org.jboss.system
Class ServiceController

java.lang.Object
  extended by org.jboss.mx.util.JBossNotificationBroadcasterSupport
      extended by org.jboss.system.ServiceController
All Implemented Interfaces:
javax.management.MBeanRegistration, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, ServiceControllerMBean

public class ServiceController
extends org.jboss.mx.util.JBossNotificationBroadcasterSupport
implements ServiceControllerMBean, javax.management.MBeanRegistration

This is the main Service Controller. A controller can deploy a service to a jboss.system It installs by delegating, it configures by delegating

Version:
$Revision: 1.45.2.15 $
Author:
Marc Fleury, David Jencks, Scott Stark, Dimitris Andreadis
See Also:
Service

Nested Class Summary
 class ServiceController.ServiceProxy
          An implementation of InvocationHandler used to proxy of the Service interface for mbeans.
 
Field Summary
protected  ServiceConfigurator configurator
          Configurator, helper class to configure MBeans
protected  ServiceCreator creator
          Creator, helper class to instantiate MBeans
static javax.management.ObjectName DEFAULT_LOADER_REPOSITORY
          The ObjectName of the default loader repository
protected  List installedServices
          A linked list of services in the order they were created
static String JBOSS_INTERNAL_LIFECYCLE
          The operation name for lifecycle
static String[] JBOSS_INTERNAL_LIFECYCLE_SIG
          The signature for lifecycle operations
protected  Map nameToServiceMap
          ObjectName to ServiceContext map
protected  javax.management.MBeanServer server
          A callback to the JMX MBeanServer
 
Fields inherited from interface org.jboss.system.ServiceControllerMBean
OBJECT_NAME
 
Constructor Summary
ServiceController()
           
 
Method Summary
 void create(javax.management.ObjectName serviceName)
          #Description of the Method
 void create(javax.management.ObjectName serviceName, Collection depends)
          #Description of the Method
 void destroy(javax.management.ObjectName serviceName)
          #Description of the Method
 ServiceContext getServiceContext(javax.management.ObjectName serviceName)
          Lookup the ServiceContext for the given serviceName
 List install(Element config, javax.management.ObjectName loaderName)
          Deploy the beans Deploy means "instantiate and configure" so the MBean is created in the MBeanServer You must call "create" and "start" separately on the MBean to affect the service lifecycle deploy doesn't bother with service lifecycle only MBean instanciation/registration/configuration
 String listConfiguration(javax.management.ObjectName[] objectNames)
          Gets the Configuration attribute of the ServiceController object
 List listDeployed()
          Lists the ServiceContexts of deployed mbeans
 List listDeployedNames()
          lists ObjectNames of deployed mbeans deployed through serviceController.
 List listIncompletelyDeployed()
          The listIncompletelyDeployed method returns the service contexts for the mbeans whose status is not CREATED, RUNNING, STOPPED or DESTROYED.
 void postDeregister()
           
 void postRegister(Boolean registrationDone)
           
 void preDeregister()
           
 javax.management.ObjectName preRegister(javax.management.MBeanServer server, javax.management.ObjectName name)
          #Description of the Method
 void register(javax.management.ObjectName serviceName)
          Register the mbean against the microkernel with no dependencies.
 void register(javax.management.ObjectName serviceName, Collection depends)
          Register the mbean against the microkernel with dependencies.
 void remove(javax.management.ObjectName objectName)
          This MBean is going bye bye
 void restart(javax.management.ObjectName serviceName)
          Stops and restarts the given service
 void setServiceBinding(ServiceBinding serviceBinding)
          Plugin a ServiceBinding policy
 void shutdown()
          Describe shutdown method here.
 void start(javax.management.ObjectName serviceName)
          Starts the indicated service
 void stop(javax.management.ObjectName serviceName)
          Stop the given service
 void validateDeploymentState(DeploymentInfo di, DeploymentState state)
          Go through the mbeans of the DeploymentInfo and validate that they are in a state at least equal to that of the argument state
 
Methods inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport
addNotificationListener, getNotificationInfo, handleNotification, nextNotificationSequenceNumber, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_LOADER_REPOSITORY

public static final javax.management.ObjectName DEFAULT_LOADER_REPOSITORY
The ObjectName of the default loader repository


JBOSS_INTERNAL_LIFECYCLE

public static final String JBOSS_INTERNAL_LIFECYCLE
The operation name for lifecycle

See Also:
Constant Field Values

JBOSS_INTERNAL_LIFECYCLE_SIG

public static final String[] JBOSS_INTERNAL_LIFECYCLE_SIG
The signature for lifecycle operations


server

protected javax.management.MBeanServer server
A callback to the JMX MBeanServer


creator

protected ServiceCreator creator
Creator, helper class to instantiate MBeans


configurator

protected ServiceConfigurator configurator
Configurator, helper class to configure MBeans


nameToServiceMap

protected Map nameToServiceMap
ObjectName to ServiceContext map


installedServices

protected List installedServices
A linked list of services in the order they were created

Constructor Detail

ServiceController

public ServiceController()
Method Detail

setServiceBinding

public void setServiceBinding(ServiceBinding serviceBinding)
Plugin a ServiceBinding policy

Specified by:
setServiceBinding in interface ServiceControllerMBean
Parameters:
serviceBinding - policy

listDeployed

public List listDeployed()
Lists the ServiceContexts of deployed mbeans

Specified by:
listDeployed in interface ServiceControllerMBean
Returns:
the list of ServiceContexts for mbeans deployed through ServiceController.

listIncompletelyDeployed

public List listIncompletelyDeployed()
The listIncompletelyDeployed method returns the service contexts for the mbeans whose status is not CREATED, RUNNING, STOPPED or DESTROYED. An MBean that has reached one of the above states has its dependencies resolved.

Specified by:
listIncompletelyDeployed in interface ServiceControllerMBean
Returns:
a List

listDeployedNames

public List listDeployedNames()
lists ObjectNames of deployed mbeans deployed through serviceController.

Specified by:
listDeployedNames in interface ServiceControllerMBean
Returns:
a list of ObjectNames of deployed mbeans.

listConfiguration

public String listConfiguration(javax.management.ObjectName[] objectNames)
                         throws Exception
Gets the Configuration attribute of the ServiceController object

Specified by:
listConfiguration in interface ServiceControllerMBean
Parameters:
objectNames - Description of Parameter
Returns:
The Configuration value
Throws:
Exception - Description of Exception

validateDeploymentState

public void validateDeploymentState(DeploymentInfo di,
                                    DeploymentState state)
Go through the mbeans of the DeploymentInfo and validate that they are in a state at least equal to that of the argument state

Specified by:
validateDeploymentState in interface ServiceControllerMBean

install

public List install(Element config,
                    javax.management.ObjectName loaderName)
             throws DeploymentException
Deploy the beans Deploy means "instantiate and configure" so the MBean is created in the MBeanServer You must call "create" and "start" separately on the MBean to affect the service lifecycle deploy doesn't bother with service lifecycle only MBean instanciation/registration/configuration

Specified by:
install in interface ServiceControllerMBean
Parameters:
config -
loaderName -
Returns:
Description of the Returned Value
Throws:
DeploymentException

register

public void register(javax.management.ObjectName serviceName)
              throws Exception
Register the mbean against the microkernel with no dependencies.

Specified by:
register in interface ServiceControllerMBean
Throws:
Exception
See Also:
register(ObjectName, java.util.Collection)

register

public void register(javax.management.ObjectName serviceName,
                     Collection depends)
              throws Exception
Description copied from interface: ServiceControllerMBean
Register the mbean against the microkernel with dependencies.

Specified by:
register in interface ServiceControllerMBean
Throws:
Exception
See Also:
register(ServiceContext, java.util.Collection)

create

public void create(javax.management.ObjectName serviceName)
            throws Exception
#Description of the Method

Specified by:
create in interface ServiceControllerMBean
Parameters:
serviceName - Description of Parameter
Throws:
Exception - Description of Exception

create

public void create(javax.management.ObjectName serviceName,
                   Collection depends)
            throws Exception
#Description of the Method

Specified by:
create in interface ServiceControllerMBean
Parameters:
serviceName - Description of Parameter
Throws:
Exception - Description of Exception

start

public void start(javax.management.ObjectName serviceName)
           throws Exception
Starts the indicated service

Specified by:
start in interface ServiceControllerMBean
Parameters:
serviceName - Description of Parameter
Throws:
Exception - Description of Exception

restart

public void restart(javax.management.ObjectName serviceName)
             throws Exception
Stops and restarts the given service

Specified by:
restart in interface ServiceControllerMBean
Parameters:
serviceName - Description of Parameter
Throws:
Exception - Description of Exception

stop

public void stop(javax.management.ObjectName serviceName)
          throws Exception
Stop the given service

Specified by:
stop in interface ServiceControllerMBean
Parameters:
serviceName - Description of Parameter
Throws:
Exception - Description of Exception

destroy

public void destroy(javax.management.ObjectName serviceName)
             throws Exception
#Description of the Method

Specified by:
destroy in interface ServiceControllerMBean
Parameters:
serviceName - Description of Parameter
Throws:
Exception - Description of Exception

remove

public void remove(javax.management.ObjectName objectName)
            throws Exception
This MBean is going bye bye

Specified by:
remove in interface ServiceControllerMBean
Parameters:
objectName - Description of Parameter
Throws:
Exception - Description of Exception

getServiceContext

public ServiceContext getServiceContext(javax.management.ObjectName serviceName)
Lookup the ServiceContext for the given serviceName

Specified by:
getServiceContext in interface ServiceControllerMBean

shutdown

public void shutdown()
Describe shutdown method here.

Specified by:
shutdown in interface ServiceControllerMBean

preRegister

public javax.management.ObjectName preRegister(javax.management.MBeanServer server,
                                               javax.management.ObjectName name)
                                        throws Exception
#Description of the Method

Specified by:
preRegister in interface javax.management.MBeanRegistration
Parameters:
server - Description of Parameter
name - Description of Parameter
Returns:
Description of the Returned Value
Throws:
Exception - Description of Exception

postRegister

public void postRegister(Boolean registrationDone)
Specified by:
postRegister in interface javax.management.MBeanRegistration

preDeregister

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

postDeregister

public void postDeregister()
Specified by:
postDeregister in interface javax.management.MBeanRegistration


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.