org.jmx4odp.j4oNet
Class JsRegistry

java.lang.Object
  extended by org.jmx4odp.j4oNet.JsRegistry

public class JsRegistry
extends java.lang.Object

Similar in concept to a Registry, this is a repository of MBeans found on the J4ONet Federated JMX network. It uses the JmxServiceObj as a descriptor for the agents and MBeans in the network. It knows what the internal data in the JmxServiceObj represents and can garauntee that JmxServiceObj are unique.

This object is used by the J4ONet resolvers to cache discovered services and to provide fast look-up.

Coders usually should have no reason to access this object directly. Instead, they should use the JsRegistryManager.

Author:
Lucas McGregor
See Also:
JmxServiceObj, JsRegistryManager

Constructor Summary
JsRegistry()
          Creates new JsRegistry
 
Method Summary
 java.lang.String bind(JmxServiceObj jso)
          Will bind the jso to the registry.
 boolean isBound(JmxServiceObj jso)
          Returns true if this object's key is bound in the registry
 boolean isBound(java.lang.String key)
          Returns true if this key is bound in the registry
 java.lang.String[] list()
          This will return the list of keys in the registry as an array of Strings.
 JmxServiceObj lookup(JmxServiceObj jso)
          Given a sparely populated JmxServiceObject, it will generate the key via getKey() and return the JmxService bound for that name.
 JmxServiceObj lookup(java.lang.String key)
          Given a key as a String, will return the JmxService bound for that name.
 java.lang.String rebind(JmxServiceObj jso)
          Will bind the jso to the registry.
 void unbind(JmxServiceObj jso)
          Given a sparsely populated JmxServiceObj, it will generate the key via geyKey() and remove the object from the regsistry.
 void unbind(java.lang.String key)
          Given a JmxServiceObject key as a string, this will remove the object from the regsistry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JsRegistry

public JsRegistry()
Creates new JsRegistry

Method Detail

bind

public java.lang.String bind(JmxServiceObj jso)
                      throws java.lang.Exception
Will bind the jso to the registry. It will use the getKey() function to determine the key for the JmxServiceObj. This operation is synchronized.

Throws:
java.rmi.AlreadyBoundException - if this object is already bound
java.lang.Exception

rebind

public java.lang.String rebind(JmxServiceObj jso)
                        throws java.lang.Exception
Will bind the jso to the registry. It will use the getKey() function to determine the key for the JmxServiceObj. This operation is synchronized.

Throws:
java.lang.Exception

lookup

public JmxServiceObj lookup(JmxServiceObj jso)
                     throws java.lang.Exception
Given a sparely populated JmxServiceObject, it will generate the key via getKey() and return the JmxService bound for that name. If nothing is bound to that key, it will return a null JmxServiceObj.

Throws:
java.lang.Exception

lookup

public JmxServiceObj lookup(java.lang.String key)
Given a key as a String, will return the JmxService bound for that name. If nothing is bound to that key, it will return a null JmxServiceObj.


unbind

public void unbind(JmxServiceObj jso)
            throws java.lang.Exception
Given a sparsely populated JmxServiceObj, it will generate the key via geyKey() and remove the object from the regsistry. This operation is synchronized.

Throws:
java.lang.Exception

unbind

public void unbind(java.lang.String key)
Given a JmxServiceObject key as a string, this will remove the object from the regsistry. This operation is synchronized.


isBound

public boolean isBound(JmxServiceObj jso)
                throws java.lang.Exception
Returns true if this object's key is bound in the registry

Throws:
java.lang.Exception

isBound

public boolean isBound(java.lang.String key)
Returns true if this key is bound in the registry


list

public java.lang.String[] list()
This will return the list of keys in the registry as an array of Strings. This operation is synchronized so that changes cannot be made to the registry while the list is being generated.