Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Panel
borderColor#6699ff
bgColor#ffffff
titleBGColor#D5EFFF
titleApache Tuscany SCA Java Extension Guide
borderStylesolid

This page is work in progress. Thanks for your contribution (smile)
This is a guide for developers who would like to extend Tuscany SCA Java.

Section

Anchor
extension
extension
What is an extension?

Extension is a module (or a set of modules),when built with Tuscany SCA, can extend it to work with additional bindings, language implementations, programming models or databindings.

...

This guide explains the steps to add each of these extension types. Please help us refine the guide as you go through the steps of adding extensions.

Name spaces used by extensions

Anchor
component
component
How to add a new component implementation?

Musings on Adding a New Component Type by Mike E 

Anchor
binding
binding
How to add a new binding?

Anchor
interface
interface
How to add a new interface binding?

Anchor
databinding
databinding
How to add a new databinding?

Anchor
general guide
general guide
General guide for developing extensions

  • Familiarize yourself with SCA 1.0 Assembly and the SCA Java 1.0 programming model. Specifications can be found at www.osoa.org.
  • Never reference any classes in core. These classes are implementation-specific and subject to change; they are not part of the public SPI contract.
  • Use autowire when assembling extension components.
  • Do not play with classloaders such as setting the current context classloader unless it is absolutely necessary, i.e. a library used by an extension makes assumptions about context classloaders. Ideally the library can be refactored to not make these assumptions. If not, make sure the extension properly resets the current context classloader.

Anchor
details
details
Detail on extension architecture

The ExtensionPointRegistry

Code Block
package org.apache.tuscany.core;

/**
 * The registry for the Tuscany core extension points.
 *
 * @version $Rev: 529327 $ $Date: 2007-04-16 10:10:43 -0700 (Mon, 16 Apr 2007) $
 */
public interface ExtensionPointRegistry {

    /**
     * Add an extension point to the registry
     * @param <T>
     * @param extensionPointType The interface of the extension point
     * @param extensionPoint The instance of the extension point
     */
    <T> void addExtensionPoint(Class<T> extensionPointType, T extensionPoint);

    /**
     * Get the extension point by the interface
     * @param <T>
     * @param extensionPointType
     * @return
     */
    <T> T getExtensionPoint(Class<T> extensionPointType);

    /**
     * Remove an extension point
     * @param extensionPoint
     */
    void removeExtensionPoint(Class extensionPoint);
}

The ModuleActivator

Code Block
package org.apache.tuscany.core;

import java.util.Map;

/**
 * ModuleActivator represents a module that plugs into the Tuscany system. Each module should
 * provide an implementation of this interface and registry the implementation class by defining
 * a file named as "META-INF/services/org.apache.tuscany.spi.bootstrp.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.
 *
 * @version $Rev: 529327 $ $Date: 2007-04-16 10:10:43 -0700 (Mon, 16 Apr 2007) $
 */
public interface ModuleActivator {
    /**
     * Get a map of the extension points defined by this module. The key is the
     * java interface to represent the extension point and the the value is the
     * instance of the implementation of the interface.
     *
     * @return All the extension points defined by this module
     */
    Map<Class, Object> getExtensionPoints();

    /**
     * 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);
}

...