summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/core/src/main
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-09-25 21:08:37 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-09-25 21:08:37 +0000
commitcfb7e9a18f0cfdc2ca01874902e95adb61b4c6b8 (patch)
treedecd5b28667e04d467af0a2cabefee310dc1708f /java/sca/modules/core/src/main
parentd64d402c3cf248b93abdc01c3187ca5227512952 (diff)
Refactor CompositeActivator, ComponentContext and other related interfaces into core-spi module
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@819009 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/core/src/main')
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ActivationException.java37
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivator.java130
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointSerializer.java38
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/CompositeActivatorImpl.java24
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointSerializerImpl.java2
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java2
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java2
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextExt.java31
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/CompositeContext.java222
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ServiceReferenceExt.java4
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallableReferenceImpl.java33
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallbackServiceReferenceImpl.java2
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ComponentContextImpl.java11
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CompositeContextImpl.java36
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/RequestContextImpl.java2
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ServiceReferenceImpl.java2
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java1
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java1
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ThreadMessageContext.java81
-rw-r--r--java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKInvocationHandler.java2
-rw-r--r--java/sca/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.conversation.ConversationManager18
-rw-r--r--java/sca/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.runtime.CompositeActivator (renamed from java/sca/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.assembly.CompositeActivator)0
-rw-r--r--java/sca/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.runtime.EndpointSerializer (renamed from java/sca/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.assembly.EndpointSerializer)0
23 files changed, 60 insertions, 621 deletions
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ActivationException.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ActivationException.java
deleted file mode 100644
index c86c876075..0000000000
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ActivationException.java
+++ /dev/null
@@ -1,37 +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.assembly;
-
-
-/**
- * Denotes an error starting the runtime
- *
- * @version $Rev$ $Date$
- */
-public class ActivationException extends Exception {
- private static final long serialVersionUID = 8612661660934426123L;
-
- public ActivationException(String message) {
- super(message);
- }
-
- public ActivationException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivator.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivator.java
deleted file mode 100644
index c8518650fb..0000000000
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivator.java
+++ /dev/null
@@ -1,130 +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.assembly;
-
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.core.context.CompositeContext;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * Start/stop a composite
- *
- * @version $Rev$ $Date$
- */
-public interface CompositeActivator {
- /**
- * Activate a composite
- * @param composite
- */
- void activate(Composite composite) throws ActivationException;
-
- /**
- * Activate a component reference
- * @param component
- * @param ref
- */
- void start(RuntimeComponent component, RuntimeComponentReference ref);
-
- /**
- * Activate a component reference
- * @param component
- * @param ref
- */
- void activate(RuntimeComponent component, RuntimeComponentReference ref);
-
- /**
- * Activate a component reference
- * @param component
- * @param ref
- */
- void activate(RuntimeComponent component, RuntimeComponentService service);
-
- /**
- * De-activate a component reference
- * @param component
- * @param ref
- */
- void deactivate(RuntimeComponent component, RuntimeComponentReference ref);
-
- /**
- * De-activate a component reference
- * @param component
- * @param ref
- */
- void deactivate(RuntimeComponent component, RuntimeComponentService service);
-
- /**
- * Stop a composite
- * @param composite
- */
- void deactivate(Composite composite) throws ActivationException;
-
- /**
- * Start a component
- * @param component
- */
- void start(Component component) throws ActivationException;
-
- /**
- * Stop a component
- * @param component
- */
- void stop(Component component) throws ActivationException;
-
- /**
- * Start components in a composite
- * @param composite
- */
- void start(Composite composite) throws ActivationException;
-
- /**
- * Stop components in a composite
- * @param composite
- */
- void stop(Composite composite) throws ActivationException;
-
- /**
- * Get the component context helper
- * @return
- */
- CompositeContext getCompositeContext();
-
- /**
- * Configure the runtime component with component context
- * @param component
- */
- void configureComponentContext(RuntimeComponent component);
-
- /**
- * Set the domain composite
- * @param domainComposite
- */
- void setDomainComposite(Composite domainComposite);
-
- /**
- * Get the domain composite
- * @return
- */
- Composite getDomainComposite();
-
-}
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointSerializer.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointSerializer.java
deleted file mode 100644
index b9c9c7032b..0000000000
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointSerializer.java
+++ /dev/null
@@ -1,38 +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.assembly;
-
-import java.io.IOException;
-
-import org.apache.tuscany.sca.assembly.Endpoint;
-import org.apache.tuscany.sca.assembly.EndpointReference;
-
-/**
- * A utility to seralize/deserialize Endpoint/EndpointReference objects
- */
-public interface EndpointSerializer {
- void read(Endpoint endpoint, String xml) throws IOException;
-
- String write(Endpoint endpoint) throws IOException;
-
- void read(EndpointReference endpointReference, String xml) throws IOException;
-
- String write(EndpointReference endpointReference) throws IOException;
-}
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/CompositeActivatorImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/CompositeActivatorImpl.java
index 50db444c2a..fd0302829d 100644
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/CompositeActivatorImpl.java
+++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/CompositeActivatorImpl.java
@@ -37,24 +37,18 @@ import org.apache.tuscany.sca.assembly.Implementation;
import org.apache.tuscany.sca.assembly.Reference;
import org.apache.tuscany.sca.assembly.Service;
import org.apache.tuscany.sca.context.ComponentContextFactory;
+import org.apache.tuscany.sca.context.CompositeContext;
import org.apache.tuscany.sca.context.ContextFactoryExtensionPoint;
-import org.apache.tuscany.sca.context.PropertyValueFactory;
-import org.apache.tuscany.sca.context.RequestContextFactory;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.FactoryExtensionPoint;
import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.core.assembly.ActivationException;
-import org.apache.tuscany.sca.core.assembly.CompositeActivator;
-import org.apache.tuscany.sca.core.context.CompositeContext;
import org.apache.tuscany.sca.core.context.impl.CompositeContextImpl;
import org.apache.tuscany.sca.core.invocation.ExtensibleWireProcessor;
-import org.apache.tuscany.sca.core.invocation.ProxyFactory;
import org.apache.tuscany.sca.core.scope.ScopeContainer;
import org.apache.tuscany.sca.core.scope.ScopeRegistry;
import org.apache.tuscany.sca.core.scope.ScopedRuntimeComponent;
import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
import org.apache.tuscany.sca.invocation.MessageFactory;
import org.apache.tuscany.sca.provider.BindingProviderFactory;
import org.apache.tuscany.sca.provider.ImplementationProvider;
@@ -64,6 +58,8 @@ import org.apache.tuscany.sca.provider.PolicyProviderFactory;
import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.ActivationException;
+import org.apache.tuscany.sca.runtime.CompositeActivator;
import org.apache.tuscany.sca.runtime.EndpointRegistry;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentContext;
@@ -90,10 +86,6 @@ public class CompositeActivatorImpl implements CompositeActivator {
private final ProviderFactoryExtensionPoint providerFactories;
private final ComponentContextFactory componentContextFactory;
- private final RequestContextFactory requestContextFactory;
- private final ProxyFactory proxyFactory;
- private final JavaInterfaceFactory javaInterfaceFactory;
- private final PropertyValueFactory propertyValueFactory;
private final EndpointRegistry endpointRegistry;
private final CompositeContext compositeContext;
@@ -102,23 +94,19 @@ public class CompositeActivatorImpl implements CompositeActivator {
public CompositeActivatorImpl(ExtensionPointRegistry extensionPoints) {
this.extensionPoints = extensionPoints;
- this.compositeContext = new CompositeContextImpl(extensionPoints);
+ UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
+ this.endpointRegistry = utilities.getUtility(EndpointRegistry.class);
+ this.compositeContext = new CompositeContextImpl(extensionPoints, endpointRegistry);
FactoryExtensionPoint factories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class);
this.assemblyFactory = factories.getFactory(AssemblyFactory.class);
this.messageFactory = factories.getFactory(MessageFactory.class);
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
this.interfaceContractMapper = utilities.getUtility(InterfaceContractMapper.class);
this.scopeRegistry = utilities.getUtility(ScopeRegistry.class);
this.workScheduler = utilities.getUtility(WorkScheduler.class);
this.wireProcessor = new ExtensibleWireProcessor(extensionPoints.getExtensionPoint(RuntimeWireProcessorExtensionPoint.class));
this.providerFactories = extensionPoints.getExtensionPoint(ProviderFactoryExtensionPoint.class);
- this.javaInterfaceFactory = compositeContext.getJavaInterfaceFactory();
- this.propertyValueFactory = factories.getFactory(PropertyValueFactory.class);
ContextFactoryExtensionPoint contextFactories = extensionPoints.getExtensionPoint(ContextFactoryExtensionPoint.class);
this.componentContextFactory = contextFactories.getFactory(ComponentContextFactory.class);
- this.requestContextFactory = contextFactories.getFactory(RequestContextFactory.class);
- proxyFactory = compositeContext.getProxyFactory();
- this.endpointRegistry = utilities.getUtility(EndpointRegistry.class);
}
//=========================================================================
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointSerializerImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointSerializerImpl.java
index f4cc957f26..c2fa113d5f 100644
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointSerializerImpl.java
+++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointSerializerImpl.java
@@ -34,7 +34,7 @@ import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.FactoryExtensionPoint;
-import org.apache.tuscany.sca.core.assembly.EndpointSerializer;
+import org.apache.tuscany.sca.runtime.EndpointSerializer;
public class EndpointSerializerImpl implements EndpointSerializer {
private XMLInputFactory inputFactory;
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java
index 3876776846..357d19091b 100644
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java
+++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointImpl.java
@@ -27,7 +27,7 @@ import java.io.ObjectOutput;
import org.apache.tuscany.sca.assembly.impl.EndpointImpl;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.core.assembly.EndpointSerializer;
+import org.apache.tuscany.sca.runtime.EndpointSerializer;
/**
* Runtime model for Endpoint that supports java serialization
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java
index 5543ec1225..2b1c85b95a 100644
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java
+++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java
@@ -27,7 +27,7 @@ import java.io.ObjectOutput;
import org.apache.tuscany.sca.assembly.impl.EndpointReferenceImpl;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.core.assembly.EndpointSerializer;
+import org.apache.tuscany.sca.runtime.EndpointSerializer;
/**
* Runtime model for Endpoint that supports java serialization
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextExt.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextExt.java
deleted file mode 100644
index 6db3af213d..0000000000
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextExt.java
+++ /dev/null
@@ -1,31 +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.context;
-
-import org.apache.tuscany.sca.core.assembly.CompositeActivator;
-import org.apache.tuscany.sca.runtime.RuntimeComponentContext;
-
-/**
- * Extended ComponentContext
- */
-public interface ComponentContextExt extends RuntimeComponentContext {
- CompositeActivator getCompositeActivator();
- CompositeContext getCompositeContext();
-}
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/CompositeContext.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/CompositeContext.java
deleted file mode 100644
index 46643f643b..0000000000
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/CompositeContext.java
+++ /dev/null
@@ -1,222 +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.context;
-
-import java.io.IOException;
-import java.io.Reader;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.Endpoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.assembly.CompositeActivator;
-import org.apache.tuscany.sca.core.invocation.ProxyFactory;
-import org.apache.tuscany.sca.core.invocation.ThreadMessageContext;
-import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.oasisopen.sca.ServiceRuntimeException;
-
-/**
- * @version $Rev$ $Date$
- */
-public abstract class CompositeContext {
- /**
- * Create a self-reference for a component service
- * @param component
- * @param service
- * @throws CloneNotSupportedException
- * @throws InvalidInterfaceException
- */
- public abstract ComponentReference createSelfReference(Component component,
- ComponentService service,
- Class<?> businessInterface)
- throws CloneNotSupportedException, InvalidInterfaceException;
-
- /**
- * Bind a component reference to a component service
- * @param <B>
- * @param businessInterface
- * @param reference
- * @param service
- * @return
- * @throws CloneNotSupportedException
- * @throws InvalidInterfaceException
- */
- public abstract RuntimeComponentReference bindComponentReference(Class<?> businessInterface,
- RuntimeComponentReference reference,
- RuntimeComponent component,
- RuntimeComponentService service)
- throws CloneNotSupportedException, InvalidInterfaceException;
-
- /**
- * @param component
- * @param reference
- * @param writer
- * @throws IOException
- */
- public abstract void write(Component component, ComponentReference reference, Writer writer) throws IOException;
-
- /**
- * @param component
- * @param reference
- * @param service
- * @param writer
- * @throws IOException
- */
- public abstract void write(Component component,
- ComponentReference reference,
- ComponentService service,
- Writer writer) throws IOException;
-
- /**
- * @param component
- * @param reference
- * @return
- * @throws IOException
- */
- public abstract String toXML(Component component, ComponentReference reference) throws IOException;
-
- /**
- * @param component
- * @param service
- * @return
- * @throws IOException
- */
- public abstract String toXML(Component component, ComponentService service) throws IOException;
-
- /**
- * @param reader
- * @return
- * @throws IOException
- */
- public abstract RuntimeComponent read(Reader reader) throws IOException;
-
- /**
- * @param streamReader
- * @return
- * @throws IOException
- */
- public abstract RuntimeComponent read(XMLStreamReader streamReader) throws IOException;
-
- /**
- * @param xml
- * @return
- * @throws IOException
- */
- public abstract Component fromXML(String xml) throws IOException;
-
- /**
- * @param streamReader
- * @return
- * @throws IOException
- */
- public abstract Component fromXML(XMLStreamReader streamReader) throws IOException;
-
- /**
- * @return
- */
- public static RuntimeComponent getCurrentComponent() {
- Message message = ThreadMessageContext.getMessageContext();
- if (message != null) {
- Endpoint to = message.getTo();
- if (to == null) {
- return null;
- }
- RuntimeComponent component = (RuntimeComponent) message.getTo().getComponent();
- return component;
- }
- return null;
- }
-
- /**
- * @return
- */
- public static CompositeActivator getCurrentCompositeActivator() {
- RuntimeComponent component = getCurrentComponent();
- if (component != null) {
- ComponentContextExt context = (ComponentContextExt)component.getComponentContext();
- return context.getCompositeActivator();
- }
- return null;
- }
-
- /**
- * @return
- */
- public static CompositeContext getCurrentCompositeContext() {
- CompositeActivator activator = getCurrentCompositeActivator();
- if (activator != null) {
- return activator.getCompositeContext();
- }
- return null;
- }
-
- /**
- * @param component
- */
- public static ComponentService getSingleService(Component component) {
- ComponentService targetService;
- List<ComponentService> services = component.getServices();
- List<ComponentService> regularServices = new ArrayList<ComponentService>();
- for (ComponentService service : services) {
- if (service.isForCallback()) {
- continue;
- }
- String name = service.getName();
- if (!name.startsWith("$") || name.startsWith("$dynamic$")) {
- regularServices.add(service);
- }
- }
- if (regularServices.size() == 0) {
- throw new ServiceRuntimeException("No service is declared on component " + component.getURI());
- }
- if (regularServices.size() != 1) {
- throw new ServiceRuntimeException("More than one service is declared on component " + component.getURI()
- + ". Service name is required to get the service.");
- }
- targetService = regularServices.get(0);
- return targetService;
- }
-
- public abstract ExtensionPointRegistry getExtensionPointRegistry();
-
- /**
- * Get the java interface factory
- * @return
- */
- public abstract JavaInterfaceFactory getJavaInterfaceFactory();
-
- /**
- * Get the proxy factory
- * @return
- */
- public abstract ProxyFactory getProxyFactory();
-
-}
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ServiceReferenceExt.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ServiceReferenceExt.java
index d590e0118c..9b60415132 100644
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ServiceReferenceExt.java
+++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ServiceReferenceExt.java
@@ -20,14 +20,10 @@
package org.apache.tuscany.sca.core.context;
import java.io.Externalizable;
-import java.io.IOException;
-import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import org.apache.tuscany.sca.assembly.EndpointReference;
-import org.apache.tuscany.sca.contribution.processor.ContributionReadException;
-import org.apache.tuscany.sca.contribution.processor.ContributionWriteException;
import org.apache.tuscany.sca.runtime.RuntimeWire;
import org.oasisopen.sca.ServiceReference;
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallableReferenceImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallableReferenceImpl.java
index 86c3d2e199..d6a029cd55 100644
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallableReferenceImpl.java
+++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallableReferenceImpl.java
@@ -42,22 +42,24 @@ import org.apache.tuscany.sca.assembly.EndpointReference;
import org.apache.tuscany.sca.assembly.Service;
import org.apache.tuscany.sca.assembly.builder.BindingBuilder;
import org.apache.tuscany.sca.assembly.builder.BuilderExtensionPoint;
+import org.apache.tuscany.sca.context.CompositeContext;
import org.apache.tuscany.sca.contribution.processor.ContributionReadException;
import org.apache.tuscany.sca.contribution.processor.ContributionWriteException;
import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.FactoryExtensionPoint;
-import org.apache.tuscany.sca.core.assembly.CompositeActivator;
import org.apache.tuscany.sca.core.assembly.RuntimeAssemblyFactory;
import org.apache.tuscany.sca.core.assembly.impl.ReferenceParametersImpl;
-import org.apache.tuscany.sca.core.context.ComponentContextExt;
-import org.apache.tuscany.sca.core.context.CompositeContext;
import org.apache.tuscany.sca.core.context.ServiceReferenceExt;
import org.apache.tuscany.sca.core.factory.ObjectCreationException;
+import org.apache.tuscany.sca.core.invocation.ExtensibleProxyFactory;
import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.core.invocation.ProxyFactoryExtensionPoint;
import org.apache.tuscany.sca.interfacedef.Interface;
import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.runtime.CompositeActivator;
import org.apache.tuscany.sca.runtime.ReferenceParameters;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
@@ -200,7 +202,7 @@ public class CallableReferenceImpl<B> implements ServiceReferenceExt<B> {
this.component = (RuntimeComponent)wire.getEndpointReference().getComponent();
this.reference = (RuntimeComponentReference)wire.getEndpointReference().getReference();
this.endpointReference = wire.getEndpointReference();
- this.compositeActivator = ((ComponentContextExt)component.getComponentContext()).getCompositeActivator();
+ this.compositeActivator = component.getComponentContext().getCompositeActivator();
initCallbackID();
}
}
@@ -415,9 +417,11 @@ public class CallableReferenceImpl<B> implements ServiceReferenceExt<B> {
return Thread.currentThread().getContextClassLoader();
}
});
+
javaInterface.setJavaClass(classLoader.loadClass(javaInterface.getName()));
- compositeActivator.getCompositeContext().getJavaInterfaceFactory()
- .createJavaInterface(javaInterface, javaInterface.getJavaClass());
+ JavaInterfaceFactory javaInterfaceFactory = getJavaInterfaceFactory(compositeActivator);
+
+ javaInterfaceFactory.createJavaInterface(javaInterface, javaInterface.getJavaClass());
//FIXME: If the interface needs XSDs to be loaded (e.g., for static SDO),
// this needs to be done here. We usually search for XSDs in the current
// contribution at resolve time. Is it possible to locate the current
@@ -434,14 +438,27 @@ public class CallableReferenceImpl<B> implements ServiceReferenceExt<B> {
}
}
- this.proxyFactory = compositeActivator.getCompositeContext().getProxyFactory();
+ this.proxyFactory = getProxyFactory(this.compositeActivator);
} else if (compositeActivator == null) {
this.compositeActivator = CompositeContext.getCurrentCompositeActivator();
if (this.compositeActivator != null) {
- this.proxyFactory = this.compositeActivator.getCompositeContext().getProxyFactory();
+ this.proxyFactory = getProxyFactory(this.compositeActivator);
}
}
}
+
+ private JavaInterfaceFactory getJavaInterfaceFactory(CompositeActivator activator) {
+ ExtensionPointRegistry extensionPointRegistry = activator.getCompositeContext().getExtensionPointRegistry();
+ FactoryExtensionPoint factories = extensionPointRegistry.getExtensionPoint(FactoryExtensionPoint.class);
+ JavaInterfaceFactory javaInterfaceFactory = factories.getFactory(JavaInterfaceFactory.class);
+ return javaInterfaceFactory;
+ }
+
+ private ProxyFactory getProxyFactory(CompositeActivator activator) {
+ ExtensionPointRegistry extensionPointRegistry = activator.getCompositeContext().getExtensionPointRegistry();
+ ProxyFactoryExtensionPoint proxyFactories = extensionPointRegistry.getExtensionPoint(ProxyFactoryExtensionPoint.class);
+ return new ExtensibleProxyFactory(proxyFactories);
+ }
// ==================================================================================
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallbackServiceReferenceImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallbackServiceReferenceImpl.java
index 31db699063..5218a7fd01 100644
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallbackServiceReferenceImpl.java
+++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallbackServiceReferenceImpl.java
@@ -24,9 +24,9 @@ import java.util.List;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.assembly.Endpoint;
import org.apache.tuscany.sca.assembly.EndpointReference;
+import org.apache.tuscany.sca.context.ThreadMessageContext;
import org.apache.tuscany.sca.core.assembly.impl.RuntimeWireImpl;
import org.apache.tuscany.sca.core.invocation.ProxyFactory;
-import org.apache.tuscany.sca.core.invocation.ThreadMessageContext;
import org.apache.tuscany.sca.invocation.Message;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
import org.apache.tuscany.sca.runtime.RuntimeWire;
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ComponentContextImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ComponentContextImpl.java
index 21f907608c..fa8c1a4dfa 100644
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ComponentContextImpl.java
+++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ComponentContextImpl.java
@@ -37,15 +37,13 @@ import org.apache.tuscany.sca.assembly.OptimizableBinding;
import org.apache.tuscany.sca.assembly.Reference;
import org.apache.tuscany.sca.assembly.Service;
import org.apache.tuscany.sca.assembly.builder.EndpointReferenceBuilder;
+import org.apache.tuscany.sca.context.CompositeContext;
import org.apache.tuscany.sca.context.ContextFactoryExtensionPoint;
import org.apache.tuscany.sca.context.PropertyValueFactory;
import org.apache.tuscany.sca.context.RequestContextFactory;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.FactoryExtensionPoint;
import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.core.assembly.CompositeActivator;
-import org.apache.tuscany.sca.core.context.ComponentContextExt;
-import org.apache.tuscany.sca.core.context.CompositeContext;
import org.apache.tuscany.sca.core.invocation.ExtensibleProxyFactory;
import org.apache.tuscany.sca.core.invocation.ProxyFactory;
import org.apache.tuscany.sca.core.invocation.ProxyFactoryExtensionPoint;
@@ -57,7 +55,9 @@ import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
import org.apache.tuscany.sca.monitor.Monitor;
import org.apache.tuscany.sca.monitor.MonitorFactory;
import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.runtime.CompositeActivator;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentContext;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.oasisopen.sca.RequestContext;
@@ -70,7 +70,7 @@ import org.oasisopen.sca.ServiceRuntimeException;
*
* @version $Rev$ $Date$
*/
-public class ComponentContextImpl implements ComponentContextExt {
+public class ComponentContextImpl implements RuntimeComponentContext {
private final RuntimeComponent component;
private final CompositeActivator compositeActivator;
@@ -87,8 +87,11 @@ public class ComponentContextImpl implements ComponentContextExt {
FactoryExtensionPoint factories = registry.getExtensionPoint(FactoryExtensionPoint.class);
this.assemblyFactory = factories.getFactory(AssemblyFactory.class);
this.javaInterfaceFactory = factories.getFactory(JavaInterfaceFactory.class);
+
+ // FIXME: We need to have node-specific compositeActivator
UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
this.compositeActivator = utilities.getUtility(CompositeActivator.class);
+
this.requestContextFactory =
registry.getExtensionPoint(ContextFactoryExtensionPoint.class).getFactory(RequestContextFactory.class);
this.proxyFactory = new ExtensibleProxyFactory(registry.getExtensionPoint(ProxyFactoryExtensionPoint.class));
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CompositeContextImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CompositeContextImpl.java
index 1fa976cfb7..b26861aa79 100644
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CompositeContextImpl.java
+++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CompositeContextImpl.java
@@ -44,23 +44,23 @@ import org.apache.tuscany.sca.assembly.Multiplicity;
import org.apache.tuscany.sca.assembly.OptimizableBinding;
import org.apache.tuscany.sca.assembly.Reference;
import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.context.CompositeContext;
+import org.apache.tuscany.sca.context.ThreadMessageContext;
import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.FactoryExtensionPoint;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.core.assembly.CompositeActivator;
-import org.apache.tuscany.sca.core.context.CompositeContext;
import org.apache.tuscany.sca.core.invocation.ExtensibleProxyFactory;
import org.apache.tuscany.sca.core.invocation.ProxyFactory;
import org.apache.tuscany.sca.core.invocation.ProxyFactoryExtensionPoint;
-import org.apache.tuscany.sca.core.invocation.ThreadMessageContext;
import org.apache.tuscany.sca.interfacedef.Interface;
import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.runtime.CompositeActivator;
+import org.apache.tuscany.sca.runtime.EndpointRegistry;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
@@ -71,25 +71,27 @@ import org.oasisopen.sca.ServiceRuntimeException;
*/
public class CompositeContextImpl extends CompositeContext {
private final ExtensionPointRegistry extensionPointRegistry;
- private final UtilityExtensionPoint utilityExtensionPoint;
+ private final EndpointRegistry endpointRegistry;
private final AssemblyFactory assemblyFactory;
private final JavaInterfaceFactory javaInterfaceFactory;
private final StAXArtifactProcessorExtensionPoint staxProcessors;
private final XMLInputFactory xmlInputFactory;
private final XMLOutputFactory xmlOutputFactory;
- private final ProxyFactory proxyFactory;
- public CompositeContextImpl(ExtensionPointRegistry registry) {
+ public CompositeContextImpl(ExtensionPointRegistry registry, EndpointRegistry endpointRegistry) {
this.extensionPointRegistry = registry;
- this.utilityExtensionPoint = extensionPointRegistry.getExtensionPoint(UtilityExtensionPoint.class);
+ this.endpointRegistry = endpointRegistry;
FactoryExtensionPoint factories = registry.getExtensionPoint(FactoryExtensionPoint.class);
this.xmlInputFactory = factories.getFactory(XMLInputFactory.class);
this.xmlOutputFactory = factories.getFactory(XMLOutputFactory.class);
this.assemblyFactory = factories.getFactory(AssemblyFactory.class);
this.javaInterfaceFactory = factories.getFactory(JavaInterfaceFactory.class);
this.staxProcessors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ }
+
+ private ProxyFactory getProxyFactory() {
ProxyFactoryExtensionPoint proxyFactories = extensionPointRegistry.getExtensionPoint(ProxyFactoryExtensionPoint.class);
- this.proxyFactory = new ExtensibleProxyFactory(proxyFactories);
+ return new ExtensibleProxyFactory(proxyFactories);
}
/**
@@ -331,20 +333,8 @@ public class CompositeContextImpl extends CompositeContext {
return extensionPointRegistry;
}
- /**
- * Get the java interface factory
- * @return
- */
- public JavaInterfaceFactory getJavaInterfaceFactory() {
- return javaInterfaceFactory;
- }
-
- /**
- * Get the proxy factory
- * @return
- */
- public ProxyFactory getProxyFactory() {
- return proxyFactory;
+ public EndpointRegistry getEndpointRegistry() {
+ return endpointRegistry;
}
}
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/RequestContextImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/RequestContextImpl.java
index a4ea709fa1..e8a1254dc9 100644
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/RequestContextImpl.java
+++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/RequestContextImpl.java
@@ -23,11 +23,11 @@ import java.util.List;
import javax.security.auth.Subject;
import org.apache.tuscany.sca.assembly.Endpoint;
+import org.apache.tuscany.sca.context.ThreadMessageContext;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.invocation.ExtensibleProxyFactory;
import org.apache.tuscany.sca.core.invocation.ProxyFactory;
import org.apache.tuscany.sca.core.invocation.ProxyFactoryExtensionPoint;
-import org.apache.tuscany.sca.core.invocation.ThreadMessageContext;
import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
import org.apache.tuscany.sca.invocation.Message;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ServiceReferenceImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ServiceReferenceImpl.java
index edd11aacc5..20b607ce74 100644
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ServiceReferenceImpl.java
+++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ServiceReferenceImpl.java
@@ -21,8 +21,8 @@ package org.apache.tuscany.sca.core.context.impl;
import javax.xml.stream.XMLStreamReader;
import org.apache.tuscany.sca.assembly.EndpointReference;
-import org.apache.tuscany.sca.core.assembly.CompositeActivator;
import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.runtime.CompositeActivator;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
import org.apache.tuscany.sca.runtime.RuntimeWire;
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java
index b08ded18c4..ec2f0a0664 100644
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java
+++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java
@@ -26,6 +26,7 @@ import java.util.logging.Logger;
import org.apache.tuscany.sca.assembly.Endpoint;
import org.apache.tuscany.sca.assembly.EndpointReference;
+import org.apache.tuscany.sca.context.ThreadMessageContext;
import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Invoker;
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java
index 7901a7fa55..0b50cbb2d3 100644
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java
+++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java
@@ -22,6 +22,7 @@ package org.apache.tuscany.sca.core.invocation;
import java.lang.reflect.InvocationTargetException;
import org.apache.tuscany.sca.assembly.EndpointReference;
+import org.apache.tuscany.sca.context.ThreadMessageContext;
import org.apache.tuscany.sca.core.factory.InstanceWrapper;
import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.invocation.InvocationChain;
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ThreadMessageContext.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ThreadMessageContext.java
deleted file mode 100644
index 13ce6510ae..0000000000
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ThreadMessageContext.java
+++ /dev/null
@@ -1,81 +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.invocation;
-
-import org.apache.tuscany.sca.core.invocation.impl.MessageImpl;
-import org.apache.tuscany.sca.invocation.Message;
-
-/**
- * Class for tunnelling a WorkContext through the invocation of a user class.
- *
- * @version $Rev$ $Date$
- */
-public final class ThreadMessageContext {
-
- private static final ThreadLocal<Message> CONTEXT = new ThreadLocal<Message>() {
- @Override
- protected synchronized Message initialValue() {
- //Message msg = new MessageImpl();
- // TODO - EPR - What to set as default?
- //msg.setFrom(new EndpointReferenceImpl("/"));
- return null;//msg;
- }
- };
-
- private ThreadMessageContext() {
- }
-
- /**
- * Set the WorkContext for the current thread.
- * The current work context is returned and must be restored after the invocation is complete.
- * Typical usage would be:
- * <pre>
- * WorkContext old = PojoWorkContextTunnel.setThreadWorkContext(newContext);
- * try {
- * ... invoke user code ...
- * } finally {
- * PojoWorkContextTunnel.setThreadWorkContext(old);
- * }
- * </pre>
- * @param context
- * @return the current work context for the thread; this must be restored after the invocation is made
- */
- public static Message setMessageContext(Message context) {
- Message old = CONTEXT.get();
- CONTEXT.set(context);
- return old;
- }
-
- /**
- * Returns the WorkContext for the current thread.
- *
- * @return the WorkContext for the current thread
- */
- public static Message getMessageContext() {
- return CONTEXT.get();
- }
-
- /**
- * Removes and state from the current thread to ensure that
- * any associated classloaders can be GCd
- */
- public static void removeMessageContext() {
- CONTEXT.remove();
- }
-}
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKInvocationHandler.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKInvocationHandler.java
index 5e36d724f5..148749922e 100644
--- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKInvocationHandler.java
+++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKInvocationHandler.java
@@ -29,9 +29,9 @@ import java.util.Map;
import org.apache.tuscany.sca.assembly.Endpoint;
import org.apache.tuscany.sca.assembly.EndpointReference;
+import org.apache.tuscany.sca.context.ThreadMessageContext;
import org.apache.tuscany.sca.core.context.ServiceReferenceExt;
import org.apache.tuscany.sca.core.factory.InstanceWrapper;
-import org.apache.tuscany.sca.core.invocation.ThreadMessageContext;
import org.apache.tuscany.sca.core.scope.TargetResolutionException;
import org.apache.tuscany.sca.interfacedef.DataType;
import org.apache.tuscany.sca.interfacedef.Operation;
diff --git a/java/sca/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.conversation.ConversationManager b/java/sca/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.conversation.ConversationManager
deleted file mode 100644
index 67cec934b4..0000000000
--- a/java/sca/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.conversation.ConversationManager
+++ /dev/null
@@ -1,18 +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.
-
-org.apache.tuscany.sca.core.conversation.impl.ConversationManagerImpl
diff --git a/java/sca/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.assembly.CompositeActivator b/java/sca/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.runtime.CompositeActivator
index d5e13292d2..d5e13292d2 100644
--- a/java/sca/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.assembly.CompositeActivator
+++ b/java/sca/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.runtime.CompositeActivator
diff --git a/java/sca/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.assembly.EndpointSerializer b/java/sca/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.runtime.EndpointSerializer
index cc3306b325..cc3306b325 100644
--- a/java/sca/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.assembly.EndpointSerializer
+++ b/java/sca/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.runtime.EndpointSerializer