| java.lang.Object com.sun.jbi.framework.ComponentFramework
ComponentFramework | public class ComponentFramework implements com.sun.jbi.ComponentManager,com.sun.jbi.ServiceLifecycle(Code) | | This is the implementation of the Component Framework, which provides
for the installation, uninstallation, and runtime management of Binding
Components, Service Engines, and Shared Libraries within the JBI framework.
author: Sun Microsystems, Inc. |
Field Summary | |
final public static int | PREPARE | final public static int | START | final public static int | STARTUP_ALL Startup type for auto startup of all installed components. | final public static int | STARTUP_AUTO Startup type for auto startup of installed components that were
running at the time of the last shutdown. | final public static int | STARTUP_NONE Startup type for no startup of components. |
Method Summary | |
public synchronized void | cancelComponentUpgrade(String componentName) Cancel a pending component upgrade. | void | createConfigurationMBean(Component comp) Create and register a Component Configuration MBean for a component. | void | createLifeCycleMBean(Component comp) Create and register a LifeCycleMBean for a component. | void | createStatisticsMBean(Component comp) Create and register a StatisticsMBean for a component. | public javax.jbi.component.Component | getComponentInstance(String componentName) Get the instance of javax.jbi.component.Component for the specified
component, if it exists.
Parameters: componentName - the unique name of the component. | public DeployerMBean | getDeployerInstance(String componentName) Get the instance of com.sun.jbi.framework.DeployerMBean for the specified
component, if it exists.
Parameters: componentName - the unique name of the component. | ObjectName | getInstallerConfigurationMBeanName(String componentName) Get the JMX ObjectName of the InstallerConfigurationMBean for a component.
Parameters: componentName - the unique name of the component. | Logger | getLogger() Get the logger for this service. | public void | initService(com.sun.jbi.EnvironmentContext context) Initialize the Component Framework service. | void | initializeComponent(Component comp) Initialize a Component. | void | initializeComponent(Component comp, javax.jbi.component.ComponentLifeCycle compInstance) Initialize a Component. | synchronized ObjectName | installComponent(InstallationContext installContext) Install a Component into the JBI framework.
Parameters: installContext - The InstallationContext created by theInstaller Service. | public synchronized void | installSharedLibrary(String name, String description, String componentRoot, boolean isSelfFirst, List elements) Install a Shared Library into the JBI framework. | public synchronized ObjectName | loadBootstrap(InstallationContext installContext, String bootClassName, List bootClassPathElements, List sharedLibraryNames) Load a component's bootstrap into the JBI framework. | void | prepare() This method is called by the JBI framework at the very beginning of its
startup so that components can create any local XAResources that might
be needed for recovery. | void | ready(boolean wait) This method is called by the JBI framework at the very end of its starup
processing to kick off the processing of component startup after any optional
XAResource recovery processing has been completed. | void | setStartup(int startup) Set the startup type. | void | shutdownComponent(Component comp) Shut down a Component. | void | shutdownComponent(Component comp, boolean force) Shut down a Component. | void | startComponent(Component comp) Start a Component. | void | startComponent(Component comp, boolean startSUs) Start a Component. | public void | startService() Start the Component Framework service. | void | startupAll(int command) Perform automatic startup processing. | void | stopComponent(Component comp) Stop a Component. | public void | stopService() Stop the Component Framework service. | synchronized void | uninstallComponent(InstallationContext installContext, boolean force) Uninstall a Component from the JBI framework. | public void | uninstallSharedLibrary(String sharedLibraryName) Uninstall a Shared Library from the JBI framework. | public void | unloadBootstrap(String componentName) Unload a component's bootstrap from the JBI framework. | void | unregisterMBeans(Component comp) Unregister all the MBeans for a component. | public synchronized void | upgradeComponent(InstallationContext installContext, String bootClassName, List<String> bootClassPathElements, List<String> sharedLibraryNames) Upgrade an installed component. | public synchronized boolean | validateComponentForUpgrade(InstallationContext installContext, String bootClassName, List bootClassPathElements, List sharedLibraryNames) Validate a component for upgrade. |
PREPARE | final public static int PREPARE(Code) | | Commands for startupAll()
|
START | final public static int START(Code) | | |
STARTUP_ALL | final public static int STARTUP_ALL(Code) | | Startup type for auto startup of all installed components.
|
STARTUP_AUTO | final public static int STARTUP_AUTO(Code) | | Startup type for auto startup of installed components that were
running at the time of the last shutdown.
|
STARTUP_NONE | final public static int STARTUP_NONE(Code) | | Startup type for no startup of components.
|
cancelComponentUpgrade | public synchronized void cancelComponentUpgrade(String componentName) throws javax.jbi.JBIException(Code) | | Cancel a pending component upgrade. This is called when some failure
has occurred after validateComponentForUpgrade() has already
been called but before upgradeComponent() is called. All
this method does is return the component to the SHUTDOWN
state and remove the busy indicator from the component entry in the
runtime registry cache.
Parameters: componentName - The name of the component. throws: javax.jbi.JBIException - if the component does not exist. |
createConfigurationMBean | void createConfigurationMBean(Component comp) throws javax.jbi.JBIException(Code) | | Create and register a Component Configuration MBean for a component.
Parameters: comp - The Component instance representing the component. throws: javax.jbi.JBIException - If a failure occurs. |
getComponentInstance | public javax.jbi.component.Component getComponentInstance(String componentName)(Code) | | Get the instance of javax.jbi.component.Component for the specified
component, if it exists.
Parameters: componentName - the unique name of the component. the javax.jbi.component.Component instance or null if no suchcomponent exists or if the component is inactive. |
getDeployerInstance | public DeployerMBean getDeployerInstance(String componentName)(Code) | | Get the instance of com.sun.jbi.framework.DeployerMBean for the specified
component, if it exists.
Parameters: componentName - the unique name of the component. the com.sun.jbi.framework.DeployerMBean instance or null if nosuch component exists or if the component has no Deployer instance. |
getInstallerConfigurationMBeanName | ObjectName getInstallerConfigurationMBeanName(String componentName) throws javax.jbi.JBIException(Code) | | Get the JMX ObjectName of the InstallerConfigurationMBean for a component.
Parameters: componentName - the unique name of the component. The JMX ObjectName of the InstallerConfigurationMBean. throws: javax.jbi.JBIException - If the component is not found. |
getLogger | Logger getLogger()(Code) | | Get the logger for this service.
The Logger instance. |
installSharedLibrary | public synchronized void installSharedLibrary(String name, String description, String componentRoot, boolean isSelfFirst, List elements) throws javax.jbi.JBIException(Code) | | Install a Shared Library into the JBI framework.
Parameters: name - The unique name assigned to this Shared Library. Parameters: description - The description of the Shared Library. Parameters: componentRoot - The root directory for the Shared Library. Parameters: isSelfFirst - Set to true to force the class loader for this SharedLibrary to use a self-first hierarchy, or false for parent-first. Parameters: elements - The list of jar and class files included in thisShared Library, in a List of Strings in the order in which theyshould appear in the class path. throws: javax.jbi.JBIException - If the installation fails. |
loadBootstrap | public synchronized ObjectName loadBootstrap(InstallationContext installContext, String bootClassName, List bootClassPathElements, List sharedLibraryNames) throws javax.jbi.JBIException(Code) | | Load a component's bootstrap into the JBI framework. This is the first
step in the installation and uninstallation processes. It creates and
registers the ComponentInstaller MBean that is used to complete the
installation or uninstallation.
Parameters: installContext - The InstallationContext created by the InstallerService. Parameters: bootClassName - The name of the bootstrap class for the component. Parameters: bootClassPathElements - A List of elements comprising theclass path for loading the bootstrap class. Each element is a Stringcontaining the full path to either a jar file or a directory containingclass files. Parameters: sharedLibraryNames - A List of String objects containing the namesof the Shared Libraries required by the component. The MBean object name of an installation configuration MBean ornull if the component didn't provide one. throws: javax.jbi.JBIException - If the component's bootstrap cannot beloaded. |
prepare | void prepare()(Code) | | This method is called by the JBI framework at the very beginning of its
startup so that components can create any local XAResources that might
be needed for recovery. If recovery is not enabled this phase will not be
called. We wait for the prepare phase to complete before
continuing. This method creats a new thread to run the
ComponentStartup class, and starts the thread. The
run() method of ComponentStartup will call
startupAll() with the PREPARE option to perform
the tasks required for components' XAResource recovery to proceed.
|
ready | void ready(boolean wait)(Code) | | This method is called by the JBI framework at the very end of its starup
processing to kick off the processing of component startup after any optional
XAResource recovery processing has been completed. When the wait
argument is set to true , the startupAll()
method is called directly with the START option to
perform automatic component startup processing. When the wait
argument is set to false , this method creates a new thread
to run the ComponentStartup class, and starts the thread.
The run() method of ComponentStartup will call
startupAll() with the START option to perform
the automatic component startup processing.
Parameters: wait - when set to true , perform startup processing onthe current thread; when set to false , perform startupprocessing on a new thread. |
setStartup | void setStartup(int startup)(Code) | | Set the startup type. This is used in junit tests to allow the testing
of service startup and shutdown with different component startup types.
Parameters: startup - The component startup type to be set. |
shutdownComponent | void shutdownComponent(Component comp, boolean force) throws javax.jbi.JBIException(Code) | | Shut down a Component.
Parameters: comp - The Component instance representing the component. Parameters: force - Set to true to force the shutdown even if the component'sshutDown method fails. throws: javax.jbi.JBIException - If the shutdown fails. |
startComponent | void startComponent(Component comp, boolean startSUs) throws javax.jbi.JBIException(Code) | | Start a Component.
Parameters: comp - The Component instance representing the component. Parameters: startSUs - When true , also brings deployed SUs totheir desired states. throws: javax.jbi.JBIException - If the component cannot be started. |
startupAll | void startupAll(int command)(Code) | | Perform automatic startup processing. This is where all installed Shared
Libraries have their class loaders set up, and all components are brought
to the desired state, based on the ComponentStartup property setting.
|
stopService | public void stopService() throws javax.jbi.JBIException(Code) | | Stop the Component Framework service. All BCs and SEs that are still
started are stopped and shut down here.
throws: javax.jbi.JBIException - If an error occurs stopping the service. |
uninstallComponent | synchronized void uninstallComponent(InstallationContext installContext, boolean force) throws javax.jbi.JBIException(Code) | | Uninstall a Component from the JBI framework.
Parameters: installContext - The InstallationContext created by theInstallation Service. Parameters: force - Set to true to proceed with the uninstallregardless of any errors encountered. throws: javax.jbi.JBIException - If the uninstall fails. |
uninstallSharedLibrary | public void uninstallSharedLibrary(String sharedLibraryName) throws javax.jbi.JBIException(Code) | | Uninstall a Shared Library from the JBI framework. A Shared Library
cannot be uninstalled until all dependent components have been shut down.
If any running dependent components are found, the uninstall of the
Shared Library is aborted.
Parameters: sharedLibraryName - The unique name of the Shared Library. throws: javax.jbi.JBIException - If the uninstall fails or is denied. |
unloadBootstrap | public void unloadBootstrap(String componentName) throws javax.jbi.JBIException(Code) | | Unload a component's bootstrap from the JBI framework. This is the last
step in the installation and uninstallation processes. It unregisters
the InstallerMBean that was used to complete the installation or
uninstallation, and calls the bootstrap cleanUp() method if it has not
yet been called. Note that in the case where this method is called
after loadBootstrap() for a new component, without an intervening call to
installComponent(), the Component instance is removed here.
Parameters: componentName - The unique name of the component. throws: javax.jbi.JBIException - if the bootstrap cannot be unloaded. |
upgradeComponent | public synchronized void upgradeComponent(InstallationContext installContext, String bootClassName, List<String> bootClassPathElements, List<String> sharedLibraryNames) throws javax.jbi.JBIException(Code) | | Upgrade an installed component. This is used to upgrade a component to a
newer version without requiring the component to be uninstalled (which
requires undeployment of all Service Assemblies that have Service Units
deployed to the component). There are two ways a component can be updated.
If the component does not provide an upgrade() method in its
bootstrap class, then the runtime jar files are updated and any changes
to the component's installation descriptor in jbi.xml are propagated. If
the component provides an upgrade() method, that method is
called to give the component the opportunity to upgrade its workspace
and all SUs deployed to it to a new version. In this case, it is the
responsibility of the component to perform all version verification, and
to provide any recovery processing required in the event of a failed
upgrade.
Parameters: installContext - The InstallationContext created by the InstallerService. Parameters: bootClassName - The name of the bootstrap class for the component. Parameters: bootClassPathElements - A List of elements comprising theclass path for loading the bootstrap class. Each element is a Stringcontaining the full path to either a jar file or a directory containingclass files. Parameters: sharedLibraryNames - A List of String objects containing the namesof the Shared Libraries required by the component. throws: javax.jbi.JBIException - if the component cannot be updated forany reason. throws: javax.jbi.JBIException - if the update fails for some reason. |
validateComponentForUpgrade | public synchronized boolean validateComponentForUpgrade(InstallationContext installContext, String bootClassName, List bootClassPathElements, List sharedLibraryNames) throws javax.jbi.JBIException(Code) | | Validate a component for upgrade. This validates that the runtime jar
files provided for the upgrade contain valid implementations of the
required interfaces and the component classes will load correctly. This
also verifies that all Shared Library dependencies are met. It also
determines whether or not the component has provided an implementation
of the upgrade() method and returns an indicator of that to
the caller.
Parameters: installContext - The InstallationContext created by the InstallerService. Parameters: bootClassName - The name of the bootstrap class for the component. Parameters: bootClassPathElements - A List of elements comprising theclass path for loading the bootstrap class. Each element is a Stringcontaining the full path to either a jar file or a directory containingclass files. Parameters: sharedLibraryNames - A List of String objects containing the namesof the Shared Libraries required by the component. true if the component provided an upgrade() method in its bootstrap implementation, false if itdid not. throws: javax.jbi.JBIException - if the component cannot be updated forany reason. |
|
|