tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmar...@apache.org
Subject svn commit: r398707 [2/3] - in /incubator/tuscany/java/sca: containers/container.java/src/main/java/org/apache/tuscany/container/java/loader/ containers/container.java/src/test/java/org/apache/tuscany/container/java/mock/ containers/container.java/src/...
Date Mon, 01 May 2006 22:08:41 GMT
Modified: incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/StAXUtil.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/StAXUtil.java?rev=398707&r1=398706&r2=398707&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/StAXUtil.java (original)
+++ incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/StAXUtil.java Mon May  1 15:08:37 2006
@@ -26,7 +26,7 @@
 
 import org.apache.tuscany.core.config.ComponentTypeIntrospector;
 import org.apache.tuscany.core.config.ConfigurationException;
-import org.apache.tuscany.core.extension.config.ImplementationProcessor;
+import org.apache.tuscany.core.config.ConfigurationLoadException;
 import org.apache.tuscany.core.config.processor.ProcessorUtils;
 import org.apache.tuscany.core.config.impl.Java5ComponentTypeIntrospector;
 import org.apache.tuscany.core.loader.assembly.ComponentLoader;
@@ -94,15 +94,9 @@
         return overrideOption == null ? def : OVERRIDE_OPTIONS.get(overrideOption);
     }
 
-    public static ModuleComponent bootstrapLoader(String name, AssemblyContext context) {
+    public static ModuleComponent bootstrapLoader(String name, AssemblyContext context) throws ConfigurationLoadException {
         SystemAssemblyFactory factory = new SystemAssemblyFactoryImpl();
-        ComponentTypeIntrospector introspector = new Java5ComponentTypeIntrospector(factory);
-        //FIXME JFM HACK
-        List<ImplementationProcessor> processors = ProcessorUtils.createCoreProcessors(factory);
-        for (ImplementationProcessor processor : processors) {
-            introspector.registerProcessor(processor);
-        }
-        // END hack
+        ComponentTypeIntrospector introspector = ProcessorUtils.createCoreIntrospector(factory);
         Module module = factory.createModule();
         module.setName("org.apache.tuscany.core.system.loader");
 
@@ -112,7 +106,9 @@
         // all others should be defined in the system.module file
         components.add(bootstrapLoader(factory, introspector, ModuleLoader.class));
         components.add(bootstrapLoader(factory, introspector, ModuleFragmentLoader.class));
-        components.add(factory.createSystemComponent("org.apache.tuscany.core.system.loader.DefaultPropertyFactory", StAXPropertyFactory.class, StringParserPropertyFactory.class, Scope.MODULE));
+        Component propFactory = factory.createSystemComponent("org.apache.tuscany.core.system.loader.DefaultPropertyFactory", StAXPropertyFactory.class, StringParserPropertyFactory.class, Scope.MODULE);
+        introspector.introspect(StAXPropertyFactory.class);
+        components.add(propFactory);
         components.add(bootstrapLoader(factory, introspector, ComponentLoader.class));
         components.add(bootstrapLoader(factory, introspector, EntryPointLoader.class));
         components.add(bootstrapLoader(factory, introspector, InterfaceJavaLoader.class));
@@ -121,9 +117,9 @@
         // do not add additional loaders above - they should be in the system.module file
 
         // bootstrap the registries needed by the bootstrap loaders above
-        bootstrapService(factory, module, StAXLoaderRegistry.class, StAXLoaderRegistryImpl.class);
-        bootstrapService(factory, module, SystemAssemblyFactory.class, SystemAssemblyFactoryImpl.class);
-        bootstrapService(factory, module, ComponentTypeIntrospector.class, Java5ComponentTypeIntrospector.class);
+        bootstrapService(factory, introspector, module, StAXLoaderRegistry.class, StAXLoaderRegistryImpl.class);
+        bootstrapService(factory, introspector, module, SystemAssemblyFactory.class, SystemAssemblyFactoryImpl.class);
+        bootstrapService(factory, introspector, module, ComponentTypeIntrospector.class, Java5ComponentTypeIntrospector.class);
 
         ModuleComponent mc = factory.createModuleComponent();
         mc.setName(name);
@@ -146,11 +142,17 @@
         return component;
     }
 
-    private static <T> void bootstrapService(SystemAssemblyFactory factory, Module module, Class<T> service, Class<? extends T> impl) {
+    private static <T> void bootstrapService(SystemAssemblyFactory factory, ComponentTypeIntrospector introspector, Module module, Class<T> service, Class<? extends T> impl) {
         String epName = service.getName();
         String compName = impl.getName();
 
         Component component = factory.createSystemComponent(compName, service, impl, Scope.MODULE);
+        try {
+            component.getImplementation().setComponentInfo(introspector.introspect(impl));
+        } catch (ConfigurationException e) {
+            throw (AssertionError) new AssertionError("Invalid bootstrap loader").initCause(e);
+        }
+
         EntryPoint entryPoint = factory.createSystemEntryPoint(epName, service, compName);
 
         module.getComponents().add(component);

Modified: incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ModuleLoader.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ModuleLoader.java?rev=398707&r1=398706&r2=398707&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ModuleLoader.java (original)
+++ incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/assembly/ModuleLoader.java Mon May  1 15:08:37 2006
@@ -16,15 +16,17 @@
  */
 package org.apache.tuscany.core.loader.assembly;
 
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
 import org.apache.tuscany.core.config.ConfigurationLoadException;
+import org.apache.tuscany.core.context.impl.CompositeContextImpl;
 import org.apache.tuscany.core.loader.LoaderContext;
+import org.apache.tuscany.core.system.context.SystemCompositeContextImpl;
 import org.apache.tuscany.model.assembly.Module;
 import org.osoa.sca.annotations.Scope;
 
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
 /**
  * @version $Rev$ $Date$
  */
@@ -37,6 +39,12 @@
     public Module load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException {
         Module module = factory.createModule();
         loadComposite(reader, module, loaderContext);
+        // JFM Hack until recursive model in place
+        if (module.getName().startsWith("org.apache.tuscany.core.system")) {
+            module.setImplementationClass(SystemCompositeContextImpl.class);
+        } else {
+            module.setImplementationClass(CompositeContextImpl.class);
+        }
         return module;
     }
 }

Modified: incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/impl/StAXLoaderRegistryImpl.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/impl/StAXLoaderRegistryImpl.java?rev=398707&r1=398706&r2=398707&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/impl/StAXLoaderRegistryImpl.java (original)
+++ incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/loader/impl/StAXLoaderRegistryImpl.java Mon May  1 15:08:37 2006
@@ -22,6 +22,7 @@
 import org.apache.tuscany.core.loader.LoaderContext;
 import org.apache.tuscany.model.assembly.AssemblyContext;
 import org.apache.tuscany.model.assembly.AssemblyObject;
+import org.osoa.sca.annotations.Scope;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
@@ -32,6 +33,7 @@
 /**
  * @version $Rev$ $Date$
  */
+@Scope("MODULE")
 public class StAXLoaderRegistryImpl implements StAXLoaderRegistry {
     private final Map<QName, StAXElementLoader<? extends AssemblyObject>> loaders = new HashMap<QName, StAXElementLoader<? extends AssemblyObject>>();
 

Modified: incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/impl/SystemAssemblyFactoryImpl.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/impl/SystemAssemblyFactoryImpl.java?rev=398707&r1=398706&r2=398707&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/impl/SystemAssemblyFactoryImpl.java (original)
+++ incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/impl/SystemAssemblyFactoryImpl.java Mon May  1 15:08:37 2006
@@ -30,7 +30,7 @@
 
 /**
  * The default implementation of the system assembly factory
- * 
+ *
  * @version $Rev$ $Date$
  */
 public class SystemAssemblyFactoryImpl extends AssemblyFactoryImpl implements SystemAssemblyFactory {

Modified: incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/impl/SystemModuleImpl.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/impl/SystemModuleImpl.java?rev=398707&r1=398706&r2=398707&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/impl/SystemModuleImpl.java (original)
+++ incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/assembly/impl/SystemModuleImpl.java Mon May  1 15:08:37 2006
@@ -23,6 +23,7 @@
 import java.util.Map;
 
 import org.apache.tuscany.core.system.assembly.SystemModule;
+import org.apache.tuscany.core.system.context.SystemCompositeContextImpl;
 import org.apache.tuscany.model.assembly.AssemblyContext;
 import org.apache.tuscany.model.assembly.AssemblyFactory;
 import org.apache.tuscany.model.assembly.AssemblyVisitor;
@@ -48,41 +49,31 @@
  * An implementation of Module.
  */
 public class SystemModuleImpl extends CompositeImpl implements SystemModule {
-    
+
     private List<ModuleFragment> moduleFragments = new ArrayList<ModuleFragment>();
     private Map<String, ModuleFragment> moduleFragmentsMap;
     private ComponentInfo componentType;
     private Object contextFactory;
-    private Class<?> implementationClass;
 
     /**
      * Constructor
      */
     protected SystemModuleImpl() {
     }
-    
-    public Class<?> getImplementationClass() {
-        return implementationClass;
-    }
 
-    public void setImplementationClass(Class<?> value) {
-        checkNotFrozen();
-        implementationClass = value;
-    }
-    
     /**
      * @see org.apache.tuscany.model.assembly.Implementation#getComponentInfo()
      */
     public ComponentInfo getComponentInfo() {
         return componentType;
     }
-    
+
     /**
      * @see org.apache.tuscany.model.assembly.Implementation#setComponentInfo(org.apache.tuscany.model.assembly.ComponentInfo)
      */
     public void setComponentInfo(ComponentInfo componentType) {
         checkNotFrozen();
-        this.componentType=componentType;
+        this.componentType = componentType;
     }
 
     /**
@@ -106,126 +97,26 @@
     public void initialize(AssemblyContext modelContext) {
         if (isInitialized())
             return;
-        
-        // Populate map of module fragments
-        moduleFragmentsMap = new HashMap<String, ModuleFragment>();
+
+        // Initialize module fragments
         for (ModuleFragment moduleFragment : moduleFragments) {
-            moduleFragmentsMap.put(moduleFragment.getName(), moduleFragment);
-            
+
             // Add all WSDL imports, components, entry points and external services from the module fragments
             getWSDLImports().addAll(moduleFragment.getWSDLImports());
             getComponents().addAll(moduleFragment.getComponents());
             getEntryPoints().addAll(moduleFragment.getEntryPoints());
             getExternalServices().addAll(moduleFragment.getExternalServices());
-            
+
             // Add all the wires from the module fragments
             getWires().addAll(moduleFragment.getWires());
-            
+
             moduleFragment.initialize(modelContext);
         }
-        
+
         // Initialize the composite
         super.initialize(modelContext);
-
-        // Derive the component type from the entry points and external services in the module
-        // Also derive properties from the overridable properties of the components in the module
-        if (componentType==null) {
-            AssemblyFactory factory = modelContext.getAssemblyFactory();
-            componentType = factory.createComponentInfo();
-            for (EntryPoint entryPoint : getEntryPoints()) {
-                Service service = factory.createService();
-                service.setName(entryPoint.getName());
-                ServiceContract serviceContract = entryPoint.getConfiguredService().getPort().getServiceContract();
-                if (serviceContract != null)
-                    service.setServiceContract(serviceContract);
-                componentType.getServices().add(service);
-
-                ConfiguredReference configuredReference = entryPoint.getConfiguredReference();
-                ServiceURI sourceURI = factory.createServiceURI(null, entryPoint, configuredReference);
-                for (String target : configuredReference.getTargets()) {
-                    ServiceURI targetURI =factory.createServiceURI(null, target);
-                    Wire wire=factory.createWire();
-                    wire.setSource(sourceURI);
-                    wire.setTarget(targetURI);
-                    getWires().add(wire);
-                }
-            }
-            for (ExternalService externalService : getExternalServices()) {
-                if (externalService.getOverrideOption()==null || externalService.getOverrideOption()== OverrideOption.NO)
-                    continue;
-                Reference reference = factory.createReference();
-                reference.setName(externalService.getName());
-                ServiceContract serviceContract = externalService.getConfiguredService().getPort().getServiceContract();
-                if (serviceContract != null)
-                    reference.setServiceContract(serviceContract);
-                componentType.getReferences().add(reference);
-            }
-            for (Component<Implementation> component : getComponents()) {
-                for (ConfiguredProperty configuredProperty : component.getConfiguredProperties()) {
-                    if (configuredProperty.getOverrideOption()==null || configuredProperty.getOverrideOption()==OverrideOption.NO)
-                        continue;
-                    componentType.getProperties().add(configuredProperty.getProperty());
-                }
-
-                for (ConfiguredReference configuredReference : component.getConfiguredReferences()) {
-                    // Create a wire
-                    ServiceURI sourceURI =factory.createServiceURI(null, component, configuredReference);
-                    for (String target : configuredReference.getTargets()) {
-                        ServiceURI targetURI =factory.createServiceURI(null, target);
-                        Wire wire=factory.createWire();
-                        wire.setSource(sourceURI);
-                        wire.setTarget(targetURI);
-                        getWires().add(wire);
-                    }
-                }
-            }
-        }
-        componentType.initialize(modelContext);
-
-
-        // Wire the module parts
-        for (Wire wire : getWires()) {
-
-            // Get the source reference
-            ServiceURI sourceURI=wire.getSource();
-            ConfiguredReference configuredReference = null;
-            String partName = sourceURI.getPartName();
-            String referenceName = sourceURI.getServiceName();
-            if (referenceName != null) {
-                Component component = (Component)getPart(partName);
-                if (component != null) {
-                    configuredReference = component.getConfiguredReference(referenceName);
-                }
-            } else {
-                EntryPoint entryPoint = (EntryPoint)getPart(partName);
-                if (entryPoint != null) {
-                    configuredReference = entryPoint.getConfiguredReference();
-                }
-            }
-            if (configuredReference == null) {
-                throw new IllegalArgumentException("Cannot find wire source " + sourceURI.getAddress());
-            } else {
-
-                // Resolve the target service endpoint
-                ServiceURI targetURI = wire.getTarget();
-                ConfiguredService configuredService = getConfiguredService(targetURI);
-                if (configuredService != null) {
-
-                    // Wire the reference to the target
-                    Multiplicity multiplicity=configuredReference.getPort().getMultiplicity();
-                    if (multiplicity==Multiplicity.ZERO_N || multiplicity==Multiplicity.ONE_N) {
-                        configuredReference.getTargetConfiguredServices().add(configuredService);
-                    } else {
-                        configuredReference.getTargetConfiguredServices().clear();
-                        configuredReference.getTargetConfiguredServices().add(configuredService);
-                    }
-                } else {
-                    throw new IllegalArgumentException("Cannot find service for " + targetURI.getAddress());
-                }
-            }
-        }
     }
-        
+
     /**
      * @see org.apache.tuscany.model.assembly.AssemblyObject#freeze()
      */
@@ -233,11 +124,11 @@
         if (isFrozen())
             return;
         super.freeze();
-        
+
         // Freeze component type and module fragments
-        if (componentType!=null)
+        if (componentType != null)
             componentType.freeze();
-        moduleFragments=Collections.unmodifiableList(moduleFragments);
+        moduleFragments = Collections.unmodifiableList(moduleFragments);
         freeze(moduleFragments);
     }
 
@@ -262,16 +153,22 @@
     public boolean accept(AssemblyVisitor visitor) {
         if (!super.accept(visitor))
             return false;
-        
-        if (componentType!=null) {
+
+        if (componentType != null) {
             if (!componentType.accept(visitor))
                 return false;
         }
-        
-        if (!accept(moduleFragments, visitor))
-            return false;
-        
-        return true;
+
+        return accept(moduleFragments, visitor);
+
+    }
+
+    public Class<?> getImplementationClass() {
+        return SystemCompositeContextImpl.class; // FIXME hack
     }
-    
+
+    public void setImplementationClass(Class<?> clazz) {
+        // do nothing
+    }
+
 }

Modified: incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/builder/SystemContextFactoryBuilder.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/builder/SystemContextFactoryBuilder.java?rev=398707&r1=398706&r2=398707&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/builder/SystemContextFactoryBuilder.java (original)
+++ incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/builder/SystemContextFactoryBuilder.java Mon May  1 15:08:37 2006
@@ -30,30 +30,28 @@
 import org.apache.tuscany.core.builder.impl.ArrayMultiplicityObjectFactory;
 import org.apache.tuscany.core.builder.impl.ListMultiplicityObjectFactory;
 import org.apache.tuscany.core.config.JavaIntrospectionHelper;
-import org.apache.tuscany.core.context.AutowireContext;
-import org.apache.tuscany.core.context.ConfigurationContext;
-import org.apache.tuscany.core.context.SystemCompositeContext;
 import org.apache.tuscany.core.context.impl.CompositeContextImpl;
-import org.apache.tuscany.core.injection.ContextObjectFactory;
+import org.apache.tuscany.core.extension.config.InjectorExtensibilityElement;
+import org.apache.tuscany.core.extension.config.extensibility.ComponentNameExtensibilityElement;
+import org.apache.tuscany.core.extension.config.extensibility.ContextExtensibilityElement;
+import org.apache.tuscany.core.extension.config.extensibility.DestroyInvokerExtensibilityElement;
+import org.apache.tuscany.core.extension.config.extensibility.InitInvokerExtensibilityElement;
 import org.apache.tuscany.core.injection.EventInvoker;
 import org.apache.tuscany.core.injection.FactoryInitException;
 import org.apache.tuscany.core.injection.FieldInjector;
 import org.apache.tuscany.core.injection.Injector;
-import org.apache.tuscany.core.injection.MethodEventInvoker;
 import org.apache.tuscany.core.injection.MethodInjector;
 import org.apache.tuscany.core.injection.NonProxiedTargetFactory;
 import org.apache.tuscany.core.injection.SingletonObjectFactory;
-import org.apache.tuscany.core.runtime.RuntimeContext;
-import org.apache.tuscany.core.system.annotation.Autowire;
-import org.apache.tuscany.core.system.annotation.Monitor;
-import org.apache.tuscany.core.system.annotation.ParentContext;
 import org.apache.tuscany.core.system.assembly.SystemImplementation;
 import org.apache.tuscany.core.system.assembly.SystemModule;
 import org.apache.tuscany.core.system.config.SystemContextFactory;
+import org.apache.tuscany.core.system.config.SystemInjectorExtensibilityElement;
+import org.apache.tuscany.core.system.config.extensibility.MonitorExtensibilityElement;
 import org.apache.tuscany.core.system.context.SystemCompositeContextImpl;
-import org.apache.tuscany.core.system.injection.AutowireObjectFactory;
 import org.apache.tuscany.model.assembly.AssemblyObject;
 import org.apache.tuscany.model.assembly.Component;
+import org.apache.tuscany.model.assembly.Composite;
 import org.apache.tuscany.model.assembly.ConfiguredProperty;
 import org.apache.tuscany.model.assembly.ConfiguredReference;
 import org.apache.tuscany.model.assembly.ConfiguredService;
@@ -62,22 +60,19 @@
 import org.apache.tuscany.model.assembly.Multiplicity;
 import org.apache.tuscany.model.assembly.Scope;
 import org.apache.tuscany.model.assembly.Service;
-import org.osoa.sca.annotations.ComponentName;
-import org.osoa.sca.annotations.Context;
-import org.osoa.sca.annotations.Destroy;
-import org.osoa.sca.annotations.Init;
 
 /**
- * Decorates components whose implementation type is a
- * {@link org.apache.tuscany.core.system.assembly.SystemImplementation} with the appropriate runtime configuration. This
- * builder handles both system composite components as well as system leaf or "simple" components. Consequently, both
- * simple and composite component types may be injected and autowired.
- * <p>
+ * Decorates components whose implementation type is a {@link org.apache.tuscany.core.system.assembly.SystemImplementation}
+ * with the appropriate runtime configuration. This builder handles both system composite components as well
+ * as system leaf or "simple" components. Consequently, both simple and composite component types may be
+ * injected and autowired.
+ * <p/>
  * Note that system component references are not proxied.
- * 
+ *
  * @version $Rev$ $Date$
  */
 public class SystemContextFactoryBuilder implements ContextFactoryBuilder {
+
     private final MonitorFactory monitorFactory;
 
     public SystemContextFactoryBuilder(MonitorFactory monitorFactory) {
@@ -95,17 +90,18 @@
         Scope scope;
         // Get the component implementation
         Implementation componentImplementation = component.getImplementation();
-        if (componentImplementation instanceof SystemImplementation && component.getContextFactory() == null) {
+        if (componentImplementation instanceof SystemImplementation
+                && component.getContextFactory() == null) {
 
             // The component is a system component, implemented by a Java class
-            SystemImplementation javaImpl = (SystemImplementation) componentImplementation;
+            SystemImplementation implementation = (SystemImplementation) componentImplementation;
             if (componentImplementation.getComponentInfo().getServices() == null
                     || componentImplementation.getComponentInfo().getServices().size() < 1) {
                 BuilderConfigException e = new BuilderConfigException("No service configured on component type");
                 e.setIdentifier(component.getName());
                 throw e;
             }
-            implClass = javaImpl.getImplementationClass();
+            implClass = implementation.getImplementationClass();
             Scope previous = null;
             scope = Scope.MODULE;
             List<Service> services = component.getImplementation().getComponentInfo().getServices();
@@ -124,24 +120,26 @@
                 }
             }
 
-        } else if (componentImplementation instanceof Module) {
-            // FIXME this is a hack
-            if (((Module) componentImplementation).getName().startsWith("org.apache.tuscany.core.system")) {
-                // The component is a system module component, fix the implementation class to our implementation
-                // of system module component context
-                implClass = SystemCompositeContextImpl.class;
-                scope = Scope.AGGREGATE;
-            } else if (componentImplementation instanceof SystemModule){
-                implClass = SystemCompositeContextImpl.class;
-                scope = Scope.AGGREGATE;
-            } else {
-                // The component is an app module component, fix the implementation class to our implementation
-                // of app module component context
-                //FIXME this should be extensible, i.e. the model should specify the impl class of the module
-                implClass = CompositeContextImpl.class;
-                scope = Scope.AGGREGATE;
+        } else if (componentImplementation instanceof Composite) {
+            implClass = ((Composite) componentImplementation).getImplementationClass();
+            if (implClass == null) {
+                // FIXME this is a hack
+                if (((Module) componentImplementation).getName().startsWith("org.apache.tuscany.core.system"))
+                {
+                    // The component is a system module component, fix the implementation class to our implementation
+                    // of system module component context
+                    implClass = SystemCompositeContextImpl.class;
+                } else if (componentImplementation instanceof SystemModule) {
+                    implClass = SystemCompositeContextImpl.class;
+                } else {
+                    // The component is an app module component, fix the implementation class to our implementation
+                    // of app module component context
+                    //FIXME this should be extensible, i.e. the model should specify the impl class of the module
+                    implClass = CompositeContextImpl.class;
+                }
+                //END hack
             }
-
+            scope = Scope.AGGREGATE;
         } else {
             return;
         }
@@ -153,13 +151,14 @@
             methods = JavaIntrospectionHelper.getAllUniqueMethods(implClass);
             String name = component.getName();
             if (componentImplementation instanceof Module) {
-                Module module = (Module)componentImplementation;
+                Module module = (Module) componentImplementation;
                 contextFactory = new SystemContextFactory(name, module, JavaIntrospectionHelper.getDefaultConstructor(implClass), scope);
 
             } else {
                 contextFactory = new SystemContextFactory(name, JavaIntrospectionHelper.getDefaultConstructor(implClass), scope);
             }
-            ContextObjectFactory contextObjectFactory = new ContextObjectFactory(contextFactory);
+
+            //ContextObjectFactory contextObjectFactory = new ContextObjectFactory(contextFactory);
 
             List<Injector> injectors = new ArrayList<Injector>();
 
@@ -183,125 +182,36 @@
                     }
                 }
             }
-
-            // create factory for the component implementation type
-            EventInvoker initInvoker = null;
-            boolean eagerInit = false;
-            EventInvoker destroyInvoker = null;
-            for (Field field : fields) {
-                ComponentName compName = field.getAnnotation(ComponentName.class);
-                if (compName != null) {
-                    Injector injector = new FieldInjector(field, new SingletonObjectFactory<String>(name));
-                    injectors.add(injector);
-                }
-                Context context = field.getAnnotation(Context.class);
-                if (context != null) {
-                    Injector injector = new FieldInjector(field, contextObjectFactory);
-                    injectors.add(injector);
-                }
-                ParentContext parentField = field.getAnnotation(ParentContext.class);
-                if (parentField != null) {
-                    Injector injector = new FieldInjector(field, contextObjectFactory);
-                    injectors.add(injector);
-                }
-                Autowire autowire = field.getAnnotation(Autowire.class);
-                if (autowire != null) {
-                    // for system composite context types, only allow autowire of certain types, otherwise we have a
-                    // chicken-and-egg problem
-                    if (SystemCompositeContext.class.isAssignableFrom(implClass)
-                            && !(field.getType().equals(ConfigurationContext.class)
-                                    || field.getType().equals(MonitorFactory.class)
-                                    || field.getType().equals(RuntimeContext.class) || field.getType().equals(
-                                    AutowireContext.class))) {
-                        BuilderConfigException e = new BuilderConfigException("Illegal autowire type for system context");
-                        e.setIdentifier(field.getType().getName());
-                        throw e;
-                    }
-                    Injector<?> injector = new FieldInjector(field, new AutowireObjectFactory(field.getType(), contextFactory));
-                    injectors.add(injector);
-                }
-                Monitor monitor = field.getAnnotation(Monitor.class);
-                if (monitor != null) {
-                    Object instance = monitorFactory.getMonitor(field.getType());
-                    Injector<?> injector = new FieldInjector(field, new SingletonObjectFactory<Object>(instance));
-                    injectors.add(injector);
-                }
-            }
-            for (Method method : methods) {
-                Init init = method.getAnnotation(Init.class);
-                if (init != null && initInvoker == null) {
-                    initInvoker = new MethodEventInvoker(method);
-                    eagerInit = init.eager();
-                    continue;
-                }
-                Destroy destroy = method.getAnnotation(Destroy.class);
-                if (destroy != null && destroyInvoker == null) {
-                    destroyInvoker = new MethodEventInvoker(method);
-                    continue;
-                }
-                ComponentName compName = method.getAnnotation(ComponentName.class);
-                if (compName != null) {
-                    Injector injector = new MethodInjector(method, new SingletonObjectFactory<String>(name));
-                    injectors.add(injector);
-                }
-                Context context = method.getAnnotation(Context.class);
-                if (context != null) {
-                    Injector injector = new MethodInjector(method, contextObjectFactory);
-                    injectors.add(injector);
-                }
-                ParentContext parentMethod = method.getAnnotation(ParentContext.class);
-                if (parentMethod != null) {
-                    // if (!(parentContext instanceof CompositeContext)) {
-                    // BuilderConfigException e = new BuilderConfigException("Component must be a child of ");
-                    // e.setIdentifier(CompositeContext.class.getName());
-                    // throw e;
-                    // }
-                    Injector injector = new MethodInjector(method, contextObjectFactory);
-                    injectors.add(injector);
-                }
-                Autowire autowire = method.getAnnotation(Autowire.class);
-                if (autowire != null) {
-                    // if (!(parentContext instanceof AutowireContext)) {
-                    // BuilderConfigException e = new BuilderConfigException("Parent context must implement)");
-                    // e.setIdentifier(AutowireContext.class.getName());
-                    // throw e;
-                    // }
-                    if (method.getParameterTypes() == null || method.getParameterTypes().length != 1) {
-                        BuilderConfigException e = new BuilderConfigException("Autowire setter methods must take one parameter");
-                        e.setIdentifier(method.getName());
-                        throw e;
-                    }
-                    Class paramType = method.getParameterTypes()[0];
-                    // for system composite context types, only allow autowire of certain types, otherwise we have a
-                    // chicken-and-egg problem
-                    if (SystemCompositeContext.class.isAssignableFrom(implClass)
-                            && !(paramType.equals(ConfigurationContext.class) || paramType.equals(MonitorFactory.class)
-                                    || paramType.equals(RuntimeContext.class) || paramType.equals(AutowireContext.class))) {
-                        BuilderConfigException e = new BuilderConfigException("Illegal autowire type for system context");
-                        e.setIdentifier(paramType.getName());
-                        throw e;
-                    }
-                    Injector injector = new MethodInjector(method, new AutowireObjectFactory(paramType, contextFactory));
-                    injectors.add(injector);
-                }
-
-                Monitor monitor = method.getAnnotation(Monitor.class);
-                if (monitor != null) {
-                    if (method.getParameterTypes() == null || method.getParameterTypes().length != 1) {
-                        BuilderConfigException e = new BuilderConfigException("Monitor setter methods must take one parameter");
-                        e.setIdentifier(method.getName());
-                        throw e;
-                    }
-                    Class<?> paramType = method.getParameterTypes()[0];
-                    Object instance = monitorFactory.getMonitor(paramType);
-                    Injector<?> injector = new MethodInjector(method, new SingletonObjectFactory<Object>(instance));
-                    injectors.add(injector);
+            List<Object> elements = componentImplementation.getComponentInfo().getExtensibilityElements();
+            for (Object element : elements) {
+                if (element instanceof InitInvokerExtensibilityElement) {
+                    InitInvokerExtensibilityElement invokerElement = (InitInvokerExtensibilityElement) element;
+                    EventInvoker<Object> initInvoker = invokerElement.getEventInvoker();
+                    boolean eagerInit = invokerElement.isEager();
+                    contextFactory.setEagerInit(eagerInit);
+                    contextFactory.setInitInvoker(initInvoker);
+                } else if (element instanceof DestroyInvokerExtensibilityElement) {
+                    DestroyInvokerExtensibilityElement invokerElement = (DestroyInvokerExtensibilityElement) element;
+                    EventInvoker<Object> destroyInvoker = invokerElement.getEventInvoker();
+                    contextFactory.setDestroyInvoker(destroyInvoker);
+                } else if (element instanceof ComponentNameExtensibilityElement) {
+                    ComponentNameExtensibilityElement nameElement = (ComponentNameExtensibilityElement) element;
+                    injectors.add(nameElement.getEventInvoker(name));
+                } else if (element instanceof ContextExtensibilityElement) {
+                    ContextExtensibilityElement contextElement = (ContextExtensibilityElement) element;
+                    injectors.add(contextElement.getInjector(contextFactory));
+                } else if (element instanceof InjectorExtensibilityElement) {
+                    InjectorExtensibilityElement injectorElement = (InjectorExtensibilityElement) element;
+                    injectors.add(injectorElement.getInjector(contextFactory));
+                } else if (element instanceof SystemInjectorExtensibilityElement) {
+                    SystemInjectorExtensibilityElement injectorElement = (SystemInjectorExtensibilityElement) element;
+                    injectors.add(injectorElement.getInjector(contextFactory));
+                } else if (element instanceof MonitorExtensibilityElement) {
+                    MonitorExtensibilityElement monitorElement = (MonitorExtensibilityElement) element;
+                    injectors.add(monitorElement.getInjector(monitorFactory));
                 }
             }
             contextFactory.setSetters(injectors);
-            contextFactory.setEagerInit(eagerInit);
-            contextFactory.setInitInvoker(initInvoker);
-            contextFactory.setDestroyInvoker(destroyInvoker);
             // decorate the logical model
             component.setContextFactory(contextFactory);
         } catch (BuilderConfigException e) {
@@ -332,7 +242,7 @@
         Method method = null;
         Field field = JavaIntrospectionHelper.findClosestMatchingField(propName, type, fields);
         if (field == null) {
-            method = JavaIntrospectionHelper.findClosestMatchingMethod(propName, new Class[] { type }, methods);
+            method = JavaIntrospectionHelper.findClosestMatchingMethod(propName, new Class[]{type}, methods);
             if (method == null) {
                 throw new NoAccessorException(propName);
             }
@@ -357,11 +267,11 @@
     }
 
     /**
-     * Creates object factories that resolve target(s) of a reference and an <code>Injector</code> responsible for
-     * injecting them into the reference
+     * Creates object factories that resolve target(s) of a reference and an <code>Injector</code> responsible
+     * for injecting them into the reference
      */
     private Injector createReferenceInjector(ConfiguredReference reference, Set<Field> fields, Set<Method> methods,
-            ContextResolver resolver) {
+                                             ContextResolver resolver) {
 
         List<ObjectFactory> objectFactories = new ArrayList<ObjectFactory>();
         String refName = reference.getPort().getName();
@@ -379,7 +289,7 @@
      * Creates an <code>Injector</code> for an object factories associated with a reference.
      */
     private Injector createInjector(String refName, Class refClass, boolean multiplicity, List<ObjectFactory> objectFactories,
-            Set<Field> fields, Set<Method> methods) throws NoAccessorException, BuilderConfigException {
+                                    Set<Field> fields, Set<Method> methods) throws NoAccessorException, BuilderConfigException {
         Field field;
         Method method = null;
         if (multiplicity) {
@@ -415,7 +325,7 @@
         } else {
             field = JavaIntrospectionHelper.findClosestMatchingField(refName, refClass, fields);
             if (field == null) {
-                method = JavaIntrospectionHelper.findClosestMatchingMethod(refName, new Class[] { refClass }, methods);
+                method = JavaIntrospectionHelper.findClosestMatchingMethod(refName, new Class[]{refClass}, methods);
                 if (method == null) {
                     throw new NoAccessorException(refName);
                 }

Added: incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemInjectorExtensibilityElement.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemInjectorExtensibilityElement.java?rev=398707&view=auto
==============================================================================
--- incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemInjectorExtensibilityElement.java (added)
+++ incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemInjectorExtensibilityElement.java Mon May  1 15:08:37 2006
@@ -0,0 +1,34 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+package org.apache.tuscany.core.system.config;
+
+import org.apache.tuscany.core.builder.ContextResolver;
+import org.apache.tuscany.core.injection.Injector;
+
+/**
+ * An extensiblity element which provides {@link org.apache.tuscany.core.injection.Injector}s based on
+ * component type metadata specific to system services
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public interface SystemInjectorExtensibilityElement {
+    /**
+     * Creates an injector
+     *
+     * @param resolver that returns the current composite context
+     */
+    public Injector<?> getInjector(ContextResolver resolver);
+
+}
+

Modified: incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/extensibility/AutowireExtensibilityElement.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/extensibility/AutowireExtensibilityElement.java?rev=398707&r1=398706&r2=398707&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/extensibility/AutowireExtensibilityElement.java (original)
+++ incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/extensibility/AutowireExtensibilityElement.java Mon May  1 15:08:37 2006
@@ -20,7 +20,7 @@
 import org.apache.tuscany.core.injection.FieldInjector;
 import org.apache.tuscany.core.injection.Injector;
 import org.apache.tuscany.core.injection.MethodInjector;
-import org.apache.tuscany.core.system.config.SystemExtensibilityElement;
+import org.apache.tuscany.core.system.config.SystemInjectorExtensibilityElement;
 import org.apache.tuscany.core.system.injection.AutowireObjectFactory;
 
 /**
@@ -28,7 +28,7 @@
  *
  * @version $$Rev$$ $$Date$$
  */
-public class AutowireExtensibilityElement implements SystemExtensibilityElement {
+public class AutowireExtensibilityElement implements SystemInjectorExtensibilityElement {
 
     private Method method;
     private Field field;

Added: incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/extensibility/MonitorExtensibilityElement.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/extensibility/MonitorExtensibilityElement.java?rev=398707&view=auto
==============================================================================
--- incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/extensibility/MonitorExtensibilityElement.java (added)
+++ incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/extensibility/MonitorExtensibilityElement.java Mon May  1 15:08:37 2006
@@ -0,0 +1,42 @@
+package org.apache.tuscany.core.system.config.extensibility;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Field;
+
+import org.apache.tuscany.core.system.config.SystemExtensibilityElement;
+import org.apache.tuscany.core.injection.Injector;
+import org.apache.tuscany.core.injection.MethodInjector;
+import org.apache.tuscany.core.injection.ContextObjectFactory;
+import org.apache.tuscany.core.injection.FieldInjector;
+import org.apache.tuscany.core.injection.SingletonObjectFactory;
+import org.apache.tuscany.core.builder.ContextResolver;
+import org.apache.tuscany.common.monitor.MonitorFactory;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+public class MonitorExtensibilityElement implements SystemExtensibilityElement {
+
+    private Method method;
+    private Field field;
+
+    public MonitorExtensibilityElement(Method m) {
+        assert(method.getParameterTypes().length == 1): "Illegal number of parameters";
+        method = m;
+    }
+
+    public MonitorExtensibilityElement(Field f) {
+        field = f;
+    }
+
+    public Injector<?> getInjector(MonitorFactory factory) {
+        if (method != null) {
+            Object monitor = factory.getMonitor(method.getParameterTypes()[0]);
+            return new MethodInjector(method, new SingletonObjectFactory<Object>(monitor));
+        } else {
+            Object monitor = factory.getMonitor(field.getType());
+            return new FieldInjector(field, new SingletonObjectFactory<Object>(monitor));
+        }
+    }
+
+}

Added: incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/extensibility/ParentContextExtensibilityElement.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/extensibility/ParentContextExtensibilityElement.java?rev=398707&view=auto
==============================================================================
--- incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/extensibility/ParentContextExtensibilityElement.java (added)
+++ incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/extensibility/ParentContextExtensibilityElement.java Mon May  1 15:08:37 2006
@@ -0,0 +1,38 @@
+package org.apache.tuscany.core.system.config.extensibility;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.core.builder.ContextResolver;
+import org.apache.tuscany.core.injection.ContextObjectFactory;
+import org.apache.tuscany.core.injection.FieldInjector;
+import org.apache.tuscany.core.injection.Injector;
+import org.apache.tuscany.core.injection.MethodInjector;
+import org.apache.tuscany.core.system.config.SystemInjectorExtensibilityElement;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+public class ParentContextExtensibilityElement implements SystemInjectorExtensibilityElement {
+
+    private Method method;
+    private Field field;
+
+    public ParentContextExtensibilityElement(Method m) {
+        assert(method.getParameterTypes().length == 1): "Illegal number of parameters";
+        method = m;
+    }
+
+    public ParentContextExtensibilityElement(Field f) {
+        field = f;
+    }
+
+    public Injector<?> getInjector(ContextResolver resolver) {
+        if (method != null) {
+            return new MethodInjector(method, new ContextObjectFactory(resolver));
+        } else {
+            return new FieldInjector(field, new ContextObjectFactory(resolver));
+        }
+    }
+
+}

Added: incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/processor/AutowireProcessor.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/processor/AutowireProcessor.java?rev=398707&view=auto
==============================================================================
--- incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/processor/AutowireProcessor.java (added)
+++ incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/processor/AutowireProcessor.java Mon May  1 15:08:37 2006
@@ -0,0 +1,74 @@
+package org.apache.tuscany.core.system.config.processor;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+
+import org.apache.tuscany.core.config.ConfigurationLoadException;
+import org.apache.tuscany.core.config.InvalidSetterException;
+import org.apache.tuscany.core.config.processor.ImplementationProcessorSupport;
+import org.apache.tuscany.core.system.annotation.Autowire;
+import org.apache.tuscany.core.system.config.extensibility.AutowireExtensibilityElement;
+import org.apache.tuscany.core.context.SystemCompositeContext;
+import org.apache.tuscany.core.context.ConfigurationContext;
+import org.apache.tuscany.core.context.AutowireContext;
+import org.apache.tuscany.core.runtime.RuntimeContext;
+import org.apache.tuscany.core.builder.BuilderConfigException;
+import org.apache.tuscany.model.assembly.ComponentInfo;
+import org.apache.tuscany.common.monitor.MonitorFactory;
+
+/**
+ * Processes {@link Autowire} annotations
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class AutowireProcessor extends ImplementationProcessorSupport {
+
+    @Override
+    public void visitMethod(Method method, ComponentInfo type) throws ConfigurationLoadException {
+        Autowire annotation = method.getAnnotation(Autowire.class);
+        if (annotation != null) {
+            if (!Modifier.isPublic(method.getModifiers())) {
+                InvalidSetterException e = new InvalidSetterException("Autowire setter method is not public");
+                e.setIdentifier(method.toString());
+                throw e;
+            }
+            if (method.getParameterTypes().length != 1){
+                InvalidSetterException e = new InvalidSetterException("Autowire setter method must have one parameter");
+                e.setIdentifier(method.toString());
+                throw e;
+            }
+            checkAutowireType(method.getParameterTypes()[0],method.getDeclaringClass());
+            type.getExtensibilityElements().add(new AutowireExtensibilityElement(method));
+        }
+    }
+
+    @Override
+    public void visitField(Field field, ComponentInfo type) throws ConfigurationLoadException {
+        checkAutowireType(field.getType(),field.getDeclaringClass());
+        int modifiers = field.getModifiers();
+        Autowire annotation = field.getAnnotation(Autowire.class);
+        if (annotation != null) {
+            if (!Modifier.isPublic(modifiers) && !Modifier.isProtected(modifiers)) {
+                InvalidSetterException e = new InvalidSetterException("Autowire field is not public or protected");
+                e.setIdentifier(field.getName());
+                throw e;
+            }
+            type.getExtensibilityElements().add(new AutowireExtensibilityElement(field));
+        }
+    }
+
+
+
+    private void checkAutowireType(Class paramClass, Class declaringClass) throws BuilderConfigException{
+        if (SystemCompositeContext.class.isAssignableFrom(declaringClass)
+                && !(paramClass.equals(ConfigurationContext.class)
+                        || paramClass.equals(MonitorFactory.class)
+                        || paramClass.equals(RuntimeContext.class) || paramClass.equals(
+                        AutowireContext.class))) {
+            BuilderConfigException e = new BuilderConfigException("Illegal autowire type for system context");
+            e.setIdentifier(paramClass.getName());
+            throw e;
+        }
+    }
+}

Added: incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/processor/MonitorProcessor.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/processor/MonitorProcessor.java?rev=398707&view=auto
==============================================================================
--- incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/processor/MonitorProcessor.java (added)
+++ incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/processor/MonitorProcessor.java Mon May  1 15:08:37 2006
@@ -0,0 +1,53 @@
+package org.apache.tuscany.core.system.config.processor;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+
+import org.apache.tuscany.core.config.ConfigurationLoadException;
+import org.apache.tuscany.core.config.InvalidSetterException;
+import org.apache.tuscany.core.config.processor.ImplementationProcessorSupport;
+import org.apache.tuscany.core.system.annotation.Monitor;
+import org.apache.tuscany.core.system.config.extensibility.MonitorExtensibilityElement;
+import org.apache.tuscany.model.assembly.ComponentInfo;
+
+/**
+ * Processes {@link org.apache.tuscany.core.system.annotation.Autowire} annotations
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class MonitorProcessor extends ImplementationProcessorSupport {
+
+    @Override
+    public void visitMethod(Method method, ComponentInfo type) throws ConfigurationLoadException {
+        Monitor annotation = method.getAnnotation(Monitor.class);
+        if (annotation != null) {
+            if (!Modifier.isPublic(method.getModifiers())) {
+                InvalidSetterException e = new InvalidSetterException("Monitor setter method is not public");
+                e.setIdentifier(method.toString());
+                throw e;
+            }
+            if (method.getParameterTypes().length != 1) {
+                InvalidSetterException e = new InvalidSetterException("Monitor setter method must have one parameter");
+                e.setIdentifier(method.toString());
+                throw e;
+            }
+            type.getExtensibilityElements().add(new MonitorExtensibilityElement(method));
+        }
+    }
+
+    @Override
+    public void visitField(Field field, ComponentInfo type) throws ConfigurationLoadException {
+        int modifiers = field.getModifiers();
+        Monitor annotation = field.getAnnotation(Monitor.class);
+        if (annotation != null) {
+            if (!Modifier.isPublic(modifiers) && !Modifier.isProtected(modifiers)) {
+                InvalidSetterException e = new InvalidSetterException("Monitor field is not public or protected");
+                e.setIdentifier(field.getName());
+                throw e;
+            }
+            type.getExtensibilityElements().add(new MonitorExtensibilityElement(field));
+        }
+    }
+
+}

Added: incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/processor/ParentContextProcessor.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/processor/ParentContextProcessor.java?rev=398707&view=auto
==============================================================================
--- incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/processor/ParentContextProcessor.java (added)
+++ incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/processor/ParentContextProcessor.java Mon May  1 15:08:37 2006
@@ -0,0 +1,56 @@
+package org.apache.tuscany.core.system.config.processor;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+
+import org.apache.tuscany.core.config.ConfigurationLoadException;
+import org.apache.tuscany.core.config.InvalidSetterException;
+import org.apache.tuscany.core.config.processor.ImplementationProcessorSupport;
+import org.apache.tuscany.core.context.CompositeContext;
+import org.apache.tuscany.core.system.annotation.ParentContext;
+import org.apache.tuscany.core.system.config.extensibility.ParentContextExtensibilityElement;
+import org.apache.tuscany.model.assembly.ComponentInfo;
+
+/**
+ * Processes {@link org.apache.tuscany.core.system.annotation.Autowire} annotations
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class ParentContextProcessor extends ImplementationProcessorSupport {
+
+    @Override
+    public void visitMethod(Method method, ComponentInfo type) throws ConfigurationLoadException {
+        ParentContext annotation = method.getAnnotation(ParentContext.class);
+        if (annotation != null) {
+            if (!Modifier.isPublic(method.getModifiers())) {
+                InvalidSetterException e = new InvalidSetterException("ParentContext setter method is not public");
+                e.setIdentifier(method.toString());
+                throw e;
+            }
+            if (method.getParameterTypes().length != 1
+                    && !CompositeContext.class.isAssignableFrom(method.getParameterTypes()[0])) {
+                InvalidSetterException e = new InvalidSetterException("ParentContext setter method must have one parameter of type " + CompositeContext.class.getName());
+                e.setIdentifier(method.toString());
+                throw e;
+            }
+            type.getExtensibilityElements().add(new ParentContextExtensibilityElement(method));
+        }
+    }
+
+    @Override
+    public void visitField(Field field, ComponentInfo type) throws ConfigurationLoadException {
+        int modifiers = field.getModifiers();
+        ParentContext annotation = field.getAnnotation(ParentContext.class);
+        if (annotation != null) {
+            if (!Modifier.isPublic(modifiers) && !Modifier.isProtected(modifiers)) {
+                InvalidSetterException e = new InvalidSetterException("ParentContext field is not public or protected");
+                e.setIdentifier(field.getName());
+                throw e;
+            }
+            type.getExtensibilityElements().add(new ParentContextExtensibilityElement(field));
+        }
+    }
+
+
+}

Modified: incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/CoreAnnotationsProcessingTestCase.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/CoreAnnotationsProcessingTestCase.java?rev=398707&r1=398706&r2=398707&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/CoreAnnotationsProcessingTestCase.java (original)
+++ incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/config/impl/CoreAnnotationsProcessingTestCase.java Mon May  1 15:08:37 2006
@@ -18,6 +18,7 @@
 import junit.framework.TestCase;
 import org.apache.tuscany.core.config.ComponentTypeIntrospector;
 import org.apache.tuscany.core.config.JavaIntrospectionHelper;
+import org.apache.tuscany.core.config.processor.ProcessorUtils;
 import org.apache.tuscany.core.system.assembly.impl.SystemAssemblyFactoryImpl;
 import org.apache.tuscany.model.assembly.AssemblyFactory;
 import org.apache.tuscany.model.assembly.ComponentInfo;
@@ -163,12 +164,7 @@
     protected void setUp() throws Exception {
         super.setUp();
         factory = new SystemAssemblyFactoryImpl();
-        introspector = IntrospectorFactory.createIntrospector();
+        introspector = ProcessorUtils.createCoreIntrospector(factory); 
     }
-
-    protected void tearDown() throws Exception {
-        super.tearDown();
-    }
-
 
 }

Modified: incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/context/CompositeHierarchyTestCase.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/context/CompositeHierarchyTestCase.java?rev=398707&r1=398706&r2=398707&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/context/CompositeHierarchyTestCase.java (original)
+++ incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/context/CompositeHierarchyTestCase.java Mon May  1 15:08:37 2006
@@ -49,6 +49,7 @@
         CompositeContext parent = createContextHierachy();
         CompositeContext child = (CompositeContext) parent.getContext("test.child");
         Component component = factory.createSystemComponent("TestService1", ModuleScopeSystemComponent.class, ModuleScopeSystemComponentImpl.class, Scope.MODULE);
+        
         component.initialize(new AssemblyContextImpl(factory, null, null));
         child.registerModelObject(component);
         parent.publish(new ModuleStart(this));

Modified: incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/ComponentLoaderTestCase.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/ComponentLoaderTestCase.java?rev=398707&r1=398706&r2=398707&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/ComponentLoaderTestCase.java (original)
+++ incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/loader/assembly/ComponentLoaderTestCase.java Mon May  1 15:08:37 2006
@@ -101,14 +101,7 @@
         loader = new ComponentLoader();
         loader.setFactory(assemblyFactory);
         loader.setDefaultPropertyFactory(new StringParserPropertyFactory());
-        introspector = new Java5ComponentTypeIntrospector(assemblyFactory);
-        //FIXME JFM HACK
-        List<ImplementationProcessor> processors = ProcessorUtils.createCoreProcessors(assemblyFactory);
-        for (ImplementationProcessor processor : processors) {
-            introspector.registerProcessor(processor);
-        }
-        // END hack
-
+        introspector = ProcessorUtils.createCoreIntrospector(assemblyFactory);
     }
 
     public static interface Service {

Modified: incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/mock/MockFactory.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/mock/MockFactory.java?rev=398707&r1=398706&r2=398707&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/mock/MockFactory.java (original)
+++ incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/mock/MockFactory.java Mon May  1 15:08:37 2006
@@ -16,7 +16,15 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.tuscany.common.monitor.impl.NullMonitorFactory;
 import org.apache.tuscany.core.builder.ContextFactoryBuilder;
+import org.apache.tuscany.core.client.BootstrapHelper;
+import org.apache.tuscany.core.config.ComponentTypeIntrospector;
+import org.apache.tuscany.core.config.ConfigurationLoadException;
+import org.apache.tuscany.core.config.impl.Java5ComponentTypeIntrospector;
+import org.apache.tuscany.core.config.processor.ProcessorUtils;
+import org.apache.tuscany.core.context.impl.CompositeContextImpl;
+import org.apache.tuscany.core.extension.config.ImplementationProcessor;
 import org.apache.tuscany.core.mock.component.ModuleScopeSystemComponent;
 import org.apache.tuscany.core.mock.component.ModuleScopeSystemComponentImpl;
 import org.apache.tuscany.core.mock.component.Source;
@@ -32,7 +40,7 @@
 import org.apache.tuscany.core.system.builder.SystemContextFactoryBuilder;
 import org.apache.tuscany.core.system.builder.SystemEntryPointBuilder;
 import org.apache.tuscany.core.system.builder.SystemExternalServiceBuilder;
-import org.apache.tuscany.core.client.BootstrapHelper;
+import org.apache.tuscany.core.system.context.SystemCompositeContextImpl;
 import org.apache.tuscany.model.assembly.AssemblyContext;
 import org.apache.tuscany.model.assembly.Component;
 import org.apache.tuscany.model.assembly.ComponentInfo;
@@ -49,36 +57,60 @@
 import org.apache.tuscany.model.assembly.Service;
 import org.apache.tuscany.model.assembly.impl.AssemblyContextImpl;
 import org.apache.tuscany.model.types.java.JavaServiceContract;
-import org.apache.tuscany.common.monitor.impl.NullMonitorFactory;
 
 /**
  * Generates test components, modules, and runtime artifacts
- * 
+ *
  * @version $Rev$ $Date$
  */
 public class MockFactory {
 
     private static SystemAssemblyFactory systemFactory = new SystemAssemblyFactoryImpl();
-
     private static AssemblyContext assemblyContext = new AssemblyContextImpl(systemFactory, null, null);
+    private static ComponentTypeIntrospector introspector;
+    private static ComponentInfo systemComponentType;
+    private static ComponentInfo compositeComponentType;
 
     private MockFactory() {
     }
 
+    public static ComponentInfo getComponentType() throws ConfigurationLoadException {
+        if (systemComponentType == null) {
+            systemComponentType = getIntrospector().introspect(SystemCompositeContextImpl.class);
+        }
+        return systemComponentType;
+    }
+
+    public static ComponentInfo getCompositeComponentType() throws ConfigurationLoadException {
+        if (compositeComponentType == null) {
+            compositeComponentType = getIntrospector().introspect(CompositeContextImpl.class);
+        }
+        return compositeComponentType;
+    }
+
+    public static ComponentTypeIntrospector getIntrospector() {
+        if (introspector == null) {
+            introspector = ProcessorUtils.createCoreIntrospector(systemFactory);
+        }
+        return introspector;
+    }
+
     /**
      * Creates an composite component with the given name
      */
-    public static ModuleComponent createCompositeComponent(String name) {
+    public static ModuleComponent createCompositeComponent(String name) throws ConfigurationLoadException {
         ModuleComponent sc = systemFactory.createModuleComponent();
         Module impl = systemFactory.createModule();
         impl.setName(name);
         //impl.setImplementationClass(CompositeContextImpl.class);
         sc.setImplementation(impl);
+        impl.setImplementationClass(CompositeContextImpl.class);
+        impl.setComponentInfo(getCompositeComponentType());
         Service s = systemFactory.createService();
         JavaServiceContract ji = systemFactory.createJavaServiceContract();
         s.setServiceContract(ji);
         ji.setScope(Scope.AGGREGATE);
-        impl.setComponentInfo(systemFactory.createComponentInfo());
+//        impl.setComponentInfo(systemFactory.createComponentInfo());
         impl.getComponentInfo().getServices().add(s);
         sc.setName(name);
         sc.setImplementation(impl);
@@ -88,17 +120,18 @@
     /**
      * Creates an composite component with the given name
      */
-    public static ModuleComponent createSystemCompositeComponent(String name) {
+    public static ModuleComponent createSystemCompositeComponent(String name) throws ConfigurationLoadException {
         ModuleComponent sc = systemFactory.createModuleComponent();
         SystemModule impl = systemFactory.createSystemModule();
         impl.setName(name);
-        //impl.setImplementationClass(SystemCompositeContextImpl.class);
+        impl.setImplementationClass(SystemCompositeContextImpl.class);
+        impl.setComponentInfo(getComponentType());
         sc.setImplementation(impl);
         Service s = systemFactory.createService();
         JavaServiceContract ji = systemFactory.createJavaServiceContract();
         s.setServiceContract(ji);
         ji.setScope(Scope.AGGREGATE);
-        impl.setComponentInfo(systemFactory.createComponentInfo());
+        //impl.setComponentInfo(systemFactory.createComponentInfo());
         impl.getComponentInfo().getServices().add(s);
         sc.setName(name);
         sc.setImplementation(impl);
@@ -107,22 +140,23 @@
 
     /**
      * Creates a basic entry point with no configured reference using the system binding
-     * 
-     * @param name the name of the entry point
+     *
+     * @param name     the name of the entry point
      * @param interfaz the inteface exposed by the entry point
-     * @param refName the name of the entry point reference
+     * @param refName  the name of the entry point reference
      */
     public static EntryPoint createEPSystemBinding(String name, Class interfaz, String refName) {
         return createEPSystemBinding(name, interfaz, refName, null);
     }
 
     /**
-     * Creates an entry point wired to the given target (e.g. component, external service) using the system binding
-     * 
-     * @param name the name of the entry point
+     * Creates an entry point wired to the given target (e.g. component, external service) using the system
+     * binding
+     *
+     * @param name     the name of the entry point
      * @param interfaz the inteface exposed by the entry point
-     * @param refName the name of the entry point reference
-     * @param target the target the entry point is wired to
+     * @param refName  the name of the entry point reference
+     * @param target   the target the entry point is wired to
      */
     public static EntryPoint createEPSystemBinding(String name, Class interfaz, String refName, Part target) {
         JavaServiceContract contract = systemFactory.createJavaServiceContract();
@@ -170,12 +204,13 @@
     }
 
     /**
-     * Creates an entry point that should be wired to the given target (e.g. component, external service) using the
-     * system binding. The system assembly process should resolve the target name to an actual target configuration.
-     * 
-     * @param name the name of the entry point
-     * @param interfaz the inteface exposed by the entry point
-     * @param refName the name of the entry point reference
+     * Creates an entry point that should be wired to the given target (e.g. component, external service)
+     * using the system binding. The system assembly process should resolve the target name to an actual
+     * target configuration.
+     *
+     * @param name          the name of the entry point
+     * @param interfaz      the inteface exposed by the entry point
+     * @param refName       the name of the entry point reference
      * @param componentName the name of the target to resolve
      */
     public static EntryPoint createEntryPointWithStringRef(String name, Class interfaz, String refName, String componentName) {
@@ -235,13 +270,14 @@
     /**
      * Creates a test system module with a module-scoped component and entry point
      */
-    public static Module createSystemModule() {
-        Module module = systemFactory.createModule();
+    public static Module createSystemModule() throws ConfigurationLoadException {
+        Module module = systemFactory.createSystemModule();
         module.setName("system.module");
 
         // create test component
         Component component = systemFactory.createSystemComponent("TestService1", ModuleScopeSystemComponent.class,
                 ModuleScopeSystemComponentImpl.class, Scope.MODULE);
+        component.getImplementation().setComponentInfo(getIntrospector().introspect(ModuleScopeSystemComponent.class));
         module.getComponents().add(component);
 
         // create the entry point
@@ -249,20 +285,28 @@
         module.getEntryPoints().add(ep);
 
         module.initialize(assemblyContext);
+        module.setImplementationClass(SystemCompositeContextImpl.class);
+        module.setComponentInfo(getComponentType());
         return module;
     }
 
-    public static <T> Component createSystemComponent(String name,  Class<T> service, Class<? extends T> impl,Scope scope ){
-       return systemFactory.createSystemComponent(name,service,impl,scope);
+    public static <T> Component createSystemComponent(String name, Class<T> service, Class<? extends T> impl, Scope scope) throws ConfigurationLoadException {
+        Component c = systemFactory.createSystemComponent(name, service, impl, scope);
+        c.getImplementation().setComponentInfo(getIntrospector().introspect(impl));
+        for (Service s : c.getImplementation().getComponentInfo().getServices()) {
+             s.getServiceContract().setScope(scope);    //hack
+        }
+
+        return c;
     }
 
     /**
      * Creates a test system module with source and target components wired together.
-     * 
+     *
      * @see org.apache.tuscany.core.mock.component.Source
      * @see org.apache.tuscany.core.mock.component.Target
      */
-    public static Module createSystemModuleWithWiredComponents(String moduleName, Scope sourceScope, Scope targetScope) {
+    public static Module createSystemModuleWithWiredComponents(String moduleName, Scope sourceScope, Scope targetScope) throws ConfigurationLoadException {
 
         // create the target component
         Component target = systemFactory.createSystemComponent("target", Target.class, TargetImpl.class, targetScope);
@@ -296,7 +340,9 @@
 
         source.initialize(assemblyContext);
 
-        Module module = systemFactory.createModule();
+        Module module = systemFactory.createSystemModule();
+        module.setImplementationClass(SystemCompositeContextImpl.class);
+        module.setComponentInfo(getComponentType());
         module.setName(moduleName);
         module.getComponents().add(source);
         module.getComponents().add(target);
@@ -306,24 +352,26 @@
 
     /**
      * Creates a test system module component with source and target components wired together.
-     * 
+     *
      * @see org.apache.tuscany.core.mock.component.Source
      * @see org.apache.tuscany.core.mock.component.Target
      */
     public static ModuleComponent createSystemModuleComponentWithWiredComponents(String moduleComponentName, Scope sourceScope,
-                                                                                 Scope targetScope) {
+                                                                                 Scope targetScope) throws ConfigurationLoadException {
         ModuleComponent mc = systemFactory.createModuleComponent();
         mc.setName(moduleComponentName);
-        mc.setImplementation(createSystemModuleWithWiredComponents(moduleComponentName+".module", sourceScope, targetScope));
+        mc.setImplementation(createSystemModuleWithWiredComponents(moduleComponentName + ".module", sourceScope, targetScope));
         return mc;
     }
 
     /**
      * Creates a test system module component with a module-scoped component and entry point
      */
-    public static Module createSystemChildModule() {
-        Module module = systemFactory.createModule();
+    public static Module createSystemChildModule() throws ConfigurationLoadException {
+        Module module = systemFactory.createSystemModule();
         module.setName("system.test.module");
+        module.setImplementationClass(SystemCompositeContextImpl.class);
+        module.setComponentInfo(getComponentType());
 
         // create test component
         Component component = systemFactory.createSystemComponent("TestService2", ModuleScopeSystemComponent.class,

Modified: incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/AutowireSourceImpl.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/AutowireSourceImpl.java?rev=398707&r1=398706&r2=398707&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/AutowireSourceImpl.java (original)
+++ incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/mock/component/AutowireSourceImpl.java Mon May  1 15:08:37 2006
@@ -25,7 +25,7 @@
 public class AutowireSourceImpl implements Source {
 
     @Autowire
-    private Target target;
+    protected Target target;
     
     private List<Target> targets;
 

Modified: incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/runtime/RuntimeContextImplTestCase.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/runtime/RuntimeContextImplTestCase.java?rev=398707&r1=398706&r2=398707&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/runtime/RuntimeContextImplTestCase.java (original)
+++ incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/runtime/RuntimeContextImplTestCase.java Mon May  1 15:08:37 2006
@@ -260,6 +260,7 @@
 
         CompositeContext system = runtime.getSystemContext();
         Component builder = factory.createSystemComponent("TestBuilder", ContextFactoryBuilder.class, TestBuilder.class, Scope.MODULE);
+        builder.getImplementation().setComponentInfo(MockFactory.getIntrospector().introspect(TestBuilder.class));
         system.registerModelObject(builder);
         system.publish(new ModuleStart(this));
         Component module1 = MockFactory.createCompositeComponent("module1");

Modified: incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/builder/MonitorInjectionTestCase.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/builder/MonitorInjectionTestCase.java?rev=398707&r1=398706&r2=398707&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/builder/MonitorInjectionTestCase.java (original)
+++ incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/builder/MonitorInjectionTestCase.java Mon May  1 15:08:37 2006
@@ -27,6 +27,7 @@
 import org.apache.tuscany.core.context.impl.EventContextImpl;
 import org.apache.tuscany.core.context.scope.DefaultScopeStrategy;
 import org.apache.tuscany.core.mock.MockConfigContext;
+import org.apache.tuscany.core.mock.MockFactory;
 import org.apache.tuscany.core.system.annotation.Monitor;
 import org.apache.tuscany.core.system.assembly.SystemAssemblyFactory;
 import org.apache.tuscany.core.system.assembly.impl.SystemAssemblyFactoryImpl;
@@ -45,7 +46,7 @@
 
     public static class TestComponent implements TestService {
         @Monitor
-        Monitor1 monitor1;
+        protected Monitor1 monitor1;
         Monitor2 monitor2;
 
         @Monitor
@@ -79,6 +80,7 @@
         MockMonitorFactory monitorFactory = new MockMonitorFactory();
         builder = new SystemContextFactoryBuilder(monitorFactory);
         component = factory.createSystemComponent("test", TestService.class, TestComponent.class, Scope.MODULE);
+        component.getImplementation().setComponentInfo(MockFactory.getIntrospector().introspect(TestComponent.class));
     }
 
     private static final Monitor1 MONITOR1 = new Monitor1() {

Modified: incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/builder/SystemComponentImpl.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/builder/SystemComponentImpl.java?rev=398707&r1=398706&r2=398707&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/builder/SystemComponentImpl.java (original)
+++ incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/builder/SystemComponentImpl.java Mon May  1 15:08:37 2006
@@ -21,22 +21,24 @@
 import org.osoa.sca.annotations.Destroy;
 import org.osoa.sca.annotations.Init;
 import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Scope;
 
 /**
  * A system component used for unit testing
  * 
  * @version $Rev$ $Date$
  */
+@Scope("MODULE")
 public class SystemComponentImpl {
 
     @Autowire
-    private ConfigurationContext ctx;
+    protected ConfigurationContext ctx;
 
     @ParentContext
-    private CompositeContext parent;
+    protected CompositeContext parent;
 
     @Autowire
-    private AutowireContext autowireCtx;
+    protected AutowireContext autowireCtx;
 
     private ConfigurationContext ctxSetter;
 
@@ -84,79 +86,79 @@
     }
 
     private boolean inited;
-    
+
     @Init
     public void init(){
         inited=true;
     }
-    
+
     public boolean initialized(){
         return (inited);
     }
 
    private boolean destroyed;
-    
+
     @Destroy
     public void destroy(){
         destroyed=true;
     }
-    
+
     public boolean destroyed(){
         return (destroyed);
     }
-    
+
     @Property
-    private int testInt;
-    
+    protected int testInt;
+
     public int getTestInt(){
         return testInt;
     }
 
     @Property
-    private double testDouble;
-    
+    protected double testDouble;
+
     public double getTestDouble(){
         return testDouble;
     }
 
     @Property
-    private float testFloat;
-    
+    protected float testFloat;
+
     public float getTestFloat(){
         return testFloat;
     }
-    
+
     @Property
-    private short testShort;
-    
+    protected short testShort;
+
     public short getTestShort(){
         return testShort;
     }
-    
+
     @Property
-    private boolean testBoolean;
-    
+    protected boolean testBoolean;
+
     public boolean getTestBoolean(){
         return testBoolean;
     }
-    
+
     @Property
-    private byte testByte;
-    
+    protected byte testByte;
+
     public byte getTestByte(){
         return testByte;
     }
-    
+
     @Property
-    private char testChar;
-    
+    protected char testChar;
+
     public char getTestChar(){
         return testChar;
     }
-    
+
     @Property
-    private String testString;
-    
+    protected String testString;
+
     public String getTestString(){
         return testString;
     }

Modified: incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/builder/SystemContextFactoryBuilderTestCase.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/builder/SystemContextFactoryBuilderTestCase.java?rev=398707&r1=398706&r2=398707&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/builder/SystemContextFactoryBuilderTestCase.java (original)
+++ incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/builder/SystemContextFactoryBuilderTestCase.java Mon May  1 15:08:37 2006
@@ -23,6 +23,7 @@
 import org.apache.tuscany.core.context.impl.EventContextImpl;
 import org.apache.tuscany.core.context.scope.DefaultScopeStrategy;
 import org.apache.tuscany.core.mock.MockConfigContext;
+import org.apache.tuscany.core.mock.MockFactory;
 import org.apache.tuscany.core.system.assembly.SystemAssemblyFactory;
 import org.apache.tuscany.core.system.assembly.SystemImplementation;
 import org.apache.tuscany.core.system.assembly.impl.SystemAssemblyFactoryImpl;
@@ -35,7 +36,7 @@
 import org.apache.tuscany.model.types.java.JavaServiceContract;
 
 /**
- * Tests to that system components are built properly
+ * Tests to system components are built properly
  * 
  * @version $Rev$ $Date$
  */
@@ -46,7 +47,7 @@
     public void testComponentContextBuilder() throws Exception {
         SystemContextFactoryBuilder builder = new SystemContextFactoryBuilder(null);
         Component component = factory.createSystemComponent("test", null, SystemComponentImpl.class, Scope.AGGREGATE);
-
+        component.getImplementation().setComponentInfo(MockFactory.getIntrospector().introspect(SystemComponentImpl.class));
         ConfiguredProperty cProp = factory.createConfiguredProperty();
         Property prop = factory.createProperty();
         prop.setName("testInt");

Modified: incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/AutowireTestCase.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/AutowireTestCase.java?rev=398707&r1=398706&r2=398707&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/AutowireTestCase.java (original)
+++ incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/AutowireTestCase.java Mon May  1 15:08:37 2006
@@ -17,6 +17,7 @@
 import junit.framework.TestCase;
 import org.apache.tuscany.core.context.CompositeContext;
 import org.apache.tuscany.core.context.SystemCompositeContext;
+import org.apache.tuscany.core.context.impl.CompositeContextImpl;
 import org.apache.tuscany.core.context.event.ModuleStop;
 import org.apache.tuscany.core.context.event.ModuleStart;
 import org.apache.tuscany.core.mock.MockFactory;
@@ -27,6 +28,7 @@
 import org.apache.tuscany.core.runtime.RuntimeContext;
 import org.apache.tuscany.core.system.assembly.SystemAssemblyFactory;
 import org.apache.tuscany.core.system.assembly.impl.SystemAssemblyFactoryImpl;
+import org.apache.tuscany.core.config.ConfigurationLoadException;
 import org.apache.tuscany.model.assembly.AssemblyContext;
 import org.apache.tuscany.model.assembly.Component;
 import org.apache.tuscany.model.assembly.EntryPoint;
@@ -292,11 +294,13 @@
         return runtime;
     }
 
-    private ModuleComponent createAppModuleComponent(String name) {
+    private ModuleComponent createAppModuleComponent(String name) throws ConfigurationLoadException {
         AssemblyContext assemblyContext = new AssemblyContextImpl(systemFactory, null, null);
         ModuleComponent mc = systemFactory.createModuleComponent();
         mc.setName(name);
         Module module = systemFactory.createModule();
+        module.setImplementationClass(CompositeContextImpl.class);
+        module.setComponentInfo(MockFactory.getComponentType());
         module.setName(name);
         module.initialize(assemblyContext);
         mc.setImplementation(module);

Modified: incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/CompositeNestingTestCase.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/CompositeNestingTestCase.java?rev=398707&r1=398706&r2=398707&view=diff
==============================================================================
--- incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/CompositeNestingTestCase.java (original)
+++ incubator/tuscany/java/sca/core/src/test/java/org/apache/tuscany/core/system/context/CompositeNestingTestCase.java Mon May  1 15:08:37 2006
@@ -21,6 +21,7 @@
 import org.apache.tuscany.core.mock.component.Source;
 import org.apache.tuscany.core.mock.component.Target;
 import org.apache.tuscany.core.runtime.RuntimeContext;
+import org.apache.tuscany.core.config.ConfigurationLoadException;
 import org.apache.tuscany.model.assembly.ModuleComponent;
 import org.apache.tuscany.model.assembly.Scope;
 
@@ -77,7 +78,7 @@
         Assert.assertNull(child1Ctx.getContext("child3")); // sanity check
     }
 
-    private ModuleComponent createHierarchy(){
+    private ModuleComponent createHierarchy() throws ConfigurationLoadException {
         ModuleComponent child3 = MockFactory.createSystemModuleComponentWithWiredComponents("child3", Scope.MODULE, Scope.MODULE);
         ModuleComponent child2 = MockFactory.createSystemModuleComponentWithWiredComponents("child2", Scope.MODULE, Scope.MODULE);
         child2.getImplementation().getComponents().add(child3);



Mime
View raw message