extension point to remove
*/
void removeExtensionPoint(Object extensionPoint);
}
|
The ModuleActivator Code Block |
---|
package org.apache.tuscany.sca.core;
/**
* ModuleActivator represents a module that plugs into the Tuscany system. Each
* module should provide an implementation of this interface and register the
* ModuleActivator implementation class by defining a file named
*
* "META-INF/services/org.apache.tuscany.core.ModuleActivator"
*
* The content of the file is the class name of the ModuleActivator implementation.
* The implementation class must have a no-arg constructor. The same instance
* will be used to invoke all the methods during different phases of the module
* activation. Note that the start and stop methods defined by this interface
* take a reference to the Tuscany SCA runtime ExtensionPointRegistry. This
* gives the ModuleActivator the oppotunity to add extension points to the
* registry as it is requested to start up and remove them when it is requested
* to shut down.
*
* @version $Rev: 564429 $ $Date: 2007-08-09 16:49:11 -0700 (Thu, 09 Aug 2007) $
*/
public interface ModuleActivator {
/**
* This method is invoked when the module is started by the Tuscany system.
* It can be used by this module to registr extensions against extension
* points.
*
* @param registry The extension point registry
*/
void start(ExtensionPointRegistry registry);
/**
* This method is invoked when the module is stopped by the Tuscany system.
* It can be used by this module to unregister extensions against the
* extension points.
*
* @param registry The extension point registry
*/
void stop(ExtensionPointRegistry registry);
}
|
The ModuleActivator represents a module that plugs into the Tuscany system. Each module can optionally provide an implementation of this interface and register the implementation class by defining a file named as "META-INF/services/org.apache.tuscany.sca.core.ModuleActivator". The content of the file is the class name of the implementation. The implementation class must have a no-arg constructor. The same instance will be used to invoke all the methods during different phases of the module activation. During bootstraping, the following sequence will happen: 1) All the module activators will be discovered by the presence of "META-INF/services/org.apache.tuscany.sca.core.ModuleActivator" 2) The activator class is instantiated using the no-arg constructor. 3) ModuleActivator.getExtensionPoints() is invoked for all modules and the extension points contributed by each module are added to the ExtensionRegistry. 4) ModuleActivator.start(ExtensionRegistry) is invoked for all the modules. The module can then get interested extension points and contribute extensions to them. The contract bwteen the extension and extension point is private to the extension point. The extension point can follow similar patterns such as Registry. If it happens that one extension point has a dependency on another extension point, they can linked at this phase. During shutting down, the stop() method is invoked for all the modules to perform cleanups. A module can choose to unregister the extension from the extension points. Lazy instantiation of extensionsTo reduce the startup time and memory footprint, most of the extension points in Tuscany now supports lazy instantiation of the registered extensions. The following describes the pattern using org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor as an example. 1) Create a plain text file named as "META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor" 2) Register an extension by adding a line in the file Code Block |
---|
org.apache.tuscany.sca.implementation.java.xml.JavaImplementationProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#implementation.java,model=org.apache.tuscany.sca.implementation.java.JavaImplementation
|
The simple syntax is: <implementation_class_name>;<parameter_name>=<parameter_value>,<parameter_name>=<parameter_value> |