|
|||||||||
| 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.html.HtmlAdaptor
public class HtmlAdaptor
This class acts as a JMX adaptor for HTTP access to mbeans.
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 web-server.
For example, to start the web-server at 8050, you can specify the following object name:
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.adventnet.adaptors.AbstractAdaptor |
|---|
AbstractAdaptor.ProcessNotification |
| Field Summary | |
|---|---|
(package private) static java.util.Hashtable |
authTable
|
(package private) boolean |
firstAccess
|
static HtmlAuthTable |
htmlAuth
|
(package private) HtmlAdaptorInitializer |
init
|
(package private) static java.util.ArrayList |
logContainer
|
(package private) static java.lang.String |
parentDir
|
static boolean |
readFromJarFile
Specifies whether read from Jar File is enabled; the default is false. |
| Fields inherited from class com.adventnet.adaptors.AbstractAdaptor |
|---|
notifications, port, processnotification, state |
| Constructor Summary | |
|---|---|
HtmlAdaptor()
The NoArg constructor used to initialize the HtmlAdaptor in forming the MBeanInfo and getting the reference of the MBeanServer using the MBeanServerFactory.findMBeanServer(..) method. |
|
HtmlAdaptor(boolean isJarFile)
This constructor used to initialize the HtmlAdaptor in forming the MBeanInfo and getting the reference of the MBeanServer using the MBeanServerFactory.findMBeanServer(..) method. |
|
HtmlAdaptor(int portNum)
This constructor used to initialize the HtmlAdaptor in forming the MBeanInfo and getting the reference of the MBeanServer using the MBeanServerFactory.findMBeanServer(..) method. |
|
HtmlAdaptor(java.lang.Integer portNum)
|
|
HtmlAdaptor(java.lang.Integer portNum,
javax.management.MBeanServer MBServer)
This constructor used to initialize the HtmlAdaptor in forming the MBeanInfo and getting the reference of the MBeanServer using the MBeanServerFactory.findMBeanServer(..) method. |
|
HtmlAdaptor(java.lang.Integer portNum,
javax.management.MBeanServer MBServer,
boolean isJarFile)
This constructor used to initialize the HtmlAdaptor in forming the MBeanInfo and getting the reference of the MBeanServer using the MBeanServerFactory.findMBeanServer(..) method. |
|
HtmlAdaptor(java.lang.String homeDir)
This constructor will be used to initialize the HtmlAdaptor (when the application is started from a different application directory) in forming the MBeanInfo and getting the reference of the MBeanServer using the MBeanServerFactory.findMBeanServer(..) method. |
|
| Method Summary | |
|---|---|
void |
addDataTypeHandler(java.lang.String key,
com.adventnet.html.datahandler.DataTypeHandler dataTypeHandler)
This method is used to add the data type hanlder to the HTML Adaptor, which renders the user defined objects. |
void |
addHttpServerInterface(HttpServerInterface httpIntf)
Adds HttpServerInterface for controlling WebServer. |
void |
addHttpServerListener(java.lang.Object l)
Deprecated. Now the HttpServerInterface is used to plug-in WebServers to HTML Adaptor. |
void |
bind()
Must be used to bind to a naming service or to bind to a ServerSocket |
static void |
deleteClientInfo(java.lang.String id,
java.lang.String user)
|
void |
destroyAdaptor()
This method is used to destroy the adaptor |
void |
disableAllTypes()
Disables all types of notifications |
void |
disableType(java.lang.String prefix)
Disables the type of notification in the parameter |
void |
enableAuthentication(boolean authFlag)
enables the authentication feature of the adaptor. |
void |
enableAuthorisation(boolean authFlag)
enables the authorisation feature of the adaptor. |
void |
enableType(java.lang.String prefix)
Enables the type of notification in the parameter |
javax.management.ObjectName |
getAdaptorObjectName()
Gets 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. |
javax.management.AttributeList |
getAttributes(java.lang.String[] attributes)
Enables the values of several attributes of this MBean. |
boolean |
getAuthentication()
Gets the authentication feature of the User. |
static java.util.Hashtable |
getConfTable()
|
static java.util.List |
getDataTypeHandler()
|
com.adventnet.html.datahandler.DataTypeHandler |
getDataTypeHandler(java.lang.String key)
This method is used to retrieve the data type handler for a specified key which is registered in the HTML Adaptor. |
java.util.List |
getDataTypeHandlerKeys()
This method is used to retrieve the List of keys for the data type handlers which are registered in the HTML Adaptor. |
java.util.Vector |
getEnabledTypes()
Gets all the enabled notifications |
static HtmlAuthTable |
getHtmlAuth()
|
static HtmlPageProp |
getHtmlPageProp(java.lang.String userName)
|
javax.management.MBeanInfo |
getMBeanInfo()
This method discovers the attributes and operations this MBean exposes for management. |
static javax.management.MBeanServer |
getMBeanServer()
Getter for MBean server. |
static java.util.ArrayList |
getNotificationList()
|
java.lang.String |
getObjectName()
Gets the ObjectName which are 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. |
static java.lang.String |
getUserName(java.lang.String id)
|
static UserViewInterface |
getUserViewIntf()
Gets the values of UserviewInterface. |
(package private) void |
initialize()
|
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()
Gets the authentication feature of the User. |
boolean |
isAuthenticationEnabled()
|
boolean |
isNotificationEnabled(javax.management.Notification notification)
Invoked before sending the specified notification to the listener |
boolean |
isNotificationEnabled(javax.management.Notification notification,
javax.management.NotificationListener listener,
java.lang.Object handback)
Invoked before sending the specified notification to the listener. |
static boolean |
isValidUser(java.lang.String userName,
java.lang.String password)
|
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 |
processNotification(javax.management.Notification notification,
java.lang.Object handback)
Invoked when an JMX notification occurs. |
void |
registerAuthentication()
This method enable the Authentication Support. |
void |
removeDataTypeHandler(java.lang.String key)
This method is used to remove the data type handler using the key |
void |
restartHttpServer()
Restarts the WebServer. |
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. |
void |
setHtmlAuth(HtmlAuthTable htmlAuth)
|
static void |
setHtmlPageProp(java.lang.String userName,
HtmlPageProp htmlPageProp)
|
void |
setLogFile(java.lang.String fileName)
Sets the logfile with the given filename parameter |
void |
setMaxNotifFileCount(int count)
Sets the maximum number of notification file |
void |
setNotifFileSize(long size)
Sets the notification file size |
static void |
setParentDir(java.lang.String dirName)
Sets the parents diectory for this adaptor |
void |
setPort(java.lang.Integer portNum)
This function is used to set the port of HtmlAdaptor. |
void |
setUserView(UserViewInterface userIntf)
Sets the values of UserviewInterface. |
void |
startHttpServer()
Starts the WebServer by calling the HttpServerInterface's startHttpServer method. |
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 |
static boolean |
updateClientInfo(java.lang.String id,
java.lang.String user,
java.lang.String passwd)
|
boolean |
updateDataTypeHandler(java.lang.String key,
com.adventnet.html.datahandler.DataTypeHandler dataTypeHandler)
This method is used to update the new data type handler with the existing one by specifying the key. |
| Methods inherited from class com.adventnet.adaptors.AbstractAdaptor |
|---|
addNotificationListener, changeState, getAdaptorVersion, getHost, getNotificationInfo, getPort, getState, getStateInString, handleNotification, isActive, isSecure, removeNotificationListener, setPort |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface javax.management.NotificationListener |
|---|
handleNotification |
| Field Detail |
|---|
HtmlAdaptorInitializer init
static java.util.ArrayList logContainer
boolean firstAccess
static java.lang.String parentDir
static java.util.Hashtable authTable
public static HtmlAuthTable htmlAuth
public static boolean readFromJarFile
| Constructor Detail |
|---|
public HtmlAdaptor()
public HtmlAdaptor(java.lang.String homeDir)
homeDir - preRegister(MBeanServer, ObjectName);public HtmlAdaptor(int portNum)
port - numberpreRegister(MBeanServer, ObjectName);public HtmlAdaptor(java.lang.Integer portNum)
public HtmlAdaptor(java.lang.Integer portNum,
javax.management.MBeanServer MBServer)
port - numberserver - The MBeanServer in which the MBean will be registered.preRegister(MBeanServer, ObjectName);public HtmlAdaptor(boolean isJarFile)
isJarFile - Boolean value to indicate whether HtmlAdaptor.prp is in jar or not.preRegister(MBeanServer, ObjectName);
public HtmlAdaptor(java.lang.Integer portNum,
javax.management.MBeanServer MBServer,
boolean isJarFile)
port - numberserver - The MBeanServer in which the MBean will be registered.isJarFile - Boolean value to indicate whether HtmlAdaptor.prp is in jar or not.preRegister(MBeanServer, ObjectName);| Method Detail |
|---|
public void setPort(java.lang.Integer portNum)
throws java.lang.Exception
port - number
java.lang.Exceptionpublic boolean isAuthenticationEnabled()
void initialize()
public void setUserView(UserViewInterface userIntf)
UserviewInterface - public static UserViewInterface getUserViewIntf()
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 javax.management.ObjectName getAdaptorObjectName()
getAdaptorObjectName in interface AdaptorgetAdaptorObjectName in class AbstractAdaptorpublic java.lang.String getObjectName()
public void destroyAdaptor()
destroyAdaptor in class AbstractAdaptorpublic void processClientRequests()
public static java.util.Hashtable getConfTable()
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 - The
specified attribute is not accessible in the MBean.
javax.management.MBeanException - The constructor of the MBean has
thrown an exception
javax.management.ReflectionException - Wraps a
ClassNotFoundException or a java.lang.Exception that occured trying to
invoke the MBean's constructor.setAttributes,setAttribute,getAttributes.public javax.management.AttributeList getAttributes(java.lang.String[] attributes)
getAttributes in interface javax.management.DynamicMBeanattributes - A list of attributes to be retrieved.
setAttribute,setAttributes,getAttribute.
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 - The constructor of the MBean has
thrown an exception
javax.management.ReflectionException - Wraps a
ClassNotFoundException or a java.lang.Exception that occured trying to
invoke the MBean's constructor.
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 - The
specified attribute is not accessible in the MBean.
javax.management.InvalidAttributeValueException - The
specified value for the attribute is not valid.
javax.management.MBeanException - The constructor of the MBean has
thrown an exception
javax.management.ReflectionException - Wraps a
ClassNotFoundException or a java.lang.Exception that occured trying to
invoke the MBean's constructor.setAttributes,getAttribute,getAttributes.public 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.
setAttribute,getAttribute,getAttributes.
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 web-server) gets started at the default port 8030.
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 processNotification(javax.management.Notification notification,
java.lang.Object handback)
processNotification in class AbstractAdaptornotification - - The notification.handback - - An opaque object which helps the listener to associate information
regarding the MBean emitter. This object was passed to the MBean during the
addListener call and resend, without modification, to the listener. The MBean object
should to use or modify the object.public void setNotifFileSize(long size)
size - of the file in longpublic void setMaxNotifFileCount(int count)
number - of files in intpublic void setLogFile(java.lang.String fileName)
fileName - String name of the file
public static java.util.ArrayList getNotificationList()
throws java.lang.Exception
java.lang.Exception
public boolean isNotificationEnabled(javax.management.Notification notification,
javax.management.NotificationListener listener,
java.lang.Object handback)
notification - The notification to be sent.listener - The listener object which will handle the notification.handback - An opaque object which helps the listener to associate information
regarding the MBean emitter. This object is passed to the MBean during the
addNotificationListener call and resent, without modification, to the listener.
public boolean isNotificationEnabled(javax.management.Notification notification)
isNotificationEnabled in interface javax.management.NotificationFilternotification - - The notification to be sent.
public void disableAllTypes()
public void disableType(java.lang.String prefix)
prefix - Notification typepublic void enableType(java.lang.String prefix)
prefix - Notification typepublic java.util.Vector getEnabledTypes()
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 boolean getAuthentication()
public static boolean isAuthenticated()
public void enableAuthentication(boolean authFlag)
enableAuthentication in interface AdaptorenableAuthentication in class AbstractAdaptorpublic void enableAuthorisation(boolean authFlag)
enableAuthorisation in interface AdaptorenableAuthorisation in class AbstractAdaptorpublic static javax.management.MBeanServer getMBeanServer()
public void addHttpServerListener(java.lang.Object l)
public void startHttpServer()
throws java.lang.Exception
java.lang.ExceptionstopHttpServer
public void stopHttpServer()
throws java.lang.Exception
java.lang.ExceptionstartHttpServer
public void restartHttpServer()
throws java.lang.Exception
on - error while restarting WebServer.
java.lang.ExceptionstopHttpServer,startHttpServerpublic java.lang.String getProtocol()
getProtocol in interface AdaptorgetProtocol in class AbstractAdaptorpublic void addHttpServerInterface(HttpServerInterface httpIntf)
httpIntf - The HttpServerInterface of the user.
public void addDataTypeHandler(java.lang.String key,
com.adventnet.html.datahandler.DataTypeHandler dataTypeHandler)
key - - key for the data type handlerdataTypeHandler - - custom data type handlerpublic static java.util.List getDataTypeHandler()
public boolean updateDataTypeHandler(java.lang.String key,
com.adventnet.html.datahandler.DataTypeHandler dataTypeHandler)
key - - Using this key, HTML Adaptor will replace the data type handler with the old one.dataTypeHandler - - custom data type handler
true if the data type handler is updated;
false if the key doesn't exist in the List.public void removeDataTypeHandler(java.lang.String key)
key - - Using this key, HTML Adaptor will look for key and remove
the data type handler which binds to the specified keypublic java.util.List getDataTypeHandlerKeys()
public com.adventnet.html.datahandler.DataTypeHandler getDataTypeHandler(java.lang.String key)
key - - key for the data type handler
public static void setParentDir(java.lang.String dirName)
dirName - String name of the parent directorypublic static java.lang.String getParentDirectory()
public void setHtmlAuth(HtmlAuthTable htmlAuth)
public static HtmlAuthTable getHtmlAuth()
public static HtmlPageProp getHtmlPageProp(java.lang.String userName)
public static java.lang.String getUserName(java.lang.String id)
public static void setHtmlPageProp(java.lang.String userName,
HtmlPageProp htmlPageProp)
public static boolean isValidUser(java.lang.String userName,
java.lang.String password)
public static boolean updateClientInfo(java.lang.String id,
java.lang.String user,
java.lang.String passwd)
public static void deleteClientInfo(java.lang.String id,
java.lang.String user)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||