Package i5.las2peer.security
Class MonitoringAgent
java.lang.Object
i5.las2peer.security.AgentImpl
i5.las2peer.security.PassphraseAgentImpl
i5.las2peer.security.MonitoringAgent
- All Implemented Interfaces:
Agent,PassphraseAgent,MessageReceiver,XmlAble,Cloneable
A MonitoringAgent is responsible for sending monitoring information collected at the
MonitoringObserver. It should only be used for this task.-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedMonitoringAgent(KeyPair pair, String passphrase, byte[] salt) Creates a new MonitoringAgent.protectedMonitoringAgent(PublicKey pubKey, byte[] encodedPrivate, byte[] salt) Creates a new MonitoringAgent with a locked private key. -
Method Summary
Modifier and TypeMethodDescriptionstatic MonitoringAgentcreateFromXml(String xml) Sets the state of the object from a string representation resulting from a previoustoXmlString()call.static MonitoringAgentcreateFromXml(Element rootElement) Sets the state of the object from a string representation resulting from a previoustoXmlString()call.static MonitoringAgentcreateMonitoringAgent(String passphrase) Create a new MonitoringAgent protected by the given passphrase.voidDoes nothing.voidreceiveMessage(Message message, AgentContext context) This method is called by the node this agent is running at.Can be used to return a XML representation of the MonitoringAgent.Methods inherited from class i5.las2peer.security.PassphraseAgentImpl
changePassphrase, getPassphrase, getSalt, lockPrivateKey, unlock, unlockPrivateKeyMethods inherited from class i5.las2peer.security.AgentImpl
cloneLocked, createFromXml, createFromXml, createSignature, decryptSymmetricKey, encryptPrivateKey, equals, getEncodedPrivate, getIdentifier, getPublicKey, getResponsibleForAgentSafeId, getRunningAtNode, isLocked, notifyRegistrationTo, signContent, unlockPrivateKeyMethods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface i5.las2peer.api.security.Agent
getIdentifier, isLocked
-
Field Details
-
PROCESSING_SERVICE_CLASS_NAME
- See Also:
-
-
Constructor Details
-
MonitoringAgent
protected MonitoringAgent(KeyPair pair, String passphrase, byte[] salt) throws AgentOperationFailedException, CryptoException Creates a new MonitoringAgent.- Parameters:
pair-passphrase-salt-- Throws:
AgentOperationFailedExceptionCryptoException
-
MonitoringAgent
Creates a new MonitoringAgent with a locked private key. Used withincreateFromXml(java.lang.String).- Parameters:
pubKey-encodedPrivate-salt-
-
-
Method Details
-
createMonitoringAgent
public static MonitoringAgent createMonitoringAgent(String passphrase) throws CryptoException, AgentOperationFailedException Create a new MonitoringAgent protected by the given passphrase.- Parameters:
passphrase- passphrase for the secret key of the new agent- Returns:
- a new UserAgent
- Throws:
CryptoExceptionAgentOperationFailedException
-
receiveMessage
This method is called by the node this agent is running at. In this context, it is used to receive monitoring messages send by theMonitoringObservers of the monitored nodes to the central processing service. Every other type of communication (to agents not resided at the monitoring node, other types of content thanMonitoringMessages will result in an Exception.- Specified by:
receiveMessagein interfaceMessageReceiver- Specified by:
receiveMessagein classAgentImpl- Parameters:
message-context-- Throws:
MessageException
-
toXmlString
Can be used to return a XML representation of the MonitoringAgent.- Returns:
- a XML representation of the MonitoringAgent
- Throws:
RuntimeException- thrown, if problems with the serialization came up
-
createFromXml
Sets the state of the object from a string representation resulting from a previoustoXmlString()call. Usually, a standard constructor is used to get a fresh instance of the class and to set the complete state via this method.- Parameters:
xml- a String- Returns:
- Returns a new agent instance
- Throws:
MalformedXMLException
-
createFromXml
Sets the state of the object from a string representation resulting from a previoustoXmlString()call.- Parameters:
rootElement- parsed XML document- Returns:
- Returns a new agent instance
- Throws:
MalformedXMLException
-
notifyUnregister
public void notifyUnregister()Does nothing.- Specified by:
notifyUnregisterin interfaceMessageReceiver- Overrides:
notifyUnregisterin classAgentImpl
-