diff options
Diffstat (limited to 'java')
3 files changed, 36 insertions, 37 deletions
diff --git a/java/sca/modules/binding-atom-runtime/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingProviderFactory.java b/java/sca/modules/binding-atom-runtime/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingProviderFactory.java index 00df45a49e..2f0c505277 100644 --- a/java/sca/modules/binding-atom-runtime/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingProviderFactory.java +++ b/java/sca/modules/binding-atom-runtime/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingProviderFactory.java @@ -19,9 +19,11 @@ 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.contribution.ModelFactoryExtensionPoint; import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.FactoryExtensionPoint; import org.apache.tuscany.sca.core.UtilityExtensionPoint; import org.apache.tuscany.sca.databinding.Mediator; import org.apache.tuscany.sca.host.http.ServletHost; @@ -30,9 +32,6 @@ 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.RuntimeComponent; -import org.apache.tuscany.sca.runtime.RuntimeComponentReference; -import org.apache.tuscany.sca.runtime.RuntimeComponentService; /** * Implementation of a Binding provider factory for the Atom binding. @@ -48,21 +47,17 @@ public class AtomBindingProviderFactory implements BindingProviderFactory<AtomBi public AtomBindingProviderFactory(ExtensionPointRegistry extensionPoints) { ServletHostExtensionPoint servletHosts = extensionPoints.getExtensionPoint(ServletHostExtensionPoint.class); this.servletHost = servletHosts.getServletHosts().get(0); - ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class); + FactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class); this.messageFactory = modelFactories.getFactory(MessageFactory.class); this.mediator = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class).getUtility(Mediator.class); } - public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component, - RuntimeComponentReference reference, - AtomBinding binding) { - return new AtomReferenceBindingProvider(component, reference, binding, mediator); + ReferenceBindingProvider createReferenceBindingProvider(EndpointReference endpointReference) { + return new AtomReferenceBindingProvider(endpointReference, mediator); } - public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component, - RuntimeComponentService service, - AtomBinding binding) { - return new AtomServiceBindingProvider(component, service, binding, servletHost, messageFactory, mediator); + ServiceBindingProvider createServiceBindingProvider(Endpoint endpoint) { + return new AtomServiceBindingProvider(endpoint, messageFactory, mediator, servletHost); } public Class<AtomBinding> getModelType() { diff --git a/java/sca/modules/binding-atom-runtime/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomReferenceBindingProvider.java b/java/sca/modules/binding-atom-runtime/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomReferenceBindingProvider.java index 65331af34c..9291b8556b 100644 --- a/java/sca/modules/binding-atom-runtime/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomReferenceBindingProvider.java +++ b/java/sca/modules/binding-atom-runtime/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomReferenceBindingProvider.java @@ -28,6 +28,7 @@ import org.apache.commons.httpclient.HttpConnectionManager; import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager; import org.apache.commons.httpclient.UsernamePasswordCredentials; import org.apache.commons.httpclient.auth.AuthScope; +import org.apache.tuscany.sca.assembly.EndpointReference; import org.apache.tuscany.sca.binding.atom.AtomBinding; import org.apache.tuscany.sca.databinding.Mediator; import org.apache.tuscany.sca.interfacedef.DataType; @@ -37,7 +38,6 @@ import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl; import org.apache.tuscany.sca.interfacedef.util.XMLType; import org.apache.tuscany.sca.invocation.Invoker; import org.apache.tuscany.sca.provider.ReferenceBindingProvider; -import org.apache.tuscany.sca.runtime.RuntimeComponent; import org.apache.tuscany.sca.runtime.RuntimeComponentReference; /** @@ -46,7 +46,7 @@ import org.apache.tuscany.sca.runtime.RuntimeComponentReference; * @version $Rev$ $Date$ */ class AtomReferenceBindingProvider implements ReferenceBindingProvider { - + private EndpointReference endpointReference; private RuntimeComponentReference reference; private AtomBinding binding; private String authorizationHeader; @@ -63,12 +63,11 @@ class AtomReferenceBindingProvider implements ReferenceBindingProvider { * @param binding * @param mediator */ - AtomReferenceBindingProvider(RuntimeComponent component, - RuntimeComponentReference reference, - AtomBinding binding, - Mediator mediator) { - this.reference = reference; - this.binding = binding; + AtomReferenceBindingProvider(EndpointReference endpointReference, + Mediator mediator) { + this.endpointReference = endpointReference; + this.reference = (RuntimeComponentReference) endpointReference.getReference(); + this.binding = (AtomBinding) endpointReference.getBinding(); this.mediator = mediator; // Prepare authorization header diff --git a/java/sca/modules/binding-atom-runtime/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomServiceBindingProvider.java b/java/sca/modules/binding-atom-runtime/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomServiceBindingProvider.java index d794dd4ee8..697a6140da 100644 --- a/java/sca/modules/binding-atom-runtime/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomServiceBindingProvider.java +++ b/java/sca/modules/binding-atom-runtime/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomServiceBindingProvider.java @@ -19,6 +19,7 @@ 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; @@ -37,38 +38,42 @@ import org.apache.tuscany.sca.runtime.RuntimeWire; * @version $Rev$ $Date$ */ class AtomServiceBindingProvider implements ServiceBindingProvider { + private MessageFactory messageFactory; + + private Endpoint endpoint; + private RuntimeComponent component; private RuntimeComponentService service; private InterfaceContract serviceContract; private AtomBinding binding; private ServletHost servletHost; - private MessageFactory messageFactory; private Mediator mediator; private String servletMapping; private String bindingURI; - AtomServiceBindingProvider(RuntimeComponent component, - RuntimeComponentService service, - AtomBinding binding, - ServletHost servletHost, - MessageFactory messageFactory, - Mediator mediator) { - this.service = service; - this.binding = binding; + AtomServiceBindingProvider(Endpoint endpoint, + MessageFactory messageFactory, + Mediator mediator, + ServletHost servletHost) { + this.endpoint = endpoint; + this.component = (RuntimeComponent)endpoint.getComponent(); + this.service = (RuntimeComponentService)endpoint.getService(); + this.binding = (AtomBinding) endpoint.getBinding(); + this.servletHost = servletHost; this.messageFactory = messageFactory; 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; - } - } + for (Service componentService : component.getImplementation().getServices()) { + if (componentService.getName().equals(service.getName())) { + this.serviceContract = (InterfaceContract) componentService.getInterfaceContract(); + break; + } + } } } |