From 5c2a1fa0635c491ab13c9e5b141c1b1ebbfd7c7c Mon Sep 17 00:00:00 2001 From: rfeng Date: Mon, 8 Jun 2009 22:29:21 +0000 Subject: Make ExtensionPointRegistry available to AssemblyFactory so that it can create Endpoint2/EndpointReference2 with the registry for looking up a processor to provide EP/EPR XML marshaling and unmarshaling git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@782818 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/assembly/DefaultAssemblyFactory.java | 18 ++++- .../org/apache/tuscany/sca/assembly/Endpoint2.java | 93 +++++++++++----------- .../tuscany/sca/assembly/EndpointReference2.java | 88 ++++++++++---------- .../sca/assembly/impl/AssemblyFactoryImpl.java | 23 ++++-- .../tuscany/sca/assembly/impl/Endpoint2Impl.java | 67 ++++++++++------ .../sca/assembly/impl/EndpointReference2Impl.java | 74 ++++++++++------- .../sca/core/assembly/RuntimeAssemblyFactory.java | 17 ++-- .../tuscany/sca/binding/sca/EndpointTestCase.java | 68 ++++++++-------- .../tuscany/sca/node/impl/NodeFactoryImpl.java | 2 +- 9 files changed, 254 insertions(+), 196 deletions(-) (limited to 'java/sca') diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultAssemblyFactory.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultAssemblyFactory.java index 5dd256e3c4..6d8350fc66 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultAssemblyFactory.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultAssemblyFactory.java @@ -6,26 +6,36 @@ * 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.assembly; import org.apache.tuscany.sca.assembly.impl.AssemblyFactoryImpl; +import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry; +import org.apache.tuscany.sca.core.ExtensionPointRegistry; /** * A factory for the assembly model. - * + * * @version $Rev$ $Date$ */ public class DefaultAssemblyFactory extends AssemblyFactoryImpl implements AssemblyFactory { + public DefaultAssemblyFactory(ExtensionPointRegistry registry) { + super(registry); + } + + public DefaultAssemblyFactory() { + super(new DefaultExtensionPointRegistry()); + } + } diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Endpoint2.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Endpoint2.java index 2af6405bc2..e2ee776d55 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Endpoint2.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Endpoint2.java @@ -6,144 +6,145 @@ * 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.assembly; +import java.io.Serializable; import java.util.List; import org.apache.tuscany.sca.interfacedef.InterfaceContract; import org.apache.tuscany.sca.policy.PolicySubject; /** - * Represents a service endpoint which is what results from having a configured + * Represents a service endpoint which is what results from having a configured * binding applied to a component service. In a deployed application an endpoint * will relate directly to a physical endpoint, for example, a HTTP URL or a - * JMS destination. - * + * JMS destination. + * * @version $Rev$ $Date$ */ -public interface Endpoint2 extends Base, PolicySubject, Cloneable { - +public interface Endpoint2 extends Base, PolicySubject, Cloneable, Serializable { + /** * Supports endpoint cloning - * + * * @return endpoint * @throws CloneNotSupportedException */ Object clone() throws CloneNotSupportedException; - + /** * Get the name of the component to which this endpoint refers - * + * * @return componentName */ String getComponentName(); - + /** * Set the name of the component to which this endpoint refers - * + * * @Param componentName - */ + */ void setComponentName(String componentName); - + /** * Get the name of the service to which this endpoint refers - * + * * @return serviceName */ String getServiceName(); - + /** * Set the name of the component to which this endpoint refers - * + * * @Param serviceName */ void setServiceName(String serviceName); - + /** * Get the name of the binding to which this endpoint refers - * + * * @return bindingName */ String getBindingName(); - + /** * Set the name of the component to which this endpoint refers - * + * * @param bindingName */ void setBindingName(String bindingName); - + /** * Get the component model object - * + * * @return component */ Component getComponent(); - + /** * Set the component model object - * - * @param component + * + * @param component */ void setComponent(Component component); - + /** * Get the service model object - * + * * @return service */ ComponentService getService(); - + /** * Set the service model object - * + * * @param service */ void setService(ComponentService service); - + /** - * Get the resolved target binding - * + * Get the resolved target binding + * * @return target binding */ Binding getBinding(); - + /** * Set the binding - * + * * @param binding */ - void setBinding(Binding binding); + void setBinding(Binding binding); /** - * Returns the interface contract defining the interface - * + * Returns the interface contract defining the interface + * * @return the interface contract */ InterfaceContract getInterfaceContract(); - + /** - * Sets the interface contract defining the interface - * + * Sets the interface contract defining the interface + * * @param interfaceContract the interface contract */ - void setInterfaceContract(InterfaceContract interfaceContract); - + void setInterfaceContract(InterfaceContract interfaceContract); + /** - * Get the service's callback endpoint references that + * Get the service's callback endpoint references that * represent endpoint references from which callbacks * originate - * + * * @return callbackEndpoint the reference callback endpoint */ List getCallbackEndpointReferences(); diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EndpointReference2.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EndpointReference2.java index a207f81727..2c6d95f20b 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EndpointReference2.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EndpointReference2.java @@ -6,120 +6,122 @@ * 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.assembly; +import java.io.Serializable; + import org.apache.tuscany.sca.interfacedef.InterfaceContract; import org.apache.tuscany.sca.policy.PolicySubject; /** - * Represents an endpoint reference. An SCA reference can reference service endpoints in a + * Represents an endpoint reference. An SCA reference can reference service endpoints in a * number of ways. Target names, autowire, configured bindings. The endpoint reference - * captures the result of specifying one of these things. - * + * captures the result of specifying one of these things. + * * @version $Rev$ $Date$ */ -public interface EndpointReference2 extends Base, PolicySubject, Cloneable { - +public interface EndpointReference2 extends Base, PolicySubject, Cloneable, Serializable { + /** * Supports endpoint reference cloning - * + * * @return endpointReference * @throws CloneNotSupportedException */ Object clone() throws CloneNotSupportedException; - + /** * Get the component model object - * + * * @return component */ Component getComponent(); - + /** * Set the component model object - * + * * @param component the component for the endpoint */ void setComponent(Component component); - + /** * Get the source component reference model object - * + * * @return reference the source component reference for the endpoint */ ComponentReference getReference(); - + /** * Set the source component reference model object - * + * * @param reference */ - void setReference(ComponentReference reference); - + void setReference(ComponentReference reference); + /** - * Get the resolved reference binding - * + * Get the resolved reference binding + * * @return binding the resolved reference binding */ Binding getBinding(); - + /** - * Set the resolved reference binding - * + * Set the resolved reference binding + * * @param binding the resolved reference binding */ - void setBinding(Binding binding); - + void setBinding(Binding binding); + /** * Get the target endpoint - * + * * @return endpoint the target endpoint */ Endpoint2 getTargetEndpoint(); - + /** * Set the target endpoint model object - * + * * @param endpoint the target endpoint */ void setTargetEndpoint(Endpoint2 targetEndpoint); - + /** - * Returns the interface contract defining the interface - * + * Returns the interface contract defining the interface + * * @return the interface contract */ InterfaceContract getInterfaceContract(); - + /** - * Sets the interface contract defining the interface - * + * Sets the interface contract defining the interface + * * @param interfaceContract the interface contract */ void setInterfaceContract(InterfaceContract interfaceContract); - + /** - * Get the reference callback endpoint that - * represents that target endpoint to which callback - * messages will be directed - * + * Get the reference callback endpoint that + * represents that target endpoint to which callback + * messages will be directed + * * @return callbackEndpoint the reference callback endpoint */ Endpoint2 getCallbackEndpoint(); - + /** - * Set the reference callback endpoint - * + * Set the reference callback endpoint + * * @param callbackEndpoint the reference callback endpoint */ void setCallbackEndpoint(Endpoint2 callbackEndpoint); diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AssemblyFactoryImpl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AssemblyFactoryImpl.java index e9939a2d2c..09b8ff453c 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AssemblyFactoryImpl.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AssemblyFactoryImpl.java @@ -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.assembly.impl; @@ -40,14 +40,21 @@ import org.apache.tuscany.sca.assembly.Property; import org.apache.tuscany.sca.assembly.Reference; import org.apache.tuscany.sca.assembly.Service; import org.apache.tuscany.sca.assembly.Wire; +import org.apache.tuscany.sca.core.ExtensionPointRegistry; /** * A factory for the assembly model. - * + * * @version $Rev$ $Date$ */ public abstract class AssemblyFactoryImpl implements AssemblyFactory { + protected ExtensionPointRegistry registry; + protected AssemblyFactoryImpl(ExtensionPointRegistry registry) { + super(); + this.registry = registry; + } + public AbstractProperty createAbstractProperty() { return new AbstractPropertyImpl(); } @@ -115,16 +122,16 @@ public abstract class AssemblyFactoryImpl implements AssemblyFactory { public Wire createWire() { return new WireImpl(); } - + public Extension createExtension() { return new ExtensionImpl(); } public Endpoint2 createEndpoint() { - return new Endpoint2Impl(); + return new Endpoint2Impl(registry); } - + public EndpointReference2 createEndpointReference() { - return new EndpointReference2Impl(); + return new EndpointReference2Impl(registry); } } diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/Endpoint2Impl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/Endpoint2Impl.java index 010a891cdc..32506e63e2 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/Endpoint2Impl.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/Endpoint2Impl.java @@ -6,18 +6,22 @@ * 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.assembly.impl; +import java.io.Externalizable; +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectOutput; import java.util.ArrayList; import java.util.List; @@ -26,6 +30,7 @@ import org.apache.tuscany.sca.assembly.Component; import org.apache.tuscany.sca.assembly.ComponentService; import org.apache.tuscany.sca.assembly.Endpoint2; import org.apache.tuscany.sca.assembly.EndpointReference2; +import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.interfacedef.InterfaceContract; import org.apache.tuscany.sca.policy.ExtensionType; import org.apache.tuscany.sca.policy.Intent; @@ -34,11 +39,11 @@ import org.apache.tuscany.sca.policy.PolicySubject; /** * The assembly model object for an endpoint. - * + * * @version $Rev$ $Date$ */ -public class Endpoint2Impl implements Endpoint2 { - +public class Endpoint2Impl implements Endpoint2, Externalizable { + private ExtensionPointRegistry registry; private Boolean unresolved; private String componentName; private Component component; @@ -51,7 +56,8 @@ public class Endpoint2Impl implements Endpoint2 { private List policySets = new ArrayList(); private List requiredIntents = new ArrayList(); - protected Endpoint2Impl() { + protected Endpoint2Impl(ExtensionPointRegistry registry) { + this.registry = registry; } @Override @@ -66,11 +72,11 @@ public class Endpoint2Impl implements Endpoint2 { public void setUnresolved(boolean unresolved) { this.unresolved = unresolved; } - + public String getComponentName() { return componentName; } - + public void setComponentName(String componentName) { this.componentName = componentName; } @@ -87,11 +93,11 @@ public class Endpoint2Impl implements Endpoint2 { public String getServiceName() { return serviceName; } - + public void setServiceName(String serviceName) { - this.serviceName = serviceName; + this.serviceName = serviceName; } - + public ComponentService getService() { return service; } @@ -100,11 +106,11 @@ public class Endpoint2Impl implements Endpoint2 { this.service = service; this.serviceName = service.getName(); } - + public String getBindingName() { return bindingName; } - + public void setBindingName(String bindingName) { this.bindingName = bindingName; } @@ -125,18 +131,18 @@ public class Endpoint2Impl implements Endpoint2 { public void setInterfaceContract(InterfaceContract interfaceContract) { this.interfaceContract = interfaceContract; } - + /** - * Get the services callbacl enpoint references that + * Get the services callbacl enpoint references that * represent endpoint references from which callbacks * originate - * + * * @return callbackEndpoint the reference callback endpoint */ public List getCallbackEndpointReferences(){ return callbackEndpointReferences; } - + public List getPolicySets() { return policySets; } @@ -155,28 +161,41 @@ public class Endpoint2Impl implements Endpoint2 { public void setType(ExtensionType type) { throw new UnsupportedOperationException(); } - + public String toString(){ String output = "Endpoint: "; - + if (componentName != null){ output += " Component = " + componentName; } - + if (serviceName != null){ output += " Service = " + serviceName; } - + if (bindingName != null){ output += " Binding = " + bindingName + "/" + binding.getClass().getName() + " "; } - + if (unresolved) { output += " Unresolved = true"; } else { output += " Unresolved = false"; } - + return output; } + + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { + // TODO: Lookup an endpoint serializer utility from the UtilityExtensionPoint + // Read the EP from the XML document + // See javax.xml.ws.wsaddressing.W3CEndpointReference + } + + public void writeExternal(ObjectOutput out) throws IOException { + // TODO: Lookup an endpoint serializer utility from the UtilityExtensionPoint + // Write the EP as XML document + // See javax.xml.ws.wsaddressing.W3CEndpointReference + } + } diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointReference2Impl.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointReference2Impl.java index 727ff8bf6a..4514d0e64b 100644 --- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointReference2Impl.java +++ b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointReference2Impl.java @@ -6,18 +6,22 @@ * 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.assembly.impl; +import java.io.Externalizable; +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectOutput; import java.util.ArrayList; import java.util.List; @@ -26,6 +30,7 @@ import org.apache.tuscany.sca.assembly.Component; import org.apache.tuscany.sca.assembly.ComponentReference; import org.apache.tuscany.sca.assembly.Endpoint2; import org.apache.tuscany.sca.assembly.EndpointReference2; +import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.interfacedef.InterfaceContract; import org.apache.tuscany.sca.policy.ExtensionType; import org.apache.tuscany.sca.policy.Intent; @@ -34,11 +39,11 @@ import org.apache.tuscany.sca.policy.PolicySubject; /** * The assembly model object for an endpoint. - * + * * @version $Rev$ $Date$ */ -public class EndpointReference2Impl implements EndpointReference2 { - +public class EndpointReference2Impl implements EndpointReference2, Externalizable { + private ExtensionPointRegistry registry; // this endpoint reference private Boolean unresolved = true; private Component component; @@ -47,25 +52,26 @@ public class EndpointReference2Impl implements EndpointReference2 { private List policySets = new ArrayList(); private List requiredIntents = new ArrayList(); private InterfaceContract interfaceContract; - - // the target of the endpoint reference + + // the target of the endpoint reference private Endpoint2 targetEndpoint; - - // callback endpoint that messages across this reference + + // callback endpoint that messages across this reference // will be directed toward private Endpoint2 callbackEndpoint; - - protected EndpointReference2Impl() { + + protected EndpointReference2Impl(ExtensionPointRegistry registry) { + this.registry = registry; } @Override public Object clone() throws CloneNotSupportedException { EndpointReference2 cloned = (EndpointReference2)super.clone(); - + if (targetEndpoint != null){ cloned.setTargetEndpoint((Endpoint2)targetEndpoint.clone()); } - + return cloned; } @@ -100,13 +106,13 @@ public class EndpointReference2Impl implements EndpointReference2 { public void setBinding(Binding binding) { this.binding = binding; } - + public Endpoint2 getTargetEndpoint() { return targetEndpoint; } - + public void setTargetEndpoint(Endpoint2 targetEndpoint) { - this.targetEndpoint = targetEndpoint; + this.targetEndpoint = targetEndpoint; } public InterfaceContract getInterfaceContract() { @@ -116,7 +122,7 @@ public class EndpointReference2Impl implements EndpointReference2 { public void setInterfaceContract(InterfaceContract interfaceContract) { this.interfaceContract = interfaceContract; } - + public List getPolicySets() { return policySets; } @@ -135,40 +141,52 @@ public class EndpointReference2Impl implements EndpointReference2 { public void setType(ExtensionType type) { throw new UnsupportedOperationException(); } - + public Endpoint2 getCallbackEndpoint() { return callbackEndpoint; } - + public void setCallbackEndpoint(Endpoint2 callbackEndpoint) { this.callbackEndpoint = callbackEndpoint; } - + public String toString(){ String output = "Endpoint Reference: "; - + if (component != null){ output += " Component = " + component.getName(); } - + if (reference != null){ output += " Reference = " + reference.getName(); } - + if (binding != null){ output += " Binding = " + binding.getName() + "/" + binding.getClass().getName() + " "; } - + if (unresolved) { output += " Unresolved = true "; } else { output += " Unresolved = false "; } - + if (targetEndpoint != null) { output += " Target " + targetEndpoint.toString(); } - + return output; - } + } + + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { + // TODO: Lookup an endpoint reference serializer utility from the UtilityExtensionPoint + // Read the EPR from the XML document + // See javax.xml.ws.wsaddressing.W3CEndpointReference + } + + public void writeExternal(ObjectOutput out) throws IOException { + // TODO: Lookup an endpoint reference serializer utility from the UtilityExtensionPoint + // Write the EPR as XML document + // See javax.xml.ws.wsaddressing.W3CEndpointReference + } } 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 8d8c9d10e8..547c8f6750 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 @@ -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.core.assembly; @@ -26,6 +26,7 @@ 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.ExtensionPointRegistry; 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; @@ -41,9 +42,9 @@ import org.apache.tuscany.sca.runtime.RuntimeComponent; * @version $Rev$ $Date$ */ public class RuntimeAssemblyFactory extends DefaultAssemblyFactory implements AssemblyFactory { - - public RuntimeAssemblyFactory() { - super(); + + public RuntimeAssemblyFactory(ExtensionPointRegistry registry) { + super(registry); } @Override @@ -60,7 +61,7 @@ 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); @@ -72,7 +73,7 @@ public class RuntimeAssemblyFactory extends DefaultAssemblyFactory implements As InterfaceContract interfaceContract) { return new EndpointReferenceImpl(component, contract, binding, interfaceContract); } - + public ReferenceParameters createReferenceParameters() { return new ReferenceParametersImpl(); } diff --git a/java/sca/modules/endpoint/src/test/java/org/apace/tuscany/sca/binding/sca/EndpointTestCase.java b/java/sca/modules/endpoint/src/test/java/org/apace/tuscany/sca/binding/sca/EndpointTestCase.java index 7d618d8e92..1e44da4661 100644 --- a/java/sca/modules/endpoint/src/test/java/org/apace/tuscany/sca/binding/sca/EndpointTestCase.java +++ b/java/sca/modules/endpoint/src/test/java/org/apace/tuscany/sca/binding/sca/EndpointTestCase.java @@ -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.apace.tuscany.sca.binding.sca; @@ -61,13 +61,13 @@ import org.junit.Test; * @version $Rev$ $Date$ */ public class EndpointTestCase { - + private static URLArtifactProcessor contributionProcessor; private static ModelResolverExtensionPoint modelResolvers; private static FactoryExtensionPoint modelFactories; private static AssemblyFactory assemblyFactory; private static XMLOutputFactory outputFactory; - private static StAXArtifactProcessor xmlProcessor; + private static StAXArtifactProcessor xmlProcessor; private static CompositeBuilder compositeBuilder; private static ModelResolver modelResolver; private static CompositeActivator compositeActivator; @@ -76,17 +76,17 @@ public class EndpointTestCase { @BeforeClass public static void init() { - - // Create extension point registry + + // Create extension point registry extensionPoints = new DefaultExtensionPointRegistry(); - + // Create a monitor UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class); MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class); - monitor = monitorFactory.createMonitor(); - + monitor = monitorFactory.createMonitor(); + modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class); - + // Initialize the Tuscany module activators ModuleActivatorExtensionPoint moduleActivators = extensionPoints.getExtensionPoint(ModuleActivatorExtensionPoint.class); for (ModuleActivator activator: moduleActivators.getModuleActivators()) { @@ -97,30 +97,30 @@ public class EndpointTestCase { XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class); outputFactory = modelFactories.getFactory(XMLOutputFactory.class); - + // Get contribution workspace and assembly model factories - assemblyFactory = new RuntimeAssemblyFactory(); + assemblyFactory = new RuntimeAssemblyFactory(extensionPoints); modelFactories.addFactory(assemblyFactory); - + // Create XML artifact processors StAXArtifactProcessorExtensionPoint xmlProcessorExtensions = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class); xmlProcessor = new ExtensibleStAXArtifactProcessor(xmlProcessorExtensions, inputFactory, outputFactory, monitor); - + // Create contribution content processor URLArtifactProcessorExtensionPoint docProcessorExtensions = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class); contributionProcessor = docProcessorExtensions.getProcessor(Contribution.class); - + // Get the model resolvers modelResolvers = extensionPoints.getExtensionPoint(ModelResolverExtensionPoint.class); modelResolver = new ExtensibleModelResolver(null, modelResolvers, modelFactories); - + // Create a composite builder compositeBuilder = extensionPoints.getExtensionPoint(CompositeBuilderExtensionPoint.class).getCompositeBuilder("org.apache.tuscany.sca.assembly.builder.CompositeBuilder"); - - + + } - + @Ignore @Test public void testProvider(){ @@ -128,33 +128,33 @@ public class EndpointTestCase { URI calculatorURI = URI.create("calcualtor"); URL calculatorURL = new File("./target/test-classes").toURI().toURL(); Contribution contribution = contributionProcessor.read(null, calculatorURI, calculatorURL); - + contributionProcessor.resolve(contribution, modelResolver); - + Composite composite = contribution.getDeployables().get(0); - + compositeBuilder.build(composite, null, monitor); - + ComponentReference ref = (composite.getComponents().get(0).getReferences().get(0)); -/* TODO - EPR - convert to new endpoint reference +/* TODO - EPR - convert to new endpoint reference Assert.assertEquals(1, ref.getEndpoints().size()); - + Endpoint endpoint = ref.getEndpoints().get(0); - + EndpointResolverFactory factory = new EndpointResolverFactoryImpl(extensionPoints); - + EndpointResolver endpointResolver = factory.createEndpointResolver(endpoint, null); - + Assert.assertNotNull(endpointResolver); -*/ - - +*/ + + } catch(Exception ex) { ex.printStackTrace(); System.out.println(ex.toString()); Assert.fail(); } } - - + + } diff --git a/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java b/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java index 2395d7ed43..f637842afe 100644 --- a/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java +++ b/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java @@ -389,7 +389,7 @@ public class NodeFactoryImpl extends NodeFactory { // Use the runtime-enabled assembly factory modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class); - assemblyFactory = new RuntimeAssemblyFactory(); + assemblyFactory = new RuntimeAssemblyFactory(extensionPoints); modelFactories.addFactory(assemblyFactory); // Create a monitor -- cgit v1.2.3