org.huihoo.jfox.service
Class ComponentSupport

org.huihoo.jfox.service.ComponentSupport
All Implemented Interfaces:
Component, ComponentSupportMBean, Loggable, Persistentable, java.io.Serializable
Direct Known Subclasses:
AbstractObjectPool, ServiceSupport, SimpleConnectionPool, SimpleThreadPool

public abstract class ComponentSupport
implements ComponentSupportMBean

Author:
Young Yang
See Also:
Serialized Form

Field Summary
protected  Logger logger
           
protected  java.lang.String name
          service name of the service
protected  javax.management.ObjectName objectName
          the ObjectName of the service register into the MBeanServer
protected  java.lang.Object proxyInstance
           
protected  long sequence
           
protected  javax.management.MBeanServer server
          MBeanService instance
protected  State state
          the status value of the service
 
Constructor Summary
ComponentSupport()
           
ComponentSupport(java.lang.String name)
           
 
Method Summary
 void destroy()
          doDestroy the service, tear down
protected abstract  void doDestroy()
          do actually destory action
protected abstract  void doInit()
          do actually create action
 Logger getLogger()
          get the logger
 java.lang.String getName()
          get the name of the Service, example: NamingService
 javax.management.ObjectName getObjectName()
          get the ObjectName of the Service, if not registered in MBeanServer, will return null the ObjectName maybe signed in the MLet Config file
 java.lang.reflect.Proxy getProxyInstance()
          get the proxy instance if return itself, unregisterMBean will invalidate
 State getState()
          get the state of the Service, the status defined in Status class
 void handleNotification(javax.management.Notification notification, java.lang.Object obj)
           
 void init()
          doCreate the service, do expensive operations etc
protected static java.lang.String parseName(java.lang.String className)
           
 void postDeregister()
           
 void postRegister(java.lang.Boolean registrationDone)
           
 void preDeregister()
           
 javax.management.ObjectName preRegister(javax.management.MBeanServer server, javax.management.ObjectName name)
          ObjectName must specified in the MLet, or use registerMBean specified explicitly
protected  void setLogger(Logger logger)
           
protected  void setName(java.lang.String name)
           
 

Field Detail

name

protected java.lang.String name
service name of the service

objectName

protected javax.management.ObjectName objectName
the ObjectName of the service register into the MBeanServer

state

protected volatile State state
the status value of the service

server

protected javax.management.MBeanServer server
MBeanService instance

logger

protected Logger logger

sequence

protected volatile long sequence

proxyInstance

protected java.lang.Object proxyInstance
Constructor Detail

ComponentSupport

public ComponentSupport()

ComponentSupport

public ComponentSupport(java.lang.String name)
Method Detail

getName

public java.lang.String getName()
Description copied from interface: Component
get the name of the Service, example: NamingService
Specified by:
getName in interface Component

setName

protected void setName(java.lang.String name)

getObjectName

public javax.management.ObjectName getObjectName()
Description copied from interface: ComponentSupportMBean
get the ObjectName of the Service, if not registered in MBeanServer, will return null the ObjectName maybe signed in the MLet Config file
Specified by:
getObjectName in interface ComponentSupportMBean

getState

public State getState()
Description copied from interface: Component
get the state of the Service, the status defined in Status class
Specified by:
getState in interface Component

getProxyInstance

public java.lang.reflect.Proxy getProxyInstance()
get the proxy instance if return itself, unregisterMBean will invalidate
Specified by:
getProxyInstance in interface ComponentSupportMBean

getLogger

public Logger getLogger()
Description copied from interface: Loggable
get the logger
Specified by:
getLogger in interface Loggable

setLogger

protected void setLogger(Logger logger)

init

public void init()
          throws java.lang.Exception
Description copied from interface: Component
doCreate the service, do expensive operations etc
Specified by:
init in interface Component

destroy

public void destroy()
             throws java.lang.Exception
Description copied from interface: Component
doDestroy the service, tear down
Specified by:
destroy in interface Component

preRegister

public javax.management.ObjectName preRegister(javax.management.MBeanServer server,
                                               javax.management.ObjectName name)
                                        throws java.lang.Exception
ObjectName must specified in the MLet, or use registerMBean specified explicitly

postRegister

public void postRegister(java.lang.Boolean registrationDone)

preDeregister

public void preDeregister()
                   throws java.lang.Exception

postDeregister

public void postDeregister()

handleNotification

public void handleNotification(javax.management.Notification notification,
                               java.lang.Object obj)

doInit

protected abstract void doInit()
                        throws java.lang.Exception
do actually create action

doDestroy

protected abstract void doDestroy()
                           throws java.lang.Exception
do actually destory action

parseName

protected static java.lang.String parseName(java.lang.String className)