summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/builder/src/main
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2010-02-26 18:23:06 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2010-02-26 18:23:06 +0000
commit3566e4b599bcc88382ad81433229b6f2cccdb899 (patch)
tree067b84f33391c785780b8ab30066651d8bec9e7b /sca-java-2.x/trunk/modules/builder/src/main
parentb4f0e720cda98d4bdaa351f4509d6486537a60f6 (diff)
Clean up the remote flag for endpoint and change the endpoint reference status to an enum
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@916778 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/builder/src/main')
-rw-r--r--sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/BindingURIBuilderImpl.java31
-rw-r--r--sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java16
-rw-r--r--sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/WireBuilderImpl.java27
3 files changed, 24 insertions, 50 deletions
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
}