summaryrefslogtreecommitdiffstats
path: root/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope
diff options
context:
space:
mode:
Diffstat (limited to 'tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope')
-rw-r--r--tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainer.java196
-rw-r--r--tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/DefaultScopeRegistry.java46
-rw-r--r--tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/Scope.java66
-rw-r--r--tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeContainer.java158
-rw-r--r--tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeContainerFactory.java32
-rw-r--r--tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeRegistry.java43
-rw-r--r--tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopedImplementationProvider.java65
-rw-r--r--tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopedRuntimeComponent.java40
-rw-r--r--tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetDestructionException.java44
-rw-r--r--tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetInitializationException.java44
-rw-r--r--tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetNotFoundException.java44
-rw-r--r--tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetResolutionException.java44
-rw-r--r--tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/CompositeScopeContainer.java82
-rw-r--r--tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/CompositeScopeContainerFactory.java40
-rw-r--r--tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/ConversationalScopeContainer.java294
-rw-r--r--tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/ConversationalScopeContainerFactory.java44
-rw-r--r--tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/HttpSessionScopeContainer.java74
-rw-r--r--tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/HttpSessionScopeContainerFactory.java44
-rw-r--r--tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/RequestScopeContainer.java79
-rw-r--r--tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/RequestScopeContainerFactory.java40
-rw-r--r--tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/ScopeRegistryImpl.java68
-rw-r--r--tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/StatelessScopeContainer.java59
-rw-r--r--tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/StatelessScopeContainerFactory.java40
23 files changed, 0 insertions, 1686 deletions
diff --git a/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainer.java b/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainer.java
deleted file mode 100644
index 4674456925..0000000000
--- a/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainer.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * 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.sca.core.scope;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.apache.tuscany.sca.core.factory.InstanceWrapper;
-import org.apache.tuscany.sca.provider.ImplementationProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * Implements functionality common to scope contexts.
- *
- * @version $Rev$ $Date$
- */
-public abstract class AbstractScopeContainer<KEY> implements ScopeContainer<KEY> {
- protected Map<KEY, InstanceWrapper<?>> wrappers = new ConcurrentHashMap<KEY, InstanceWrapper<?>>();
- protected final Scope scope;
-
- protected RuntimeComponent component;
- protected volatile int lifecycleState = UNINITIALIZED;
-
-
- public AbstractScopeContainer(Scope scope, RuntimeComponent component) {
- this.scope = scope;
- this.component = component;
- }
-
- protected void checkInit() {
- if (getLifecycleState() != RUNNING) {
- throw new IllegalStateException("Scope container not running [" + getLifecycleState() + "]");
- }
- }
-
- /**
- * 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
- */
- protected InstanceWrapper createInstanceWrapper() throws TargetResolutionException {
- ImplementationProvider implementationProvider = component.getImplementationProvider();
- if (implementationProvider instanceof ScopedImplementationProvider) {
- return ((ScopedImplementationProvider)implementationProvider).createInstanceWrapper();
- }
- return null;
- }
-
- public InstanceWrapper getAssociatedWrapper(KEY contextId) throws TargetResolutionException {
- return getWrapper(contextId); // TODO: what is this method supposed to do diff than getWrapper?
- }
-
- public Scope getScope() {
- return scope;
- }
-
- public InstanceWrapper getWrapper(KEY contextId) throws TargetResolutionException {
- return wrappers.get(contextId);
- }
-
- public void addWrapperReference(KEY existingContextId, KEY newContextId)
- throws TargetResolutionException {
- // do nothing here. the conversational scope container implements this
- }
-
- public void registerWrapper(InstanceWrapper wrapper, KEY contextId) throws TargetResolutionException {
- // do nothing here. the conversational scope container implements this
- }
-
- protected boolean isEagerInit() {
- ImplementationProvider implementationProvider = ((RuntimeComponent)component).getImplementationProvider();
- if (implementationProvider instanceof ScopedImplementationProvider) {
- return ((ScopedImplementationProvider)implementationProvider).isEagerInit();
- }
- return false;
- }
-
- public void returnWrapper(InstanceWrapper wrapper, KEY contextId) throws TargetDestructionException {
- }
-
- /**
- * Default implementation of remove which does nothing
- *
- * @param contextId the identifier of the context to remove.
- */
- public void remove(KEY contextId)
- throws TargetDestructionException {
- }
-
- public synchronized void start() {
- int lifecycleState = getLifecycleState();
- if (lifecycleState != UNINITIALIZED && lifecycleState != STOPPED) {
- throw new IllegalStateException("Scope must be in UNINITIALIZED or STOPPED state [" + lifecycleState + "]");
- }
- setLifecycleState(RUNNING);
- }
-
- public void startContext(KEY contextId) {
- if(isEagerInit()) {
- try {
- getWrapper(contextId);
- } catch (TargetResolutionException e) {
- //
- }
- }
- }
-
- public synchronized void stop() {
- int lifecycleState = getLifecycleState();
- if (lifecycleState != RUNNING) {
- throw new IllegalStateException("Scope in wrong state [" + lifecycleState + "]");
- }
- setLifecycleState(STOPPED);
- }
-
- public void stopContext(KEY contextId) {
- wrappers.remove(contextId);
- }
-
- @Override
- public String toString() {
- String s;
- switch (lifecycleState) {
- case ScopeContainer.CONFIG_ERROR:
- s = "CONFIG_ERROR";
- break;
- case ScopeContainer.ERROR:
- s = "ERROR";
- break;
- case ScopeContainer.INITIALIZING:
- s = "INITIALIZING";
- break;
- case ScopeContainer.INITIALIZED:
- s = "INITIALIZED";
- break;
- case ScopeContainer.RUNNING:
- s = "RUNNING";
- break;
- case ScopeContainer.STOPPING:
- s = "STOPPING";
- break;
- case ScopeContainer.STOPPED:
- s = "STOPPED";
- break;
- case ScopeContainer.UNINITIALIZED:
- s = "UNINITIALIZED";
- break;
- default:
- s = "UNKNOWN";
- break;
- }
- return "In state [" + s + ']';
- }
-
- public RuntimeComponent getComponent() {
- return component;
- }
-
- public void setComponent(RuntimeComponent component) {
- this.component = component;
- }
-
- public int getLifecycleState() {
- return lifecycleState;
- }
-
- /**
- * Set the current state of the Lifecycle.
- *
- * @param lifecycleState the new state
- */
- protected void setLifecycleState(int lifecycleState) {
- this.lifecycleState = lifecycleState;
- }
-
-}
diff --git a/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/DefaultScopeRegistry.java b/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/DefaultScopeRegistry.java
deleted file mode 100644
index b6857be97a..0000000000
--- a/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/DefaultScopeRegistry.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.sca.core.scope;
-
-import org.apache.tuscany.sca.core.scope.impl.CompositeScopeContainerFactory;
-import org.apache.tuscany.sca.core.scope.impl.ConversationalScopeContainerFactory;
-import org.apache.tuscany.sca.core.scope.impl.RequestScopeContainerFactory;
-import org.apache.tuscany.sca.core.scope.impl.ScopeRegistryImpl;
-import org.apache.tuscany.sca.core.scope.impl.StatelessScopeContainerFactory;
-
-/**
- * A default scope registry implementation.
- *
- * @version $Rev$ $Date$
- */
-public class DefaultScopeRegistry extends ScopeRegistryImpl implements ScopeRegistry {
-
- public DefaultScopeRegistry() {
- ScopeContainerFactory[] factories =
- new ScopeContainerFactory[] {new CompositeScopeContainerFactory(), new StatelessScopeContainerFactory(),
- new RequestScopeContainerFactory(),
- new ConversationalScopeContainerFactory(),
- // new HttpSessionScopeContainer(monitor)
- };
- for (ScopeContainerFactory f : factories) {
- register(f);
- }
- }
-}
diff --git a/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/Scope.java b/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/Scope.java
deleted file mode 100644
index 0a20d793f7..0000000000
--- a/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/Scope.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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.sca.core.scope;
-
-/**
- * The default implementation scopes supported by assemblies.
- *
- * @version $Rev$ $Date$
- */
-public class Scope {
- public static final Scope STATELESS = new Scope("STATELESS");
- public static final Scope REQUEST = new Scope("REQUEST");
- public static final Scope SESSION = new Scope("SESSION");
- public static final Scope CONVERSATION = new Scope("CONVERSATION");
- public static final Scope COMPOSITE = new Scope("COMPOSITE");
- public static final Scope SYSTEM = new Scope("SYSTEM");
- public static final Scope UNDEFINED = new Scope("UNDEFINED");
-
- private String scope;
-
- public Scope(String scope) {
- this.scope = scope.toUpperCase().intern();
- }
-
- public String getScope() {
- return scope;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- final Scope scope1 = (Scope) o;
- return !(scope != null ? scope != scope1.scope.intern() : scope1.scope != null);
- }
-
- @Override
- public int hashCode() {
- return scope != null ? scope.hashCode() : 0;
- }
-
- @Override
- public String toString() {
- return scope;
- }
-}
diff --git a/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeContainer.java b/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeContainer.java
deleted file mode 100644
index 2398ecea3e..0000000000
--- a/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeContainer.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * 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.sca.core.scope;
-
-import org.apache.tuscany.sca.core.factory.InstanceWrapper;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-
-/**
- * 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> {
-
- /**
- * Returns the Scope that this container supports.
- *
- * @return the Scope that this container supports
- */
- Scope getScope();
-
- /**
- * Start a new context with the supplied ID.
- *
- * @param contextId an ID that uniquely identifies the context.
- */
- void startContext(KEY contextId);
-
- /**
- * 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 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(KEY contextId) throws TargetResolutionException;
-
- /**
- * Allows a component to be registered against more than one context id. This is required in the
- * case of stateful callbacks where we want to identify the originating client component instance
- * as the callback target but we don't want to reuse the clients original conversation id
- *
- * @param existingContextId an id that identifies an existing component instance
- * @param newContextId a new id against which this component will also be registered
- * @throws TargetResolutionException
- */
- void addWrapperReference(KEY existingContextId, KEY newContextId)
- throws TargetResolutionException;
-
- /**
- * Register an existing instance against a context id. This is needed
- * for a stateful callback where the service reference for the forward call
- * contains a callback object that is not a service reference.
- *
- * @param wrapper the instance wrapper for the instance to be registered
- * @param contextId the id for the scope context
- * @throws TargetResolutionException
- */
- void registerWrapper(InstanceWrapper wrapper, 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 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(KEY contextId)
- throws TargetResolutionException;
-
- /**
- * Return a wrapper after use (for example, after invoking the instance).
- * @param wrapper the wrapper for the target instance being returned
- * @param contextId the id for the scope context
- *
- * @throws TargetDestructionException if there was a problem returning the target instance
- */
- void returnWrapper(InstanceWrapper wrapper, KEY contextId)
- throws TargetDestructionException;
-
- /**
- * Removes an identified component implementation instance associated with the current
- * context from persistent storage
- *
- * @param contextId the identifier of the context to remove.
- */
- void remove(KEY contextId)
- throws TargetDestructionException;
-
- /* A configuration error state */
- int CONFIG_ERROR = -1;
- /* Has not been initialized */
- int UNINITIALIZED = 0;
- /* In the process of being configured and initialized */
- int INITIALIZING = 1;
- /* Instantiated and configured */
- int INITIALIZED = 2;
- /* Configured and initialized */
- int RUNNING = 4;
- /* In the process of being shutdown */
- int STOPPING = 5;
- /* Has been shutdown and removed from the composite */
- int STOPPED = 6;
- /* In an error state */
- int ERROR = 7;
-
- /**
- * Returns the lifecycle state
- *
- * @see #UNINITIALIZED
- * @see #INITIALIZING
- * @see #INITIALIZED
- * @see #RUNNING
- * @see #STOPPING
- * @see #STOPPED
- */
- int getLifecycleState();
-
- /**
- * Starts the Lifecycle.
- */
- void start();
-
- /**
- * Stops the Lifecycle.
- */
- void stop();
-
-}
diff --git a/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeContainerFactory.java b/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeContainerFactory.java
deleted file mode 100644
index b19c14b3e0..0000000000
--- a/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeContainerFactory.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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.sca.core.scope;
-
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * Factory to create ScopeContainer for components
- *
- * @version $Rev$ $Date$
- */
-public interface ScopeContainerFactory {
- ScopeContainer createScopeContainer(RuntimeComponent component);
- Scope getScope();
-}
diff --git a/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeRegistry.java b/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeRegistry.java
deleted file mode 100644
index 842ed4c547..0000000000
--- a/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeRegistry.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.sca.core.scope;
-
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-
-/**
- * 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(RuntimeComponent component);
-
- /**
- * @param factory
- */
- void register(ScopeContainerFactory factory);
-}
diff --git a/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopedImplementationProvider.java b/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopedImplementationProvider.java
deleted file mode 100644
index 30d5c77181..0000000000
--- a/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopedImplementationProvider.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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.sca.core.scope;
-
-import org.apache.tuscany.sca.core.factory.InstanceWrapper;
-import org.apache.tuscany.sca.provider.ImplementationProvider;
-
-/**
- * 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
- *
- * @return true if the component is marked to be eagerly initialized, false
- * otherwise
- */
- boolean isEagerInit();
-
- /**
- * @return the maxAge
- */
- long getMaxAge();
-
- /**
- * @return the maxIdleTime
- */
- long getMaxIdleTime();
-
- /**
- * Create a wrapper for the component instance for the scope management
- *
- * @return A wrapper for the component instance
- */
- InstanceWrapper createInstanceWrapper();
-
-}
diff --git a/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopedRuntimeComponent.java b/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopedRuntimeComponent.java
deleted file mode 100644
index c27b112f8a..0000000000
--- a/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopedRuntimeComponent.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.sca.core.scope;
-
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * Scoped runtime component
- *
- * @version $Rev$ $Date$
- */
-public interface ScopedRuntimeComponent extends RuntimeComponent {
- /**
- * Set the associated scope container
- * @param scopeContainer
- */
- void setScopeContainer(ScopeContainer scopeContainer);
- /**
- * Get the assoicated scope container
- * @return
- */
- ScopeContainer getScopeContainer();
-}
diff --git a/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetDestructionException.java b/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetDestructionException.java
deleted file mode 100644
index 0f83dad97d..0000000000
--- a/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetDestructionException.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.sca.core.scope;
-
-/**
- * Denotes an error destroying a target
- *
- * @version $Rev$ $Date$
- */
-public class TargetDestructionException extends TargetResolutionException {
- private static final long serialVersionUID = -6126684147851674709L;
-
- public TargetDestructionException() {
- super();
- }
-
- public TargetDestructionException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public TargetDestructionException(String message) {
- super(message);
- }
-
- public TargetDestructionException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetInitializationException.java b/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetInitializationException.java
deleted file mode 100644
index 15959c0608..0000000000
--- a/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetInitializationException.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.sca.core.scope;
-
-/**
- * Denotes an error initializing a target
- *
- * @version $Rev$ $Date$
- */
-public class TargetInitializationException extends TargetResolutionException {
- private static final long serialVersionUID = -6228778208649752698L;
-
- public TargetInitializationException() {
- super();
- }
-
- public TargetInitializationException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public TargetInitializationException(String message) {
- super(message);
- }
-
- public TargetInitializationException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetNotFoundException.java b/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetNotFoundException.java
deleted file mode 100644
index bb46a2499b..0000000000
--- a/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetNotFoundException.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.sca.core.scope;
-
-/**
- * Thrown when a target of an operation cannot be found
- *
- * @version $Rev$ $Date$
- */
-public class TargetNotFoundException extends TargetResolutionException {
- private static final long serialVersionUID = 5541830480658471186L;
-
- public TargetNotFoundException() {
- super();
- }
-
- public TargetNotFoundException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public TargetNotFoundException(String message) {
- super(message);
- }
-
- public TargetNotFoundException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetResolutionException.java b/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetResolutionException.java
deleted file mode 100644
index ea8d0e876c..0000000000
--- a/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetResolutionException.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.sca.core.scope;
-
-/**
- * Denotes an error retrieving a target instance
- *
- * @version $Rev$ $Date$
- */
-public class TargetResolutionException extends Exception {
- private static final long serialVersionUID = 2912513650522019405L;
-
- public TargetResolutionException() {
- super();
- }
-
- public TargetResolutionException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public TargetResolutionException(String message) {
- super(message);
- }
-
- public TargetResolutionException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/CompositeScopeContainer.java b/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/CompositeScopeContainer.java
deleted file mode 100644
index 6763c8117d..0000000000
--- a/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/CompositeScopeContainer.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * 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.sca.core.scope.impl;
-
-import org.apache.tuscany.sca.core.factory.InstanceWrapper;
-import org.apache.tuscany.sca.core.scope.AbstractScopeContainer;
-import org.apache.tuscany.sca.core.scope.Scope;
-import org.apache.tuscany.sca.core.scope.TargetDestructionException;
-import org.apache.tuscany.sca.core.scope.TargetNotFoundException;
-import org.apache.tuscany.sca.core.scope.TargetResolutionException;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * A scope context which manages atomic component instances keyed by composite
- *
- * @version $Rev$ $Date$
- */
-public class CompositeScopeContainer<KEY> extends AbstractScopeContainer<KEY> {
- private InstanceWrapper<?> wrapper;
-
- public CompositeScopeContainer(RuntimeComponent component) {
- super(Scope.COMPOSITE, component);
- }
-
- @Override
- public synchronized void stop() {
- super.stop();
- if (wrapper != null) {
- try {
- wrapper.stop();
- } catch (TargetDestructionException e) {
- throw new IllegalStateException(e);
- }
- }
- wrapper = null;
- }
-
- @Override
- public synchronized InstanceWrapper getWrapper(KEY contextId) throws TargetResolutionException {
- if (wrapper == null) {
- wrapper = createInstanceWrapper();
- wrapper.start();
- }
- return wrapper;
- }
-
- @Override
- public InstanceWrapper getAssociatedWrapper(KEY contextId) throws TargetResolutionException {
- if (wrapper == null) {
- throw new TargetNotFoundException(component.getURI());
- }
- return wrapper;
- }
-
- @Override
- public synchronized void start() {
- super.start();
- if (isEagerInit()) {
- try {
- getWrapper(null);
- } catch (TargetResolutionException e) {
- throw new IllegalStateException(e);
- }
- }
- }
-}
diff --git a/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/CompositeScopeContainerFactory.java b/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/CompositeScopeContainerFactory.java
deleted file mode 100644
index f61e70a598..0000000000
--- a/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/CompositeScopeContainerFactory.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.sca.core.scope.impl;
-
-import org.apache.tuscany.sca.core.scope.Scope;
-import org.apache.tuscany.sca.core.scope.ScopeContainer;
-import org.apache.tuscany.sca.core.scope.ScopeContainerFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * @version $Rev$ $Date$
- */
-public class CompositeScopeContainerFactory implements ScopeContainerFactory {
-
- public ScopeContainer createScopeContainer(RuntimeComponent component) {
- return new CompositeScopeContainer(component);
- }
-
- public Scope getScope() {
- return Scope.COMPOSITE;
- }
-
-}
diff --git a/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/ConversationalScopeContainer.java b/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/ConversationalScopeContainer.java
deleted file mode 100644
index 8dfe77f61b..0000000000
--- a/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/ConversationalScopeContainer.java
+++ /dev/null
@@ -1,294 +0,0 @@
-/*
- * 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.sca.core.scope.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.apache.tuscany.sca.core.conversation.ConversationExt;
-import org.apache.tuscany.sca.core.conversation.ConversationListener;
-import org.apache.tuscany.sca.core.conversation.ConversationManager;
-import org.apache.tuscany.sca.core.factory.InstanceWrapper;
-import org.apache.tuscany.sca.core.invocation.ThreadMessageContext;
-import org.apache.tuscany.sca.core.scope.AbstractScopeContainer;
-import org.apache.tuscany.sca.core.scope.Scope;
-import org.apache.tuscany.sca.core.scope.TargetDestructionException;
-import org.apache.tuscany.sca.core.scope.TargetResolutionException;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * A scope context which manages atomic component instances keyed on ConversationID
- *
- * @version $Rev$ $Date$
- */
-public class ConversationalScopeContainer extends AbstractScopeContainer<Object> implements ConversationListener {
- private ConversationManager conversationManager;
- private Map<Object, InstanceLifeCycleWrapper> instanceLifecycleCollection =
- new ConcurrentHashMap<Object, InstanceLifeCycleWrapper>();
-
- public ConversationalScopeContainer(RuntimeComponent component) {
- super(Scope.CONVERSATION, component);
-
- // Note: aStore is here to preserve the original factory interface. It is not currently used in this
- // implementation since we do not support instance persistence.
-
- // Check System properties to see if timeout values have been specified. All timeout values
- // will be specified in seconds.
- //
-
- }
-
-
- protected InstanceWrapper getInstanceWrapper(boolean create, Object contextId) throws TargetResolutionException {
-
- // we might get a null context if the target service has
- // conversational scope but only its callback interface
- // is conversational. In this case we need to invent a
- // conversation Id here to store the service against
- // and populate the thread context
- if (contextId == null) {
- contextId = UUID.randomUUID().toString();
- Message msgContext = ThreadMessageContext.getMessageContext();
-
- if (msgContext != null) {
- // TODO - EPR - not required for OASIS
- //msgContext.getFrom().getReferenceParameters().setConversationID(contextId);
- }
- }
-
- InstanceLifeCycleWrapper anInstanceWrapper = this.instanceLifecycleCollection.get(contextId);
-
- if (anInstanceWrapper == null && !create)
- return null;
-
- if (anInstanceWrapper == null) {
- anInstanceWrapper = new InstanceLifeCycleWrapper(contextId);
- this.instanceLifecycleCollection.put(contextId, anInstanceWrapper);
- }
-
- return anInstanceWrapper.getInstanceWrapper(contextId);
-
- }
-
- @Override
- public InstanceWrapper getWrapper(Object contextId) throws TargetResolutionException {
- return getInstanceWrapper(true, contextId);
- }
-
- /**
- * This method allows a new context id to be registered alongside an existing one. This happens in
- * one case, when a conversation includes a stateful callback. The client component instance
- * must be registered against all outgoing conversation ids so that the component instance
- * can be found when the callback arrives
- *
- * @param existingContextId the context id against which the component is already registered
- * @param context this should be a conversation object so that the conversation can b stored
- * and reset when the component instance is removed
- */
- @Override
- public void addWrapperReference(Object existingContextId, Object contextId) throws TargetResolutionException {
-
-
- // get the instance wrapper via the existing id
- InstanceLifeCycleWrapper existingInstanceWrapper = this.instanceLifecycleCollection.get(existingContextId);
- InstanceLifeCycleWrapper newInstanceWrapper = this.instanceLifecycleCollection.get(contextId);
-
- // only add the extra reference once
- if (newInstanceWrapper == null) {
- // add the id to the list of ids that the wrapper holds. Used for reference
- // counting and conversation resetting on destruction.
- existingInstanceWrapper.addCallbackConversation(contextId);
-
- // add the reference to the collection
- this.instanceLifecycleCollection.put(contextId, existingInstanceWrapper);
- }
- }
-
- @Override
- public void registerWrapper(InstanceWrapper wrapper, Object contextId) throws TargetResolutionException {
- // if a wrapper for a different instance is already registered for this contextId, remove it
- InstanceLifeCycleWrapper anInstanceWrapper = this.instanceLifecycleCollection.get(contextId);
- if (anInstanceWrapper != null) {
- if (anInstanceWrapper.getInstanceWrapper(contextId).getInstance() != wrapper.getInstance()) {
- remove(contextId);
- } else {
- return;
- }
- }
-
- anInstanceWrapper = new InstanceLifeCycleWrapper(wrapper, contextId);
- this.instanceLifecycleCollection.put(contextId, anInstanceWrapper);
- }
-
- // The remove is invoked when a conversation is explicitly ended. This can occur by using the @EndsConversation or API.
- // In this case the instance is immediately removed. A new conversation will be started on the next operation
- // associated with this conversationId's service reference.
- //
- @Override
- public void remove(Object contextId) throws TargetDestructionException {
- if (contextId != null) {
- if (this.instanceLifecycleCollection.containsKey(contextId)) {
- InstanceLifeCycleWrapper anInstanceLifeCycleWrapper = this.instanceLifecycleCollection.get(contextId);
- this.instanceLifecycleCollection.remove(contextId);
- anInstanceLifeCycleWrapper.removeInstanceWrapper(contextId);
- }
- }
- }
-
- /*
- * This is an inner class that keeps track of the lifecycle of a conversation scoped
- * implementation instance.
- *
- */
-
- private class InstanceLifeCycleWrapper {
- private Object clientConversationId;
- private List<Object> callbackConversations = new ArrayList<Object>();
-
- private InstanceLifeCycleWrapper(Object contextId) throws TargetResolutionException {
- this.clientConversationId = contextId;
- this.createInstance(contextId);
- }
-
- private InstanceLifeCycleWrapper(InstanceWrapper wrapper, Object contextId) throws TargetResolutionException {
- this.clientConversationId = contextId;
- wrappers.put(contextId, wrapper);
- }
-
-
- // Associates a callback conversation with this instance. Each time the scope container
- // is asked to remove an object given a ontextId an associated conversation object will
- // have its conversationId reset to null. When the list of ids is empty the component instance
- // will be removed from the scope container
- private void addCallbackConversation(Object conversationID) {
- InstanceWrapper ctx = getInstanceWrapper(clientConversationId);
- callbackConversations.add(conversationID);
- wrappers.put(conversationID, ctx);
- }
-
- //
- // Return the backing implementation instance
- //
- private InstanceWrapper getInstanceWrapper(Object contextId) {
- InstanceWrapper ctx = wrappers.get(contextId);
- return ctx;
- }
-
- private void removeInstanceWrapper(Object contextId) throws TargetDestructionException {
- InstanceWrapper ctx = getInstanceWrapper(contextId);
- wrappers.remove(contextId);
-
- // find out if we are dealing with the original client conversation id
- // and reset accordingly
- if ( ( clientConversationId != null ) && ( clientConversationId.equals(contextId)) ) {
- clientConversationId = null;
- } else {
- // reset the conversationId in the conversation object if present
- // so that and ending callback causes the conversation in the originating
- // service reference in the client to be reset
- callbackConversations.remove(contextId);
- }
-
- // stop the component if this removes the last reference
- if (clientConversationId == null && callbackConversations.isEmpty()) {
- ctx.stop();
- }
- }
-
- private void createInstance(Object contextId) throws TargetResolutionException {
- InstanceWrapper instanceWrapper = createInstanceWrapper();
- instanceWrapper.start();
- wrappers.put(contextId, instanceWrapper);
- }
-
- }
-
- /**
- * @see org.apache.tuscany.sca.core.conversation.ConversationListener#conversationEnded(org.apache.tuscany.sca.core.conversation.ConversationExt)
- */
- public void conversationEnded(ConversationExt conversation) {
- try {
- remove(conversation.getConversationID());
- } catch (Exception ex) {
-
- }
- }
-
- /**
- * @see org.apache.tuscany.sca.core.conversation.ConversationListener#conversationExpired(org.apache.tuscany.sca.core.conversation.ConversationExt)
- */
- public void conversationExpired(ConversationExt conversation) {
-
- Object conversationId = conversation.getConversationID();
- InstanceLifeCycleWrapper ilcw = instanceLifecycleCollection.get(conversationId);
- if (ilcw != null) {
- // cycle through all the references to this instance and
- // remove them from the underlying wrappers collection and
- // from the lifecycle wrappers collection
-
- for (Object conversationID : ilcw.callbackConversations) {
- try{
- ilcw.removeInstanceWrapper(conversationID);
- remove(conversationID);
- } catch(TargetDestructionException tde) {
- System.out.println("Could not remove conversation id " + conversationID);
- }
- }
-
-
- if (ilcw.clientConversationId != null) {
- try{
- ilcw.removeInstanceWrapper(ilcw.clientConversationId);
- remove(ilcw.clientConversationId);
- } catch(TargetDestructionException tde) {
- System.out.println("Could not remove conversation id " + ilcw.clientConversationId);
- }
- }
-
- }
-
- }
-
- /**
- * @see org.apache.tuscany.sca.core.conversation.ConversationListener#conversationStarted(org.apache.tuscany.sca.core.conversation.ConversationExt)
- */
- public void conversationStarted(ConversationExt conversation) {
- startContext(conversation.getConversationID());
- }
-
- /**
- * @return the conversationManager
- */
- public ConversationManager getConversationManager() {
- return conversationManager;
- }
-
- /**
- * @param conversationManager the conversationManager to set
- */
- public void setConversationManager(ConversationManager conversationManager) {
- this.conversationManager = conversationManager;
- }
-
-}
diff --git a/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/ConversationalScopeContainerFactory.java b/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/ConversationalScopeContainerFactory.java
deleted file mode 100644
index f8ffc027a1..0000000000
--- a/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/ConversationalScopeContainerFactory.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.sca.core.scope.impl;
-
-import org.apache.tuscany.sca.core.scope.Scope;
-import org.apache.tuscany.sca.core.scope.ScopeContainer;
-import org.apache.tuscany.sca.core.scope.ScopeContainerFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ConversationalScopeContainerFactory implements ScopeContainerFactory {
-
- public ConversationalScopeContainerFactory() {
- super();
- }
-
- public ScopeContainer createScopeContainer(RuntimeComponent component) {
- return new ConversationalScopeContainer(component);
- }
-
- public Scope getScope() {
- return Scope.CONVERSATION;
- }
-
-}
diff --git a/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/HttpSessionScopeContainer.java b/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/HttpSessionScopeContainer.java
deleted file mode 100644
index bfe197255d..0000000000
--- a/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/HttpSessionScopeContainer.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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.sca.core.scope.impl;
-
-import org.apache.tuscany.sca.core.factory.InstanceWrapper;
-import org.apache.tuscany.sca.core.scope.AbstractScopeContainer;
-import org.apache.tuscany.sca.core.scope.Scope;
-import org.apache.tuscany.sca.core.scope.TargetResolutionException;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * A scope context which manages atomic component instances keyed on HTTP
- * session
- *
- * @version $Rev$ $Date$
- */
-public class HttpSessionScopeContainer extends AbstractScopeContainer<Object> {
-
- public HttpSessionScopeContainer(RuntimeComponent component) {
- super(Scope.SESSION, component);
- }
-
- @Override
- public synchronized void start() {
- if (lifecycleState != UNINITIALIZED && lifecycleState != STOPPED) {
- throw new IllegalStateException("Scope must be in UNINITIALIZED or STOPPED state [" + lifecycleState + "]");
- }
- lifecycleState = RUNNING;
- }
-
- @Override
- public synchronized void stop() {
- lifecycleState = STOPPED;
- }
-
- protected InstanceWrapper getInstanceWrapper(boolean create) throws TargetResolutionException {
-// Object key = workContext.getIdentifier(Scope.SESSION);
- // FIXME: Need to fix this
- Object key ="http-session-id";
- assert key != null : "HTTP session key not bound in work context";
- InstanceWrapper ctx = wrappers.get(key);
- if (ctx == null && !create) {
- return null;
- }
- if (ctx == null) {
- ctx = super.createInstanceWrapper();
- ctx.start();
- wrappers.put(key, ctx);
- }
- return ctx;
- }
-
- @Override
- public InstanceWrapper getWrapper(Object contextId) throws TargetResolutionException {
- return getInstanceWrapper(true);
- }
-
-}
diff --git a/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/HttpSessionScopeContainerFactory.java b/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/HttpSessionScopeContainerFactory.java
deleted file mode 100644
index d6aaa4cc84..0000000000
--- a/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/HttpSessionScopeContainerFactory.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.sca.core.scope.impl;
-
-import org.apache.tuscany.sca.core.scope.Scope;
-import org.apache.tuscany.sca.core.scope.ScopeContainer;
-import org.apache.tuscany.sca.core.scope.ScopeContainerFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * @version $Rev$ $Date$
- */
-public class HttpSessionScopeContainerFactory implements ScopeContainerFactory {
-
- public HttpSessionScopeContainerFactory() {
- super();
- }
-
- public ScopeContainer createScopeContainer(RuntimeComponent component) {
- return new HttpSessionScopeContainer(component);
- }
-
- public Scope getScope() {
- return Scope.SESSION;
- }
-
-}
diff --git a/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/RequestScopeContainer.java b/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/RequestScopeContainer.java
deleted file mode 100644
index 7519af2341..0000000000
--- a/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/RequestScopeContainer.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * 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.sca.core.scope.impl;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.apache.tuscany.sca.core.factory.InstanceWrapper;
-import org.apache.tuscany.sca.core.scope.AbstractScopeContainer;
-import org.apache.tuscany.sca.core.scope.Scope;
-import org.apache.tuscany.sca.core.scope.TargetResolutionException;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * A scope context which manages atomic component instances keyed on the current
- * request context
- *
- * @version $Rev$ $Date$
- */
-public class RequestScopeContainer extends AbstractScopeContainer<Thread> {
- private final Map<Thread, InstanceWrapper> contexts;
-
- public RequestScopeContainer(RuntimeComponent component) {
- super(Scope.REQUEST, component);
- contexts = new ConcurrentHashMap<Thread, InstanceWrapper>();
- }
-
- @Override
- public synchronized void start() {
- if (lifecycleState != UNINITIALIZED && lifecycleState != STOPPED) {
- throw new IllegalStateException("Scope must be in UNINITIALIZED or STOPPED state [" + lifecycleState + "]");
- }
- lifecycleState = RUNNING;
- }
-
- @Override
- public synchronized void stop() {
- contexts.clear();
- // synchronized (destroyQueues) {
- // destroyQueues.clear();
- // }
- lifecycleState = STOPPED;
- }
-
- protected InstanceWrapper getInstanceWrapper(boolean create) throws TargetResolutionException {
- InstanceWrapper ctx = wrappers.get(Thread.currentThread());
- if (ctx == null && !create) {
- return null;
- }
- if (ctx == null) {
- ctx = super.createInstanceWrapper();
- ctx.start();
- wrappers.put(Thread.currentThread(), ctx);
- }
- return ctx;
- }
-
- @Override
- public InstanceWrapper getWrapper(Thread contextId) throws TargetResolutionException {
- return getInstanceWrapper(true);
- }
-
-}
diff --git a/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/RequestScopeContainerFactory.java b/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/RequestScopeContainerFactory.java
deleted file mode 100644
index 9d1cf88d96..0000000000
--- a/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/RequestScopeContainerFactory.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.sca.core.scope.impl;
-
-import org.apache.tuscany.sca.core.scope.Scope;
-import org.apache.tuscany.sca.core.scope.ScopeContainer;
-import org.apache.tuscany.sca.core.scope.ScopeContainerFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * @version $Rev$ $Date$
- */
-public class RequestScopeContainerFactory implements ScopeContainerFactory {
-
- public ScopeContainer createScopeContainer(RuntimeComponent component) {
- return new RequestScopeContainer(component);
- }
-
- public Scope getScope() {
- return Scope.REQUEST;
- }
-
-}
diff --git a/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/ScopeRegistryImpl.java b/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/ScopeRegistryImpl.java
deleted file mode 100644
index f11295c9fa..0000000000
--- a/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/ScopeRegistryImpl.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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.sca.core.scope.impl;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.apache.tuscany.sca.core.scope.Scope;
-import org.apache.tuscany.sca.core.scope.ScopeContainer;
-import org.apache.tuscany.sca.core.scope.ScopeContainerFactory;
-import org.apache.tuscany.sca.core.scope.ScopeRegistry;
-import org.apache.tuscany.sca.core.scope.ScopedImplementationProvider;
-import org.apache.tuscany.sca.core.scope.ScopedRuntimeComponent;
-import org.apache.tuscany.sca.provider.ImplementationProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * The default implementation of a scope registry
- *
- * @version $Rev$ $Date$
- */
-public class ScopeRegistryImpl implements ScopeRegistry {
- private final Map<Scope, ScopeContainerFactory> scopeCache = new ConcurrentHashMap<Scope, ScopeContainerFactory>();
-
- public void register(ScopeContainerFactory factory) {
- scopeCache.put(factory.getScope(), factory);
- }
-
- public ScopeContainer getScopeContainer(RuntimeComponent runtimeComponent) {
- if (!(runtimeComponent instanceof ScopedRuntimeComponent)) {
- return null;
- }
- ScopedRuntimeComponent component = (ScopedRuntimeComponent)runtimeComponent;
- if (component.getScopeContainer() != null) {
- return component.getScopeContainer();
- }
- ImplementationProvider implementationProvider = component.getImplementationProvider();
- if (implementationProvider instanceof ScopedImplementationProvider) {
- ScopedImplementationProvider provider = (ScopedImplementationProvider)implementationProvider;
- Scope scope = provider.getScope();
- if (scope == null) {
- scope = Scope.STATELESS;
- }
- ScopeContainerFactory factory = scopeCache.get(scope);
- ScopeContainer container = factory.createScopeContainer(component);
- component.setScopeContainer(container);
- return container;
- }
- return null;
- }
-
-}
diff --git a/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/StatelessScopeContainer.java b/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/StatelessScopeContainer.java
deleted file mode 100644
index 0639b8885b..0000000000
--- a/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/StatelessScopeContainer.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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.sca.core.scope.impl;
-
-import org.apache.tuscany.sca.core.factory.InstanceWrapper;
-import org.apache.tuscany.sca.core.scope.AbstractScopeContainer;
-import org.apache.tuscany.sca.core.scope.Scope;
-import org.apache.tuscany.sca.core.scope.TargetDestructionException;
-import org.apache.tuscany.sca.core.scope.TargetResolutionException;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * A scope context which manages stateless atomic component instances in a non-pooled fashion.
- *
- * @version $Rev$ $Date$
- */
-public class StatelessScopeContainer<KEY> extends AbstractScopeContainer<KEY> {
-
- public StatelessScopeContainer(RuntimeComponent component) {
- super(Scope.STATELESS, component);
- }
-
- @Override
- public InstanceWrapper getWrapper(KEY contextId)
- throws TargetResolutionException {
- InstanceWrapper ctx = createInstanceWrapper();
- ctx.start();
- return ctx;
- }
-
- @Override
- public InstanceWrapper getAssociatedWrapper(KEY contextId)
- throws TargetResolutionException {
- return getWrapper(contextId);
- }
-
- @Override
- public void returnWrapper(InstanceWrapper wrapper, KEY contextId)
- throws TargetDestructionException {
- wrapper.stop();
- }
-
-}
diff --git a/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/StatelessScopeContainerFactory.java b/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/StatelessScopeContainerFactory.java
deleted file mode 100644
index 5bf20a6a5f..0000000000
--- a/tags/java/sca/2.0-M3-RC4/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/StatelessScopeContainerFactory.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.sca.core.scope.impl;
-
-import org.apache.tuscany.sca.core.scope.Scope;
-import org.apache.tuscany.sca.core.scope.ScopeContainer;
-import org.apache.tuscany.sca.core.scope.ScopeContainerFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * @version $Rev$ $Date$
- */
-public class StatelessScopeContainerFactory implements ScopeContainerFactory {
-
- public ScopeContainer createScopeContainer(RuntimeComponent component) {
- return new StatelessScopeContainer(component);
- }
-
- public Scope getScope() {
- return Scope.STATELESS;
- }
-
-}