From 7a22e19de169d79b2e5ecc93b229631b8c1200f5 Mon Sep 17 00:00:00 2001 From: rfeng Date: Tue, 9 Dec 2008 19:20:26 +0000 Subject: Fix the access violation to EndpointReferenceImpl git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@724840 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/binding/ws/axis2/Axis2ServiceProvider.java | 16 ++++++++++++--- .../sca/core/assembly/RuntimeAssemblyFactory.java | 24 ++++++++++++++++++++++ 2 files changed, 37 insertions(+), 3 deletions(-) (limited to 'java') diff --git a/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java b/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java index c77adbb0c4..09cb6b13b7 100644 --- a/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java +++ b/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java @@ -71,6 +71,7 @@ import org.apache.axis2.transport.jms.JMSListener; import org.apache.axis2.transport.jms.JMSSender; import org.apache.axis2.transport.jms.JMSUtils; import org.apache.tuscany.sca.assembly.AbstractContract; +import org.apache.tuscany.sca.assembly.AssemblyFactory; import org.apache.tuscany.sca.assembly.Binding; import org.apache.tuscany.sca.binding.ws.WebServiceBinding; import org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceClient.URIResolverImpl; @@ -80,7 +81,8 @@ import org.apache.tuscany.sca.binding.ws.axis2.policy.configurator.Axis2BindingB import org.apache.tuscany.sca.binding.ws.axis2.policy.configurator.Axis2BindingHeaderConfigurator; import org.apache.tuscany.sca.binding.ws.axis2.policy.header.Axis2HeaderPolicy; import org.apache.tuscany.sca.binding.ws.axis2.policy.header.Axis2SOAPHeaderString; -import org.apache.tuscany.sca.core.assembly.impl.EndpointReferenceImpl; +import org.apache.tuscany.sca.core.FactoryExtensionPoint; +import org.apache.tuscany.sca.core.assembly.RuntimeAssemblyFactory; import org.apache.tuscany.sca.host.http.ServletHost; import org.apache.tuscany.sca.interfacedef.Interface; import org.apache.tuscany.sca.interfacedef.Operation; @@ -252,6 +254,14 @@ public class Axis2ServiceProvider { } } + // FIXME: [rfeng] Need to have a better way + private EndpointReference createEndpointReference(String uri) { + FactoryExtensionPoint factories = + component.getComponentContext().getExtensionPointRegistry().getExtensionPoint(FactoryExtensionPoint.class); + RuntimeAssemblyFactory factory = (RuntimeAssemblyFactory)factories.getFactory(AssemblyFactory.class); + return factory.createEndpointReference(uri); + } + private String computeEndpointURI(String uri, ServletHost servletHost) { if (uri == null) { @@ -713,14 +723,14 @@ public class Axis2ServiceProvider { if (callbackAddress != null || callbackID != null || conversationID != null) { - from = new EndpointReferenceImpl(null); + from = createEndpointReference(null); parameters = from.getReferenceParameters(); msg.setFrom(from); } // set the reference parameters into the "From" EPR if (callbackAddress != null) { - parameters.setCallbackReference(new EndpointReferenceImpl(callbackAddress)); + parameters.setCallbackReference(createEndpointReference(callbackAddress)); } if (callbackID != null) { parameters.setCallbackID(callbackID); diff --git a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeAssemblyFactory.java b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeAssemblyFactory.java index a60a57e5bc..8d8c9d10e8 100644 --- a/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeAssemblyFactory.java +++ b/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeAssemblyFactory.java @@ -20,13 +20,21 @@ package org.apache.tuscany.sca.core.assembly; import org.apache.tuscany.sca.assembly.AssemblyFactory; +import org.apache.tuscany.sca.assembly.Binding; import org.apache.tuscany.sca.assembly.Component; import org.apache.tuscany.sca.assembly.ComponentReference; import org.apache.tuscany.sca.assembly.ComponentService; +import org.apache.tuscany.sca.assembly.Contract; import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory; +import org.apache.tuscany.sca.core.assembly.impl.EndpointReferenceImpl; +import org.apache.tuscany.sca.core.assembly.impl.ReferenceParametersImpl; import org.apache.tuscany.sca.core.assembly.impl.RuntimeComponentImpl; import org.apache.tuscany.sca.core.assembly.impl.RuntimeComponentReferenceImpl; import org.apache.tuscany.sca.core.assembly.impl.RuntimeComponentServiceImpl; +import org.apache.tuscany.sca.interfacedef.InterfaceContract; +import org.apache.tuscany.sca.runtime.EndpointReference; +import org.apache.tuscany.sca.runtime.ReferenceParameters; +import org.apache.tuscany.sca.runtime.RuntimeComponent; /** * The runtime version of assembly factory @@ -52,5 +60,21 @@ public class RuntimeAssemblyFactory extends DefaultAssemblyFactory implements As public ComponentService createComponentService() { return new RuntimeComponentServiceImpl(); } + + // FIXME: [rfeng] We need to find a more consistent story to deal with EPR, EP and CallableReference + public EndpointReference createEndpointReference(String uri) { + return new EndpointReferenceImpl(uri); + } + + public EndpointReference createEndpointReference(RuntimeComponent component, + Contract contract, + Binding binding, + InterfaceContract interfaceContract) { + return new EndpointReferenceImpl(component, contract, binding, interfaceContract); + } + + public ReferenceParameters createReferenceParameters() { + return new ReferenceParametersImpl(); + } } -- cgit v1.2.3