From 200a40b332420f94992eb39a6d0ea1cf1490ffc4 Mon Sep 17 00:00:00 2001 From: coreyg Date: Fri, 21 Nov 2014 09:30:19 +0000 Subject: Adding tuscany's website to their svn repo for svnpubsub git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1640879 13f79535-47bb-0310-9956-ffa450edef68 --- .../adding-the-spring-implementation-type.html | 273 +++++++++++++++++++++ 1 file changed, 273 insertions(+) create mode 100644 site/trunk/site-publish/adding-the-spring-implementation-type.html (limited to 'site/trunk/site-publish/adding-the-spring-implementation-type.html') diff --git a/site/trunk/site-publish/adding-the-spring-implementation-type.html b/site/trunk/site-publish/adding-the-spring-implementation-type.html new file mode 100644 index 0000000000..e9718e06cc --- /dev/null +++ b/site/trunk/site-publish/adding-the-spring-implementation-type.html @@ -0,0 +1,273 @@ + + + + + + + + + + + + + + + Apache Tuscany : Adding the Spring Implementation Type + + + + + + + + + + + + + + + +
+ + + + +   + +
+ + +
+
+ + + + + + + + + +
+  Apache Tuscany > Home > SCA Overview > SCA Java > Java SCA Documentation Menu > SCA Java Extension Development Guide > Mike Edwards Ramble through Adding a New Implementation Type > Adding the Spring Implementation Type + + User List | Dev List | Issue Tracker   +
+ + + + + + + +
+ + +
+ +
+
+

(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.

+ +

Sequence

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Order Work Item
Comment
0
implementation-spring module created
+
+org.apache.tuscany.implementation.spring package
 
1 Created ModuleActivator file
Points at the SpringModuleActivator class
2 Create SpringModuleActivator class Core of the Spring implementation module
3
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
4
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
+org.apache.tuscany.implementation.script.ScriptModuleActivator
+
+
+ +

SpringModuleActivator class 

+ + +

Constructor

+ +

Creates resources used by other parts of the Module implementation:

+
    +
  • AssemblyFactory
  • +
  • JavaInterfaceFactory
  • +
  • PolicyFactory
  • +
+ + +

start()

+ +

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
  • +
+ + +

stop()

+ +

Removes the SpringArtifactProcessor from the registry StAXArtifactProcessors 

+ +

getExtensionPoints() 

+ +

Returns a very simple DefaultJavaClassIntrospectorExtensionPoint. 

+ +

SpringArtifactProcessor class 

+ +

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

+ +

Constructor

+ +

Takes a series of classes used  in loading & resolution:

+
    +
  • AssemblyFactory
  • +
  • JavaInterfaceFactory
  • +
  • JavaInterfaceIntrospector
  • +
  • PolicyFactory 
  • +
  • JavaPropertyValueObjectFactor
  • +
+ + +

read()

+ +

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. 

+ +

resolve() 

+ +

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.

+ + +

getArtifactType() 

+ +

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

+ +

 SpringXMLComponentTypeLoader class

+ + +
    +
  1.  
  2. +
+ + +

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.

+
+
+
+ + +
+ + + + + + website stats + + + + + + -- cgit v1.2.3