You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by js...@apache.org on 2007/05/08 08:15:27 UTC

svn commit: r536080 [1/2] - in /incubator/tuscany/java/sca/modules: binding-rmi/src/main/java/org/apache/tuscany/binding/rmi/ core-spi/src/main/java/org/apache/tuscany/core/ core-spi/src/main/java/org/apache/tuscany/provider/ core/src/main/java/org/apa...

Author: jsdelfino
Date: Mon May  7 23:15:22 2007
New Revision: 536080

URL: http://svn.apache.org/viewvc?view=rev&rev=536080
Log:
Separating model implementations from runtime implementation providers.

Added:
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/BindingProviderFactory.java   (with props)
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ImplementationActivator.java   (with props)
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ImplementationProvider.java   (with props)
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ImplementationProviderFactory.java   (with props)
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ReferenceBindingActivator.java   (with props)
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ReferenceBindingProvider.java   (with props)
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ScopedImplementationProvider.java   (with props)
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ServiceBindingActivator.java   (with props)
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ServiceBindingProvider.java   (with props)
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeSCABindingProvider.java   (with props)
    incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/backend/
    incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/backend/ResourceManager.java   (with props)
    incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/impl/
    incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/impl/CRUDImplementationImpl.java   (with props)
    incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/impl/CRUDImplementationProcessor.java   (with props)
    incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/module/
    incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/module/CRUDModuleActivator.java   (with props)
    incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/provider/
    incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/provider/CRUDImplementationProvider.java   (with props)
    incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/provider/CRUDImplementationProviderFactory.java   (with props)
    incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/provider/CRUDInvoker.java   (with props)
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/implementation/java/invocation/JavaImplementationProviderFactory.java   (with props)
    incubator/tuscany/java/sca/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptImplementationProvider.java   (with props)
Removed:
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/core/ImplementationActivator.java
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/core/ImplementationProvider.java
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/core/ReferenceBindingActivator.java
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/core/ReferenceBindingProvider.java
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/core/RuntimeBinding.java
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/core/RuntimeImplementation.java
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/core/ScopedImplementationProvider.java
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/core/ServiceBindingActivator.java
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/core/ServiceBindingProvider.java
    incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/CRUDImplementationImpl.java
    incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/CRUDImplementationProcessor.java
    incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/CRUDImplementationProvider.java
    incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/CRUDInvoker.java
    incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/CRUDModuleActivator.java
    incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/ResourceManager.java
Modified:
    incubator/tuscany/java/sca/modules/binding-rmi/src/main/java/org/apache/tuscany/binding/rmi/RMIBindingProvider.java
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/core/RuntimeComponent.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/DefaultCompositeActivator.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeComponentImpl.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeSCABindingImpl.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/scope/AbstractScopeContainer.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/scope/ScopeRegistryImpl.java
    incubator/tuscany/java/sca/modules/core/src/test/java/org/apache/tuscany/core/scope/AbstractScopeContainerTestCase.java
    incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/DefaultCRUDImplementationFactory.java
    incubator/tuscany/java/sca/modules/host-embedded/src/test/resources/META-INF/services/org.apache.tuscany.core.ModuleActivator
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/implementation/java/invocation/JavaComponentInfo.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/implementation/java/invocation/JavaImplementationProvider.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/implementation/java/invocation/RuntimeJavaImplementationFactory.java
    incubator/tuscany/java/sca/modules/implementation-script/src/main/java/org/apache/tuscany/implementation/spi/AbstractImplementation.java
    incubator/tuscany/java/sca/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptImplementation.java
    incubator/tuscany/java/sca/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptInvoker.java

Modified: incubator/tuscany/java/sca/modules/binding-rmi/src/main/java/org/apache/tuscany/binding/rmi/RMIBindingProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-rmi/src/main/java/org/apache/tuscany/binding/rmi/RMIBindingProvider.java?view=diff&rev=536080&r1=536079&r2=536080
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-rmi/src/main/java/org/apache/tuscany/binding/rmi/RMIBindingProvider.java (original)
+++ incubator/tuscany/java/sca/modules/binding-rmi/src/main/java/org/apache/tuscany/binding/rmi/RMIBindingProvider.java Mon May  7 23:15:22 2007
@@ -30,14 +30,10 @@
 import net.sf.cglib.proxy.MethodInterceptor;
 import net.sf.cglib.proxy.MethodProxy;
 
-import org.apache.tuscany.core.ReferenceBindingActivator;
-import org.apache.tuscany.core.ReferenceBindingProvider;
 import org.apache.tuscany.core.RuntimeComponent;
 import org.apache.tuscany.core.RuntimeComponentReference;
 import org.apache.tuscany.core.RuntimeComponentService;
 import org.apache.tuscany.core.RuntimeWire;
-import org.apache.tuscany.core.ServiceBindingActivator;
-import org.apache.tuscany.core.ServiceBindingProvider;
 import org.apache.tuscany.interfacedef.Interface;
 import org.apache.tuscany.interfacedef.InterfaceContract;
 import org.apache.tuscany.interfacedef.Operation;
@@ -47,6 +43,10 @@
 import org.apache.tuscany.invocation.Invoker;
 import org.apache.tuscany.invocation.Message;
 import org.apache.tuscany.invocation.MessageImpl;
+import org.apache.tuscany.provider.ReferenceBindingActivator;
+import org.apache.tuscany.provider.ReferenceBindingProvider;
+import org.apache.tuscany.provider.ServiceBindingActivator;
+import org.apache.tuscany.provider.ServiceBindingProvider;
 import org.apache.tuscany.rmi.RMIHost;
 import org.apache.tuscany.rmi.RMIHostException;
 import org.apache.tuscany.spi.component.WorkContext;

Modified: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/core/RuntimeComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/core/RuntimeComponent.java?view=diff&rev=536080&r1=536079&r2=536080
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/core/RuntimeComponent.java (original)
+++ incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/core/RuntimeComponent.java Mon May  7 23:15:22 2007
@@ -20,6 +20,7 @@
 package org.apache.tuscany.core;
 
 import org.apache.tuscany.assembly.Component;
+import org.apache.tuscany.provider.ImplementationProvider;
 import org.apache.tuscany.scope.ScopeContainer;
 import org.osoa.sca.ComponentContext;
 
@@ -30,14 +31,15 @@
 public interface RuntimeComponent extends Component, ComponentContext {
     /**
      * Set the implementation-specific configuration for this component
-     * @param configuration
+     * @param implementationProvider
      */
-    void setImplementationConfiguration(Object configuration);
+    void setImplementationProvider(ImplementationProvider implementationProvider);
+    
     /**
      * Get the implementation-specific configuation for this component
      * @return
      */
-    Object getImplementationConfiguration();
+    ImplementationProvider getImplementationProvider();
     
     /**
      * Set the associated scope container

Added: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/BindingProviderFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/BindingProviderFactory.java?view=auto&rev=536080
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/BindingProviderFactory.java (added)
+++ incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/BindingProviderFactory.java Mon May  7 23:15:22 2007
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.provider;
+
+import org.apache.tuscany.assembly.Binding;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface BindingProviderFactory extends Binding {
+    
+    ReferenceBindingProvider createReferenceBindingProvider();
+    
+    ServiceBindingProvider createServiceBindingProvider();
+    
+}

Propchange: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/BindingProviderFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/BindingProviderFactory.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ImplementationActivator.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ImplementationActivator.java?view=auto&rev=536080
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ImplementationActivator.java (added)
+++ incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ImplementationActivator.java Mon May  7 23:15:22 2007
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.provider;
+
+import org.apache.tuscany.core.RuntimeComponent;
+
+
+/**
+ * A component implementation can optionally implement this interface to control
+ * how a component is started ot stopped.
+ * 
+ * @version $Rev$ $Date$
+ */
+public interface ImplementationActivator {
+    /**
+     * This method will be invoked when a component implemented by this
+     * implementation is activated.
+     * 
+     * @param component The component to be started
+     */
+    void start(RuntimeComponent component);
+
+    /**
+     * This method will be invoked when a component implemented by this
+     * implementation is deactivated.
+     * 
+     * @param component The component to be stopped
+     */
+    void stop(RuntimeComponent component);
+}

Propchange: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ImplementationActivator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ImplementationActivator.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ImplementationProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ImplementationProvider.java?view=auto&rev=536080
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ImplementationProvider.java (added)
+++ incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ImplementationProvider.java Mon May  7 23:15:22 2007
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.provider;
+
+import org.apache.tuscany.core.RuntimeComponent;
+import org.apache.tuscany.core.RuntimeComponentService;
+import org.apache.tuscany.interfacedef.InterfaceContract;
+import org.apache.tuscany.interfacedef.Operation;
+import org.apache.tuscany.invocation.Invoker;
+
+/**
+ * A component implementation can implement this interface to provide additional logic 
+ * to the Tuscany runtime 
+ * 
+ * @version $Rev$ $Date$
+ */
+public interface ImplementationProvider extends ImplementationActivator {
+    /**
+     * Create an invoker for the component implementation in the invocation
+     * chain. The invoker will be responsible for calling the implementation
+     * logic for the given component.
+     * 
+     * @param component The component that owns the component service
+     * @param service The component service
+     * @param operation The operation that the interceptor will handle
+     * @return An invoker that handles the invocation logic, null should be
+     *         returned if no invoker is required
+     */
+    Invoker createInvoker(RuntimeComponent component, RuntimeComponentService service, Operation operation);
+
+    /**
+     * Create an invoker to call back to the given component
+     * @param component The component that receives the callback
+     * @param operation The operation
+     * @return An invoker that handles the invocation logic, null should be
+     *         returned if no invoker is required
+     */
+    Invoker createCallbackInvoker(RuntimeComponent component, Operation operation);
+    
+    /**
+     * Get the effective interface contract imposed by the implementation.
+     * 
+     * @param service The component service
+     * @return The effective interface contract, if null is returned, the interface contract
+     * for the component service will be used
+     */
+    InterfaceContract getImplementationInterfaceContract(RuntimeComponentService service);
+  
+    /**
+     * Configure the component by adding additional metadata for the component
+     * @param component The runtime component
+     */
+    void configure(RuntimeComponent component);
+}

Propchange: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ImplementationProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ImplementationProvider.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ImplementationProviderFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ImplementationProviderFactory.java?view=auto&rev=536080
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ImplementationProviderFactory.java (added)
+++ incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ImplementationProviderFactory.java Mon May  7 23:15:22 2007
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.provider;
+
+import org.apache.tuscany.assembly.Implementation;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface ImplementationProviderFactory extends Implementation {
+    
+    ImplementationProvider createImplementationProvider();
+    
+}

Propchange: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ImplementationProviderFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ImplementationProviderFactory.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ReferenceBindingActivator.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ReferenceBindingActivator.java?view=auto&rev=536080
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ReferenceBindingActivator.java (added)
+++ incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ReferenceBindingActivator.java Mon May  7 23:15:22 2007
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.provider;
+
+import org.apache.tuscany.core.RuntimeComponent;
+import org.apache.tuscany.core.RuntimeComponentReference;
+
+
+/**
+ * A binding can optionally implement this interface to control how the
+ * reference binding is started or stopped.
+ * 
+ * @version $Rev$ $Date$
+ */
+public interface ReferenceBindingActivator {
+    /**
+     * This method will be invoked when the reference binding is activated for
+     * the given component reference
+     * 
+     * @param component The component that owns the reference
+     * @param reference The reference that owns the binding
+     */
+    void start(RuntimeComponent component, RuntimeComponentReference reference);
+
+    /**
+     * This method will be invoked when the reference binding is deactivated for
+     * the given component reference
+     * 
+     * @param component The component that owns the reference
+     * @param reference The reference that owns the binding
+     */
+    void stop(RuntimeComponent component, RuntimeComponentReference reference);
+}

Propchange: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ReferenceBindingActivator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ReferenceBindingActivator.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ReferenceBindingProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ReferenceBindingProvider.java?view=auto&rev=536080
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ReferenceBindingProvider.java (added)
+++ incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ReferenceBindingProvider.java Mon May  7 23:15:22 2007
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.provider;
+
+import org.apache.tuscany.core.RuntimeComponent;
+import org.apache.tuscany.core.RuntimeComponentReference;
+import org.apache.tuscany.interfacedef.InterfaceContract;
+import org.apache.tuscany.interfacedef.Operation;
+import org.apache.tuscany.invocation.Invoker;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface ReferenceBindingProvider extends ReferenceBindingActivator {
+    /**
+     * Create an invoker for the reference binding in the invocation chain.
+     * The invoker is responsible for making the outbound invocation over
+     * the binding protocol.
+     * 
+     * @param model The service that defines the binding
+     * @param operation The operation that the interceptor will handle
+     * @param isCallback A flag to tell if the operation is for the callback
+     * @return An invoker that handles the invocation logic, null should be
+     *         returned if no invoker is required
+     */
+    Invoker createInvoker(RuntimeComponent component, RuntimeComponentReference reference, Operation operation, boolean isCallback);
+
+    /**
+     * Get the effective interface contract imposed by the binding. For example,
+     * it will be interface contract introspected from the WSDL portType used by
+     * the endpoint for a WebService binding.
+     * 
+     * @param model The model object
+     * @return The effective interface contract, if null is returned, the interface contract
+     * for the component reference will be used
+     */
+    InterfaceContract getBindingInterfaceContract(RuntimeComponentReference reference);
+    
+
+}

Propchange: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ReferenceBindingProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ReferenceBindingProvider.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ScopedImplementationProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ScopedImplementationProvider.java?view=auto&rev=536080
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ScopedImplementationProvider.java (added)
+++ incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ScopedImplementationProvider.java Mon May  7 23:15:22 2007
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.provider;
+
+import org.apache.tuscany.core.RuntimeComponent;
+import org.apache.tuscany.scope.InstanceWrapper;
+import org.apache.tuscany.scope.Scope;
+
+/**
+ * A component implementation can implement this interface to provide scope
+ * management for the components
+ * 
+ * @version $Rev$ $Date$
+ */
+public interface ScopedImplementationProvider extends ImplementationProvider {
+    /**
+     * Get the scope for the component implementation
+     * 
+     * @return The scope for the component implementation, if null is returned,
+     *         STATELESS will be used
+     */
+    Scope getScope();
+
+    /**
+     * Indicate if the component needs to be eagerly initialized
+     * 
+     * @param component The component
+     * @return true if the component is marked to be eagerly initialized, false
+     *         otherwise
+     */
+    boolean isEagerInit(RuntimeComponent component);
+
+    /**
+     * Create a wrapper for the component instance for the scope management
+     * 
+     * @param component The component
+     * @return A wrapper for the component instance
+     */
+    InstanceWrapper createInstanceWrapper(RuntimeComponent component);
+
+}

Propchange: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ScopedImplementationProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ScopedImplementationProvider.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ServiceBindingActivator.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ServiceBindingActivator.java?view=auto&rev=536080
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ServiceBindingActivator.java (added)
+++ incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ServiceBindingActivator.java Mon May  7 23:15:22 2007
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.provider;
+
+import org.apache.tuscany.core.RuntimeComponent;
+import org.apache.tuscany.core.RuntimeComponentService;
+
+
+/**
+ * A binding can optionally implement this interface to control how the service
+ * binding is started or stopped.
+ * 
+ * @version $Rev$ $Date$
+ */
+public interface ServiceBindingActivator {
+    /**
+     * This method will be invoked when a service binding is activated for the
+     * given component service.
+     * 
+     * @param component The SCA component
+     * @param service The service that owns the binding
+     */
+    void start(RuntimeComponent component, RuntimeComponentService service);
+
+    /**
+     * This method will be invoked when a service binding is deactivated or the
+     * given component service.
+     * 
+     * @param component The SCA component
+     * @param service The service that owns the binding
+     */
+    void stop(RuntimeComponent component, RuntimeComponentService service);
+}

Propchange: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ServiceBindingActivator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ServiceBindingActivator.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ServiceBindingProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ServiceBindingProvider.java?view=auto&rev=536080
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ServiceBindingProvider.java (added)
+++ incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ServiceBindingProvider.java Mon May  7 23:15:22 2007
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.provider;
+
+import org.apache.tuscany.core.RuntimeComponentService;
+import org.apache.tuscany.interfacedef.InterfaceContract;
+
+/**
+ * A service binding can optionally implement this interface
+ * 
+ * @version $Rev$ $Date$
+ */
+public interface ServiceBindingProvider extends ServiceBindingActivator {
+    /**
+     * Get the effective interface contract imposed by the binding. For example,
+     * it will be interface contract introspected from the WSDL portType used by
+     * the endpoint for a WebService binding.
+     * 
+     * @param service The component service that owns the service binding
+     * @return The effective interface contract, if null is returned, the interface contract
+     * for the component service will be used
+     */
+    InterfaceContract getBindingInterfaceContract(RuntimeComponentService service);
+}

Propchange: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ServiceBindingProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/provider/ServiceBindingProvider.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/DefaultCompositeActivator.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/DefaultCompositeActivator.java?view=diff&rev=536080&r1=536079&r2=536080
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/DefaultCompositeActivator.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/DefaultCompositeActivator.java Mon May  7 23:15:22 2007
@@ -31,18 +31,11 @@
 import org.apache.tuscany.assembly.builder.CompositeBuilderMonitor;
 import org.apache.tuscany.assembly.builder.Problem;
 import org.apache.tuscany.assembly.builder.impl.DefaultCompositeBuilder;
-import org.apache.tuscany.core.ImplementationActivator;
-import org.apache.tuscany.core.ImplementationProvider;
-import org.apache.tuscany.core.ReferenceBindingActivator;
-import org.apache.tuscany.core.ReferenceBindingProvider;
 import org.apache.tuscany.core.RuntimeComponent;
 import org.apache.tuscany.core.RuntimeComponentReference;
 import org.apache.tuscany.core.RuntimeComponentService;
 import org.apache.tuscany.core.RuntimeWire;
 import org.apache.tuscany.core.RuntimeWireProcessor;
-import org.apache.tuscany.core.ScopedImplementationProvider;
-import org.apache.tuscany.core.ServiceBindingActivator;
-import org.apache.tuscany.core.ServiceBindingProvider;
 import org.apache.tuscany.core.invocation.InvocationChainImpl;
 import org.apache.tuscany.core.invocation.NonBlockingInterceptor;
 import org.apache.tuscany.interfacedef.IncompatibleInterfaceContractException;
@@ -51,6 +44,15 @@
 import org.apache.tuscany.interfacedef.Operation;
 import org.apache.tuscany.invocation.InvocationChain;
 import org.apache.tuscany.invocation.Invoker;
+import org.apache.tuscany.provider.BindingProviderFactory;
+import org.apache.tuscany.provider.ImplementationActivator;
+import org.apache.tuscany.provider.ImplementationProvider;
+import org.apache.tuscany.provider.ImplementationProviderFactory;
+import org.apache.tuscany.provider.ReferenceBindingActivator;
+import org.apache.tuscany.provider.ReferenceBindingProvider;
+import org.apache.tuscany.provider.ScopedImplementationProvider;
+import org.apache.tuscany.provider.ServiceBindingActivator;
+import org.apache.tuscany.provider.ServiceBindingProvider;
 import org.apache.tuscany.scope.Scope;
 import org.apache.tuscany.scope.ScopeRegistry;
 import org.apache.tuscany.spi.component.WorkContext;
@@ -98,25 +100,32 @@
             
             for (ComponentService service : component.getServices()) {
                 for (Binding binding : service.getBindings()) {
-                    if (binding instanceof ServiceBindingActivator) {
-                        ServiceBindingActivator bindingActivator = (ServiceBindingActivator)binding;
-                        bindingActivator.start((RuntimeComponent)component, (RuntimeComponentService)service);
+                    if (binding instanceof BindingProviderFactory) {
+                        ServiceBindingActivator bindingActivator = ((BindingProviderFactory)binding).createServiceBindingProvider();
+                        if (bindingActivator != null) {
+                            bindingActivator.start((RuntimeComponent)component, (RuntimeComponentService)service);
+                        }
                     }
                 }
             }
             for (ComponentReference reference : component.getReferences()) {
                 for (Binding binding : reference.getBindings()) {
-                    if (binding instanceof ReferenceBindingActivator) {
-                        ReferenceBindingActivator bindingActivator = (ReferenceBindingActivator)binding;
-                        bindingActivator.start((RuntimeComponent)component, (RuntimeComponentReference)reference);
+                    if (binding instanceof BindingProviderFactory) {
+                        ReferenceBindingActivator bindingActivator = ((BindingProviderFactory)binding).createReferenceBindingProvider();
+                        if (bindingActivator != null) {
+                            bindingActivator.start((RuntimeComponent)component, (RuntimeComponentReference)reference);
+                        }
                     }
                 }
             }
             Implementation implementation = component.getImplementation();
             if (implementation instanceof Composite) {
                 startComposite((Composite)implementation);
-            } else if (implementation instanceof ImplementationActivator) {
-                ((ImplementationActivator)implementation).start((RuntimeComponent)component);
+            } else if (implementation instanceof ImplementationProviderFactory) {
+                ImplementationActivator implementationActivator = ((RuntimeComponent)component).getImplementationProvider();
+                if (implementationActivator != null) {
+                    implementationActivator.start((RuntimeComponent)component);
+                }
             }
 
             if (component instanceof RuntimeComponent) {
@@ -127,7 +136,6 @@
             }
             
         }
-
     }
 
     /**
@@ -142,8 +150,12 @@
             Implementation implementation = component.getImplementation();
             if (implementation instanceof Composite) {
                 configureComposite((Composite)implementation);
-            } else if (implementation instanceof ImplementationProvider) {
-                ((ImplementationProvider)implementation).configure((RuntimeComponent)component);
+            } else if (implementation instanceof ImplementationProviderFactory) {
+                ImplementationProvider implementationProvider = ((ImplementationProviderFactory)implementation).createImplementationProvider();
+                if (implementationProvider != null) {
+                    ((RuntimeComponent)component).setImplementationProvider(implementationProvider);
+                    implementationProvider.configure((RuntimeComponent)component);
+                }
                 setScopeContainer(component);
             }
         }
@@ -157,25 +169,32 @@
             
             for (ComponentService service : component.getServices()) {
                 for (Binding binding : service.getBindings()) {
-                    if (binding instanceof ServiceBindingActivator) {
-                        ServiceBindingActivator bindingActivator = (ServiceBindingActivator)binding;
-                        bindingActivator.stop((RuntimeComponent)component, (RuntimeComponentService)service);
+                    if (binding instanceof BindingProviderFactory) {
+                        ServiceBindingActivator bindingActivator = ((BindingProviderFactory)binding).createServiceBindingProvider();
+                        if (bindingActivator != null) {
+                            bindingActivator.stop((RuntimeComponent)component, (RuntimeComponentService)service);
+                        }
                     }
                 }
             }
             for (ComponentReference reference : component.getReferences()) {
                 for (Binding binding : reference.getBindings()) {
-                    if (binding instanceof ReferenceBindingActivator) {
-                        ReferenceBindingActivator bindingActivator = (ReferenceBindingActivator)binding;
-                        bindingActivator.stop((RuntimeComponent)component, (RuntimeComponentReference)reference);
+                    if (binding instanceof BindingProviderFactory) {
+                        ReferenceBindingActivator bindingActivator = ((BindingProviderFactory)binding).createReferenceBindingProvider();
+                        if (bindingActivator != null) {
+                            bindingActivator.stop((RuntimeComponent)component, (RuntimeComponentReference)reference);
+                        }
                     }
                 }
             }
             Implementation implementation = component.getImplementation();
             if (implementation instanceof Composite) {
-                stop((Composite)implementation);
-            } else if (implementation instanceof ImplementationActivator) {
-                ((ImplementationActivator)implementation).stop((RuntimeComponent)component);
+                startComposite((Composite)implementation);
+            } else if (implementation instanceof ImplementationProviderFactory) {
+                ImplementationActivator implementationActivator = ((RuntimeComponent)component).getImplementationProvider();
+                if (implementationActivator != null) {
+                    implementationActivator.stop((RuntimeComponent)component);
+                }
             }
 
             if (component instanceof RuntimeComponent) {
@@ -228,12 +247,14 @@
      */
     private InterfaceContract getInterfaceContract(ComponentReference reference, Binding binding) {
         InterfaceContract interfaceContract = reference.getInterfaceContract();
-        if (binding instanceof ReferenceBindingProvider) {
-            ReferenceBindingProvider provider = (ReferenceBindingProvider)binding;
-            InterfaceContract bindingContract = provider
-                .getBindingInterfaceContract((RuntimeComponentReference)reference);
-            if (bindingContract != null) {
-                interfaceContract = bindingContract;
+        if (binding instanceof BindingProviderFactory) {
+            ReferenceBindingProvider provider = ((BindingProviderFactory)binding).createReferenceBindingProvider();
+            if (provider != null) {
+                InterfaceContract bindingContract = provider
+                    .getBindingInterfaceContract((RuntimeComponentReference)reference);
+                if (bindingContract != null) {
+                    interfaceContract = bindingContract;
+                }
             }
         }
         return interfaceContract;
@@ -357,11 +378,13 @@
     private InterfaceContract getInterfaceContract(ComponentService service, Binding binding) {
         InterfaceContract interfaceContract = service.getInterfaceContract();
 
-        if (binding instanceof ServiceBindingProvider) {
-            ServiceBindingProvider provider = (ServiceBindingProvider)binding;
-            InterfaceContract bindingContract = provider.getBindingInterfaceContract((RuntimeComponentService)service);
-            if (bindingContract != null) {
-                interfaceContract = bindingContract;
+        if (binding instanceof BindingProviderFactory) {
+            ServiceBindingProvider provider = ((BindingProviderFactory)binding).createServiceBindingProvider();
+            if (provider != null) {
+                InterfaceContract bindingContract = provider.getBindingInterfaceContract((RuntimeComponentService)service);
+                if (bindingContract != null) {
+                    interfaceContract = bindingContract;
+                }
             }
         }
         return interfaceContract;
@@ -370,12 +393,14 @@
     private InterfaceContract getInterfaceContract(Component component, ComponentService service) {
         InterfaceContract interfaceContract = service.getInterfaceContract();
 
-        Implementation impl = component != null ? component.getImplementation() : null;
-        if (impl instanceof ImplementationProvider) {
-            InterfaceContract implContract = ((ImplementationProvider)impl)
-                .getImplementationInterfaceContract((RuntimeComponentService)service);
-            if (implContract != null) {
-                interfaceContract = implContract;
+        Implementation implementation = component != null ? component.getImplementation() : null;
+        if (implementation instanceof ImplementationProviderFactory) {
+            ImplementationProvider implementationProvider = ((RuntimeComponent)component).getImplementationProvider();
+            if (implementationProvider != null) {
+                InterfaceContract implementationContract = implementationProvider.getImplementationInterfaceContract((RuntimeComponentService)service);
+                if (implementationContract != null) {
+                    interfaceContract = implementationContract;
+                }
             }
         }
 
@@ -453,17 +478,20 @@
                                               InvocationChain chain,
                                               Operation operation,
                                               boolean isCallback) {
-        if (component.getImplementation() instanceof ImplementationProvider) {
-            ImplementationProvider provider = (ImplementationProvider)component.getImplementation();
-            Invoker invoker = null;
-            if (!isCallback) {
-                invoker = provider.createInvoker((RuntimeComponent)component,
-                                                         (RuntimeComponentService)service,
-                                                         operation);
-            } else {
-                invoker = provider.createCallbackInvoker((RuntimeComponent)component, operation);
+        Implementation implementation = component.getImplementation();
+        if (implementation instanceof ImplementationProviderFactory) {
+            ImplementationProvider provider = ((RuntimeComponent)component).getImplementationProvider();
+            if (provider != null) {
+                Invoker invoker = null;
+                if (!isCallback) {
+                    invoker = provider.createInvoker((RuntimeComponent)component,
+                                                             (RuntimeComponentService)service,
+                                                             operation);
+                } else {
+                    invoker = provider.createCallbackInvoker((RuntimeComponent)component, operation);
+                }
+                chain.addInvoker(invoker);
             }
-            chain.addInvoker(invoker);
         }
     }
 
@@ -483,14 +511,16 @@
                                       InvocationChain chain,
                                       Operation operation,
                                       boolean isCallback) {
-        if (binding instanceof ReferenceBindingProvider) {
-            ReferenceBindingProvider provider = (ReferenceBindingProvider)binding;
-            Invoker invoker = provider.createInvoker((RuntimeComponent)component,
-                                                                 (RuntimeComponentReference)reference,
-                                                                 operation,
-                                                                 isCallback);
-            if (invoker != null) {
-                chain.addInvoker(invoker);
+        if (binding instanceof BindingProviderFactory) {
+            ReferenceBindingProvider provider = ((BindingProviderFactory)binding).createReferenceBindingProvider();
+            if (provider != null) {
+                Invoker invoker = provider.createInvoker((RuntimeComponent)component,
+                                                                     (RuntimeComponentReference)reference,
+                                                                     operation,
+                                                                     isCallback);
+                if (invoker != null) {
+                    chain.addInvoker(invoker);
+                }
             }
         }
     }
@@ -502,9 +532,9 @@
      * @return
      */
     private Scope getScope(Component component) {
-        Implementation impl = component.getImplementation();
-        if (impl instanceof ScopedImplementationProvider) {
-            ScopedImplementationProvider provider = (ScopedImplementationProvider)impl;
+        ImplementationProvider implementationProvider = ((RuntimeComponent)component).getImplementationProvider();
+        if (implementationProvider instanceof ScopedImplementationProvider) {
+            ScopedImplementationProvider provider = (ScopedImplementationProvider)implementationProvider;
             Scope scope = provider.getScope();
             if (scope == null) {
                 return Scope.STATELESS;

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeComponentImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeComponentImpl.java?view=diff&rev=536080&r1=536079&r2=536080
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeComponentImpl.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeComponentImpl.java Mon May  7 23:15:22 2007
@@ -30,6 +30,7 @@
 import org.apache.tuscany.core.component.ServiceReferenceImpl;
 import org.apache.tuscany.core.invocation.WireObjectFactory;
 import org.apache.tuscany.invocation.ProxyFactory;
+import org.apache.tuscany.provider.ImplementationProvider;
 import org.apache.tuscany.scope.ScopeContainer;
 import org.osoa.sca.CallableReference;
 import org.osoa.sca.RequestContext;
@@ -40,7 +41,7 @@
  */
 public class RuntimeComponentImpl extends ComponentImpl implements RuntimeComponent {
     public static final String SELF_REFERENCE_PREFIX = "$self$.";
-    protected Object implementationConfiguration;
+    protected ImplementationProvider implementationProvider;
     protected ProxyFactory proxyService;
     protected ScopeContainer scopeContainer;
 
@@ -108,12 +109,12 @@
         return (R)ref;
     }
 
-    public Object getImplementationConfiguration() {
-        return implementationConfiguration;
+    public ImplementationProvider getImplementationProvider() {
+        return implementationProvider;
     }
 
-    public void setImplementationConfiguration(Object implementationConfiguration) {
-        this.implementationConfiguration = implementationConfiguration;
+    public void setImplementationProvider(ImplementationProvider provider) {
+        this.implementationProvider = provider;
     }
 
     public ScopeContainer getScopeContainer() {

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeSCABindingImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeSCABindingImpl.java?view=diff&rev=536080&r1=536079&r2=536080
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeSCABindingImpl.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeSCABindingImpl.java Mon May  7 23:15:22 2007
@@ -22,43 +22,33 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.tuscany.assembly.Binding;
-import org.apache.tuscany.assembly.Reference;
 import org.apache.tuscany.assembly.SCABinding;
 import org.apache.tuscany.assembly.impl.SCABindingImpl;
-import org.apache.tuscany.core.ReferenceBindingProvider;
-import org.apache.tuscany.core.RuntimeComponent;
-import org.apache.tuscany.core.RuntimeComponentReference;
 import org.apache.tuscany.core.RuntimeWire;
-import org.apache.tuscany.interfacedef.InterfaceContract;
-import org.apache.tuscany.interfacedef.Operation;
-import org.apache.tuscany.invocation.Interceptor;
+import org.apache.tuscany.provider.BindingProviderFactory;
+import org.apache.tuscany.provider.ReferenceBindingProvider;
+import org.apache.tuscany.provider.ServiceBindingProvider;
 
 /**
  * @version $Rev$ $Date$
  */
-public class RuntimeSCABindingImpl extends SCABindingImpl implements SCABinding, ReferenceBindingProvider {
+public class RuntimeSCABindingImpl extends SCABindingImpl implements SCABinding, BindingProviderFactory {
     private List<RuntimeWire> wires = new ArrayList<RuntimeWire>();
     
     public void addWire(RuntimeWire wire) {
         wires.add(wire);
     }
 
-    public Interceptor createInterceptor(Reference reference, Binding binding, Operation operation, boolean isCallback) {
-        return null;
-    }
-
-    public InterfaceContract getBindingInterfaceContract(RuntimeComponentReference reference) {
-        return reference.getInterfaceContract();
-    }
-
     public List<RuntimeWire> getWires() {
         return wires;
     }
 
-    public Interceptor createInvoker(RuntimeComponent component, RuntimeComponentReference reference, Operation operation, boolean isCallback) {
-        return null;
+    public ReferenceBindingProvider createReferenceBindingProvider() {
+        return new RuntimeSCABindingProvider();
     }
 
-
+    public ServiceBindingProvider createServiceBindingProvider() {
+        return null;
+    }
+    
 }

Added: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeSCABindingProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeSCABindingProvider.java?view=auto&rev=536080
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeSCABindingProvider.java (added)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeSCABindingProvider.java Mon May  7 23:15:22 2007
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.runtime;
+
+import org.apache.tuscany.assembly.SCABinding;
+import org.apache.tuscany.assembly.impl.SCABindingImpl;
+import org.apache.tuscany.core.RuntimeComponent;
+import org.apache.tuscany.core.RuntimeComponentReference;
+import org.apache.tuscany.interfacedef.InterfaceContract;
+import org.apache.tuscany.interfacedef.Operation;
+import org.apache.tuscany.invocation.Invoker;
+import org.apache.tuscany.provider.ReferenceBindingProvider;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class RuntimeSCABindingProvider extends SCABindingImpl implements SCABinding, ReferenceBindingProvider {
+    
+    public InterfaceContract getBindingInterfaceContract(RuntimeComponentReference reference) {
+        return reference.getInterfaceContract();
+    }
+
+    public Invoker createInvoker(RuntimeComponent component, RuntimeComponentReference reference, Operation operation, boolean isCallback) {
+        return null;
+    }
+
+    public void start(RuntimeComponent component, RuntimeComponentReference reference) {
+    }
+
+    public void stop(RuntimeComponent component, RuntimeComponentReference reference) {
+    }
+
+}

Propchange: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeSCABindingProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeSCABindingProvider.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/scope/AbstractScopeContainer.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/scope/AbstractScopeContainer.java?view=diff&rev=536080&r1=536079&r2=536080
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/scope/AbstractScopeContainer.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/scope/AbstractScopeContainer.java Mon May  7 23:15:22 2007
@@ -21,10 +21,10 @@
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
-import org.apache.tuscany.assembly.Implementation;
 import org.apache.tuscany.core.RuntimeComponent;
-import org.apache.tuscany.core.ScopedImplementationProvider;
 import org.apache.tuscany.event.Event;
+import org.apache.tuscany.provider.ImplementationProvider;
+import org.apache.tuscany.provider.ScopedImplementationProvider;
 import org.apache.tuscany.scope.InstanceWrapper;
 import org.apache.tuscany.scope.Scope;
 import org.apache.tuscany.scope.ScopeContainer;
@@ -66,9 +66,9 @@
      *             instance
      */
     protected InstanceWrapper createInstanceWrapper() throws TargetResolutionException {
-        Implementation impl = component.getImplementation();
-        if (impl instanceof ScopedImplementationProvider) {
-            return ((ScopedImplementationProvider)impl).createInstanceWrapper(component);
+        ImplementationProvider implementationProvider = component.getImplementationProvider();
+        if (implementationProvider instanceof ScopedImplementationProvider) {
+            return ((ScopedImplementationProvider)implementationProvider).createInstanceWrapper(component);
         }
         return null;
     }
@@ -89,9 +89,9 @@
     }
 
     protected boolean isEagerInit() {
-        Implementation impl = component.getImplementation();
-        if (impl instanceof ScopedImplementationProvider) {
-            return ((ScopedImplementationProvider)impl).isEagerInit(component);
+        ImplementationProvider implementationProvider = ((RuntimeComponent)component).getImplementationProvider();
+        if (implementationProvider instanceof ScopedImplementationProvider) {
+            return ((ScopedImplementationProvider)implementationProvider).isEagerInit(component);
         }
         return false;
     }

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/scope/ScopeRegistryImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/scope/ScopeRegistryImpl.java?view=diff&rev=536080&r1=536079&r2=536080
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/scope/ScopeRegistryImpl.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/scope/ScopeRegistryImpl.java Mon May  7 23:15:22 2007
@@ -21,9 +21,9 @@
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
-import org.apache.tuscany.assembly.Implementation;
 import org.apache.tuscany.core.RuntimeComponent;
-import org.apache.tuscany.core.ScopedImplementationProvider;
+import org.apache.tuscany.provider.ImplementationProvider;
+import org.apache.tuscany.provider.ScopedImplementationProvider;
 import org.apache.tuscany.scope.Scope;
 import org.apache.tuscany.scope.ScopeContainer;
 import org.apache.tuscany.scope.ScopeContainerFactory;
@@ -45,9 +45,9 @@
         if (component.getScopeContainer() != null) {
             return component.getScopeContainer();
         }
-        Implementation impl = component.getImplementation();
-        if (impl instanceof ScopedImplementationProvider) {
-            ScopedImplementationProvider provider = (ScopedImplementationProvider)impl;
+        ImplementationProvider implementationProvider = component.getImplementationProvider();
+        if (implementationProvider instanceof ScopedImplementationProvider) {
+            ScopedImplementationProvider provider = (ScopedImplementationProvider)implementationProvider;
             Scope scope = provider.getScope();
             if (scope == null) {
                 scope = Scope.STATELESS;

Modified: incubator/tuscany/java/sca/modules/core/src/test/java/org/apache/tuscany/core/scope/AbstractScopeContainerTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/test/java/org/apache/tuscany/core/scope/AbstractScopeContainerTestCase.java?view=diff&rev=536080&r1=536079&r2=536080
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/test/java/org/apache/tuscany/core/scope/AbstractScopeContainerTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/test/java/org/apache/tuscany/core/scope/AbstractScopeContainerTestCase.java Mon May  7 23:15:22 2007
@@ -24,7 +24,7 @@
 
 import org.apache.tuscany.assembly.Implementation;
 import org.apache.tuscany.core.RuntimeComponent;
-import org.apache.tuscany.core.ScopedImplementationProvider;
+import org.apache.tuscany.provider.ScopedImplementationProvider;
 import org.apache.tuscany.scope.InstanceWrapper;
 import org.apache.tuscany.scope.ScopeContainer;
 import org.easymock.EasyMock;

Modified: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/DefaultCRUDImplementationFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/DefaultCRUDImplementationFactory.java?view=diff&rev=536080&r1=536079&r2=536080
==============================================================================
--- incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/DefaultCRUDImplementationFactory.java (original)
+++ incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/DefaultCRUDImplementationFactory.java Mon May  7 23:15:22 2007
@@ -23,6 +23,8 @@
 import org.apache.tuscany.interfacedef.java.JavaInterfaceFactory;
 import org.apache.tuscany.interfacedef.java.introspect.JavaInterfaceIntrospector;
 
+import crud.provider.CRUDImplementationProviderFactory;
+
 /**
  * A default factory for the CRUD implementation model.
  *
@@ -43,7 +45,7 @@
     }
 
     public CRUDImplementation createCRUDImplementation() {
-        return new CRUDImplementationProvider(assemblyFactory, javaFactory, introspector);
+        return new CRUDImplementationProviderFactory(assemblyFactory, javaFactory, introspector);
     }
 
 }

Added: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/backend/ResourceManager.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/backend/ResourceManager.java?view=auto&rev=536080
==============================================================================
--- incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/backend/ResourceManager.java (added)
+++ incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/backend/ResourceManager.java Mon May  7 23:15:22 2007
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 crud.backend;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import crud.CRUD;
+
+/**
+ * A fake resource manager implementation used as a backend by the sample
+ * CRUD component implementation.
+ *  
+ * @version $Rev$ $Date$
+ */
+public class ResourceManager implements CRUD {
+    private static int counter;
+    private static final Map<String, Object> store = new HashMap<String, Object>();
+    private String directory;
+
+    /**
+     * Constructs a new resource manager.
+     * 
+     * @param directory the directory where to persist resources
+     */
+    public ResourceManager(String directory) {
+        super();
+        this.directory = directory;
+    }
+
+    /**
+     * Creates a new resource.
+     * 
+     * @param resource
+     * @return
+     */
+    public String createResource(Object resource) {
+        System.out.println("create(" + resource + ") in " + directory);
+        String key = String.valueOf(counter++);
+        store.put(key, resource);
+        return key;
+    }
+
+    /**
+     * Deletes a resource.
+     * 
+     * @param id
+     */
+    public void deleteResource(String id) {
+        System.out.println("delete(" + id + ")");
+        store.remove(id);
+    }
+
+    /**
+     * Retrieves a resource.
+     * 
+     * @param id
+     * @return
+     */
+    public Object retrieveResource(String id) {
+        System.out.println("retrieve(" + id + ")");
+        return store.get(id);
+    }
+
+    /**
+     * Updates a resource.
+     * 
+     * @param id
+     * @param resource
+     * @return
+     */
+    public Object updateResource(String id, Object resource) {
+        System.out.println("update(" + id + ")");
+        return store.put(id, resource);
+    }
+
+    //FIXME We shouldn't have to implement the CRUD interface here
+    
+    public String create(Object resource) {
+        return createResource(resource);
+    }
+    
+    public Object retrieve(String id) {
+        return retrieveResource(id);
+    }
+    
+    public Object update(String id, Object resource) {
+        return updateResource(id, resource);
+    }
+    
+    public void delete(String id) {
+        deleteResource(id);
+    }
+}

Propchange: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/backend/ResourceManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/backend/ResourceManager.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/impl/CRUDImplementationImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/impl/CRUDImplementationImpl.java?view=auto&rev=536080
==============================================================================
--- incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/impl/CRUDImplementationImpl.java (added)
+++ incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/impl/CRUDImplementationImpl.java Mon May  7 23:15:22 2007
@@ -0,0 +1,138 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 crud.impl;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.tuscany.assembly.AssemblyFactory;
+import org.apache.tuscany.assembly.ConstrainingType;
+import org.apache.tuscany.assembly.Property;
+import org.apache.tuscany.assembly.Reference;
+import org.apache.tuscany.assembly.Service;
+import org.apache.tuscany.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.interfacedef.java.JavaInterface;
+import org.apache.tuscany.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.interfacedef.java.introspect.JavaInterfaceIntrospector;
+import org.apache.tuscany.policy.Intent;
+import org.apache.tuscany.policy.PolicySet;
+
+import crud.CRUD;
+import crud.CRUDImplementation;
+
+/**
+ * The model representing a sample CRUD implementation in an SCA assembly model.
+ * 
+ * @version $$Rev$$ $$Date: 2007-04-23 19:18:54 -0700 (Mon, 23 Apr
+ *          2007) $$
+ */
+public class CRUDImplementationImpl implements CRUDImplementation {
+
+    private Service crudService;
+    private String directory;
+
+    /**
+     * Constructs a new CRUD implementation.
+     */
+    public CRUDImplementationImpl(AssemblyFactory assemblyFactory,
+                              JavaInterfaceFactory javaFactory,
+                              JavaInterfaceIntrospector introspector) {
+
+        // CRUD implementation always provide a single service exposing
+        // the CRUD interface, and have no references and properties
+        crudService = assemblyFactory.createService();
+        crudService.setName("CRUD");
+        JavaInterface javaInterface;
+        try {
+            javaInterface = introspector.introspect(CRUD.class);
+        } catch (InvalidInterfaceException e) {
+            throw new IllegalArgumentException(e);
+        }
+        JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
+        interfaceContract.setInterface(javaInterface);
+        crudService.setInterfaceContract(interfaceContract);
+    }
+
+    public String getDirectory() {
+        return directory;
+    }
+
+    public void setDirectory(String directory) {
+        this.directory = directory;
+    }
+
+    public ConstrainingType getConstrainingType() {
+        // The sample CRUD implementation does not support constrainingTypes
+        return null;
+    }
+
+    public List<Property> getProperties() {
+        // The sample CRUD implementation does not support properties
+        return Collections.emptyList();
+    }
+
+    public List<Service> getServices() {
+        // The sample CRUD implementation provides a single fixed CRUD service
+        return Collections.singletonList(crudService);
+    }
+    
+    public List<Reference> getReferences() {
+        // The sample CRUD implementation does not support properties
+        return Collections.emptyList();
+    }
+
+    public String getURI() {
+        // The sample CRUD implementation does not have a URI
+        return null;
+    }
+
+    public void setConstrainingType(ConstrainingType constrainingType) {
+        // The sample CRUD implementation does not support constrainingTypes
+    }
+
+    public void setURI(String uri) {
+        // The sample CRUD implementation does not have a URI
+    }
+
+    public List<PolicySet> getPolicySets() {
+        // The sample CRUD implementation does not support policy sets
+        return Collections.emptyList();
+    }
+
+    public List<Intent> getRequiredIntents() {
+        // The sample CRUD implementation does not support intents
+        return Collections.emptyList();
+    }
+
+    public List<Object> getExtensions() {
+        // The sample CRUD implementation does not support extensions
+        return Collections.emptyList();
+    }
+
+    public boolean isUnresolved() {
+        // The sample CRUD implementation is always resolved
+        return false;
+    }
+
+    public void setUnresolved(boolean unresolved) {
+        // The sample CRUD implementation is always resolved
+    }
+
+}

Propchange: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/impl/CRUDImplementationImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/impl/CRUDImplementationImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/impl/CRUDImplementationProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/impl/CRUDImplementationProcessor.java?view=auto&rev=536080
==============================================================================
--- incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/impl/CRUDImplementationProcessor.java (added)
+++ incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/impl/CRUDImplementationProcessor.java Mon May  7 23:15:22 2007
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 crud.impl;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.contribution.resolver.ModelResolver;
+import org.apache.tuscany.contribution.service.ContributionReadException;
+import org.apache.tuscany.contribution.service.ContributionResolveException;
+import org.apache.tuscany.contribution.service.ContributionWriteException;
+
+import crud.CRUDImplementation;
+import crud.CRUDImplementationFactory;
+
+/**
+ * Implements a STAX artifact processor for CRUD implementations.
+ * 
+ * The artifact processor is responsible for processing <implementation.crud>
+ * elements in SCA assembly XML composite files and populating the CRUD
+ * implementation model, resolving its references to other artifacts in the SCA
+ * contribution, and optionally write the model back to SCA assembly XML. 
+ *
+ * @version $Rev$ $Date$
+ */
+public class CRUDImplementationProcessor implements StAXArtifactProcessor<CRUDImplementation> {
+    private static final QName IMPLEMENTATION_CRUD = new QName("http://crud", "implementation.crud");
+    
+    private CRUDImplementationFactory crudFactory;
+    
+    public CRUDImplementationProcessor(CRUDImplementationFactory crudFactory) {
+        this.crudFactory = crudFactory;
+    }
+
+    public QName getArtifactType() {
+        // Returns the qname of the XML element processed by this processor
+        return IMPLEMENTATION_CRUD;
+    }
+
+    public Class<CRUDImplementation> getModelType() {
+        // Returns the type of model processed by this processor
+        return CRUDImplementation.class;
+    }
+
+    public CRUDImplementation read(XMLStreamReader reader) throws ContributionReadException {
+        assert IMPLEMENTATION_CRUD.equals(reader.getName());
+        
+        // Read an <implementation.crud> element
+        try {
+            // Read the directory attribute. This is where the sample
+            // CRUD implementation will persist resources.
+            String directory = reader.getAttributeValue(null, "directory");
+
+            // Create an initialize the CRUD implementation model
+            CRUDImplementation implementation = crudFactory.createCRUDImplementation();
+            implementation.setDirectory(directory);
+            
+            // Skip to end element
+            while (reader.hasNext()) {
+                if (reader.next() == END_ELEMENT && IMPLEMENTATION_CRUD.equals(reader.getName())) {
+                    break;
+                }
+            }
+            
+            return implementation;
+        } catch (XMLStreamException e) {
+            throw new ContributionReadException(e);
+        }
+    }
+
+    public void resolve(CRUDImplementation impl, ModelResolver resolver) throws ContributionResolveException {
+    }
+
+    public void write(CRUDImplementation model, XMLStreamWriter outputSource) throws ContributionWriteException {
+    }
+}

Propchange: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/impl/CRUDImplementationProcessor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/impl/CRUDImplementationProcessor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/module/CRUDModuleActivator.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/module/CRUDModuleActivator.java?view=auto&rev=536080
==============================================================================
--- incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/module/CRUDModuleActivator.java (added)
+++ incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/module/CRUDModuleActivator.java Mon May  7 23:15:22 2007
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 crud.module;
+
+import java.util.Map;
+
+import org.apache.tuscany.assembly.AssemblyFactory;
+import org.apache.tuscany.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.core.ExtensionPointRegistry;
+import org.apache.tuscany.core.ModuleActivator;
+import org.apache.tuscany.core.runtime.RuntimeAssemblyFactory;
+import org.apache.tuscany.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.interfacedef.java.introspect.ExtensibleJavaInterfaceIntrospector;
+import org.apache.tuscany.interfacedef.java.introspect.JavaInterfaceIntrospector;
+import org.apache.tuscany.interfacedef.java.introspect.JavaInterfaceIntrospectorExtensionPoint;
+import org.apache.tuscany.invocation.ProxyFactory;
+
+import crud.CRUDImplementationFactory;
+import crud.DefaultCRUDImplementationFactory;
+import crud.impl.CRUDImplementationProcessor;
+
+/**
+ * Implements a module activator for the CRUD implementation extension module.
+ * The module activator is responsible for contributing the CRUD implementation
+ * extensions and plugging them in the extension points defined by the Tuscany
+ * runtime.
+ * 
+ * @version $Rev$ $Date$
+ */
+public class CRUDModuleActivator implements ModuleActivator {
+
+    private CRUDImplementationProcessor implementationArtifactProcessor;
+
+    public Map<Class, Object> getExtensionPoints() {
+        // This module extension does not contribute any new
+        // extension point
+        return null;
+    }
+
+    public void start(ExtensionPointRegistry registry) {
+
+        ProxyFactory proxyFactory = registry.getExtensionPoint(ProxyFactory.class);
+        // Create the CRUD implementation factory
+        AssemblyFactory assemblyFactory = new RuntimeAssemblyFactory(proxyFactory);
+        JavaInterfaceFactory javaFactory = new DefaultJavaInterfaceFactory();
+        JavaInterfaceIntrospectorExtensionPoint visitors = registry.getExtensionPoint(JavaInterfaceIntrospectorExtensionPoint.class);
+        JavaInterfaceIntrospector introspector = new ExtensibleJavaInterfaceIntrospector(javaFactory, visitors);
+        CRUDImplementationFactory crudFactory = new DefaultCRUDImplementationFactory(assemblyFactory, javaFactory, introspector);
+
+        // Add the CRUD implementation extension to the StAXArtifactProcessor
+        // extension point
+        StAXArtifactProcessorExtensionPoint processors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+        implementationArtifactProcessor = new CRUDImplementationProcessor(crudFactory);
+        processors.addArtifactProcessor(implementationArtifactProcessor);
+    }
+
+    public void stop(ExtensionPointRegistry registry) {
+
+        // Remove the contributed extensions
+        StAXArtifactProcessorExtensionPoint processors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+        processors.removeArtifactProcessor(implementationArtifactProcessor);
+    }
+}

Propchange: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/module/CRUDModuleActivator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/module/CRUDModuleActivator.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org