diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2008-12-04 06:05:21 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2008-12-04 06:05:21 +0000 |
commit | 8d4370a11f701a919715e7b9df1f69ca71574c3a (patch) | |
tree | f9e2e2f653d61b0fc38f2cb3b4e43f0ea37c228f | |
parent | cc1d347487ed1badb0eb3da1201acfad71714f81 (diff) |
Refactor the tuscany-core module to move private classes out of the SPI packages
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@723218 13f79535-47bb-0310-9956-ffa450edef68
93 files changed, 667 insertions, 455 deletions
diff --git a/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/module/DataBindingModuleActivator.java b/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/module/DataBindingModuleActivator.java index c9ee4e485f..06d742e014 100644 --- a/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/module/DataBindingModuleActivator.java +++ b/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/module/DataBindingModuleActivator.java @@ -24,13 +24,10 @@ import org.apache.tuscany.sca.core.FactoryExtensionPoint; import org.apache.tuscany.sca.core.ModuleActivator; import org.apache.tuscany.sca.core.databinding.processor.DataBindingJavaInterfaceProcessor; import org.apache.tuscany.sca.core.databinding.transformers.Array2ArrayTransformer; -import org.apache.tuscany.sca.core.databinding.transformers.CallableReference2XMLStreamReader; -import org.apache.tuscany.sca.core.databinding.transformers.CallableReferenceDataBinding; import org.apache.tuscany.sca.core.databinding.transformers.CallableReferenceXMLAdapter; import org.apache.tuscany.sca.core.databinding.transformers.Exception2ExceptionTransformer; import org.apache.tuscany.sca.core.databinding.transformers.Input2InputTransformer; import org.apache.tuscany.sca.core.databinding.transformers.Output2OutputTransformer; -import org.apache.tuscany.sca.core.databinding.transformers.XMLStreamReader2CallableReference; import org.apache.tuscany.sca.core.databinding.wire.DataBindingRuntimeWireProcessor; import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint; import org.apache.tuscany.sca.databinding.TransformerExtensionPoint; @@ -77,9 +74,9 @@ public class DataBindingModuleActivator implements ModuleActivator { group2GroupTransformer.setMediator(mediator); transformers.addTransformer(group2GroupTransformer, true); - dataBindings.addDataBinding(new CallableReferenceDataBinding()); - transformers.addTransformer(new CallableReference2XMLStreamReader(), true); - transformers.addTransformer(new XMLStreamReader2CallableReference(), false); +// dataBindings.addDataBinding(new CallableReferenceDataBinding()); +// transformers.addTransformer(new CallableReference2XMLStreamReader(), true); +// transformers.addTransformer(new XMLStreamReader2CallableReference(), false); FactoryExtensionPoint modelFactories = registry.getExtensionPoint(FactoryExtensionPoint.class); JavaInterfaceFactory javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class); diff --git a/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReference2XMLStreamReader.java b/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReference2XMLStreamReader.java index 124928db24..76272f53dc 100644 --- a/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReference2XMLStreamReader.java +++ b/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReference2XMLStreamReader.java @@ -20,7 +20,7 @@ package org.apache.tuscany.sca.core.databinding.transformers; import javax.xml.stream.XMLStreamReader;
-import org.apache.tuscany.sca.core.context.CallableReferenceImpl;
+import org.apache.tuscany.sca.core.context.CallableReferenceExt;
import org.apache.tuscany.sca.databinding.PullTransformer;
import org.apache.tuscany.sca.databinding.TransformationContext;
import org.apache.tuscany.sca.databinding.TransformationException;
@@ -44,12 +44,12 @@ public class CallableReference2XMLStreamReader extends BaseTransformer<CallableR public XMLStreamReader transform(CallableReference source, TransformationContext context) {
try {
if (source != null) {
- if (source instanceof CallableReferenceImpl) {
- XMLStreamReader xmlReader = ((CallableReferenceImpl)source).getXMLReader();
+ if (source instanceof CallableReferenceExt) {
+ XMLStreamReader xmlReader = ((CallableReferenceExt)source).getXMLReader();
if (xmlReader != null) {
return xmlReader;
} else {
- String xmlString = ((CallableReferenceImpl)source).toXMLString();
+ String xmlString = ((CallableReferenceExt)source).toXMLString();
// remove "<?xml...?>" processing instruction and wrap with a top-level element
return StAXHelper.createXMLStreamReader("<reference xmlns=\"http://callable\">"
diff --git a/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReferenceXMLAdapter.java b/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReferenceXMLAdapter.java index ff6e444dcd..09b2b53306 100644 --- a/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReferenceXMLAdapter.java +++ b/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReferenceXMLAdapter.java @@ -19,43 +19,32 @@ package org.apache.tuscany.sca.core.databinding.transformers; -import java.io.StringReader; -import java.io.StringWriter; - import javax.xml.bind.annotation.adapters.XmlAdapter; -import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamReader; -import javax.xml.transform.Source; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.stream.StreamResult; -import javax.xml.transform.stream.StreamSource; -import org.apache.tuscany.sca.databinding.xml.XMLStreamReader2String; +import org.apache.tuscany.sca.databinding.xml.Node2XMLStreamReader; +import org.apache.tuscany.sca.databinding.xml.XMLStreamReader2Node; import org.osoa.sca.CallableReference; +import org.w3c.dom.Element; /** * @version $Rev$ $Date$ */ -public class CallableReferenceXMLAdapter extends XmlAdapter<Source, CallableReference> { - private TransformerFactory transformerFactory = TransformerFactory.newInstance(); - private XMLInputFactory inputFactory = XMLInputFactory.newInstance(); +public class CallableReferenceXMLAdapter extends XmlAdapter<Element, CallableReference> { @Override - public CallableReference unmarshal(Source v) throws Exception { - StringWriter sw = new StringWriter(); - StreamResult result = new StreamResult(sw); - transformerFactory.newTransformer().transform(v, result); - XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(sw.toString())); + public CallableReference unmarshal(Element v) throws Exception { + Node2XMLStreamReader tf = new Node2XMLStreamReader(); + XMLStreamReader reader = tf.transform(v, null); XMLStreamReader2CallableReference t2 = new XMLStreamReader2CallableReference(); return t2.transform(reader, null); } @Override - public Source marshal(CallableReference v) throws Exception { + public Element marshal(CallableReference v) throws Exception { CallableReference2XMLStreamReader t = new CallableReference2XMLStreamReader(); XMLStreamReader reader = t.transform(v, null); - XMLStreamReader2String t2 = new XMLStreamReader2String(); - String xml = t2.transform(reader, null); - return new StreamSource(new StringReader(xml)); + XMLStreamReader2Node t2 = new XMLStreamReader2Node(); + return (Element) t2.transform(reader, null); } } diff --git a/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/XMLStreamReader2CallableReference.java b/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/XMLStreamReader2CallableReference.java index 841efa9398..3e8ada594c 100644 --- a/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/XMLStreamReader2CallableReference.java +++ b/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/XMLStreamReader2CallableReference.java @@ -26,8 +26,8 @@ import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
-import org.apache.tuscany.sca.core.context.CallableReferenceImpl;
-import org.apache.tuscany.sca.core.context.ServiceReferenceImpl;
+import org.apache.tuscany.sca.core.context.CallableReferenceExt;
+import org.apache.tuscany.sca.core.context.ServiceReferenceExt;
import org.apache.tuscany.sca.databinding.PullTransformer;
import org.apache.tuscany.sca.databinding.TransformationContext;
import org.apache.tuscany.sca.databinding.TransformationException;
@@ -40,18 +40,19 @@ public class XMLStreamReader2CallableReference extends BaseTransformer<XMLStream private static final String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
private static final String COMPOSITE = "composite";
- public static final QName COMPOSITE_QNAME = new QName(SCA10_NS, COMPOSITE);
+ private static final QName COMPOSITE_QNAME = new QName(SCA10_NS, COMPOSITE);
public CallableReference transform(XMLStreamReader source, TransformationContext context) {
try {
if (source != null) {
skipTopLevelElement(source);
- Class refType = context.getTargetDataType().getPhysical();
+ Class refType =
+ context == null ? CallableReferenceExt.class : context.getTargetDataType().getPhysical();
Class implType;
- if (refType.isAssignableFrom(CallableReferenceImpl.class)) {
- implType = CallableReferenceImpl.class;
- } else if (refType.isAssignableFrom(ServiceReferenceImpl.class)) {
- implType = ServiceReferenceImpl.class;
+ if (refType.isAssignableFrom(CallableReferenceExt.class)) {
+ implType = CallableReferenceExt.class;
+ } else if (refType.isAssignableFrom(ServiceReferenceExt.class)) {
+ implType = ServiceReferenceExt.class;
} else {
throw new TransformationException("Unrecognized transformation target type");
}
diff --git a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/RequestContextFactory.java b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/RequestContextFactory.java index 546757c766..d4952adde9 100644 --- a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/RequestContextFactory.java +++ b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/RequestContextFactory.java @@ -18,6 +18,7 @@ */ package org.apache.tuscany.sca.context; +import org.apache.tuscany.sca.runtime.RuntimeComponent; import org.osoa.sca.RequestContext; /** @@ -29,5 +30,5 @@ public interface RequestContextFactory { /** * @return An instance of RequestContext for the current invocation */ - RequestContext createRequestContext(); + RequestContext createRequestContext(RuntimeComponent component); } diff --git a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentContext.java b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentContext.java index 801bb9e294..10f3c19550 100644 --- a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentContext.java +++ b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentContext.java @@ -25,6 +25,8 @@ import java.io.Writer; import org.apache.tuscany.sca.assembly.Binding; import org.apache.tuscany.sca.assembly.ComponentService; +import org.apache.tuscany.sca.context.PropertyValueFactory; +import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.osoa.sca.CallableReference; import org.osoa.sca.ComponentContext; import org.osoa.sca.ServiceReference; @@ -101,4 +103,7 @@ public interface RuntimeComponentContext extends ComponentContext { * @return */ <B> ServiceReference<B> createSelfReference(Class<B> businessInterface, ComponentService service); + + ExtensionPointRegistry getExtensionPointRegistry(); + void setPropertyValueFactory(PropertyValueFactory propertyValueFactory); } diff --git a/java/sca/modules/core/META-INF/MANIFEST.MF b/java/sca/modules/core/META-INF/MANIFEST.MF index 3a87219d28..a4fc2ccd70 100644 --- a/java/sca/modules/core/META-INF/MANIFEST.MF +++ b/java/sca/modules/core/META-INF/MANIFEST.MF @@ -1,43 +1,42 @@ Manifest-Version: 1.0
-Export-Package: org.apache.tuscany.sca.core.assembly;uses:="org.apache
- .tuscany.sca.runtime,org.apache.tuscany.sca.context,org.apache.tuscan
- y.sca.provider,org.apache.tuscany.sca.core.context,org.apache.tuscany
- .sca.assembly.impl,org.apache.tuscany.sca.core,org.apache.tuscany.sca
- .core.conversation,javax.xml.namespace,javax.xml.stream,org.apache.tu
- scany.sca.endpointresolver,org.apache.tuscany.sca.contribution.resolv
- er,org.apache.tuscany.sca.core.invocation,org.osoa.sca,org.apache.tus
- cany.sca.core.scope,org.apache.tuscany.sca.assembly,org.apache.tuscan
- y.sca.monitor,org.apache.tuscany.sca.interfacedef.java,org.apache.tus
- cany.sca.interfacedef,org.apache.tuscany.sca.invocation,org.apache.tu
- scany.sca.work,org.apache.tuscany.sca.contribution.processor";version
- ="1.4",org.apache.tuscany.sca.core.work;uses:="javax.naming,org.osoa.
- sca.annotations,org.apache.tuscany.sca.work";version="1.
- 4",org.apache.tuscany.sca.core.context;uses:="org.apache.tuscany.sca.
- runtime,org.apache.tuscany.sca.assembly,org.apache.tuscany.sca.contex
- t,javax.security.auth,org.apache.tuscany.sca.monitor,org.apache.tusca
- ny.sca.interfacedef.java,org.apache.tuscany.sca.core.conversation,org
- .apache.tuscany.sca.interfacedef,javax.xml.namespace,org.apache.tusca
- ny.sca.invocation,javax.xml.stream,org.apache.tuscany.sca.core.assemb
- ly,org.apache.tuscany.sca.core.factory,org.apache.tuscany.sca.contrib
- ution.processor,org.osoa.sca,org.apache.tuscany.sca.core.invocation,o
- rg.apache.tuscany.sca.core.scope,org.apache.tuscany.sca.assembly.buil
- der";version="1.4",org.apache.tuscany.sca.core.factory;version="1.4",
- org.apache.tuscany.sca.core.invocation;uses:="org.apache.tuscany.sca.
- runtime,org.apache.tuscany.sca.interfacedef.util,org.apache.tuscany.s
- ca.assembly,net.sf.cglib.proxy,org.apache.tuscany.sca.provider,org.ap
- ache.tuscany.sca.core.context,org.apache.tuscany.sca.core,org.apache.
- tuscany.sca.core.conversation,org.apache.tuscany.sca.interfacedef.jav
- a,org.apache.tuscany.sca.extensibility,org.apache.tuscany.sca.interfa
- cedef,org.apache.tuscany.sca.invocation,org.apache.tuscany.sca.core.a
- ssembly,org.apache.tuscany.sca.work,org.apache.tuscany.sca.core.facto
- ry,org.osoa.sca,org.apache.tuscany.sca.core.scope";version="1.4",org.
- apache.tuscany.sca.core.conversation;uses:="org.apache.tuscany.sca.ru
- ntime,org.apache.tuscany.sca.provider,org.osoa.sca,org.apache.tuscany
- .sca.core.scope";version="1.4",org.apache.tuscany.sca.core.scope;uses
- :="org.apache.tuscany.sca.invocation,org.apache.tuscany.sca.runtime,o
- rg.apache.tuscany.sca.provider,org.apache.tuscany.sca.core.context,or
- g.apache.tuscany.sca.core.invocation,org.apache.tuscany.sca.core.conv
- ersation";version="1.4"
+Export-Package: org.apache.tuscany.sca.core.assembly;version="1.4";
+ uses:="org.apache.tuscany.sca.runtime,
+ org.apache.tuscany.sca.assembly,
+ org.apache.tuscany.sca.core.context,
+ org.apache.tuscany.sca.core.invocation,
+ org.apache.tuscany.sca.core.conversation,
+ org.apache.tuscany.sca.interfacedef.java",
+ org.apache.tuscany.sca.core.context;version="1.4";
+ uses:="org.apache.tuscany.sca.runtime,
+ org.apache.tuscany.sca.assembly,
+ org.apache.tuscany.sca.context,
+ org.apache.tuscany.sca.core,
+ org.apache.tuscany.sca.core.conversation,
+ org.apache.tuscany.sca.interfacedef.java,
+ org.apache.tuscany.sca.interfacedef,
+ javax.xml.stream,
+ org.apache.tuscany.sca.core.assembly,
+ org.osoa.sca,
+ org.apache.tuscany.sca.core.invocation",
+ org.apache.tuscany.sca.core.conversation;version="1.4";uses:="org.apache.tuscany.sca.runtime,org.osoa.sca",
+ org.apache.tuscany.sca.core.factory;version="1.4",
+ org.apache.tuscany.sca.core.invocation;version="1.4";
+ uses:="org.apache.tuscany.sca.runtime,
+ org.apache.tuscany.sca.assembly,
+ org.apache.tuscany.sca.core,
+ org.apache.tuscany.sca.core.conversation,
+ org.apache.tuscany.sca.interfacedef,
+ org.apache.tuscany.sca.invocation,
+ org.apache.tuscany.sca.core.invocation.impl,
+ org.apache.tuscany.sca.work,
+ org.apache.tuscany.sca.core.factory,
+ org.osoa.sca",
+ org.apache.tuscany.sca.core.scope;version="1.4";
+ uses:="org.apache.tuscany.sca.runtime,
+ org.apache.tuscany.sca.provider,
+ org.apache.tuscany.sca.core.scope.impl,
+ org.apache.tuscany.sca.core.factory",
+ org.apache.tuscany.sca.core.work;version="1.4";uses:="javax.naming,org.osoa.sca.annotations,org.apache.tuscany.sca.work"
Tool: Bnd-0.0.255
Bundle-Name: Apache Tuscany SCA Core Runtime
Created-By: 1.6.0_07 (Sun Microsystems Inc.)
@@ -51,7 +50,6 @@ Import-Package: javax.naming, javax.security.auth,
javax.xml.namespace,
javax.xml.stream,
-
net.sf.cglib.proxy,
org.apache.tuscany.sca.assembly;version="1.4",
org.apache.tuscany.sca.assembly.builder;version="1.4",
@@ -80,7 +78,6 @@ Import-Package: javax.naming, org.apache.tuscany.sca.provider;version="1.4",
org.apache.tuscany.sca.runtime;version="1.4",
org.apache.tuscany.sca.work;version="1.4",
-
org.osoa.sca;version="1.4",
org.osoa.sca.annotations;version="1.4"
Bundle-SymbolicName: org.apache.tuscany.sca.core
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 index 29dcc20f0b..24be299581 100644 --- 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 @@ -21,7 +21,7 @@ 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.ComponentContextHelper; +import org.apache.tuscany.sca.core.context.CompositeContext; import org.apache.tuscany.sca.core.conversation.ConversationManager; import org.apache.tuscany.sca.core.invocation.ProxyFactory; import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; @@ -110,7 +110,7 @@ public interface CompositeActivator { * Get the component context helper * @return */ - ComponentContextHelper getComponentContextHelper(); + CompositeContext getCompositeContext(); /** * Get the proxy factory diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeAssemblyFactory.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeAssemblyFactory.java index b174dea6ce..a60a57e5bc 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeAssemblyFactory.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeAssemblyFactory.java @@ -24,6 +24,9 @@ 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.DefaultAssemblyFactory; +import org.apache.tuscany.sca.core.assembly.impl.RuntimeComponentImpl; +import org.apache.tuscany.sca.core.assembly.impl.RuntimeComponentReferenceImpl; +import org.apache.tuscany.sca.core.assembly.impl.RuntimeComponentServiceImpl; /** * The runtime version of assembly factory diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivatorImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/CompositeActivatorImpl.java index a657ecb19c..5d8fdecc2f 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivatorImpl.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/CompositeActivatorImpl.java @@ -17,7 +17,7 @@ * under the License. */ -package org.apache.tuscany.sca.core.assembly; +package org.apache.tuscany.sca.core.assembly.impl; import java.security.AccessController; import java.security.PrivilegedAction; @@ -36,7 +36,6 @@ import org.apache.tuscany.sca.assembly.Endpoint; import org.apache.tuscany.sca.assembly.Implementation; import org.apache.tuscany.sca.assembly.OptimizableBinding; import org.apache.tuscany.sca.assembly.Reference; -import org.apache.tuscany.sca.assembly.SCABindingFactory; import org.apache.tuscany.sca.assembly.Service; import org.apache.tuscany.sca.context.ContextFactoryExtensionPoint; import org.apache.tuscany.sca.context.RequestContextFactory; @@ -44,18 +43,20 @@ import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtens 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.context.ComponentContextHelper; -import org.apache.tuscany.sca.core.context.ComponentContextImpl; +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.ComponentContextImpl; import org.apache.tuscany.sca.core.conversation.ConversationManager; import org.apache.tuscany.sca.core.invocation.ExtensibleProxyFactory; import org.apache.tuscany.sca.core.invocation.ExtensibleWireProcessor; import org.apache.tuscany.sca.core.invocation.ProxyFactory; import org.apache.tuscany.sca.core.invocation.ProxyFactoryExtensionPoint; -import org.apache.tuscany.sca.core.scope.ConversationalScopeContainer; import org.apache.tuscany.sca.core.scope.Scope; 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.core.scope.impl.ConversationalScopeContainer; import org.apache.tuscany.sca.endpointresolver.EndpointResolver; import org.apache.tuscany.sca.endpointresolver.EndpointResolverFactory; import org.apache.tuscany.sca.endpointresolver.EndpointResolverFactoryExtensionPoint; @@ -101,7 +102,7 @@ public class CompositeActivatorImpl implements CompositeActivator { private final JavaInterfaceFactory javaInterfaceFactory; private final ConversationManager conversationManager; - private final ComponentContextHelper componentContextHelper; + private final CompositeContext componentContextHelper; private Composite domainComposite; @@ -123,36 +124,7 @@ public class CompositeActivatorImpl implements CompositeActivator { proxyFactory = new ExtensibleProxyFactory(proxyFactories); this.conversationManager = utilities.getUtility(ConversationManager.class); StAXArtifactProcessorExtensionPoint processors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class); - this.componentContextHelper = new ComponentContextHelper(assemblyFactory, javaInterfaceFactory, processors); - } - - public CompositeActivatorImpl(AssemblyFactory assemblyFactory, - MessageFactory messageFactory, - JavaInterfaceFactory javaInterfaceFactory, - SCABindingFactory scaBindingFactory, - InterfaceContractMapper interfaceContractMapper, - ScopeRegistry scopeRegistry, - WorkScheduler workScheduler, - RuntimeWireProcessor wireProcessor, - RequestContextFactory requestContextFactory, - ProxyFactory proxyFactory, - ProviderFactoryExtensionPoint providerFactories, - EndpointResolverFactoryExtensionPoint endpointResolverFactories, - StAXArtifactProcessorExtensionPoint processors, - ConversationManager conversationManager) { - this.assemblyFactory = assemblyFactory; - this.messageFactory = messageFactory; - this.interfaceContractMapper = interfaceContractMapper; - this.scopeRegistry = scopeRegistry; - this.workScheduler = workScheduler; - this.wireProcessor = wireProcessor; - this.providerFactories = providerFactories; - this.endpointResolverFactories = endpointResolverFactories; - this.javaInterfaceFactory = javaInterfaceFactory; - this.requestContextFactory = requestContextFactory; - this.proxyFactory = proxyFactory; - this.conversationManager = conversationManager; - this.componentContextHelper = new ComponentContextHelper(assemblyFactory, javaInterfaceFactory, processors); + this.componentContextHelper = new CompositeContext(extensionPoints); } /** @@ -1052,7 +1024,7 @@ public class CompositeActivatorImpl implements CompositeActivator { /** * @return the referenceHelper */ - public ComponentContextHelper getComponentContextHelper() { + public CompositeContext getCompositeContext() { return componentContextHelper; } diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointReferenceImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointReferenceImpl.java index 78096b20ab..022cac398a 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointReferenceImpl.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointReferenceImpl.java @@ -17,7 +17,7 @@ * under the License. */ -package org.apache.tuscany.sca.core.assembly; +package org.apache.tuscany.sca.core.assembly.impl; import org.apache.tuscany.sca.assembly.Binding; import org.apache.tuscany.sca.assembly.Contract; diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointWireImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointWireImpl.java index 4f463b105d..a87515c5cb 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointWireImpl.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointWireImpl.java @@ -17,14 +17,15 @@ * under the License. */ -package org.apache.tuscany.sca.core.assembly; +package org.apache.tuscany.sca.core.assembly.impl; import java.lang.reflect.InvocationTargetException; import java.util.List; import org.apache.tuscany.sca.assembly.Endpoint; import org.apache.tuscany.sca.assembly.Reference; -import org.apache.tuscany.sca.core.invocation.InvocationChainImpl; +import org.apache.tuscany.sca.core.assembly.CompositeActivator; +import org.apache.tuscany.sca.core.invocation.impl.InvocationChainImpl; import org.apache.tuscany.sca.endpointresolver.EndpointResolver; import org.apache.tuscany.sca.interfacedef.InterfaceContract; import org.apache.tuscany.sca.interfacedef.Operation; diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ReferenceParameterProcessor.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/ReferenceParameterProcessor.java index c3e5a12189..213f1d8afa 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ReferenceParameterProcessor.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/ReferenceParameterProcessor.java @@ -17,7 +17,7 @@ * under the License. */ -package org.apache.tuscany.sca.core.assembly; +package org.apache.tuscany.sca.core.assembly.impl; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ReferenceParametersImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/ReferenceParametersImpl.java index 14a5f565fc..0170af54fc 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ReferenceParametersImpl.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/ReferenceParametersImpl.java @@ -17,7 +17,7 @@ * under the License. */ -package org.apache.tuscany.sca.core.assembly; +package org.apache.tuscany.sca.core.assembly.impl; import org.apache.tuscany.sca.runtime.EndpointReference; import org.apache.tuscany.sca.runtime.ReferenceParameters; diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeComponentImpl.java index 32ac611e54..6032005b9a 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentImpl.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeComponentImpl.java @@ -17,7 +17,7 @@ * under the License. */ -package org.apache.tuscany.sca.core.assembly; +package org.apache.tuscany.sca.core.assembly.impl; import java.util.ArrayList; import java.util.List; diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentReferenceImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeComponentReferenceImpl.java index b386495a08..eda274bd29 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentReferenceImpl.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeComponentReferenceImpl.java @@ -17,7 +17,7 @@ * under the License. */ -package org.apache.tuscany.sca.core.assembly; +package org.apache.tuscany.sca.core.assembly.impl; import java.util.ArrayList; import java.util.HashMap; diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentServiceImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeComponentServiceImpl.java index af5230a163..4a25f7d4c4 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentServiceImpl.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeComponentServiceImpl.java @@ -17,7 +17,7 @@ * under the License. */ -package org.apache.tuscany.sca.core.assembly; +package org.apache.tuscany.sca.core.assembly.impl; import java.util.ArrayList; import java.util.HashMap; diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeWireImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeWireImpl.java index 9de122592f..c2c4a0a9e4 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeWireImpl.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeWireImpl.java @@ -17,7 +17,7 @@ * under the License. */ -package org.apache.tuscany.sca.core.assembly; +package org.apache.tuscany.sca.core.assembly.impl; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; @@ -29,9 +29,9 @@ import org.apache.tuscany.sca.assembly.ComponentReference; import org.apache.tuscany.sca.assembly.ComponentService; import org.apache.tuscany.sca.assembly.Contract; import org.apache.tuscany.sca.core.conversation.ConversationManager; -import org.apache.tuscany.sca.core.invocation.InvocationChainImpl; import org.apache.tuscany.sca.core.invocation.NonBlockingInterceptor; import org.apache.tuscany.sca.core.invocation.RuntimeWireInvoker; +import org.apache.tuscany.sca.core.invocation.impl.InvocationChainImpl; import org.apache.tuscany.sca.interfacedef.InterfaceContract; import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper; import org.apache.tuscany.sca.interfacedef.Operation; diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/CallableReferenceExt.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/CallableReferenceExt.java new file mode 100644 index 0000000000..ffa55d583a --- /dev/null +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/CallableReferenceExt.java @@ -0,0 +1,66 @@ +/* + * 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.Externalizable; +import java.io.IOException; + +import javax.xml.stream.XMLStreamReader; + +import org.apache.tuscany.sca.core.conversation.ConversationExt; +import org.apache.tuscany.sca.core.factory.ObjectCreationException; +import org.apache.tuscany.sca.runtime.EndpointReference; +import org.apache.tuscany.sca.runtime.RuntimeWire; +import org.osoa.sca.CallableReference; +import org.osoa.sca.Conversation; + +/** + * Extended version of CallableReference + */ +public interface CallableReferenceExt<B> extends CallableReference<B>, Externalizable { + RuntimeWire getRuntimeWire(); + + B getProxy() throws ObjectCreationException; + + B getService(); + + Class<B> getBusinessInterface(); + + boolean isConversational(); + + Conversation getConversation(); + + Object getCallbackID(); + + String toXMLString() throws IOException; + + void attachCallbackID(Object callbackID); + + void attachConversationID(Object conversationID); + + void attachConversation(ConversationExt conversation); + + void attachConversation(Object conversationID); + + EndpointReference getEndpointReference(); + + XMLStreamReader getXMLReader(); + +} 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 new file mode 100644 index 0000000000..cb61c57f27 --- /dev/null +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextExt.java @@ -0,0 +1,30 @@ +/* + * 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(); +} diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextHelper.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/CompositeContext.java index 78b0887482..76de8a2aaa 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextHelper.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/CompositeContext.java @@ -45,7 +45,10 @@ import org.apache.tuscany.sca.assembly.Reference; import org.apache.tuscany.sca.assembly.Service; 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.context.impl.ComponentContextImpl; import org.apache.tuscany.sca.core.invocation.ThreadMessageContext; import org.apache.tuscany.sca.interfacedef.Interface; import org.apache.tuscany.sca.interfacedef.InterfaceContract; @@ -62,24 +65,20 @@ import org.osoa.sca.ServiceRuntimeException; /** * @version $Rev$ $Date$ */ -public class ComponentContextHelper { - +public class CompositeContext { + private final ExtensionPointRegistry extensionPointRegistry; private final AssemblyFactory assemblyFactory; private final JavaInterfaceFactory javaInterfaceFactory; private final StAXArtifactProcessorExtensionPoint staxProcessors; - /** - * @param assemblyFactory The factory to create assembly models - * @param processors The extension point for StAX artifact processors - */ - public ComponentContextHelper(AssemblyFactory assemblyFactory, - JavaInterfaceFactory javaInterfaceFactory, - StAXArtifactProcessorExtensionPoint processors) { - this.assemblyFactory = assemblyFactory; - this.javaInterfaceFactory = javaInterfaceFactory; - this.staxProcessors = processors; + public CompositeContext(ExtensionPointRegistry registry) { + this.extensionPointRegistry = registry; + FactoryExtensionPoint factories = registry.getExtensionPoint(FactoryExtensionPoint.class); + this.assemblyFactory = factories.getFactory(AssemblyFactory.class); + this.javaInterfaceFactory = factories.getFactory(JavaInterfaceFactory.class); + this.staxProcessors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class); } - + /** * Create a self-reference for a component service * @param component @@ -282,10 +281,10 @@ public class ComponentContextHelper { return null; } - public static ComponentContextHelper getCurrentComponentContextHelper() { + public static CompositeContext getCurrentCompositeContext() { CompositeActivator activator = getCurrentCompositeActivator(); if (activator != null) { - return activator.getComponentContextHelper(); + return activator.getCompositeContext(); } return null; } @@ -317,4 +316,8 @@ public class ComponentContextHelper { return targetService; } + public ExtensionPointRegistry getExtensionPointRegistry() { + return extensionPointRegistry; + } + } diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/DefaultComponentContextFactory.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/DefaultComponentContextFactory.java index c5b68389b2..51da89499d 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/DefaultComponentContextFactory.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/DefaultComponentContextFactory.java @@ -21,9 +21,16 @@ package org.apache.tuscany.sca.core.context; import org.apache.tuscany.sca.assembly.AssemblyFactory; import org.apache.tuscany.sca.context.ComponentContextFactory; +import org.apache.tuscany.sca.context.ContextFactoryExtensionPoint; 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.impl.ComponentContextImpl; +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.InterfaceContractMapper; import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; import org.apache.tuscany.sca.runtime.RuntimeComponent; @@ -40,6 +47,18 @@ public class DefaultComponentContextFactory implements ComponentContextFactory { private final JavaInterfaceFactory javaInterfaceFactory; private final InterfaceContractMapper interfaceContractMapper; + public DefaultComponentContextFactory(ExtensionPointRegistry registry) { + FactoryExtensionPoint factories = registry.getExtensionPoint(FactoryExtensionPoint.class); + this.assemblyFactory = factories.getFactory(AssemblyFactory.class); + this.javaInterfaceFactory = factories.getFactory(JavaInterfaceFactory.class); + UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class); + this.compositeActivator = utilities.getUtility(CompositeActivator.class); + this.interfaceContractMapper = utilities.getUtility(InterfaceContractMapper.class); + this.requestContextFactory = + registry.getExtensionPoint(ContextFactoryExtensionPoint.class).getFactory(RequestContextFactory.class); + this.proxyFactory = new ExtensibleProxyFactory(registry.getExtensionPoint(ProxyFactoryExtensionPoint.class)); + } + public DefaultComponentContextFactory(CompositeActivator compositeActivator, AssemblyFactory assemblyFactory, ProxyFactory proxyFactory, diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/DefaultRequestContextFactory.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/DefaultRequestContextFactory.java new file mode 100644 index 0000000000..52dccb9fff --- /dev/null +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/DefaultRequestContextFactory.java @@ -0,0 +1,40 @@ +/* + * 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.context.RequestContextFactory; +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.context.impl.RequestContextImpl; +import org.apache.tuscany.sca.runtime.RuntimeComponent; +import org.osoa.sca.RequestContext; + +/** + * Default implementation of RequestContextFactory + */ +public class DefaultRequestContextFactory implements RequestContextFactory { + + public DefaultRequestContextFactory(ExtensionPointRegistry registry) { + } + + public RequestContext createRequestContext(RuntimeComponent component) { + return new RequestContextImpl(component); + } + +} 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 new file mode 100644 index 0000000000..a36ae0f1fc --- /dev/null +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ServiceReferenceExt.java @@ -0,0 +1,29 @@ +/* + * 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.osoa.sca.ServiceReference; + +/** + * Extended ServiceReference + */ +public interface ServiceReferenceExt<B> extends CallableReferenceExt<B>, ServiceReference<B> { + +} diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/CallableReferenceImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallableReferenceImpl.java index fc6d7abf6a..901a642f1c 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/CallableReferenceImpl.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallableReferenceImpl.java @@ -16,9 +16,8 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.tuscany.sca.core.context; +package org.apache.tuscany.sca.core.context.impl; -import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; @@ -38,13 +37,16 @@ import org.apache.tuscany.sca.assembly.SCABinding; import org.apache.tuscany.sca.assembly.Service; import org.apache.tuscany.sca.assembly.builder.BindingBuilderExtension; import org.apache.tuscany.sca.core.assembly.CompositeActivator; -import org.apache.tuscany.sca.core.assembly.CompositeActivatorImpl; -import org.apache.tuscany.sca.core.assembly.EndpointReferenceImpl; -import org.apache.tuscany.sca.core.assembly.EndpointWireImpl; -import org.apache.tuscany.sca.core.assembly.ReferenceParametersImpl; +import org.apache.tuscany.sca.core.assembly.impl.CompositeActivatorImpl; +import org.apache.tuscany.sca.core.assembly.impl.EndpointReferenceImpl; +import org.apache.tuscany.sca.core.assembly.impl.EndpointWireImpl; +import org.apache.tuscany.sca.core.assembly.impl.ReferenceParametersImpl; +import org.apache.tuscany.sca.core.context.CallableReferenceExt; +import org.apache.tuscany.sca.core.context.ComponentContextExt; +import org.apache.tuscany.sca.core.context.CompositeContext; +import org.apache.tuscany.sca.core.conversation.ConversationExt; import org.apache.tuscany.sca.core.conversation.ConversationManager; import org.apache.tuscany.sca.core.conversation.ConversationState; -import org.apache.tuscany.sca.core.conversation.ExtendedConversation; import org.apache.tuscany.sca.core.factory.ObjectCreationException; import org.apache.tuscany.sca.core.invocation.ProxyFactory; import org.apache.tuscany.sca.interfacedef.Interface; @@ -55,7 +57,6 @@ import org.apache.tuscany.sca.runtime.ReferenceParameters; import org.apache.tuscany.sca.runtime.RuntimeComponent; import org.apache.tuscany.sca.runtime.RuntimeComponentReference; import org.apache.tuscany.sca.runtime.RuntimeWire; -import org.osoa.sca.CallableReference; import org.osoa.sca.Conversation; import org.osoa.sca.ServiceRuntimeException; @@ -65,7 +66,7 @@ import org.osoa.sca.ServiceRuntimeException; * @version $Rev$ $Date$ * @param <B> the type of the business interface */ -public class CallableReferenceImpl<B> implements CallableReference<B>, Externalizable { +public class CallableReferenceImpl<B> implements CallableReferenceExt<B> { static final long serialVersionUID = -521548304761848325L; protected transient CompositeActivator compositeActivator; protected transient ProxyFactory proxyFactory; @@ -74,7 +75,7 @@ public class CallableReferenceImpl<B> implements CallableReference<B>, Externali // if the wire targets a conversational service this holds the conversation state protected transient ConversationManager conversationManager; - protected transient ExtendedConversation conversation; + protected transient ConversationExt conversation; protected transient Object conversationID; protected Object callbackID; // The callbackID should be serializable @@ -171,7 +172,7 @@ public class CallableReferenceImpl<B> implements CallableReference<B>, Externali this.component = wire.getSource().getComponent(); this.reference = (RuntimeComponentReference)wire.getSource().getContract(); this.binding = wire.getSource().getBinding(); - this.compositeActivator = ((ComponentContextImpl)component.getComponentContext()).getCompositeActivator(); + this.compositeActivator = ((ComponentContextExt)component.getComponentContext()).getCompositeActivator(); this.conversationManager = this.compositeActivator.getConversationManager(); initCallbackID(); } @@ -273,9 +274,9 @@ public class CallableReferenceImpl<B> implements CallableReference<B>, Externali */ private synchronized void resolve() throws Exception { if ((scdl != null || xmlReader != null) && component == null && reference == null) { - ComponentContextHelper componentContextHelper = ComponentContextHelper.getCurrentComponentContextHelper(); + CompositeContext componentContextHelper = CompositeContext.getCurrentCompositeContext(); if (componentContextHelper != null) { - this.compositeActivator = ComponentContextHelper.getCurrentCompositeActivator(); + this.compositeActivator = CompositeContext.getCurrentCompositeActivator(); this.conversationManager = this.compositeActivator.getConversationManager(); Component c; if (xmlReader != null) { @@ -371,7 +372,7 @@ public class CallableReferenceImpl<B> implements CallableReference<B>, Externali this.proxyFactory = compositeActivator.getProxyFactory(); } } else { - this.compositeActivator = ComponentContextHelper.getCurrentCompositeActivator(); + this.compositeActivator = CompositeContext.getCurrentCompositeActivator(); if (this.compositeActivator != null) { this.proxyFactory = this.compositeActivator.getProxyFactory(); } @@ -455,7 +456,7 @@ public class CallableReferenceImpl<B> implements CallableReference<B>, Externali if (conversation != null){ refParams.setConversationID(conversation.getConversationID()); } - return ((CompositeActivatorImpl)compositeActivator).getComponentContextHelper() + return ((CompositeActivatorImpl)compositeActivator).getCompositeContext() .toXML(component, clonedRef); } else { return scdl; @@ -479,13 +480,13 @@ public class CallableReferenceImpl<B> implements CallableReference<B>, Externali this.conversationID = conversationID; } - public void attachConversation(ExtendedConversation conversation) { + public void attachConversation(ConversationExt conversation) { this.conversation = conversation; } public void attachConversation(Object conversationID) { if (conversationID != null) { - ExtendedConversation conversation = conversationManager.getConversation(conversationID); + ConversationExt conversation = conversationManager.getConversation(conversationID); if (conversation == null){ conversation = conversationManager.startConversation(conversationID); } @@ -589,7 +590,7 @@ public class CallableReferenceImpl<B> implements CallableReference<B>, Externali } if ("".equals(serviceName)) { - targetService = ComponentContextHelper.getSingleService(targetComponent); + targetService = CompositeContext.getSingleService(targetComponent); } else { for (ComponentService service : targetComponent.getServices()) { if (service.getName().equals(serviceName)) { diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ComponentContextImpl.java index 2bcf13f679..9538eb755f 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextImpl.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ComponentContextImpl.java @@ -16,13 +16,13 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.tuscany.sca.core.context; +package org.apache.tuscany.sca.core.context.impl; import java.io.IOException; import java.io.Reader; import java.io.Writer; -import java.util.Collection; import java.util.ArrayList; +import java.util.Collection; import org.apache.tuscany.sca.assembly.AssemblyFactory; import org.apache.tuscany.sca.assembly.Binding; @@ -36,7 +36,10 @@ import org.apache.tuscany.sca.assembly.Reference; import org.apache.tuscany.sca.assembly.Service; 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.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.ProxyFactory; import org.apache.tuscany.sca.interfacedef.Interface; import org.apache.tuscany.sca.interfacedef.InterfaceContract; @@ -45,7 +48,6 @@ 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.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.osoa.sca.CallableReference; @@ -58,7 +60,7 @@ import org.osoa.sca.ServiceRuntimeException; * * @version $Rev$ $Date$ */ -public class ComponentContextImpl implements RuntimeComponentContext { +public class ComponentContextImpl implements ComponentContextExt { private final RuntimeComponent component; private final CompositeActivator compositeActivator; @@ -75,7 +77,7 @@ public class ComponentContextImpl implements RuntimeComponentContext { * @see #getProperty(Class, String) */ private PropertyValueFactory propertyFactory; - + public ComponentContextImpl(CompositeActivator compositeActivator, AssemblyFactory assemblyFactory, ProxyFactory proxyFactory, @@ -111,12 +113,13 @@ public class ComponentContextImpl implements RuntimeComponentContext { if (referenceName.equals(ref.getName())) { /* ******************** Contribution for issue TUSCANY-2281 ******************** */ Multiplicity multiplicity = ref.getMultiplicity(); - if( multiplicity == Multiplicity.ZERO_N || multiplicity == Multiplicity.ONE_N) - { - throw new IllegalArgumentException("Reference " + referenceName + " has multiplicity " + multiplicity); + if (multiplicity == Multiplicity.ZERO_N || multiplicity == Multiplicity.ONE_N) { + throw new IllegalArgumentException("Reference " + referenceName + + " has multiplicity " + + multiplicity); } /* ******************** Contribution for issue TUSCANY-2281 ******************** */ - + return getServiceReference(businessInterface, (RuntimeComponentReference)ref, null); } } @@ -163,7 +166,7 @@ public class ComponentContextImpl implements RuntimeComponentContext { } public <B> ServiceReference<B> createSelfReference(Class<B> businessInterface) { - ComponentService service = ComponentContextHelper.getSingleService(component); + ComponentService service = CompositeContext.getSingleService(component); try { return createSelfReference(businessInterface, service); } catch (Exception e) { @@ -205,9 +208,9 @@ public class ComponentContextImpl implements RuntimeComponentContext { public RequestContext getRequestContext() { if (requestContextFactory != null) { - return requestContextFactory.createRequestContext(); + return requestContextFactory.createRequestContext(component); } else { - return new RequestContextImpl(proxyFactory); + return new RequestContextImpl(component); } } @@ -218,7 +221,9 @@ public class ComponentContextImpl implements RuntimeComponentContext { * @throws CloneNotSupportedException * @throws InvalidInterfaceException */ - public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, RuntimeComponentReference reference, Binding binding) { + public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, + RuntimeComponentReference reference, + Binding binding) { try { RuntimeComponentReference ref = (RuntimeComponentReference)reference; InterfaceContract interfaceContract = reference.getInterfaceContract(); @@ -236,11 +241,12 @@ public class ComponentContextImpl implements RuntimeComponentContext { } } ref.setComponent(component); - return new ServiceReferenceImpl<B>(businessInterface, component, ref, binding, proxyFactory, compositeActivator); + return new ServiceReferenceImpl<B>(businessInterface, component, ref, binding, proxyFactory, + compositeActivator); } catch (Exception e) { throw new ServiceRuntimeException(e); } - } + } /** * Bind a component reference to a component service @@ -399,7 +405,7 @@ public class ComponentContextImpl implements RuntimeComponentContext { * @see org.apache.tuscany.sca.runtime.RuntimeComponentContext#read(java.io.Reader) */ public RuntimeComponent read(Reader reader) throws IOException { - RuntimeComponent component = compositeActivator.getComponentContextHelper().read(reader); + RuntimeComponent component = compositeActivator.getCompositeContext().read(reader); compositeActivator.configureComponentContext(component); return component; } @@ -408,45 +414,49 @@ public class ComponentContextImpl implements RuntimeComponentContext { * @see org.apache.tuscany.sca.runtime.RuntimeComponentContext#write(org.apache.tuscany.sca.runtime.RuntimeComponentReference, java.io.Writer) */ public void write(RuntimeComponentReference reference, Writer writer) throws IOException { - compositeActivator.getComponentContextHelper().write(component, reference, writer); + compositeActivator.getCompositeContext().write(component, reference, writer); } /* ******************** Contribution for issue TUSCANY-2281 ******************** */ - + /** * @see ComponentContext#getServices(Class<B>, String) */ public <B> Collection<B> getServices(Class<B> businessInterface, String referenceName) { - ArrayList<B> services = new ArrayList<B>(); - Collection<ServiceReference<B>> serviceRefs = getServiceReferences(businessInterface, referenceName); - for (ServiceReference<B> serviceRef : serviceRefs) { - services.add(serviceRef.getService()); - } - return services; + ArrayList<B> services = new ArrayList<B>(); + Collection<ServiceReference<B>> serviceRefs = getServiceReferences(businessInterface, referenceName); + for (ServiceReference<B> serviceRef : serviceRefs) { + services.add(serviceRef.getService()); + } + return services; } - + /** * @see ComponentContext#getServiceReferences(Class<B>, String) */ public <B> Collection<ServiceReference<B>> getServiceReferences(Class<B> businessInterface, String referenceName) { - try { - for (ComponentReference ref : component.getReferences()) { - if (referenceName.equals(ref.getName())) { - ArrayList<ServiceReference<B>> serviceRefs = new ArrayList<ServiceReference<B>>(); - for(Binding binding : ref.getBindings()) - { - serviceRefs.add( getServiceReference(businessInterface, (RuntimeComponentReference) ref, binding) ); + try { + for (ComponentReference ref : component.getReferences()) { + if (referenceName.equals(ref.getName())) { + ArrayList<ServiceReference<B>> serviceRefs = new ArrayList<ServiceReference<B>>(); + for (Binding binding : ref.getBindings()) { + serviceRefs + .add(getServiceReference(businessInterface, (RuntimeComponentReference)ref, binding)); + } + return serviceRefs; + } } - return serviceRefs; - } + throw new ServiceRuntimeException("Reference not found: " + referenceName); + } catch (ServiceRuntimeException e) { + throw e; + } catch (Exception e) { + throw new ServiceRuntimeException(e.getMessage(), e); } - throw new ServiceRuntimeException("Reference not found: " + referenceName); - } catch (ServiceRuntimeException e) { - throw e; - } catch (Exception e) { - throw new ServiceRuntimeException(e.getMessage(), e); - } } /* ******************** Contribution for issue TUSCANY-2281 ******************** */ - + + public ExtensionPointRegistry getExtensionPointRegistry() { + return compositeActivator.getCompositeContext().getExtensionPointRegistry(); + } + } diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/RequestContextImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/RequestContextImpl.java index d26da1fd4f..a37f14e954 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/RequestContextImpl.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/RequestContextImpl.java @@ -16,15 +16,17 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.tuscany.sca.core.context; +package org.apache.tuscany.sca.core.context.impl; import java.util.List; import javax.security.auth.Subject; -import org.apache.tuscany.sca.core.invocation.CallbackReferenceImpl; +import org.apache.tuscany.sca.core.ExtensionPointRegistry; 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.core.invocation.impl.CallbackReferenceImpl; import org.apache.tuscany.sca.interfacedef.java.JavaInterface; import org.apache.tuscany.sca.invocation.Message; import org.apache.tuscany.sca.runtime.EndpointReference; @@ -41,10 +43,11 @@ import org.osoa.sca.RequestContext; */ public class RequestContextImpl implements RequestContext { - private ProxyFactory proxyFactory; + private ProxyFactoryExtensionPoint proxyFactoryExtensionPoint; - public RequestContextImpl(ProxyFactory proxyFactory) { - this.proxyFactory = proxyFactory; + public RequestContextImpl(RuntimeComponent component) { + ExtensionPointRegistry registry = component.getComponentContext().getExtensionPointRegistry(); + proxyFactoryExtensionPoint = registry.getExtensionPoint(ProxyFactoryExtensionPoint.class); } public Subject getSecuritySubject() { @@ -97,6 +100,8 @@ public class RequestContextImpl implements RequestContext { JavaInterface javaInterface = (JavaInterface) callbackReference.getInterfaceContract().getInterface(); Class<CB> javaClass = (Class<CB>)javaInterface.getJavaClass(); List<RuntimeWire> wires = callbackReference.getRuntimeWires(); + ProxyFactory proxyFactory = javaClass.isInterface() ? proxyFactoryExtensionPoint.getInterfaceProxyFactory() : + proxyFactoryExtensionPoint.getClassProxyFactory(); CallbackReferenceImpl ref = CallbackReferenceImpl.newInstance(javaClass, proxyFactory, wires); if (ref != null) { //ref.resolveTarget(); diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ServiceReferenceImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ServiceReferenceImpl.java index 1d178421cf..fb782c9070 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ServiceReferenceImpl.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ServiceReferenceImpl.java @@ -16,12 +16,14 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.tuscany.sca.core.context; +package org.apache.tuscany.sca.core.context.impl; import javax.xml.stream.XMLStreamReader; import org.apache.tuscany.sca.assembly.Binding; import org.apache.tuscany.sca.core.assembly.CompositeActivator; +import org.apache.tuscany.sca.core.context.CallableReferenceExt; +import org.apache.tuscany.sca.core.context.ServiceReferenceExt; import org.apache.tuscany.sca.core.conversation.ConversationState; import org.apache.tuscany.sca.core.invocation.ProxyFactory; import org.apache.tuscany.sca.runtime.EndpointReference; @@ -38,7 +40,7 @@ import org.osoa.sca.ServiceReference; * @version $Rev$ $Date$ * @param <B> the type of the business interface */ -public class ServiceReferenceImpl<B> extends CallableReferenceImpl<B> implements ServiceReference<B> { +public class ServiceReferenceImpl<B> extends CallableReferenceImpl<B> implements ServiceReferenceExt<B> { private static final long serialVersionUID = 6763709434194361540L; protected transient Object callback; @@ -120,7 +122,7 @@ public class ServiceReferenceImpl<B> extends CallableReferenceImpl<B> implements ReferenceParameters parameters = super.getReferenceParameters(); if (callback != null) { if (callback instanceof ServiceReference) { - EndpointReference callbackRef = ((CallableReferenceImpl)callback).getEndpointReference(); + EndpointReference callbackRef = ((CallableReferenceExt)callback).getEndpointReference(); parameters.setCallbackReference(callbackRef); } else { EndpointReference callbackRef = getRuntimeWire().getSource().getCallbackEndpoint(); diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ExtendedConversation.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationExt.java index 03c18c26b8..12416b723e 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ExtendedConversation.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationExt.java @@ -27,7 +27,7 @@ import org.osoa.sca.Conversation; * * @version $Rev$ $Date$ */ -public interface ExtendedConversation extends Conversation { +public interface ConversationExt extends Conversation { /** * Get the state of a conversation * @return The state diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationListener.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationListener.java index efa362a929..425fa3af9c 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationListener.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationListener.java @@ -28,13 +28,13 @@ public interface ConversationListener { /** * The conversation is started */ - void conversationStarted(ExtendedConversation conversation); + void conversationStarted(ConversationExt conversation); /** * The conversation is ended */ - void conversationEnded(ExtendedConversation conversation); + void conversationEnded(ConversationExt conversation); /** * The conversation is expired */ - void conversationExpired(ExtendedConversation conversation); + void conversationExpired(ConversationExt conversation); } diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationManager.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationManager.java index 28e22b4f2c..ed858bd499 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationManager.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationManager.java @@ -29,7 +29,7 @@ public interface ConversationManager { * @param conversationID * @return */ - ExtendedConversation startConversation(Object conversationID); + ConversationExt startConversation(Object conversationID); /** * @param conversationID @@ -40,7 +40,7 @@ public interface ConversationManager { * @param conversationID * @return */ - ExtendedConversation getConversation(Object conversationID); + ConversationExt getConversation(Object conversationID); /** * @param conversationID diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationManagerImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/impl/ConversationManagerImpl.java index 8a883f8e15..3c726426f6 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationManagerImpl.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/impl/ConversationManagerImpl.java @@ -17,7 +17,7 @@ * under the License. */ -package org.apache.tuscany.sca.core.conversation; +package org.apache.tuscany.sca.core.conversation.impl; import java.security.AccessController; import java.security.PrivilegedAction; @@ -31,13 +31,18 @@ import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; +import org.apache.tuscany.sca.core.conversation.ConversationListener; +import org.apache.tuscany.sca.core.conversation.ConversationManager; +import org.apache.tuscany.sca.core.conversation.ConversationState; +import org.apache.tuscany.sca.core.conversation.ConversationExt; + /** * @version $Rev$ $Date$ */ public class ConversationManagerImpl implements ConversationManager { private List<ConversationListener> listeners = Collections.synchronizedList(new ArrayList<ConversationListener>()); - private Map<Object, ExtendedConversation> conversations = new ConcurrentHashMap<Object, ExtendedConversation>(); + private Map<Object, ConversationExt> conversations = new ConcurrentHashMap<Object, ConversationExt>(); /** * the default max age. this is set to 1 hour @@ -113,10 +118,10 @@ public class ConversationManagerImpl implements ConversationManager { } /** - * @see org.apache.tuscany.sca.core.conversation.ConversationManager#endConversation(org.apache.tuscany.sca.core.conversation.ExtendedConversation) + * @see org.apache.tuscany.sca.core.conversation.ConversationManager#endConversation(org.apache.tuscany.sca.core.conversation.ConversationExt) */ public void endConversation(Object conversationID) { - ExtendedConversation conv = getConversation(conversationID); + ConversationExt conv = getConversation(conversationID); if (conv != null) { conv.setState(ConversationState.ENDED); for (ConversationListener listener : listeners) { @@ -130,7 +135,7 @@ public class ConversationManagerImpl implements ConversationManager { } public void expireConversation(Object conversationID) { - ExtendedConversation conv = getConversation(conversationID); + ConversationExt conv = getConversation(conversationID); if (conv != null) { for (ConversationListener listener : listeners) { listener.conversationExpired(conv); @@ -145,7 +150,7 @@ public class ConversationManagerImpl implements ConversationManager { /** * @see org.apache.tuscany.sca.core.conversation.ConversationManager#getConversation(java.lang.Object) */ - public ExtendedConversation getConversation(Object conversationID) { + public ConversationExt getConversation(Object conversationID) { // ConcurrentHashMap cannot take null key return conversationID == null ? null : conversations.get(conversationID); } @@ -179,12 +184,12 @@ public class ConversationManagerImpl implements ConversationManager { /** * @see org.apache.tuscany.sca.core.conversation.ConversationManager#startConversation(java.lang.Object) */ - public ExtendedConversation startConversation(Object conversationID) { + public ConversationExt startConversation(Object conversationID) { if (conversationID == null) { conversationID = UUID.randomUUID().toString(); } - ExtendedConversation conversation = getConversation(conversationID); + ConversationExt conversation = getConversation(conversationID); if (conversation != null && conversation.getState() != ConversationState.ENDED) { throw new IllegalStateException(conversation + " already exists."); } diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ExtendedConversationImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/impl/ExtendedConversationImpl.java index 0bf66b2817..26939cfbc1 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ExtendedConversationImpl.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/impl/ExtendedConversationImpl.java @@ -16,8 +16,10 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.tuscany.sca.core.conversation; +package org.apache.tuscany.sca.core.conversation.impl; +import org.apache.tuscany.sca.core.conversation.ConversationState; +import org.apache.tuscany.sca.core.conversation.ConversationExt; import org.apache.tuscany.sca.core.scope.ScopedImplementationProvider; import org.apache.tuscany.sca.provider.ImplementationProvider; import org.apache.tuscany.sca.runtime.RuntimeComponent; @@ -27,7 +29,7 @@ import org.apache.tuscany.sca.runtime.RuntimeComponent; * * @version $Rev$ $Date$ */ -public class ExtendedConversationImpl implements ExtendedConversation, Runnable { +public class ExtendedConversationImpl implements ConversationExt, Runnable { private final ConversationManagerImpl manager; private volatile Object conversationID; diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/InstanceWrapper.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/factory/InstanceWrapper.java index b577180291..2371897dce 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/context/InstanceWrapper.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/factory/InstanceWrapper.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.tuscany.sca.core.context; +package org.apache.tuscany.sca.core.factory; import org.apache.tuscany.sca.core.scope.TargetDestructionException; import org.apache.tuscany.sca.core.scope.TargetInitializationException; diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/SCAProxy.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CachedProxy.java index 1112d02b7e..d729dfad19 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/SCAProxy.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CachedProxy.java @@ -18,57 +18,53 @@ */
package org.apache.tuscany.sca.core.invocation;
+import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Proxy;
-import java.lang.reflect.Constructor;
import java.util.WeakHashMap;
-public class SCAProxy extends Proxy
-{
- protected SCAProxy (InvocationHandler handler) {
- super(handler);
- }
-
- // This is a cache containing the proxy class constructor for each business interface.
- // This improves performance compared to calling Proxy.newProxyInstance()
- // every time that a proxy is needed.
- private static WeakHashMap cache = new WeakHashMap<Class, Object>();
-
- public static Object newProxyInstance(ClassLoader classloader, Class aclass[], InvocationHandler invocationhandler)
- throws IllegalArgumentException
- {
+public class CachedProxy extends Proxy {
+ private static final long serialVersionUID = 783519311852563060L;
+
+ protected CachedProxy(InvocationHandler handler) {
+ super(handler);
+ }
+
+ // This is a cache containing the proxy class constructor for each business interface.
+ // This improves performance compared to calling Proxy.newProxyInstance()
+ // every time that a proxy is needed.
+ private static WeakHashMap<Class<?>, Object> cache = new WeakHashMap<Class<?>, Object>();
+
+ public static Object newProxyInstance(ClassLoader classloader, Class aclass[], InvocationHandler invocationhandler)
+ throws IllegalArgumentException {
try {
- if(invocationhandler == null)
+ if (invocationhandler == null)
throw new NullPointerException();
// Lookup cached constructor. aclass[0] is the reference's business interface.
Constructor proxyCTOR;
- synchronized(cache) {
- proxyCTOR = (Constructor) cache.get(aclass[0]);
+ synchronized (cache) {
+ proxyCTOR = (Constructor)cache.get(aclass[0]);
}
- if(proxyCTOR == null) {
+ if (proxyCTOR == null) {
Class proxyClass = getProxyClass(classloader, aclass);
proxyCTOR = proxyClass.getConstructor(constructorParams);
- synchronized(cache){
- cache.put(aclass[0],proxyCTOR);
+ synchronized (cache) {
+ cache.put(aclass[0], proxyCTOR);
}
}
- return proxyCTOR.newInstance(new Object[] { invocationhandler });
- }
- catch(NoSuchMethodException e) {
+ return proxyCTOR.newInstance(new Object[] {invocationhandler});
+ } catch (NoSuchMethodException e) {
throw new InternalError(e.toString());
- }
- catch(IllegalAccessException e) {
+ } catch (IllegalAccessException e) {
throw new InternalError(e.toString());
- }
- catch (InstantiationException e) {
+ } catch (InstantiationException e) {
throw new InternalError(e.toString());
- }
- catch (InvocationTargetException e) {
+ } catch (InvocationTargetException e) {
throw new InternalError(e.toString());
}
}
-
- private static final Class constructorParams[] = { InvocationHandler.class };
-}
\ No newline at end of file + private static final Class<?> constructorParams[] = {InvocationHandler.class};
+
+}
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackReferenceObjectFactory.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackReferenceObjectFactory.java index b5b40811ad..20cc6bfd03 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackReferenceObjectFactory.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackReferenceObjectFactory.java @@ -22,6 +22,7 @@ import java.util.List; import org.apache.tuscany.sca.core.factory.ObjectCreationException;
import org.apache.tuscany.sca.core.factory.ObjectFactory;
+import org.apache.tuscany.sca.core.invocation.impl.CallbackReferenceImpl;
import org.apache.tuscany.sca.runtime.RuntimeWire;
import org.osoa.sca.CallableReference;
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CglibProxyFactory.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CglibProxyFactory.java index 15c4d50901..a7f9b00153 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CglibProxyFactory.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CglibProxyFactory.java @@ -28,8 +28,11 @@ import net.sf.cglib.proxy.Factory; import net.sf.cglib.proxy.MethodInterceptor; import net.sf.cglib.proxy.MethodProxy; -import org.apache.tuscany.sca.core.context.CallableReferenceImpl; -import org.apache.tuscany.sca.core.context.ServiceReferenceImpl; +import org.apache.tuscany.sca.core.context.impl.CallableReferenceImpl; +import org.apache.tuscany.sca.core.context.impl.ServiceReferenceImpl; +import org.apache.tuscany.sca.core.invocation.impl.CallbackReferenceImpl; +import org.apache.tuscany.sca.core.invocation.impl.JDKCallbackInvocationHandler; +import org.apache.tuscany.sca.core.invocation.impl.JDKInvocationHandler; import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper; import org.apache.tuscany.sca.invocation.MessageFactory; import org.apache.tuscany.sca.runtime.RuntimeWire; diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/DefaultProxyFactoryExtensionPoint.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/DefaultProxyFactoryExtensionPoint.java index 6e93947dfb..bb212d5869 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/DefaultProxyFactoryExtensionPoint.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/DefaultProxyFactoryExtensionPoint.java @@ -22,6 +22,7 @@ package org.apache.tuscany.sca.core.invocation; 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.invocation.impl.JDKProxyFactory; import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper; import org.apache.tuscany.sca.invocation.MessageFactory; diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ExtensibleProxyFactory.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ExtensibleProxyFactory.java index fcb48259b9..3a2ebf0781 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ExtensibleProxyFactory.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ExtensibleProxyFactory.java @@ -21,13 +21,14 @@ package org.apache.tuscany.sca.core.invocation; import java.util.List; +import org.apache.tuscany.sca.core.invocation.impl.CallbackReferenceImpl; import org.apache.tuscany.sca.runtime.RuntimeWire; import org.osoa.sca.CallableReference; /** * An extensible proxy factory. * - * @version $Rev: $ $Date: $ + * @version $Rev$ $Date$ */ public class ExtensibleProxyFactory implements ProxyFactory { diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ProxyFactory.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ProxyFactory.java index cb836e42c1..179d20dc71 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ProxyFactory.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ProxyFactory.java @@ -20,6 +20,7 @@ package org.apache.tuscany.sca.core.invocation; import java.util.List; +import org.apache.tuscany.sca.core.invocation.impl.CallbackReferenceImpl; import org.apache.tuscany.sca.runtime.RuntimeWire; import org.osoa.sca.CallableReference; 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 925a7c10a5..6736b5c0e4 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 @@ -21,10 +21,10 @@ package org.apache.tuscany.sca.core.invocation; import java.lang.reflect.InvocationTargetException; -import org.apache.tuscany.sca.core.context.InstanceWrapper; import org.apache.tuscany.sca.core.conversation.ConversationManager; import org.apache.tuscany.sca.core.conversation.ConversationState; -import org.apache.tuscany.sca.core.conversation.ExtendedConversation; +import org.apache.tuscany.sca.core.conversation.ConversationExt; +import org.apache.tuscany.sca.core.factory.InstanceWrapper; import org.apache.tuscany.sca.core.scope.Scope; import org.apache.tuscany.sca.core.scope.ScopeContainer; import org.apache.tuscany.sca.core.scope.ScopedRuntimeComponent; @@ -50,7 +50,7 @@ import org.osoa.sca.ServiceRuntimeException; public class RuntimeWireInvoker implements Invoker{ protected ConversationManager conversationManager; protected boolean conversational; - protected ExtendedConversation conversation; + protected ConversationExt conversation; protected MessageFactory messageFactory; protected Object conversationID; protected Object callbackID; diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/TargetInvocationException.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/TargetInvocationException.java deleted file mode 100644 index 2c4d657882..0000000000 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/TargetInvocationException.java +++ /dev/null @@ -1,45 +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; - -/** - * Raised when an error is encountered during a target invocation - * - * @version $Rev$ $Date$ - */ -public class TargetInvocationException extends Exception { - - private static final long serialVersionUID = -6553427708442761743L; - - public TargetInvocationException() { - super(); - } - - public TargetInvocationException(String message, Throwable cause) { - super(message, cause); - } - - public TargetInvocationException(String message) { - super(message); - } - - public TargetInvocationException(Throwable cause) { - super(cause); - } -} 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 index 504bd9b036..5ae4a24b36 100644 --- 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 @@ -18,7 +18,8 @@ */ package org.apache.tuscany.sca.core.invocation; -import org.apache.tuscany.sca.core.assembly.EndpointReferenceImpl; +import org.apache.tuscany.sca.core.assembly.impl.EndpointReferenceImpl; +import org.apache.tuscany.sca.core.invocation.impl.MessageImpl; import org.apache.tuscany.sca.invocation.Message; /** diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/WireObjectFactory.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/WireObjectFactory.java index 246f9c45d6..2fc3d6c7eb 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/WireObjectFactory.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/WireObjectFactory.java @@ -18,9 +18,10 @@ */ package org.apache.tuscany.sca.core.invocation; -import org.apache.tuscany.sca.core.context.ServiceReferenceImpl; +import org.apache.tuscany.sca.core.context.impl.ServiceReferenceImpl; import org.apache.tuscany.sca.core.factory.ObjectCreationException; import org.apache.tuscany.sca.core.factory.ObjectFactory; +import org.apache.tuscany.sca.core.invocation.impl.NoMethodForOperationException; import org.apache.tuscany.sca.runtime.RuntimeWire; /** diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackReferenceImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/CallbackReferenceImpl.java index 97c69c33cb..79daf537ea 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackReferenceImpl.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/CallbackReferenceImpl.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations
* under the License.
*/
-package org.apache.tuscany.sca.core.invocation;
+package org.apache.tuscany.sca.core.invocation.impl;
import java.io.IOException;
import java.io.ObjectInput;
@@ -28,11 +28,13 @@ import org.apache.tuscany.sca.assembly.Component; import org.apache.tuscany.sca.assembly.ComponentService;
import org.apache.tuscany.sca.assembly.Contract;
import org.apache.tuscany.sca.assembly.OptimizableBinding;
-import org.apache.tuscany.sca.core.assembly.EndpointReferenceImpl;
-import org.apache.tuscany.sca.core.assembly.RuntimeComponentReferenceImpl;
-import org.apache.tuscany.sca.core.assembly.RuntimeWireImpl;
-import org.apache.tuscany.sca.core.context.CallableReferenceImpl;
-import org.apache.tuscany.sca.core.context.ComponentContextHelper;
+import org.apache.tuscany.sca.core.assembly.impl.EndpointReferenceImpl;
+import org.apache.tuscany.sca.core.assembly.impl.RuntimeComponentReferenceImpl;
+import org.apache.tuscany.sca.core.assembly.impl.RuntimeWireImpl;
+import org.apache.tuscany.sca.core.context.CompositeContext;
+import org.apache.tuscany.sca.core.context.impl.CallableReferenceImpl;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.core.invocation.ThreadMessageContext;
import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
import org.apache.tuscany.sca.invocation.Message;
@@ -221,7 +223,7 @@ public class CallbackReferenceImpl<B> extends CallableReferenceImpl<B> { this.callbackID = in.readObject();
this.convID = in.readObject();
- this.compositeActivator = ComponentContextHelper.getCurrentCompositeActivator();
+ this.compositeActivator = CompositeContext.getCurrentCompositeActivator();
// Get the target Component and Service from the URI
final String uri = in.readUTF();
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/InvocationChainImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/InvocationChainImpl.java index c559a42bdc..3c7fefb674 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/InvocationChainImpl.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/InvocationChainImpl.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.tuscany.sca.core.invocation; +package org.apache.tuscany.sca.core.invocation.impl; import java.util.ArrayList; import java.util.List; diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKCallbackInvocationHandler.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKCallbackInvocationHandler.java index cade0499d3..b8365c8994 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKCallbackInvocationHandler.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKCallbackInvocationHandler.java @@ -16,13 +16,13 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.tuscany.sca.core.invocation; +package org.apache.tuscany.sca.core.invocation.impl; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import org.apache.tuscany.sca.core.assembly.RuntimeWireImpl; -import org.apache.tuscany.sca.core.context.CallableReferenceImpl; +import org.apache.tuscany.sca.core.assembly.impl.RuntimeWireImpl; +import org.apache.tuscany.sca.core.context.impl.CallableReferenceImpl; import org.apache.tuscany.sca.core.conversation.ConversationState; import org.apache.tuscany.sca.invocation.InvocationChain; import org.apache.tuscany.sca.invocation.MessageFactory; diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKInvocationHandler.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKInvocationHandler.java index a23b9af9ad..46f09bd1ad 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKInvocationHandler.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKInvocationHandler.java @@ -17,7 +17,7 @@ * under the License. */ -package org.apache.tuscany.sca.core.invocation; +package org.apache.tuscany.sca.core.invocation.impl; import java.io.Serializable; import java.lang.reflect.InvocationHandler; @@ -28,12 +28,13 @@ import java.util.List; import java.util.Map; import java.util.UUID; -import org.apache.tuscany.sca.core.assembly.RuntimeWireImpl; -import org.apache.tuscany.sca.core.context.CallableReferenceImpl; -import org.apache.tuscany.sca.core.context.InstanceWrapper; +import org.apache.tuscany.sca.core.assembly.impl.RuntimeWireImpl; +import org.apache.tuscany.sca.core.context.impl.CallableReferenceImpl; import org.apache.tuscany.sca.core.conversation.ConversationManager; import org.apache.tuscany.sca.core.conversation.ConversationState; -import org.apache.tuscany.sca.core.conversation.ExtendedConversation; +import org.apache.tuscany.sca.core.conversation.ConversationExt; +import org.apache.tuscany.sca.core.factory.InstanceWrapper; +import org.apache.tuscany.sca.core.invocation.ThreadMessageContext; import org.apache.tuscany.sca.core.scope.Scope; import org.apache.tuscany.sca.core.scope.ScopeContainer; import org.apache.tuscany.sca.core.scope.ScopedRuntimeComponent; @@ -65,7 +66,7 @@ public class JDKInvocationHandler implements InvocationHandler, Serializable { private static final long serialVersionUID = -3366410500152201371L; protected boolean conversational; - protected ExtendedConversation conversation; + protected ConversationExt conversation; protected MessageFactory messageFactory; protected EndpointReference source; protected EndpointReference target; @@ -89,7 +90,7 @@ public class JDKInvocationHandler implements InvocationHandler, Serializable { this.callableReference = callableReference; if (callableReference != null) { this.businessInterface = callableReference.getBusinessInterface(); - this.conversation = (ExtendedConversation)callableReference.getConversation(); + this.conversation = (ConversationExt)callableReference.getConversation(); this.wire = ((CallableReferenceImpl<?>)callableReference).getRuntimeWire(); if (wire != null) { init(wire); diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKProxyFactory.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKProxyFactory.java index b75b8ad44c..a4ec97f4a3 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKProxyFactory.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKProxyFactory.java @@ -16,15 +16,18 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.tuscany.sca.core.invocation; +package org.apache.tuscany.sca.core.invocation.impl; import java.lang.reflect.InvocationHandler; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.List; -import org.apache.tuscany.sca.core.context.CallableReferenceImpl; -import org.apache.tuscany.sca.core.context.ServiceReferenceImpl; +import org.apache.tuscany.sca.core.context.impl.CallableReferenceImpl; +import org.apache.tuscany.sca.core.context.impl.ServiceReferenceImpl; +import org.apache.tuscany.sca.core.invocation.ProxyCreationException; +import org.apache.tuscany.sca.core.invocation.ProxyFactory; +import org.apache.tuscany.sca.core.invocation.CachedProxy; import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper; import org.apache.tuscany.sca.invocation.MessageFactory; import org.apache.tuscany.sca.runtime.RuntimeWire; @@ -64,7 +67,7 @@ public class JDKProxyFactory implements ProxyFactory { return interfaze.getClassLoader(); } }); - Object proxy = SCAProxy.newProxyInstance(cl, new Class[] {interfaze}, handler); + Object proxy = CachedProxy.newProxyInstance(cl, new Class[] {interfaze}, handler); ((CallableReferenceImpl)callableReference).setProxy(proxy); return interfaze.cast(proxy); } @@ -79,13 +82,13 @@ public class JDKProxyFactory implements ProxyFactory { Class<T> interfaze = callbackReference.getBusinessInterface(); InvocationHandler handler = new JDKCallbackInvocationHandler(messageFactory, callbackReference); ClassLoader cl = interfaze.getClassLoader(); - Object proxy = SCAProxy.newProxyInstance(cl, new Class[] {interfaze}, handler); + Object proxy = CachedProxy.newProxyInstance(cl, new Class[] {interfaze}, handler); callbackReference.setProxy(proxy); return interfaze.cast(proxy); } public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException { - InvocationHandler handler = SCAProxy.getInvocationHandler(target); + InvocationHandler handler = CachedProxy.getInvocationHandler(target); if (handler instanceof JDKInvocationHandler) { return (R)((JDKInvocationHandler)handler).getCallableReference(); } else { @@ -97,6 +100,6 @@ public class JDKProxyFactory implements ProxyFactory { * @see org.apache.tuscany.sca.core.invocation.ProxyFactory#isProxyClass(java.lang.Class) */ public boolean isProxyClass(Class<?> clazz) { - return SCAProxy.isProxyClass(clazz); + return CachedProxy.isProxyClass(clazz); } } diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/MessageFactoryImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/MessageFactoryImpl.java index 6e182a6a14..6ce2ffca21 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/MessageFactoryImpl.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/MessageFactoryImpl.java @@ -17,7 +17,7 @@ * under the License. */ -package org.apache.tuscany.sca.core.invocation; +package org.apache.tuscany.sca.core.invocation.impl; import org.apache.tuscany.sca.invocation.Message; import org.apache.tuscany.sca.invocation.MessageFactory; diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/MessageImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/MessageImpl.java index a45362a92d..e81e5a2f31 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/MessageImpl.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/MessageImpl.java @@ -16,12 +16,12 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.tuscany.sca.core.invocation; +package org.apache.tuscany.sca.core.invocation.impl; import java.util.ArrayList; import java.util.List; -import org.apache.tuscany.sca.core.assembly.EndpointReferenceImpl; +import org.apache.tuscany.sca.core.assembly.impl.EndpointReferenceImpl; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.Message; import org.apache.tuscany.sca.runtime.EndpointReference; diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NoMethodForOperationException.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/NoMethodForOperationException.java index 733544d387..45f4bf52bf 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NoMethodForOperationException.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/NoMethodForOperationException.java @@ -16,7 +16,9 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.tuscany.sca.core.invocation; +package org.apache.tuscany.sca.core.invocation.impl; + +import org.apache.tuscany.sca.core.invocation.ProxyCreationException; /** diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/PhaseManager.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/PhaseManager.java index a3c8429c7b..58c52833c1 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/PhaseManager.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/PhaseManager.java @@ -17,7 +17,7 @@ * under the License. */ -package org.apache.tuscany.sca.core.invocation; +package org.apache.tuscany.sca.core.invocation.impl; import static org.apache.tuscany.sca.invocation.Phase.IMPLEMENTATION; import static org.apache.tuscany.sca.invocation.Phase.IMPLEMENTATION_POLICY; diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/PhaseSorter.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/PhaseSorter.java index fc4bea3d9f..175f3463ad 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/PhaseSorter.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/PhaseSorter.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.tuscany.sca.core.invocation; +package org.apache.tuscany.sca.core.invocation.impl; import java.util.ArrayList; import java.util.HashMap; diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainer.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainer.java index ff92aa00a8..4674456925 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainer.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainer.java @@ -21,7 +21,7 @@ package org.apache.tuscany.sca.core.scope; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -import org.apache.tuscany.sca.core.context.InstanceWrapper; +import org.apache.tuscany.sca.core.factory.InstanceWrapper; import org.apache.tuscany.sca.provider.ImplementationProvider; import org.apache.tuscany.sca.runtime.RuntimeComponent; diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/DefaultScopeRegistry.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/DefaultScopeRegistry.java index 4d4b324e05..b6857be97a 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/DefaultScopeRegistry.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/DefaultScopeRegistry.java @@ -19,6 +19,12 @@ 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. * diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeContainer.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeContainer.java index 0f82e5e864..2398ecea3e 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeContainer.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeContainer.java @@ -18,7 +18,7 @@ */ package org.apache.tuscany.sca.core.scope; -import org.apache.tuscany.sca.core.context.InstanceWrapper; +import org.apache.tuscany.sca.core.factory.InstanceWrapper; import org.apache.tuscany.sca.runtime.RuntimeComponent; diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopedImplementationProvider.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopedImplementationProvider.java index 85a6626cdd..30d5c77181 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopedImplementationProvider.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopedImplementationProvider.java @@ -19,7 +19,7 @@ package org.apache.tuscany.sca.core.scope; -import org.apache.tuscany.sca.core.context.InstanceWrapper; +import org.apache.tuscany.sca.core.factory.InstanceWrapper; import org.apache.tuscany.sca.provider.ImplementationProvider; /** diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/CompositeScopeContainer.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/CompositeScopeContainer.java index 7e7ab7a9e4..6763c8117d 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/CompositeScopeContainer.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/CompositeScopeContainer.java @@ -16,9 +16,14 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.tuscany.sca.core.scope; +package org.apache.tuscany.sca.core.scope.impl; -import org.apache.tuscany.sca.core.context.InstanceWrapper; +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; /** diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/CompositeScopeContainerFactory.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/CompositeScopeContainerFactory.java index 786988613b..f61e70a598 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/CompositeScopeContainerFactory.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/CompositeScopeContainerFactory.java @@ -17,8 +17,11 @@ * under the License. */ -package org.apache.tuscany.sca.core.scope; +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; /** diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainer.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/ConversationalScopeContainer.java index dc5d9ea8fe..853866d8e8 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainer.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/ConversationalScopeContainer.java @@ -17,7 +17,7 @@ * under the License.
*/
-package org.apache.tuscany.sca.core.scope;
+package org.apache.tuscany.sca.core.scope.impl;
import java.util.ArrayList;
import java.util.List;
@@ -25,11 +25,15 @@ import java.util.Map; import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
-import org.apache.tuscany.sca.core.context.InstanceWrapper;
import org.apache.tuscany.sca.core.conversation.ConversationListener;
import org.apache.tuscany.sca.core.conversation.ConversationManager;
-import org.apache.tuscany.sca.core.conversation.ExtendedConversation;
+import org.apache.tuscany.sca.core.conversation.ConversationExt;
+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;
@@ -220,9 +224,9 @@ public class ConversationalScopeContainer extends AbstractScopeContainer<Object> }
/**
- * @see org.apache.tuscany.sca.core.conversation.ConversationListener#conversationEnded(org.apache.tuscany.sca.core.conversation.ExtendedConversation)
+ * @see org.apache.tuscany.sca.core.conversation.ConversationListener#conversationEnded(org.apache.tuscany.sca.core.conversation.ConversationExt)
*/
- public void conversationEnded(ExtendedConversation conversation) {
+ public void conversationEnded(ConversationExt conversation) {
try {
remove(conversation.getConversationID());
} catch (Exception ex) {
@@ -231,9 +235,9 @@ public class ConversationalScopeContainer extends AbstractScopeContainer<Object> }
/**
- * @see org.apache.tuscany.sca.core.conversation.ConversationListener#conversationExpired(org.apache.tuscany.sca.core.conversation.ExtendedConversation)
+ * @see org.apache.tuscany.sca.core.conversation.ConversationListener#conversationExpired(org.apache.tuscany.sca.core.conversation.ConversationExt)
*/
- public void conversationExpired(ExtendedConversation conversation) {
+ public void conversationExpired(ConversationExt conversation) {
Object conversationId = conversation.getConversationID();
InstanceLifeCycleWrapper ilcw = instanceLifecycleCollection.get(conversationId);
@@ -266,9 +270,9 @@ public class ConversationalScopeContainer extends AbstractScopeContainer<Object> }
/**
- * @see org.apache.tuscany.sca.core.conversation.ConversationListener#conversationStarted(org.apache.tuscany.sca.core.conversation.ExtendedConversation)
+ * @see org.apache.tuscany.sca.core.conversation.ConversationListener#conversationStarted(org.apache.tuscany.sca.core.conversation.ConversationExt)
*/
- public void conversationStarted(ExtendedConversation conversation) {
+ public void conversationStarted(ConversationExt conversation) {
startContext(conversation.getConversationID());
}
diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainerFactory.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/ConversationalScopeContainerFactory.java index 6263cf6313..f8ffc027a1 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainerFactory.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/ConversationalScopeContainerFactory.java @@ -17,8 +17,11 @@ * under the License. */ -package org.apache.tuscany.sca.core.scope; +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; /** diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/HttpSessionScopeContainer.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/HttpSessionScopeContainer.java index c359f04ae0..bfe197255d 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/HttpSessionScopeContainer.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/HttpSessionScopeContainer.java @@ -16,9 +16,12 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.tuscany.sca.core.scope; +package org.apache.tuscany.sca.core.scope.impl; -import org.apache.tuscany.sca.core.context.InstanceWrapper; +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; /** diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/HttpSessionScopeContainerFactory.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/HttpSessionScopeContainerFactory.java index 49f89661b1..d6aaa4cc84 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/HttpSessionScopeContainerFactory.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/HttpSessionScopeContainerFactory.java @@ -17,8 +17,11 @@ * under the License. */ -package org.apache.tuscany.sca.core.scope; +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; /** diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/RequestScopeContainer.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/RequestScopeContainer.java index c6fd9ec067..7519af2341 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/RequestScopeContainer.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/RequestScopeContainer.java @@ -16,12 +16,15 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.tuscany.sca.core.scope; +package org.apache.tuscany.sca.core.scope.impl; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -import org.apache.tuscany.sca.core.context.InstanceWrapper; +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; /** diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/RequestScopeContainerFactory.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/RequestScopeContainerFactory.java index 1cfb6b06a4..9d1cf88d96 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/RequestScopeContainerFactory.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/RequestScopeContainerFactory.java @@ -17,8 +17,11 @@ * under the License. */ -package org.apache.tuscany.sca.core.scope; +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; /** diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeRegistryImpl.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/ScopeRegistryImpl.java index 75261e11a8..f11295c9fa 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeRegistryImpl.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/ScopeRegistryImpl.java @@ -16,11 +16,17 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.tuscany.sca.core.scope; +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; diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/StatelessScopeContainer.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/StatelessScopeContainer.java index a2c0edb9b4..0639b8885b 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/StatelessScopeContainer.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/StatelessScopeContainer.java @@ -16,9 +16,13 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.tuscany.sca.core.scope; +package org.apache.tuscany.sca.core.scope.impl; -import org.apache.tuscany.sca.core.context.InstanceWrapper; +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; /** diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/StatelessScopeContainerFactory.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/StatelessScopeContainerFactory.java index 0471b2c52e..5bf20a6a5f 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/StatelessScopeContainerFactory.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/impl/StatelessScopeContainerFactory.java @@ -17,8 +17,11 @@ * under the License. */ -package org.apache.tuscany.sca.core.scope; +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; /** diff --git a/java/sca/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.context.ComponentContextFactory b/java/sca/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.context.ComponentContextFactory new file mode 100644 index 0000000000..e118d5967b --- /dev/null +++ b/java/sca/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.context.ComponentContextFactory @@ -0,0 +1,17 @@ +# 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.context.DefaultComponentContextFactory
\ No newline at end of file diff --git a/java/sca/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.context.RequestContextFactory b/java/sca/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.context.RequestContextFactory new file mode 100644 index 0000000000..171588cc7b --- /dev/null +++ b/java/sca/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.context.RequestContextFactory @@ -0,0 +1,17 @@ +# 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.context.DefaultRequestContextFactory
\ No newline at end of file diff --git a/java/sca/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/java/sca/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor index 5f54178483..5fc42915cb 100644 --- a/java/sca/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor +++ b/java/sca/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor @@ -16,4 +16,4 @@ # under the License. # Implementation class for the artifact processor extension -org.apache.tuscany.sca.core.assembly.ReferenceParameterProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#referenceParameters,model=org.apache.tuscany.sca.runtime.ReferenceParameters +org.apache.tuscany.sca.core.assembly.impl.ReferenceParameterProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#referenceParameters,model=org.apache.tuscany.sca.runtime.ReferenceParameters 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.core.assembly.CompositeActivator index fc2760f73f..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.core.assembly.CompositeActivator @@ -15,4 +15,4 @@ # specific language governing permissions and limitations
# under the License.
-org.apache.tuscany.sca.core.assembly.CompositeActivatorImpl
+org.apache.tuscany.sca.core.assembly.impl.CompositeActivatorImpl
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 index 898054509b..67cec934b4 100644 --- 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 @@ -15,4 +15,4 @@ # specific language governing permissions and limitations
# under the License.
-org.apache.tuscany.sca.core.conversation.ConversationManagerImpl
+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.invocation.MessageFactory b/java/sca/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.invocation.MessageFactory index bcbd5b0abf..00a33e1656 100644 --- a/java/sca/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.invocation.MessageFactory +++ b/java/sca/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.invocation.MessageFactory @@ -15,4 +15,4 @@ # specific language governing permissions and limitations
# under the License.
-org.apache.tuscany.sca.core.invocation.MessageFactoryImpl
+org.apache.tuscany.sca.core.invocation.impl.MessageFactoryImpl
diff --git a/java/sca/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation/PhaseManagerTestCase.java b/java/sca/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation/impl/PhaseManagerTestCase.java index 7f6fe2b66e..c5eb009619 100644 --- a/java/sca/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation/PhaseManagerTestCase.java +++ b/java/sca/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation/impl/PhaseManagerTestCase.java @@ -17,10 +17,11 @@ * under the License. */ -package org.apache.tuscany.sca.core.invocation; +package org.apache.tuscany.sca.core.invocation.impl; import java.util.List; +import org.apache.tuscany.sca.core.invocation.impl.PhaseManager; import org.junit.Assert; import org.junit.Test; diff --git a/java/sca/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation/PhaseSorterTestCase.java b/java/sca/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation/impl/PhaseSorterTestCase.java index b1a91df515..04f8213d5d 100644 --- a/java/sca/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation/PhaseSorterTestCase.java +++ b/java/sca/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation/impl/PhaseSorterTestCase.java @@ -16,11 +16,12 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.tuscany.sca.core.invocation; +package org.apache.tuscany.sca.core.invocation.impl; import java.util.Arrays; import java.util.List; +import org.apache.tuscany.sca.core.invocation.impl.PhaseSorter; import org.junit.After; import org.junit.Before; import org.junit.Test; diff --git a/java/sca/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/CallbackInterfaceInterceptorTestCase.java.fixme b/java/sca/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/CallbackInterfaceInterceptorTestCase.java.fixme index 1aba9656d8..27985425bc 100644 --- a/java/sca/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/CallbackInterfaceInterceptorTestCase.java.fixme +++ b/java/sca/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/CallbackInterfaceInterceptorTestCase.java.fixme @@ -20,9 +20,9 @@ package org.apache.tuscany.sca.core.wire; import junit.framework.TestCase; -import org.apache.tuscany.sca.core.assembly.EndpointReferenceImpl; +import org.apache.tuscany.sca.core.assembly.impl.EndpointReferenceImpl; import org.apache.tuscany.sca.core.invocation.CallbackInterfaceInterceptor; -import org.apache.tuscany.sca.core.invocation.MessageFactoryImpl; +import org.apache.tuscany.sca.core.invocation.impl.MessageFactoryImpl; import org.apache.tuscany.sca.invocation.Interceptor; import org.apache.tuscany.sca.invocation.Message; import org.easymock.EasyMock; diff --git a/java/sca/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/InvocationChainImplTestCase.java b/java/sca/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/InvocationChainImplTestCase.java index 81173b5e96..cfd18ab18e 100644 --- a/java/sca/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/InvocationChainImplTestCase.java +++ b/java/sca/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/InvocationChainImplTestCase.java @@ -20,7 +20,7 @@ package org.apache.tuscany.sca.core.wire; import static org.junit.Assert.assertEquals; -import org.apache.tuscany.sca.core.invocation.InvocationChainImpl; +import org.apache.tuscany.sca.core.invocation.impl.InvocationChainImpl; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.interfacedef.impl.OperationImpl; import org.apache.tuscany.sca.invocation.Interceptor; diff --git a/java/sca/modules/databinding-jaxb-axiom/src/main/java/org/apache/tuscany/sca/databinding/jaxb/axiom/OMElement2JAXB.java b/java/sca/modules/databinding-jaxb-axiom/src/main/java/org/apache/tuscany/sca/databinding/jaxb/axiom/OMElement2JAXB.java index 3753fd9d64..4f867a8af7 100644 --- a/java/sca/modules/databinding-jaxb-axiom/src/main/java/org/apache/tuscany/sca/databinding/jaxb/axiom/OMElement2JAXB.java +++ b/java/sca/modules/databinding-jaxb-axiom/src/main/java/org/apache/tuscany/sca/databinding/jaxb/axiom/OMElement2JAXB.java @@ -27,6 +27,7 @@ import javax.xml.bind.JAXBException; import javax.xml.bind.Unmarshaller; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; +import javax.xml.stream.util.StreamReaderDelegate; import org.apache.axiom.om.OMElement; import org.apache.tuscany.sca.databinding.PullTransformer; @@ -60,6 +61,14 @@ public class OMElement2JAXB extends BaseTransformer<OMElement, Object> implement try { unmarshaller = JAXBContextHelper.getUnmarshaller(jaxbContext); reader = source.getXMLStreamReaderWithoutCaching(); + // https://issues.apache.org/jira/browse/WSCOMMONS-395 + reader = new StreamReaderDelegate(reader) { + // Fix the issue in WSCOMMONS-395 + public String getAttributeType(int index) { + String type = super.getAttributeType(index); + return type == null ? "CDATA" : type; + } + }; result = unmarshaller.unmarshal(reader, JAXBContextHelper.getJavaType(context.getTargetDataType())); } finally { if (reader != null) { diff --git a/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/InstanceFactory.java b/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/InstanceFactory.java index ac8af3ed64..e2d99852d8 100644 --- a/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/InstanceFactory.java +++ b/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/InstanceFactory.java @@ -18,7 +18,7 @@ */ package org.apache.tuscany.sca.implementation.java.context; -import org.apache.tuscany.sca.core.context.InstanceWrapper; +import org.apache.tuscany.sca.core.factory.InstanceWrapper; /** * Interface for a factory that returns an injected component instance. diff --git a/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceFactory.java b/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceFactory.java index b5d3254fa0..73b7990a79 100644 --- a/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceFactory.java +++ b/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceFactory.java @@ -21,7 +21,7 @@ package org.apache.tuscany.sca.implementation.java.context; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; -import org.apache.tuscany.sca.core.context.InstanceWrapper; +import org.apache.tuscany.sca.core.factory.InstanceWrapper; import org.apache.tuscany.sca.core.factory.ObjectCreationException; import org.apache.tuscany.sca.core.factory.ObjectFactory; import org.apache.tuscany.sca.implementation.java.injection.Injector; diff --git a/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceWrapper.java b/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceWrapper.java index e99aedf929..aeaf60e957 100644 --- a/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceWrapper.java +++ b/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceWrapper.java @@ -18,7 +18,7 @@ */ package org.apache.tuscany.sca.implementation.java.context; -import org.apache.tuscany.sca.core.context.InstanceWrapper; +import org.apache.tuscany.sca.core.factory.InstanceWrapper; import org.apache.tuscany.sca.core.scope.TargetDestructionException; import org.apache.tuscany.sca.core.scope.TargetInitializationException; import org.apache.tuscany.sca.implementation.java.invocation.EventInvoker; diff --git a/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/RequestContextObjectFactory.java b/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/RequestContextObjectFactory.java index ca9c08fe63..4519c6128e 100644 --- a/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/RequestContextObjectFactory.java +++ b/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/RequestContextObjectFactory.java @@ -19,37 +19,26 @@ package org.apache.tuscany.sca.implementation.java.injection; import org.apache.tuscany.sca.context.RequestContextFactory; -import org.apache.tuscany.sca.core.context.RequestContextImpl; import org.apache.tuscany.sca.core.factory.ObjectCreationException; import org.apache.tuscany.sca.core.factory.ObjectFactory; -import org.apache.tuscany.sca.core.invocation.ProxyFactory; +import org.apache.tuscany.sca.runtime.RuntimeComponent; import org.osoa.sca.RequestContext; /** - * Creates instances of - * {@link org.apache.tuscany.sca.core.context.RequestContextImpl} for - * injection on component implementation instances + * Creates instances of RequestContext for injection on component implementation instances * * @version $Rev$ $Date$ */ public class RequestContextObjectFactory implements ObjectFactory<RequestContext> { private RequestContextFactory factory; - private ProxyFactory proxyFactory; + private RuntimeComponent component; - public RequestContextObjectFactory(RequestContextFactory factory) { - this(factory, null); - } - - public RequestContextObjectFactory(RequestContextFactory factory, ProxyFactory proxyFactory) { + public RequestContextObjectFactory(RequestContextFactory factory, RuntimeComponent component) { this.factory = factory; - this.proxyFactory = proxyFactory; + this.component = component; } public RequestContext getInstance() throws ObjectCreationException { - if (factory != null) { - return factory.createRequestContext(); - } else { - return new RequestContextImpl(proxyFactory); - } + return factory.createRequestContext(component); } } diff --git a/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/InvalidConversationSequenceException.java b/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/InvalidConversationSequenceException.java index 135fde09ff..1c330ea913 100644 --- a/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/InvalidConversationSequenceException.java +++ b/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/InvalidConversationSequenceException.java @@ -18,14 +18,13 @@ */ package org.apache.tuscany.sca.implementation.java.invocation; -import org.apache.tuscany.sca.core.invocation.TargetInvocationException; /** * Denotes an unknown operation sequence in a conversation * * @version $Rev$ $Date$ */ -public class InvalidConversationSequenceException extends TargetInvocationException { +public class InvalidConversationSequenceException extends Exception { private static final long serialVersionUID = -5744028391493899147L; public InvalidConversationSequenceException() { diff --git a/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java b/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java index 529eb23875..e3604766a4 100644 --- a/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java +++ b/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java @@ -38,8 +38,7 @@ import org.apache.tuscany.sca.assembly.Multiplicity; import org.apache.tuscany.sca.assembly.Reference; import org.apache.tuscany.sca.context.ComponentContextFactory; import org.apache.tuscany.sca.context.RequestContextFactory; -import org.apache.tuscany.sca.core.context.ComponentContextImpl; -import org.apache.tuscany.sca.core.context.InstanceWrapper; +import org.apache.tuscany.sca.core.factory.InstanceWrapper; import org.apache.tuscany.sca.core.factory.ObjectCreationException; import org.apache.tuscany.sca.core.factory.ObjectFactory; import org.apache.tuscany.sca.core.invocation.CallableReferenceObjectFactory; @@ -61,6 +60,7 @@ import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.interfacedef.java.impl.JavaInterfaceUtil; import org.apache.tuscany.sca.invocation.Invoker; 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.RuntimeWire; import org.osoa.sca.CallableReference; @@ -265,7 +265,7 @@ public class JavaComponentContextProvider { // We need to set the PropertyValueFactory on the ComponentContextImpl // so the ComponentContext can "de-marshal" the property type to a value // when the getProperty() method is called - ComponentContextImpl ccImpl = (ComponentContextImpl)component.getComponentContext(); + RuntimeComponentContext ccImpl = (RuntimeComponentContext)component.getComponentContext(); ccImpl.setPropertyValueFactory(propertyValueFactory); //setUpPolicyHandlers(); diff --git a/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationInvoker.java b/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationInvoker.java index 25d538cff4..0db3d3d190 100644 --- a/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationInvoker.java +++ b/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationInvoker.java @@ -21,7 +21,7 @@ package org.apache.tuscany.sca.implementation.java.invocation; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import org.apache.tuscany.sca.core.context.InstanceWrapper; +import org.apache.tuscany.sca.core.factory.InstanceWrapper; import org.apache.tuscany.sca.core.scope.Scope; import org.apache.tuscany.sca.core.scope.ScopeContainer; import org.apache.tuscany.sca.core.scope.ScopedRuntimeComponent; diff --git a/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProvider.java b/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProvider.java index b83dba42cc..3c483d68e2 100644 --- a/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProvider.java +++ b/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProvider.java @@ -25,7 +25,7 @@ import java.util.List; import org.apache.tuscany.sca.assembly.Service; import org.apache.tuscany.sca.context.ComponentContextFactory; import org.apache.tuscany.sca.context.RequestContextFactory; -import org.apache.tuscany.sca.core.context.InstanceWrapper; +import org.apache.tuscany.sca.core.factory.InstanceWrapper; import org.apache.tuscany.sca.core.factory.ObjectFactory; import org.apache.tuscany.sca.core.invocation.ProxyFactory; import org.apache.tuscany.sca.core.scope.Scope; @@ -124,7 +124,7 @@ public class JavaImplementationProvider implements ScopedImplementationProvider if (ComponentContext.class.equals(type)) { objectFactory = new JavaComponentContextFactory(componentContextProvider); } else if (RequestContext.class.equals(type)) { - objectFactory = new RequestContextObjectFactory(requestContextFactory, proxyService); + objectFactory = new RequestContextObjectFactory(requestContextFactory, componentContextProvider.getComponent()); } else if (String.class.equals(type)) { objectFactory = new JavaComponentNameFactory(componentContextProvider); } else { diff --git a/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/RequestContextObjectFactoryTestCase.java b/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/RequestContextObjectFactoryTestCase.java deleted file mode 100644 index 61af4de19c..0000000000 --- a/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/RequestContextObjectFactoryTestCase.java +++ /dev/null @@ -1,36 +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.implementation.java.injection; - -import static org.junit.Assert.assertNotNull; - -import org.junit.Test; - -/** - * @version $Rev$ $Date$ - */ -public class RequestContextObjectFactoryTestCase { - - @Test - public void testInstanceCreate() { - RequestContextObjectFactory factory = new RequestContextObjectFactory(null); - assertNotNull(factory.getInstance()); - } - -} diff --git a/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/BaseBeanGenerator.java b/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/BaseBeanGenerator.java index 4cf56fed0c..bb27781c36 100644 --- a/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/BaseBeanGenerator.java +++ b/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/BaseBeanGenerator.java @@ -222,7 +222,7 @@ public abstract class BaseBeanGenerator implements Opcodes { fv = cw.visitField(ACC_PROTECTED, getFieldName(propName), propClassSignature, propTypeSignature, null); // For Map property, we cannot have the XmlElement annotation - if (isElement) { + if (isElement && xmlAdapterClassSignature == null) { av0 = fv.visitAnnotation("Ljavax/xml/bind/annotation/XmlElement;", true); av0.visit("name", propName); av0.visit("namespace", ""); @@ -235,6 +235,9 @@ public abstract class BaseBeanGenerator implements Opcodes { } if (xmlAdapterClassSignature != null) { + av0 = fv.visitAnnotation("Ljavax/xml/bind/annotation/XmlAnyElement;", true); + av0.visit("lax", Boolean.TRUE); + av0.visitEnd(); av0 = fv.visitAnnotation("Ljavax/xml/bind/annotation/adapters/XmlJavaTypeAdapter;", true); av0.visit("value", org.objectweb.asm.Type.getType(xmlAdapterClassSignature)); av0.visitEnd(); diff --git a/java/sca/modules/interface-java-jaxws/src/test/resources/wsdl/StockExceptionTest.wsdl b/java/sca/modules/interface-java-jaxws/src/test/resources/wsdl/StockExceptionTest.wsdl index 4fee9e9756..e92409bfdb 100644 --- a/java/sca/modules/interface-java-jaxws/src/test/resources/wsdl/StockExceptionTest.wsdl +++ b/java/sca/modules/interface-java-jaxws/src/test/resources/wsdl/StockExceptionTest.wsdl @@ -23,7 +23,8 @@ xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="StockExceptionTest">
<wsdl:types>
<schema targetNamespace="http://www.example.com/stock" xmlns="http://www.w3.org/2001/XMLSchema"
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="2.0">
<complexType name="StockOffer">
<sequence>
<element name="symbol" minOccurs="1" type="xsd:string" />
@@ -61,6 +62,27 @@ <element name="MarketClosedFault" type="xsd:int" />
<element name="TestNotDeclaredAtSourceFault" type="xsd:string" />
+
+ <element name="anyElement">
+ <complexType>
+ <sequence>
+ <element name="first" type="anyType">
+ <annotation>
+ <appinfo>
+ <jaxb:dom />
+ </appinfo>
+ </annotation>
+ </element>
+ <any maxOccurs="unbounded" processContents="skip">
+ <annotation>
+ <appinfo>
+ <jaxb:dom />
+ </appinfo>
+ </annotation>
+ </any>
+ </sequence>
+ </complexType>
+ </element>
</schema>
</wsdl:types>
diff --git a/java/sca/modules/node-impl/META-INF/MANIFEST.MF b/java/sca/modules/node-impl/META-INF/MANIFEST.MF index 0391a04003..4cca47bacd 100644 --- a/java/sca/modules/node-impl/META-INF/MANIFEST.MF +++ b/java/sca/modules/node-impl/META-INF/MANIFEST.MF @@ -21,7 +21,6 @@ Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt Bundle-Description: Apache Tuscany SCA Node Implementation
Import-Package: javax.xml.namespace,
javax.xml.stream,
-
org.apache.tuscany.sca.assembly;version="1.4",
org.apache.tuscany.sca.assembly.builder;version="1.4",
org.apache.tuscany.sca.contribution;version="1.4",
@@ -40,7 +39,6 @@ Import-Package: javax.xml.namespace, org.apache.tuscany.sca.work;version="1.4",
org.apache.tuscany.sca.workspace;version="1.4",
org.apache.tuscany.sca.workspace.builder;version="1.4",
-
org.osoa.sca;version="1.4",
org.osoa.sca.annotations;version="1.4";resolution:=optional
Bundle-SymbolicName: org.apache.tuscany.sca.node.impl
diff --git a/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java b/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java index 73ef98010d..fb261bb2dd 100644 --- a/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java +++ b/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java @@ -299,6 +299,12 @@ public class NodeImpl implements Node, Client { // Create extension point registry extensionPoints = new DefaultExtensionPointRegistry(); + + // Use the runtime-enabled assembly factory + modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class); + assemblyFactory = new RuntimeAssemblyFactory(); + modelFactories.addFactory(assemblyFactory); + // Create a monitor UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class); @@ -318,18 +324,12 @@ public class NodeImpl implements Node, Client { } // Get XML input/output factories - modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class); inputFactory = modelFactories.getFactory(XMLInputFactory.class); // Get contribution workspace and assembly model factories contributionFactory = modelFactories.getFactory(ContributionFactory.class); workspaceFactory = modelFactories.getFactory(WorkspaceFactory.class); - assemblyFactory = modelFactories.getFactory(AssemblyFactory.class); - // Use the runtime-enabled assembly factory - assemblyFactory = new RuntimeAssemblyFactory(); - modelFactories.addFactory(assemblyFactory); - // Create XML artifact processors xmlProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class); compositeProcessor = xmlProcessors.getProcessor(Composite.class); |