org.apache.servicemix.jbi.management
Class ManagementContext

java.lang.Object
  extended by org.apache.servicemix.jbi.management.BaseLifeCycle
      extended by org.apache.servicemix.jbi.management.BaseSystemService
          extended by org.apache.servicemix.jbi.management.ManagementContext
All Implemented Interfaces:
javax.jbi.management.AdminServiceMBean, javax.jbi.management.LifeCycleMBean, ManagementContextMBean, MBeanInfoProvider

public class ManagementContext
extends BaseSystemService
implements ManagementContextMBean

Management Context applied to a ServiceMix container

Version:
$Revision: 665810 $

Field Summary
static String DEFAULT_CONNECTOR_PATH
           
static int DEFAULT_CONNECTOR_PORT
           
static String DEFAULT_DOMAIN
          Default servicemix domain
protected  Map<String,ObjectName> systemServices
           
 
Fields inherited from class org.apache.servicemix.jbi.management.BaseSystemService
container
 
Fields inherited from class org.apache.servicemix.jbi.management.BaseLifeCycle
currentState, INITIALIZED, listener
 
Fields inherited from interface javax.jbi.management.LifeCycleMBean
SHUTDOWN, STARTED, STOPPED, UNKNOWN
 
Constructor Summary
ManagementContext()
          Default Constructor
 
Method Summary
 ObjectName createCustomComponentMBeanName(String type, String name)
          Formulate and return the MBean ObjectName of a custom control MBean for a JBI component.
 ObjectName createObjectName(Map<String,String> props)
          Create an ObjectName
 ObjectName createObjectName(MBeanInfoProvider provider)
          Create an ObjectName
 ObjectName createObjectName(String name)
          Create an ObjectName
 ObjectName createObjectName(String domain, Map<String,String> props)
          Create an ObjectName
 Map<String,String> createObjectNameProps(MBeanInfoProvider provider)
          Create a String used to create an ObjectName
 Map<String,String> createObjectNameProps(MBeanInfoProvider provider, boolean subTypeBeforeName)
          Create a String used to create an ObjectName
 MBeanAttributeInfo[] getAttributeInfos()
          Get an array of MBeanOperationInfo
 ObjectName[] getBindingComponents()
          Get a list of all binding components currently installed.
 ObjectName getComponentByName(String componentName)
          Lookup a JBI Installable Component by its unique name.
static ObjectName getContainerObjectName(String domainName, String containerName)
           
 String getDescription()
          Get the Description of the item
 ObjectName[] getEngineComponents()
          Get a list of all engines currently installed.
 String getJmxDomainName()
           
 MBeanServer getMBeanServer()
          Get the MBeanServer
 int getNamingPort()
           
 MBeanOperationInfo[] getOperationInfos()
          Get an array of MBeanOperationInfo
 ObjectName[] getPojoComponents()
           
protected  Class<ManagementContextMBean> getServiceMBean()
           
 String getSystemInfo()
          Return current version and other info about this JBI Framework.
static ObjectName getSystemObjectName(String domainName, String containerName, Class interfaceType)
          Retrive an System ObjectName
 ObjectName getSystemService(String serviceName)
          Lookup a system service by name.
static String getSystemServiceName(Class interfaceType)
           
 ObjectName[] getSystemServices()
          Looks up all JBI Framework System Services currently installed.
 void init(JBIContainer container, MBeanServer server)
          Initialize the ManagementContext
 boolean isBinding(String componentName)
          Check if a given JBI Installable Component is a Binding Component.
 boolean isCreateJmxConnector()
           
 boolean isCreateMBeanServer()
           
 boolean isEngine(String componentName)
          Check if a given JBI Component is a service engine.
 boolean isUseMBeanServer()
           
 void registerMBean(ObjectName name, MBeanInfoProvider resource, Class interfaceMBean)
          Register an MBean
 void registerMBean(ObjectName name, Object resource, Class interfaceMBean, String description)
          Register an MBean
 void registerSystemService(BaseSystemService service, Class interfaceType)
          Register a System service
 void setCreateJmxConnector(boolean createJmxConnector)
           
 void setCreateMBeanServer(boolean enableJMX)
           
 void setNamingPort(int portNum)
           
 void setUseMBeanServer(boolean useMBeanServer)
           
 void shutDown()
          Shut down the item.
 String shutDownComponent(String componentName)
          Shutdown a Component
 void start()
          Start the item.
 String startComponent(String componentName)
          Start a Component
 void stop()
          Stop the item.
 String stopComponent(String componentName)
          Stop a Component
 void unregisterMBean(Object bean)
          Unregister an MBean
 void unregisterMBean(ObjectName name)
          Unregister an MBean
 void unregisterSystemService(BaseSystemService service)
          Unregister a System service
 
Methods inherited from class org.apache.servicemix.jbi.management.BaseSystemService
getContainer, getName, getType, init
 
Methods inherited from class org.apache.servicemix.jbi.management.BaseLifeCycle
firePropertyChanged, getCurrentState, getObjectToManage, getSubType, init, isInitialized, isShutDown, isStarted, isStopped, isUnknown, setCurrentState, setPropertyChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_DOMAIN

public static final String DEFAULT_DOMAIN
Default servicemix domain

See Also:
Constant Field Values

DEFAULT_CONNECTOR_PATH

public static final String DEFAULT_CONNECTOR_PATH
See Also:
Constant Field Values

DEFAULT_CONNECTOR_PORT

public static final int DEFAULT_CONNECTOR_PORT
See Also:
Constant Field Values

systemServices

protected Map<String,ObjectName> systemServices
Constructor Detail

ManagementContext

public ManagementContext()
Default Constructor

Method Detail

getDescription

public String getDescription()
Get the Description of the item

Specified by:
getDescription in interface MBeanInfoProvider
Returns:
the description

getMBeanServer

public MBeanServer getMBeanServer()
Get the MBeanServer

Returns:
the MBeanServer

getJmxDomainName

public String getJmxDomainName()
Returns:
the domain

isUseMBeanServer

public boolean isUseMBeanServer()
Returns:
Returns the useMBeanServer.

setUseMBeanServer

public void setUseMBeanServer(boolean useMBeanServer)
Parameters:
useMBeanServer - The useMBeanServer to set.

isCreateMBeanServer

public boolean isCreateMBeanServer()
Returns:
Returns the createMBeanServer flag.

setCreateMBeanServer

public void setCreateMBeanServer(boolean enableJMX)
Parameters:
enableJMX - Set createMBeanServer.

setNamingPort

public void setNamingPort(int portNum)

getNamingPort

public int getNamingPort()

isCreateJmxConnector

public boolean isCreateJmxConnector()

setCreateJmxConnector

public void setCreateJmxConnector(boolean createJmxConnector)

init

public void init(JBIContainer container,
                 MBeanServer server)
          throws javax.jbi.JBIException
Initialize the ManagementContext

Parameters:
container -
server -
Throws:
javax.jbi.JBIException

getServiceMBean

protected Class<ManagementContextMBean> getServiceMBean()
Specified by:
getServiceMBean in class BaseSystemService

start

public void start()
           throws javax.jbi.JBIException
Start the item.

Specified by:
start in interface javax.jbi.management.LifeCycleMBean
Overrides:
start in class BaseLifeCycle
Throws:
javax.jbi.JBIException - if the item fails to start.

stop

public void stop()
          throws javax.jbi.JBIException
Stop the item. This suspends current messaging activities.

Specified by:
stop in interface javax.jbi.management.LifeCycleMBean
Overrides:
stop in class BaseLifeCycle
Throws:
javax.jbi.JBIException - if the item fails to stop.

shutDown

public void shutDown()
              throws javax.jbi.JBIException
Shut down the item. The releases resources, preparatory to uninstallation.

Specified by:
shutDown in interface javax.jbi.management.LifeCycleMBean
Overrides:
shutDown in class BaseSystemService
Throws:
javax.jbi.JBIException - if the item fails to shut down.

getBindingComponents

public ObjectName[] getBindingComponents()
Get a list of all binding components currently installed.

Specified by:
getBindingComponents in interface javax.jbi.management.AdminServiceMBean
Returns:
array of JMX object names of all installed BCs.

getComponentByName

public ObjectName getComponentByName(String componentName)
Lookup a JBI Installable Component by its unique name.

Specified by:
getComponentByName in interface javax.jbi.management.AdminServiceMBean
Parameters:
componentName - - is the name of the BC or SE.
Returns:
the JMX object name of the component's LifeCycle MBean or null.

getEngineComponents

public ObjectName[] getEngineComponents()
Get a list of all engines currently installed.

Specified by:
getEngineComponents in interface javax.jbi.management.AdminServiceMBean
Returns:
array of JMX object names of all installed SEs.

getPojoComponents

public ObjectName[] getPojoComponents()
Specified by:
getPojoComponents in interface ManagementContextMBean
Returns:
an array of ObjectNames for all Pojo components

getSystemInfo

public String getSystemInfo()
Return current version and other info about this JBI Framework.

Specified by:
getSystemInfo in interface javax.jbi.management.AdminServiceMBean
Returns:
info String

getSystemService

public ObjectName getSystemService(String serviceName)
Lookup a system service by name.

Specified by:
getSystemService in interface javax.jbi.management.AdminServiceMBean
Parameters:
serviceName - - is the name of the system service
Returns:
the JMX object name of the service or null

getSystemServices

public ObjectName[] getSystemServices()
Looks up all JBI Framework System Services currently installed.

Specified by:
getSystemServices in interface javax.jbi.management.AdminServiceMBean
Returns:
array of JMX object names of system services

isBinding

public boolean isBinding(String componentName)
Check if a given JBI Installable Component is a Binding Component.

Specified by:
isBinding in interface javax.jbi.management.AdminServiceMBean
Parameters:
componentName - - the unique name of the component
Returns:
true if the component is a binding

isEngine

public boolean isEngine(String componentName)
Check if a given JBI Component is a service engine.

Specified by:
isEngine in interface javax.jbi.management.AdminServiceMBean
Parameters:
componentName - - the unique name of the component
Returns:
true if the component is a service engine

startComponent

public String startComponent(String componentName)
                      throws javax.jbi.JBIException
Start a Component

Specified by:
startComponent in interface ManagementContextMBean
Parameters:
componentName -
Returns:
the status
Throws:
javax.jbi.JBIException

stopComponent

public String stopComponent(String componentName)
                     throws javax.jbi.JBIException
Stop a Component

Specified by:
stopComponent in interface ManagementContextMBean
Parameters:
componentName -
Returns:
the status
Throws:
javax.jbi.JBIException

shutDownComponent

public String shutDownComponent(String componentName)
                         throws javax.jbi.JBIException
Shutdown a Component

Specified by:
shutDownComponent in interface ManagementContextMBean
Parameters:
componentName -
Returns:
the status
Throws:
javax.jbi.JBIException

createCustomComponentMBeanName

public ObjectName createCustomComponentMBeanName(String type,
                                                 String name)
Formulate and return the MBean ObjectName of a custom control MBean for a JBI component.

Parameters:
type -
name -
Returns:
the JMX ObjectName of the MBean, or null if customName is invalid.

createObjectName

public ObjectName createObjectName(MBeanInfoProvider provider)
Create an ObjectName

Parameters:
provider -
Returns:
the ObjectName

createObjectName

public ObjectName createObjectName(String name)
Create an ObjectName

Parameters:
name -
Returns:
the ObjectName

createObjectName

public ObjectName createObjectName(String domain,
                                   Map<String,String> props)
Create an ObjectName

Parameters:
domain -
Returns:
the ObjectName

createObjectName

public ObjectName createObjectName(Map<String,String> props)
Create an ObjectName

Parameters:
props -
Returns:
the ObjectName

createObjectNameProps

public Map<String,String> createObjectNameProps(MBeanInfoProvider provider)
Create a String used to create an ObjectName

Parameters:
provider -
Returns:
the ObjectName

createObjectNameProps

public Map<String,String> createObjectNameProps(MBeanInfoProvider provider,
                                                boolean subTypeBeforeName)
Create a String used to create an ObjectName

Parameters:
provider -
Returns:
the ObjectName

registerMBean

public void registerMBean(ObjectName name,
                          MBeanInfoProvider resource,
                          Class interfaceMBean)
                   throws JMException
Register an MBean

Parameters:
resource -
name -
interfaceMBean -
Throws:
JMException

registerMBean

public void registerMBean(ObjectName name,
                          Object resource,
                          Class interfaceMBean,
                          String description)
                   throws JMException
Register an MBean

Parameters:
resource -
name -
interfaceMBean -
description -
Throws:
JMException

getSystemObjectName

public static ObjectName getSystemObjectName(String domainName,
                                             String containerName,
                                             Class interfaceType)
Retrive an System ObjectName

Parameters:
domainName -
containerName -
interfaceType -
Returns:
the ObjectName

getSystemServiceName

public static String getSystemServiceName(Class interfaceType)

getContainerObjectName

public static ObjectName getContainerObjectName(String domainName,
                                                String containerName)

registerSystemService

public void registerSystemService(BaseSystemService service,
                                  Class interfaceType)
                           throws javax.jbi.JBIException
Register a System service

Parameters:
service -
interfaceType -
Throws:
javax.jbi.JBIException

unregisterSystemService

public void unregisterSystemService(BaseSystemService service)
                             throws javax.jbi.JBIException
Unregister a System service

Parameters:
service -
Throws:
javax.jbi.JBIException

unregisterMBean

public void unregisterMBean(ObjectName name)
                     throws javax.jbi.JBIException
Unregister an MBean

Parameters:
name -
Throws:
javax.jbi.JBIException

unregisterMBean

public void unregisterMBean(Object bean)
                     throws javax.jbi.JBIException
Unregister an MBean

Parameters:
bean -
Throws:
javax.jbi.JBIException

getAttributeInfos

public MBeanAttributeInfo[] getAttributeInfos()
                                       throws JMException
Get an array of MBeanOperationInfo

Specified by:
getAttributeInfos in interface MBeanInfoProvider
Overrides:
getAttributeInfos in class BaseLifeCycle
Returns:
array of OperationInfos
Throws:
JMException

getOperationInfos

public MBeanOperationInfo[] getOperationInfos()
                                       throws JMException
Description copied from class: BaseLifeCycle
Get an array of MBeanOperationInfo

Specified by:
getOperationInfos in interface MBeanInfoProvider
Overrides:
getOperationInfos in class BaseLifeCycle
Returns:
array of OperationInfos
Throws:
JMException


Copyright © 2005-2008 Apache Software Foundation. All Rights Reserved.