Package i5.las2peer.p2p
Class NodeInformation
java.lang.Object
i5.las2peer.p2p.NodeInformation
- All Implemented Interfaces:
XmlAble
A NodeInformation gives basic information about a node.
-
Constructor Summary
ConstructorDescriptioncreate a new standard node informationNodeInformation
(ServiceAgentImpl[] hostedServiceAgents) create a standard node information for a node hosting the given services -
Method Summary
Modifier and TypeMethodDescriptionstatic NodeInformation
createFromXml
(String xml) factory create a node information instance from an XML stringstatic NodeInformation
createFromXmlFile
(String filename) factory: create a NodeInformation instance from a XML filestatic NodeInformation
createFromXmlFile
(String filename, ServiceAgentImpl[] serviceAgents) factory: create a NodeInformation instance from a XML file and set the hosted servicesget the admin email address of this node informationget the name of the admin stored in this informationget the description entryget an array with the class names of all services hosted at the node described with this informationget the handle of the described nodeget the public encryption key of the nodeget the organization, this node is hosted bybyte[]
byte[]
the content for the signatureboolean
check, if all relevant information is givenstatic void
command line tool for generating a description XML filevoid
setNodeHandle
(Serializable nodeHandle) for the node itself: deliver the handlevoid
setNodeKey
(PublicKey nodeKey) for the node itself: deliver the keyvoid
setSignature
(byte[] signature) for the node itself: set the signature before sendingtoString()
return all information stored here as XML stringReturns a XML representation of this object.void
verify the signature
-
Constructor Details
-
NodeInformation
public NodeInformation()create a new standard node information -
NodeInformation
create a standard node information for a node hosting the given services- Parameters:
hostedServiceAgents
- A bunch of service agents hosted on this node
-
-
Method Details
-
getOrganization
get the organization, this node is hosted by- Returns:
- organization name
-
getAdminName
get the name of the admin stored in this information- Returns:
- admin real name
-
getAdminEmail
get the admin email address of this node information- Returns:
- email address
-
getDescription
get the description entry- Returns:
- a node description
-
getHostedServices
get an array with the class names of all services hosted at the node described with this information- Returns:
- array with service class names
-
setSignature
public void setSignature(byte[] signature) for the node itself: set the signature before sending- Parameters:
signature
- A signature to set
-
getSignature
public byte[] getSignature() -
setNodeHandle
for the node itself: deliver the handle- Parameters:
nodeHandle
- A node handle to set
-
setNodeKey
for the node itself: deliver the key- Parameters:
nodeKey
- A node public key to set
-
verifySignature
verify the signature- Throws:
InternalSecurityException
- If verifying the signature fails
-
getSignatureContent
public byte[] getSignatureContent()the content for the signature- Returns:
- an array containing the signature content as bytes
-
getNodeHandle
get the handle of the described node- Returns:
- a node handle, either Long or NodeHandle
-
getNodeKey
get the public encryption key of the node- Returns:
- the public node key
-
isComplete
public boolean isComplete()check, if all relevant information is given- Returns:
- true, if at least node key, signature and node handle are provided.
-
toXmlString
Description copied from interface:XmlAble
Returns a XML representation of this object.- Specified by:
toXmlString
in interfaceXmlAble
- Returns:
- a XML String representation
-
toString
return all information stored here as XML string -
createFromXmlFile
public static NodeInformation createFromXmlFile(String filename) throws MalformedXMLException, IOException factory: create a NodeInformation instance from a XML file- Parameters:
filename
- A name for a file containing the XML data- Returns:
- the node information contained in the given XML file
- Throws:
MalformedXMLException
- If the XML data is malformedIOException
- If reading the file fails
-
createFromXmlFile
public static NodeInformation createFromXmlFile(String filename, ServiceAgentImpl[] serviceAgents) throws MalformedXMLException, IOException factory: create a NodeInformation instance from a XML file and set the hosted services- Parameters:
filename
- A filename to read fromserviceAgents
- A bunch of service agents hosted on this node- Returns:
- a node information
- Throws:
MalformedXMLException
- If the XML data is malformedIOException
- If reading the file fails
-
createFromXml
factory create a node information instance from an XML string- Parameters:
xml
- An XML data string- Returns:
- node information contained in the given XML string
- Throws:
MalformedXMLException
- If the XML data string is malformed
-
main
command line tool for generating a description XML file- Parameters:
argv
- A bunch of args
-