org.apache.servicemix.jbi.deployer.impl
Class InstallationContextImpl

java.lang.Object
  extended by org.apache.servicemix.jbi.deployer.impl.InstallationContextImpl
All Implemented Interfaces:
javax.jbi.component.ComponentContext, javax.jbi.component.InstallationContext, javax.jbi.management.MBeanNames

public class InstallationContextImpl
extends Object
implements javax.jbi.component.InstallationContext, javax.jbi.component.ComponentContext, javax.jbi.management.MBeanNames

This context contains information necessary for a JBI component to perform its installation/uninstallation processing. This is provided to the init() method of the component's Bootstrap interface.


Field Summary
 
Fields inherited from interface javax.jbi.management.MBeanNames
BOOTSTRAP_EXTENSION, COMPONENT_LIFE_CYCLE_EXTENSION
 
Constructor Summary
InstallationContextImpl(ComponentDesc descriptor, org.apache.servicemix.jbi.runtime.Environment environment)
           
 
Method Summary
 javax.jbi.servicedesc.ServiceEndpoint activateEndpoint(QName serviceName, String endpointName)
           
 ObjectName createCustomComponentMBeanName(String customName)
           
 void deactivateEndpoint(javax.jbi.servicedesc.ServiceEndpoint endpoint)
           
 void deregisterExternalEndpoint(javax.jbi.servicedesc.ServiceEndpoint externalEndpoint)
           
 List<String> getClassPathElements()
          Get a list of elements that comprise the class path for this component.
 String getComponentClassName()
          Get the name of the class that implements the Componentinterface for this component.
 String getComponentDescription()
           
 String getComponentName()
          Get the unique name assigned to this component.
 javax.jbi.component.ComponentContext getContext()
          Get the JBI context for this component.
 javax.jbi.messaging.DeliveryChannel getDeliveryChannel()
           
 ComponentDesc getDescriptor()
           
 javax.jbi.servicedesc.ServiceEndpoint getEndpoint(QName service, String name)
           
 Document getEndpointDescriptor(javax.jbi.servicedesc.ServiceEndpoint endpoint)
           
 javax.jbi.servicedesc.ServiceEndpoint[] getEndpoints(QName interfaceName)
           
 javax.jbi.servicedesc.ServiceEndpoint[] getEndpointsForService(QName serviceName)
           
 javax.jbi.servicedesc.ServiceEndpoint[] getExternalEndpoints(QName interfaceName)
           
 javax.jbi.servicedesc.ServiceEndpoint[] getExternalEndpointsForService(QName serviceName)
           
 DocumentFragment getInstallationDescriptorExtension()
          Return a DOM document fragment representing the installation descriptor (jbi.xml) extension data for the component, if any.
 String getInstallRoot()
          Get the installation root directory full path name for this component.
 String getJmxDomainName()
           
 Logger getLogger(String suffix, String resourceBundleName)
           
 javax.jbi.management.MBeanNames getMBeanNames()
           
 MBeanServer getMBeanServer()
           
 InitialContext getNamingContext()
           
 String[] getSharedLibraries()
           
 Object getTransactionManager()
           
 String getWorkspaceRoot()
           
 boolean isBinding()
           
 boolean isEngine()
           
 boolean isInstall()
          Returns true if this context was created in order to install a component into the JBI environment.
 void registerExternalEndpoint(javax.jbi.servicedesc.ServiceEndpoint externalEndpoint)
           
 javax.jbi.servicedesc.ServiceEndpoint resolveEndpointReference(DocumentFragment epr)
           
 void setClassPathElements(List classPathElements)
          Set the list of elements that comprise the class path for this component.
 void setInstall(boolean install)
           
 void setInstallRoot(File installRoot)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InstallationContextImpl

public InstallationContextImpl(ComponentDesc descriptor,
                               org.apache.servicemix.jbi.runtime.Environment environment)
Method Detail

getDescriptor

public ComponentDesc getDescriptor()
Returns:
the descriptor

getSharedLibraries

public String[] getSharedLibraries()
Returns:
the sharedLibraries

getComponentClassName

public String getComponentClassName()
Get the name of the class that implements the Componentinterface for this component. This must be the component class name given in the component's installation descriptor.

Specified by:
getComponentClassName in interface javax.jbi.component.InstallationContext
Returns:
the Componentimplementation class name, which must be non-null and non-empty.

getClassPathElements

public List<String> getClassPathElements()
Get a list of elements that comprise the class path for this component. Each element represents either a directory (containing class files) or a library file. All elements are reachable from the install root. These elements represent class path items that the component's execution-time component class loader uses, in search order. All path elements must use the file separator character appropriate to the system (i.e., File.separator).

Specified by:
getClassPathElements in interface javax.jbi.component.InstallationContext
Returns:
a list of String objects, each of which contains a class path elements. The list must contain at least one class path element.

getComponentName

public String getComponentName()
Get the unique name assigned to this component. This name must be assigned from the component's installation descriptor identification section.

Specified by:
getComponentName in interface javax.jbi.component.ComponentContext
Specified by:
getComponentName in interface javax.jbi.component.InstallationContext
Returns:
the unique component name, which must be non-null and non-empty.

getContext

public javax.jbi.component.ComponentContext getContext()
Get the JBI context for this component. The following methods are valid to use on the context: All other methods on the returned context must throw a IllegalStateException exception if invoked.

Specified by:
getContext in interface javax.jbi.component.InstallationContext
Returns:
the JBI context for this component, which must be non-null.

getInstallRoot

public String getInstallRoot()
Get the installation root directory full path name for this component. This path name must be formatted for the platform the JBI environment is running on.

Specified by:
getInstallRoot in interface javax.jbi.component.ComponentContext
Specified by:
getInstallRoot in interface javax.jbi.component.InstallationContext
Returns:
the installation root directory name, which must be non-null and non-empty.

getInstallationDescriptorExtension

public DocumentFragment getInstallationDescriptorExtension()
Return a DOM document fragment representing the installation descriptor (jbi.xml) extension data for the component, if any.

The Installation Descriptor Extension data are located at the end of the <component> element of the installation descriptor.

Specified by:
getInstallationDescriptorExtension in interface javax.jbi.component.InstallationContext
Returns:
a DOM document fragment containing the installation descriptor (jbi.xml) extension data, or null if none is present in the descriptor.

isInstall

public boolean isInstall()
Returns true if this context was created in order to install a component into the JBI environment. Returns false if this context was created to uninstall a previously installed component.

This method is provided to allow Bootstrapimplementations to tailor their behaviour according to use case. For example, the Bootstrap.init(InstallationContext)method implementation may create different types of extension MBeans, depending on the use case specified by this method.

Specified by:
isInstall in interface javax.jbi.component.InstallationContext
Returns:
true if this context was created in order to install a component into the JBI environment; otherwise the context was created to uninstall an existing component.

setClassPathElements

public final void setClassPathElements(List classPathElements)
Set the list of elements that comprise the class path for this component. Each element represents either a directory (containing class files) or a library file. Elements are reached from the install root. These elements represent class path items that the component's execution-time component class loader uses, in search order. All file paths are relative to the install root of the component.

This method allows the component's bootstrap to alter the execution-time class path specified by the component's installation descriptor. The component configuration determined during installation can affect the class path needed by the component at execution-time. All path elements must use the file separator character appropriate to the system (i.e., File.separator.

Specified by:
setClassPathElements in interface javax.jbi.component.InstallationContext
Parameters:
classPathElements - a list of String objects, each of which contains a class path elements; the list must be non-null and contain at least one class path element.
Throws:
IllegalArgumentException - if the class path elements is null, empty, or if an individual element is ill-formed.

activateEndpoint

public javax.jbi.servicedesc.ServiceEndpoint activateEndpoint(QName serviceName,
                                                              String endpointName)
                                                       throws javax.jbi.JBIException
Specified by:
activateEndpoint in interface javax.jbi.component.ComponentContext
Throws:
javax.jbi.JBIException

deactivateEndpoint

public void deactivateEndpoint(javax.jbi.servicedesc.ServiceEndpoint endpoint)
                        throws javax.jbi.JBIException
Specified by:
deactivateEndpoint in interface javax.jbi.component.ComponentContext
Throws:
javax.jbi.JBIException

registerExternalEndpoint

public void registerExternalEndpoint(javax.jbi.servicedesc.ServiceEndpoint externalEndpoint)
                              throws javax.jbi.JBIException
Specified by:
registerExternalEndpoint in interface javax.jbi.component.ComponentContext
Throws:
javax.jbi.JBIException

deregisterExternalEndpoint

public void deregisterExternalEndpoint(javax.jbi.servicedesc.ServiceEndpoint externalEndpoint)
                                throws javax.jbi.JBIException
Specified by:
deregisterExternalEndpoint in interface javax.jbi.component.ComponentContext
Throws:
javax.jbi.JBIException

resolveEndpointReference

public javax.jbi.servicedesc.ServiceEndpoint resolveEndpointReference(DocumentFragment epr)
Specified by:
resolveEndpointReference in interface javax.jbi.component.ComponentContext

getDeliveryChannel

public javax.jbi.messaging.DeliveryChannel getDeliveryChannel()
                                                       throws javax.jbi.messaging.MessagingException
Specified by:
getDeliveryChannel in interface javax.jbi.component.ComponentContext
Throws:
javax.jbi.messaging.MessagingException

getEndpoint

public javax.jbi.servicedesc.ServiceEndpoint getEndpoint(QName service,
                                                         String name)
Specified by:
getEndpoint in interface javax.jbi.component.ComponentContext

getEndpointDescriptor

public Document getEndpointDescriptor(javax.jbi.servicedesc.ServiceEndpoint endpoint)
                               throws javax.jbi.JBIException
Specified by:
getEndpointDescriptor in interface javax.jbi.component.ComponentContext
Throws:
javax.jbi.JBIException

getEndpoints

public javax.jbi.servicedesc.ServiceEndpoint[] getEndpoints(QName interfaceName)
Specified by:
getEndpoints in interface javax.jbi.component.ComponentContext

getEndpointsForService

public javax.jbi.servicedesc.ServiceEndpoint[] getEndpointsForService(QName serviceName)
Specified by:
getEndpointsForService in interface javax.jbi.component.ComponentContext

getExternalEndpoints

public javax.jbi.servicedesc.ServiceEndpoint[] getExternalEndpoints(QName interfaceName)
Specified by:
getExternalEndpoints in interface javax.jbi.component.ComponentContext

getExternalEndpointsForService

public javax.jbi.servicedesc.ServiceEndpoint[] getExternalEndpointsForService(QName serviceName)
Specified by:
getExternalEndpointsForService in interface javax.jbi.component.ComponentContext

getLogger

public Logger getLogger(String suffix,
                        String resourceBundleName)
                 throws MissingResourceException,
                        javax.jbi.JBIException
Specified by:
getLogger in interface javax.jbi.component.ComponentContext
Throws:
MissingResourceException
javax.jbi.JBIException

getMBeanNames

public javax.jbi.management.MBeanNames getMBeanNames()
Specified by:
getMBeanNames in interface javax.jbi.component.ComponentContext

getWorkspaceRoot

public String getWorkspaceRoot()
Specified by:
getWorkspaceRoot in interface javax.jbi.component.ComponentContext

createCustomComponentMBeanName

public ObjectName createCustomComponentMBeanName(String customName)
Specified by:
createCustomComponentMBeanName in interface javax.jbi.management.MBeanNames

getJmxDomainName

public String getJmxDomainName()
Specified by:
getJmxDomainName in interface javax.jbi.management.MBeanNames

setInstall

public void setInstall(boolean install)
Parameters:
install - The install to set.

setInstallRoot

public void setInstallRoot(File installRoot)
Parameters:
installRoot - The installRoot to set.

isBinding

public boolean isBinding()
Returns:
Returns the binding.

isEngine

public boolean isEngine()
Returns:
Returns the engine.

getComponentDescription

public String getComponentDescription()
Returns:
Returns the componentDescription.

getMBeanServer

public MBeanServer getMBeanServer()
Specified by:
getMBeanServer in interface javax.jbi.component.ComponentContext

getNamingContext

public InitialContext getNamingContext()
Specified by:
getNamingContext in interface javax.jbi.component.ComponentContext

getTransactionManager

public Object getTransactionManager()
Specified by:
getTransactionManager in interface javax.jbi.component.ComponentContext


Copyright © 2005-2011 The Apache Software Foundation. All Rights Reserved.