|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
jrunx.kernel.ServiceAdapter
Default JRun Service, designed to provide convenience implementations of registration methods, JRun Service methods, and default JMX Notification support.
ServiceAdapter should be extended in order to plug a new Service into JRun. If the new Service is intended to hold other Services, then ServicePartition should be extended instead.
ServiceMBean,
ServicePartition, Serialized Form| Field Summary | |
static boolean |
DEFAULT_DEACTIVATED
|
static java.lang.String |
DEFAULT_DOMAIN
|
static java.lang.String |
DOMAIN_NAME_SEPARATOR
|
static java.lang.String |
DOMAIN_NAME_SUFFIX
|
protected java.lang.String |
domainName
The domain name of the Service |
protected boolean |
jndiBindable
By default, do not bind to JNDI |
static int |
LOGGER_CACHE_TIME
|
static java.lang.String |
SCHEDULER_SERVICE
|
static java.lang.String |
SECURITY_MANAGER
|
protected javax.management.MBeanServer |
server
Every Service knows its Server upon registration. |
int |
status
Every Service knows it current status. |
static java.lang.String |
TRANSACTION_MANAGER
|
| Fields inherited from interface jrunx.kernel.Service |
INITIALIZED, STARTED, STARTING, STOPPED, STOPPING, UNINITIALIZED |
| Constructor Summary | |
ServiceAdapter()
|
|
| Method Summary | |
void |
bind()
Bind the Service to JNDI. |
void |
destroy()
Every service is eventually destroyed. |
javax.management.ObjectInstance |
findObjectInstance(java.lang.String name)
Finds the named service within the JMX framework. |
javax.management.ObjectInstance |
findObjectInstance(java.lang.String name,
boolean required)
Finds a required service. |
javax.management.ObjectInstance |
findObjectInstance(java.lang.String name,
java.lang.String domain)
|
boolean |
getBindToJNDI()
|
boolean |
getDeactivated()
Check if the service is deactivated and should not be started |
java.lang.String |
getDomainName()
Retrieve the domain name of this service. |
protected java.lang.String |
getDomainSearchPath()
Gets the name of the domain that we need to search in. |
java.lang.Object |
getJRunService()
|
Logger |
getLogger()
Returns an instance of the current logger for this context |
java.lang.String |
getName()
Retrieve the String version of the Service's JMX ObjectName. |
ServiceMBean |
getParentService()
Gets the parent service of this service, or null if not part of a ConfigurableServicePartition |
javax.naming.Reference |
getReference()
|
ResourceManager |
getResourceManager(java.lang.String path)
Convenience method for getting a ResourceManager |
java.lang.String |
getServerName()
Gets the current server name |
protected java.util.Properties |
getServerProperties()
Returns a list of server properties use for dynamic variable substitution. |
int |
getStatus()
|
void |
init()
Not every service needs to init, implement it out of convenience. |
java.lang.Object |
invokeMethod(javax.management.ObjectName objName,
java.lang.String method,
java.lang.Object[] params,
java.lang.String[] types)
Invoke a method on a Service using its ObjectName. |
boolean |
isInPartition()
Determines if this service is in a partition |
boolean |
isPartition()
Determines if this service is a partition |
java.lang.Object |
lookup(java.lang.String name)
Convenience method for looking up a named service in the JNDI context. |
void |
postDeregister()
Override for additional functionality after being removed from the server. |
void |
postRegister(java.lang.Boolean b)
Override for additional functionality after registration time. |
void |
preDeregister()
Override for additional functionality before removal time. |
javax.management.ObjectName |
preRegister(javax.management.MBeanServer server,
javax.management.ObjectName name)
Override for additional functionality at registration time. |
javax.management.MBeanServer |
requestServer()
Every service may report its server by reference. |
void |
scheduleRunnable(java.lang.Runnable runnable,
long msFromNow)
Schedule a runnable to execute using the standard SchedulerService |
void |
setBindToJNDI(boolean b)
|
void |
setDeactivated(boolean deactivated)
Deactivate the service to prevent it from being started |
void |
setDomainName(java.lang.String name)
Set the domain name of the partition's internal MBeanServer. |
void |
setName(java.lang.String n)
Set the JMX ObjectName of this Service using a String. |
void |
setParentService(ServiceMBean parent)
Sets the parent service of this service. |
void |
start()
Every service other than mere data collections should start |
void |
stop()
Every service other than mere data collections should stop |
java.lang.String |
toString()
|
void |
unbind()
Unbind the service form the JNDI tree. |
void |
unscheduleRunnable(java.lang.Runnable runnable)
Unschedule a runnable to execute using the standard SchedulerService |
void |
updateStatus(int n)
This is not a 'set' method in order to avoid exposing it as an automatically writable attribute. |
| Field Detail |
protected transient javax.management.MBeanServer server
public int status
protected boolean jndiBindable
protected java.lang.String domainName
public static final boolean DEFAULT_DEACTIVATED
public static final java.lang.String DEFAULT_DOMAIN
public static final java.lang.String DOMAIN_NAME_SEPARATOR
public static final java.lang.String DOMAIN_NAME_SUFFIX
public static final java.lang.String SCHEDULER_SERVICE
public static final java.lang.String TRANSACTION_MANAGER
public static final java.lang.String SECURITY_MANAGER
public static final int LOGGER_CACHE_TIME
| Constructor Detail |
public ServiceAdapter()
| Method Detail |
public void init()
throws java.lang.Exception
init in interface Service
public void start()
throws java.lang.Exception
start in interface Service
public void stop()
throws java.lang.Exception
stop in interface Service
public void destroy()
throws java.lang.Exception
destroy in interface Servicepublic int getStatus()
getStatus in interface Servicepublic boolean getDeactivated()
ServiceMBeangetDeactivated in interface ServiceMBeanpublic void setDeactivated(boolean deactivated)
ServiceMBeansetDeactivated in interface ServiceMBeanpublic void updateStatus(int n)
updateStatus in interface Servicepublic java.lang.String getName()
getName in interface ServiceMBeanpublic void setName(java.lang.String n)
setName in interface ServiceMBeanpublic void setDomainName(java.lang.String name)
setDomainName in interface ServiceMBeanpublic java.lang.String getDomainName()
ServiceMBeangetDomainName in interface ServiceMBeanpublic javax.management.MBeanServer requestServer()
requestServer in interface ServiceMBean
public javax.management.ObjectName preRegister(javax.management.MBeanServer server,
javax.management.ObjectName name)
throws java.lang.Exception
public void postRegister(java.lang.Boolean b)
public void preDeregister()
throws java.lang.Exception
public void postDeregister()
public void bind()
throws javax.naming.NamingException
jrun:service/[servicename] and if the
service is inside a partition, the service can be accessed through
jrun:service/[domainname]/[servicename].
jrun:service/SimpleService
and that same service if created by a partition named "SimplePartition"
would be accessible through
jrun:service/SimplePartition/SimpleService.
bind in interface ServiceMBeanpublic boolean isPartition()
public boolean isInPartition()
public java.lang.String getServerName()
getServerName in interface ServiceMBeanpublic javax.naming.Reference getReference()
getReference in interface javax.naming.Referenceable
public java.lang.Object lookup(java.lang.String name)
throws java.lang.Exception
name - The service name to findprotected java.lang.String getDomainSearchPath()
public void unbind()
throws javax.naming.NamingException
ServiceMBeanunbind in interface ServiceMBeanpublic final javax.management.ObjectInstance findObjectInstance(java.lang.String name)
name - The service name
public final javax.management.ObjectInstance findObjectInstance(java.lang.String name,
boolean required)
throws ServiceException
name - The service namerequired - true if the service is required
public javax.management.ObjectInstance findObjectInstance(java.lang.String name,
java.lang.String domain)
public java.lang.Object invokeMethod(javax.management.ObjectName objName,
java.lang.String method,
java.lang.Object[] params,
java.lang.String[] types)
throws java.lang.Exception
public void scheduleRunnable(java.lang.Runnable runnable,
long msFromNow)
throws java.lang.Exception
runnable - The runnablemsFromNow - The number of ms from now to run, or 0 for immediate
public void unscheduleRunnable(java.lang.Runnable runnable)
throws java.lang.Exception
runnable - The runnablepublic boolean getBindToJNDI()
getBindToJNDI in interface ServiceMBeanpublic void setBindToJNDI(boolean b)
setBindToJNDI in interface ServiceMBeanpublic Logger getLogger()
getLogger in interface ServiceMBeanprotected java.util.Properties getServerProperties()
public ResourceManager getResourceManager(java.lang.String path)
throws java.lang.Exception
path - The root pathpublic void setParentService(ServiceMBean parent)
ServiceMBeansetParentService in interface ServiceMBeanjrunx.kernel.ServiceMBeanparent - The parent servicepublic ServiceMBean getParentService()
ServiceMBeangetParentService in interface ServiceMBeanjrunx.kernel.ServiceMBeanpublic java.lang.String toString()
public java.lang.Object getJRunService()
getJRunService in interface ServiceMBean
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||