com.sun.jdmk.comm
Class GenericHttpConnectorServer

java.lang.Object
  extended by com.sun.jdmk.comm.CommunicatorServer
      extended by com.sun.jdmk.comm.GenericHttpConnectorServer
All Implemented Interfaces:
CommunicatorServerMBean, Runnable, MBeanRegistration, NotificationBroadcaster
Direct Known Subclasses:
HttpConnectorServer, HttpsConnectorServer

Deprecated. The JMX Remote API should be used in preference to the legacy Java DMK connector classes. This class may be removed in a future version of Java DMK. See JdmkLegacyConnector.

public abstract class GenericHttpConnectorServer
extends CommunicatorServer

This class implements the common behavior for the server part of the HTTP-based connectors. The HTTP/TCP connector extends this class and inherits this behavior.

The HTTP-based connectors differ by the socket type they use to communicate between the server and the client:

However the features and the behavior of these connectors are the same. They are implemented in this class and described below.

The data transmitted between the client and server parts is the same in both connectors: these are serialized Java objects encoded as HTTP requests and responses.

The two connectors can perform user authentication. The add/remove user authentication info methods are used to add/remove users and their corresponding authentication information. If this server carries out client authentication then clients connecting to this server are authenticated using the 'CRAM-MD5 Access Authentication Scheme' as defined in RFCs 2104 and 2195.

An HTTP-based connector server may serve several clients concurrently. The number of concurrent clients can be limited using the property maxActiveClientCount.

The HTTP/TCP connector specifies a default value (10) for the maxActiveClientCount property. When a connector is stopped, the active requests are interrupted and an error result is sent to the clients.

See Also:
GenericHttpConnectorClient

Field Summary
 
Fields inherited from class com.sun.jdmk.comm.CommunicatorServer
HTML_TYPE, HTTP_TYPE, HTTPS_TYPE, OFFLINE, ONLINE, RMI_TYPE, SNMP_TYPE, STARTING, STOPPING
 
Constructor Summary
GenericHttpConnectorServer(int connectorType)
          Deprecated. Initializes this GenericHttpConnectorServer with the default port.
GenericHttpConnectorServer(int connectorType, int port)
          Deprecated. Initializes this GenericHttpConnectorServer with the specified port.
GenericHttpConnectorServer(int connectorType, int port, AuthInfo[] authInfoList)
          Deprecated. Initializes this GenericHttpConnectorServer with the specified port and user authentication information list.
GenericHttpConnectorServer(int connectorType, int port, AuthInfo[] authInfoList, InetAddress bindAddr)
          Deprecated. Initializes this GenericHttpConnectorServer with the specified port and user authentication information list.
GenericHttpConnectorServer(int connectorType, int port, InetAddress bindAddr)
          Deprecated. Initializes this GenericHttpConnectorServer with the specified port.
 
Method Summary
 void addUserAuthenticationInfo(AuthInfo authinfo)
          Deprecated. Adds user authentication information to this server.
protected  void doBind()
          Deprecated.  
protected  void doError(Exception e)
          Deprecated.  
protected  void doProcess()
          Deprecated. doProcess() is called after doReceive(): it should process the requests of the incoming client.
protected  void doReceive()
          Deprecated. doReceive() should block until a client is available.
protected  void doUnbind()
          Deprecated. doUnbind() is called whenever the connector goes OFFLINE, except if doBind() has thrown an exception.
 int getActiveClientCount()
          Deprecated. Gets the number of clients currently being processed by this GenericHttpConnectorServer.
 String getLastConnectedClient()
          Deprecated. Gets the IP address of the last connected client.
 int getMaxActiveClientCount()
          Deprecated. Gets the maximum number of clients that this GenericHttpConnectorServer can process concurrently.
 int getServedClientCount()
          Deprecated. Gets the number of clients that have been processed by this GenericHttpConnectorServer since its creation.
 boolean isAuthenticationOn()
          Deprecated. Returns true if the list of users supported by this server is not empty.
 void postDeregister()
          Deprecated. Allows the MBean to perform any operations needed after having been de-registered from the MBean server.
 void postRegister(Boolean registrationDone)
          Deprecated. Allows the MBean to perform any operations needed after having been registered in the MBeanServer or after the registration has failed.
 void preDeregister()
          Deprecated. Allows the MBean to perform any operations it needs before being de-registered by the MBean server.
 ObjectName preRegister(MBeanServer server, ObjectName name)
          Deprecated. Performs pre-registration initialization.
 void removeUserAuthenticationInfo(AuthInfo authinfo)
          Deprecated. Removes user authentication information from this server.
 void setMaxActiveClientCount(int c)
          Deprecated. Sets the maximum number of clients this GenericHttpConnectorServer can process concurrently.
 void setMBeanServer(MBeanServer newMBS)
          Deprecated. Set the MBeanServer object to which incoming requests are sent.
 void stop()
          Deprecated. Stops this connector server.
 
Methods inherited from class com.sun.jdmk.comm.CommunicatorServer
addNotificationListener, getHost, getMBeanServer, getNotificationInfo, getPort, getProtocol, getState, getStateString, isActive, removeNotificationListener, run, setPort, start, waitState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericHttpConnectorServer

public GenericHttpConnectorServer(int connectorType)
                           throws IllegalArgumentException
Deprecated. 
Initializes this GenericHttpConnectorServer with the default port. The default port is protocol-specific: its value is defined by the derived classes.

Parameters:
connectorType - Indicates the connector type. Possible values are: CommunicatorServer.HTTP_TYPE or CommunicatorServer.HTTPS_TYPE.
Throws:
IllegalArgumentException

GenericHttpConnectorServer

public GenericHttpConnectorServer(int connectorType,
                                  int port)
                           throws IllegalArgumentException
Deprecated. 
Initializes this GenericHttpConnectorServer with the specified port.

Parameters:
connectorType - Indicates the connector type. Possible values are: CommunicatorServer.HTTP_TYPE or CommunicatorServer.HTTPS_TYPE.
port - The port number.
Throws:
IllegalArgumentException

GenericHttpConnectorServer

public GenericHttpConnectorServer(int connectorType,
                                  int port,
                                  AuthInfo[] authInfoList)
                           throws IllegalArgumentException
Deprecated. 
Initializes this GenericHttpConnectorServer with the specified port and user authentication information list.

Parameters:
connectorType - Indicates the connector type. Possible values are: CommunicatorServer.HTTP_TYPE or CommunicatorServer.HTTPS_TYPE.
port - The port number.
authInfoList - The user authentication information list.
Throws:
IllegalArgumentException

GenericHttpConnectorServer

public GenericHttpConnectorServer(int connectorType,
                                  int port,
                                  InetAddress bindAddr)
                           throws IllegalArgumentException
Deprecated. 
Initializes this GenericHttpConnectorServer with the specified port.

Parameters:
connectorType - Indicates the connector type. Possible values are: CommunicatorServer.HTTP_TYPE or CommunicatorServer.HTTPS_TYPE.
port - The port number.
bindAddr - The local InetAddress the server will bind to .
Throws:
IllegalArgumentException

GenericHttpConnectorServer

public GenericHttpConnectorServer(int connectorType,
                                  int port,
                                  AuthInfo[] authInfoList,
                                  InetAddress bindAddr)
                           throws IllegalArgumentException
Deprecated. 
Initializes this GenericHttpConnectorServer with the specified port and user authentication information list.

Parameters:
connectorType - Indicates the connector type. Possible values are: CommunicatorServer.HTTP_TYPE or CommunicatorServer.HTTPS_TYPE.
port - The port number.
authInfoList - The user authentication information list.
bindAddr - The local InetAddress the server will bind to .
Throws:
IllegalArgumentException
Method Detail

preRegister

public ObjectName preRegister(MBeanServer server,
                              ObjectName name)
                       throws Exception
Deprecated. 
Performs pre-registration initialization. This method is not intended to be called directly by the user.

Specified by:
preRegister in interface MBeanRegistration
Overrides:
preRegister in class CommunicatorServer
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:
Exception - This exception should be caught by the MBeanServer and re-thrown as an MBeanRegistrationException.

postRegister

public void postRegister(Boolean registrationDone)
Deprecated. 
Allows the MBean to perform any operations needed after having been registered in the MBeanServer or after the registration has failed.

Specified by:
postRegister in interface MBeanRegistration
Overrides:
postRegister in class CommunicatorServer
Parameters:
registrationDone - Indicates whether or not the MBean has been successfully registered in the MBeanServer. The value false means that the registration phase has failed.

preDeregister

public void preDeregister()
                   throws Exception
Deprecated. 
Allows the MBean to perform any operations it needs before being de-registered by the MBean server.

Specified by:
preDeregister in interface MBeanRegistration
Overrides:
preDeregister in class CommunicatorServer
Throws:
Exception - This exception should be caught by the MBean server and re-thrown as an MBeanRegistrationException.

postDeregister

public void postDeregister()
Deprecated. 
Allows the MBean to perform any operations needed after having been de-registered from the MBean server.

Specified by:
postDeregister in interface MBeanRegistration
Overrides:
postDeregister in class CommunicatorServer

doError

protected void doError(Exception e)
                throws CommunicationException
Deprecated. 
Specified by:
doError in class CommunicatorServer
Throws:
CommunicationException

doBind

protected void doBind()
               throws InterruptedException,
                      CommunicationException
Deprecated. 
Specified by:
doBind in class CommunicatorServer
Throws:
InterruptedException
CommunicationException

doReceive

protected void doReceive()
                  throws InterruptedException,
                         CommunicationException
Deprecated. 
Description copied from class: CommunicatorServer
doReceive() should block until a client is available. If this method throws an exception, doProcess() is not called but doUnbind() is called then run() stops.

Specified by:
doReceive in class CommunicatorServer
Throws:
InterruptedException
CommunicationException

doProcess

protected void doProcess()
                  throws InterruptedException,
                         CommunicationException
Deprecated. 
Description copied from class: CommunicatorServer
doProcess() is called after doReceive(): it should process the requests of the incoming client. If it throws an exception, doUnbind() is called and run() stops.

Specified by:
doProcess in class CommunicatorServer
Throws:
InterruptedException
CommunicationException

doUnbind

protected void doUnbind()
                 throws InterruptedException,
                        CommunicationException
Deprecated. 
Description copied from class: CommunicatorServer
doUnbind() is called whenever the connector goes OFFLINE, except if doBind() has thrown an exception.

Specified by:
doUnbind in class CommunicatorServer
Throws:
InterruptedException
CommunicationException

stop

public void stop()
Deprecated. 
Stops this connector server.

Has no effect if this HTTP connector server is OFFLINE or STOPPING.

Specified by:
stop in interface CommunicatorServerMBean
Overrides:
stop in class CommunicatorServer

setMBeanServer

public void setMBeanServer(MBeanServer newMBS)
                    throws IllegalArgumentException,
                           IllegalStateException
Deprecated. 
Description copied from class: CommunicatorServer
Set the MBeanServer object to which incoming requests are sent. This must be either the MBean server in which this connector is registered, or an MBeanServerForwarder leading to that server. An MBeanServerForwarder mbsf leads to an MBean server mbs if mbsf.getMBeanServer() is either mbs or an MBeanServerForwarder leading to mbs.

Overrides:
setMBeanServer in class CommunicatorServer
Throws:
IllegalArgumentException - if newMBS is neither the MBean server in which this connector is registered nor an MBeanServerForwarder leading to that server.
IllegalStateException - This method has been invoked while the communicator was ONLINE or STARTING.

getServedClientCount

public int getServedClientCount()
Deprecated. 
Gets the number of clients that have been processed by this GenericHttpConnectorServer since its creation.

Returns:
The number of clients handled by this GenericHttpConnectorServer since its creation. This counter is not reset by the stop method.

getActiveClientCount

public int getActiveClientCount()
Deprecated. 
Gets the number of clients currently being processed by this GenericHttpConnectorServer.

Returns:
The number of clients currently being processed by this GenericHttpConnectorServer.

getMaxActiveClientCount

public int getMaxActiveClientCount()
Deprecated. 
Gets the maximum number of clients that this GenericHttpConnectorServer can process concurrently.

Returns:
The maximum number of clients that this GenericHttpConnectorServer can process concurrently.

setMaxActiveClientCount

public void setMaxActiveClientCount(int c)
                             throws IllegalStateException
Deprecated. 
Sets the maximum number of clients this GenericHttpConnectorServer can process concurrently.

Parameters:
c - The number of clients.
Throws:
IllegalStateException - This method has been invoked while the communicator was ONLINE or STARTING.

getLastConnectedClient

public String getLastConnectedClient()
Deprecated. 
Gets the IP address of the last connected client. This function uses the string representation of InetAddress.

Returns:
The IP address of the last connected client.
See Also:
InetAddress

addUserAuthenticationInfo

public void addUserAuthenticationInfo(AuthInfo authinfo)
Deprecated. 
Adds user authentication information to this server. In order to populate the list of users supported by this server, invoke this method for each user you want to add. If the user already exists, then update his authentication information.

Parameters:
authinfo - The user authentication information.

removeUserAuthenticationInfo

public void removeUserAuthenticationInfo(AuthInfo authinfo)
Deprecated. 
Removes user authentication information from this server.

Parameters:
authinfo - The user authentication information.
See Also:
addUserAuthenticationInfo(com.sun.jdmk.comm.AuthInfo)

isAuthenticationOn

public boolean isAuthenticationOn()
Deprecated. 
Returns true if the list of users supported by this server is not empty.

Returns:
True, if the list of users supported by this server is not empty. False, if the list of supported users is empty so no authentication is performed by this server.

Open Source build 02
opendmk-1.0-b02 2007.10.01_19:17:46_MEST

Copyright 1998-2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.