(3rd May 2007) This pages and the pages hung off it describe the creation of the module which supports the Spring Component Type that I am working on for a demo. This might be useful to anyone looking to build their own Component Type implementation.



Work Item



implementation-spring module created

org.apache.tuscany.implementation.spring package



Created ModuleActivator file

Points at the SpringModuleActivator class


Create SpringModuleActivator class

Core of the Spring implementation module


Create SpringArtifactProcessor class

Reads the implementation.spring xml in the composite file
- one required attribute = location, which specifies the location of the Spring application context
Creates the implementationSpring instance
Initiates resolution of the componentType of the Spring application context by calling SpringXMLComponentTypeLoader


Create SpringXMLComponentTypeLoader class

Reads the Spring application context and introspects the Beans referenced from it to determine the component type of the Spring implementation (ie Services, References, Properties)
















ModuleActivator file

Placed into the resources/META-INF/services directory:

# Implementation class for the ExtensionActivator

SpringModuleActivator class 


Creates resources used by other parts of the Module implementation:

  • AssemblyFactory
  • JavaInterfaceFactory
  • PolicyFactory


Takes an ExtensionPointRegistry as input parameter, which provides access to configuration of the core.

  • Creates a SpringArtifactProcessor and adds to the registry StAXArtifactProcessors
  • Creates a SpringImplementationProviderFactory and adds to the registry ProviderFactories

Creates a series of artifacts that are required by the SpringArtifactProcessor and SpringImplementationProviderFactory:

  • ExtensibleJavaInterfaceIntrospector (used to introspect Spring Beans)
  • JavaPropertyValueObjectFactory


Removes the SpringArtifactProcessor from the registry StAXArtifactProcessors 


Returns a very simple DefaultJavaClassIntrospectorExtensionPoint. 

SpringArtifactProcessor class 

Handles the <implementation.spring..../> element used in composite files.


Takes a series of classes used  in loading & resolution:

  • AssemblyFactory
  • JavaInterfaceFactory
  • JavaInterfaceIntrospector
  • PolicyFactory 
  • JavaPropertyValueObjectFactor


Reads the <implementation.spring.../> element from the composite.

Gets the location attribute - throws an exception if the attribute is missing. 

Creates a SpringImplementation instance, sets its location field and returns it. 


Given the SpringImplementation instance and a ModelResolver, gets the ComponentType for the implementation.

Does this by invoking  SpringXMLComponentTypeLoader.load() - will follow up by reading a side file if this does not fully resolve the component type.


Returns the fully qualified name of the implementation.spring element (includes the SCA namespace...)  

 SpringXMLComponentTypeLoader class


Resolution of the ComponentType of Spring application context

ComponentType of the Spring application-context is performed by reading the application-context.xml file and by introspecting the Java beans which it references. This is done by the SpringXMLComponentTypeLoader class.

  • No labels