You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by rf...@apache.org on 2007/05/03 02:21:28 UTC

svn commit: r534663 [1/2] - in /incubator/tuscany/java/sca: modules/core-spi/src/main/java/org/apache/tuscany/core/ modules/core-spi/src/main/java/org/apache/tuscany/scope/ modules/core-spi/src/main/java/org/apache/tuscany/spi/component/ modules/core/s...

Author: rfeng
Date: Wed May  2 17:21:26 2007
New Revision: 534663

URL: http://svn.apache.org/viewvc?view=rev&rev=534663
Log:
Bring up the java component with the extension SPIs, the calculator sample is running

Added:
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/core/ScopedImplementationProvider.java   (with props)
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/scope/
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/scope/ScopeContainer.java   (with props)
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/scope/ScopeRegistry.java   (with props)
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/scope/Scopeable.java
      - copied, changed from r534518, incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/spi/component/Scopeable.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/scope/
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/scope/AbstractScopeContainer.java
      - copied, changed from r534557, incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/component/scope/AbstractScopeContainer.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/scope/CompositeScopeContainer.java
      - copied, changed from r534557, incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/component/scope/CompositeScopeContainer.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/scope/HttpSessionScopeContainer.java
      - copied, changed from r534557, incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/component/scope/HttpSessionScopeContainer.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/scope/InstanceWrapperBase.java
      - copied, changed from r534557, incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/component/scope/InstanceWrapperBase.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/scope/RequestScopeContainer.java
      - copied, changed from r534557, incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/component/scope/RequestScopeContainer.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/scope/ScopeRegistryImpl.java
      - copied, changed from r534557, incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/component/scope/ScopeRegistryImpl.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/scope/StatelessScopeContainer.java
      - copied, changed from r534557, incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/component/scope/StatelessScopeContainer.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/implementation/java/invocation/CallbackWireObjectFactory.java
      - copied, changed from r534597, incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/implementation/java/injection/CallbackWireObjectFactory.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/implementation/java/invocation/JavaAtomicComponent.java
      - copied, changed from r534597, incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/implementation/java/context/JavaAtomicComponent.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/implementation/java/invocation/JavaTargetInvoker.java
      - copied, changed from r534597, incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/implementation/java/context/JavaTargetInvoker.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/implementation/java/invocation/PassByValueInvoker.java
      - copied, changed from r534597, incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/implementation/java/context/PassByValueInvoker.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/implementation/java/invocation/PojoAtomicComponent.java
      - copied, changed from r534597, incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/implementation/java/context/PojoAtomicComponent.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/implementation/java/invocation/PojoComponentContextFactory.java
      - copied, changed from r534597, incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/implementation/java/context/PojoComponentContextFactory.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/implementation/java/invocation/PojoConfiguration.java
      - copied, changed from r534597, incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/implementation/java/context/PojoConfiguration.java
    incubator/tuscany/java/sca/samples/binding-echo/src/main/java/echo/EchoBindingInterceptor.java
      - copied, changed from r534518, incubator/tuscany/java/sca/samples/binding-echo/src/main/java/echo/EchoInvoker.java
Removed:
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/spi/component/Scopeable.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/services/
    incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/CRUDComponentBuilder.java
    incubator/tuscany/java/sca/samples/binding-echo/src/main/java/echo/EchoBindingBuilder.java
    incubator/tuscany/java/sca/samples/binding-echo/src/main/java/echo/EchoInvoker.java
    incubator/tuscany/java/sca/samples/binding-echo/src/main/java/echo/EchoReference.java
    incubator/tuscany/java/sca/samples/implementation-crud/src/main/java/crud/CRUDAtomicComponent.java
    incubator/tuscany/java/sca/samples/implementation-crud/src/main/java/crud/CRUDComponentBuilder.java
Modified:
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/core/ImplementationProvider.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/builder/BuilderRegistryImpl.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/invocation/JDKInvocationHandler.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/RuntimeActivatorImpl.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeComponentImpl.java
    incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/SCARuntimeActivator.java
    incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/impl/DefaultSCARuntimeActivator.java
    incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/CRUDImplementation.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-java-runtime/src/main/java/org/apache/tuscany/implementation/java/module/JavaRuntimeModuleActivator.java
    incubator/tuscany/java/sca/samples/binding-echo/src/main/java/echo/EchoBindingImpl.java
    incubator/tuscany/java/sca/samples/binding-echo/src/main/java/echo/EchoModuleActivator.java
    incubator/tuscany/java/sca/samples/binding-echo/src/main/java/echo/EchoServer.java
    incubator/tuscany/java/sca/samples/binding-echo/src/test/java/echo/EchoReferenceTestCase.java
    incubator/tuscany/java/sca/samples/binding-echo/src/test/java/echo/EchoServiceTestCase.java
    incubator/tuscany/java/sca/samples/calculator/src/main/java/calculator/CalculatorClient.java
    incubator/tuscany/java/sca/samples/calculator/src/test/java/calculator/CalculatorTestCase.java
    incubator/tuscany/java/sca/samples/implementation-crud/src/main/java/crud/CRUDImplementation.java
    incubator/tuscany/java/sca/samples/implementation-crud/src/test/java/crud/CRUDTestCase.java

Modified: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/core/ImplementationProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/core/ImplementationProvider.java?view=diff&rev=534663&r1=534662&r2=534663
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/core/ImplementationProvider.java (original)
+++ incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/core/ImplementationProvider.java Wed May  2 17:21:26 2007
@@ -22,7 +22,6 @@
 import org.apache.tuscany.assembly.ComponentService;
 import org.apache.tuscany.interfacedef.InterfaceContract;
 import org.apache.tuscany.interfacedef.Operation;
-import org.apache.tuscany.spi.Scope;
 import org.apache.tuscany.spi.wire.Interceptor;
 
 /**
@@ -54,22 +53,7 @@
      * for the component service will be used
      */
     InterfaceContract getImplementationInterfaceContract(ComponentService service);
-
-    /**
-     * Get the scope for the component implementation
-     * @return The scope for the component implementation, if null is returned, STATELESS
-     * will be used
-     */
-    Scope getScope();
-    
-    /**
-     * Create a local instance to represent the component service
-     * @param component The component
-     * @param service The component service
-     * @return A new instance to represent the component service
-     */
-    Object createInstance(RuntimeComponent component, ComponentService service);
-    
+  
     /**
      * Configure the component by adding additional metadata for the component
      * @param component The runtime component

Added: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/core/ScopedImplementationProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/core/ScopedImplementationProvider.java?view=auto&rev=534663
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/core/ScopedImplementationProvider.java (added)
+++ incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/core/ScopedImplementationProvider.java Wed May  2 17:21:26 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.core;
+
+import org.apache.tuscany.spi.Scope;
+import org.apache.tuscany.spi.component.InstanceWrapper;
+
+/**
+ * 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/core/ScopedImplementationProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

Added: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/scope/ScopeContainer.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/scope/ScopeContainer.java?view=auto&rev=534663
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/scope/ScopeContainer.java (added)
+++ incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/scope/ScopeContainer.java Wed May  2 17:21:26 2007
@@ -0,0 +1,126 @@
+/*
+ * 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.scope;
+
+import java.net.URI;
+
+import org.apache.tuscany.core.RuntimeComponent;
+import org.apache.tuscany.spi.Lifecycle;
+import org.apache.tuscany.spi.Scope;
+import org.apache.tuscany.spi.component.GroupInitializationException;
+import org.apache.tuscany.spi.component.InstanceWrapper;
+import org.apache.tuscany.spi.component.PersistenceException;
+import org.apache.tuscany.spi.component.TargetDestructionException;
+import org.apache.tuscany.spi.component.TargetNotFoundException;
+import org.apache.tuscany.spi.component.TargetResolutionException;
+import org.apache.tuscany.spi.event.RuntimeEventListener;
+
+
+/**
+ * Manages the lifecycle and visibility of instances associated with a an {@link RuntimeComponent}.
+ *
+ * @version $Rev$ $Date$
+ * @param <KEY> the type of IDs that this container uses to identify its contexts.
+ * For example, for COMPOSITE scope this could be the URI of the composite component,
+ * or for HTTP Session scope it might be the HTTP session ID.
+ */
+public interface ScopeContainer<KEY> extends Lifecycle, RuntimeEventListener {
+
+    /**
+     * Returns the Scope that this container supports.
+     *
+     * @return the Scope that this container supports
+     */
+    Scope getScope();
+
+    /**
+     * Registers a component with the scope.
+     *
+     * @param component the component to register
+     * @param groupId the id of the group to associate this component with
+     */
+     void register(RuntimeComponent component, URI groupId);
+
+    /**
+     * Unregisters a component with the scope.
+     *
+     * @param component the component to unregister
+     */
+     void unregister(RuntimeComponent component);
+
+    /**
+     * Start a new context with the supplied ID.
+     *
+     * @param contextId an ID that uniquely identifies the context.
+     * @param groupId the group of components to associate with this context
+     * @throws GroupInitializationException if an exception was thrown by any eagerInit component
+     */
+    void startContext(KEY contextId, URI groupId) throws GroupInitializationException;
+
+    /**
+     * Stop the context with the supplied ID.
+     *
+     * @param contextId an ID that uniquely identifies the context.
+     */
+    void stopContext(KEY contextId);
+
+    /**
+     * Returns an instance wrapper associated with the current scope context, creating one if necessary
+     *
+     * @param  the type of the target instance
+     * @param component the component
+     * @param contextId the id for the scope context
+     * @return the wrapper for the target instance
+     * @throws TargetResolutionException if there was a problem instantiating the target instance
+     */
+     InstanceWrapper getWrapper(RuntimeComponent component, KEY contextId) throws TargetResolutionException;
+
+    /**
+     * Returns an implementation instance associated with the current scope context.
+     * If no instance is found, a {@link TargetNotFoundException} is thrown.
+     *
+     * @param  the type of the target instance
+     * @param component the component
+     * @param contextId the id for the scope context
+     * @return the wrapper for the target instance
+     * @throws TargetResolutionException if there was a problem instantiating the target instance
+     */
+     InstanceWrapper getAssociatedWrapper(RuntimeComponent component, KEY contextId)
+        throws TargetResolutionException;
+
+    /**
+     * Return a wrapper after use (for example, after invoking the instance).
+     *
+     * @param  the type of the target instance
+     * @param component the component
+     * @param contextId the id for the scope context
+     * @param wrapper the wrapper for the target instance being returned
+     * @throws TargetDestructionException if there was a problem returning the target instance
+     */
+     void returnWrapper(RuntimeComponent component, InstanceWrapper wrapper, KEY contextId)
+        throws TargetDestructionException;
+
+    /**
+     * Removes a component implementation instance associated with the current context from persistent storage
+     *
+     * @param component the owning component
+     * @throws PersistenceException if there was a problem removing the instance
+     */
+     void remove(RuntimeComponent component) throws PersistenceException;
+}

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

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

Added: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/scope/ScopeRegistry.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/scope/ScopeRegistry.java?view=auto&rev=534663
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/scope/ScopeRegistry.java (added)
+++ incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/scope/ScopeRegistry.java Wed May  2 17:21:26 2007
@@ -0,0 +1,42 @@
+/*
+ * 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.scope;
+
+import org.apache.tuscany.spi.Scope;
+
+/**
+ * Manages {@link ScopeContainer}s in the runtime
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public interface ScopeRegistry {
+
+    /**
+     * Returns the scope container for the given scope or null if one not found
+     *
+     * @param scope the scope
+     * @return the scope container for the given scope or null if one not found
+     */
+    ScopeContainer getScopeContainer(Scope scope);
+
+    /**
+     * @param container
+     */
+    void register(ScopeContainer container);
+}

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

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

Copied: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/scope/Scopeable.java (from r534518, incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/spi/component/Scopeable.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/scope/Scopeable.java?view=diff&rev=534663&p1=incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/spi/component/Scopeable.java&r1=534518&p2=incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/scope/Scopeable.java&r2=534663
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/spi/component/Scopeable.java (original)
+++ incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/scope/Scopeable.java Wed May  2 17:21:26 2007
@@ -17,7 +17,7 @@
  * under the License.    
  */
 
-package org.apache.tuscany.spi.component;
+package org.apache.tuscany.scope;
 
 import org.apache.tuscany.spi.Scope;
 

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/builder/BuilderRegistryImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/builder/BuilderRegistryImpl.java?view=diff&rev=534663&r1=534662&r2=534663
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/builder/BuilderRegistryImpl.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/builder/BuilderRegistryImpl.java Wed May  2 17:21:26 2007
@@ -35,6 +35,7 @@
 import org.apache.tuscany.core.implementation.composite.ReferenceImpl;
 import org.apache.tuscany.core.implementation.composite.ServiceImpl;
 import org.apache.tuscany.core.util.JavaIntrospectionHelper;
+import org.apache.tuscany.scope.Scopeable;
 import org.apache.tuscany.spi.Scope;
 import org.apache.tuscany.spi.builder.BindingBuilder;
 import org.apache.tuscany.spi.builder.BuilderException;
@@ -48,7 +49,6 @@
 import org.apache.tuscany.spi.component.SCAObject;
 import org.apache.tuscany.spi.component.ScopeContainer;
 import org.apache.tuscany.spi.component.ScopeRegistry;
-import org.apache.tuscany.spi.component.Scopeable;
 import org.apache.tuscany.spi.component.ServiceBinding;
 import org.apache.tuscany.spi.deployer.DeploymentContext;
 import org.osoa.sca.annotations.EagerInit;

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/invocation/JDKInvocationHandler.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/invocation/JDKInvocationHandler.java?view=diff&rev=534663&r1=534662&r2=534663
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/invocation/JDKInvocationHandler.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/invocation/JDKInvocationHandler.java Wed May  2 17:21:26 2007
@@ -66,7 +66,7 @@
             throw new IllegalArgumentException("No matching opeeration is found: " + method);
         }
 
-        return invokeTarget(chain, args, null, null);
+        return invoke(chain, null, args, null, null, workContext);
     }
 
     /**

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=534663&r1=534662&r2=534663
==============================================================================
--- 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 Wed May  2 17:21:26 2007
@@ -30,8 +30,10 @@
 import org.apache.tuscany.assembly.ComponentReference;
 import org.apache.tuscany.assembly.ComponentService;
 import org.apache.tuscany.assembly.Composite;
+import org.apache.tuscany.assembly.CompositeReference;
 import org.apache.tuscany.assembly.Implementation;
 import org.apache.tuscany.assembly.Multiplicity;
+import org.apache.tuscany.assembly.Reference;
 import org.apache.tuscany.assembly.SCABinding;
 import org.apache.tuscany.assembly.util.CompositeUtil;
 import org.apache.tuscany.assembly.util.PrintUtil;
@@ -42,6 +44,7 @@
 import org.apache.tuscany.core.RuntimeComponent;
 import org.apache.tuscany.core.RuntimeComponentReference;
 import org.apache.tuscany.core.RuntimeWire;
+import org.apache.tuscany.core.ScopedImplementationProvider;
 import org.apache.tuscany.core.ServiceBindingActivator;
 import org.apache.tuscany.core.component.WorkContextImpl;
 import org.apache.tuscany.core.util.JavaIntrospectionHelper;
@@ -110,16 +113,16 @@
 
             for (ComponentService service : component.getServices()) {
                 for (Binding binding : service.getBindings()) {
-                    if(binding instanceof ServiceBindingActivator) {
-                        ServiceBindingActivator bindingActivator = (ServiceBindingActivator) binding;
+                    if (binding instanceof ServiceBindingActivator) {
+                        ServiceBindingActivator bindingActivator = (ServiceBindingActivator)binding;
                         bindingActivator.start(component, service);
                     }
                 }
             }
             for (ComponentReference reference : component.getReferences()) {
                 for (Binding binding : reference.getBindings()) {
-                    if(binding instanceof ReferenceBindingActivator) {
-                        ReferenceBindingActivator bindingActivator = (ReferenceBindingActivator) binding;
+                    if (binding instanceof ReferenceBindingActivator) {
+                        ReferenceBindingActivator bindingActivator = (ReferenceBindingActivator)binding;
                         bindingActivator.start(component, reference);
                     }
                 }
@@ -127,8 +130,8 @@
             Implementation implementation = component.getImplementation();
             if (implementation instanceof Composite) {
                 start((Composite)implementation);
-            } else if(implementation instanceof ImplementationActivator) {
-                ((ImplementationActivator) implementation).start((RuntimeComponent) component); 
+            } else if (implementation instanceof ImplementationActivator) {
+                ((ImplementationActivator)implementation).start((RuntimeComponent)component);
             }
         }
 
@@ -140,29 +143,28 @@
             Implementation implementation = component.getImplementation();
             if (implementation instanceof Composite) {
                 configure((Composite)implementation);
-            } else if(implementation instanceof ImplementationProvider) {
-                ((ImplementationProvider) implementation).configure((RuntimeComponent) component); 
+            } else if (implementation instanceof ImplementationProvider) {
+                ((ImplementationProvider)implementation).configure((RuntimeComponent)component);
             }
         }
 
     }
-    
-    
+
     public void stop(Composite composite) {
         for (Component component : composite.getComponents()) {
 
             for (ComponentService service : component.getServices()) {
                 for (Binding binding : service.getBindings()) {
-                    if(binding instanceof ServiceBindingActivator) {
-                        ServiceBindingActivator bindingActivator = (ServiceBindingActivator) binding;
+                    if (binding instanceof ServiceBindingActivator) {
+                        ServiceBindingActivator bindingActivator = (ServiceBindingActivator)binding;
                         bindingActivator.stop(component, service);
                     }
                 }
             }
             for (ComponentReference reference : component.getReferences()) {
                 for (Binding binding : reference.getBindings()) {
-                    if(binding instanceof ReferenceBindingActivator) {
-                        ReferenceBindingActivator bindingActivator = (ReferenceBindingActivator) binding;
+                    if (binding instanceof ReferenceBindingActivator) {
+                        ReferenceBindingActivator bindingActivator = (ReferenceBindingActivator)binding;
                         bindingActivator.stop(component, reference);
                     }
                 }
@@ -170,12 +172,13 @@
             Implementation implementation = component.getImplementation();
             if (implementation instanceof Composite) {
                 start((Composite)implementation);
-            } else if(implementation instanceof ImplementationActivator) {
-                ((ImplementationActivator) implementation).stop((RuntimeComponent) component); 
+            } else if (implementation instanceof ImplementationActivator) {
+                ((ImplementationActivator)implementation).stop((RuntimeComponent)component);
             }
         }
 
-    }    
+    }
+
     public void createRuntimeWires(Composite composite) throws IncompatibleInterfaceContractException {
         for (Component component : composite.getComponents()) {
 
@@ -185,7 +188,9 @@
             } else {
                 // createSelfReferences(component);
                 for (ComponentReference reference : component.getReferences()) {
-                    for (Binding binding : reference.getBindings()) {
+                    // FIXME: ComponentReference.getBindings() should return the effective bindings
+//                    for (Binding binding : reference.getBindings()) {
+                for (Binding binding : getBindings(reference)) {
                         createWires(component, reference, binding);
                     }
                 }
@@ -206,6 +211,16 @@
             component.getReferences().add(ref);
         }
     }
+    
+    private List<Binding> getBindings(ComponentReference reference) {
+        List<CompositeReference> list = reference.promotedAs();
+        if(!list.isEmpty()) {
+            CompositeReference compositeReference = list.get(0);
+            return compositeReference.getBindings();
+        } else {
+            return reference.getBindings();
+        }
+    }
 
     private void createWires(Component component, ComponentReference reference, Binding binding) {
         if (!(binding instanceof ReferenceBindingProvider)) {
@@ -214,6 +229,38 @@
 
         RuntimeComponentReference wireSource = (RuntimeComponentReference)reference;
         ReferenceBindingProvider provider = (ReferenceBindingProvider)binding;
+
+        if (!(binding instanceof SCABinding)) {
+            RuntimeWire wire = new RuntimeWireImpl(reference, binding);
+
+            InterfaceContract sourceContract = provider.getBindingInterfaceContract(reference);
+            for (Operation operation : sourceContract.getInterface().getOperations()) {
+                Operation targetOperation = operation;
+                InvocationChain chain = new InvocationChainImpl(operation, targetOperation);
+                /* lresende */
+                if (operation.isNonBlocking()) {
+                    chain.addInterceptor(new NonBlockingInterceptor(workScheduler, workContext));
+                }
+
+                addBindingIntercepor(component, reference, binding, chain, operation, false);
+
+                wire.getInvocationChains().add(chain);
+            }
+            if (sourceContract.getCallbackInterface() != null) {
+                for (Operation operation : sourceContract.getCallbackInterface().getOperations()) {
+                    Operation targetOperation = operation;
+                    InvocationChain chain = new InvocationChainImpl(operation, targetOperation);
+                    /* lresende */
+                    if (operation.isNonBlocking()) {
+                        chain.addInterceptor(new NonBlockingInterceptor(workScheduler, workContext));
+                    }
+                    addBindingIntercepor(component, reference, binding, chain, operation, true);
+                    wire.getCallbackInvocationChains().add(chain);
+                }
+            }
+
+            wireSource.addRuntimeWire(wire);
+        }
         for (ComponentService service : reference.getTargets()) {
             // FIXME: Need a way to find the owning component of a component
             // service
@@ -293,8 +340,8 @@
 
     private Scope getScope(Component component) {
         Implementation impl = component.getImplementation();
-        if (impl instanceof ImplementationProvider) {
-            ImplementationProvider provider = (ImplementationProvider)impl;
+        if (impl instanceof ScopedImplementationProvider) {
+            ScopedImplementationProvider provider = (ScopedImplementationProvider)impl;
             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/RuntimeActivatorImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeActivatorImpl.java?view=diff&rev=534663&r1=534662&r2=534663
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeActivatorImpl.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/RuntimeActivatorImpl.java Wed May  2 17:21:26 2007
@@ -22,7 +22,6 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
-import java.net.URI;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -42,11 +41,12 @@
 import org.apache.tuscany.core.ModuleActivator;
 import org.apache.tuscany.core.builder.WirePostProcessorRegistryImpl;
 import org.apache.tuscany.core.component.WorkContextImpl;
-import org.apache.tuscany.core.component.scope.AbstractScopeContainer;
-import org.apache.tuscany.core.component.scope.CompositeScopeContainer;
-import org.apache.tuscany.core.component.scope.RequestScopeContainer;
-import org.apache.tuscany.core.component.scope.ScopeRegistryImpl;
-import org.apache.tuscany.core.component.scope.StatelessScopeContainer;
+import org.apache.tuscany.core.invocation.JDKProxyService;
+import org.apache.tuscany.core.scope.AbstractScopeContainer;
+import org.apache.tuscany.core.scope.CompositeScopeContainer;
+import org.apache.tuscany.core.scope.RequestScopeContainer;
+import org.apache.tuscany.core.scope.ScopeRegistryImpl;
+import org.apache.tuscany.core.scope.StatelessScopeContainer;
 import org.apache.tuscany.core.util.IOHelper;
 import org.apache.tuscany.core.work.Jsr237WorkScheduler;
 import org.apache.tuscany.core.work.ThreadPoolWorkManager;
@@ -54,9 +54,10 @@
 import org.apache.tuscany.interfacedef.IncompatibleInterfaceContractException;
 import org.apache.tuscany.interfacedef.InterfaceContractMapper;
 import org.apache.tuscany.interfacedef.impl.DefaultInterfaceContractMapper;
+import org.apache.tuscany.invocation.ProxyFactory;
 import org.apache.tuscany.policy.PolicyFactory;
 import org.apache.tuscany.policy.impl.DefaultPolicyFactory;
-import org.apache.tuscany.spi.component.ScopeRegistry;
+import org.apache.tuscany.scope.ScopeRegistry;
 import org.apache.tuscany.spi.component.WorkContext;
 import org.apache.tuscany.spi.component.WorkContextTunnel;
 import org.apache.tuscany.spi.services.work.WorkScheduler;
@@ -64,8 +65,6 @@
 import org.osoa.sca.ComponentContext;
 import org.osoa.sca.Constants;
 
-import commonj.work.WorkManager;
-
 /**
  * @version $Rev$ $Date$
  */
@@ -119,7 +118,10 @@
         // WorkContext workContext = new SimpleWorkContext();
         WorkContext workContext = new WorkContextImpl();
         extensionPointRegistry.addExtensionPoint(WorkContext.class, workContext);
+
         WorkContextTunnel.setThreadWorkContext(workContext);
+        
+        extensionPointRegistry.addExtensionPoint(ProxyFactory.class, new JDKProxyService(workContext, interfaceContractMapper));
 
         workManager = new ThreadPoolWorkManager(10);
         WorkScheduler workScheduler = new Jsr237WorkScheduler(workManager);
@@ -136,7 +138,15 @@
         domain.setName(new QName(Constants.SCA_NS, "sca.domain"));
         domain.setURI("sca://local/");
     }
+    
+    public <B> B locateService(Class<B> businessInterface, String componentName, String serviceName) {
+        return getComponentContext(componentName).createSelfReference(businessInterface, serviceName).getService();
+    }
 
+    public <B> B locateService(Class<B> businessInterface, String componentName) {
+        return getComponentContext(componentName).createSelfReference(businessInterface).getService();
+    }
+    
     public void start() throws ActivationException {
         activators = getInstances(hostClassLoader, ModuleActivator.class);
         for (ModuleActivator activator : activators) {

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=534663&r1=534662&r2=534663
==============================================================================
--- 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 Wed May  2 17:21:26 2007
@@ -28,6 +28,7 @@
 import org.apache.tuscany.core.RuntimeComponentReference;
 import org.apache.tuscany.core.RuntimeWire;
 import org.apache.tuscany.core.component.ServiceReferenceImpl;
+import org.apache.tuscany.core.component.WorkContextImpl;
 import org.apache.tuscany.core.invocation.JDKProxyService;
 import org.apache.tuscany.core.invocation.WireObjectFactory;
 import org.apache.tuscany.interfacedef.impl.DefaultInterfaceContractMapper;
@@ -73,7 +74,7 @@
             if (ref.getName().equals(referenceName)) {
                 RuntimeComponentReference attachPoint = (RuntimeComponentReference)ref;
                 RuntimeWire wire = attachPoint.getRuntimeWires().get(0);
-                return new JDKProxyService(null, new DefaultInterfaceContractMapper()).createProxy(businessInterface,
+                return new JDKProxyService(new WorkContextImpl(), new DefaultInterfaceContractMapper()).createProxy(businessInterface,
                                                                                                    wire);
             }
         }
@@ -87,7 +88,7 @@
                 && ref.getName().startsWith(referenceName)) {
                 RuntimeComponentReference attachPoint = (RuntimeComponentReference)ref;
                 RuntimeWire wire = attachPoint.getRuntimeWires().get(0);
-                JDKProxyService proxyService = new JDKProxyService(null, new DefaultInterfaceContractMapper());
+                JDKProxyService proxyService = new JDKProxyService(new WorkContextImpl(), new DefaultInterfaceContractMapper());
                 WireObjectFactory<B> factory = new WireObjectFactory<B>(businessInterface, wire, proxyService);
                 return new ServiceReferenceImpl<B>(businessInterface, factory);
             }

Copied: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/scope/AbstractScopeContainer.java (from r534557, incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/component/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=534663&p1=incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/component/scope/AbstractScopeContainer.java&r1=534557&p2=incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/scope/AbstractScopeContainer.java&r2=534663
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/component/scope/AbstractScopeContainer.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/scope/AbstractScopeContainer.java Wed May  2 17:21:26 2007
@@ -16,26 +16,25 @@
  * specific language governing permissions and limitations
  * under the License.    
  */
-package org.apache.tuscany.core.component.scope;
-
+package org.apache.tuscany.core.scope;
 
 import java.net.URI;
 import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
 import java.util.HashMap;
 import java.util.List;
 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.scope.ScopeContainer;
+import org.apache.tuscany.scope.ScopeRegistry;
 import org.apache.tuscany.spi.AbstractLifecycle;
 import org.apache.tuscany.spi.Scope;
-import org.apache.tuscany.spi.component.AtomicComponent;
 import org.apache.tuscany.spi.component.GroupInitializationException;
 import org.apache.tuscany.spi.component.InstanceWrapper;
 import org.apache.tuscany.spi.component.PersistenceException;
-import org.apache.tuscany.spi.component.ScopeContainer;
-import org.apache.tuscany.spi.component.ScopeRegistry;
 import org.apache.tuscany.spi.component.TargetDestructionException;
 import org.apache.tuscany.spi.component.TargetResolutionException;
 import org.apache.tuscany.spi.event.Event;
@@ -45,29 +44,20 @@
 
 /**
  * Implements functionality common to scope contexts.
- *
+ * 
  * @version $Rev$ $Date$
  */
-public abstract class AbstractScopeContainer<KEY> extends AbstractLifecycle
-    implements ScopeContainer<KEY> {
-
-    private static final Comparator<AtomicComponent<?>> COMPARATOR = new Comparator<AtomicComponent<?>>() {
-        public int compare(AtomicComponent<?> o1, AtomicComponent<?> o2) {
-            return o1.getInitLevel() - o2.getInitLevel();
-        }
-    };
+public abstract class AbstractScopeContainer<KEY> extends AbstractLifecycle implements ScopeContainer<KEY> {
 
-    protected final Map<AtomicComponent<?>, URI> componentGroups =
-        new ConcurrentHashMap<AtomicComponent<?>, URI>();
+    protected final Map<RuntimeComponent, URI> componentGroups = new ConcurrentHashMap<RuntimeComponent, URI>();
     protected final Map<KEY, URI> contextGroups = new ConcurrentHashMap<KEY, URI>();
 
-    // the queue of instanceWrappers to destroy, in the order that their instances were created
-    protected final Map<KEY, List<InstanceWrapper<?>>> destroyQueues =
-        new ConcurrentHashMap<KEY, List<InstanceWrapper<?>>>();
+    // the queue of instanceWrappers to destroy, in the order that their
+    // instances were created
+    protected final Map<KEY, List<InstanceWrapper<?>>> destroyQueues = new ConcurrentHashMap<KEY, List<InstanceWrapper<?>>>();
 
     // the queue of components to eagerly initialize in each group
-    protected final Map<URI, List<AtomicComponent<?>>> initQueues =
-        new HashMap<URI, List<AtomicComponent<?>>>();
+    protected final Map<URI, List<RuntimeComponent>> initQueues = new HashMap<URI, List<RuntimeComponent>>();
 
     private final Scope scope;
 
@@ -82,17 +72,23 @@
     }
 
     /**
-     * Creates a new physical instance of a component, wrapped in an InstanceWrapper.
-     *
+     * Creates a new physical instance of a component, wrapped in an
+     * InstanceWrapper.
+     * 
      * @param component the component whose instance should be created
      * @return a wrapped instance that has been injected but not yet started
-     * @throws TargetResolutionException if there was a problem creating the instance
+     * @throws TargetResolutionException if there was a problem creating the
+     *             instance
      */
-    protected <T> InstanceWrapper<T> createInstance(AtomicComponent<T> component) throws TargetResolutionException {
-        return component.createInstanceWrapper();
+    protected InstanceWrapper createInstance(RuntimeComponent component) throws TargetResolutionException {
+        Implementation impl = component.getImplementation();
+        if (impl instanceof ScopedImplementationProvider) {
+            return ((ScopedImplementationProvider)impl).createInstanceWrapper(component);
+        }
+        return null;
     }
 
-    public <T> InstanceWrapper<T> getAssociatedWrapper(AtomicComponent<T> component, KEY contextId)
+    public InstanceWrapper getAssociatedWrapper(RuntimeComponent component, KEY contextId)
         throws TargetResolutionException {
         return null;
     }
@@ -101,24 +97,24 @@
         return scope;
     }
 
-    public <T> InstanceWrapper<T> getWrapper(AtomicComponent<T> component, KEY contextId)
-        throws TargetResolutionException {
+    public InstanceWrapper getWrapper(RuntimeComponent component, KEY contextId) throws TargetResolutionException {
         return null;
     }
 
     /**
-     * Initialise an ordered list of components.
-     * The list is traversed in order and the getWrapper() method called for each to
-     * associate an instance with the supplied context.
-     *
-     * @param contextId  the contextId to associated with the component instances
+     * Initialise an ordered list of components. The list is traversed in order
+     * and the getWrapper() method called for each to associate an instance with
+     * the supplied context.
+     * 
+     * @param contextId the contextId to associated with the component instances
      * @param components the components to be initialized
-     * @throws GroupInitializationException if one or more components threw an exception during initialization
+     * @throws GroupInitializationException if one or more components threw an
+     *             exception during initialization
      */
-    protected void initializeComponents(KEY contextId, List<AtomicComponent<?>> components)
+    protected void initializeComponents(KEY contextId, List<RuntimeComponent> components)
         throws GroupInitializationException {
         List<Exception> causes = null;
-        for (AtomicComponent<?> component : components) {
+        for (RuntimeComponent component : components) {
             try {
                 getWrapper(component, contextId);
 
@@ -137,28 +133,36 @@
     public void onEvent(Event event) {
     }
 
-    public <T> void register(AtomicComponent<T> component, URI groupId) {
+    public void register(RuntimeComponent component, URI groupId) {
         checkInit();
-        if (component.isEagerInit()) {
+        if (isEagerInit(component)) {
             componentGroups.put(component, groupId);
             synchronized (initQueues) {
-                List<AtomicComponent<?>> initQueue = initQueues.get(groupId);
+                List<RuntimeComponent> initQueue = initQueues.get(groupId);
                 if (initQueue == null) {
-                    initQueue = new ArrayList<AtomicComponent<?>>();
+                    initQueue = new ArrayList<RuntimeComponent>();
                     initQueues.put(groupId, initQueue);
                 }
-                // FIXME it would be more efficient to binary search and then insert
+                // FIXME it would be more efficient to binary search and then
+                // insert
                 initQueue.add(component);
-                Collections.sort(initQueue, COMPARATOR);
             }
         }
     }
 
-    public <T> void remove(AtomicComponent<T> component) throws PersistenceException {
+    private boolean isEagerInit(RuntimeComponent component) {
+        Implementation impl = component.getImplementation();
+        if (impl instanceof ScopedImplementationProvider) {
+            return ((ScopedImplementationProvider)impl).isEagerInit(component);
+        }
+        return false;
+    }
+
+    public void remove(RuntimeComponent component) throws PersistenceException {
         throw new UnsupportedOperationException("Scope does not support persistence");
     }
 
-    public <T> void returnWrapper(AtomicComponent<T> component, InstanceWrapper<T> wrapper, KEY contextId)
+    public void returnWrapper(RuntimeComponent component, InstanceWrapper wrapper, KEY contextId)
         throws TargetDestructionException {
     }
 
@@ -168,10 +172,10 @@
     }
 
     /**
-     * Shut down an ordered list of instances.
-     * The list passed to this method is treated as a live, mutable list
-     * so any instances added to this list as shutdown is occuring will also be shut down.
-     *
+     * Shut down an ordered list of instances. The list passed to this method is
+     * treated as a live, mutable list so any instances added to this list as
+     * shutdown is occuring will also be shut down.
+     * 
      * @param instances the list of instances to shutdown
      */
     protected void shutdownComponents(List<InstanceWrapper<?>> instances) {
@@ -206,11 +210,11 @@
         destroyQueues.put(contextId, new ArrayList<InstanceWrapper<?>>());
 
         // get and clone initialization queue
-        List<AtomicComponent<?>> initQueue;
+        List<RuntimeComponent> initQueue;
         synchronized (initQueues) {
             initQueue = initQueues.get(groupId);
             if (initQueue != null) {
-                initQueue = new ArrayList<AtomicComponent<?>>(initQueue);
+                initQueue = new ArrayList<RuntimeComponent>(initQueue);
             }
         }
         if (initQueue != null) {
@@ -244,11 +248,11 @@
         return "In state [" + super.toString() + ']';
     }
 
-    public <T> void unregister(AtomicComponent<T> component) {
-        if (component.isEagerInit()) {
+    public void unregister(RuntimeComponent component) {
+        if (isEagerInit(component)) {
             URI groupId = componentGroups.remove(component);
             synchronized (initQueues) {
-                List<AtomicComponent<?>> initQueue = initQueues.get(groupId);
+                List<RuntimeComponent> initQueue = initQueues.get(groupId);
                 initQueue.remove(component);
                 if (initQueue.isEmpty()) {
                     initQueues.remove(groupId);

Copied: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/scope/CompositeScopeContainer.java (from r534557, incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/component/scope/CompositeScopeContainer.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/scope/CompositeScopeContainer.java?view=diff&rev=534663&p1=incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/component/scope/CompositeScopeContainer.java&r1=534557&p2=incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/scope/CompositeScopeContainer.java&r2=534663
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/component/scope/CompositeScopeContainer.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/scope/CompositeScopeContainer.java Wed May  2 17:21:26 2007
@@ -16,30 +16,25 @@
  * specific language governing permissions and limitations
  * under the License.    
  */
-package org.apache.tuscany.core.component.scope;
+package org.apache.tuscany.core.scope;
 
 import java.net.URI;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
+import org.apache.tuscany.core.RuntimeComponent;
 import org.apache.tuscany.spi.Scope;
-import org.apache.tuscany.spi.component.AtomicComponent;
 import org.apache.tuscany.spi.component.InstanceWrapper;
-import org.apache.tuscany.spi.component.ScopeContainer;
 import org.apache.tuscany.spi.component.TargetDestructionException;
 import org.apache.tuscany.spi.component.TargetInitializationException;
 import org.apache.tuscany.spi.component.TargetNotFoundException;
 import org.apache.tuscany.spi.component.TargetResolutionException;
-import org.osoa.sca.annotations.EagerInit;
-import org.osoa.sca.annotations.Service;
 
 /**
  * A scope context which manages atomic component instances keyed by composite
  *
  * @version $Rev$ $Date$
  */
-@EagerInit
-@Service(ScopeContainer.class)
 public class CompositeScopeContainer<KEY> extends AbstractScopeContainer<KEY> {
     private static final InstanceWrapper<Object> EMPTY = new InstanceWrapper<Object>() {
         public Object getInstance() {
@@ -60,19 +55,19 @@
     };
 
     // there is one instance per component so we can index directly
-    private final Map<AtomicComponent<?>, InstanceWrapper<?>> instanceWrappers =
-        new ConcurrentHashMap<AtomicComponent<?>, InstanceWrapper<?>>();
+    private final Map<RuntimeComponent, InstanceWrapper> instanceWrappers =
+        new ConcurrentHashMap<RuntimeComponent, InstanceWrapper>();
 
     public CompositeScopeContainer() {
         super(Scope.COMPOSITE);
     }
 
-    public <T> void register(AtomicComponent<T> component, URI groupId) {
+    public  void register(RuntimeComponent component, URI groupId) {
         super.register(component, groupId);
         instanceWrappers.put(component, EMPTY);
     }
 
-    public <T> void unregister(AtomicComponent<T> component) {
+    public  void unregister(RuntimeComponent component) {
         // FIXME should this component be destroyed already or do we need to stop it?
         instanceWrappers.remove(component);
         super.unregister(component);
@@ -83,11 +78,11 @@
         instanceWrappers.clear();
     }
 
-    public <T> InstanceWrapper<T> getWrapper(AtomicComponent<T> component, KEY contextId)
+    public  InstanceWrapper getWrapper(RuntimeComponent component, KEY contextId)
         throws TargetResolutionException {
         assert instanceWrappers.containsKey(component);
         @SuppressWarnings("unchecked")
-        InstanceWrapper<T> wrapper = (InstanceWrapper<T>) instanceWrappers.get(component);
+        InstanceWrapper wrapper = (InstanceWrapper) instanceWrappers.get(component);
         if (wrapper == EMPTY) {
             // FIXME is there a potential race condition here that may result in two instances being created
             wrapper = createInstance(component);
@@ -98,13 +93,13 @@
         return wrapper;
     }
 
-    public <T> InstanceWrapper<T> getAssociatedWrapper(AtomicComponent<T> component, KEY contextId)
+    public  InstanceWrapper getAssociatedWrapper(RuntimeComponent component, KEY contextId)
         throws TargetResolutionException {
         assert instanceWrappers.containsKey(component);
         @SuppressWarnings("unchecked")
-        InstanceWrapper<T> wrapper = (InstanceWrapper<T>) instanceWrappers.get(component);
+        InstanceWrapper wrapper = (InstanceWrapper) instanceWrappers.get(component);
         if (wrapper == EMPTY) {
-            throw new TargetNotFoundException(component.getUri().toString());
+            throw new TargetNotFoundException(component.getURI());
         }
         return wrapper;
     }

Copied: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/scope/HttpSessionScopeContainer.java (from r534557, incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/component/scope/HttpSessionScopeContainer.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/scope/HttpSessionScopeContainer.java?view=diff&rev=534663&p1=incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/component/scope/HttpSessionScopeContainer.java&r1=534557&p2=incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/scope/HttpSessionScopeContainer.java&r2=534663
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/component/scope/HttpSessionScopeContainer.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/scope/HttpSessionScopeContainer.java Wed May  2 17:21:26 2007
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.    
  */
-package org.apache.tuscany.core.component.scope;
+package org.apache.tuscany.core.scope;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -24,9 +24,9 @@
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
+import org.apache.tuscany.core.RuntimeComponent;
 import org.apache.tuscany.core.component.event.HttpSessionEnd;
 import org.apache.tuscany.spi.Scope;
-import org.apache.tuscany.spi.component.AtomicComponent;
 import org.apache.tuscany.spi.component.InstanceWrapper;
 import org.apache.tuscany.spi.component.TargetDestructionException;
 import org.apache.tuscany.spi.component.TargetResolutionException;
@@ -40,13 +40,13 @@
  */
 public class HttpSessionScopeContainer extends AbstractScopeContainer {
     private final WorkContext workContext;
-    private final Map<AtomicComponent, Map<Object, InstanceWrapper>> contexts;
+    private final Map<RuntimeComponent, Map<Object, InstanceWrapper>> contexts;
     private final Map<Object, List<InstanceWrapper>> destroyQueues;
 
     public HttpSessionScopeContainer(WorkContext workContext) {
         super(Scope.SESSION);
         this.workContext = workContext;
-        contexts = new ConcurrentHashMap<AtomicComponent, Map<Object, InstanceWrapper>>();
+        contexts = new ConcurrentHashMap<RuntimeComponent, Map<Object, InstanceWrapper>>();
         destroyQueues = new ConcurrentHashMap<Object, List<InstanceWrapper>>();
     }
 
@@ -74,26 +74,26 @@
         lifecycleState = STOPPED;
     }
 
-    public void register(AtomicComponent component, Object groupId) {
+    public void register(RuntimeComponent component, Object groupId) {
         contexts.put(component, new ConcurrentHashMap<Object, InstanceWrapper>());
-        component.addListener(this);
+//        component.addListener(this);
     }
 
-    public void unregister(AtomicComponent component) {
+    public void unregister(RuntimeComponent component) {
         // FIXME should all the instances associated with this component be destroyed already
         contexts.remove(component);
-        component.removeListener(this);
+//        component.removeListener(this);
         super.unregister(component);
     }
 
-    protected InstanceWrapper getInstanceWrapper(AtomicComponent component, boolean create)
+    protected InstanceWrapper getInstanceWrapper(RuntimeComponent component, boolean create)
         throws TargetResolutionException {
         Object key = workContext.getIdentifier(Scope.SESSION);
         assert key != null : "HTTP session key not bound in work context";
         return getInstance(component, key, create);
     }
 
-    private InstanceWrapper getInstance(AtomicComponent component, Object key, boolean create)
+    private InstanceWrapper getInstance(RuntimeComponent component, Object key, boolean create)
         throws TargetResolutionException {
         Map<Object, InstanceWrapper> wrappers = contexts.get(component);
         InstanceWrapper ctx = wrappers.get(key);
@@ -101,7 +101,7 @@
             return null;
         }
         if (ctx == null) {
-            ctx = component.createInstanceWrapper();
+            ctx = super.createInstance(component);
             ctx.start();
             wrappers.put(key, ctx);
             List<InstanceWrapper> destroyQueue = destroyQueues.get(key);

Copied: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/scope/InstanceWrapperBase.java (from r534557, incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/component/scope/InstanceWrapperBase.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/scope/InstanceWrapperBase.java?view=diff&rev=534663&p1=incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/component/scope/InstanceWrapperBase.java&r1=534557&p2=incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/scope/InstanceWrapperBase.java&r2=534663
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/component/scope/InstanceWrapperBase.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/scope/InstanceWrapperBase.java Wed May  2 17:21:26 2007
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.    
  */
-package org.apache.tuscany.core.component.scope;
+package org.apache.tuscany.core.scope;
 
 import org.apache.tuscany.spi.component.TargetDestructionException;
 import org.apache.tuscany.spi.component.TargetInitializationException;

Copied: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/scope/RequestScopeContainer.java (from r534557, incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/component/scope/RequestScopeContainer.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/scope/RequestScopeContainer.java?view=diff&rev=534663&p1=incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/component/scope/RequestScopeContainer.java&r1=534557&p2=incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/scope/RequestScopeContainer.java&r2=534663
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/component/scope/RequestScopeContainer.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/scope/RequestScopeContainer.java Wed May  2 17:21:26 2007
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.    
  */
-package org.apache.tuscany.core.component.scope;
+package org.apache.tuscany.core.scope;
 
 import java.net.URI;
 import java.util.ArrayList;
@@ -25,9 +25,9 @@
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
+import org.apache.tuscany.core.RuntimeComponent;
 import org.apache.tuscany.core.component.event.RequestEnd;
 import org.apache.tuscany.spi.Scope;
-import org.apache.tuscany.spi.component.AtomicComponent;
 import org.apache.tuscany.spi.component.InstanceWrapper;
 import org.apache.tuscany.spi.component.TargetDestructionException;
 import org.apache.tuscany.spi.component.TargetResolutionException;
@@ -39,12 +39,12 @@
  * @version $Rev$ $Date$
  */
 public class RequestScopeContainer extends AbstractScopeContainer {
-    private final Map<AtomicComponent, Map<Thread, InstanceWrapper>> contexts;
+    private final Map<RuntimeComponent, Map<Thread, InstanceWrapper>> contexts;
     private final Map<Thread, List<InstanceWrapper>> destroyQueues;
 
     public RequestScopeContainer() {
         super(Scope.REQUEST);
-        contexts = new ConcurrentHashMap<AtomicComponent, Map<Thread, InstanceWrapper>>();
+        contexts = new ConcurrentHashMap<RuntimeComponent, Map<Thread, InstanceWrapper>>();
         destroyQueues = new ConcurrentHashMap<Thread, List<InstanceWrapper>>();
     }
 
@@ -70,18 +70,18 @@
         lifecycleState = STOPPED;
     }
 
-    public void register(AtomicComponent component, URI groupId) {
+    public void register(RuntimeComponent component, URI groupId) {
         super.register(component, groupId);
         contexts.put(component, new ConcurrentHashMap<Thread, InstanceWrapper>());
     }
 
-    public void unregister(AtomicComponent component) {
+    public void unregister(RuntimeComponent component) {
         // FIXME should all the instances associated with this component be destroyed already
         contexts.remove(component);
         super.unregister(component);
     }
 
-    protected InstanceWrapper getInstanceWrapper(AtomicComponent component, boolean create)
+    protected InstanceWrapper getInstanceWrapper(RuntimeComponent component, boolean create)
         throws TargetResolutionException {
         Map<Thread, InstanceWrapper> instanceContextMap = contexts.get(component);
         assert instanceContextMap != null : "Atomic component not registered";
@@ -90,7 +90,7 @@
             return null;
         }
         if (ctx == null) {
-            ctx = component.createInstanceWrapper();
+            ctx = super.createInstance(component);
             ctx.start();
             instanceContextMap.put(Thread.currentThread(), ctx);
             List<InstanceWrapper> destroyQueue = destroyQueues.get(Thread.currentThread());

Copied: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/scope/ScopeRegistryImpl.java (from r534557, incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/component/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=534663&p1=incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/component/scope/ScopeRegistryImpl.java&r1=534557&p2=incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/scope/ScopeRegistryImpl.java&r2=534663
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/component/scope/ScopeRegistryImpl.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/scope/ScopeRegistryImpl.java Wed May  2 17:21:26 2007
@@ -16,15 +16,15 @@
  * specific language governing permissions and limitations
  * under the License.    
  */
-package org.apache.tuscany.core.component.scope;
+package org.apache.tuscany.core.scope;
 
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
+import org.apache.tuscany.scope.ScopeContainer;
+import org.apache.tuscany.scope.ScopeRegistry;
 import org.apache.tuscany.spi.ObjectFactory;
 import org.apache.tuscany.spi.Scope;
-import org.apache.tuscany.spi.component.ScopeContainer;
-import org.apache.tuscany.spi.component.ScopeRegistry;
 
 /**
  * The default implementation of a scope registry

Copied: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/scope/StatelessScopeContainer.java (from r534557, incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/component/scope/StatelessScopeContainer.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/scope/StatelessScopeContainer.java?view=diff&rev=534663&p1=incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/component/scope/StatelessScopeContainer.java&r1=534557&p2=incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/scope/StatelessScopeContainer.java&r2=534663
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/component/scope/StatelessScopeContainer.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/scope/StatelessScopeContainer.java Wed May  2 17:21:26 2007
@@ -16,43 +16,38 @@
  * specific language governing permissions and limitations
  * under the License.    
  */
-package org.apache.tuscany.core.component.scope;
+package org.apache.tuscany.core.scope;
 
+import org.apache.tuscany.core.RuntimeComponent;
 import org.apache.tuscany.spi.Scope;
-import org.apache.tuscany.spi.component.AtomicComponent;
 import org.apache.tuscany.spi.component.InstanceWrapper;
-import org.apache.tuscany.spi.component.ScopeContainer;
 import org.apache.tuscany.spi.component.TargetDestructionException;
 import org.apache.tuscany.spi.component.TargetResolutionException;
-import org.osoa.sca.annotations.EagerInit;
-import org.osoa.sca.annotations.Service;
 
 /**
  * A scope context which manages stateless atomic component instances in a non-pooled fashion.
  *
  * @version $Rev$ $Date$
  */
-@EagerInit
-@Service(ScopeContainer.class)
 public class StatelessScopeContainer<KEY> extends AbstractScopeContainer<KEY> {
 
     public StatelessScopeContainer() {
         super(Scope.STATELESS);
     }
 
-    public <T> InstanceWrapper<T> getWrapper(AtomicComponent<T> component, KEY contextId)
+    public  InstanceWrapper getWrapper(RuntimeComponent component, KEY contextId)
         throws TargetResolutionException {
-        InstanceWrapper<T> ctx = createInstance(component);
+        InstanceWrapper ctx = createInstance(component);
         ctx.start();
         return ctx;
     }
 
-    public <T> InstanceWrapper<T> getAssociatedWrapper(AtomicComponent<T> component, KEY contextId)
+    public  InstanceWrapper getAssociatedWrapper(RuntimeComponent component, KEY contextId)
         throws TargetResolutionException {
         throw new UnsupportedOperationException();
     }
 
-    public <T> void returnWrapper(AtomicComponent<T> component, InstanceWrapper<T> wrapper, KEY contextId)
+    public  void returnWrapper(RuntimeComponent component, InstanceWrapper wrapper, KEY contextId)
         throws TargetDestructionException {
         wrapper.stop();
     }

Modified: incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/SCARuntimeActivator.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/SCARuntimeActivator.java?view=diff&rev=534663&r1=534662&r2=534663
==============================================================================
--- incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/SCARuntimeActivator.java (original)
+++ incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/SCARuntimeActivator.java Wed May  2 17:21:26 2007
@@ -27,7 +27,6 @@
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 
-import org.apache.tuscany.host.embedded.impl.DefaultSCARuntime;
 import org.apache.tuscany.host.embedded.impl.DefaultSCARuntimeActivator;
 import org.osoa.sca.ComponentContext;
 
@@ -76,8 +75,8 @@
      * of the implementation class. Otherwise, if the resource
      * "META-INF/services/org.apache.tuscany.api.SCARuntime" can be loaded from
      * the supplied classloader. Otherwise, it will use
-     * "org.apache.tuscany.host.embedded.DefaultSCARuntime" as the default.
-     * The named class is loaded from the supplied classloader and instantiated
+     * "org.apache.tuscany.host.embedded.DefaultSCARuntime" as the default. The
+     * named class is loaded from the supplied classloader and instantiated
      * using its default (no-arg) constructor.
      * 
      * @return
@@ -181,6 +180,14 @@
         }
     }
 
+    public static <B> B locateService(Class<B> businessInterface, String componentName, String serviceName) {
+        return getInstance().locate(businessInterface, componentName, serviceName);
+    }
+
+    public static <B> B locateService(Class<B> businessInterface, String componentName) {
+        return getInstance().locate(businessInterface, componentName);
+    }
+
     /**
      * Look up the ComponentContext by name
      * 
@@ -197,8 +204,7 @@
      *            the application URL
      * @throws Exception
      */
-    protected abstract void startup(URL application, String compositePath)
-        throws Exception;
+    protected abstract void startup(URL application, String compositePath) throws Exception;
 
     /**
      * Shutdown the runtime
@@ -206,4 +212,8 @@
      * @throws Exception
      */
     protected abstract void shutdown() throws Exception;
+
+    protected abstract <B> B locate(Class<B> businessInterface, String componentName, String serviceName);
+
+    protected abstract <B> B locate(Class<B> businessInterface, String componentName);
 }

Modified: incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/impl/DefaultSCARuntimeActivator.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/impl/DefaultSCARuntimeActivator.java?view=diff&rev=534663&r1=534662&r2=534663
==============================================================================
--- incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/impl/DefaultSCARuntimeActivator.java (original)
+++ incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/impl/DefaultSCARuntimeActivator.java Wed May  2 17:21:26 2007
@@ -57,4 +57,16 @@
         return runtime.getComponentContext(componentName);
     }
 
+    protected <B> B locate(Class<B> businessInterface, String componentName, String serviceName) {
+        if (serviceName != null) {
+            return runtime.locateService(businessInterface, componentName, serviceName);
+        } else {
+            return locate(businessInterface, componentName);
+        }
+    }
+
+    protected <B> B locate(Class<B> businessInterface, String componentName) {
+        return runtime.locateService(businessInterface, componentName);
+    }
+
 }

Modified: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/CRUDImplementation.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/CRUDImplementation.java?view=diff&rev=534663&r1=534662&r2=534663
==============================================================================
--- incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/CRUDImplementation.java (original)
+++ incubator/tuscany/java/sca/modules/host-embedded/src/test/java/crud/CRUDImplementation.java Wed May  2 17:21:26 2007
@@ -40,7 +40,6 @@
 import org.apache.tuscany.interfacedef.java.introspect.JavaInterfaceIntrospector;
 import org.apache.tuscany.policy.Intent;
 import org.apache.tuscany.policy.PolicySet;
-import org.apache.tuscany.spi.Scope;
 import org.apache.tuscany.spi.wire.Interceptor;
 
 /**
@@ -170,10 +169,6 @@
         return service.getInterfaceContract();
     }
 
-    public Scope getScope() {
-        return null;
-    }
-
     public void start(RuntimeComponent component) {
         System.out.println("Starting " + component.getName());
     }
@@ -184,10 +179,6 @@
 
     public void configure(RuntimeComponent component) {
         System.out.println("Configuring " + component.getName());
-    }
-
-    public Object createInstance(RuntimeComponent component, ComponentService service) {
-        return null;
     }
 
 }

Copied: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/implementation/java/invocation/CallbackWireObjectFactory.java (from r534597, incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/implementation/java/injection/CallbackWireObjectFactory.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/implementation/java/invocation/CallbackWireObjectFactory.java?view=diff&rev=534663&p1=incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/implementation/java/injection/CallbackWireObjectFactory.java&r1=534597&p2=incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/implementation/java/invocation/CallbackWireObjectFactory.java&r2=534663
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/implementation/java/injection/CallbackWireObjectFactory.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/implementation/java/invocation/CallbackWireObjectFactory.java Wed May  2 17:21:26 2007
@@ -16,14 +16,14 @@
  * specific language governing permissions and limitations
  * under the License.    
  */
-package org.apache.tuscany.implementation.java.injection;
+package org.apache.tuscany.implementation.java.invocation;
 
 import java.util.List;
 
+import org.apache.tuscany.core.RuntimeWire;
+import org.apache.tuscany.invocation.ProxyFactory;
 import org.apache.tuscany.spi.ObjectCreationException;
 import org.apache.tuscany.spi.ObjectFactory;
-import org.apache.tuscany.spi.wire.Wire;
-import org.apache.tuscany.spi.wire.ProxyService;
 
 /**
  * Returns proxy instance for a wire callback
@@ -31,18 +31,18 @@
  * @version $Rev$ $Date$
  */
 public class CallbackWireObjectFactory implements ObjectFactory {
-    private ProxyService proxyService;
+    private ProxyFactory proxyFactory;
     private Class<?> interfaze;
-    private List<Wire> wires;
+    private List<RuntimeWire> wires;
 
-    public CallbackWireObjectFactory(Class<?> interfaze, ProxyService proxyService, List<Wire> wires) {
+    public CallbackWireObjectFactory(Class<?> interfaze, ProxyFactory proxyService, List<RuntimeWire> wires) {
         this.interfaze = interfaze;
-        this.proxyService = proxyService;
+        this.proxyFactory = proxyService;
         this.wires = wires;
     }
 
     public Object getInstance() throws ObjectCreationException {
-        return proxyService.createCallbackProxy(interfaze, wires);
+        return proxyFactory.createCallbackProxy(interfaze, wires);
     }
 
 }

Copied: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/implementation/java/invocation/JavaAtomicComponent.java (from r534597, incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/implementation/java/context/JavaAtomicComponent.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/implementation/java/invocation/JavaAtomicComponent.java?view=diff&rev=534663&p1=incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/implementation/java/context/JavaAtomicComponent.java&r1=534597&p2=incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/implementation/java/invocation/JavaAtomicComponent.java&r2=534663
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/implementation/java/context/JavaAtomicComponent.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/implementation/java/invocation/JavaAtomicComponent.java Wed May  2 17:21:26 2007
@@ -16,20 +16,22 @@
  * specific language governing permissions and limitations
  * under the License.    
  */
-package org.apache.tuscany.implementation.java.context;
+package org.apache.tuscany.implementation.java.invocation;
 
 import java.lang.reflect.Method;
 
 import org.apache.tuscany.assembly.ComponentProperty;
-import org.apache.tuscany.core.wire.WireObjectFactory;
+import org.apache.tuscany.core.RuntimeComponent;
+import org.apache.tuscany.core.RuntimeWire;
 import org.apache.tuscany.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.implementation.java.context.JavaPropertyValueObjectFactory;
+import org.apache.tuscany.implementation.java.context.TargetMethodNotFoundException;
 import org.apache.tuscany.interfacedef.Operation;
 import org.apache.tuscany.interfacedef.java.JavaInterface;
 import org.apache.tuscany.interfacedef.java.impl.JavaInterfaceUtil;
 import org.apache.tuscany.spi.ObjectFactory;
 import org.apache.tuscany.spi.component.TargetInvokerCreationException;
 import org.apache.tuscany.spi.wire.TargetInvoker;
-import org.apache.tuscany.spi.wire.Wire;
 
 /**
  * The runtime instantiation of Java component implementations
@@ -40,8 +42,8 @@
     private JavaPropertyValueObjectFactory propertyValueFactory;
     private DataBindingExtensionPoint dataBindingRegistry;
 
-    public JavaAtomicComponent(PojoConfiguration configuration) {
-        super(configuration);
+    public JavaAtomicComponent(RuntimeComponent component, PojoConfiguration configuration) {
+        super(component, configuration);
     }
 
     public TargetInvoker createTargetInvoker(String targetName, Operation operation, boolean isCallback)
@@ -58,9 +60,9 @@
             boolean passByValue = operation.getInterface().isRemotable() && (!configuration.getDefinition()
                                       .isAllowsPassByReference(method));
 
-            TargetInvoker invoker = new JavaTargetInvoker(method, this, scopeContainer);
+            TargetInvoker invoker = new JavaTargetInvoker(method, component, scopeContainer);
             if (passByValue) {
-                return new PassByValueInvoker(dataBindingRegistry, operation, method, this, scopeContainer);
+                return new PassByValueInvoker(dataBindingRegistry, operation, method, component, scopeContainer);
             } else {
                 return invoker;
             }
@@ -70,8 +72,8 @@
 
     }
 
-    protected <B> ObjectFactory<B> createWireFactory(Class<B> interfaze, Wire wire) {
-        return new WireObjectFactory<B>(interfaze, wire, proxyService);
+    protected <B> ObjectFactory<B> createWireFactory(Class<B> interfaze, RuntimeWire wire) {
+        return new org.apache.tuscany.core.invocation.WireObjectFactory<B>(interfaze, wire, proxyService);
     }
 
     protected ObjectFactory<?> createPropertyValueFactory(ComponentProperty property,



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