Replace RuntimeWire with RuntimeEnpoint/RuntimeEndpointReference as the owner of invocaiton chains

(http://www.mail-archive.com/dev@tuscany.apache.org/msg07856.html)

git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@836009 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
rfeng 2009-11-13 21:49:15 +00:00
parent c6a1c369e4
commit 4dcff75335
139 changed files with 2244 additions and 3443 deletions

View file

@ -105,7 +105,7 @@ public class ExceptionsTestCase {
Object o = ((ObjectMessage)m).getObject();
assertTrue(o instanceof RuntimeException);
assertTrue("java.lang.RuntimeException".equals(o.getClass().getName()));
assertEquals("java.lang.RuntimeException: bla", ((RuntimeException)o).getMessage());
assertEquals("bla", ((RuntimeException)o).getMessage());
}
@Test
@ -151,7 +151,7 @@ public class ExceptionsTestCase {
Object o = ((ObjectMessage)m).getObject();
assertTrue(o instanceof RuntimeException);
assertTrue("java.lang.RuntimeException".equals(o.getClass().getName()));
assertEquals("java.lang.RuntimeException: bla", ((RuntimeException)o).getMessage());
assertEquals("bla", ((RuntimeException)o).getMessage());
}
@After

View file

@ -97,7 +97,7 @@ public class ExceptionsTestCase {
service.throwUnChecked();
fail();
} catch (Exception e) {
assertEquals("java.lang.RuntimeException: bla", e.getCause().getMessage());
assertEquals("bla", e.getCause().getMessage());
}
}

View file

@ -48,7 +48,7 @@ public class FormatJMSObjectTestCase {
assertEquals("Hello1 Fred Hello1 Bloggs Hello2 null Hello3 Fred Hello4 Fred Bloggs Hello5 Fred Bloggs Hello6 Fred Bloggs Hello7 Fred Bloggs",
helloWorldService.getGreetingsWrapSingle("Fred", "Bloggs"));
assertEquals("Hello1 Fred Hello1 Bloggs Hello2 null Hello3 Fred Hello4 Fred Bloggs Hello5 Fred Bloggs Hello6 Fred Bloggs Hello7 Fred Bloggs foo java.lang.RuntimeException: bla",
assertEquals("Hello1 Fred Hello1 Bloggs Hello2 null Hello3 Fred Hello4 Fred Bloggs Hello5 Fred Bloggs Hello6 Fred Bloggs Hello7 Fred Bloggs foo bla",
helloWorldService.getGreetingsDontWrapSingle("Fred", "Bloggs"));
}

View file

@ -17,7 +17,7 @@
* specific language governing permissions and limitations
* under the License.
-->
<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903" name="ConstructorPropertyInjection">
<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903" targetNamespace="http://foo" name="ConstructorPropertyInjection">
<component name="Foo1Component">
<implementation.java class="org.apache.tuscany.sca.itest.cdi.Foo1" />

View file

@ -26,7 +26,7 @@
<implementation.composite name="foo:PropertyTest" />
<property name="number">125</property>
<property name="complex" type="foo:MyComplexType">
<foo:MyComplexValue xsi:type="foo:MyComplexType">
<value xsi:type="foo:MyComplexType">
<foo:a>Overriden A</foo:a>
<foo:b>Overriden B</foo:b>
<foo:c>Overriden C</foo:c>
@ -35,7 +35,7 @@
<foo:y>Overriden Y</foo:y>
<foo:z>Overriden Z</foo:z>
</foo:x>
</foo:MyComplexValue>
</value>
</property>
</component>
</composite>

View file

@ -21,7 +21,6 @@ package org.apache.tuscany.sca.assembly;
import java.io.Serializable;
import java.util.List;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.policy.PolicySubject;
@ -112,14 +111,6 @@ public interface Endpoint extends Base, PolicySubject, Cloneable, Serializable {
*/
List<EndpointReference> getCallbackEndpointReferences();
/**
* Set the extension point registry against the endpoint after it is deserialized as
* the registry needs to be re-attached
*
* @param registry
*/
void setExtensionPointRegistry(ExtensionPointRegistry registry);
/**
* Returns true if this endpoint represents a serivce that is not
* running in this JVM
@ -143,4 +134,11 @@ public interface Endpoint extends Base, PolicySubject, Cloneable, Serializable {
* @throws CloneNotSupportedException
*/
Object clone() throws CloneNotSupportedException;
/*
String getDomainURI();
String getNodeURI();
void setDomainURI(String domainURI);
void setNodeURI(String nodeURI);
*/
}

View file

@ -20,7 +20,6 @@ package org.apache.tuscany.sca.assembly;
import java.io.Serializable;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.policy.PolicySubject;
@ -163,14 +162,6 @@ public interface EndpointReference extends Base, PolicySubject, Cloneable, Seria
*/
void setRemote(boolean remote);
/**
* Set the extension point registry against the endpoint after it is deserialized as
* the registry needs to be re-attached
*
* @param registry
*/
void setExtensionPointRegistry(ExtensionPointRegistry registry);
/**
* Rather than relying on combinations of unresolved flags and
* other data we maintain a status enumeration

View file

@ -188,7 +188,7 @@ public class EndpointImpl implements Endpoint {
this.uri = null;
}
public void setExtensionPointRegistry(ExtensionPointRegistry registry) {
protected void setExtensionPointRegistry(ExtensionPointRegistry registry) {
this.registry = registry;
}

View file

@ -61,7 +61,7 @@ import org.apache.tuscany.sca.invocation.InvocationChain;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
import org.apache.tuscany.sca.invocation.MessageFactory;
import org.apache.tuscany.sca.runtime.RuntimeWire;
import org.apache.tuscany.sca.runtime.Invocable;
/**
* A resource collection binding listener, implemented as a Servlet and
@ -81,7 +81,7 @@ class AtomBindingListenerServlet extends HttpServlet {
private static final String CONTENTLOCATION = "Content-Location";
private static final SimpleDateFormat dateFormat = new SimpleDateFormat( "EEE, dd MMM yyyy HH:mm:ss Z" ); // RFC 822 date time
private RuntimeWire wire;
private Invocable wire;
private Invoker getFeedInvoker;
private Invoker getAllInvoker;
private Invoker queryInvoker;
@ -106,7 +106,7 @@ class AtomBindingListenerServlet extends HttpServlet {
* @param messageFactory
* @param feedType
*/
AtomBindingListenerServlet(RuntimeWire wire, MessageFactory messageFactory, Mediator mediator, String title, String description) {
AtomBindingListenerServlet(Invocable wire, MessageFactory messageFactory, Mediator mediator, String title, String description) {
this.wire = wire;
this.messageFactory = messageFactory;
this.mediator = mediator;

View file

@ -19,8 +19,6 @@
package org.apache.tuscany.sca.binding.atom.provider;
import org.apache.tuscany.sca.assembly.Endpoint;
import org.apache.tuscany.sca.assembly.EndpointReference;
import org.apache.tuscany.sca.binding.atom.AtomBinding;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.FactoryExtensionPoint;
@ -32,6 +30,8 @@ import org.apache.tuscany.sca.invocation.MessageFactory;
import org.apache.tuscany.sca.provider.BindingProviderFactory;
import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
import org.apache.tuscany.sca.provider.ServiceBindingProvider;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
/**
* Implementation of a Binding provider factory for the Atom binding.
@ -52,11 +52,11 @@ public class AtomBindingProviderFactory implements BindingProviderFactory<AtomBi
this.mediator = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class).getUtility(Mediator.class);
}
public ReferenceBindingProvider createReferenceBindingProvider(EndpointReference endpointReference) {
public ReferenceBindingProvider createReferenceBindingProvider(RuntimeEndpointReference endpointReference) {
return new AtomReferenceBindingProvider(endpointReference, mediator);
}
public ServiceBindingProvider createServiceBindingProvider(Endpoint endpoint) {
public ServiceBindingProvider createServiceBindingProvider(RuntimeEndpoint endpoint) {
return new AtomServiceBindingProvider(endpoint, messageFactory, mediator, servletHost);
}

View file

@ -19,18 +19,16 @@
package org.apache.tuscany.sca.binding.atom.provider;
import org.apache.tuscany.sca.assembly.Endpoint;
import org.apache.tuscany.sca.assembly.Service;
import org.apache.tuscany.sca.binding.atom.AtomBinding;
import org.apache.tuscany.sca.databinding.Mediator;
import org.apache.tuscany.sca.host.http.ServletHost;
import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract;
import org.apache.tuscany.sca.invocation.MessageFactory;
import org.apache.tuscany.sca.provider.ServiceBindingProvider;
import org.apache.tuscany.sca.runtime.Invocable;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeWire;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
/**
* Implementation of the Atom binding provider.
@ -40,7 +38,7 @@ import org.apache.tuscany.sca.runtime.RuntimeWire;
class AtomServiceBindingProvider implements ServiceBindingProvider {
private MessageFactory messageFactory;
private Endpoint endpoint;
private RuntimeEndpoint endpoint;
private RuntimeComponent component;
private RuntimeComponentService service;
@ -52,7 +50,7 @@ class AtomServiceBindingProvider implements ServiceBindingProvider {
private String servletMapping;
private String bindingURI;
AtomServiceBindingProvider(Endpoint endpoint,
AtomServiceBindingProvider(RuntimeEndpoint endpoint,
MessageFactory messageFactory,
Mediator mediator,
ServletHost servletHost) {
@ -66,16 +64,7 @@ class AtomServiceBindingProvider implements ServiceBindingProvider {
this.mediator = mediator;
// TUSCANY-3166
this.serviceContract = service.getInterfaceContract();
if (this.serviceContract instanceof WSDLInterfaceContract) {
for (Service componentService : component.getImplementation().getServices()) {
if (componentService.getName().equals(service.getName())) {
this.serviceContract = (InterfaceContract) componentService.getInterfaceContract();
break;
}
}
}
this.serviceContract = endpoint.getServiceInterfaceContract();
}
public InterfaceContract getBindingInterfaceContract() {
@ -87,8 +76,7 @@ class AtomServiceBindingProvider implements ServiceBindingProvider {
}
public void start() {
RuntimeComponentService componentService = (RuntimeComponentService)service;
RuntimeWire wire = componentService.getRuntimeWire(binding);
Invocable wire = (RuntimeEndpoint) endpoint;
AtomBindingListenerServlet servlet =
new AtomBindingListenerServlet(wire, messageFactory, mediator, binding.getTitle(), binding.getDescription());

View file

@ -18,8 +18,6 @@
*/
package org.apache.tuscany.sca.binding.ejb.provider;
import org.apache.tuscany.sca.assembly.Endpoint;
import org.apache.tuscany.sca.assembly.EndpointReference;
import org.apache.tuscany.sca.binding.ejb.EJBBinding;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.provider.BindingProviderFactory;
@ -27,6 +25,8 @@ import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
import org.apache.tuscany.sca.provider.ServiceBindingProvider;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
/**
* A factory from creating the EJB binding provider.
@ -39,13 +39,13 @@ public class EJBBindingProviderFactory implements BindingProviderFactory<EJBBind
// empty constructor
}
public ReferenceBindingProvider createReferenceBindingProvider(EndpointReference endpointReference) {
public ReferenceBindingProvider createReferenceBindingProvider(RuntimeEndpointReference endpointReference) {
return new EJBBindingReferenceBindingProvider((RuntimeComponent)endpointReference.getComponent(),
(RuntimeComponentReference)endpointReference.getReference(),
(EJBBinding)endpointReference.getBinding());
}
public ServiceBindingProvider createServiceBindingProvider(Endpoint endpoint) {
public ServiceBindingProvider createServiceBindingProvider(RuntimeEndpoint endpoint) {
// Service Binding not supported for EJB Binding
return null;
}

View file

@ -19,8 +19,6 @@
package org.apache.tuscany.sca.binding.http.provider;
import org.apache.tuscany.sca.assembly.Endpoint;
import org.apache.tuscany.sca.assembly.EndpointReference;
import org.apache.tuscany.sca.binding.http.HTTPBinding;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.FactoryExtensionPoint;
@ -30,6 +28,8 @@ import org.apache.tuscany.sca.invocation.MessageFactory;
import org.apache.tuscany.sca.provider.BindingProviderFactory;
import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
import org.apache.tuscany.sca.provider.ServiceBindingProvider;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
/**
@ -50,12 +50,12 @@ public class HTTPBindingProviderFactory implements BindingProviderFactory<HTTPBi
messageFactory = modelFactories.getFactory(MessageFactory.class);
}
public ReferenceBindingProvider createReferenceBindingProvider(EndpointReference endpointReference) {
public ReferenceBindingProvider createReferenceBindingProvider(RuntimeEndpointReference endpointReference) {
// Binding HTTP is currently NOT supporting References
return null;
}
public ServiceBindingProvider createServiceBindingProvider(Endpoint endpoint) {
public ServiceBindingProvider createServiceBindingProvider(RuntimeEndpoint endpoint) {
return new HTTPServiceBindingProvider(endpoint, extensionPoints, messageFactory, servletHost);
}

View file

@ -21,7 +21,6 @@ package org.apache.tuscany.sca.binding.http.provider;
import javax.servlet.Servlet;
import org.apache.tuscany.sca.assembly.Endpoint;
import org.apache.tuscany.sca.binding.http.HTTPBinding;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.host.http.ServletHost;
@ -31,25 +30,25 @@ import org.apache.tuscany.sca.invocation.InvocationChain;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.MessageFactory;
import org.apache.tuscany.sca.invocation.Phase;
import org.apache.tuscany.sca.provider.EndpointProvider;
import org.apache.tuscany.sca.provider.OperationSelectorProvider;
import org.apache.tuscany.sca.provider.OperationSelectorProviderFactory;
import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
import org.apache.tuscany.sca.provider.ServiceBindingProviderRRB;
import org.apache.tuscany.sca.provider.WireFormatProvider;
import org.apache.tuscany.sca.provider.WireFormatProviderFactory;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeWire;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
/**
* Implementation of an HTTP binding provider.
*
* @version $Rev$ $Date$
*/
public class HTTPServiceBindingProvider implements ServiceBindingProviderRRB {
public class HTTPServiceBindingProvider implements EndpointProvider {
private ExtensionPointRegistry extensionPoints;
private Endpoint endpoint;
private RuntimeEndpoint endpoint;
private RuntimeComponent component;
private RuntimeComponentService service;
private InterfaceContract serviceContract;
@ -63,7 +62,7 @@ public class HTTPServiceBindingProvider implements ServiceBindingProviderRRB {
private String servletMapping;
private HTTPBindingListenerServlet bindingListenerServlet;
public HTTPServiceBindingProvider(Endpoint endpoint,
public HTTPServiceBindingProvider(RuntimeEndpoint endpoint,
ExtensionPointRegistry extensionPoints,
MessageFactory messageFactory,
ServletHost servletHost) {
@ -86,7 +85,7 @@ public class HTTPServiceBindingProvider implements ServiceBindingProviderRRB {
// Configure the interceptors for operation selection
OperationSelectorProviderFactory osProviderFactory = (OperationSelectorProviderFactory) providerFactories.getProviderFactory(binding.getOperationSelector().getClass());
if (osProviderFactory != null) {
this.osProvider = osProviderFactory.createServiceOperationSelectorProvider(component, service, binding);
this.osProvider = osProviderFactory.createServiceOperationSelectorProvider(endpoint);
}
}
@ -94,7 +93,7 @@ public class HTTPServiceBindingProvider implements ServiceBindingProviderRRB {
// Configure the interceptors for wire format
WireFormatProviderFactory wfProviderFactory = (WireFormatProviderFactory) providerFactories.getProviderFactory(binding.getRequestWireFormat().getClass());
if (wfProviderFactory != null) {
this.wfProvider = wfProviderFactory.createServiceWireFormatProvider(component, service, binding);
this.wfProvider = wfProviderFactory.createServiceWireFormatProvider(endpoint);
}
}
@ -116,11 +115,9 @@ public class HTTPServiceBindingProvider implements ServiceBindingProviderRRB {
public void start() {
// Get the invokers for the supported operations
RuntimeComponentService componentService = (RuntimeComponentService) service;
RuntimeWire wire = componentService.getRuntimeWire(binding);
Servlet servlet = null;
bindingListenerServlet = new HTTPBindingListenerServlet(binding, messageFactory );
for (InvocationChain invocationChain : wire.getInvocationChains()) {
for (InvocationChain invocationChain : endpoint.getInvocationChains()) {
Operation operation = invocationChain.getTargetOperation();
String operationName = operation.getName();
if (operationName.equals("get")) {
@ -195,9 +192,9 @@ public class HTTPServiceBindingProvider implements ServiceBindingProviderRRB {
* Add specific http interceptor to invocation chain
* @param runtimeWire
*/
public void configureBindingChain(RuntimeWire runtimeWire) {
public void configure() {
InvocationChain bindingChain = runtimeWire.getBindingInvocationChain();
InvocationChain bindingChain = endpoint.getBindingInvocationChain();
if(osProvider != null) {
bindingChain.addInterceptor(Phase.SERVICE_BINDING_OPERATION_SELECTOR, osProvider.createInterceptor());

View file

@ -40,9 +40,8 @@ import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeWire;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
/**
*
@ -51,7 +50,7 @@ import org.apache.tuscany.sca.runtime.RuntimeWire;
public class HeaderReferenceInterceptor implements Interceptor {
private Invoker next;
private RuntimeWire runtimeWire;
private RuntimeEndpointReference runtimeWire;
private JMSResourceFactory jmsResourceFactory;
private JMSBinding jmsBinding;
private JMSMessageProcessor requestMessageProcessor;
@ -60,7 +59,7 @@ public class HeaderReferenceInterceptor implements Interceptor {
private WireFormat requestWireFormat;
private WireFormat responseWireFormat;
public HeaderReferenceInterceptor(JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeWire runtimeWire, ExtensionPointRegistry extensions) {
public HeaderReferenceInterceptor(ExtensionPointRegistry extensions, JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeEndpointReference runtimeWire) {
super();
this.jmsBinding = jmsBinding;
this.runtimeWire = runtimeWire;
@ -85,7 +84,7 @@ public class HeaderReferenceInterceptor implements Interceptor {
Operation operation = tuscanyMsg.getOperation();
String operationName = operation.getName();
RuntimeComponentReference reference = (RuntimeComponentReference)runtimeWire.getEndpointReference().getReference();
RuntimeEndpointReference reference = runtimeWire;
// I think the OASIS spec suggests we do not need to do anything with
// @nativeOperation here on the reference side.
@ -145,11 +144,10 @@ public class HeaderReferenceInterceptor implements Interceptor {
}
protected String getCallbackDestinationName(RuntimeComponentReference reference) {
RuntimeComponentService s = (RuntimeComponentService)reference.getCallbackService();
JMSBinding b = s.getBinding(JMSBinding.class);
if (b != null) {
JMSBindingServiceBindingProvider bp = (JMSBindingServiceBindingProvider)s.getBindingProvider(b);
protected String getCallbackDestinationName(RuntimeEndpointReference reference) {
RuntimeEndpoint endpoint = (RuntimeEndpoint) reference.getCallbackEndpoint();
if (endpoint != null) {
JMSBindingServiceBindingProvider bp = (JMSBindingServiceBindingProvider)endpoint.getBindingProvider();
return bp.getDestinationName();
}
return null;

View file

@ -41,8 +41,8 @@ public class DefaultJMSServiceListenerFactory implements JMSServiceListenerFacto
JMSResourceFactory rf = ((JMSBindingServiceBindingProvider)jmsSLD).getResourceFactory();
MessageListener listener = new DefaultServiceInvoker(jmsSLD.getJmsBinding(), jmsSLD.getService(), jmsSLD.getTargetBinding(), jmsSLD.getMessageFactory(), rf);
RuntimeComponentService service = jmsSLD.getService();
RuntimeComponentService service = (RuntimeComponentService) jmsSLD.getEndpoint().getService();
MessageListener listener = new DefaultServiceInvoker(jmsSLD.getEndpoint(), jmsSLD.getTargetBinding(), jmsSLD.getMessageFactory(), rf);
// return new ASFListener(listener, service.getName(), service.isCallback(), jmsSLD.getJmsBinding(), workScheduler, rf);
// TODO: 2.x migration, service.isCallback()

View file

@ -28,11 +28,13 @@ import javax.jms.MessageListener;
import javax.naming.NamingException;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.assembly.Endpoint;
import org.apache.tuscany.sca.binding.jms.JMSBinding;
import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
import org.apache.tuscany.sca.invocation.MessageFactory;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
/**
* TODO RRB experiement
@ -44,16 +46,18 @@ public class DefaultServiceInvoker implements MessageListener {
private static final Logger logger = Logger.getLogger(DefaultServiceInvoker.class.getName());
private RuntimeEndpoint endpoint;
private JMSBinding jmsBinding;
private Binding targetBinding;
private JMSResourceFactory jmsResourceFactory;
private RuntimeComponentService service;
private MessageFactory messageFactory;
public DefaultServiceInvoker(JMSBinding jmsBinding, RuntimeComponentService service, Binding targetBinding, MessageFactory messageFactory, JMSResourceFactory rf) throws NamingException {
this.jmsBinding = jmsBinding;
public DefaultServiceInvoker(RuntimeEndpoint endpoint, Binding targetBinding, MessageFactory messageFactory, JMSResourceFactory rf) throws NamingException {
this.endpoint = endpoint;
this.jmsBinding = (JMSBinding) endpoint.getBinding();
this.jmsResourceFactory = rf;
this.service = service;
this.service = (RuntimeComponentService) endpoint.getService();
this.targetBinding = targetBinding;
this.messageFactory = messageFactory;
@ -86,8 +90,17 @@ public class DefaultServiceInvoker implements MessageListener {
// call the runtime wire - the response is handled by the
// transport interceptor
service.getRuntimeWire(targetBinding).invoke(tuscanyMsg);
getEndpoint(targetBinding).invoke(tuscanyMsg);
}
}
private RuntimeEndpoint getEndpoint(Binding targetBinding) {
for(Endpoint ep: service.getEndpoints()) {
if(ep.getBinding() == targetBinding) {
return (RuntimeEndpoint) ep;
}
}
return endpoint;
}
}

View file

@ -22,18 +22,15 @@ package org.apache.tuscany.sca.binding.jms.host;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.binding.jms.JMSBinding;
import org.apache.tuscany.sca.invocation.MessageFactory;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
public interface JMSServiceListenerDetails {
JMSBinding getJmsBinding();
Binding getTargetBinding();
RuntimeComponentService getService();
RuntimeComponent getComponent();
RuntimeEndpoint getEndpoint();
MessageFactory getMessageFactory();

View file

@ -19,14 +19,12 @@
package org.apache.tuscany.sca.binding.jms.operationselector.jmsdefault.runtime;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.binding.jms.operationselector.OperationSelectorJMSDefault;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.provider.OperationSelectorProvider;
import org.apache.tuscany.sca.provider.OperationSelectorProviderFactory;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
/**
* @version $Rev$ $Date$
@ -41,18 +39,14 @@ public class OperationSelectorJMSDefaultProviderFactory implements OperationSele
/**
*/
public OperationSelectorProvider createReferenceOperationSelectorProvider(RuntimeComponent component,
RuntimeComponentReference reference,
Binding binding) {
public OperationSelectorProvider createReferenceOperationSelectorProvider(RuntimeEndpointReference endpointReference) {
return null;
}
/**
*/
public OperationSelectorProvider createServiceOperationSelectorProvider(RuntimeComponent component,
RuntimeComponentService service,
Binding binding) {
return new OperationSelectorJMSDefaultServiceProvider(registry, component, service, binding);
public OperationSelectorProvider createServiceOperationSelectorProvider(RuntimeEndpoint endpoint) {
return new OperationSelectorJMSDefaultServiceProvider(registry, endpoint);
}
/**

View file

@ -45,7 +45,7 @@ import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeWire;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
/**
* Policy handler to handle PolicySet related to Logging with the QName
@ -58,7 +58,7 @@ public class OperationSelectorJMSDefaultServiceInterceptor implements Intercepto
private static final String ON_MESSAGE_METHOD_NAME = "onMessage";
private Invoker next;
private RuntimeWire runtimeWire;
private RuntimeEndpoint endpint;
private JMSResourceFactory jmsResourceFactory;
private JMSBinding jmsBinding;
private JMSMessageProcessor requestMessageProcessor;
@ -67,15 +67,14 @@ public class OperationSelectorJMSDefaultServiceInterceptor implements Intercepto
private List<Operation> serviceOperations;
public OperationSelectorJMSDefaultServiceInterceptor(ExtensionPointRegistry registry, JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory,
RuntimeWire runtimeWire) {
public OperationSelectorJMSDefaultServiceInterceptor(ExtensionPointRegistry registry, JMSResourceFactory jmsResourceFactory, RuntimeEndpoint endpoint) {
super();
this.jmsBinding = jmsBinding;
this.runtimeWire = runtimeWire;
this.endpint = endpoint;
this.jmsBinding = (JMSBinding) endpoint.getBinding();
this.jmsResourceFactory = jmsResourceFactory;
this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(registry, jmsBinding);
this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(registry, jmsBinding);
this.service = (RuntimeComponentService)runtimeWire.getEndpoint().getService();
this.service = (RuntimeComponentService)endpoint.getService();
this.serviceOperations = service.getInterfaceContract().getInterface().getOperations();
}

View file

@ -19,38 +19,29 @@
package org.apache.tuscany.sca.binding.jms.operationselector.jmsdefault.runtime;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.binding.jms.JMSBinding;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Phase;
import org.apache.tuscany.sca.provider.OperationSelectorProvider;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
/**
* @version $Rev$ $Date$
*/
public class OperationSelectorJMSDefaultServiceProvider implements OperationSelectorProvider {
private RuntimeComponent component;
private RuntimeComponentService service;
private Binding binding;
private RuntimeEndpoint endpoint;
private ExtensionPointRegistry registry;
public OperationSelectorJMSDefaultServiceProvider(ExtensionPointRegistry registry, RuntimeComponent component, RuntimeComponentService service, Binding binding) {
public OperationSelectorJMSDefaultServiceProvider(ExtensionPointRegistry registry, RuntimeEndpoint endpoint) {
super();
this.component = component;
this.service = service;
this.binding = binding;
this.endpoint = endpoint;
this.registry = registry;
}
/**
*/
public Interceptor createInterceptor() {
return new OperationSelectorJMSDefaultServiceInterceptor(registry, (JMSBinding)binding,
null,
service.getRuntimeWire(binding));
return new OperationSelectorJMSDefaultServiceInterceptor(registry, null, endpoint);
}
/**

View file

@ -19,14 +19,12 @@
package org.apache.tuscany.sca.binding.jms.operationselector.jmsuserprop.runtime;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.binding.jms.operationselector.OperationSelectorJMSUserProp;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.provider.OperationSelectorProvider;
import org.apache.tuscany.sca.provider.OperationSelectorProviderFactory;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
public class OperationSelectorJMSUserPropProviderFactory implements OperationSelectorProviderFactory<OperationSelectorJMSUserProp> {
private ExtensionPointRegistry registry;
@ -38,18 +36,14 @@ public class OperationSelectorJMSUserPropProviderFactory implements OperationSel
/**
*/
public OperationSelectorProvider createReferenceOperationSelectorProvider(RuntimeComponent component,
RuntimeComponentReference reference,
Binding binding) {
public OperationSelectorProvider createReferenceOperationSelectorProvider(RuntimeEndpointReference endpointReference) {
return null;
}
/**
*/
public OperationSelectorProvider createServiceOperationSelectorProvider(RuntimeComponent component,
RuntimeComponentService service,
Binding binding) {
return new OperationSelectorJMSUserPropServiceProvider(component, service, binding);
public OperationSelectorProvider createServiceOperationSelectorProvider(RuntimeEndpoint endpoint) {
return new OperationSelectorJMSUserPropServiceProvider(endpoint);
}
/**

View file

@ -31,7 +31,7 @@ import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeWire;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
/**
* Interceptor for user property based operation selection
@ -42,18 +42,18 @@ import org.apache.tuscany.sca.runtime.RuntimeWire;
public class OperationSelectorJMSUserPropServiceInterceptor implements Interceptor {
private Invoker next;
private RuntimeWire runtimeWire;
private RuntimeEndpoint endpoint;
private JMSBinding jmsBinding;
private OperationSelectorJMSUserProp operationSelector;
private RuntimeComponentService service;
private List<Operation> serviceOperations;
public OperationSelectorJMSUserPropServiceInterceptor(JMSBinding jmsBinding, RuntimeWire runtimeWire) {
public OperationSelectorJMSUserPropServiceInterceptor(RuntimeEndpoint endpoint) {
super();
this.jmsBinding = jmsBinding;
this.jmsBinding = (JMSBinding) endpoint.getBinding();
this.operationSelector = (OperationSelectorJMSUserProp)jmsBinding.getOperationSelector();
this.runtimeWire = runtimeWire;
this.service = (RuntimeComponentService) runtimeWire.getEndpoint().getService();
this.endpoint = endpoint;
this.service = (RuntimeComponentService) endpoint.getService();
this.serviceOperations = service.getInterfaceContract().getInterface().getOperations();
}

View file

@ -19,30 +19,23 @@
package org.apache.tuscany.sca.binding.jms.operationselector.jmsuserprop.runtime;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.binding.jms.JMSBinding;
import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Phase;
import org.apache.tuscany.sca.provider.OperationSelectorProvider;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
public class OperationSelectorJMSUserPropServiceProvider implements OperationSelectorProvider {
private RuntimeComponent component;
private RuntimeComponentService service;
private Binding binding;
private RuntimeEndpoint endpoint;
public OperationSelectorJMSUserPropServiceProvider(RuntimeComponent component, RuntimeComponentService service, Binding binding) {
public OperationSelectorJMSUserPropServiceProvider(RuntimeEndpoint endpoint) {
super();
this.component = component;
this.service = service;
this.binding = binding;
this.endpoint = endpoint;
}
/**
*/
public Interceptor createInterceptor() {
return new OperationSelectorJMSUserPropServiceInterceptor((JMSBinding)binding, service.getRuntimeWire(binding));
return new OperationSelectorJMSUserPropServiceInterceptor(endpoint);
}
/**

View file

@ -19,8 +19,6 @@
package org.apache.tuscany.sca.binding.jms.provider;
import org.apache.tuscany.sca.assembly.Endpoint;
import org.apache.tuscany.sca.assembly.EndpointReference;
import org.apache.tuscany.sca.binding.jms.JMSBinding;
import org.apache.tuscany.sca.binding.jms.host.DefaultJMSHostExtensionPoint;
import org.apache.tuscany.sca.binding.jms.host.JMSHostExtensionPoint;
@ -29,9 +27,8 @@ import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.provider.BindingProviderFactory;
import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
import org.apache.tuscany.sca.provider.ServiceBindingProvider;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
/**
* A factory from creating the JMS binding provider.
@ -61,15 +58,15 @@ public class JMSBindingProviderFactory implements BindingProviderFactory<JMSBind
serviceListenerFactory = jmsHostExtensionPoint.getJMSServiceListenerFactory();
}
public ReferenceBindingProvider createReferenceBindingProvider(EndpointReference endpointReference) {
public ReferenceBindingProvider createReferenceBindingProvider(RuntimeEndpointReference endpointReference) {
JMSResourceFactory jmsRF = jmsRFEP.createJMSResourceFactory((JMSBinding)endpointReference.getBinding());
return new JMSBindingReferenceBindingProvider((RuntimeComponent)endpointReference.getComponent(), (RuntimeComponentReference) endpointReference.getReference(), (JMSBinding)endpointReference.getBinding(), extensionPoints, jmsRF);
return new JMSBindingReferenceBindingProvider(endpointReference, extensionPoints, jmsRF);
}
public ServiceBindingProvider createServiceBindingProvider(Endpoint endpoint) {
public ServiceBindingProvider createServiceBindingProvider(RuntimeEndpoint endpoint) {
JMSBinding binding = (JMSBinding)endpoint.getBinding();
JMSResourceFactory jmsRF = jmsRFEP.createJMSResourceFactory(binding);
return new JMSBindingServiceBindingProvider(extensionPoints, (RuntimeComponent)endpoint.getComponent(), (RuntimeComponentService)endpoint.getService(), binding, binding, serviceListenerFactory, extensionPoints, jmsRF);
return new JMSBindingServiceBindingProvider(extensionPoints, endpoint, serviceListenerFactory, extensionPoints, jmsRF);
}
public Class<JMSBinding> getModelType() {

View file

@ -31,21 +31,22 @@ import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.invocation.InvocationChain;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Phase;
import org.apache.tuscany.sca.provider.EndpointReferenceProvider;
import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
import org.apache.tuscany.sca.provider.ReferenceBindingProviderRRB;
import org.apache.tuscany.sca.provider.WireFormatProvider;
import org.apache.tuscany.sca.provider.WireFormatProviderFactory;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
import org.apache.tuscany.sca.runtime.RuntimeWire;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
/**
* Implementation of the JMS reference binding provider.
*
* @version $Rev$ $Date$
*/
public class JMSBindingReferenceBindingProvider implements ReferenceBindingProviderRRB {
public class JMSBindingReferenceBindingProvider implements EndpointReferenceProvider {
private RuntimeEndpointReference endpointReference;
private RuntimeComponentReference reference;
private JMSBinding jmsBinding;
private JMSResourceFactory jmsResourceFactory;
@ -61,11 +62,12 @@ public class JMSBindingReferenceBindingProvider implements ReferenceBindingProvi
private WireFormatProviderFactory responseWireFormatProviderFactory;
private WireFormatProvider responseWireFormatProvider;
public JMSBindingReferenceBindingProvider(RuntimeComponent component, RuntimeComponentReference reference, JMSBinding binding, ExtensionPointRegistry extensions, JMSResourceFactory jmsResourceFactory) {
this.reference = reference;
this.jmsBinding = binding;
public JMSBindingReferenceBindingProvider(RuntimeEndpointReference endpointReference, ExtensionPointRegistry extensions, JMSResourceFactory jmsResourceFactory) {
this.endpointReference = endpointReference;
this.reference = (RuntimeComponentReference) endpointReference.getReference();
this.jmsBinding = (JMSBinding) endpointReference.getBinding();
this.extensions = extensions;
this.component = component;
this.component = (RuntimeComponent) endpointReference.getComponent();
this.jmsResourceFactory = jmsResourceFactory;
// Get the factories/providers for operation selection
@ -75,13 +77,13 @@ public class JMSBindingReferenceBindingProvider implements ReferenceBindingProvi
this.requestWireFormatProviderFactory =
(WireFormatProviderFactory)providerFactories.getProviderFactory(jmsBinding.getRequestWireFormat().getClass());
if (this.requestWireFormatProviderFactory != null){
this.requestWireFormatProvider = requestWireFormatProviderFactory.createReferenceWireFormatProvider(component, reference, jmsBinding);
this.requestWireFormatProvider = requestWireFormatProviderFactory.createReferenceWireFormatProvider(endpointReference);
}
this.responseWireFormatProviderFactory =
(WireFormatProviderFactory)providerFactories.getProviderFactory(jmsBinding.getResponseWireFormat().getClass());
if (this.responseWireFormatProviderFactory != null){
this.responseWireFormatProvider = responseWireFormatProviderFactory.createReferenceWireFormatProvider(component, reference, jmsBinding);
this.responseWireFormatProvider = responseWireFormatProviderFactory.createReferenceWireFormatProvider(endpointReference);
}
// create an interface contract that reflects both request and response
@ -105,7 +107,7 @@ public class JMSBindingReferenceBindingProvider implements ReferenceBindingProvi
}
Invoker invoker = null;
invoker = new RRBJMSBindingInvoker(jmsBinding, operation, jmsResourceFactory, reference);
invoker = new RRBJMSBindingInvoker(operation, jmsResourceFactory, endpointReference);
return invoker;
}
@ -135,15 +137,15 @@ public class JMSBindingReferenceBindingProvider implements ReferenceBindingProvi
* set up the reference binding wire with the right set of jms reference
* interceptors
*/
public void configureBindingChain(RuntimeWire runtimeWire) {
public void configure() {
InvocationChain bindingChain = runtimeWire.getBindingInvocationChain();
InvocationChain bindingChain = endpointReference.getBindingInvocationChain();
// add transport interceptor
bindingChain.addInterceptor(Phase.REFERENCE_BINDING_TRANSPORT,
new TransportReferenceInterceptor(jmsBinding,
jmsResourceFactory,
runtimeWire) );
endpointReference) );
// add request wire format
bindingChain.addInterceptor(requestWireFormatProvider.getPhase(),
@ -158,9 +160,10 @@ public class JMSBindingReferenceBindingProvider implements ReferenceBindingProvi
// add the header processor that comes after the wire formatter but before the
// policy interceptors
bindingChain.addInterceptor(Phase.REFERENCE_BINDING_WIREFORMAT,
new HeaderReferenceInterceptor(jmsBinding,
new HeaderReferenceInterceptor(extensions,
jmsBinding,
jmsResourceFactory,
runtimeWire, extensions) );
endpointReference) );
}
}

View file

@ -36,24 +36,26 @@ import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.invocation.InvocationChain;
import org.apache.tuscany.sca.invocation.MessageFactory;
import org.apache.tuscany.sca.invocation.Phase;
import org.apache.tuscany.sca.provider.EndpointProvider;
import org.apache.tuscany.sca.provider.OperationSelectorProvider;
import org.apache.tuscany.sca.provider.OperationSelectorProviderFactory;
import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
import org.apache.tuscany.sca.provider.ServiceBindingProviderRRB;
import org.apache.tuscany.sca.provider.WireFormatProvider;
import org.apache.tuscany.sca.provider.WireFormatProviderFactory;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeWire;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
/**
* Implementation of the JMS service binding provider.
*
* @version $Rev$ $Date$
*/
public class JMSBindingServiceBindingProvider implements ServiceBindingProviderRRB, JMSServiceListenerDetails {
public class JMSBindingServiceBindingProvider implements EndpointProvider, JMSServiceListenerDetails {
private static final Logger logger = Logger.getLogger(JMSBindingServiceBindingProvider.class.getName());
private ExtensionPointRegistry registry;
private RuntimeEndpoint endpoint;
private RuntimeComponentService service;
private Binding targetBinding;
private JMSBinding jmsBinding;
@ -78,14 +80,13 @@ public class JMSBindingServiceBindingProvider implements ServiceBindingProviderR
private WireFormatProviderFactory responseWireFormatProviderFactory;
private WireFormatProvider responseWireFormatProvider;
private ExtensionPointRegistry registry;
public JMSBindingServiceBindingProvider(ExtensionPointRegistry registry, RuntimeComponent component, RuntimeComponentService service, Binding targetBinding, JMSBinding binding, JMSServiceListenerFactory serviceListenerFactory, ExtensionPointRegistry extensionPoints, JMSResourceFactory jmsResourceFactory) {
this.component = component;
this.service = service;
this.jmsBinding = binding;
public JMSBindingServiceBindingProvider(ExtensionPointRegistry registry, RuntimeEndpoint endpoint, JMSServiceListenerFactory serviceListenerFactory, ExtensionPointRegistry extensionPoints, JMSResourceFactory jmsResourceFactory) {
this.endpoint = endpoint;
this.component = (RuntimeComponent) endpoint.getComponent();
this.service = (RuntimeComponentService) endpoint.getService();
this.jmsBinding = (JMSBinding) endpoint.getBinding();
this.serviceListenerFactory = serviceListenerFactory;
this.targetBinding = targetBinding;
this.targetBinding = jmsBinding;
this.jmsResourceFactory = jmsResourceFactory;
this.registry = registry;
@ -109,20 +110,20 @@ public class JMSBindingServiceBindingProvider implements ServiceBindingProviderR
this.operationSelectorProviderFactory =
(OperationSelectorProviderFactory)providerFactories.getProviderFactory(jmsBinding.getOperationSelector().getClass());
if (this.operationSelectorProviderFactory != null){
this.operationSelectorProvider = operationSelectorProviderFactory.createServiceOperationSelectorProvider(component, service, jmsBinding);
this.operationSelectorProvider = operationSelectorProviderFactory.createServiceOperationSelectorProvider(endpoint);
}
// Get the factories/providers for wire format
this.requestWireFormatProviderFactory =
(WireFormatProviderFactory)providerFactories.getProviderFactory(jmsBinding.getRequestWireFormat().getClass());
if (this.requestWireFormatProviderFactory != null){
this.requestWireFormatProvider = requestWireFormatProviderFactory.createServiceWireFormatProvider(component, service, jmsBinding);
this.requestWireFormatProvider = requestWireFormatProviderFactory.createServiceWireFormatProvider(endpoint);
}
this.responseWireFormatProviderFactory =
(WireFormatProviderFactory)providerFactories.getProviderFactory(jmsBinding.getResponseWireFormat().getClass());
if (this.responseWireFormatProviderFactory != null){
this.responseWireFormatProvider = responseWireFormatProviderFactory.createServiceWireFormatProvider(component, service, jmsBinding);
this.responseWireFormatProvider = responseWireFormatProviderFactory.createServiceWireFormatProvider(endpoint);
}
// create an interface contract that reflects both request and response
@ -171,15 +172,15 @@ public class JMSBindingServiceBindingProvider implements ServiceBindingProviderR
/*
* Adds JMS specific interceptors to the binding chain
*/
public void configureBindingChain(RuntimeWire runtimeWire) {
public void configure() {
InvocationChain bindingChain = runtimeWire.getBindingInvocationChain();
InvocationChain bindingChain = endpoint.getBindingInvocationChain();
// add transport interceptor
bindingChain.addInterceptor(Phase.SERVICE_BINDING_TRANSPORT,
new TransportServiceInterceptor(registry, jmsBinding,
jmsResourceFactory,
runtimeWire) );
endpoint) );
// add operation selector interceptor
bindingChain.addInterceptor(operationSelectorProvider.getPhase(),
@ -187,11 +188,11 @@ public class JMSBindingServiceBindingProvider implements ServiceBindingProviderR
// add operationProperties interceptor after operation selector
bindingChain.addInterceptor(Phase.SERVICE_BINDING_OPERATION_SELECTOR,
new OperationPropertiesInterceptor(jmsBinding, runtimeWire));
new OperationPropertiesInterceptor(jmsBinding, endpoint));
// add callback destination interceptor after operation selector
bindingChain.addInterceptor(Phase.SERVICE_BINDING_WIREFORMAT,
new CallbackDestinationInterceptor(runtimeWire));
new CallbackDestinationInterceptor(endpoint));
// add request wire format
bindingChain.addInterceptor(requestWireFormatProvider.getPhase(),
@ -228,4 +229,8 @@ public class JMSBindingServiceBindingProvider implements ServiceBindingProviderR
return jmsResourceFactory;
}
public RuntimeEndpoint getEndpoint() {
return endpoint;
}
}

View file

@ -33,8 +33,7 @@ import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.interfacedef.util.FaultException;
import org.apache.tuscany.sca.invocation.DataExchangeSemantics;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
import org.apache.tuscany.sca.runtime.RuntimeWire;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
import org.oasisopen.sca.ServiceRuntimeException;
/**
@ -51,18 +50,16 @@ public class RRBJMSBindingInvoker implements Invoker, DataExchangeSemantics {
protected JMSResourceFactory jmsResourceFactory;
protected Destination bindingRequestDest;
protected Destination bindingReplyDest;
protected RuntimeComponentReference reference;
protected RuntimeWire runtimeWire;
protected RuntimeEndpointReference endpointReference;
public RRBJMSBindingInvoker(JMSBinding jmsBinding, Operation operation, JMSResourceFactory jmsResourceFactory, RuntimeComponentReference reference) {
public RRBJMSBindingInvoker(Operation operation, JMSResourceFactory jmsResourceFactory, RuntimeEndpointReference epr) {
this.operation = operation;
operationName = operation.getName();
this.jmsBinding = jmsBinding;
this.endpointReference = epr;
this.jmsBinding = (JMSBinding) epr.getBinding();
this.jmsResourceFactory = jmsResourceFactory;
this.reference = reference;
this.runtimeWire = reference.getRuntimeWire(jmsBinding);
try {
// If this is a callback reference, the destination is determined dynamically based on
@ -200,7 +197,7 @@ public class RRBJMSBindingInvoker implements Invoker, DataExchangeSemantics {
context.setReplyToDestination(getReplyToDestination(session));
try {
tuscanyMsg = runtimeWire.getBindingInvocationChain().getHeadInvoker().invoke(tuscanyMsg);
tuscanyMsg = endpointReference.getBindingInvocationChain().getHeadInvoker().invoke(tuscanyMsg);
} catch (ServiceRuntimeException e) {
if (e.getCause() instanceof InvocationTargetException) {
if ((e.getCause().getCause() instanceof RuntimeException)) {

View file

@ -31,8 +31,7 @@ import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
import org.apache.tuscany.sca.runtime.RuntimeWire;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
/**
* Policy handler to handle PolicySet related to Logging with the QName
@ -43,11 +42,11 @@ import org.apache.tuscany.sca.runtime.RuntimeWire;
public class TransportReferenceInterceptor implements Interceptor {
private Invoker next;
private RuntimeWire runtimeWire;
private RuntimeEndpointReference runtimeWire;
private JMSResourceFactory jmsResourceFactory;
private JMSBinding jmsBinding;
public TransportReferenceInterceptor(JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeWire runtimeWire) {
public TransportReferenceInterceptor(JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeEndpointReference runtimeWire) {
super();
this.jmsBinding = jmsBinding;
this.runtimeWire = runtimeWire;

View file

@ -40,7 +40,7 @@ import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeWire;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
/**
*
@ -50,7 +50,7 @@ public class TransportServiceInterceptor implements Interceptor {
private static final Logger logger = Logger.getLogger(TransportServiceInterceptor.class.getName());
private Invoker next;
private RuntimeWire runtimeWire;
private RuntimeEndpoint endpoint;
private JMSResourceFactory jmsResourceFactory;
private JMSBinding jmsBinding;
private JMSMessageProcessor requestMessageProcessor;
@ -59,14 +59,14 @@ public class TransportServiceInterceptor implements Interceptor {
private String correlationScheme;
public TransportServiceInterceptor(ExtensionPointRegistry registry, JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeWire runtimeWire) {
public TransportServiceInterceptor(ExtensionPointRegistry registry, JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeEndpoint endpoint) {
super();
this.jmsBinding = jmsBinding;
this.runtimeWire = runtimeWire;
this.endpoint = endpoint;
this.jmsResourceFactory = jmsResourceFactory;
this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(registry, jmsBinding);
this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(registry, jmsBinding);
this.service = (RuntimeComponentService)runtimeWire.getEndpoint().getService();
this.service = (RuntimeComponentService)endpoint.getService();
this.correlationScheme = jmsBinding.getCorrelationScheme();
}

View file

@ -30,15 +30,15 @@ import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeWire;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
public class CallbackDestinationInterceptor implements Interceptor {
private Invoker next;
private RuntimeComponentService service;
public CallbackDestinationInterceptor(RuntimeWire runtimeWire) {
public CallbackDestinationInterceptor(RuntimeEndpoint endpoint) {
super();
this.service = (RuntimeComponentService) runtimeWire.getEndpoint().getService();
this.service = (RuntimeComponentService) endpoint.getService();
}
public Invoker getNext() {

View file

@ -26,7 +26,7 @@ import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeWire;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
public class OperationPropertiesInterceptor implements Interceptor {
private Invoker next;
@ -34,10 +34,10 @@ public class OperationPropertiesInterceptor implements Interceptor {
private RuntimeComponentService service;
private List<Operation> serviceOperations;
public OperationPropertiesInterceptor(JMSBinding jmsBinding, RuntimeWire runtimeWire) {
public OperationPropertiesInterceptor(JMSBinding jmsBinding, RuntimeEndpoint endpoint) {
super();
this.jmsBinding = jmsBinding;
this.service = (RuntimeComponentService) runtimeWire.getEndpoint().getService();
this.service = (RuntimeComponentService) endpoint.getService();
this.serviceOperations = service.getInterfaceContract().getInterface().getOperations();
}

View file

@ -19,14 +19,12 @@
package org.apache.tuscany.sca.binding.jms.wireformat.jmsbytes.runtime;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSBytes;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.provider.WireFormatProvider;
import org.apache.tuscany.sca.provider.WireFormatProviderFactory;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
/**
* @version $Rev$ $Date$
@ -41,18 +39,14 @@ public class WireFormatJMSBytesProviderFactory implements WireFormatProviderFact
/**
*/
public WireFormatProvider createReferenceWireFormatProvider(RuntimeComponent component,
RuntimeComponentReference reference,
Binding binding) {
return new WireFormatJMSBytesReferenceProvider(registry, component, reference, binding);
public WireFormatProvider createReferenceWireFormatProvider(RuntimeEndpointReference endpointReference) {
return new WireFormatJMSBytesReferenceProvider(registry, endpointReference);
}
/**
*/
public WireFormatProvider createServiceWireFormatProvider(RuntimeComponent component,
RuntimeComponentService service,
Binding binding) {
return new WireFormatJMSBytesServiceProvider(registry, component, service, binding);
public WireFormatProvider createServiceWireFormatProvider(RuntimeEndpoint endpoint) {
return new WireFormatJMSBytesServiceProvider(registry, endpoint);
}
/**

View file

@ -35,7 +35,7 @@ import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
import org.apache.tuscany.sca.runtime.RuntimeWire;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
/**
*
@ -44,16 +44,16 @@ import org.apache.tuscany.sca.runtime.RuntimeWire;
public class WireFormatJMSBytesReferenceInterceptor implements Interceptor {
private Invoker next;
private RuntimeWire runtimeWire;
private RuntimeEndpointReference endpointReference;
private JMSResourceFactory jmsResourceFactory;
private JMSBinding jmsBinding;
private JMSMessageProcessor requestMessageProcessor;
private JMSMessageProcessor responseMessageProcessor;
public WireFormatJMSBytesReferenceInterceptor(ExtensionPointRegistry registry, JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeWire runtimeWire) {
public WireFormatJMSBytesReferenceInterceptor(ExtensionPointRegistry registry, JMSResourceFactory jmsResourceFactory, RuntimeEndpointReference endpointReference) {
super();
this.jmsBinding = jmsBinding;
this.runtimeWire = runtimeWire;
this.endpointReference = endpointReference;
this.jmsBinding = (JMSBinding) endpointReference.getBinding();
this.jmsResourceFactory = jmsResourceFactory;
this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(registry, jmsBinding);
this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(registry, jmsBinding);

View file

@ -19,7 +19,6 @@
package org.apache.tuscany.sca.binding.jms.wireformat.jmsbytes.runtime;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.binding.jms.JMSBinding;
import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSBytes;
@ -28,28 +27,23 @@ import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Phase;
import org.apache.tuscany.sca.provider.WireFormatProvider;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
/**
* @version $Rev$ $Date$
*/
public class WireFormatJMSBytesReferenceProvider implements WireFormatProvider {
private ExtensionPointRegistry registry;
private RuntimeComponent component;
private RuntimeComponentReference reference;
private RuntimeEndpointReference endpointReference;
private JMSBinding binding;
private InterfaceContract interfaceContract;
public WireFormatJMSBytesReferenceProvider(ExtensionPointRegistry registry,
RuntimeComponent component,
RuntimeComponentReference reference,
Binding binding) {
RuntimeEndpointReference endpointReference) {
super();
this.registry = registry;
this.component = component;
this.reference = reference;
this.binding = (JMSBinding)binding;
this.endpointReference = endpointReference;
this.binding = (JMSBinding) endpointReference.getBinding();
// configure the reference based on this wire format
@ -65,7 +59,7 @@ public class WireFormatJMSBytesReferenceProvider implements WireFormatProvider {
// just point to the reference interface contract so no
// databinding transformation takes place
interfaceContract = reference.getReference().getInterfaceContract();
interfaceContract = endpointReference.getReference().getReference().getInterfaceContract();
}
public InterfaceContract configureWireFormatInterfaceContract(InterfaceContract interfaceContract){
@ -85,9 +79,7 @@ public class WireFormatJMSBytesReferenceProvider implements WireFormatProvider {
}
public Interceptor createInterceptor() {
return new WireFormatJMSBytesReferenceInterceptor(registry, binding,
null,
reference.getRuntimeWire(binding));
return new WireFormatJMSBytesReferenceInterceptor(registry, null, endpointReference);
}
public String getPhase() {

View file

@ -31,7 +31,7 @@ import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
import org.apache.tuscany.sca.runtime.RuntimeWire;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
/**
* Policy handler to handle PolicySet related to Logging with the QName
@ -41,16 +41,16 @@ import org.apache.tuscany.sca.runtime.RuntimeWire;
*/
public class WireFormatJMSBytesServiceInterceptor implements Interceptor {
private Invoker next;
private RuntimeWire runtimeWire;
private RuntimeEndpoint endpoint;
private JMSResourceFactory jmsResourceFactory;
private JMSBinding jmsBinding;
private JMSMessageProcessor requestMessageProcessor;
private JMSMessageProcessor responseMessageProcessor;
public WireFormatJMSBytesServiceInterceptor(ExtensionPointRegistry registry, JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeWire runtimeWire) {
public WireFormatJMSBytesServiceInterceptor(ExtensionPointRegistry registry, JMSResourceFactory jmsResourceFactory, RuntimeEndpoint endpoint) {
super();
this.jmsBinding = jmsBinding;
this.runtimeWire = runtimeWire;
this.endpoint = endpoint;
this.jmsBinding = (JMSBinding) endpoint.getBinding();
this.jmsResourceFactory = jmsResourceFactory;
this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(registry, jmsBinding);
this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(registry, jmsBinding);

View file

@ -19,7 +19,6 @@
package org.apache.tuscany.sca.binding.jms.wireformat.jmsbytes.runtime;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.binding.jms.JMSBinding;
import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSBytes;
@ -28,28 +27,23 @@ import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Phase;
import org.apache.tuscany.sca.provider.WireFormatProvider;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
/**
* @version $Rev$ $Date$
*/
public class WireFormatJMSBytesServiceProvider implements WireFormatProvider {
private ExtensionPointRegistry registry;
private RuntimeComponent component;
private RuntimeComponentService service;
private RuntimeEndpoint endpoint;
private JMSBinding binding;
private InterfaceContract interfaceContract;
public WireFormatJMSBytesServiceProvider(ExtensionPointRegistry registry,
RuntimeComponent component,
RuntimeComponentService service,
Binding binding) {
RuntimeEndpoint endpoint) {
super();
this.registry = registry;
this.component = component;
this.service = service;
this.binding = (JMSBinding)binding;
this.endpoint = endpoint;
this.binding = (JMSBinding) endpoint.getBinding();
// configure the service based on this wire format
@ -65,7 +59,7 @@ public class WireFormatJMSBytesServiceProvider implements WireFormatProvider {
// just point to the reference interface contract so no
// databinding transformation takes place
interfaceContract = service.getService().getInterfaceContract();
interfaceContract = endpoint.getService().getService().getInterfaceContract();
}
public InterfaceContract configureWireFormatInterfaceContract(InterfaceContract interfaceContract){
@ -87,9 +81,7 @@ public class WireFormatJMSBytesServiceProvider implements WireFormatProvider {
/**
*/
public Interceptor createInterceptor() {
return new WireFormatJMSBytesServiceInterceptor(registry, (JMSBinding)binding,
null,
service.getRuntimeWire(binding));
return new WireFormatJMSBytesServiceInterceptor(registry, null, endpoint);
}
/**

View file

@ -19,7 +19,6 @@
package org.apache.tuscany.sca.binding.jms.wireformat.jmsbytesxml.runtime;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.binding.jms.JMSBinding;
import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactoryExtensionPoint;
@ -27,9 +26,8 @@ import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSBytes;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.provider.WireFormatProvider;
import org.apache.tuscany.sca.provider.WireFormatProviderFactory;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
public class WireFormatJMSBytesXMLProviderFactory implements WireFormatProviderFactory<WireFormatJMSBytes> {
@ -44,19 +42,15 @@ public class WireFormatJMSBytesXMLProviderFactory implements WireFormatProviderF
/**
*/
public WireFormatProvider createReferenceWireFormatProvider(RuntimeComponent component,
RuntimeComponentReference reference,
Binding binding) {
return new WireFormatJMSBytesXMLReferenceProvider(registry, component, reference, binding);
public WireFormatProvider createReferenceWireFormatProvider(RuntimeEndpointReference endpointReference) {
return new WireFormatJMSBytesXMLReferenceProvider(registry, endpointReference);
}
/**
*/
public WireFormatProvider createServiceWireFormatProvider(RuntimeComponent component,
RuntimeComponentService service,
Binding binding) {
JMSResourceFactory jmsRF = jmsRFEP.createJMSResourceFactory((JMSBinding)binding);
return new WireFormatJMSBytesXMLServiceProvider(registry, component, service, binding, jmsRF);
public WireFormatProvider createServiceWireFormatProvider(RuntimeEndpoint endpoint) {
JMSResourceFactory jmsRF = jmsRFEP.createJMSResourceFactory((JMSBinding)endpoint.getBinding());
return new WireFormatJMSBytesXMLServiceProvider(registry, endpoint, jmsRF);
}
/**

View file

@ -36,22 +36,22 @@ import org.apache.tuscany.sca.interfacedef.util.FaultException;
import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
import org.apache.tuscany.sca.runtime.RuntimeWire;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
public class WireFormatJMSBytesXMLReferenceInterceptor implements Interceptor {
private Invoker next;
private RuntimeWire runtimeWire;
private RuntimeEndpointReference endpointReference;
private JMSResourceFactory jmsResourceFactory;
private JMSBinding jmsBinding;
private JMSMessageProcessor requestMessageProcessor;
private JMSMessageProcessor responseMessageProcessor;
public WireFormatJMSBytesXMLReferenceInterceptor(ExtensionPointRegistry registry, JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeWire runtimeWire) {
public WireFormatJMSBytesXMLReferenceInterceptor(ExtensionPointRegistry registry, JMSResourceFactory jmsResourceFactory, RuntimeEndpointReference endpointReference) {
super();
this.jmsBinding = jmsBinding;
this.runtimeWire = runtimeWire;
this.jmsBinding = (JMSBinding) endpointReference.getBinding();
this.endpointReference = endpointReference;
this.jmsResourceFactory = jmsResourceFactory;
this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(registry, jmsBinding);
this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(registry, jmsBinding);

View file

@ -20,7 +20,6 @@
package org.apache.tuscany.sca.binding.jms.wireformat.jmsbytesxml.runtime;
import org.apache.axiom.om.OMElement;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.binding.jms.JMSBinding;
import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSBytesXML;
@ -32,25 +31,20 @@ import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Phase;
import org.apache.tuscany.sca.provider.WireFormatProvider;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
public class WireFormatJMSBytesXMLReferenceProvider implements WireFormatProvider {
private ExtensionPointRegistry registry;
private RuntimeComponent component;
private RuntimeComponentReference reference;
private RuntimeEndpointReference endpointReference;
private JMSBinding binding;
private InterfaceContract interfaceContract;
public WireFormatJMSBytesXMLReferenceProvider(ExtensionPointRegistry registry,
RuntimeComponent component,
RuntimeComponentReference reference,
Binding binding) {
RuntimeEndpointReference endpointReference) {
super();
this.registry = registry;
this.component = component;
this.reference = reference;
this.binding = (JMSBinding)binding;
this.endpointReference = endpointReference;
this.binding = (JMSBinding)endpointReference.getBinding();
// configure the reference based on this wire format
@ -71,7 +65,7 @@ public class WireFormatJMSBytesXMLReferenceProvider implements WireFormatProvide
// as required
WebServiceBindingFactory wsFactory = registry.getExtensionPoint(WebServiceBindingFactory.class);
WebServiceBinding wsBinding = wsFactory.createWebServiceBinding();
BindingWSDLGenerator.generateWSDL(component, reference, wsBinding, registry, null);
BindingWSDLGenerator.generateWSDL(endpointReference.getComponent(), endpointReference.getContract(), wsBinding, registry, null);
interfaceContract = wsBinding.getBindingInterfaceContract();
interfaceContract.getInterface().resetDataBinding(OMElement.class.getName());
}
@ -93,9 +87,7 @@ public class WireFormatJMSBytesXMLReferenceProvider implements WireFormatProvide
}
public Interceptor createInterceptor() {
return new WireFormatJMSBytesXMLReferenceInterceptor(registry, binding,
null,
reference.getRuntimeWire(binding));
return new WireFormatJMSBytesXMLReferenceInterceptor(registry, null, endpointReference);
}
public String getPhase() {

View file

@ -31,20 +31,20 @@ import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
import org.apache.tuscany.sca.runtime.RuntimeWire;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
public class WireFormatJMSBytesXMLServiceInterceptor implements Interceptor {
private Invoker next;
private RuntimeWire runtimeWire;
private RuntimeEndpoint endpoint;
private JMSResourceFactory jmsResourceFactory;
private JMSBinding jmsBinding;
private JMSMessageProcessor requestMessageProcessor;
private JMSMessageProcessor responseMessageProcessor;
public WireFormatJMSBytesXMLServiceInterceptor(ExtensionPointRegistry registry, JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeWire runtimeWire) {
public WireFormatJMSBytesXMLServiceInterceptor(ExtensionPointRegistry registry, JMSResourceFactory jmsResourceFactory, RuntimeEndpoint endpoint) {
super();
this.jmsBinding = jmsBinding;
this.runtimeWire = runtimeWire;
this.jmsBinding = (JMSBinding) endpoint.getBinding();
this.endpoint = endpoint;
this.jmsResourceFactory = jmsResourceFactory;
this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(registry, jmsBinding);
this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(registry, jmsBinding);

View file

@ -20,7 +20,6 @@
package org.apache.tuscany.sca.binding.jms.wireformat.jmsbytesxml.runtime;
import org.apache.axiom.om.OMElement;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.binding.jms.JMSBinding;
import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
@ -33,27 +32,22 @@ import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Phase;
import org.apache.tuscany.sca.provider.WireFormatProvider;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
public class WireFormatJMSBytesXMLServiceProvider implements WireFormatProvider {
private ExtensionPointRegistry registry;
private RuntimeComponent component;
private RuntimeComponentService service;
private RuntimeEndpoint endpoint;
private JMSBinding binding;
private JMSResourceFactory jmsResourceFactory;
private InterfaceContract interfaceContract;
public WireFormatJMSBytesXMLServiceProvider(ExtensionPointRegistry registry,
RuntimeComponent component,
RuntimeComponentService service,
Binding binding,
JMSResourceFactory jmsResourceFactory) {
RuntimeEndpoint endpoint,
JMSResourceFactory jmsResourceFactory) {
super();
this.registry = registry;
this.component = component;
this.service = service;
this.binding = (JMSBinding)binding;
this.endpoint = endpoint;
this.binding = (JMSBinding)endpoint.getBinding();
this.jmsResourceFactory = jmsResourceFactory;
// configure the service based on this wire format
@ -75,7 +69,7 @@ public class WireFormatJMSBytesXMLServiceProvider implements WireFormatProvider
// as required
WebServiceBindingFactory wsFactory = registry.getExtensionPoint(WebServiceBindingFactory.class);
WebServiceBinding wsBinding = wsFactory.createWebServiceBinding();
BindingWSDLGenerator.generateWSDL(component, service, wsBinding, registry, null);
BindingWSDLGenerator.generateWSDL(endpoint.getComponent(), endpoint.getService(), wsBinding, registry, null);
interfaceContract = wsBinding.getBindingInterfaceContract();
interfaceContract.getInterface().resetDataBinding(OMElement.class.getName());
}
@ -99,9 +93,7 @@ public class WireFormatJMSBytesXMLServiceProvider implements WireFormatProvider
/**
*/
public Interceptor createInterceptor() {
return new WireFormatJMSBytesXMLServiceInterceptor(registry, (JMSBinding)binding,
jmsResourceFactory,
service.getRuntimeWire(binding));
return new WireFormatJMSBytesXMLServiceInterceptor(registry, jmsResourceFactory, endpoint);
}
/**

View file

@ -19,7 +19,6 @@
package org.apache.tuscany.sca.binding.jms.wireformat.jmsdefault.runtime;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.binding.jms.JMSBinding;
import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactoryExtensionPoint;
@ -27,9 +26,8 @@ import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSDefault;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.provider.WireFormatProvider;
import org.apache.tuscany.sca.provider.WireFormatProviderFactory;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
/**
* @version $Rev$ $Date$
@ -46,16 +44,15 @@ public class WireFormatJMSDefaultProviderFactory implements WireFormatProviderFa
/**
*/
public WireFormatProvider createReferenceWireFormatProvider(RuntimeComponent component, RuntimeComponentReference reference,
Binding binding) {
return new WireFormatJMSDefaultReferenceProvider(registry, component, reference, binding);
public WireFormatProvider createReferenceWireFormatProvider(RuntimeEndpointReference endpointReference) {
return new WireFormatJMSDefaultReferenceProvider(registry, endpointReference);
}
/**
*/
public WireFormatProvider createServiceWireFormatProvider(RuntimeComponent component, RuntimeComponentService service, Binding binding) {
JMSResourceFactory jmsRF = jmsRFEP.createJMSResourceFactory((JMSBinding) binding);
return new WireFormatJMSDefaultServiceProvider(registry, component, service, binding, jmsRF);
public WireFormatProvider createServiceWireFormatProvider(RuntimeEndpoint endpoint) {
JMSResourceFactory jmsRF = jmsRFEP.createJMSResourceFactory((JMSBinding) endpoint.getBinding());
return new WireFormatJMSDefaultServiceProvider(registry, endpoint, jmsRF);
}
/**

View file

@ -40,7 +40,7 @@ import org.apache.tuscany.sca.interfacedef.util.FaultException;
import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
import org.apache.tuscany.sca.runtime.RuntimeWire;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
/**
*
@ -49,7 +49,7 @@ import org.apache.tuscany.sca.runtime.RuntimeWire;
public class WireFormatJMSDefaultReferenceInterceptor implements Interceptor {
private Invoker next;
private RuntimeWire runtimeWire;
private RuntimeEndpointReference endpointReference;
private JMSResourceFactory jmsResourceFactory;
private JMSBinding jmsBinding;
private DefaultMessageProcessor requestMessageProcessor;
@ -57,11 +57,11 @@ public class WireFormatJMSDefaultReferenceInterceptor implements Interceptor {
private HashMap<String, Boolean> inputWrapperMap;
private HashMap<String, OMElement> outputWrapperMap;
public WireFormatJMSDefaultReferenceInterceptor(ExtensionPointRegistry registry, JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeWire runtimeWire, HashMap<String, Boolean> inputWrapperMap,
public WireFormatJMSDefaultReferenceInterceptor(ExtensionPointRegistry registry, JMSResourceFactory jmsResourceFactory, RuntimeEndpointReference endpointReference, HashMap<String, Boolean> inputWrapperMap,
HashMap<String, OMElement> outputWrapperMap) {
super();
this.jmsBinding = jmsBinding;
this.runtimeWire = runtimeWire;
this.jmsBinding = (JMSBinding) endpointReference.getBinding();
this.endpointReference = endpointReference;
this.jmsResourceFactory = jmsResourceFactory;
// Note the default processor doesn't follow the normal processor pattern
// as it has to handle both text and bytes messages

View file

@ -26,7 +26,7 @@ import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.assembly.ComponentReference;
import org.apache.tuscany.sca.binding.jms.JMSBinding;
import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSDefault;
@ -41,27 +41,25 @@ import org.apache.tuscany.sca.interfacedef.util.ElementInfo;
import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Phase;
import org.apache.tuscany.sca.provider.WireFormatProvider;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
/**
* @version $Rev$ $Date$
*/
public class WireFormatJMSDefaultReferenceProvider implements WireFormatProvider {
private ExtensionPointRegistry registry;
private RuntimeComponent component;
private RuntimeComponentReference reference;
private RuntimeEndpointReference endpointReference;
private ComponentReference reference;
private JMSBinding binding;
private InterfaceContract interfaceContract;
private HashMap<String, Boolean> inputWrapperMap;
private HashMap<String, OMElement> outputWrapperMap;
public WireFormatJMSDefaultReferenceProvider(ExtensionPointRegistry registry, RuntimeComponent component, RuntimeComponentReference reference, Binding binding) {
public WireFormatJMSDefaultReferenceProvider(ExtensionPointRegistry registry, RuntimeEndpointReference endpointReference) {
super();
this.registry = registry;
this.component = component;
this.reference = reference;
this.binding = (JMSBinding) binding;
this.endpointReference = endpointReference;
this.binding = (JMSBinding) endpointReference.getBinding();
this.inputWrapperMap = new HashMap<String, Boolean>();
this.outputWrapperMap = new HashMap<String, OMElement>();
@ -78,6 +76,7 @@ public class WireFormatJMSDefaultReferenceProvider implements WireFormatProvider
this.binding.setResponseMessageProcessorName(JMSBindingConstants.DEFAULT_MP_CLASSNAME);
}
this.reference = endpointReference.getReference();
// TODO - can be null if it's a $self$ reference. Need to decide if
// that's valid
if (reference.getReference() == null){
@ -96,7 +95,7 @@ public class WireFormatJMSDefaultReferenceProvider implements WireFormatProvider
if (reference.getInterfaceContract() != null && !isAsIs()) {
WebServiceBindingFactory wsFactory = registry.getExtensionPoint(WebServiceBindingFactory.class);
WebServiceBinding wsBinding = wsFactory.createWebServiceBinding();
BindingWSDLGenerator.generateWSDL(component, reference, wsBinding, registry, null);
BindingWSDLGenerator.generateWSDL(endpointReference.getComponent(), reference, wsBinding, registry, null);
interfaceContract = wsBinding.getBindingInterfaceContract();
interfaceContract.getInterface().resetDataBinding(OMElement.class.getName());
@ -189,7 +188,7 @@ public class WireFormatJMSDefaultReferenceProvider implements WireFormatProvider
}
public Interceptor createInterceptor() {
return new WireFormatJMSDefaultReferenceInterceptor(registry, (JMSBinding) binding, null, reference.getRuntimeWire(binding), inputWrapperMap, outputWrapperMap);
return new WireFormatJMSDefaultReferenceInterceptor(registry, null, endpointReference, inputWrapperMap, outputWrapperMap);
}
public String getPhase() {

View file

@ -36,7 +36,7 @@ import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
import org.apache.tuscany.sca.runtime.RuntimeWire;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
/**
* Policy handler to handle PolicySet related to Logging with the QName {http://tuscany.apache.org/xmlns/sca/1.0/impl/java}LoggingPolicy
@ -45,7 +45,7 @@ import org.apache.tuscany.sca.runtime.RuntimeWire;
*/
public class WireFormatJMSDefaultServiceInterceptor implements Interceptor {
private Invoker next;
private RuntimeWire runtimeWire;
private RuntimeEndpoint endpoint;
private JMSResourceFactory jmsResourceFactory;
private JMSBinding jmsBinding;
private DefaultMessageProcessor requestMessageProcessor;
@ -53,11 +53,11 @@ public class WireFormatJMSDefaultServiceInterceptor implements Interceptor {
private HashMap<String,OMElement> inputWrapperMap;
private HashMap<String, Boolean> outputWrapperMap;
public WireFormatJMSDefaultServiceInterceptor(ExtensionPointRegistry registry, JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeWire runtimeWire, HashMap<String, OMElement> inputWrapperMap,
public WireFormatJMSDefaultServiceInterceptor(ExtensionPointRegistry registry, JMSResourceFactory jmsResourceFactory, RuntimeEndpoint endpoint, HashMap<String, OMElement> inputWrapperMap,
HashMap<String, Boolean> outputWrapperMap) {
super();
this.jmsBinding = jmsBinding;
this.runtimeWire = runtimeWire;
this.jmsBinding = (JMSBinding) endpoint.getBinding();
this.endpoint = endpoint;
this.jmsResourceFactory = jmsResourceFactory;
// Note the default processor doesn't follow the normal processor pattern
// as it has to handle both text and bytes messages

View file

@ -26,7 +26,7 @@ import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.assembly.ComponentService;
import org.apache.tuscany.sca.binding.jms.JMSBinding;
import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
@ -42,27 +42,26 @@ import org.apache.tuscany.sca.interfacedef.util.ElementInfo;
import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Phase;
import org.apache.tuscany.sca.provider.WireFormatProvider;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
/**
* @version $Rev$ $Date$
*/
public class WireFormatJMSDefaultServiceProvider implements WireFormatProvider {
private ExtensionPointRegistry registry;
private RuntimeComponent component;
private RuntimeComponentService service;
private RuntimeEndpoint endpoint;
private ComponentService service;
private JMSBinding binding;
private JMSResourceFactory jmsResourceFactory;
private InterfaceContract interfaceContract;
private HashMap<String, OMElement> inputWrapperMap;
private HashMap<String, Boolean> outputWrapperMap;
public WireFormatJMSDefaultServiceProvider(ExtensionPointRegistry registry, RuntimeComponent component, RuntimeComponentService service, Binding binding, JMSResourceFactory jmsResourceFactory) {
public WireFormatJMSDefaultServiceProvider(ExtensionPointRegistry registry, RuntimeEndpoint endpoint, JMSResourceFactory jmsResourceFactory) {
super();
this.component = component;
this.service = service;
this.binding = (JMSBinding) binding;
this.endpoint = endpoint;
this.binding = (JMSBinding) endpoint.getBinding();
this.service = endpoint.getService();
this.jmsResourceFactory = jmsResourceFactory;
this.inputWrapperMap = new HashMap<String, OMElement>();
@ -92,7 +91,7 @@ public class WireFormatJMSDefaultServiceProvider implements WireFormatProvider {
if (service.getInterfaceContract() != null && !isAsIs()) {
WebServiceBindingFactory wsFactory = registry.getExtensionPoint(WebServiceBindingFactory.class);
WebServiceBinding wsBinding = wsFactory.createWebServiceBinding();
BindingWSDLGenerator.generateWSDL(component, service, wsBinding, registry, null);
BindingWSDLGenerator.generateWSDL(endpoint.getComponent(), service, wsBinding, registry, null);
interfaceContract = wsBinding.getBindingInterfaceContract();
interfaceContract.getInterface().resetDataBinding(OMElement.class.getName());
@ -181,7 +180,7 @@ public class WireFormatJMSDefaultServiceProvider implements WireFormatProvider {
public Interceptor createInterceptor() {
return new WireFormatJMSDefaultServiceInterceptor(registry, binding, jmsResourceFactory, service.getRuntimeWire(binding), this.inputWrapperMap, this.outputWrapperMap);
return new WireFormatJMSDefaultServiceInterceptor(registry, jmsResourceFactory, endpoint, this.inputWrapperMap, this.outputWrapperMap);
}
public String getPhase() {

View file

@ -19,14 +19,12 @@
package org.apache.tuscany.sca.binding.jms.wireformat.jmsobject.runtime;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSObject;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.provider.WireFormatProvider;
import org.apache.tuscany.sca.provider.WireFormatProviderFactory;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
/**
* @version $Rev$ $Date$
@ -41,18 +39,14 @@ public class WireFormatJMSObjectProviderFactory implements WireFormatProviderFac
/**
*/
public WireFormatProvider createReferenceWireFormatProvider(RuntimeComponent component,
RuntimeComponentReference reference,
Binding binding) {
return new WireFormatJMSObjectReferenceProvider(registry, component, reference, binding);
public WireFormatProvider createReferenceWireFormatProvider(RuntimeEndpointReference endpointReference) {
return new WireFormatJMSObjectReferenceProvider(registry, endpointReference);
}
/**
*/
public WireFormatProvider createServiceWireFormatProvider(RuntimeComponent component,
RuntimeComponentService service,
Binding binding) {
return new WireFormatJMSObjectServiceProvider(registry, component, service, binding);
public WireFormatProvider createServiceWireFormatProvider(RuntimeEndpoint endpoint) {
return new WireFormatJMSObjectServiceProvider(registry, endpoint);
}
/**

View file

@ -37,7 +37,7 @@ import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
import org.apache.tuscany.sca.runtime.RuntimeWire;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
/**
*
@ -46,7 +46,7 @@ import org.apache.tuscany.sca.runtime.RuntimeWire;
public class WireFormatJMSObjectReferenceInterceptor implements Interceptor {
private Invoker next;
private RuntimeWire runtimeWire;
private RuntimeEndpointReference endpointReference;
private JMSResourceFactory jmsResourceFactory;
private JMSBinding jmsBinding;
private JMSMessageProcessor requestMessageProcessor;
@ -54,10 +54,10 @@ public class WireFormatJMSObjectReferenceInterceptor implements Interceptor {
private HashMap<String, String> singleArgMap;
public WireFormatJMSObjectReferenceInterceptor(ExtensionPointRegistry registry, JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeWire runtimeWire, HashMap<String, String> hashMap) {
public WireFormatJMSObjectReferenceInterceptor(ExtensionPointRegistry registry, JMSResourceFactory jmsResourceFactory, RuntimeEndpointReference endpointReference, HashMap<String, String> hashMap) {
super();
this.jmsBinding = jmsBinding;
this.runtimeWire = runtimeWire;
this.jmsBinding = (JMSBinding) endpointReference.getBinding();
this.endpointReference = endpointReference;
this.jmsResourceFactory = jmsResourceFactory;
this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(registry, jmsBinding);
this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(registry, jmsBinding);

View file

@ -22,7 +22,7 @@ package org.apache.tuscany.sca.binding.jms.wireformat.jmsobject.runtime;
import java.util.HashMap;
import java.util.List;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.assembly.ComponentReference;
import org.apache.tuscany.sca.binding.jms.JMSBinding;
import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSObject;
@ -32,32 +32,28 @@ import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Phase;
import org.apache.tuscany.sca.provider.WireFormatProvider;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
/**
* @version $Rev$ $Date$
*/
public class WireFormatJMSObjectReferenceProvider implements WireFormatProvider {
private ExtensionPointRegistry registry;
private RuntimeComponent component;
private RuntimeComponentReference reference;
private RuntimeEndpointReference endpointReference;
private JMSBinding binding;
private InterfaceContract interfaceContract;
private HashMap<String,String> singleArgMap; //map of one arg operations, leave empty if wrapSingleInput is true
public WireFormatJMSObjectReferenceProvider(ExtensionPointRegistry registry,
RuntimeComponent component,
RuntimeComponentReference reference,
Binding binding) {
RuntimeEndpointReference endpointReference) {
super();
this.registry = registry;
this.component = component;
this.reference = reference;
this.binding = (JMSBinding)binding;
this.endpointReference = endpointReference;
this.binding = (JMSBinding)endpointReference.getBinding();
this.singleArgMap = new HashMap<String,String>();
ComponentReference reference = endpointReference.getReference();
// configure the reference based on this wire format
@ -104,9 +100,7 @@ public class WireFormatJMSObjectReferenceProvider implements WireFormatProvider
}
public Interceptor createInterceptor() {
return new WireFormatJMSObjectReferenceInterceptor(registry, binding,
null,
reference.getRuntimeWire(binding), this.singleArgMap);
return new WireFormatJMSObjectReferenceInterceptor(registry, null, endpointReference, this.singleArgMap);
}
public String getPhase() {

View file

@ -34,7 +34,7 @@ import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
import org.apache.tuscany.sca.runtime.RuntimeWire;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
/**
* Policy handler to handle PolicySet related to Logging with the QName
@ -44,7 +44,7 @@ import org.apache.tuscany.sca.runtime.RuntimeWire;
*/
public class WireFormatJMSObjectServiceInterceptor implements Interceptor {
private Invoker next;
private RuntimeWire runtimeWire;
private RuntimeEndpoint endpoint;
private JMSResourceFactory jmsResourceFactory;
private JMSBinding jmsBinding;
private JMSMessageProcessor requestMessageProcessor;
@ -52,11 +52,11 @@ public class WireFormatJMSObjectServiceInterceptor implements Interceptor {
private HashMap<String,Class<?>> singleArgMap;
private boolean wrapSingle;
public WireFormatJMSObjectServiceInterceptor(ExtensionPointRegistry registry, JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory,
RuntimeWire runtimeWire, HashMap<String, Class<?>> singleArgMap, boolean wrapSingle) {
public WireFormatJMSObjectServiceInterceptor(ExtensionPointRegistry registry, JMSResourceFactory jmsResourceFactory,
RuntimeEndpoint endpoint, HashMap<String, Class<?>> singleArgMap, boolean wrapSingle) {
super();
this.jmsBinding = jmsBinding;
this.runtimeWire = runtimeWire;
this.jmsBinding = (JMSBinding) endpoint.getBinding();
this.endpoint = endpoint;
this.jmsResourceFactory = jmsResourceFactory;
this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(registry, jmsBinding);
this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(registry, jmsBinding);

View file

@ -23,7 +23,7 @@ package org.apache.tuscany.sca.binding.jms.wireformat.jmsobject.runtime;
import java.util.HashMap;
import java.util.List;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.assembly.ComponentService;
import org.apache.tuscany.sca.binding.jms.JMSBinding;
import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSObject;
@ -33,32 +33,27 @@ import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Phase;
import org.apache.tuscany.sca.provider.WireFormatProvider;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
/**
* @version $Rev$ $Date$
*/
public class WireFormatJMSObjectServiceProvider implements WireFormatProvider {
private ExtensionPointRegistry registry;
private RuntimeComponent component;
private RuntimeComponentService service;
private RuntimeEndpoint endpoint;
private JMSBinding binding;
private InterfaceContract interfaceContract;
private HashMap<String,Class<?>> singleArgMap;
private boolean wrapSingle = true;
public WireFormatJMSObjectServiceProvider(ExtensionPointRegistry registry,
RuntimeComponent component,
RuntimeComponentService service,
Binding binding) {
public WireFormatJMSObjectServiceProvider(ExtensionPointRegistry registry, RuntimeEndpoint endpoint) {
super();
this.registry = registry;
this.component = component;
this.service = service;
this.binding = (JMSBinding)binding;
this.endpoint = endpoint;
this.binding = (JMSBinding)endpoint.getBinding();
this.singleArgMap = new HashMap<String,Class<?>>();
ComponentService service = endpoint.getService();
// configure the service based on this wire format
// currently maintaining the message processor structure which
@ -108,9 +103,8 @@ public class WireFormatJMSObjectServiceProvider implements WireFormatProvider {
/**
*/
public Interceptor createInterceptor() {
return new WireFormatJMSObjectServiceInterceptor(registry, (JMSBinding)binding, null,service.getRuntimeWire(binding),
this.singleArgMap, wrapSingle );
return new WireFormatJMSObjectServiceInterceptor(registry, null, endpoint, this.singleArgMap, wrapSingle);
}
/**

View file

@ -19,14 +19,12 @@
package org.apache.tuscany.sca.binding.jms.wireformat.jmstext.runtime;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSText;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.provider.WireFormatProvider;
import org.apache.tuscany.sca.provider.WireFormatProviderFactory;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
/**
* @version $Rev$ $Date$
@ -41,18 +39,14 @@ public class WireFormatJMSTextProviderFactory implements WireFormatProviderFacto
/**
*/
public WireFormatProvider createReferenceWireFormatProvider(RuntimeComponent component,
RuntimeComponentReference reference,
Binding binding) {
return new WireFormatJMSTextReferenceProvider(registry, component, reference, binding);
public WireFormatProvider createReferenceWireFormatProvider(RuntimeEndpointReference endpointReference) {
return new WireFormatJMSTextReferenceProvider(registry, endpointReference);
}
/**
*/
public WireFormatProvider createServiceWireFormatProvider(RuntimeComponent component,
RuntimeComponentService service,
Binding binding) {
return new WireFormatJMSTextServiceProvider(registry, component, service, binding);
public WireFormatProvider createServiceWireFormatProvider(RuntimeEndpoint endpoint) {
return new WireFormatJMSTextServiceProvider(registry, endpoint);
}
/**

View file

@ -35,7 +35,7 @@ import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
import org.apache.tuscany.sca.runtime.RuntimeWire;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
/**
*
@ -44,16 +44,16 @@ import org.apache.tuscany.sca.runtime.RuntimeWire;
public class WireFormatJMSTextReferenceInterceptor implements Interceptor {
private Invoker next;
private RuntimeWire runtimeWire;
private RuntimeEndpointReference endpointReference;
private JMSResourceFactory jmsResourceFactory;
private JMSBinding jmsBinding;
private JMSMessageProcessor requestMessageProcessor;
private JMSMessageProcessor responseMessageProcessor;
public WireFormatJMSTextReferenceInterceptor(ExtensionPointRegistry registry, JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeWire runtimeWire) {
public WireFormatJMSTextReferenceInterceptor(ExtensionPointRegistry registry, JMSResourceFactory jmsResourceFactory, RuntimeEndpointReference endpointReference) {
super();
this.jmsBinding = jmsBinding;
this.runtimeWire = runtimeWire;
this.jmsBinding = (JMSBinding) endpointReference.getBinding();
this.endpointReference = endpointReference;
this.jmsResourceFactory = jmsResourceFactory;
this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(registry, jmsBinding);
this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(registry, jmsBinding);

View file

@ -20,7 +20,6 @@
package org.apache.tuscany.sca.binding.jms.wireformat.jmstext.runtime;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.binding.jms.JMSBinding;
import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSText;
@ -29,28 +28,23 @@ import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Phase;
import org.apache.tuscany.sca.provider.WireFormatProvider;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
/**
* @version $Rev$ $Date$
*/
public class WireFormatJMSTextReferenceProvider implements WireFormatProvider {
private ExtensionPointRegistry registry;
private RuntimeComponent component;
private RuntimeComponentReference reference;
private RuntimeEndpointReference endpointReference;
private JMSBinding binding;
private InterfaceContract interfaceContract;
public WireFormatJMSTextReferenceProvider(ExtensionPointRegistry registry,
RuntimeComponent component,
RuntimeComponentReference reference,
Binding binding) {
RuntimeEndpointReference endpointReference) {
super();
this.registry = registry;
this.component = component;
this.reference = reference;
this.binding = (JMSBinding)binding;
this.endpointReference = endpointReference;
this.binding = (JMSBinding)endpointReference.getBinding();
// configure the reference based on this wire format
@ -74,7 +68,7 @@ public class WireFormatJMSTextReferenceProvider implements WireFormatProvider {
// just point to the reference interface contract so no
// databinding transformation takes place
interfaceContract = reference.getReference().getInterfaceContract();
interfaceContract = endpointReference.getReference().getReference().getInterfaceContract();
}
public InterfaceContract configureWireFormatInterfaceContract(InterfaceContract interfaceContract){
@ -94,9 +88,7 @@ public class WireFormatJMSTextReferenceProvider implements WireFormatProvider {
}
public Interceptor createInterceptor() {
return new WireFormatJMSTextReferenceInterceptor(registry, binding,
null,
reference.getRuntimeWire(binding));
return new WireFormatJMSTextReferenceInterceptor(registry, null, endpointReference);
}
public String getPhase() {

View file

@ -31,7 +31,7 @@ import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
import org.apache.tuscany.sca.runtime.RuntimeWire;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
/**
* Policy handler to handle PolicySet related to Logging with the QName
@ -41,16 +41,16 @@ import org.apache.tuscany.sca.runtime.RuntimeWire;
*/
public class WireFormatJMSTextServiceInterceptor implements Interceptor {
private Invoker next;
private RuntimeWire runtimeWire;
private RuntimeEndpoint endpoint;
private JMSResourceFactory jmsResourceFactory;
private JMSBinding jmsBinding;
private JMSMessageProcessor requestMessageProcessor;
private JMSMessageProcessor responseMessageProcessor;
public WireFormatJMSTextServiceInterceptor(ExtensionPointRegistry registry, JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeWire runtimeWire) {
public WireFormatJMSTextServiceInterceptor(ExtensionPointRegistry registry, JMSResourceFactory jmsResourceFactory, RuntimeEndpoint endpoint) {
super();
this.jmsBinding = jmsBinding;
this.runtimeWire = runtimeWire;
this.jmsBinding = (JMSBinding) endpoint.getBinding();
this.endpoint = endpoint;
this.jmsResourceFactory = jmsResourceFactory;
this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(registry, jmsBinding);
this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(registry, jmsBinding);

View file

@ -19,7 +19,6 @@
package org.apache.tuscany.sca.binding.jms.wireformat.jmstext.runtime;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.binding.jms.JMSBinding;
import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSText;
@ -28,28 +27,23 @@ import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Phase;
import org.apache.tuscany.sca.provider.WireFormatProvider;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
/**
* @version $Rev$ $Date$
*/
public class WireFormatJMSTextServiceProvider implements WireFormatProvider {
private ExtensionPointRegistry registry;
private RuntimeComponent component;
private RuntimeComponentService service;
private RuntimeEndpoint endpoint;
private JMSBinding binding;
private InterfaceContract interfaceContract;
public WireFormatJMSTextServiceProvider(ExtensionPointRegistry registry,
RuntimeComponent component,
RuntimeComponentService service,
Binding binding) {
RuntimeEndpoint endpoint) {
super();
this.registry = registry;
this.component = component;
this.service = service;
this.binding = (JMSBinding)binding;
this.endpoint = endpoint;
this.binding = (JMSBinding)endpoint.getBinding();
// configure the service based on this wire format
@ -72,7 +66,7 @@ public class WireFormatJMSTextServiceProvider implements WireFormatProvider {
// just point to the reference interface contract so no
// databinding transformation takes place
interfaceContract = service.getService().getInterfaceContract();
interfaceContract = endpoint.getService().getService().getInterfaceContract();
}
public InterfaceContract configureWireFormatInterfaceContract(InterfaceContract interfaceContract){
@ -94,9 +88,7 @@ public class WireFormatJMSTextServiceProvider implements WireFormatProvider {
/**
*/
public Interceptor createInterceptor() {
return new WireFormatJMSTextServiceInterceptor(registry, (JMSBinding)binding,
null,
service.getRuntimeWire(binding));
return new WireFormatJMSTextServiceInterceptor(registry, null, endpoint);
}
/**

View file

@ -19,7 +19,6 @@
package org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.runtime;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.binding.jms.JMSBinding;
import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactoryExtensionPoint;
@ -27,9 +26,8 @@ import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSTextXML;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.provider.WireFormatProvider;
import org.apache.tuscany.sca.provider.WireFormatProviderFactory;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
/**
* @version $Rev$ $Date$
@ -46,19 +44,15 @@ public class WireFormatJMSTextXMLProviderFactory implements WireFormatProviderFa
/**
*/
public WireFormatProvider createReferenceWireFormatProvider(RuntimeComponent component,
RuntimeComponentReference reference,
Binding binding) {
return new WireFormatJMSTextXMLReferenceProvider(registry, component, reference, binding);
public WireFormatProvider createReferenceWireFormatProvider(RuntimeEndpointReference endpointReference) {
return new WireFormatJMSTextXMLReferenceProvider(registry, endpointReference);
}
/**
*/
public WireFormatProvider createServiceWireFormatProvider(RuntimeComponent component,
RuntimeComponentService service,
Binding binding) {
JMSResourceFactory jmsRF = jmsRFEP.createJMSResourceFactory((JMSBinding)binding);
return new WireFormatJMSTextXMLServiceProvider(registry, component, service, binding, jmsRF);
public WireFormatProvider createServiceWireFormatProvider(RuntimeEndpoint endpoint) {
JMSResourceFactory jmsRF = jmsRFEP.createJMSResourceFactory((JMSBinding)endpoint.getBinding());
return new WireFormatJMSTextXMLServiceProvider(registry, endpoint, jmsRF);
}
/**

View file

@ -38,7 +38,7 @@ import org.apache.tuscany.sca.interfacedef.util.FaultException;
import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
import org.apache.tuscany.sca.runtime.RuntimeWire;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
import org.w3c.dom.Node;
/**
@ -48,16 +48,17 @@ import org.w3c.dom.Node;
public class WireFormatJMSTextXMLReferenceInterceptor implements Interceptor {
private Invoker next;
private RuntimeWire runtimeWire;
private RuntimeEndpointReference endpointReference;
private JMSResourceFactory jmsResourceFactory;
private JMSBinding jmsBinding;
private JMSMessageProcessor requestMessageProcessor;
private JMSMessageProcessor responseMessageProcessor;
public WireFormatJMSTextXMLReferenceInterceptor(ExtensionPointRegistry registry, JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeWire runtimeWire) {
public WireFormatJMSTextXMLReferenceInterceptor(ExtensionPointRegistry registry, JMSResourceFactory jmsResourceFactory, RuntimeEndpointReference endpointReference) {
super();
this.jmsBinding = jmsBinding;
this.runtimeWire = runtimeWire;
this.jmsBinding = (JMSBinding) endpointReference.getBinding();
this.endpointReference = endpointReference;
this.jmsResourceFactory = jmsResourceFactory;
this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(registry, jmsBinding);
this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(registry, jmsBinding);

View file

@ -19,7 +19,6 @@
package org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.runtime;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.binding.jms.JMSBinding;
import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
import org.apache.tuscany.sca.binding.jms.wireformat.WireFormatJMSTextXML;
@ -32,28 +31,23 @@ import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Phase;
import org.apache.tuscany.sca.provider.WireFormatProvider;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
/**
* @version $Rev$ $Date$
*/
public class WireFormatJMSTextXMLReferenceProvider implements WireFormatProvider {
private ExtensionPointRegistry registry;
private RuntimeComponent component;
private RuntimeComponentReference reference;
private RuntimeEndpointReference endpointReference;
private JMSBinding binding;
private InterfaceContract interfaceContract;
public WireFormatJMSTextXMLReferenceProvider(ExtensionPointRegistry registry,
RuntimeComponent component,
RuntimeComponentReference reference,
Binding binding) {
RuntimeEndpointReference endpointReference) {
super();
this.registry = registry;
this.component = component;
this.reference = reference;
this.binding = (JMSBinding)binding;
this.endpointReference = endpointReference;
this.binding = (JMSBinding)endpointReference.getBinding();
// configure the reference based on this wire format
@ -75,13 +69,13 @@ public class WireFormatJMSTextXMLReferenceProvider implements WireFormatProvider
// as required
WebServiceBindingFactory wsFactory = registry.getExtensionPoint(WebServiceBindingFactory.class);
WebServiceBinding wsBinding = wsFactory.createWebServiceBinding();
BindingWSDLGenerator.generateWSDL(component, reference, wsBinding, registry, null);
BindingWSDLGenerator.generateWSDL(endpointReference.getComponent(), endpointReference.getReference(), wsBinding, registry, null);
interfaceContract = wsBinding.getBindingInterfaceContract();
interfaceContract.getInterface().resetDataBinding(DOMDataBinding.NAME);
}
protected boolean isOnMessage() {
InterfaceContract ic = reference.getInterfaceContract();
InterfaceContract ic = endpointReference.getReference().getInterfaceContract();
if (ic.getInterface().getOperations().size() != 1) {
return false;
}
@ -105,7 +99,7 @@ public class WireFormatJMSTextXMLReferenceProvider implements WireFormatProvider
}
public Interceptor createInterceptor() {
return new WireFormatJMSTextXMLReferenceInterceptor(registry, (JMSBinding)binding, null, reference.getRuntimeWire(binding));
return new WireFormatJMSTextXMLReferenceInterceptor(registry, null, endpointReference);
}
public String getPhase() {

View file

@ -31,7 +31,7 @@ import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
import org.apache.tuscany.sca.runtime.RuntimeWire;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
/**
* Policy handler to handle PolicySet related to Logging with the QName
@ -41,16 +41,16 @@ import org.apache.tuscany.sca.runtime.RuntimeWire;
*/
public class WireFormatJMSTextXMLServiceInterceptor implements Interceptor {
private Invoker next;
private RuntimeWire runtimeWire;
private RuntimeEndpoint endpoint;
private JMSResourceFactory jmsResourceFactory;
private JMSBinding jmsBinding;
private JMSMessageProcessor requestMessageProcessor;
private JMSMessageProcessor responseMessageProcessor;
public WireFormatJMSTextXMLServiceInterceptor(ExtensionPointRegistry registry, JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeWire runtimeWire) {
public WireFormatJMSTextXMLServiceInterceptor(ExtensionPointRegistry registry, JMSResourceFactory jmsResourceFactory, RuntimeEndpoint endpoint) {
super();
this.jmsBinding = jmsBinding;
this.runtimeWire = runtimeWire;
this.jmsBinding = (JMSBinding) endpoint.getBinding();
this.endpoint = endpoint;
this.jmsResourceFactory = jmsResourceFactory;
this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(registry, jmsBinding);
this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(registry, jmsBinding);

View file

@ -19,7 +19,6 @@
package org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.runtime;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.binding.jms.JMSBinding;
import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
@ -33,29 +32,24 @@ import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Phase;
import org.apache.tuscany.sca.provider.WireFormatProvider;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
/**
* @version $Rev$ $Date$
*/
public class WireFormatJMSTextXMLServiceProvider implements WireFormatProvider {
private ExtensionPointRegistry registry;
private RuntimeComponent component;
private RuntimeComponentService service;
private RuntimeEndpoint endpoint;
private JMSBinding binding;
private JMSResourceFactory jmsResourceFactory;
private InterfaceContract interfaceContract;
public WireFormatJMSTextXMLServiceProvider(ExtensionPointRegistry registry,
RuntimeComponent component,
RuntimeComponentService service,
Binding binding,
RuntimeEndpoint endpoint,
JMSResourceFactory jmsResourceFactory) {
super();
this.component = component;
this.service = service;
this.binding = (JMSBinding)binding;
this.endpoint = endpoint;
this.binding = (JMSBinding)endpoint.getBinding();
this.jmsResourceFactory = jmsResourceFactory;
this.registry = registry;
@ -78,7 +72,7 @@ public class WireFormatJMSTextXMLServiceProvider implements WireFormatProvider {
// as required
WebServiceBindingFactory wsFactory = registry.getExtensionPoint(WebServiceBindingFactory.class);
WebServiceBinding wsBinding = wsFactory.createWebServiceBinding();
BindingWSDLGenerator.generateWSDL(component, service, wsBinding, registry, null);
BindingWSDLGenerator.generateWSDL(endpoint.getComponent(), endpoint.getService(), wsBinding, registry, null);
interfaceContract = wsBinding.getBindingInterfaceContract();
interfaceContract.getInterface().resetDataBinding(DOMDataBinding.NAME);
}
@ -100,9 +94,7 @@ public class WireFormatJMSTextXMLServiceProvider implements WireFormatProvider {
}
public Interceptor createInterceptor() {
return new WireFormatJMSTextXMLServiceInterceptor(registry, (JMSBinding)binding,
jmsResourceFactory,
service.getRuntimeWire(binding));
return new WireFormatJMSTextXMLServiceInterceptor(registry, jmsResourceFactory, endpoint);
}
public String getPhase() {

View file

@ -21,8 +21,6 @@ package org.apache.tuscany.sca.binding.jsonp.runtime;
import java.util.List;
import org.apache.tuscany.sca.assembly.Endpoint;
import org.apache.tuscany.sca.assembly.EndpointReference;
import org.apache.tuscany.sca.binding.jsonp.JSONPBinding;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.host.http.ServletHost;
@ -30,6 +28,8 @@ import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint;
import org.apache.tuscany.sca.provider.BindingProviderFactory;
import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
import org.apache.tuscany.sca.provider.ServiceBindingProvider;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
public class JSONPBindingProviderFactory implements BindingProviderFactory<JSONPBinding> {
@ -47,11 +47,11 @@ public class JSONPBindingProviderFactory implements BindingProviderFactory<JSONP
return JSONPBinding.class;
}
public ReferenceBindingProvider createReferenceBindingProvider(EndpointReference endpoint) {
public ReferenceBindingProvider createReferenceBindingProvider(RuntimeEndpointReference endpoint) {
return new JSONPReferenceBindingProvider(endpoint);
}
public ServiceBindingProvider createServiceBindingProvider(Endpoint endpoint) {
public ServiceBindingProvider createServiceBindingProvider(RuntimeEndpoint endpoint) {
return new JSONPServiceBindingProvider(endpoint, servletHost);
}

View file

@ -20,31 +20,28 @@
package org.apache.tuscany.sca.binding.jsonp.runtime;
import org.apache.tuscany.sca.assembly.ComponentService;
import org.apache.tuscany.sca.assembly.Endpoint;
import org.apache.tuscany.sca.host.http.ServletHost;
import org.apache.tuscany.sca.interfacedef.Interface;
import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.provider.ServiceBindingProvider;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeWire;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
public class JSONPServiceBindingProvider implements ServiceBindingProvider {
private Endpoint endpoint;
private RuntimeEndpoint endpoint;
private ServletHost servletHost;
public JSONPServiceBindingProvider(Endpoint endpoint, ServletHost servletHost) {
public JSONPServiceBindingProvider(RuntimeEndpoint endpoint, ServletHost servletHost) {
this.endpoint = endpoint;
this.servletHost = servletHost;
}
public void start() {
ComponentService service = endpoint.getService();
RuntimeWire wire = ((RuntimeComponentService)service).getRuntimeWire(endpoint.getBinding());
Interface serviceInterface = service.getInterfaceContract().getInterface();
for (Operation op : serviceInterface.getOperations()) {
JSONPServlet servlet = new JSONPServlet(wire, op);
JSONPServlet servlet = new JSONPServlet(endpoint, op);
String path = endpoint.getBinding().getURI() + "/" + op.getName();
servletHost.addServletMapping(path, servlet);
}

View file

@ -36,7 +36,7 @@ import javax.servlet.http.HttpServletRequest;
import org.apache.tuscany.sca.interfacedef.DataType;
import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.runtime.RuntimeWire;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.ObjectMapper;
@ -44,11 +44,11 @@ import org.codehaus.jackson.map.ObjectMapper;
public class JSONPServlet extends GenericServlet {
private static final long serialVersionUID = 1L;
protected transient RuntimeWire wire;
protected transient RuntimeEndpoint wire;
protected transient Operation operation;
protected transient ObjectMapper mapper;
public JSONPServlet(RuntimeWire wire, Operation operation) {
public JSONPServlet(RuntimeEndpoint wire, Operation operation) {
this.wire = wire;
this.operation = operation;
this.mapper = new ObjectMapper();

View file

@ -19,8 +19,6 @@
package org.apache.tuscany.sca.binding.jsonrpc.provider;
import org.apache.tuscany.sca.assembly.Endpoint;
import org.apache.tuscany.sca.assembly.EndpointReference;
import org.apache.tuscany.sca.binding.jsonrpc.JSONRPCBinding;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.FactoryExtensionPoint;
@ -30,6 +28,8 @@ import org.apache.tuscany.sca.invocation.MessageFactory;
import org.apache.tuscany.sca.provider.BindingProviderFactory;
import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
import org.apache.tuscany.sca.provider.ServiceBindingProvider;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
/**
* JSON-RPC Provider Factory
@ -49,12 +49,12 @@ public class JSONRPCBindingProviderFactory implements BindingProviderFactory<JSO
messageFactory = modelFactories.getFactory(MessageFactory.class);
}
public ReferenceBindingProvider createReferenceBindingProvider(EndpointReference endpointReference) {
public ReferenceBindingProvider createReferenceBindingProvider(RuntimeEndpointReference endpointReference) {
return new JSONRPCReferenceBindingProvider(endpointReference);
}
public ServiceBindingProvider createServiceBindingProvider(Endpoint endpoint) {
public ServiceBindingProvider createServiceBindingProvider(RuntimeEndpoint endpoint) {
return new JSONRPCServiceBindingProvider(endpoint, messageFactory, servletHost);
}

View file

@ -22,9 +22,7 @@ package org.apache.tuscany.sca.binding.jsonrpc.provider;
import java.util.ArrayList;
import java.util.List;
import org.apache.tuscany.sca.assembly.Endpoint;
import org.apache.tuscany.sca.binding.jsonrpc.JSONRPCBinding;
import org.apache.tuscany.sca.databinding.json.JSONDataBinding;
import org.apache.tuscany.sca.host.http.ServletHost;
import org.apache.tuscany.sca.interfacedef.Interface;
import org.apache.tuscany.sca.interfacedef.InterfaceContract;
@ -33,6 +31,7 @@ import org.apache.tuscany.sca.invocation.MessageFactory;
import org.apache.tuscany.sca.provider.ServiceBindingProvider;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
/**
@ -43,7 +42,7 @@ import org.apache.tuscany.sca.runtime.RuntimeComponentService;
public class JSONRPCServiceBindingProvider implements ServiceBindingProvider {
private MessageFactory messageFactory;
private Endpoint endpoint;
private RuntimeEndpoint endpoint;
private RuntimeComponent component;
private RuntimeComponentService service;
private InterfaceContract serviceContract;
@ -51,7 +50,7 @@ public class JSONRPCServiceBindingProvider implements ServiceBindingProvider {
private ServletHost servletHost;
private List<String> servletMappings = new ArrayList<String>();
public JSONRPCServiceBindingProvider(Endpoint endpoint,
public JSONRPCServiceBindingProvider(RuntimeEndpoint endpoint,
MessageFactory messageFactory,
ServletHost servletHost) {
this.endpoint = endpoint;
@ -72,7 +71,7 @@ public class JSONRPCServiceBindingProvider implements ServiceBindingProvider {
}
public InterfaceContract getBindingInterfaceContract() {
return service.getInterfaceContract();
return serviceContract;
}
public boolean supportsOneWayInvocation() {
@ -81,7 +80,7 @@ public class JSONRPCServiceBindingProvider implements ServiceBindingProvider {
public void start() {
// Set default databinding to json
serviceContract.getInterface().resetDataBinding(JSONDataBinding.NAME);
// serviceContract.getInterface().resetDataBinding(JSONDataBinding.NAME);
// Determine the service business interface
Class<?> serviceInterface = getTargetJavaClass(serviceContract.getInterface());
@ -91,7 +90,7 @@ public class JSONRPCServiceBindingProvider implements ServiceBindingProvider {
// Create and register a Servlet for this service
JSONRPCServiceServlet serviceServlet =
new JSONRPCServiceServlet(messageFactory, binding, service, serviceContract, serviceInterface, proxy);
new JSONRPCServiceServlet(messageFactory, endpoint, serviceInterface, proxy);
String mapping = binding.getURI();
if (!mapping.endsWith("/")) {
mapping += "/";

View file

@ -32,12 +32,10 @@ import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.invocation.Message;
import org.apache.tuscany.sca.invocation.MessageFactory;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeWire;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
import org.jabsorb.JSONRPCBridge;
import org.jabsorb.JSONRPCResult;
import org.jabsorb.JSONRPCServlet;
@ -61,21 +59,17 @@ public class JSONRPCServiceServlet extends JSONRPCServlet {
transient Binding binding;
transient String serviceName;
transient Object serviceInstance;
transient RuntimeComponentService componentService;
transient InterfaceContract serviceContract;
transient RuntimeEndpoint endpoint;
transient Class<?> serviceInterface;
public JSONRPCServiceServlet(MessageFactory messageFactory,
Binding binding,
RuntimeComponentService componentService,
InterfaceContract serviceContract,
RuntimeEndpoint endpoint,
Class<?> serviceInterface,
Object serviceInstance) {
this.endpoint = endpoint;
this.messageFactory = messageFactory;
this.binding = binding;
this.binding = endpoint.getBinding();
this.serviceName = binding.getName();
this.componentService = componentService;
this.serviceContract = serviceContract;
this.serviceInterface = serviceInterface;
this.serviceInstance = serviceInstance;
}
@ -238,7 +232,6 @@ public class JSONRPCServiceServlet extends JSONRPCServlet {
}
// invoke the request
RuntimeWire wire = componentService.getRuntimeWire(binding, serviceContract);
Operation jsonOperation = findOperation(method);
Object result = null;
@ -254,7 +247,7 @@ public class JSONRPCServiceServlet extends JSONRPCServlet {
//result = wire.invoke(jsonOperation, args);
Message responseMessage = null;
try {
responseMessage = wire.getInvocationChain(jsonOperation).getHeadInvoker().invoke(requestMessage);
responseMessage = endpoint.getInvocationChain(jsonOperation).getHeadInvoker().invoke(requestMessage);
} catch (RuntimeException re) {
if (re.getCause() instanceof javax.security.auth.login.LoginException) {
throw re;
@ -297,7 +290,7 @@ public class JSONRPCServiceServlet extends JSONRPCServlet {
method = method.substring(method.lastIndexOf(".") + 1);
}
List<Operation> operations = serviceContract.getInterface().getOperations();
List<Operation> operations = endpoint.getServiceInterfaceContract().getInterface().getOperations();
//componentService.getBindingProvider(binding).getBindingInterfaceContract().getInterface().getOperations();

View file

@ -19,8 +19,6 @@
package org.apache.tuscany.sca.binding.rmi.provider;
import org.apache.tuscany.sca.assembly.Endpoint;
import org.apache.tuscany.sca.assembly.EndpointReference;
import org.apache.tuscany.sca.binding.rmi.RMIBinding;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.host.rmi.ExtensibleRMIHost;
@ -32,6 +30,8 @@ import org.apache.tuscany.sca.provider.ServiceBindingProvider;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
/**
* RMI Binding Provider Factory
@ -47,12 +47,12 @@ public class RMIBindingProviderFactory implements BindingProviderFactory<RMIBind
this.rmiHost = new ExtensibleRMIHost(rmiHosts);
}
public ReferenceBindingProvider createReferenceBindingProvider(EndpointReference endpointReference) {
public ReferenceBindingProvider createReferenceBindingProvider(RuntimeEndpointReference endpointReference) {
return new RMIReferenceBindingProvider(endpointReference, rmiHost);
}
public ServiceBindingProvider createServiceBindingProvider(Endpoint endpoint) {
public ServiceBindingProvider createServiceBindingProvider(RuntimeEndpoint endpoint) {
return new RMIServiceBindingProvider(endpoint, rmiHost);
}

View file

@ -32,8 +32,6 @@ import net.sf.cglib.proxy.Enhancer;
import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;
import org.apache.tuscany.sca.assembly.Endpoint;
import org.apache.tuscany.sca.assembly.SCABinding;
import org.apache.tuscany.sca.binding.rmi.RMIBinding;
import org.apache.tuscany.sca.common.java.classloader.ClassLoaderDelegate;
import org.apache.tuscany.sca.host.rmi.RMIHost;
@ -46,7 +44,7 @@ import org.apache.tuscany.sca.interfacedef.java.impl.JavaInterfaceUtil;
import org.apache.tuscany.sca.provider.ServiceBindingProvider;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeWire;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
import org.oasisopen.sca.ServiceRuntimeException;
/**
@ -60,10 +58,11 @@ public class RMIServiceBindingProvider implements ServiceBindingProvider {
private RuntimeComponentService service;
private RMIBinding binding;
private RMIHost rmiHost;
private RuntimeWire wire;
private RuntimeEndpoint endpoint;
private Remote rmiProxy;
public RMIServiceBindingProvider(Endpoint endpoint, RMIHost rmiHost) {
public RMIServiceBindingProvider(RuntimeEndpoint endpoint, RMIHost rmiHost) {
this.endpoint = endpoint;
this.component = (RuntimeComponent)endpoint.getComponent();
this.service = (RuntimeComponentService)endpoint.getService();
this.binding = (RMIBinding)endpoint.getBinding();
@ -71,23 +70,6 @@ public class RMIServiceBindingProvider implements ServiceBindingProvider {
}
public void start() {
// URI uri = URI.create(component.getURI() + "/" + binding.getName());
// binding.setURI(uri.toString());
wire = service.getRuntimeWire(binding);
// TODO - must be a better way to do this, which is copied from the Axis2ServiceProvider
// TODO - EPR - if there is no wire then find the wire for the SCA binding
// because this WS endpoint is providing remote support for the
// SCA binding
if (wire == null){
for(RuntimeWire tmpWire : service.getRuntimeWires()){
if (tmpWire.getEndpoint().getBinding() instanceof SCABinding){
wire = tmpWire;
break;
}
}
}
Interface serviceInterface = service.getInterfaceContract().getInterface();
@ -162,7 +144,7 @@ public class RMIServiceBindingProvider implements ServiceBindingProvider {
}
private Object invokeTarget(Operation op, Object[] args) throws InvocationTargetException {
return wire.invoke(op, args);
return endpoint.invoke(op, args);
}
private Class<?> getTargetJavaClass(Interface targetInterface) {

View file

@ -20,8 +20,6 @@
package org.apache.tuscany.sca.binding.sca.axis2.impl;
import org.apache.tuscany.sca.assembly.DistributedSCABinding;
import org.apache.tuscany.sca.assembly.Endpoint;
import org.apache.tuscany.sca.assembly.EndpointReference;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.provider.BindingProviderFactory;
import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
@ -29,6 +27,8 @@ import org.apache.tuscany.sca.provider.ServiceBindingProvider;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
/**
* The factory for the Axis2 based implementation of the distributed sca binding
@ -43,11 +43,11 @@ public class Axis2SCABindingProviderFactory implements BindingProviderFactory<Di
this.extensionPoints = extensionPoints;
}
public ReferenceBindingProvider createReferenceBindingProvider(EndpointReference endpointReference) {
public ReferenceBindingProvider createReferenceBindingProvider(RuntimeEndpointReference endpointReference) {
return new Axis2SCAReferenceBindingProvider(endpointReference, extensionPoints);
}
public ServiceBindingProvider createServiceBindingProvider(Endpoint endpoint) {
public ServiceBindingProvider createServiceBindingProvider(RuntimeEndpoint endpoint) {
return new Axis2SCAServiceBindingProvider(endpoint, extensionPoints);
}

View file

@ -39,6 +39,7 @@ import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
/**
* The reference binding provider for the remote sca binding implementation. Relies on the
@ -78,9 +79,9 @@ public class Axis2SCAReferenceBindingProvider implements ReferenceBindingProvide
contract.getInterface().resetDataBinding(OMElement.class.getName());
// create a copy of the endpoint reference but with the web service binding in
EndpointReference epr = null;
RuntimeEndpointReference epr = null;
try {
epr = (EndpointReference)endpointReference.clone();
epr = (RuntimeEndpointReference)endpointReference.clone();
} catch (Exception ex){
// we know we can clone endpoint references
}

View file

@ -44,6 +44,7 @@ import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
import org.apache.tuscany.sca.provider.ServiceBindingProvider;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
/**
* The service binding provider for the remote sca binding implementation. Relies on the
@ -115,9 +116,9 @@ public class Axis2SCAServiceBindingProvider implements ServiceBindingProvider {
contract.getInterface().resetDataBinding(OMElement.class.getName());
// create a copy of the endpoint but with the web service binding in
Endpoint ep = null;
RuntimeEndpoint ep = null;
try {
ep = (Endpoint)endpoint.clone();
ep = (RuntimeEndpoint)endpoint.clone();
} catch (Exception ex){
// we know we can clone endpoint references
}

View file

@ -20,12 +20,12 @@
package org.apache.tuscany.sca.binding.sca.rmi;
import org.apache.tuscany.sca.assembly.DistributedSCABinding;
import org.apache.tuscany.sca.assembly.Endpoint;
import org.apache.tuscany.sca.assembly.EndpointReference;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.provider.BindingProviderFactory;
import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
import org.apache.tuscany.sca.provider.ServiceBindingProvider;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
/**
* The factory for the RMI based implementation of the distributed sca binding
@ -38,11 +38,11 @@ public class RMISCABindingProviderFactory implements BindingProviderFactory<Dist
this.extensionPoints = extensionPoints;
}
public ReferenceBindingProvider createReferenceBindingProvider(EndpointReference endpointReference) {
public ReferenceBindingProvider createReferenceBindingProvider(RuntimeEndpointReference endpointReference) {
return new RMISCAReferenceBindingProvider(endpointReference, extensionPoints);
}
public ServiceBindingProvider createServiceBindingProvider(Endpoint endpoint) {
public ServiceBindingProvider createServiceBindingProvider(RuntimeEndpoint endpoint) {
return new RMISCAServiceBindingProvider(endpoint, extensionPoints);
}

View file

@ -34,6 +34,7 @@ import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.provider.BindingProviderFactory;
import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
/**
* The reference binding provider for the remote sca binding implementation. Relies on the
@ -60,9 +61,9 @@ public class RMISCAReferenceBindingProvider implements ReferenceBindingProvider
rmiBinding.setURI(this.binding.getURI());
// create a copy of the endpoint reference but with the RMI binding in
EndpointReference epr = null;
RuntimeEndpointReference epr = null;
try {
epr = (EndpointReference)endpointReference.clone();
epr = (RuntimeEndpointReference)endpointReference.clone();
} catch (Exception ex){
// we know we can clone endpoint references
}
@ -72,6 +73,8 @@ public class RMISCAReferenceBindingProvider implements ReferenceBindingProvider
ProviderFactoryExtensionPoint providerFactories = extensionPoints.getExtensionPoint(ProviderFactoryExtensionPoint.class);
BindingProviderFactory<?> providerFactory = (BindingProviderFactory<?>)providerFactories.getProviderFactory(RMIBinding.class);
referenceBindingProvider = providerFactory.createReferenceBindingProvider(epr);
// Set the reference binding provider so that it can be used to start/stop
((RuntimeEndpointReference) endpointReference).setBindingProvider(referenceBindingProvider);
logger.info("Reference using RMI SCA Binding: " + rmiBinding.getURI());
}

View file

@ -37,6 +37,7 @@ import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.provider.BindingProviderFactory;
import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
import org.apache.tuscany.sca.provider.ServiceBindingProvider;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
/**
* The service binding provider for the remote sca binding implementation. Relies on the
@ -88,9 +89,9 @@ public class RMISCAServiceBindingProvider implements ServiceBindingProvider {
rmiBinding.setURI(this.binding.getURI());
// create a copy of the endpoint but with the web service binding in
Endpoint ep = null;
RuntimeEndpoint ep = null;
try {
ep = (Endpoint)endpoint.clone();
ep = (RuntimeEndpoint)endpoint.clone();
} catch (Exception ex){
// we know we can clone endpoint references
}
@ -100,6 +101,9 @@ public class RMISCAServiceBindingProvider implements ServiceBindingProvider {
BindingProviderFactory<?> providerFactory = (BindingProviderFactory<?>) providerFactories.getProviderFactory(RMIBinding.class);
serviceBindingProvider = providerFactory.createServiceBindingProvider(ep);
// Set the service binding provider so that it can be used to start/stop
((RuntimeEndpoint) endpoint).setBindingProvider(serviceBindingProvider);
logger.info("Service using RMI SCA Binding: " + rmiBinding.getURI());
}

View file

@ -19,8 +19,6 @@
package org.apache.tuscany.sca.binding.sca.provider;
import org.apache.tuscany.sca.assembly.Endpoint;
import org.apache.tuscany.sca.assembly.EndpointReference;
import org.apache.tuscany.sca.assembly.SCABinding;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.provider.BindingProviderFactory;
@ -29,6 +27,8 @@ import org.apache.tuscany.sca.provider.ServiceBindingProvider;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
/**
* The factory for creating SCA Binding providers
@ -44,12 +44,12 @@ public class RuntimeSCABindingProviderFactory implements BindingProviderFactory<
}
public ReferenceBindingProvider createReferenceBindingProvider(EndpointReference endpointReference) {
public ReferenceBindingProvider createReferenceBindingProvider(RuntimeEndpointReference endpointReference) {
return new RuntimeSCAReferenceBindingProvider(extensionPoints, endpointReference);
}
public ServiceBindingProvider createServiceBindingProvider(Endpoint endpoint) {
public ServiceBindingProvider createServiceBindingProvider(RuntimeEndpoint endpoint) {
return new RuntimeSCAServiceBindingProvider(extensionPoints, endpoint);
}

View file

@ -19,13 +19,10 @@
package org.apache.tuscany.sca.binding.sca.provider;
import java.net.URI;
import java.util.logging.Logger;
import org.apache.tuscany.sca.assembly.DistributedSCABinding;
import org.apache.tuscany.sca.assembly.Endpoint;
import org.apache.tuscany.sca.assembly.EndpointReference;
import org.apache.tuscany.sca.assembly.OptimizableBinding;
import org.apache.tuscany.sca.assembly.SCABinding;
import org.apache.tuscany.sca.assembly.SCABindingFactory;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
@ -40,7 +37,8 @@ import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeWire;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
import org.oasisopen.sca.ServiceUnavailableException;
/**
@ -56,7 +54,7 @@ public class RuntimeSCAReferenceBindingProvider implements ReferenceBindingProvi
private static final Logger logger = Logger.getLogger(RuntimeSCAReferenceBindingProvider.class.getName());
private EndpointReference endpointReference;
private RuntimeEndpointReference endpointReference;
private RuntimeComponent component;
private RuntimeComponentReference reference;
private SCABinding binding;
@ -67,7 +65,7 @@ public class RuntimeSCAReferenceBindingProvider implements ReferenceBindingProvi
private SCABindingFactory scaBindingFactory;
public RuntimeSCAReferenceBindingProvider(ExtensionPointRegistry extensionPoints,
EndpointReference endpointReference) {
RuntimeEndpointReference endpointReference) {
this.endpointReference = endpointReference;
this.component = (RuntimeComponent)endpointReference.getComponent();
this.reference = (RuntimeComponentReference)endpointReference.getReference();
@ -143,9 +141,9 @@ public class RuntimeSCAReferenceBindingProvider implements ReferenceBindingProvi
distributedBinding.setSCABinding(binding);
// create a copy of the endpoint reference and change the binding
EndpointReference epr = null;
RuntimeEndpointReference epr = null;
try {
epr = (EndpointReference)endpointReference.clone();
epr = (RuntimeEndpointReference)endpointReference.clone();
} catch (Exception ex) {
// we know we can clone endpoint references
}
@ -163,10 +161,13 @@ public class RuntimeSCAReferenceBindingProvider implements ReferenceBindingProvi
if (isTargetRemote()) {
return getDistributedProvider().getBindingInterfaceContract();
} else {
if (reference.getReference() != null) {
return reference.getReference().getInterfaceContract();
// Check if there is a target
RuntimeEndpoint endpoint = (RuntimeEndpoint)endpointReference.getTargetEndpoint();
if (endpoint != null) {
// Use the target binding interface contract
return endpoint.getBindingInterfaceContract();
} else {
return reference.getInterfaceContract();
return endpointReference.getReferenceInterfaceContract();
}
}
}
@ -179,14 +180,12 @@ public class RuntimeSCAReferenceBindingProvider implements ReferenceBindingProvi
}
}
private Invoker getInvoker(RuntimeWire wire, Operation operation) {
Endpoint target = wire.getEndpoint();
private Invoker getInvoker(RuntimeEndpointReference epr, Operation operation) {
Endpoint target = epr.getTargetEndpoint();
if (target != null) {
RuntimeComponentService service = (RuntimeComponentService)target.getService();
if (service != null) { // not a callback wire
SCABinding scaBinding = service.getBinding(SCABinding.class);
InvocationChain chain =
service.getInvocationChain(scaBinding, wire.getEndpointReference().getInterfaceContract(), operation);
InvocationChain chain = ((RuntimeEndpoint) target).getInvocationChain(operation);
return chain == null ? null : new SCABindingInvoker(chain);
}
}
@ -197,8 +196,7 @@ public class RuntimeSCAReferenceBindingProvider implements ReferenceBindingProvi
if (isTargetRemote()) {
return getDistributedProvider().createInvoker(operation);
} else {
RuntimeWire wire = reference.getRuntimeWire(binding);
Invoker invoker = getInvoker(wire, operation);
Invoker invoker = getInvoker(endpointReference, operation);
if (invoker == null) {
throw new ServiceUnavailableException("Unable to create SCA binding invoker for local target " + component.getName()
+ " reference "

View file

@ -24,7 +24,6 @@ import java.util.Collection;
import org.apache.tuscany.sca.assembly.DistributedSCABinding;
import org.apache.tuscany.sca.assembly.Endpoint;
import org.apache.tuscany.sca.assembly.EndpointReference;
import org.apache.tuscany.sca.assembly.SCABinding;
import org.apache.tuscany.sca.assembly.SCABindingFactory;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
@ -38,6 +37,7 @@ import org.apache.tuscany.sca.runtime.DomainRegistryFactory;
import org.apache.tuscany.sca.runtime.EndpointRegistry;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
/**
* The sca service binding provider mediates between the twin requirements of
@ -59,7 +59,7 @@ public class RuntimeSCAServiceBindingProvider implements ServiceBindingProvider
private DistributedSCABinding distributedBinding;
public RuntimeSCAServiceBindingProvider(ExtensionPointRegistry extensionPoints, Endpoint endpoint) {
public RuntimeSCAServiceBindingProvider(ExtensionPointRegistry extensionPoints, RuntimeEndpoint endpoint) {
this.component = (RuntimeComponent)endpoint.getComponent();
this.service = (RuntimeComponentService)endpoint.getService();
this.binding = (SCABinding)endpoint.getBinding();
@ -87,9 +87,9 @@ public class RuntimeSCAServiceBindingProvider implements ServiceBindingProvider
distributedBinding.setSCABinding(binding);
// create a copy of the endpoint and change the binding
Endpoint ep = null;
RuntimeEndpoint ep = null;
try {
ep = (Endpoint)endpoint.clone();
ep = (RuntimeEndpoint)endpoint.clone();
} catch (Exception ex) {
// we know we can clone endpoint
}

View file

@ -20,8 +20,6 @@ package org.apache.tuscany.sca.binding.ws.axis2;
import java.util.List;
import org.apache.tuscany.sca.assembly.Endpoint;
import org.apache.tuscany.sca.assembly.EndpointReference;
import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.FactoryExtensionPoint;
@ -34,6 +32,8 @@ import org.apache.tuscany.sca.provider.ServiceBindingProvider;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
/**
* Axis2BindingProviderFactory
@ -57,11 +57,11 @@ public class Axis2BindingProviderFactory implements BindingProviderFactory<WebSe
dataBindings = extensionPoints.getExtensionPoint(DataBindingExtensionPoint.class);
}
public ReferenceBindingProvider createReferenceBindingProvider(EndpointReference endpointReference) {
public ReferenceBindingProvider createReferenceBindingProvider(RuntimeEndpointReference endpointReference) {
return new Axis2ReferenceBindingProvider(endpointReference, modelFactories, dataBindings);
}
public ServiceBindingProvider createServiceBindingProvider(Endpoint endpoint) {
public ServiceBindingProvider createServiceBindingProvider(RuntimeEndpoint endpoint) {
return new Axis2ServiceBindingProvider(endpoint, servletHost, modelFactories, dataBindings);
}

View file

@ -19,7 +19,6 @@
package org.apache.tuscany.sca.binding.ws.axis2;
import org.apache.axiom.om.OMElement;
import org.apache.tuscany.sca.assembly.Endpoint;
import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
import org.apache.tuscany.sca.core.FactoryExtensionPoint;
import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
@ -29,6 +28,7 @@ import org.apache.tuscany.sca.invocation.MessageFactory;
import org.apache.tuscany.sca.provider.ServiceBindingProvider;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
import org.oasisopen.sca.ServiceRuntimeException;
public class Axis2ServiceBindingProvider implements ServiceBindingProvider {
@ -39,7 +39,7 @@ public class Axis2ServiceBindingProvider implements ServiceBindingProvider {
private Axis2ServiceProvider axisProvider;
public Axis2ServiceBindingProvider(Endpoint endpoint,
public Axis2ServiceBindingProvider(RuntimeEndpoint endpoint,
ServletHost servletHost,
FactoryExtensionPoint modelFactories,
DataBindingExtensionPoint dataBindings) {
@ -62,7 +62,7 @@ public class Axis2ServiceBindingProvider implements ServiceBindingProvider {
InterfaceContract contract = wsBinding.getBindingInterfaceContract();
contract.getInterface().resetDataBinding(OMElement.class.getName());
axisProvider = new Axis2ServiceProvider(component, service, wsBinding, servletHost, messageFactory, modelFactories);
axisProvider = new Axis2ServiceProvider(endpoint, component, service, wsBinding, servletHost, messageFactory, modelFactories);
}
public void start() {

View file

@ -77,7 +77,6 @@ import org.apache.tuscany.sca.assembly.AssemblyFactory;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.assembly.Endpoint;
import org.apache.tuscany.sca.assembly.EndpointReference;
import org.apache.tuscany.sca.assembly.SCABinding;
import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
import org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceClient.URIResolverImpl;
import org.apache.tuscany.sca.binding.ws.axis2.policy.authentication.token.Axis2TokenAuthenticationPolicy;
@ -98,8 +97,7 @@ import org.apache.tuscany.sca.policy.PolicySet;
import org.apache.tuscany.sca.policy.PolicySubject;
import org.apache.tuscany.sca.policy.authentication.basic.BasicAuthenticationPolicy;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeWire;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
import org.apache.tuscany.sca.xsd.XSDefinition;
import org.apache.ws.commons.schema.XmlSchema;
import org.apache.ws.commons.schema.XmlSchemaExternal;
@ -117,6 +115,7 @@ public class Axis2ServiceProvider {
private static final Logger logger = Logger.getLogger(Axis2ServiceProvider.class.getName());
private RuntimeEndpoint endpoint;
private RuntimeComponent component;
private AbstractContract contract;
private WebServiceBinding wsBinding;
@ -159,13 +158,14 @@ public class Axis2ServiceProvider {
public static final List<QName> XSD_QNAME_LIST =
Arrays.asList(new QName[] {Q_ELEM_XSD_1999, Q_ELEM_XSD_2000, Q_ELEM_XSD_2001});
public Axis2ServiceProvider(RuntimeComponent component,
public Axis2ServiceProvider(RuntimeEndpoint endpoint,
RuntimeComponent component,
AbstractContract contract,
WebServiceBinding wsBinding,
ServletHost servletHost,
MessageFactory messageFactory,
final FactoryExtensionPoint modelFactories) {
this.endpoint = endpoint;
this.component = component;
this.contract = contract;
this.wsBinding = wsBinding;
@ -696,27 +696,11 @@ public class Axis2ServiceProvider {
from.setCallbackEndpoint(callbackEndpoint);
}
// find the runtime wire and invoke it with the message
RuntimeWire wire = ((RuntimeComponentService)contract).getRuntimeWire(getBinding());
// TODO - EPR - if there is no wire then find the wire for the SCA binding
// because this WS endpoint is providing remote support for the
// SCA binding
if (wire == null){
for(RuntimeWire tmpWire : ((RuntimeComponentService)contract).getRuntimeWires()){
if (tmpWire.getEndpoint().getBinding() instanceof SCABinding){
wire = tmpWire;
break;
}
}
Message response = endpoint.invoke(op, msg);
if(response.isFault()) {
throw new InvocationTargetException((Throwable) response.getBody());
}
Object response = wire.invoke(op, msg);
return response;
}
public boolean isConversational() {
return wsBinding.getBindingInterfaceContract().getInterface().isConversational();
return response.getBody();
}
/**

View file

@ -21,7 +21,6 @@ package org.apache.tuscany.sca.core.databinding.wire;
import java.util.List;
import org.apache.tuscany.sca.assembly.ComponentReference;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.UtilityExtensionPoint;
import org.apache.tuscany.sca.databinding.Mediator;
@ -31,7 +30,8 @@ import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.InvocationChain;
import org.apache.tuscany.sca.invocation.Phase;
import org.apache.tuscany.sca.runtime.RuntimeWire;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
import org.apache.tuscany.sca.runtime.RuntimeWireProcessor;
/**
@ -123,45 +123,6 @@ public class DataBindingRuntimeWireProcessor implements RuntimeWireProcessor {
return isTransformationRequired(sourceOperation, targetOperation);
}
public void process(RuntimeWire wire) {
InterfaceContract sourceContract = wire.getEndpointReference().getInterfaceContract();
InterfaceContract targetContract = wire.getEndpoint().getInterfaceContract();
if (targetContract == null) {
targetContract = sourceContract;
}
if (!sourceContract.getInterface().isRemotable()) {
return;
}
List<InvocationChain> chains = wire.getInvocationChains();
for (InvocationChain chain : chains) {
Operation sourceOperation = chain.getSourceOperation();
Operation targetOperation = chain.getTargetOperation();
Interceptor interceptor = null;
if (isTransformationRequired(sourceContract, sourceOperation, targetContract, targetOperation)) {
// Add the interceptor to the source side because multiple
// references can be wired to the same service
interceptor =
new DataTransformationInterceptor(wire, sourceOperation, targetOperation, mediator);
} else {
// assume pass-by-values copies are required if interfaces are remotable and there is no data binding
// transformation, i.e. a transformation will result in a copy so another pass-by-value copy is unnecessary
if (!isOnMessage(targetOperation) && isRemotable(chain, sourceOperation, targetOperation)) {
interceptor =
new PassByValueInterceptor(mediator, chain, targetOperation);
}
}
if (interceptor != null) {
String phase =
(wire.getEndpointReference().getReference() instanceof ComponentReference) ? Phase.REFERENCE_INTERFACE
: Phase.SERVICE_INTERFACE;
chain.addInterceptor(phase, interceptor);
}
}
}
/**
* FIXME: TUSCANY-2586, temporary work around till the JIRA is fixed to prevent
* the PassByValueInterceptor being used for services when the binding protocol
@ -185,4 +146,78 @@ public class DataBindingRuntimeWireProcessor implements RuntimeWireProcessor {
return true;
}
public void process(RuntimeEndpoint endpoint) {
InterfaceContract sourceContract = endpoint.getBindingInterfaceContract();
InterfaceContract targetContract = endpoint.getServiceInterfaceContract();
if (targetContract == null) {
targetContract = sourceContract;
}
if (!sourceContract.getInterface().isRemotable()) {
return;
}
List<InvocationChain> chains = endpoint.getInvocationChains();
for (InvocationChain chain : chains) {
Operation sourceOperation = chain.getSourceOperation();
Operation targetOperation = chain.getTargetOperation();
Interceptor interceptor = null;
if (isTransformationRequired(sourceContract, sourceOperation, targetContract, targetOperation)) {
// Add the interceptor to the source side because multiple
// references can be wired to the same service
interceptor =
new DataTransformationInterceptor(endpoint, sourceOperation, targetOperation, mediator);
} else {
// assume pass-by-values copies are required if interfaces are remotable and there is no data binding
// transformation, i.e. a transformation will result in a copy so another pass-by-value copy is unnecessary
if (!isOnMessage(targetOperation) && isRemotable(chain, sourceOperation, targetOperation)) {
interceptor =
new PassByValueInterceptor(mediator, chain, targetOperation);
}
}
if (interceptor != null) {
String phase = Phase.SERVICE_INTERFACE;
chain.addInterceptor(phase, interceptor);
}
}
}
public void process(RuntimeEndpointReference endpointReference) {
InterfaceContract sourceContract = endpointReference.getReferenceInterfaceContract();
InterfaceContract targetContract = endpointReference.getBindingInterfaceContract();
if (targetContract == null) {
targetContract = sourceContract;
}
if (!sourceContract.getInterface().isRemotable()) {
return;
}
List<InvocationChain> chains = endpointReference.getInvocationChains();
for (InvocationChain chain : chains) {
Operation sourceOperation = chain.getSourceOperation();
Operation targetOperation = chain.getTargetOperation();
Interceptor interceptor = null;
if (isTransformationRequired(sourceContract, sourceOperation, targetContract, targetOperation)) {
// Add the interceptor to the source side because multiple
// references can be wired to the same service
interceptor =
new DataTransformationInterceptor(endpointReference, sourceOperation, targetOperation, mediator);
} else {
// assume pass-by-values copies are required if interfaces are remotable and there is no data binding
// transformation, i.e. a transformation will result in a copy so another pass-by-value copy is unnecessary
if (!isOnMessage(targetOperation) && isRemotable(chain, sourceOperation, targetOperation)) {
interceptor =
new PassByValueInterceptor(mediator, chain, targetOperation);
}
}
if (interceptor != null) {
String phase = Phase.REFERENCE_INTERFACE;
chain.addInterceptor(phase, interceptor);
}
}
}
}

View file

@ -19,21 +19,16 @@
package org.apache.tuscany.sca.core.databinding.wire;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import java.util.Map;
import org.apache.tuscany.sca.databinding.Mediator;
import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
import org.apache.tuscany.sca.interfacedef.util.FaultException;
import org.apache.tuscany.sca.interfacedef.util.XMLType;
import org.apache.tuscany.sca.invocation.DataExchangeSemantics;
import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
import org.apache.tuscany.sca.runtime.RuntimeWire;
import org.oasisopen.sca.ServiceRuntimeException;
import org.apache.tuscany.sca.runtime.Invocable;
/**
* An interceptor to transform data across databindings on the wire
@ -46,10 +41,10 @@ public class DataTransformationInterceptor implements Interceptor, DataExchangeS
private Operation sourceOperation;
private Operation targetOperation;
private RuntimeWire wire;
private Invocable invocable;
private Mediator mediator;
public DataTransformationInterceptor(RuntimeWire wire,
public DataTransformationInterceptor(Invocable invocable,
Operation sourceOperation,
Operation targetOperation,
Mediator mediator) {
@ -57,7 +52,7 @@ public class DataTransformationInterceptor implements Interceptor, DataExchangeS
this.sourceOperation = sourceOperation;
this.targetOperation = targetOperation;
this.mediator = mediator;
this.wire = wire;
this.invocable = invocable;
}
public Invoker getNext() {
@ -66,7 +61,7 @@ public class DataTransformationInterceptor implements Interceptor, DataExchangeS
public Message invoke(Message msg) {
Map<String, Object> metadata = new HashMap<String, Object>();
metadata.put("wire", wire);
metadata.put(Invocable.class.getName(), invocable);
Object input = mediator.mediateInput(msg.getBody(), sourceOperation, targetOperation, metadata);
msg.setBody(input);
Message resultMsg = next.invoke(msg);
@ -76,7 +71,6 @@ public class DataTransformationInterceptor implements Interceptor, DataExchangeS
return resultMsg;
}
if (resultMsg.isFault()) {
Object transformedFault = null;
if ((result instanceof Exception) && !(result instanceof RuntimeException)) {

View file

@ -33,7 +33,24 @@ import org.apache.tuscany.sca.runtime.RuntimeComponentContext;
*
* @version $Rev$ $Date$
*/
public abstract class CompositeContext {
public class CompositeContext {
protected ExtensionPointRegistry extensionPointRegistry;
protected EndpointRegistry endpointRegistry;
protected ComponentContextFactory componentContextFactory;
protected Composite domainComposite;
public CompositeContext(ExtensionPointRegistry registry, EndpointRegistry endpointRegistry, Composite domainComposite) {
this.extensionPointRegistry = registry;
this.endpointRegistry = endpointRegistry;
ContextFactoryExtensionPoint contextFactories = registry.getExtensionPoint(ContextFactoryExtensionPoint.class);
this.componentContextFactory = contextFactories.getFactory(ComponentContextFactory.class);
this.domainComposite = domainComposite;
}
public CompositeContext(ExtensionPointRegistry registry, EndpointRegistry endpointRegistry) {
this(registry, endpointRegistry, null);
}
/**
* @return
*/
@ -62,30 +79,37 @@ public abstract class CompositeContext {
return null;
}
/**
* Attach a component context to the component
* @param runtimeComponent
*/
public abstract void bindComponent(RuntimeComponent runtimeComponent);
public void bindComponent(RuntimeComponent runtimeComponent) {
RuntimeComponentContext componentContext =
(RuntimeComponentContext)componentContextFactory.createComponentContext(this, runtimeComponent);
runtimeComponent.setComponentContext(componentContext);
}
/**
*
* @param endpointReference
*/
public abstract void bindEndpointReference(EndpointReference endpointReference);
public void bindEndpointReference(EndpointReference endpointReference) {
}
/**
* Get the ExtensionPointRegistry for this node
* @return The ExtensionPointRegistry
*/
public abstract ExtensionPointRegistry getExtensionPointRegistry();
public ExtensionPointRegistry getExtensionPointRegistry() {
return extensionPointRegistry;
}
/**
* Get the EndpointRegistry
* @return The EndpointRegistry for this node
*/
public abstract EndpointRegistry getEndpointRegistry();
public EndpointRegistry getEndpointRegistry() {
return endpointRegistry;
}
public abstract Composite getDomainComposite();
public Composite getDomainComposite() {
return domainComposite;
}
}

View file

@ -32,9 +32,10 @@ import org.apache.tuscany.sca.invocation.PhasedInterceptor;
import org.apache.tuscany.sca.policy.PolicyExpression;
import org.apache.tuscany.sca.policy.PolicySet;
import org.apache.tuscany.sca.policy.PolicySubject;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeWire;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
/**
* Abstract base class for policy providers
@ -129,30 +130,26 @@ public abstract class BasePolicyProvider<T> implements PolicyProvider {
return null;
}
private InvocationChain getInvocationChain() {
if (subject instanceof Endpoint) {
Endpoint endpoint = (Endpoint)subject;
RuntimeComponentService service = (RuntimeComponentService)endpoint.getService();
RuntimeWire wire = service.getRuntimeWire(endpoint.getBinding());
List<InvocationChain> chains = wire.getInvocationChains();
protected InvocationChain getInvocationChain() {
if (subject instanceof RuntimeEndpoint) {
RuntimeEndpoint endpoint = (RuntimeEndpoint)subject;
List<InvocationChain> chains = endpoint.getInvocationChains();
for (InvocationChain chain : chains) {
configure(chain, chain.getTargetOperation());
}
} else if (subject instanceof EndpointReference) {
EndpointReference endpointReference = (EndpointReference)subject;
RuntimeComponentReference reference = (RuntimeComponentReference)endpointReference.getReference();
RuntimeWire wire = reference.getRuntimeWire(endpointReference.getBinding());
List<InvocationChain> chains = wire.getInvocationChains();
} else if (subject instanceof RuntimeEndpointReference) {
RuntimeEndpointReference endpointReference = (RuntimeEndpointReference)subject;
List<InvocationChain> chains = endpointReference.getInvocationChains();
for (InvocationChain chain : chains) {
configure(chain, chain.getSourceOperation());
}
} else if (subject instanceof Component) {
Component component = (Component)subject;
} else if (subject instanceof RuntimeComponent) {
RuntimeComponent component = (RuntimeComponent)subject;
for (ComponentService s : component.getServices()) {
RuntimeComponentService service = (RuntimeComponentService)s;
for (RuntimeWire wire : service.getRuntimeWires()) {
List<InvocationChain> chains = wire.getInvocationChains();
for (Endpoint ep : service.getEndpoints()) {
List<InvocationChain> chains = ((RuntimeEndpoint)ep).getInvocationChains();
for (InvocationChain chain : chains) {
configure(chain, chain.getTargetOperation());
}

View file

@ -27,7 +27,7 @@ import org.apache.tuscany.sca.invocation.PhasedInterceptor;
* binding function
* @version $Rev$ $Date$
*/
public interface PolicyProviderRRB extends PolicyProvider {
public interface BindingPolicyProvider extends PolicyProvider {
/**
* Create a binding interceptor
* @return An interceptor that realize the policySet

View file

@ -20,8 +20,8 @@
package org.apache.tuscany.sca.provider;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.assembly.Endpoint;
import org.apache.tuscany.sca.assembly.EndpointReference;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
/**
* A factory for creating the runtime artifacts that represent bindings.
@ -36,7 +36,7 @@ public interface BindingProviderFactory<M extends Binding> extends ProviderFacto
* @param endpointReference defines the component/reference/binding against which to create the provider
* @return The binding provider
*/
ReferenceBindingProvider createReferenceBindingProvider(EndpointReference endpointReference);
ReferenceBindingProvider createReferenceBindingProvider(RuntimeEndpointReference endpointReference);
/**
* Creates a new service binding provider for the given component and
@ -45,6 +45,6 @@ public interface BindingProviderFactory<M extends Binding> extends ProviderFacto
* @param endpoint defines the component/service/binding against which to create the provider
* @return The binding provider
*/
ServiceBindingProvider createServiceBindingProvider(Endpoint endpoint);
ServiceBindingProvider createServiceBindingProvider(RuntimeEndpoint endpoint);
}

View file

@ -26,7 +26,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.assembly.Endpoint;
import org.apache.tuscany.sca.assembly.EndpointReference;
import org.apache.tuscany.sca.assembly.Implementation;
@ -34,8 +33,8 @@ import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
/**
* Default implementation of a provider factory extension point.
@ -237,12 +236,12 @@ public class DefaultProviderFactoryExtensionPoint implements ProviderFactoryExte
}
@SuppressWarnings("unchecked")
public ReferenceBindingProvider createReferenceBindingProvider(EndpointReference endpointReference) {
public ReferenceBindingProvider createReferenceBindingProvider(RuntimeEndpointReference endpointReference) {
return getFactory().createReferenceBindingProvider(endpointReference);
}
@SuppressWarnings("unchecked")
public ServiceBindingProvider createServiceBindingProvider(Endpoint endpoint) {
public ServiceBindingProvider createServiceBindingProvider(RuntimeEndpoint endpoint) {
return getFactory().createServiceBindingProvider(endpoint);
}
@ -409,16 +408,12 @@ public class DefaultProviderFactoryExtensionPoint implements ProviderFactoryExte
return factory;
}
public WireFormatProvider createReferenceWireFormatProvider(RuntimeComponent component,
RuntimeComponentReference reference,
Binding binding){
return getFactory().createReferenceWireFormatProvider(component, reference, binding);
public WireFormatProvider createReferenceWireFormatProvider(RuntimeEndpointReference endpointReference){
return getFactory().createReferenceWireFormatProvider(endpointReference);
}
public WireFormatProvider createServiceWireFormatProvider(RuntimeComponent component,
RuntimeComponentService service,
Binding binding){
return getFactory().createServiceWireFormatProvider(component, service, binding);
public WireFormatProvider createServiceWireFormatProvider(RuntimeEndpoint endpoint){
return getFactory().createServiceWireFormatProvider(endpoint);
}
public Class<?> getModelType() {
@ -470,16 +465,12 @@ public class DefaultProviderFactoryExtensionPoint implements ProviderFactoryExte
return factory;
}
public OperationSelectorProvider createReferenceOperationSelectorProvider(RuntimeComponent component,
RuntimeComponentReference reference,
Binding binding){
return getFactory().createReferenceOperationSelectorProvider(component, reference, binding);
public OperationSelectorProvider createReferenceOperationSelectorProvider(RuntimeEndpointReference endpointReference){
return getFactory().createReferenceOperationSelectorProvider(endpointReference);
}
public OperationSelectorProvider createServiceOperationSelectorProvider(RuntimeComponent component,
RuntimeComponentService service,
Binding binding){
return getFactory().createServiceOperationSelectorProvider(component, service, binding);
public OperationSelectorProvider createServiceOperationSelectorProvider(RuntimeEndpoint endpoint){
return getFactory().createServiceOperationSelectorProvider(endpoint);
}
public Class<?> getModelType() {

View file

@ -19,7 +19,6 @@
package org.apache.tuscany.sca.provider;
import org.apache.tuscany.sca.runtime.RuntimeWire;
/**
* TODO RRB experiment
@ -28,8 +27,9 @@ import org.apache.tuscany.sca.runtime.RuntimeWire;
*
* @version $Rev$ $Date$
*/
public interface ReferenceBindingProviderRRB extends ReferenceBindingProvider {
void configureBindingChain(RuntimeWire runtimeWire);
public interface EndpointProvider extends ServiceBindingProvider {
/**
* Configure the binding invocation chain
*/
void configure();
}

View file

@ -19,7 +19,6 @@
package org.apache.tuscany.sca.provider;
import org.apache.tuscany.sca.runtime.RuntimeWire;
/**
* TODO RRB experiment
@ -28,8 +27,10 @@ import org.apache.tuscany.sca.runtime.RuntimeWire;
*
* @version $Rev$ $Date$
*/
public interface ServiceBindingProviderRRB extends ServiceBindingProvider {
void configureBindingChain(RuntimeWire runtimeWire);
public interface EndpointReferenceProvider extends ReferenceBindingProvider {
/**
* Configure the binding invocation chain
*/
void configure();
}

View file

@ -19,11 +19,9 @@
package org.apache.tuscany.sca.provider;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.assembly.OperationSelector;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
/**
* @version $Rev$ $Date$
@ -31,23 +29,15 @@ import org.apache.tuscany.sca.runtime.RuntimeComponentService;
public interface OperationSelectorProviderFactory<M extends OperationSelector> extends ProviderFactory<M> {
/**
* Create wire format provider for a given reference binding
* @param component
* @param reference
* @param binding
* @param endpointReference TODO
* @return
*/
OperationSelectorProvider createReferenceOperationSelectorProvider(RuntimeComponent component,
RuntimeComponentReference reference,
Binding binding);
OperationSelectorProvider createReferenceOperationSelectorProvider(RuntimeEndpointReference endpointReference);
/**
* Create policy provider for a given service binding
* @param component
* @param service
* @param binding
* @param endpoint TODO
* @return
*/
OperationSelectorProvider createServiceOperationSelectorProvider(RuntimeComponent component,
RuntimeComponentService service,
Binding binding);
OperationSelectorProvider createServiceOperationSelectorProvider(RuntimeEndpoint endpoint);
}

View file

@ -19,11 +19,9 @@
package org.apache.tuscany.sca.provider;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.assembly.WireFormat;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
/**
* @version $Rev$ $Date$
@ -31,23 +29,15 @@ import org.apache.tuscany.sca.runtime.RuntimeComponentService;
public interface WireFormatProviderFactory<M extends WireFormat> extends ProviderFactory<M> {
/**
* Create wire format provider for a given reference binding
* @param component
* @param reference
* @param binding
* @param endpointReference The endpoint reference
* @return
*/
WireFormatProvider createReferenceWireFormatProvider(RuntimeComponent component,
RuntimeComponentReference reference,
Binding binding);
WireFormatProvider createReferenceWireFormatProvider(RuntimeEndpointReference endpointReference);
/**
* Create policy provider for a given service binding
* @param component
* @param service
* @param binding
* @param endpoint TODO
* @return
*/
WireFormatProvider createServiceWireFormatProvider(RuntimeComponent component,
RuntimeComponentService service,
Binding binding);
WireFormatProvider createServiceWireFormatProvider(RuntimeEndpoint endpoint);
}

View file

@ -6,15 +6,15 @@
* 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.
* under the License.
*/
package org.apache.tuscany.sca.runtime;
@ -22,38 +22,63 @@ package org.apache.tuscany.sca.runtime;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import org.apache.tuscany.sca.assembly.Endpoint;
import org.apache.tuscany.sca.assembly.EndpointReference;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.assembly.Component;
import org.apache.tuscany.sca.assembly.Contract;
import org.apache.tuscany.sca.context.CompositeContext;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.invocation.InvocationChain;
import org.apache.tuscany.sca.invocation.Message;
import org.apache.tuscany.sca.provider.PolicyProvider;
/**
* The runtime wire interface that connects a component reference to a
* component service (or an external service) over the selected binding
*
* @version $Rev$ $Date$
* The abstraction of an invocable model that contains invocation chains
*/
public interface RuntimeWire extends Cloneable {
public interface Invocable {
/**
* return the endpoint reference that configured this wire
*
* @return the endpoint reference that configured this wire
* Bind the invocable to the composite context
* @param context
*/
EndpointReference getEndpointReference();
void bind(CompositeContext context);
/**
* Bind the invocable to the extension point registry and endpoint registry. This is typically
* called after the endpoint or endpoint reference is deserialized
* @param registry
* @param endpointRegistry
*/
void bind(ExtensionPointRegistry registry, EndpointRegistry endpointRegistry);
/**
* Get the associated composite context
* @return
*/
CompositeContext getCompositeContext();
/**
* return the endpoint that configured this wire
*
* @return the endpoint that configured this wire
* Unbind the invocable from the composite context
*/
Endpoint getEndpoint();
void unbind();
/**
* Force the invocation chains to be rebuilt
* Get the component
* @return
*/
void rebuild();
Component getComponent();
/**
* Get the service or reference (contract)
* @return
*/
Contract getContract();
/**
* Get the binding
* @return
*/
Binding getBinding();
/**
* Returns the invocation chains for service operations associated with the
* wire
@ -72,7 +97,7 @@ public interface RuntimeWire extends Cloneable {
/**
* Get the invocation chain for the binding-specific handling
* @return
* @return The binding invocation chain
*/
InvocationChain getBindingInvocationChain();
@ -80,11 +105,10 @@ public interface RuntimeWire extends Cloneable {
* This invoke method assumes that the binding invocation chain is in force
* and that there will be an operation selector element there to
* determine which operation to call
* @param msg The message
* @return The result
* @throws InvocationTargetException
* @param msg The request message
* @return The response message
*/
Object invoke(Message msg) throws InvocationTargetException;
Message invoke(Message msg);
/**
* Invoke an operation with given arguments
@ -98,17 +122,15 @@ public interface RuntimeWire extends Cloneable {
/**
* Invoke an operation with a context message
* @param operation The operation
* @param msg The message
* @return The result
* @param msg The request message
* @return The response message
* @throws InvocationTargetException
*/
Object invoke(Operation operation, Message msg) throws InvocationTargetException;
Message invoke(Operation operation, Message msg);
/**
* @return a clone of the runtime wire
* @throws CloneNotSupportedException
* Get a list of policy providers
* @return
*/
Object clone() throws CloneNotSupportedException;
boolean isOutOfDate();
List<PolicyProvider> getPolicyProviders();
}

View file

@ -20,7 +20,6 @@
package org.apache.tuscany.sca.runtime;
import org.apache.tuscany.sca.assembly.ComponentService;
import org.apache.tuscany.sca.assembly.EndpointReference;
import org.apache.tuscany.sca.context.CompositeContext;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.oasisopen.sca.ComponentContext;
@ -40,27 +39,12 @@ public interface RuntimeComponentContext extends ComponentContext {
* Get the CallableReference for a given component reference
* @param <B>
* @param businessInterface The business interface
* @param reference The reference to be wired
* @param endpointReference The endpointReference to be used
* @return A service reference representing the wire
*/
<B> ServiceReference<B> getServiceReference(Class<B> businessInterface,
RuntimeComponentReference reference,
EndpointReference endpointReference);
RuntimeEndpointReference endpointReference);
/**
* Bind the reference to a target component/componentService
* @param <B>
* @param businessInterface The business interface
* @param reference The reference to be wired
* @param component The target component
* @param service The target component service
* @return A service reference representing the wire
*/
<B> ServiceReference<B> getServiceReference(Class<B> businessInterface,
RuntimeComponentReference reference,
RuntimeComponent component,
RuntimeComponentService service);
/**
* Create a CallableReference for the given component service
@ -70,9 +54,7 @@ public interface RuntimeComponentContext extends ComponentContext {
* @param service
* @return
*/
<B> ServiceReference<B> getCallableReference(Class<B> businessInterface,
RuntimeComponent component,
RuntimeComponentService service);
<B> ServiceReference<B> getServiceReference(Class<B> businessInterface, RuntimeEndpoint endpoint);
/**
* @param <B>
@ -81,7 +63,8 @@ public interface RuntimeComponentContext extends ComponentContext {
* @return
*/
<B> ServiceReference<B> createSelfReference(Class<B> businessInterface, ComponentService service);
ExtensionPointRegistry getExtensionPointRegistry();
CompositeContext getCompositeContext();
}

View file

@ -19,15 +19,7 @@
package org.apache.tuscany.sca.runtime;
import java.util.List;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.assembly.ComponentReference;
import org.apache.tuscany.sca.assembly.EndpointReference;
import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.provider.PolicyProvider;
import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
/**
* The runtime component reference. Provides the bridge between the
@ -37,69 +29,6 @@ import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
* @version $Rev$ $Date$
*/
public interface RuntimeComponentReference extends ComponentReference {
/**
* Get a list of runtime wires to the reference
*
* @return The list of wires
*/
List<RuntimeWire> getRuntimeWires();
/**
* Get the runtime wire for the given binding
* @param binding The assembly model binding
* @return The runtime wire
*/
RuntimeWire getRuntimeWire(Binding binding);
/**
* Get the runtime wire for the given endpoint reference
* @param endpointReference The assembly model endpoint reference
* @return The runtime wire
*/
RuntimeWire getRuntimeWire(EndpointReference endpointReference);
/**
* Returns the reference binding provider associated with this
* component reference and the given binding.
*
* @param binding The assembly model binding
* @return The runtime reference binding provider
*/
ReferenceBindingProvider getBindingProvider(Binding binding);
/**
* Sets the reference binding provider associated with this
* component reference and the given binding.
*
* @param binding The assembly model binding
* @param bindingProvider The runtime reference binding provider
*/
void setBindingProvider(Binding binding, ReferenceBindingProvider bindingProvider);
/**
* Add a policy provider for the given binding to the reference
* @param binding The assembly model binding
* @param policyProvider The policy handler
*/
void addPolicyProvider(Binding binding, PolicyProvider policyProvider);
/**
* Get a list of policy providers for the given binding
* @param binding The assembly model binding
* @return A list of policy providers for the given binding
*/
List<PolicyProvider> getPolicyProviders(Binding binding);
/**
* Get the invoker for the given binding and operation
* @param binding The assembly model binding
* @param operation The assembly model operation
* @return The runtime Invoker
*/
Invoker getInvoker(Binding binding, Operation operation);
/**
* Set the owning component
* @param component

View file

@ -19,16 +19,7 @@
package org.apache.tuscany.sca.runtime;
import java.util.List;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.assembly.ComponentService;
import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.invocation.InvocationChain;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.provider.PolicyProvider;
import org.apache.tuscany.sca.provider.ServiceBindingProvider;
/**
* The runtime component service. Provides the bridge between the
@ -38,101 +29,4 @@ import org.apache.tuscany.sca.provider.ServiceBindingProvider;
* @version $Rev$ $Date$
*/
public interface RuntimeComponentService extends ComponentService {
/**
* Get a list of runtime wires to the service
*
* @return The list of wires
*/
List<RuntimeWire> getRuntimeWires();
/**
* Get the runtime wire for the given binding
* @param binding The assembly model binding
* @return The runtime wire
*/
RuntimeWire getRuntimeWire(Binding binding);
/**
* Get the callback wires associated with this service
*
* @return The list of runtime callback wires
*/
List<RuntimeWire> getCallbackWires();
/**
* Returns the service binding provider associated with this
* component service and the given binding.
*
* @param binding The assembly model binding
* @return The runtime service binding provider
*/
ServiceBindingProvider getBindingProvider(Binding binding);
/**
* Returns the service binding provider associated with this
* component service and the given binding.
*
* @param binding
* @param interfaceContract
* @return
*/
RuntimeWire getRuntimeWire(Binding binding, InterfaceContract interfaceContract);
/**
* Sets the service binding provider associated with this
* component service and the given binding.
*
* @param binding The assembly model binding
* @param bindingProvider The runtime service binding provider
*/
void setBindingProvider(Binding binding, ServiceBindingProvider bindingProvider);
/**
* Get the invoker for the given binding and operation
* @param binding The assembly model binding
* @param operation The assembly model operation
* @return The runtime invoker
*/
Invoker getInvoker(Binding binding, Operation operation);
/**
* Get the invoker for the given binding and operation
* @param binding The assembly model binding
* @param interfaceContract the client interface contract
* @param operation The assembly model operation
* @return The runtime invoker
*/
Invoker getInvoker(Binding binding, InterfaceContract interfaceContract, Operation operation);
/**
* Get the invocation chain for the given binding and operation
* @param binding The assembly model binding
* @param operation The assembly model operation
* @return The runtime invocation chain
*/
InvocationChain getInvocationChain(Binding binding, Operation operation);
/**
* Get the invocation chain for the given binding and operation
* @param binding The assembly model binding
* @param operation The assembly model operation
* @param interfaceContract the client interface contract
* @return The runtime invocation chain
*/
InvocationChain getInvocationChain(Binding binding, InterfaceContract interfaceContract, Operation operation);
/**
* Add a policy provider for the given binding to the service
* @param binding The assembly model binding
* @param policyProvider The policy handler
*/
void addPolicyProvider(Binding binding, PolicyProvider policyProvider);
/**
* Get a list of policy providers for the given binding
* @param binding The assembly model binding
* @return A list of policy providers for the given binding
*/
List<PolicyProvider> getPolicyProviders(Binding binding);
}

View file

@ -20,70 +20,15 @@
package org.apache.tuscany.sca.runtime;
import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import org.apache.tuscany.sca.assembly.Endpoint;
import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.invocation.InvocationChain;
import org.apache.tuscany.sca.invocation.Message;
import org.apache.tuscany.sca.provider.PolicyProvider;
import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.provider.ServiceBindingProvider;
/**
* The runtime representation of a service endpoint
*/
public interface RuntimeEndpoint extends Endpoint, Serializable {
/**
* Returns the invocation chains for service operations associated with the
* wire
*
* @return the invocation chains for service operations associated with the
* wire
*/
List<InvocationChain> getInvocationChains();
/**
* Lookup the invocation chain by operation
* @param operation The operation
* @return The invocation chain for the given operation
*/
InvocationChain getInvocationChain(Operation operation);
/**
* Get the invocation chain for the binding-specific handling
* @return The binding invocation chain
*/
InvocationChain getBindingInvocationChain();
/**
* This invoke method assumes that the binding invocation chain is in force
* and that there will be an operation selector element there to
* determine which operation to call
* @param msg The message
* @return The result
* @throws InvocationTargetException
*/
Object invoke(Message msg) throws InvocationTargetException;
/**
* Invoke an operation with given arguments
* @param operation The operation
* @param args The arguments
* @return The result
* @throws InvocationTargetException
*/
Object invoke(Operation operation, Object[] args) throws InvocationTargetException;
/**
* Invoke an operation with a context message
* @param operation The operation
* @param msg The message
* @return The result
* @throws InvocationTargetException
*/
Object invoke(Operation operation, Message msg) throws InvocationTargetException;
public interface RuntimeEndpoint extends Endpoint, Invocable, Serializable {
/**
* Attach the service binding provider
* @param provider
@ -95,10 +40,19 @@ public interface RuntimeEndpoint extends Endpoint, Serializable {
* @return
*/
ServiceBindingProvider getBindingProvider();
/**
* Get a list of policy providers
* @return
* Get the interface contract for the binding. This represents the data types that the binding
* protocol stack can process.
* @return The binding interface contract
*/
List<PolicyProvider> getPolicyProviders();
InterfaceContract getBindingInterfaceContract();
/**
* Get the interface contract of the service of the target component type, i.e., the
* componentType.service.interfaceContract. This represents the data types that the implementation
* code can process.
* @return The target component type service interface contract
*/
InterfaceContract getServiceInterfaceContract();
}

View file

@ -20,70 +20,15 @@
package org.apache.tuscany.sca.runtime;
import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import org.apache.tuscany.sca.assembly.EndpointReference;
import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.invocation.InvocationChain;
import org.apache.tuscany.sca.invocation.Message;
import org.apache.tuscany.sca.provider.PolicyProvider;
import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
/**
* The runtime representation of an endpoint reference
*/
public interface RuntimeEndpointReference extends EndpointReference, Serializable {
/**
* Returns the invocation chains for service operations associated with the
* wire
*
* @return the invocation chains for service operations associated with the
* wire
*/
List<InvocationChain> getInvocationChains();
/**
* Lookup the invocation chain by operation
* @param operation The operation
* @return The invocation chain for the given operation
*/
InvocationChain getInvocationChain(Operation operation);
/**
* Get the invocation chain for the binding-specific handling
* @return The binding invocation chain
*/
InvocationChain getBindingInvocationChain();
/**
* This invoke method assumes that the binding invocation chain is in force
* and that there will be an operation selector element there to
* determine which operation to call
* @param msg The message
* @return The result
* @throws InvocationTargetException
*/
Object invoke(Message msg) throws InvocationTargetException;
/**
* Invoke an operation with given arguments
* @param operation The operation
* @param args The arguments
* @return The result
* @throws InvocationTargetException
*/
Object invoke(Operation operation, Object[] args) throws InvocationTargetException;
/**
* Invoke an operation with a context message
* @param operation The operation
* @param msg The message
* @return The result
* @throws InvocationTargetException
*/
Object invoke(Operation operation, Message msg) throws InvocationTargetException;
public interface RuntimeEndpointReference extends EndpointReference, Invocable, Serializable {
/**
* Set the reference binding provider for the endpoint reference
* @param provider The binding provider
@ -95,10 +40,21 @@ public interface RuntimeEndpointReference extends EndpointReference, Serializabl
* @return The binding provider
*/
ReferenceBindingProvider getBindingProvider();
/**
* Get the list of policy providers for the endpoint reference
* @return A list of policy providers for the endpoint reference
* Get the interface contract for the binding. This represents the data types that the binding
* protocol stack can process.
* @return The binding interface contract
*/
List<PolicyProvider> getPolicyProviders();
InterfaceContract getBindingInterfaceContract();
/**
* Get the interface contract of the reference of the source component type, i.e., the
* componentType.reference.interfaceContract. This represents the data types that the
* implementation code uses to make the outbound call.
* @return The source component type reference interface contract
*/
InterfaceContract getReferenceInterfaceContract();
boolean isOutOfDate();
void rebuild();
}

View file

@ -24,12 +24,15 @@ package org.apache.tuscany.sca.runtime;
* @version $Rev$ $Date$
*/
public interface RuntimeWireProcessor {
/**
* Process the runtime wire to add interceptors
*
* @param wire
* Configure the runtime endpoint
* @param endpoint
*/
void process(RuntimeWire wire);
void process(RuntimeEndpoint endpoint);
/**
* Configure the runtime endpoint reference
* @param endpointReference
*/
void process(RuntimeEndpointReference endpointReference);
}

Some files were not shown because too many files have changed in this diff Show more