|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.adventnet.adaptors.AbstractAdaptor
com.adventnet.adaptors.http.HttpConnector
public class HttpConnector
This class acts as a Connector for HTTP access to mbeans in Multi-Protocol.
It itself acts as a mbean for exposing the http properties. This class extends the AbstractAdaptor which provides the implementation of ServiceInfo interface and acts as the http-server.
The port number of the service can be specified in the ObjectName with key-value pair as, port=8050(by default)
For example, to start the web-server at 8200, you can specify the following object name:
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.adventnet.adaptors.AbstractAdaptor |
|---|
AbstractAdaptor.ProcessNotification |
| Field Summary | |
|---|---|
static HttpAuthTable |
httpAuth
|
(package private) static java.lang.String |
parentDir
|
| Fields inherited from class com.adventnet.adaptors.AbstractAdaptor |
|---|
notifications, port, processnotification, state |
| Constructor Summary | |
|---|---|
HttpConnector()
The NoArg constructor used to initialize the HttpAdaptor in forming the MBeanInfo and getting the reference of the MBeanServer using the MBeanServerFactory.findMBeanServer(null) method. |
|
HttpConnector(int portNum)
|
|
HttpConnector(java.lang.Integer portNum)
|
|
HttpConnector(java.lang.Integer portNum,
javax.management.MBeanServer MBServer)
This constructor used to initialize the HttpAdaptor in forming the MBeanInfo and getting the reference of the MBeanServer using the input parameter portNum and MBServer. |
|
| Method Summary | |
|---|---|
void |
addHttpServerInterface(HttpServerInterface httpServerInterface)
Adds HttpServerInterface for controlling WebServer. |
static boolean |
authenticate(com.adventnet.agent.security.UserContext userContext)
Deprecated |
void |
bind()
Must be used to bind to a naming service or to bind to a ServerSocket |
void |
destroyAdaptor()
Kills the adaptor and releases all its resources |
void |
enableAuthentication(boolean authFlag)
enables the authentication feature of the adaptor. |
void |
enableAuthorisation(boolean authFlag)
enables the authorisation feature of the adaptor. |
javax.management.ObjectName |
getAdaptorObjectName()
Returns the ObjectName of this adaptor with which it has been registered with the MBeanServer. |
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. |
javax.management.AttributeList |
getAttributes(java.lang.String[] attributes)
Gets the value of a all attributes of this MBean. |
javax.management.MBeanInfo |
getMBeanInfo()
This method discovers the attributes and operations this MBean exposes for management. |
static javax.management.MBeanServer |
getMBeanServer()
|
java.lang.String |
getObjectName()
Returns the ObjectName of this adaptor with which it has been registered with the MBeanServer. |
static java.lang.String |
getParentDirectory()
Gets the parent directory for this adaptor |
java.lang.String |
getProtocol()
Gets the protocol supported by this adaptor. |
void |
instantiateAdaptor()
Must be implemented by the adaptor and should be used to instantiate itsefl |
java.lang.Object |
invoke(java.lang.String actionName,
java.lang.Object[] params,
java.lang.String[] signature)
Invokes an action on this MBean. |
static boolean |
isAuthenticated()
Deprecated |
static boolean |
isAuthorised()
Deprecated |
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. |
javax.management.ObjectName |
preRegister(javax.management.MBeanServer server,
javax.management.ObjectName name)
This method is an implementation of MBeanRegistration interface. |
void |
processClientRequests()
|
void |
registerAuthentication()
|
void |
restartHttpServer()
Restarts the WebServer. |
void |
run()
Getter for MBean server. |
void |
setAttribute(javax.management.Attribute attribute)
Sets the value of a specific attribute of this MBean. |
javax.management.AttributeList |
setAttributes(javax.management.AttributeList attributes)
Sets the values of several attributes of this MBean. |
static void |
setParentDir(java.lang.String dirName)
|
void |
startHttpServer()
Invoke the HTTP server in a thread. |
void |
startService()
Allows the web-server to get started. |
void |
stopHttpServer()
Method to stop the http server. |
void |
stopService()
Allows the web-server to get stopped. |
void |
unbind()
Must be used to unbind from a naming service or to relese a ServerSocket |
| Methods inherited from class com.adventnet.adaptors.AbstractAdaptor |
|---|
addNotificationListener, changeState, getHost, getNotificationInfo, getPort, getState, getStateInString, handleNotification, isActive, isSecure, processNotification, removeNotificationListener, setPort |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static HttpAuthTable httpAuth
static java.lang.String parentDir
| Constructor Detail |
|---|
public HttpConnector()
public HttpConnector(int portNum)
public HttpConnector(java.lang.Integer portNum)
public HttpConnector(java.lang.Integer portNum,
javax.management.MBeanServer MBServer)
| Method Detail |
|---|
public static boolean authenticate(com.adventnet.agent.security.UserContext userContext)
public static boolean isAuthenticated()
public static boolean isAuthorised()
public javax.management.MBeanInfo getMBeanInfo()
getMBeanInfo in interface javax.management.DynamicMBean
public java.lang.Object getAttribute(java.lang.String attribute)
throws javax.management.AttributeNotFoundException,
javax.management.MBeanException,
javax.management.ReflectionException
getAttribute in interface javax.management.DynamicMBeanattribute - A String specifying the name of the
attribute to be retrieved.
javax.management.AttributeNotFoundException
javax.management.MBeanException
javax.management.ReflectionExceptionpublic javax.management.AttributeList getAttributes(java.lang.String[] attributes)
getAttributes in interface javax.management.DynamicMBeanattributes - 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 javax.management.MBeanException,
javax.management.ReflectionException
invoke in interface javax.management.DynamicMBeanactionName - 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.
javax.management.MBeanException
javax.management.ReflectionException
public void setAttribute(javax.management.Attribute attribute)
throws javax.management.AttributeNotFoundException,
javax.management.InvalidAttributeValueException,
javax.management.MBeanException,
javax.management.ReflectionException
setAttribute in interface javax.management.DynamicMBeanattribute - The identification of the attribute to
be set and the value it is to be set to.
javax.management.AttributeNotFoundException
javax.management.InvalidAttributeValueException
javax.management.MBeanException
javax.management.ReflectionExceptionpublic javax.management.AttributeList setAttributes(javax.management.AttributeList attributes)
setAttributes in interface javax.management.DynamicMBeanattributes - A list of attributes: The identification
of the attributes to be set and the values they are to be set to.
public javax.management.ObjectName preRegister(javax.management.MBeanServer server,
javax.management.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(http - server) gets started at the default port 8050.
preRegister in interface javax.management.MBeanRegistrationpreRegister in class AbstractAdaptorserver - 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 postRegister(java.lang.Boolean registrationDone)
postRegister in interface javax.management.MBeanRegistrationpostRegister in class AbstractAdaptorregistrationDone - 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 interface javax.management.MBeanRegistrationpreDeregister in class AbstractAdaptorjava.langException - This exception should be caught by the MBeanServer and
re-thrown as an MBeanRegistrationException.
java.lang.Exceptionpublic void postDeregister()
postDeregister in interface javax.management.MBeanRegistrationpostDeregister in class AbstractAdaptor
public void startService()
throws java.lang.IllegalStateException,
java.lang.Exception
startService in interface AdaptorstartService in class AbstractAdaptorjava.lang.IllegalStateException - when the adaptor is in STARTED or STARTING state
java.lang.Exception
public void stopService()
throws java.lang.IllegalStateException
stopService in interface AdaptorstopService in class AbstractAdaptorjava.lang.IllegalStateException - when the adaptor is in STOPPED or STOPPING statepublic void enableAuthentication(boolean authFlag)
enableAuthentication in interface AdaptorenableAuthentication in class AbstractAdaptorpublic void enableAuthorisation(boolean authFlag)
enableAuthorisation in interface AdaptorenableAuthorisation in class AbstractAdaptorpublic void processClientRequests()
public void instantiateAdaptor()
throws java.lang.InstantiationException
AbstractAdaptor
instantiateAdaptor in class AbstractAdaptorjava.lang.InstantiationExceptionpublic void bind()
AbstractAdaptor
bind in class AbstractAdaptorpublic void unbind()
AbstractAdaptor
unbind in class AbstractAdaptorpublic void registerAuthentication()
public void destroyAdaptor()
AbstractAdaptor
destroyAdaptor in class AbstractAdaptorpublic javax.management.ObjectName getAdaptorObjectName()
getAdaptorObjectName in interface AdaptorgetAdaptorObjectName in class AbstractAdaptorpublic java.lang.String getObjectName()
public void run()
run in interface java.lang.Runnable
public void startHttpServer()
throws java.lang.Exception
java.lang.Exceptionpublic void stopHttpServer()
public void restartHttpServer()
public java.lang.String getAdaptorVersion()
getAdaptorVersion in interface AdaptorgetAdaptorVersion in class AbstractAdaptorpublic java.lang.String getProtocol()
getProtocol in interface AdaptorgetProtocol in class AbstractAdaptorpublic void addHttpServerInterface(HttpServerInterface httpServerInterface)
httpServerInterface - The HttpServerInterface of the user.public static void setParentDir(java.lang.String dirName)
public static java.lang.String getParentDirectory()
public static javax.management.MBeanServer getMBeanServer()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||