HOME

com.ireasoning.core.jmx
Class AdaptorServer

java.lang.Object
  extended bycom.ireasoning.core.jmx.AdaptorServer
All Implemented Interfaces:
AdaptorServerMBean, MBeanRegistration, Runnable, Service, ServiceMBean, State
Direct Known Subclasses:
SnmpAdaptorServer, TL1AdaptorServer

public abstract class AdaptorServer
extends Object
implements AdaptorServerMBean, Runnable, MBeanRegistration

Abstract base class of JMX adaptor


Field Summary
protected  com.ireasoning.core.network.DataHandler _dataHandler
           
protected  com.ireasoning.core.network.DataHandlerFactory _dataHandlerFactory
           
protected  InetAddress _ipAddress
           
protected  int _maxConnections
           
protected  MBeanInfo _mbeaninfo
           
protected  MBeanServer _mbeanServer
           
protected  ObjectName _objectName
           
protected  int _port
           
protected  Object _serverSocket
           
protected  SocketServer _socketServer
           
protected  long _startTime
           
protected  int _state
           
protected  int _transportLayerType
           
static int MAX_CONNECTIONS
          Maximum number of connections
static int RECV_BUF_SIZE
          Receive buffer size
static String SNMP
          Snmp protocol
static int TCP
          TCP transport layer
protected static int TCP_TL1
           
static String TL1
          TL1 protocol
static int UDP
          Snmp transport layer
 
Fields inherited from interface com.ireasoning.core.jmx.State
STARTED, STARTING, STATES, STOPPED, STOPPING, UNINITIALIZED
 
Constructor Summary
protected AdaptorServer(MBeanServer server, int port)
          Constructor
protected AdaptorServer(MBeanServer server, int port, int transportLayerType, com.ireasoning.core.network.DataHandler handler)
          Constructor
protected AdaptorServer(MBeanServer server, int port, int transportLayerType, com.ireasoning.core.network.DataHandlerFactory handlerFactory)
          Constructor
 
Method Summary
 int getActiveClientCount()
          Returns the number of active client
 String getHost()
          Gets host name
 String getName()
          Returns adaptor name
static String getObjectName(String adaptorName, InetAddress address, int port)
          Return the object name based on passed adaptorName, ip address and port number
static String getObjectName(String adaptorName, int port)
          Return the object name based on passed adaptorName and port number
 int getPort()
          Returns the server port
abstract  String getProtocol()
          Returns the protocol name
 Object getServerSocket()
          Returns the server socket
 int getState()
          Returns the server state
 String getStateString()
          Returns the server state as string format
 long getUptime()
          Returns the server up time
 void postDeregister()
          Gets called after MBean is unregistered
 void postRegister(Boolean b)
          Gets called after MBean is registered
 void preDeregister()
           
 ObjectName preRegister(MBeanServer mbeanserver, ObjectName objectname)
           
 void run()
           
 void setIpAddress(InetAddress address)
          Sets server's local address to bind
 void setMaxConnections(int maxConns)
          Sets max.
 void setPort(int port)
          Sets server port.
 void startService()
          Starts server
 void stopService()
          Stops server
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_CONNECTIONS

public static final int MAX_CONNECTIONS
Maximum number of connections

See Also:
Constant Field Values

RECV_BUF_SIZE

public static final int RECV_BUF_SIZE
Receive buffer size

See Also:
Constant Field Values

TCP

public static final int TCP
TCP transport layer

See Also:
Constant Field Values

UDP

public static final int UDP
Snmp transport layer

See Also:
Constant Field Values

TCP_TL1

protected static final int TCP_TL1
See Also:
Constant Field Values

TL1

public static final String TL1
TL1 protocol

See Also:
Constant Field Values

SNMP

public static final String SNMP
Snmp protocol

See Also:
Constant Field Values

_port

protected int _port

_ipAddress

protected InetAddress _ipAddress

_mbeanServer

protected MBeanServer _mbeanServer

_objectName

protected ObjectName _objectName

_socketServer

protected SocketServer _socketServer

_serverSocket

protected Object _serverSocket

_mbeaninfo

protected MBeanInfo _mbeaninfo

_startTime

protected long _startTime

_maxConnections

protected int _maxConnections

_transportLayerType

protected int _transportLayerType

_dataHandlerFactory

protected com.ireasoning.core.network.DataHandlerFactory _dataHandlerFactory

_dataHandler

protected com.ireasoning.core.network.DataHandler _dataHandler

_state

protected int _state
Constructor Detail

AdaptorServer

protected AdaptorServer(MBeanServer server,
                        int port)
Constructor

Parameters:
server - MBeanServer instance
port - server port number

AdaptorServer

protected AdaptorServer(MBeanServer server,
                        int port,
                        int transportLayerType,
                        com.ireasoning.core.network.DataHandlerFactory handlerFactory)
Constructor

Parameters:
transportLayerType - transport layer type, one of AdaptorServer.TCP and AdaptorServer.UDP

AdaptorServer

protected AdaptorServer(MBeanServer server,
                        int port,
                        int transportLayerType,
                        com.ireasoning.core.network.DataHandler handler)
Constructor

Parameters:
transportLayerType - transport layer type, one of AdaptorServer.TCP and AdaptorServer.UDP
Method Detail

getServerSocket

public Object getServerSocket()
Returns the server socket

Specified by:
getServerSocket in interface AdaptorServerMBean

setPort

public void setPort(int port)
Sets server port. If the server is running, setting port will result in restart of server.

Specified by:
setPort in interface AdaptorServerMBean
Parameters:
port - new port number

setIpAddress

public void setIpAddress(InetAddress address)
Sets server's local address to bind

Specified by:
setIpAddress in interface AdaptorServerMBean

setMaxConnections

public void setMaxConnections(int maxConns)
Sets max. number of connections

Specified by:
setMaxConnections in interface AdaptorServerMBean

getHost

public String getHost()
               throws UnknownHostException
Gets host name

Specified by:
getHost in interface AdaptorServerMBean
Throws:
UnknownHostException

getPort

public int getPort()
Returns the server port

Specified by:
getPort in interface AdaptorServerMBean

run

public void run()
Specified by:
run in interface Runnable

startService

public void startService()
                  throws Exception
Starts server

Specified by:
startService in interface Service
Throws:
Exception

stopService

public void stopService()
Stops server

Specified by:
stopService in interface Service

getState

public int getState()
Returns the server state

Specified by:
getState in interface State

getStateString

public String getStateString()
Returns the server state as string format

Specified by:
getStateString in interface State

getName

public String getName()
Returns adaptor name

Specified by:
getName in interface ServiceMBean

getUptime

public long getUptime()
Returns the server up time

Specified by:
getUptime in interface AdaptorServerMBean

getActiveClientCount

public int getActiveClientCount()
Returns the number of active client

Specified by:
getActiveClientCount in interface AdaptorServerMBean

postDeregister

public void postDeregister()
Gets called after MBean is unregistered

Specified by:
postDeregister in interface MBeanRegistration

postRegister

public void postRegister(Boolean b)
Gets called after MBean is registered

Specified by:
postRegister in interface MBeanRegistration

preDeregister

public void preDeregister()
                   throws Exception
Specified by:
preDeregister in interface MBeanRegistration
Throws:
Exception

preRegister

public ObjectName preRegister(MBeanServer mbeanserver,
                              ObjectName objectname)
                       throws Exception
Specified by:
preRegister in interface MBeanRegistration
Throws:
Exception

getObjectName

public static String getObjectName(String adaptorName,
                                   InetAddress address,
                                   int port)
Return the object name based on passed adaptorName, ip address and port number


getObjectName

public static String getObjectName(String adaptorName,
                                   int port)
Return the object name based on passed adaptorName and port number


getProtocol

public abstract String getProtocol()
Returns the protocol name

Specified by:
getProtocol in interface AdaptorServerMBean

HOME

Copyright © 2002 iReasoning Inc. All Rights Reserved.