summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/assembly/src/main/java/org
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/assembly/src/main/java/org
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/assembly/src/main/java/org')
-rw-r--r--sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Endpoint.java8
-rw-r--r--sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EndpointReference.java39
-rw-r--r--sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointReferenceImpl.java47
3 files changed, 23 insertions, 71 deletions
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;
}
}