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,java.lang.Cloneable
public class MonitoringAgent extends PassphraseAgentImpl
A MonitoringAgent is responsible for sending monitoring information collected at the
MonitoringObserver. It should only be used for this task.-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringPROCESSING_SERVICE_CLASS_NAME -
Constructor Summary
Constructors Modifier Constructor Description protectedMonitoringAgent(java.security.KeyPair pair, java.lang.String passphrase, byte[] salt)Creates a new MonitoringAgent.protectedMonitoringAgent(java.security.PublicKey pubKey, byte[] encodedPrivate, byte[] salt)Creates a new MonitoringAgent with a locked private key. -
Method Summary
Modifier and Type Method Description static MonitoringAgentcreateFromXml(java.lang.String xml)Sets the state of the object from a string representation resulting from a previoustoXmlString()call.static MonitoringAgentcreateFromXml(org.w3c.dom.Element rootElement)Sets the state of the object from a string representation resulting from a previoustoXmlString()call.static MonitoringAgentcreateMonitoringAgent(java.lang.String passphrase)Create a new MonitoringAgent protected by the given passphrase.voidnotifyUnregister()Does nothing.voidreceiveMessage(Message message, AgentContext context)This method is called by the node this agent is running at.java.lang.StringtoXmlString()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, unlockPrivateKey
-
Field Details
-
PROCESSING_SERVICE_CLASS_NAME
public static final java.lang.String PROCESSING_SERVICE_CLASS_NAME- See Also:
- Constant Field Values
-
-
Constructor Details
-
MonitoringAgent
protected MonitoringAgent(java.security.KeyPair pair, java.lang.String passphrase, byte[] salt) throws AgentOperationFailedException, CryptoExceptionCreates a new MonitoringAgent.- Parameters:
pair-passphrase-salt-- Throws:
AgentOperationFailedExceptionCryptoException
-
MonitoringAgent
protected MonitoringAgent(java.security.PublicKey pubKey, byte[] encodedPrivate, byte[] salt)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(java.lang.String passphrase) throws CryptoException, AgentOperationFailedExceptionCreate 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
public java.lang.String toXmlString()Can be used to return a XML representation of the MonitoringAgent.- Returns:
- a XML representation of the MonitoringAgent
- Throws:
java.lang.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
public static MonitoringAgent createFromXml(org.w3c.dom.Element rootElement) throws MalformedXMLExceptionSets 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
-