com.adventnet.adaptors.corba
Class CorbaAdaptor

java.lang.Object
  |
  +--com.adventnet.adaptors.AbstractAdaptor
        |
        +--com.adventnet.adaptors.corba.CorbaAdaptor

public class CorbaAdaptor
extends AbstractAdaptor
implements DynamicMBean

This class acts as a JMX adaptor for IIOP protocol.

It itself acts as a mbean for exposing the Corba properties. This class extends the SimpleAdaptor which provides the implementation of ServiceInfo interface and acts as the Corba server.

See Also:
Serialized Form

Inner classes inherited from class com.adventnet.adaptors.AbstractAdaptor
AbstractAdaptor.ProcessNotification
 
Field Summary
(package private)  java.lang.String classpath
           
(package private)  java.lang.String cmd
           
static java.lang.String factoryName
          The CorbaFactory interface NameComponent string with which it is registered immediately to the rootcontext(i.e NameService).
(package private)  java.lang.String java_home
           
(package private)  java.lang.Process p
           
 
Fields inherited from class com.adventnet.adaptors.AbstractAdaptor
handleNotificationinNewThread, notifications, port, processnotification, state
 
Constructor Summary
CorbaAdaptor()
          The default constructor for CorbaAdaptor.By default,corba server will be initialized at port 1050.
CorbaAdaptor(int portNo, MBeanServer server)
          The two Arg constructor initializes the CorbaAdaptor at the port specified by portNo
 
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 Corba Adaptor to the Naming Service
 void destroyAdaptor()
          Allows the service to get stopped.
 void enableAuthentication(boolean enable)
          Enables Authentication for the RMI Adaptor
 void enableAuthorisation(boolean enable)
          Enables Authorisation for the RMI Adaptor
 ObjectName getAdaptorObjectName()
          Returns the ObjectName with which the Adaptor is registered with the MBean server
 java.lang.String getAdaptorVersion()
          Gets the version of the adaptor.
 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 getPersistentName()
          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 Corba Adaptor.By default,Corba Adaptor will be initialized at port 1050
 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 Authenticatio 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 setPersistentName(java.lang.String name)
          Sets the name of the serialized file in which the User Context details are stored.
 void setPort(java.lang.Integer port)
           
 void unbind()
          Unbinds the Corba Adaptor from the Naming Service
 
Methods inherited from class com.adventnet.adaptors.AbstractAdaptor
addNotificationListener, changeState, getHost, getNotificationInfo, getPort, getState, getStateInString, handleNotification, isActive, isSecure, processNotification, removeNotificationListener, setPort, startService, stopService
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

factoryName

public static final java.lang.String factoryName
The CorbaFactory interface NameComponent string with which it is registered immediately to the rootcontext(i.e NameService). The default string is "AdventnetCorbaFactory" .

p

java.lang.Process p

cmd

java.lang.String cmd

classpath

java.lang.String classpath

java_home

java.lang.String java_home
Constructor Detail

CorbaAdaptor

public CorbaAdaptor()
The default constructor for CorbaAdaptor.By default,corba server will be initialized at port 1050.

CorbaAdaptor

public CorbaAdaptor(int portNo,
                    MBeanServer server)
The two Arg constructor initializes the CorbaAdaptor at the port specified by portNo
Parameters:
portNo - the port at which the CorbaAdaptor has to be initialized
server - the MBean server to which the adaptor will be registered
Method Detail

setPort

public void setPort(java.lang.Integer port)
             throws java.lang.Exception

getAdaptorObjectName

public ObjectName getAdaptorObjectName()
Returns the ObjectName with which the Adaptor is registered with the MBean server
Overrides:
getAdaptorObjectName in class AbstractAdaptor
Returns:
the ObjectName of the Adaptor with which it gets registered with the MBean server

addUser

public void addUser(com.adventnet.agent.security.UserContext userContext)
Adds the users specified in the UserContext to the Authentication List of the Adaptor
Parameters:
userContext - the UserContext which has to be added

removeUser

public void removeUser(com.adventnet.agent.security.UserContext userContext)
Removes the users specified in the UserContext from the Authenticatio List of the Adaptor
Parameters:
userContext - the UserContext which has to be removed

setPersistentName

public void setPersistentName(java.lang.String name)
Sets the name of the serialized file in which the User Context details are stored.
Parameters:
name - name of the Serialized file

getPersistentName

public java.lang.String getPersistentName()
Returns the name of the serialized file in which the User Context details are stored.
Returns:
the name of the file

getMBeanInfo

public MBeanInfo getMBeanInfo()
This method discovers the attributes and operations this MBean exposes for management.
Specified by:
getMBeanInfo in interface DynamicMBean
Returns:
An instance of MBeanInfo allowing to retrieve all attributes and operations of this MBean.

getAttribute

public java.lang.Object getAttribute(java.lang.String attribute)
                              throws AttributeNotFoundException,
                                     MBeanException,
                                     ReflectionException
Gets the value of a specific attribute of this MBean.
Specified by:
getAttribute in interface DynamicMBean
Parameters:
attribute - A String specifying the name of the attribute to be retrieved.
Returns:
The value of the retrieved attribute.
Throws:
AttributeNotFoundException - The specified attribute is not accessible in the MBean.
MBeanException - Wraps an exception thrown by the MBean's getter.
ReflectionException - Wraps an java.lang.Exception thrown while trying to invoke the setter.

getAttributes

public AttributeList getAttributes(java.lang.String[] attributes)
Enables the values of several attributes of this MBean.
Specified by:
getAttributes in interface DynamicMBean
Parameters:
attributes - A list of attributes to be retrieved.
Returns:
The value of the retrieved attributes as attributeList.

invoke

public java.lang.Object invoke(java.lang.String actionName,
                               java.lang.Object[] params,
                               java.lang.String[] signature)
                        throws MBeanException,
                               ReflectionException
Invokes an action on the original MBean associated with this MBean.
Specified by:
invoke in interface DynamicMBean
Parameters:
actionName - The name of the action to be invoked.
params - An array containing the parameters to be set when the action is invoked
signature - 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.
Returns:
The object returned by the action, which represents the result of invoking the action on the specified MBean.
Throws:
MBeanException - Wraps an exception thrown by the MBean's getter.
ReflectionException - Wraps an java.lang.Exception thrown while trying to invoke the setter.

setAttribute

public void setAttribute(Attribute attribute)
                  throws AttributeNotFoundException,
                         InvalidAttributeValueException,
                         MBeanException,
                         ReflectionException
Sets the value of a specific attribute of this MBean.
Specified by:
setAttribute in interface DynamicMBean
Parameters:
attribute - The identification of the attribute to be set and the value it is to be set to.
Returns:
The value of the attribute that has been set.
Throws:
AttributeNotFoundException - The specified attribute is not accessible in the MBean.
InvalidAttributeValueException - The specified value for the attribute is not valid.
MBeanException - Wraps an exception thrown by the MBean's getter.
ReflectionException - Wraps an java.lang.Exception thrown while trying to invoke the setter.

setAttributes

public AttributeList setAttributes(AttributeList attributes)
Sets the values of several attributes of this MBean.
Specified by:
setAttributes in interface DynamicMBean
Parameters:
attributes - A list of attributes: The identification of the attributes to be set and the values they are to be set to.
Returns:
The list of attributes that were set, with their new values.

instantiateAdaptor

public void instantiateAdaptor()
Instantiates the Corba Adaptor.By default,Corba Adaptor will be initialized at port 1050
Overrides:
instantiateAdaptor in class AbstractAdaptor

bind

public void bind()
Binds the Corba Adaptor to the Naming Service
Overrides:
bind in class AbstractAdaptor

unbind

public void unbind()
Unbinds the Corba Adaptor from the Naming Service
Overrides:
unbind in class AbstractAdaptor

preRegister

public ObjectName preRegister(MBeanServer server,
                              ObjectName name)
                       throws java.lang.Exception
This method is an implementation of MBeanRegistration interface. Allows this MBean to perform any operations it needs before being registered in the MBeanServer. If the name of the MBean is not specified, the MBean can provide a name for its registration. If any exception is raised, the MBean will not be registered with the MBeanServer.

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(CORBA) gets started at the default port 1050.

Overrides:
preRegister in class AbstractAdaptor
Parameters:
server - The MBeanServer in which the MBean will be registered.
name - The object name of the MBean.
Returns:
The name of the MBean registered.
Throws:
java.lang.Exception - This exception should be caught by the MBeanServer and re-thrown as an MBeanRegistrationException.

postRegister

public 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.
Overrides:
postRegister in class AbstractAdaptor
Parameters:
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.

preDeregister

public void preDeregister()
                   throws java.lang.Exception
Allows this MBean to perform any operations it needs before being de-registered by the MBeanServer.
Overrides:
preDeregister in class AbstractAdaptor
Throws:
java.langException - This exception should be caught by the MBeanServer and re-thrown as an MBeanRegistrationException.

postDeregister

public void postDeregister()
Allows this MBean to perform any operations needed after having been de-registered in the MBeanServer.
Overrides:
postDeregister in class AbstractAdaptor

destroyAdaptor

public void destroyAdaptor()
Allows the service to get stopped.
Overrides:
destroyAdaptor in class AbstractAdaptor

getObjectName

public java.lang.String getObjectName()
Returns the ObjectName of this adaptor with which it has been registered with the MBeanServer.
Returns:
the ObjectName

getAdaptorVersion

public java.lang.String getAdaptorVersion()
Gets the version of the adaptor.
Overrides:
getAdaptorVersion in class AbstractAdaptor
Returns:
The version of the adaptor.

getProtocol

public java.lang.String getProtocol()
Gets the protocol supported by this adaptor.
Overrides:
getProtocol in class AbstractAdaptor
Returns:
The protocol supported by this adaptor.

enableAuthorisation

public void enableAuthorisation(boolean enable)
                         throws java.lang.UnsupportedOperationException
Enables Authorisation for the RMI Adaptor
Overrides:
enableAuthorisation in class AbstractAdaptor
Parameters:
enable - Enables Authorisation if the value is true

enableAuthentication

public void enableAuthentication(boolean enable)
                          throws java.lang.UnsupportedOperationException
Enables Authentication for the RMI Adaptor
Overrides:
enableAuthentication in class AbstractAdaptor
Parameters:
enable - Enables Authentication if the value is true