diff options
17 files changed, 72 insertions, 166 deletions
diff --git a/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/EndpointReferenceProcessor.java b/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/EndpointReferenceProcessor.java index ea742ae404..eda90c9d44 100644 --- a/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/EndpointReferenceProcessor.java +++ b/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/EndpointReferenceProcessor.java @@ -99,12 +99,12 @@ public class EndpointReferenceProcessor extends BaseAssemblyProcessor implements // the endpoint registry will be consulted endpoint.setUnresolved(true); endpoint.setURI(reference.getTargets().get(0).getName()); - endpointReference.setStatus(EndpointReference.WIRED_TARGET_NOT_FOUND); + endpointReference.setStatus(EndpointReference.Status.WIRED_TARGET_NOT_FOUND); endpointReference.setUnresolved(true); } else { endpoint.setUnresolved(false); endpoint.setBinding(reference.getBindings().get(0)); - endpointReference.setStatus(EndpointReference.RESOLVED_BINDING); + endpointReference.setStatus(EndpointReference.Status.RESOLVED_BINDING); endpointReference.setUnresolved(false); } } @@ -130,7 +130,7 @@ public class EndpointReferenceProcessor extends BaseAssemblyProcessor implements Binding binding = (Binding)endpointReference.getBinding().clone(); reference.getBindings().add(binding); //reference.setInterfaceContract(endpointReference.getInterfaceContract()); - if (endpointReference.getStatus() != EndpointReference.RESOLVED_BINDING){ + if (endpointReference.getStatus() != EndpointReference.Status.RESOLVED_BINDING){ ComponentService service = assemblyFactory.createComponentService(); service.setName(endpointReference.getTargetEndpoint().getURI()); reference.getTargets().clear(); diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Endpoint.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Endpoint.java index 2a26bcb66b..df4aaf3b98 100644 --- a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Endpoint.java +++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Endpoint.java @@ -127,11 +127,5 @@ 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); - */ + } diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EndpointReference.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EndpointReference.java index ab02c02f4d..fef2a072d0 100644 --- a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EndpointReference.java +++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EndpointReference.java @@ -32,13 +32,18 @@ import org.apache.tuscany.sca.policy.PolicySubject; */ public interface EndpointReference extends Base, PolicySubject, Cloneable, Serializable { - public static final int NOT_CONFIGURED = 0; - public static final int RESOLVED_BINDING = 1; - public static final int AUTOWIRE_PLACEHOLDER = 2; - public static final int WIRED_TARGET_NOT_FOUND = 3; - public static final int WIRED_TARGET_FOUND_READY_FOR_MATCHING = 4; - public static final int WIRED_TARGET_FOUND_AND_MATCHED = 5; - public static final int WIRED_TARGET_IN_BINDING_URI = 6; + /** + * Status of the endpoint reference resolution + */ + enum Status { + NOT_CONFIGURED, // Not configured + RESOLVED_BINDING, // The endpoint reference is configured with a binding + AUTOWIRE_PLACEHOLDER, // Autowire to be performed + WIRED_TARGET_NOT_FOUND, // Wire target not found + WIRED_TARGET_FOUND_READY_FOR_MATCHING, // Wire target found and to be resolved to an endpoint + WIRED_TARGET_FOUND_AND_MATCHED, // Wire target found and resolved to an endpoint + WIRED_TARGET_IN_BINDING_URI // Target specified by the binding uri + }; /** * Get the structural URI of the reference binding @@ -142,28 +147,12 @@ public interface EndpointReference extends Base, PolicySubject, Cloneable, Seria void setCallbackEndpoint(Endpoint callbackEndpoint); /** - * Returns true if this endpoint reference refers to an endpoint that - * is not running in this endpoint reference - * - * @return true if the endpoint is remote - */ - boolean isRemote(); - - /** - * Set true if this endpoint reference refers to an endpoint that - * is not running in this endpoint reference - * - * @param remote set to true if the endpoint is remote - */ - void setRemote(boolean remote); - - /** * Rather than relying on combinations of unresolved flags and * other data we maintain a status enumeration * * @return status */ - int getStatus(); + Status getStatus(); /** * Rather than relying on combinations of unresolved flags and @@ -171,5 +160,5 @@ public interface EndpointReference extends Base, PolicySubject, Cloneable, Seria * * @param status the new status */ - void setStatus(int status); + void setStatus(Status status); } diff --git a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointReferenceImpl.java b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointReferenceImpl.java index b80d3c6437..d13740b287 100644 --- a/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointReferenceImpl.java +++ b/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointReferenceImpl.java @@ -50,8 +50,7 @@ public class EndpointReferenceImpl implements EndpointReference { protected List<PolicySet> policySets = new ArrayList<PolicySet>(); protected List<Intent> requiredIntents = new ArrayList<Intent>(); protected InterfaceContract interfaceContract; - protected boolean remote = false; - protected int status; + protected Status status = Status.NOT_CONFIGURED; // the target of the endpoint reference protected Endpoint targetEndpoint; @@ -169,41 +168,19 @@ public class EndpointReferenceImpl implements EndpointReference { } public String toStringWithoutHash() { - String output = "EndpointReference: "; + StringBuffer output = new StringBuffer("EndpointReference: "); if (getURI() != null) { - output += " URI = " + getURI(); + output.append(" URI = ").append(getURI()); } - switch (status) { - case 0: - output += " NOT_CONFIGURED "; - break; - case 1: - output += " RESOLVED_BINDING "; - break; - case 2: - output += " AUTOWIRE_PLACEHOLDER "; - break; - case 3: - output += " WIRED_TARGET_NOT_FOUND "; - break; - case 4: - output += " WIRED_TARGET_FOUND_READY_FOR_MATCHING "; - break; - case 5: - output += " WIRED_TARGET_FOUND_AND_MATCHED "; - break; - case 6: - output += " WIRED_TARGET_IN_BINDING_URI "; - break; - } + output.append(" ").append(status); if (targetEndpoint != null) { - output += " Target = " + targetEndpoint.toString(); + output.append(" Target = ").append(targetEndpoint); } - return output; + return output.toString(); } public String toString() { @@ -231,14 +208,6 @@ public class EndpointReferenceImpl implements EndpointReference { this.uri = uri; } - public boolean isRemote() { - return remote; - } - - public void setRemote(boolean remote) { - this.remote = remote; - } - protected void resolve() { } @@ -250,11 +219,11 @@ public class EndpointReferenceImpl implements EndpointReference { this.registry = registry; } - public int getStatus() { + public Status getStatus() { return status; } - public void setStatus(int status) { + public void setStatus(Status status) { this.status = status; } } diff --git a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportServiceInterceptor.java b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportServiceInterceptor.java index 04edbe95fa..1a175ce026 100644 --- a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportServiceInterceptor.java +++ b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportServiceInterceptor.java @@ -106,7 +106,7 @@ public class TransportServiceInterceptor implements Interceptor { EndpointReference from = assemblyFactory.createEndpointReference(); Endpoint fromEndpoint = assemblyFactory.createEndpoint(); from.setTargetEndpoint(fromEndpoint); - from.setStatus(EndpointReference.WIRED_TARGET_FOUND_AND_MATCHED); + from.setStatus(EndpointReference.Status.WIRED_TARGET_FOUND_AND_MATCHED); msg.setFrom(from); Endpoint callbackEndpoint = assemblyFactory.createEndpoint(); // callbackEndpoint.setURI(callbackAddress); // TODO: is this needed? Seems to work without it diff --git a/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java b/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java index 201f604b94..362c269b01 100644 --- a/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java +++ b/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java @@ -109,7 +109,7 @@ public class Axis2ServiceProvider implements Provider<OMElement> { from = assemblyFactory.createEndpointReference(); Endpoint fromEndpoint = assemblyFactory.createEndpoint(); from.setTargetEndpoint(fromEndpoint); - from.setStatus(EndpointReference.WIRED_TARGET_FOUND_AND_MATCHED); + from.setStatus(EndpointReference.Status.WIRED_TARGET_FOUND_AND_MATCHED); msg.setFrom(from); Endpoint callbackEndpoint = assemblyFactory.createEndpoint(); callbackEndpoint.setURI(callbackAddress); diff --git a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/BindingURIBuilderImpl.java b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/BindingURIBuilderImpl.java index aad07dd704..42da4abed7 100644 --- a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/BindingURIBuilderImpl.java +++ b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/BindingURIBuilderImpl.java @@ -194,17 +194,11 @@ public class BindingURIBuilderImpl implements CompositeBuilder { boolean includeBindingName = !service.getName().equals(binding.getName()); // calculate the service binding URI - URI bindingURI; - if (binding.getURI() != null) { - bindingURI = new URI(binding.getURI()); - - // if the user has provided an absolute binding URI then use it - if (bindingURI.isAbsolute()) { - binding.setURI(bindingURI.toString()); - return; - } - } else { - bindingURI = null; + URI bindingURI = binding.getURI() == null ? null : new URI(binding.getURI()); + + // if the user has provided an absolute binding URI then use it + if (bindingURI != null && bindingURI.isAbsolute()) { + return; } String serviceName = service.getName(); @@ -217,22 +211,9 @@ public class BindingURIBuilderImpl implements CompositeBuilder { } // calculate the component URI - URI componentURI; + URI componentURI = null; if (componentURIString != null) { componentURI = new URI(addSlashToPath(componentURIString)); - } else { - componentURI = null; - } - - // if the user has provided an absolute component URI then use it - if (componentURI != null && componentURI.isAbsolute()) { - binding.setURI(constructBindingURI(null, - componentURI, - bindingURI, - serviceName, - includeBindingName, - bindingName)); - return; } // calculate the base URI diff --git a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java index e2b3c1200e..8771a204eb 100644 --- a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java +++ b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java @@ -222,7 +222,7 @@ public class EndpointReferenceBuilderImpl { if (intentsMatch(reference.getRequiredIntents(), targetComponentService.getRequiredIntents())) { EndpointReference endpointRef = createEndpointRef(component, reference, false); endpointRef.setTargetEndpoint(createEndpoint(targetComponent, targetComponentService, true)); - endpointRef.setStatus(EndpointReference.WIRED_TARGET_NOT_FOUND); + endpointRef.setStatus(EndpointReference.Status.WIRED_TARGET_NOT_FOUND); reference.getEndpointReferences().add(endpointRef); // Stop with the first match for 0..1 and 1..1 references @@ -269,8 +269,7 @@ public class EndpointReferenceBuilderImpl { EndpointReference endpointRef = createEndpointRef(component, reference, true); endpointRef.setTargetEndpoint(createEndpoint(component, target.getName())); - endpointRef.setRemote(true); - endpointRef.setStatus(EndpointReference.WIRED_TARGET_NOT_FOUND); + endpointRef.setStatus(EndpointReference.Status.WIRED_TARGET_NOT_FOUND); reference.getEndpointReferences().add(endpointRef); } } @@ -296,14 +295,13 @@ public class EndpointReferenceBuilderImpl { // Assume that the system needs to resolve this binding later as // it's the SCA binding endpointRef.setTargetEndpoint(createEndpoint(true)); - endpointRef.setStatus(EndpointReference.NOT_CONFIGURED); + endpointRef.setStatus(EndpointReference.Status.NOT_CONFIGURED); } else { // The user has configured a binding so assume they know what // they are doing and mark in as already resolved. endpointRef.setTargetEndpoint(createEndpoint(false)); - endpointRef.setStatus(EndpointReference.RESOLVED_BINDING); + endpointRef.setStatus(EndpointReference.Status.RESOLVED_BINDING); } - endpointRef.setRemote(true); reference.getEndpointReferences().add(endpointRef); continue; } // end if @@ -323,7 +321,7 @@ public class EndpointReferenceBuilderImpl { // so that the binder can test it against the fully populated // registry endpoint = createEndpoint(component, uri); - endpointRef.setStatus(EndpointReference.WIRED_TARGET_IN_BINDING_URI); + endpointRef.setStatus(EndpointReference.Status.WIRED_TARGET_IN_BINDING_URI); } catch (Exception ex) { // the target string definitely isn't an SCA target string // so we can assume here that the user has configured a @@ -331,7 +329,7 @@ public class EndpointReferenceBuilderImpl { endpoint = createEndpoint(false); endpoint.setURI(uri); endpoint.setBinding(binding); - endpointRef.setStatus(EndpointReference.RESOLVED_BINDING); + endpointRef.setStatus(EndpointReference.Status.RESOLVED_BINDING); } endpointRef.setTargetEndpoint(endpoint); @@ -784,7 +782,7 @@ public class EndpointReferenceBuilderImpl { // have to pass in reference as we don't have access to the registry in // the builders for (EndpointReference epr : registry.getEndpointReferences()){ - if (epr.getStatus() == EndpointReference.AUTOWIRE_PLACEHOLDER){ + if (epr.getStatus() == EndpointReference.Status.AUTOWIRE_PLACEHOLDER){ epr.getReference().getEndpointReferences().remove(epr); } } diff --git a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/WireBuilderImpl.java b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/WireBuilderImpl.java index 4b6a551a8e..21725fb1b1 100644 --- a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/WireBuilderImpl.java +++ b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/WireBuilderImpl.java @@ -356,7 +356,7 @@ public class WireBuilderImpl { if (intentsMatch(reference.getRequiredIntents(), targetComponentService.getRequiredIntents())) { EndpointReference endpointRef = createEndpointRef(component, reference, false); endpointRef.setTargetEndpoint(createEndpoint(targetComponent, targetComponentService, true)); - endpointRef.setStatus(EndpointReference.WIRED_TARGET_FOUND_READY_FOR_MATCHING); + endpointRef.setStatus(EndpointReference.Status.WIRED_TARGET_FOUND_READY_FOR_MATCHING); reference.getEndpointReferences().add(endpointRef); // Stop with the first match for 0..1 and 1..1 references @@ -425,15 +425,14 @@ public class WireBuilderImpl { targetComponentService, targetBinding, true)); - endpointRef.setStatus(EndpointReference.WIRED_TARGET_FOUND_AND_MATCHED); + endpointRef.setStatus(EndpointReference.Status.WIRED_TARGET_FOUND_AND_MATCHED); // relying on the registry here to resolve the real endpoint reference.getEndpointReferences().add(endpointRef); } else { EndpointReference endpointRef = createEndpointRef(component, reference, true); endpointRef.setTargetEndpoint(createEndpoint(component, targetName)); - endpointRef.setRemote(true); - endpointRef.setStatus(EndpointReference.WIRED_TARGET_NOT_FOUND); + endpointRef.setStatus(EndpointReference.Status.WIRED_TARGET_NOT_FOUND); reference.getEndpointReferences().add(endpointRef); Monitor.warning(monitor, this, @@ -449,7 +448,7 @@ public class WireBuilderImpl { EndpointReference endpointRef = createEndpointRef(component, reference, false); endpointRef .setTargetEndpoint(createEndpoint(targetComponent, targetComponentService, true)); - endpointRef.setStatus(EndpointReference.WIRED_TARGET_FOUND_READY_FOR_MATCHING); + endpointRef.setStatus(EndpointReference.Status.WIRED_TARGET_FOUND_READY_FOR_MATCHING); reference.getEndpointReferences().add(endpointRef); } } else { @@ -465,8 +464,7 @@ public class WireBuilderImpl { // add an unresolved endpoint reference with an unresolved endpoint to go with it EndpointReference endpointRef = createEndpointRef(component, reference, true); endpointRef.setTargetEndpoint(createEndpoint(component, targetName)); - endpointRef.setRemote(true); - endpointRef.setStatus(EndpointReference.WIRED_TARGET_NOT_FOUND); + endpointRef.setStatus(EndpointReference.Status.WIRED_TARGET_NOT_FOUND); reference.getEndpointReferences().add(endpointRef); Monitor.warning(monitor, this, @@ -499,14 +497,13 @@ public class WireBuilderImpl { // Assume that the system needs to resolve this binding later as // it's the SCA binding endpointRef.setTargetEndpoint(createEndpoint(true)); - endpointRef.setStatus(EndpointReference.NOT_CONFIGURED); + endpointRef.setStatus(EndpointReference.Status.NOT_CONFIGURED); } else { // The user has configured a binding so assume they know what // they are doing and mark in as already resolved. endpointRef.setTargetEndpoint(createEndpoint(false)); - endpointRef.setStatus(EndpointReference.RESOLVED_BINDING); + endpointRef.setStatus(EndpointReference.Status.RESOLVED_BINDING); } - endpointRef.setRemote(true); reference.getEndpointReferences().add(endpointRef); continue; } // end if @@ -551,15 +548,14 @@ public class WireBuilderImpl { targetComponentService, targetBinding, true)); - endpointRef.setStatus(EndpointReference.WIRED_TARGET_NOT_FOUND); + endpointRef.setStatus(EndpointReference.Status.WIRED_TARGET_NOT_FOUND); // relying on the registry here to resolve the real endpoint reference.getEndpointReferences().add(endpointRef); } else { EndpointReference endpointRef = createEndpointRef(component, reference, true); endpointRef.setTargetEndpoint(createEndpoint(component, targetName)); - endpointRef.setRemote(true); - endpointRef.setStatus(EndpointReference.WIRED_TARGET_NOT_FOUND); + endpointRef.setStatus(EndpointReference.Status.WIRED_TARGET_NOT_FOUND); reference.getEndpointReferences().add(endpointRef); Monitor.warning(monitor, this, @@ -576,7 +572,7 @@ public class WireBuilderImpl { createEndpointRef(component, reference, binding, null, false); endpointRef .setTargetEndpoint(createEndpoint(targetComponent, targetComponentService, true)); - endpointRef.setStatus(EndpointReference.WIRED_TARGET_FOUND_READY_FOR_MATCHING); + endpointRef.setStatus(EndpointReference.Status.WIRED_TARGET_FOUND_READY_FOR_MATCHING); reference.getEndpointReferences().add(endpointRef); } } else { @@ -596,8 +592,7 @@ public class WireBuilderImpl { Endpoint endpoint = createEndpoint(false); endpoint.setBinding(binding); endpointRef.setTargetEndpoint(endpoint); - endpointRef.setRemote(true); - endpointRef.setStatus(EndpointReference.RESOLVED_BINDING); + endpointRef.setStatus(EndpointReference.Status.RESOLVED_BINDING); reference.getEndpointReferences().add(endpointRef); } // end if } diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointSerializerImpl.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointSerializerImpl.java index 3cc6b61782..4e5275058e 100644 --- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointSerializerImpl.java +++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointSerializerImpl.java @@ -84,7 +84,6 @@ public class EndpointSerializerImpl implements EndpointSerializer { try { XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(xml)); EndpointReference result = refProcessor.read(reader, new ProcessorContext(registry)); - result.setRemote(true); reader.close(); return result; } catch (Exception e) { diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java index ff290ee150..156d73c82e 100644 --- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java +++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/RuntimeEndpointReferenceImpl.java @@ -130,7 +130,6 @@ public class RuntimeEndpointReferenceImpl extends EndpointReferenceImpl implemen this.policySets = copy.policySets; this.uri = copy.uri; - this.remote = copy.remote; this.unresolved = copy.unresolved; this.status = copy.status; @@ -350,8 +349,8 @@ public class RuntimeEndpointReferenceImpl extends EndpointReferenceImpl implemen // source interface contract for local wires this.chains = null; - if (getStatus() == EndpointReference.WIRED_TARGET_FOUND_AND_MATCHED){ - setStatus(EndpointReference.NOT_CONFIGURED); + if (getStatus() == EndpointReference.Status.WIRED_TARGET_FOUND_AND_MATCHED){ + setStatus(EndpointReference.Status.NOT_CONFIGURED); } // TODO - cheating here as I fixed the RuntimeComponentService code diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ComponentContextImpl.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ComponentContextImpl.java index c968599d36..fc2c6bbdfb 100644 --- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ComponentContextImpl.java +++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/ComponentContextImpl.java @@ -383,7 +383,7 @@ public class ComponentContextImpl implements RuntimeComponentContext { endpointReference.setReference(componentReference); endpointReference.setBinding(endpoint.getBinding()); endpointReference.setUnresolved(false); - endpointReference.setStatus(EndpointReference.WIRED_TARGET_FOUND_READY_FOR_MATCHING); + endpointReference.setStatus(EndpointReference.Status.WIRED_TARGET_FOUND_READY_FOR_MATCHING); endpointReference.setTargetEndpoint(endpoint); diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java index d50554a777..dc007c6a07 100644 --- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java +++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java @@ -42,7 +42,6 @@ import org.apache.tuscany.sca.core.UtilityExtensionPoint; import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper; import org.apache.tuscany.sca.monitor.Monitor; import org.apache.tuscany.sca.monitor.MonitorFactory; -import org.apache.tuscany.sca.monitor.Problem; import org.apache.tuscany.sca.policy.Intent; import org.apache.tuscany.sca.policy.PolicySet; import org.apache.tuscany.sca.runtime.EndpointReferenceBinder; @@ -124,7 +123,7 @@ public class EndpointReferenceBinderImpl implements EndpointReferenceBinder { // This logic does post build autowire matching but isn't actually used at the moment // as problems with dependencies mean we still do this during build - if (endpointReference.getStatus() == EndpointReference.AUTOWIRE_PLACEHOLDER){ + if (endpointReference.getStatus() == EndpointReference.Status.AUTOWIRE_PLACEHOLDER){ // do autowire matching // will only be called at build time at the moment @@ -167,7 +166,7 @@ public class EndpointReferenceBinderImpl implements EndpointReferenceBinder { autowireEndpointRefrence.setTargetEndpoint(endpoint); autowireEndpointRefrence.setBinding(endpoint.getBinding()); - autowireEndpointRefrence.setStatus(EndpointReference.WIRED_TARGET_FOUND_AND_MATCHED); + autowireEndpointRefrence.setStatus(EndpointReference.Status.WIRED_TARGET_FOUND_AND_MATCHED); endpointReference.getReference().getEndpointReferences().add(autowireEndpointRefrence); } } @@ -187,8 +186,8 @@ public class EndpointReferenceBinderImpl implements EndpointReferenceBinder { setSingleAutoWireTarget(endpointReference.getReference()); - } else if ( endpointReference.getStatus() == EndpointReference.WIRED_TARGET_FOUND_AND_MATCHED|| - endpointReference.getStatus() == EndpointReference.RESOLVED_BINDING ) { + } else if ( endpointReference.getStatus() == EndpointReference.Status.WIRED_TARGET_FOUND_AND_MATCHED|| + endpointReference.getStatus() == EndpointReference.Status.RESOLVED_BINDING ) { // The endpoint reference is already resolved to either // a service endpoint local to this composite or it has // a remote binding @@ -201,7 +200,7 @@ public class EndpointReferenceBinderImpl implements EndpointReferenceBinder { endpointReference.getReference().getCallbackService().getEndpoints(), matchAudit); } - } else if (endpointReference.getStatus() == EndpointReference.WIRED_TARGET_FOUND_READY_FOR_MATCHING ){ + } else if (endpointReference.getStatus() == EndpointReference.Status.WIRED_TARGET_FOUND_READY_FOR_MATCHING ){ // The endpoint reference is already resolved to either // a service endpoint but no binding was specified in the // target URL and/or the policies have yet to be matched. @@ -216,9 +215,9 @@ public class EndpointReferenceBinderImpl implements EndpointReferenceBinder { endpointReference.getReference().getCallbackService().getEndpoints(), matchAudit); } - } else if (endpointReference.getStatus() == EndpointReference.WIRED_TARGET_IN_BINDING_URI || - endpointReference.getStatus() == EndpointReference.WIRED_TARGET_NOT_FOUND || - endpointReference.getStatus() == EndpointReference.NOT_CONFIGURED){ + } else if (endpointReference.getStatus() == EndpointReference.Status.WIRED_TARGET_IN_BINDING_URI || + endpointReference.getStatus() == EndpointReference.Status.WIRED_TARGET_NOT_FOUND || + endpointReference.getStatus() == EndpointReference.Status.NOT_CONFIGURED){ // The reference is not yet matched to a service // find the service in the endpoint registry @@ -231,10 +230,9 @@ public class EndpointReferenceBinderImpl implements EndpointReferenceBinder { // in the builder that pulls the URI out of the binding if there are no targets // on the reference. have to wait until here to see if the binding uri matches any // available services. If not we assume here that it's a resolved binding - if (endpointReference.getStatus() == EndpointReference.WIRED_TARGET_IN_BINDING_URI){ + if (endpointReference.getStatus() == EndpointReference.Status.WIRED_TARGET_IN_BINDING_URI){ endpointReference.getTargetEndpoint().setBinding(endpointReference.getBinding()); - endpointReference.setRemote(true); - endpointReference.setStatus(EndpointReference.RESOLVED_BINDING); + endpointReference.setStatus(EndpointReference.Status.RESOLVED_BINDING); } else { Monitor.error(monitor, this, @@ -258,8 +256,8 @@ public class EndpointReferenceBinderImpl implements EndpointReferenceBinder { logger.fine(matchAudit.toString()); - if (endpointReference.getStatus() != EndpointReference.WIRED_TARGET_FOUND_AND_MATCHED && - endpointReference.getStatus() != EndpointReference.RESOLVED_BINDING){ + if (endpointReference.getStatus() != EndpointReference.Status.WIRED_TARGET_FOUND_AND_MATCHED && + endpointReference.getStatus() != EndpointReference.Status.RESOLVED_BINDING){ if (runtime){ Monitor.error(monitor, @@ -324,7 +322,7 @@ public class EndpointReferenceBinderImpl implements EndpointReferenceBinder { } else { endpointReference.setTargetEndpoint(matchedEndpoint); endpointReference.setBinding(endpointReference.getTargetEndpoint().getBinding()); - endpointReference.setStatus(EndpointReference.WIRED_TARGET_FOUND_AND_MATCHED); + endpointReference.setStatus(EndpointReference.Status.WIRED_TARGET_FOUND_AND_MATCHED); endpointReference.setUnresolved(false); } } @@ -617,7 +615,7 @@ public class EndpointReferenceBinderImpl implements EndpointReferenceBinder { Endpoint te = endpointReference.getTargetEndpoint(); if (te != null && !te.isUnresolved() && te.getURI() != null - && endpointReference.getStatus() != EndpointReference.RESOLVED_BINDING) { + && endpointReference.getStatus() != EndpointReference.Status.RESOLVED_BINDING) { List<Endpoint> endpoints = endpointRegistry.findEndpoint(endpointReference); return ! endpoints.contains(endpointReference.getTargetEndpoint()); } diff --git a/sca-java-2.x/trunk/modules/endpoint-dht/src/main/java/org/apache/tuscany/sca/endpoint/dht/OverlayEndpointRegistry.java b/sca-java-2.x/trunk/modules/endpoint-dht/src/main/java/org/apache/tuscany/sca/endpoint/dht/OverlayEndpointRegistry.java index 8bf237c993..a7b36987ae 100644 --- a/sca-java-2.x/trunk/modules/endpoint-dht/src/main/java/org/apache/tuscany/sca/endpoint/dht/OverlayEndpointRegistry.java +++ b/sca-java-2.x/trunk/modules/endpoint-dht/src/main/java/org/apache/tuscany/sca/endpoint/dht/OverlayEndpointRegistry.java @@ -198,10 +198,6 @@ public class OverlayEndpointRegistry implements EndpointRegistry, LifeCycleListe Endpoint endpoint = v.getValue(); if (matches(targetEndpoint.getURI(), endpoint.getURI())) { - if (!isLocal(endpoint)) { - endpoint.setRemote(true); - } - if(endpoint instanceof RuntimeEndpoint) { ((RuntimeEndpoint) endpoint).bind(registry, this); } diff --git a/sca-java-2.x/trunk/modules/endpoint-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/HazelcastEndpointRegistry.java b/sca-java-2.x/trunk/modules/endpoint-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/HazelcastEndpointRegistry.java index 88a45bbf4c..c91189fb44 100644 --- a/sca-java-2.x/trunk/modules/endpoint-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/HazelcastEndpointRegistry.java +++ b/sca-java-2.x/trunk/modules/endpoint-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/HazelcastEndpointRegistry.java @@ -30,12 +30,11 @@ import org.apache.tuscany.sca.assembly.Endpoint; import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.LifeCycleListener;
import org.apache.tuscany.sca.runtime.BaseEndpointRegistry;
+import org.apache.tuscany.sca.runtime.DomainRegistryURI;
import org.apache.tuscany.sca.runtime.EndpointRegistry;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
-import org.apache.tuscany.sca.runtime.DomainRegistryURI;
import com.hazelcast.config.Config;
-import com.hazelcast.config.MapConfig;
import com.hazelcast.config.NearCacheConfig;
import com.hazelcast.config.TcpIpConfig;
import com.hazelcast.config.XmlConfigBuilder;
@@ -149,7 +148,6 @@ public class HazelcastEndpointRegistry extends BaseEndpointRegistry implements E logger.fine("Matching against - " + endpoint);
if (matches(uri, endpoint.getURI())) {
if (!isLocal(endpoint)) {
- endpoint.setRemote(true);
((RuntimeEndpoint)endpoint).bind(registry, this);
} else {
// get the local version of the endpoint
@@ -206,7 +204,6 @@ public class HazelcastEndpointRegistry extends BaseEndpointRegistry implements E Endpoint newEp = (Endpoint)value;
if (!isLocal(newEp)) {
logger.info(" Remote endpoint added: " + newEp);
- newEp.setRemote(true);
}
endpointAdded(newEp);
}
diff --git a/sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.java b/sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.java index e581fa22d1..a3d33f8235 100644 --- a/sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.java +++ b/sca-java-2.x/trunk/modules/endpoint-tribes/src/main/java/org/apache/tuscany/sca/endpoint/tribes/ReplicatedEndpointRegistry.java @@ -49,9 +49,9 @@ import org.apache.tuscany.sca.core.LifeCycleListener; import org.apache.tuscany.sca.endpoint.tribes.AbstractReplicatedMap.MapEntry; import org.apache.tuscany.sca.endpoint.tribes.MapStore.MapListener; import org.apache.tuscany.sca.runtime.BaseEndpointRegistry; +import org.apache.tuscany.sca.runtime.DomainRegistryURI; import org.apache.tuscany.sca.runtime.EndpointRegistry; import org.apache.tuscany.sca.runtime.RuntimeEndpoint; -import org.apache.tuscany.sca.runtime.DomainRegistryURI; /** * A replicated EndpointRegistry based on Apache Tomcat Tribes @@ -298,9 +298,6 @@ public class ReplicatedEndpointRegistry extends BaseEndpointRegistry implements logger.fine("Matching against - " + endpoint); if (matches(uri, endpoint.getURI())) { MapEntry entry = map.getInternal(endpoint.getURI()); - if (!isLocal(entry)) { - endpoint.setRemote(true); - } // if (!entry.isPrimary()) { ((RuntimeEndpoint)endpoint).bind(registry, this); // } @@ -362,7 +359,6 @@ public class ReplicatedEndpointRegistry extends BaseEndpointRegistry implements Endpoint newEp = (Endpoint)entry.getValue(); if (!isLocal(entry)) { logger.info(id + " Remote endpoint added: " + entry.getValue()); - newEp.setRemote(true); } endpointAdded(newEp); } diff --git a/sca-java-2.x/trunk/modules/sca-client-impl/src/main/java/org/apache/tuscany/sca/client/impl/SCAClientFactoryImpl.java b/sca-java-2.x/trunk/modules/sca-client-impl/src/main/java/org/apache/tuscany/sca/client/impl/SCAClientFactoryImpl.java index 8d6986b401..762c97bef9 100644 --- a/sca-java-2.x/trunk/modules/sca-client-impl/src/main/java/org/apache/tuscany/sca/client/impl/SCAClientFactoryImpl.java +++ b/sca-java-2.x/trunk/modules/sca-client-impl/src/main/java/org/apache/tuscany/sca/client/impl/SCAClientFactoryImpl.java @@ -42,10 +42,8 @@ import org.apache.tuscany.sca.interfacedef.InterfaceContract; import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException; import org.apache.tuscany.sca.interfacedef.java.JavaInterface; import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; -import org.apache.tuscany.sca.node.Node; import org.apache.tuscany.sca.node.NodeFactory; import org.apache.tuscany.sca.node.impl.NodeFactoryImpl; -import org.apache.tuscany.sca.node.impl.NodeImpl; import org.apache.tuscany.sca.runtime.DomainRegistryFactory; import org.apache.tuscany.sca.runtime.EndpointRegistry; import org.apache.tuscany.sca.runtime.ExtensibleDomainRegistryFactory; @@ -148,12 +146,9 @@ public class SCAClientFactoryImpl extends SCAClientFactory { endpointReference.setReference(componentReference); endpointReference.setBinding(endpoint.getBinding()); endpointReference.setUnresolved(false); - endpointReference.setStatus(EndpointReference.WIRED_TARGET_FOUND_AND_MATCHED); + endpointReference.setStatus(EndpointReference.Status.WIRED_TARGET_FOUND_AND_MATCHED); endpointReference.setTargetEndpoint(endpoint); - if (endpoint.isRemote()) { - endpointReference.setRemote(true); - } componentReference.getEndpointReferences().add(endpointReference); ((RuntimeComponentReference)componentReference).setComponent((RuntimeComponent)component); |