From 130df2a457cdd1452ebf54add49a350bb53ad188 Mon Sep 17 00:00:00 2001 From: rfeng Date: Tue, 16 Mar 2010 23:34:25 +0000 Subject: Make sure the equals is overridden by ScriptImplementationImpl to avoid conflicts with ComponentTypeImpl git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@924051 13f79535-47bb-0310-9956-ffa450edef68 --- .../script/ScriptImplementation.java | 4 -- .../script/impl/ScriptImplementationImpl.java | 47 ++++++++++++++++------ .../script/xml/ScriptImplementationProcessor.java | 2 +- 3 files changed, 36 insertions(+), 17 deletions(-) (limited to 'sca-java-2.x/trunk/modules') diff --git a/sca-java-2.x/trunk/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptImplementation.java b/sca-java-2.x/trunk/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptImplementation.java index 543f852ef2..d34dde61eb 100644 --- a/sca-java-2.x/trunk/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptImplementation.java +++ b/sca-java-2.x/trunk/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptImplementation.java @@ -43,8 +43,4 @@ public interface ScriptImplementation extends Implementation { String getLanguage(); - String getURI(); - - void setURI(String uri); - } diff --git a/sca-java-2.x/trunk/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/impl/ScriptImplementationImpl.java b/sca-java-2.x/trunk/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/impl/ScriptImplementationImpl.java index 10821db972..a610e77147 100644 --- a/sca-java-2.x/trunk/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/impl/ScriptImplementationImpl.java +++ b/sca-java-2.x/trunk/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/impl/ScriptImplementationImpl.java @@ -32,20 +32,20 @@ import org.apache.tuscany.sca.implementation.script.ScriptImplementation; public class ScriptImplementationImpl extends ImplementationImpl implements ScriptImplementation { public static final QName TYPE = new QName(Base.SCA11_TUSCANY_NS, "implementation.script"); - private String uri; - private String language; - private String location; + private String script; // Relative URI to the script + private String language; // Scripting lang + private String location; // Resolved location of the script public ScriptImplementationImpl() { super(TYPE); } public String getScript() { - return uri; + return script; } - public void setScript(String uri) { - this.uri = uri; + public void setScript(String script) { + this.script = script; } public String getLocation() { @@ -64,16 +64,39 @@ public class ScriptImplementationImpl extends ImplementationImpl implements Scri return language; } - public String getURI() { - return uri; + @Override + public String toString() { + return "Script : " + getScript(); } - public void setURI(String uri) { - this.uri = uri; + @Override + public int hashCode() { + final int prime = 31; + int result = super.hashCode(); + result = prime * result + ((language == null) ? 0 : language.hashCode()); + result = prime * result + ((script == null) ? 0 : script.hashCode()); + return result; } @Override - public String toString() { - return "Script : " + getURI(); + public boolean equals(Object obj) { + if (this == obj) + return true; + if (!super.equals(obj)) + return false; + if (getClass() != obj.getClass()) + return false; + ScriptImplementationImpl other = (ScriptImplementationImpl)obj; + if (language == null) { + if (other.language != null) + return false; + } else if (!language.equals(other.language)) + return false; + if (script == null) { + if (other.script != null) + return false; + } else if (!script.equals(other.script)) + return false; + return true; } } diff --git a/sca-java-2.x/trunk/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/xml/ScriptImplementationProcessor.java b/sca-java-2.x/trunk/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/xml/ScriptImplementationProcessor.java index 18d3bfa4aa..273306894b 100644 --- a/sca-java-2.x/trunk/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/xml/ScriptImplementationProcessor.java +++ b/sca-java-2.x/trunk/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/xml/ScriptImplementationProcessor.java @@ -159,7 +159,7 @@ public class ScriptImplementationProcessor implements StAXArtifactProcessor