org.apache.servicemix.jbi.framework
Class Registry

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.framework.Registry
All Implemented Interfaces:
javax.jbi.management.LifeCycleMBean, RegistryMBean, MBeanInfoProvider

public class Registry
extends BaseSystemService
implements RegistryMBean

Registry - state infomation including running state, SA's deployed etc.

Version:
$Revision: 695373 $

Field Summary
 
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
Registry()
          Constructor
 
Method Summary
 javax.jbi.servicedesc.ServiceEndpoint activateEndpoint(ComponentContextImpl context, QName serviceName, String endpointName)
           
 void addPendingAssembly(ServiceAssemblyLifeCycle sa)
           
 void addPendingComponent(ComponentMBeanImpl comp)
           
 void cancelPendingExchanges()
          Cancel pending exchanges in all components
 void checkPendingAssemblies()
           
 void checkPendingComponents()
           
 void deactivateEndpoint(javax.jbi.component.ComponentContext provider, InternalEndpoint serviceEndpoint)
           
 void deregisterComponent(ComponentMBeanImpl component)
           
 void deregisterExternalEndpoint(ComponentNameSpace cns, javax.jbi.servicedesc.ServiceEndpoint externalEndpoint)
           
 InternalEndpoint deregisterSubscription(ComponentContextImpl context, SubscriptionSpec subscription)
           
 void deregisterSubscriptions(ComponentContextImpl context, ActivationSpec as)
          Deregister All subscriptions
 MBeanAttributeInfo[] getAttributeInfos()
          Get an array of MBeanAttributeInfo
 ObjectName[] getBindingComponents()
          Get a list of all binding components currently installed.
 ComponentMBeanImpl getComponent(ComponentNameSpace cns)
          Get a Component
 ComponentMBeanImpl getComponent(String name)
          Get a Component
 ObjectName[] getComponentNames()
           
 ComponentRegistry getComponentRegistry()
           
 Collection<ComponentMBeanImpl> getComponents()
           
 String[] getComponentsForDeployedServiceAssembly(String saName)
          Returns a list of components(to which SUs are targeted for) in a Service Assembly.
 String[] getDeployedServiceAssemblies()
          Returns a list of Service Assemblies deployed to the JBI enviroment.
 String[] getDeployedServiceAssembliesForComponent(String componentName)
          Returns a list of Service Assemblies that contain SUs for the given component.
 ServiceUnitLifeCycle[] getDeployedServiceUnits(String componentName)
          Returns a list of Service Units that are currently deployed to the given component.
 String getDescription()
          Get the description
 javax.jbi.servicedesc.ServiceEndpoint getEndpoint(QName service, String name)
           
 Document getEndpointDescriptor(javax.jbi.servicedesc.ServiceEndpoint endpoint)
          Retrieve the service description metadata for the specified endpoint.
 ObjectName[] getEndpointNames()
           
 EndpointRegistry getEndpointRegistry()
           
 javax.jbi.servicedesc.ServiceEndpoint[] getEndpointsForComponent(ComponentNameSpace cns)
           
 javax.jbi.servicedesc.ServiceEndpoint[] getEndpointsForInterface(QName interfaceName)
           
 javax.jbi.servicedesc.ServiceEndpoint[] getEndpointsForService(QName serviceName)
           
 ObjectName[] getEngineComponents()
          Get a list of all engines currently installed.
protected  EnvironmentContext getEnvironmentContext()
           
 javax.jbi.servicedesc.ServiceEndpoint[] getExternalEndpoints(QName interfaceName)
           
 javax.jbi.servicedesc.ServiceEndpoint[] getExternalEndpointsForService(QName serviceName)
           
 javax.jbi.servicedesc.ServiceEndpoint getInternalEndpoint(QName service, String name)
           
 List<InternalEndpoint> getMatchingSubscriptionEndpoints(MessageExchangeImpl exchange)
           
 ObjectName[] getPojoComponents()
          Get a list of all pojos currently installed.
 Collection<ServiceAssemblyLifeCycle> getServiceAssemblies()
           
 ServiceAssemblyLifeCycle getServiceAssembly(String saName)
          Get a named ServiceAssembly
 ObjectName[] getServiceAssemblyNames()
           
protected  Class getServiceMBean()
           
 ServiceUnitLifeCycle getServiceUnit(String suKey)
          Get a ServiceUnit by its key.
 ObjectName[] getServiceUnitNames()
           
 Collection<ServiceUnitLifeCycle> getServiceUnits()
          Return a list of all service units.
 Collection<SharedLibrary> getSharedLibraries()
           
 SharedLibrary getSharedLibrary(String name)
           
 ObjectName[] getSharedLibraryNames()
           
 void init(JBIContainer container)
           
protected  boolean isContainerEmbedded()
           
 boolean isSADeployedServiceUnit(String componentName, String suName)
          Returns a boolean value indicating whether the SU is currently deployed.
protected  InternalEndpoint matchEndpointByName(javax.jbi.servicedesc.ServiceEndpoint[] endpoints, String endpointName)
           
 ComponentMBeanImpl registerComponent(ComponentNameSpace name, String description, javax.jbi.component.Component component, boolean binding, boolean service, String[] sharedLibs)
          REgister a local Component
 void registerEndpointConnection(QName fromSvc, String fromEp, QName toSvc, String toEp, String link)
           
 void registerExternalEndpoint(ComponentNameSpace cns, javax.jbi.servicedesc.ServiceEndpoint externalEndpoint)
           
 void registerInterfaceConnection(QName fromItf, QName toSvc, String toEp)
           
 void registerRemoteEndpoint(javax.jbi.servicedesc.ServiceEndpoint endpoint)
           
 ServiceAssemblyLifeCycle registerServiceAssembly(ServiceAssembly sa, ServiceAssemblyEnvironment env)
          Register a service assembly
 ServiceAssemblyLifeCycle registerServiceAssembly(ServiceAssembly sa, String[] suKeys, ServiceAssemblyEnvironment env)
          Register a service assembly
 String registerServiceUnit(ServiceUnit su, String saName, File suDir)
          Register a ServiceUnit.
 void registerSharedLibrary(SharedLibrary sl, File installationDir)
           
 void registerSubscription(ComponentContextImpl context, SubscriptionSpec subscription, javax.jbi.servicedesc.ServiceEndpoint endpoint)
           
 void registerSubscriptions(ComponentContextImpl context, ActivationSpec as)
          Register All subscriptions
 javax.jbi.servicedesc.ServiceEndpoint resolveEndpointReference(DocumentFragment epr)
          Resolve the given endpoint reference into a service endpoint.
 javax.jbi.servicedesc.ServiceEndpoint resolveInternalEPR(DocumentFragment epr)
           Resolve an internal JBI EPR conforming to the format defined in the JBI specification.
 javax.jbi.servicedesc.ServiceEndpoint resolveStandardEPR(DocumentFragment epr)
          Resolve a standard EPR understood by ServiceMix container.
 void shutDown()
          shutdown all Components
 void start()
          start brokering
protected  void startPendingAssemblies()
           
protected  void startPendingComponents()
           
 void stop()
          stop brokering
 void unregisterEndpointConnection(QName fromSvc, String fromEp)
           
 void unregisterInterfaceConnection(QName fromItf)
           
 void unregisterRemoteEndpoint(javax.jbi.servicedesc.ServiceEndpoint endpoint)
           
 boolean unregisterServiceAssembly(String saName)
          Un-register a service assembly
 void unregisterServiceUnit(String suKey)
          Unregister a ServiceUnit by its key.
 void unregisterSharedLibrary(String name)
           
 
Methods inherited from class org.apache.servicemix.jbi.management.BaseSystemService
getContainer, getName, getType
 
Methods inherited from class org.apache.servicemix.jbi.management.BaseLifeCycle
firePropertyChanged, getCurrentState, getObjectToManage, getOperationInfos, 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
 
Methods inherited from interface javax.jbi.management.LifeCycleMBean
getCurrentState
 

Constructor Detail

Registry

public Registry()
Constructor

Method Detail

getDescription

public String getDescription()
Get the description

Specified by:
getDescription in interface MBeanInfoProvider
Returns:
description

getServiceMBean

protected Class getServiceMBean()
Specified by:
getServiceMBean in class BaseSystemService

getComponentRegistry

public ComponentRegistry getComponentRegistry()

getEndpointRegistry

public EndpointRegistry getEndpointRegistry()

init

public void init(JBIContainer container)
          throws javax.jbi.JBIException
Overrides:
init in class BaseSystemService
Throws:
javax.jbi.JBIException

start

public void start()
           throws javax.jbi.JBIException
start brokering

Specified by:
start in interface javax.jbi.management.LifeCycleMBean
Overrides:
start in class BaseLifeCycle
Throws:
javax.jbi.JBIException

stop

public void stop()
          throws javax.jbi.JBIException
stop brokering

Specified by:
stop in interface javax.jbi.management.LifeCycleMBean
Overrides:
stop in class BaseLifeCycle
Throws:
javax.jbi.JBIException

shutDown

public void shutDown()
              throws javax.jbi.JBIException
shutdown all Components

Specified by:
shutDown in interface javax.jbi.management.LifeCycleMBean
Overrides:
shutDown in class BaseSystemService
Throws:
javax.jbi.JBIException

getEnvironmentContext

protected EnvironmentContext getEnvironmentContext()
Returns:
the EnvironmentContext

isContainerEmbedded

protected boolean isContainerEmbedded()
Returns:
true if the container is embedded

matchEndpointByName

protected InternalEndpoint matchEndpointByName(javax.jbi.servicedesc.ServiceEndpoint[] endpoints,
                                               String endpointName)

activateEndpoint

public javax.jbi.servicedesc.ServiceEndpoint activateEndpoint(ComponentContextImpl context,
                                                              QName serviceName,
                                                              String endpointName)
                                                       throws javax.jbi.JBIException
Parameters:
context -
serviceName -
endpointName -
Returns:
EndPointReference
Throws:
javax.jbi.JBIException

getEndpointsForComponent

public javax.jbi.servicedesc.ServiceEndpoint[] getEndpointsForComponent(ComponentNameSpace cns)

getEndpointsForInterface

public javax.jbi.servicedesc.ServiceEndpoint[] getEndpointsForInterface(QName interfaceName)
Parameters:
interfaceName - qualified name
Returns:
an array of available endpoints for the specified interface name;

deactivateEndpoint

public void deactivateEndpoint(javax.jbi.component.ComponentContext provider,
                               InternalEndpoint serviceEndpoint)
Parameters:
provider -
serviceEndpoint -

getEndpointDescriptor

public Document getEndpointDescriptor(javax.jbi.servicedesc.ServiceEndpoint endpoint)
                               throws javax.jbi.JBIException
Retrieve the service description metadata for the specified endpoint.

Note that the result can use either the WSDL 1.1 or WSDL 2.0 description language.

Parameters:
endpoint - endpoint reference; must be non-null.
Returns:
metadata describing endpoint, or null if metadata is unavailable.
Throws:
javax.jbi.JBIException - invalid endpoint reference.

resolveEndpointReference

public javax.jbi.servicedesc.ServiceEndpoint resolveEndpointReference(DocumentFragment epr)
Resolve the given endpoint reference into a service endpoint. This is called by the component when it has an EPR that it wants to resolve into a service endpoint.

Note that the service endpoint returned refers to a dynamic endpoint; the endpoint will exist only as long as this component retains a strong reference to the object returned by this method. The endpoint may not be included in the list of "activated" endpoints.

Parameters:
epr - endpoint reference as an XML fragment; must be non-null.
Returns:
the service endpoint corresponding to the given endpoint reference; null if the reference cannot be resolved.

resolveInternalEPR

public javax.jbi.servicedesc.ServiceEndpoint resolveInternalEPR(DocumentFragment epr)

Resolve an internal JBI EPR conforming to the format defined in the JBI specification.

The EPR would look like:

 
 

Parameters:
epr - EPR fragment
Returns:
internal service endpoint corresponding to the EPR, or null if the EPR is not an internal EPR or if the EPR cannot be resolved

resolveStandardEPR

public javax.jbi.servicedesc.ServiceEndpoint resolveStandardEPR(DocumentFragment epr)
Resolve a standard EPR understood by ServiceMix container. Currently, the supported syntax is the WSA one, the address uri being parsed with the following possiblities: jbi:endpoint:service-namespace/service-name/endpoint jbi:endpoint:service-namespace:service-name:endpoint The full EPR will look like: jbi:endpoint:http://foo.bar.com/service/endpoint BCs should also be able to resolve such EPR but using their own URI parsing, for example: http://foo.bar.com/myService?http.soap=true or jms://activemq/queue/FOO.BAR?persistent=true Note that the separator should be same as the one used in the namespace depending on the namespace: http://foo.bar.com => '/' urn:foo:bar => ':' The syntax is the same as the one that can be used to specifiy a target for a JBI exchange with the restriction that it only allows the endpoint subprotocol to be used.

Parameters:
epr -
Returns:

registerExternalEndpoint

public void registerExternalEndpoint(ComponentNameSpace cns,
                                     javax.jbi.servicedesc.ServiceEndpoint externalEndpoint)
                              throws javax.jbi.JBIException
Parameters:
provider -
externalEndpoint - the external endpoint to be registered, must be non-null.
Throws:
javax.jbi.JBIException

deregisterExternalEndpoint

public void deregisterExternalEndpoint(ComponentNameSpace cns,
                                       javax.jbi.servicedesc.ServiceEndpoint externalEndpoint)
Parameters:
provider -
externalEndpoint - the external endpoint to be deregistered; must be non-null.

getEndpoint

public javax.jbi.servicedesc.ServiceEndpoint getEndpoint(QName service,
                                                         String name)
Parameters:
service -
name -
Returns:
endpoint

getInternalEndpoint

public javax.jbi.servicedesc.ServiceEndpoint getInternalEndpoint(QName service,
                                                                 String name)

getEndpointsForService

public javax.jbi.servicedesc.ServiceEndpoint[] getEndpointsForService(QName serviceName)
Parameters:
serviceName -
Returns:
endpoints

getExternalEndpoints

public javax.jbi.servicedesc.ServiceEndpoint[] getExternalEndpoints(QName interfaceName)
Parameters:
interfaceName -
Returns:
endpoints

getExternalEndpointsForService

public javax.jbi.servicedesc.ServiceEndpoint[] getExternalEndpointsForService(QName serviceName)
Parameters:
serviceName -
Returns:
endpoints

registerComponent

public ComponentMBeanImpl registerComponent(ComponentNameSpace name,
                                            String description,
                                            javax.jbi.component.Component component,
                                            boolean binding,
                                            boolean service,
                                            String[] sharedLibs)
                                     throws javax.jbi.JBIException
REgister a local Component

Parameters:
name -
description -
component -
dc -
binding -
service -
Returns:
ComponentConnector
Throws:
javax.jbi.JBIException

deregisterComponent

public void deregisterComponent(ComponentMBeanImpl component)
Parameters:
component -

getComponents

public Collection<ComponentMBeanImpl> getComponents()
Returns:
all local ComponentConnectors

getComponent

public ComponentMBeanImpl getComponent(ComponentNameSpace cns)
Get a Component

Parameters:
cns -
Returns:
the Component

getComponent

public ComponentMBeanImpl getComponent(String name)
Get a Component

Parameters:
name -
Returns:
the Componment

getEngineComponents

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

Returns:
array of JMX object names of all installed SEs.

getBindingComponents

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

Returns:
array of JMX object names of all installed BCs.

getPojoComponents

public ObjectName[] getPojoComponents()
Get a list of all pojos currently installed.

Returns:
array of JMX object names of all installed PJOJO Conponents.

registerSubscriptions

public void registerSubscriptions(ComponentContextImpl context,
                                  ActivationSpec as)
Register All subscriptions

Parameters:
context -
as -

deregisterSubscriptions

public void deregisterSubscriptions(ComponentContextImpl context,
                                    ActivationSpec as)
Deregister All subscriptions

Parameters:
context -
as -

registerSubscription

public void registerSubscription(ComponentContextImpl context,
                                 SubscriptionSpec subscription,
                                 javax.jbi.servicedesc.ServiceEndpoint endpoint)
Parameters:
context -
subscription -
endpoint -

deregisterSubscription

public InternalEndpoint deregisterSubscription(ComponentContextImpl context,
                                               SubscriptionSpec subscription)
Parameters:
context -
subscription -
Returns:
the ServiceEndpoint

getMatchingSubscriptionEndpoints

public List<InternalEndpoint> getMatchingSubscriptionEndpoints(MessageExchangeImpl exchange)
Parameters:
exchange -
Returns:
a List of matching endpoints - can return null if no matches

registerServiceAssembly

public ServiceAssemblyLifeCycle registerServiceAssembly(ServiceAssembly sa,
                                                        ServiceAssemblyEnvironment env)
                                                 throws javax.jbi.management.DeploymentException
Register a service assembly

Parameters:
sa -
Returns:
true if not already registered
Throws:
javax.jbi.management.DeploymentException

registerServiceAssembly

public ServiceAssemblyLifeCycle registerServiceAssembly(ServiceAssembly sa,
                                                        String[] suKeys,
                                                        ServiceAssemblyEnvironment env)
                                                 throws javax.jbi.management.DeploymentException
Register a service assembly

Parameters:
sa -
Returns:
true if not already registered
Throws:
javax.jbi.management.DeploymentException

unregisterServiceAssembly

public boolean unregisterServiceAssembly(String saName)
Un-register a service assembly

Parameters:
saName -
Returns:
true if successfully unregistered

getServiceAssembly

public ServiceAssemblyLifeCycle getServiceAssembly(String saName)
Get a named ServiceAssembly

Parameters:
name -
Returns:
the ServiceAssembly or null if it doesn't exist

getDeployedServiceUnits

public ServiceUnitLifeCycle[] getDeployedServiceUnits(String componentName)
Returns a list of Service Units that are currently deployed to the given component.

Parameters:
componentName - name of the component.
Returns:
List of deployed service units

getServiceUnits

public Collection<ServiceUnitLifeCycle> getServiceUnits()
Return a list of all service units.

Returns:
list of all service units

getServiceAssemblies

public Collection<ServiceAssemblyLifeCycle> getServiceAssemblies()

getDeployedServiceAssemblies

public String[] getDeployedServiceAssemblies()
Returns a list of Service Assemblies deployed to the JBI enviroment.

Returns:
list of Service Assembly Name's.

getDeployedServiceAssembliesForComponent

public String[] getDeployedServiceAssembliesForComponent(String componentName)
Returns a list of Service Assemblies that contain SUs for the given component.

Parameters:
componentName - name of the component.
Returns:
list of Service Assembly names.

getComponentsForDeployedServiceAssembly

public String[] getComponentsForDeployedServiceAssembly(String saName)
Returns a list of components(to which SUs are targeted for) in a Service Assembly.

Parameters:
saName - name of the service assembly.
Returns:
list of component names.

isSADeployedServiceUnit

public boolean isSADeployedServiceUnit(String componentName,
                                       String suName)
Returns a boolean value indicating whether the SU is currently deployed.

Parameters:
componentName - - name of component.
suName - - name of the Service Unit.
Returns:
boolean value indicating whether the SU is currently deployed.

getServiceUnit

public ServiceUnitLifeCycle getServiceUnit(String suKey)
Get a ServiceUnit by its key.

Parameters:
suKey - the key of the service unit
Returns:
the ServiceUnit or null of it doesn't exist

registerServiceUnit

public String registerServiceUnit(ServiceUnit su,
                                  String saName,
                                  File suDir)
Register a ServiceUnit.

Parameters:
su - the service unit to register
serviceAssembly - the service assembly the service unit belongs to
Returns:
the service unit key

unregisterServiceUnit

public void unregisterServiceUnit(String suKey)
Unregister a ServiceUnit by its key.

Parameters:
suKey - the key of the service unit

registerSharedLibrary

public void registerSharedLibrary(SharedLibrary sl,
                                  File installationDir)

unregisterSharedLibrary

public void unregisterSharedLibrary(String name)

getSharedLibrary

public SharedLibrary getSharedLibrary(String name)

getSharedLibraries

public Collection<SharedLibrary> getSharedLibraries()

registerEndpointConnection

public void registerEndpointConnection(QName fromSvc,
                                       String fromEp,
                                       QName toSvc,
                                       String toEp,
                                       String link)
                                throws javax.jbi.JBIException
Throws:
javax.jbi.JBIException

unregisterEndpointConnection

public void unregisterEndpointConnection(QName fromSvc,
                                         String fromEp)

registerInterfaceConnection

public void registerInterfaceConnection(QName fromItf,
                                        QName toSvc,
                                        String toEp)
                                 throws javax.jbi.JBIException
Throws:
javax.jbi.JBIException

unregisterInterfaceConnection

public void unregisterInterfaceConnection(QName fromItf)

registerRemoteEndpoint

public void registerRemoteEndpoint(javax.jbi.servicedesc.ServiceEndpoint endpoint)

unregisterRemoteEndpoint

public void unregisterRemoteEndpoint(javax.jbi.servicedesc.ServiceEndpoint endpoint)

checkPendingAssemblies

public void checkPendingAssemblies()

addPendingAssembly

public void addPendingAssembly(ServiceAssemblyLifeCycle sa)

startPendingAssemblies

protected void startPendingAssemblies()

checkPendingComponents

public void checkPendingComponents()

addPendingComponent

public void addPendingComponent(ComponentMBeanImpl comp)

startPendingComponents

protected void startPendingComponents()

getComponentNames

public ObjectName[] getComponentNames()
Specified by:
getComponentNames in interface RegistryMBean

getEndpointNames

public ObjectName[] getEndpointNames()
Specified by:
getEndpointNames in interface RegistryMBean

getServiceAssemblyNames

public ObjectName[] getServiceAssemblyNames()
Specified by:
getServiceAssemblyNames in interface RegistryMBean

getServiceUnitNames

public ObjectName[] getServiceUnitNames()
Specified by:
getServiceUnitNames in interface RegistryMBean

getSharedLibraryNames

public ObjectName[] getSharedLibraryNames()
Specified by:
getSharedLibraryNames in interface RegistryMBean

getAttributeInfos

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

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

cancelPendingExchanges

public void cancelPendingExchanges()
Cancel pending exchanges in all components



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