|
XMOJO 5 API Docs | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.adventnet.adaptors.AbstractAdaptor | +--com.adventnet.adaptors.rmi.RMIAdaptor
This class acts as a JMX adaptor for RMI protocol.
It itself acts as a mbean for exposing the RMI properties. This class extends the SimpleAdaptor which provides the implementation of ServiceInfo interface and acts as the RMI server.
The port number of the service can be specified in the ObjectName with key-value pair as, port=1099(by default)
For example, to start the RMI server at 1150, you can specify the following object name:
Field Summary | |
java.rmi.registry.Registry |
registry
|
Fields inherited from class com.adventnet.adaptors.AbstractAdaptor |
port, state |
Constructor Summary | |
RMIAdaptor()
The NoArg constructor used to initialize the RMIAdaptor in forming the MBeanInfo and getting the reference of the MBeanServer using the MBeanServer.findJMXAgent(...) method. |
Method Summary | |
void |
addUser(com.adventnet.agent.security.UserContext userContext)
Adds the users specified in the UserContext to the Authentication List of the Adaptor |
void |
bind()
Binds the rmi server at the specified port |
void |
destroyAdaptor()
Removes the RemoteMBeanServerImpl from the RMI runtime |
void |
enableAuthentication(boolean authenticate)
Enables Authentication for the RMI Adaptor |
void |
enableAuthorisation(boolean authorise)
Enables Authorisation for the RMI Adaptor |
ObjectName |
getAdaptorObjectName()
Returns the ObjectName of this adaptor with which it has been registered with the MBeanServer. |
java.lang.Object |
getAttribute(java.lang.String attribute)
Gets the value of a specific attribute of this MBean. |
AttributeList |
getAttributes(java.lang.String[] attributes)
Enables the values of several attributes of this MBean. |
MBeanInfo |
getMBeanInfo()
This method discovers the attributes and operations this MBean exposes for management. |
java.lang.String |
getObjectName()
Returns the ObjectName of this adaptor with which it has been registered with the MBeanServer. |
java.lang.String |
getPersistantName()
Returns the name of the serialized file in which the User Context details are stored. |
java.lang.String |
getProtocol()
Gets the protocol supported by this adaptor. |
void |
instantiateAdaptor()
Instantiates the RMI Adaptor |
java.lang.Object |
invoke(java.lang.String actionName,
java.lang.Object[] params,
java.lang.String[] signature)
Invokes an action on the original MBean associated with this MBean. |
void |
postDeregister()
Allows this MBean to perform any operations needed after having been de-registered in the MBeanServer. |
void |
postRegister(java.lang.Boolean registrationDone)
Allows this MBean to perform any operations needed after having been registered in the MBeanServer or after the registration has failed. |
void |
preDeregister()
Allows this MBean to perform any operations it needs before being de-registered by the MBeanServer. |
ObjectName |
preRegister(MBeanServer server,
ObjectName name)
This method is an implementation of MBeanRegistration interface. |
void |
removeUser(com.adventnet.agent.security.UserContext userContext)
Removes the users specified in the UserContext from the Authentication List of the Adaptor |
void |
setAttribute(Attribute attribute)
Sets the value of a specific attribute of this MBean. |
AttributeList |
setAttributes(AttributeList attributes)
Sets the values of several attributes of this MBean. |
void |
setPersistantName(java.lang.String fileName)
Sets the name of the serialized file in which the User Context details are stored |
void |
setPort(java.lang.Integer port)
|
java.rmi.registry.Registry |
startRegistry(int port)
Starts the RMI Registry at the specified port. |
void |
unbind()
Allows the service to get stopped. |
Methods inherited from class com.adventnet.adaptors.AbstractAdaptor |
addNotificationListener, changeState, getAdaptorVersion, getHost, getNotificationInfo, getPort, getState, getStateInString, isActive, isSecure, removeNotificationListener, setPort, startService, stopService |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public java.rmi.registry.Registry registry
Constructor Detail |
public RMIAdaptor()
Method Detail |
public void setPort(java.lang.Integer port) throws java.lang.Exception
public void setPersistantName(java.lang.String fileName)
fileName
- The name of the file in which the User Context details are to be storedpublic java.lang.String getPersistantName()
public MBeanInfo getMBeanInfo()
getMBeanInfo
in interface DynamicMBean
public java.lang.Object getAttribute(java.lang.String attribute) throws AttributeNotFoundException, MBeanException, ReflectionException
getAttribute
in interface DynamicMBean
attribute
- A String specifying the name of the
attribute to be retrieved.AttributeNotFoundException
- The
specified attribute is not accessible in the MBean.MBeanException
- The constructor of the MBean has
thrown an exceptionReflectionException
- Wraps a
ClassNotFoundException or a java.lang.Exception that occured trying to
invoke the MBean's constructor.public AttributeList getAttributes(java.lang.String[] attributes)
getAttributes
in interface DynamicMBean
attributes
- A list of attributes to be retrieved.public java.lang.Object invoke(java.lang.String actionName, java.lang.Object[] params, java.lang.String[] signature) throws MBeanException, ReflectionException
invoke
in interface DynamicMBean
actionName
- The name of the action to be invoked.params
- An array containing the parameters to be
set when the action is invokedsignature
- An array containing the signature of
the action. The class objects will be loaded using the
same class loader as the one used for loading the MBean
on which the action was invoked.MBeanException
- The constructor of the MBean has
thrown an exceptionReflectionException
- Wraps a
ClassNotFoundException or a java.lang.Exception that occured trying to
invoke the MBean's constructor.public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException
setAttribute
in interface DynamicMBean
attribute
- The identification of the attribute to
be set and the value it is to be set to.AttributeNotFoundException
- The
specified attribute is not accessible in the MBean.InvalidAttributeValueException
- The
specified value for the attribute is not valid.MBeanException
- The constructor of the MBean has
thrown an exceptionReflectionException
- Wraps a
ClassNotFoundException or a java.lang.Exception that occured trying to
invoke the MBean's constructor.public AttributeList setAttributes(AttributeList attributes)
setAttributes
in interface DynamicMBean
attributes
- A list of attributes: The identification
of the attributes to be set and the values they are to be set to.public ObjectName preRegister(MBeanServer server, ObjectName name) throws java.lang.Exception
This method is called by the MBeanServer before this mbean getting registered with the server. If the passed objectName is invalid, the returned objectName is taken as valid name to get registered with the server.
The service gets actually started only inside this method at the specified port mentioned in the key "port". If the key "port" is absent, then the service(RMI) gets started at the default port 1099. The rmiregistry gets created here. If suppose the port is already occupied, the server creation gets failed. If registry is started already in the same port, inorder to use it ,the already started registry should have the classpath to the rmi skeleton files.
preRegister
in class AbstractAdaptor
server
- The MBeanServer in which the MBean will be registered.name
- The object name of the MBean.java.lang.Exception
- This exception should be caught by the MBeanServer and
re-thrown as an MBeanRegistrationException.public void instantiateAdaptor() throws java.lang.InstantiationException
instantiateAdaptor
in class AbstractAdaptor
public void bind()
bind
in class AbstractAdaptor
public java.rmi.registry.Registry startRegistry(int port) throws java.rmi.RemoteException
port
- The port at which the RMI Registry has to be startedjava.rmi.RemoteException
- when thepublic void postRegister(java.lang.Boolean registrationDone)
postRegister
in class AbstractAdaptor
registrationDone
- Indicates whether or not the MBean has been successfully
registered in the MBeanServer. The value false means that either the registration phase
has failed.public void preDeregister() throws java.lang.Exception
preDeregister
in class AbstractAdaptor
java.langException
- This exception should be caught by the MBeanServer and
re-thrown as an MBeanRegistrationException.public void postDeregister()
postDeregister
in class AbstractAdaptor
public void unbind()
unbind
in class AbstractAdaptor
public ObjectName getAdaptorObjectName()
getAdaptorObjectName
in class AbstractAdaptor
public java.lang.String getObjectName()
public java.lang.String getProtocol()
getProtocol
in class AbstractAdaptor
public void enableAuthentication(boolean authenticate)
enableAuthentication
in class AbstractAdaptor
authenticate
- Enables Authentication if the value is truepublic void enableAuthorisation(boolean authorise)
enableAuthorisation
in class AbstractAdaptor
authorise
- Enables Authentication if the value is truepublic void addUser(com.adventnet.agent.security.UserContext userContext)
userContext
- The UserContext which has to be addedpublic void removeUser(com.adventnet.agent.security.UserContext userContext)
userContext
- The UserContext which has to be removedpublic void destroyAdaptor()
destroyAdaptor
in class AbstractAdaptor
RemoteMBeanServerImpl
|
XMOJO 5 API Docs | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |