com.sun.mfwk.discovery
Class MfDiscoveryResponder

java.lang.Object
  extended bycom.sun.mfwk.discovery.MfDiscoveryResponder

public class MfDiscoveryResponder
extends java.lang.Object

Allows to implement the discovery service on the Component Product side.

When the MfDiscoveryResponder is instantiated, a multicast socket is created. The MfDiscoveryResponder then sends a discovery RESPONSE message to the multicast group containing:

- Component Product information (Product name & instance)

- Monitoring URI

- Optional user data

This discovery RESPONSE message is also re-emitted everytime a DISCOVERY frame is received on the Multicast channel. The multicast socket default group and port can be modified setting the appropriate properties in the /etc/opt/SUNWmfwk/config/agent.properties files. The default values for the group and the port are 225.225.225.1 and 12345. These cannot be modified at run time.

NB multicast messages are only received on the local node (TTL is forced to 0)

Version:
1.0
Author:
Sun Microsystems, Inc

Constructor Summary
MfDiscoveryResponder(java.lang.String productName, java.lang.String productInstance, java.lang.String uri)
          Creates a new instance of MfDiscoveryResponder and starts it
MfDiscoveryResponder(java.lang.String productName, java.lang.String productInstance, java.lang.String uri, byte[] userData)
          Creates a new instance of MfDiscoveryResponder and starts it
MfDiscoveryResponder(java.lang.String productName, java.lang.String productInstance, java.lang.String uri, byte[] userData, byte[] encryptUserDataKey)
          Creates a new instance of MfDiscoveryResponder and starts it A mechanism is provided for encrypting the userData part provided in the MfDiscoveryResponder.
 
Method Summary
 boolean getIsUserDataEncryted()
          Return a boolean indicating wether encryption has been asked or not if it has then user defined data will be encrypted using the key when sent on Multicast channel
 java.lang.String getMulticastGroup()
          Return the multicast group
 int getMulticastPort()
          Return the multicast port
 java.lang.String getProductInstance()
          Return the product instance unique indentifier
 java.lang.String getProductName()
          Return the product name (includes version)
 int getState()
          return the current state of the responder
 java.lang.String getUri()
          Return the uri to connect to retrieve monitoring information
 byte[] getUserData()
          Return the user defined data
 byte[] getUserDataKey()
          Return the key used to encode user defined data
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MfDiscoveryResponder

public MfDiscoveryResponder(java.lang.String productName,
                            java.lang.String productInstance,
                            java.lang.String uri)
                     throws java.io.IOException
Creates a new instance of MfDiscoveryResponder and starts it

Parameters:
productName - The name of the component Product to be discovered
productInstance - The unique identifier of the instance to be discovered
uri - The unique uri where the agent should connect to retrieve monitoring information
Throws:
java.io.IOException - if an I/O error occurs

MfDiscoveryResponder

public MfDiscoveryResponder(java.lang.String productName,
                            java.lang.String productInstance,
                            java.lang.String uri,
                            byte[] userData)
                     throws java.io.IOException
Creates a new instance of MfDiscoveryResponder and starts it

Parameters:
productName - The name of the component Product to be discovered
productInstance - The unique identifier of the instance to be discovered
uri - The unique uri where the agent should connect to retrieve monitoring information
userData - The additional information that the user add to the RESP frame Allows the user to specify additional information in the discovery RESPONSE message. The following limitation applies to the length of the byte array parameter: The length of a UDP packet is maximum 64 Kbytes.
Throws:
java.io.IOException - if an I/O error occurs

MfDiscoveryResponder

public MfDiscoveryResponder(java.lang.String productName,
                            java.lang.String productInstance,
                            java.lang.String uri,
                            byte[] userData,
                            byte[] encryptUserDataKey)
                     throws java.io.IOException
Creates a new instance of MfDiscoveryResponder and starts it A mechanism is provided for encrypting the userData part provided in the MfDiscoveryResponder. The principle is that you can encrypt these data using a key and setting the flag encryptData to true. The DiscoveryClient will decode the user data *before* notifying the listener using the key in the /etc/opt/SUNWmfwk/security/disc.key. Read carefully what follows if you intend to use this mechanism - the key you provide in the API *has to be the same* as the one contained in the /etc/opt/SUNWmfwk/security/disc.key file - when you retrieve the data in the CP module using the MfDiscoveryInfo.getUserData() method, the data is already decrypted - if the keys do not match, the key is invalid (not generated with /opt/SUNWmfwk/bin/discgenkey), the key file is not there or not readable by the agent, the discovery packet will be dropped and ignored.

Parameters:
encryptUserDataKey - The key you provide in order to encrypt the userData field The key you provide in the API *has to be the same* as the one contained in the /etc/opt/SUNWmfwk/security/disc.key file
productName - The name of the component Product to be discovered
productInstance - The unique identifier of the instance to be discovered
uri - The unique uri where the agent should connect to retrieve monitoring information
userData - The additional information that the user add to the RESP frame
Throws:
java.io.IOException - if an I/O error occurs
Method Detail

getProductName

public java.lang.String getProductName()
Return the product name (includes version)

Returns:
Return the product name (includes version)

getProductInstance

public java.lang.String getProductInstance()
Return the product instance unique indentifier

Returns:
Return the product instance unique indentifier

getUri

public java.lang.String getUri()
Return the uri to connect to retrieve monitoring information

Returns:
Return the uri to connect to retrieve monitoring information

getMulticastGroup

public java.lang.String getMulticastGroup()
Return the multicast group

Returns:
Return the multicast group

getMulticastPort

public int getMulticastPort()
Return the multicast port

Returns:
Return the multicast port

getUserData

public byte[] getUserData()
Return the user defined data

Returns:
Return the user defined data

getUserDataKey

public byte[] getUserDataKey()
Return the key used to encode user defined data

Returns:
Return the key used to encode user defined data

getIsUserDataEncryted

public boolean getIsUserDataEncryted()
Return a boolean indicating wether encryption has been asked or not if it has then user defined data will be encrypted using the key when sent on Multicast channel

Returns:
Return the key used to encode user defined data

getState

public int getState()
return the current state of the responder

Returns:
1 -> OFFLINE 2 -> ONLINE