summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2010-03-16 23:34:25 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2010-03-16 23:34:25 +0000
commit130df2a457cdd1452ebf54add49a350bb53ad188 (patch)
tree370c1b5d7a9d5003a997717944cc94a10f4fd3ee /sca-java-2.x/trunk/modules
parentd7f043799799120cf6be7b2c18cdb54b9d9df284 (diff)
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
Diffstat (limited to 'sca-java-2.x/trunk/modules')
-rw-r--r--sca-java-2.x/trunk/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptImplementation.java4
-rw-r--r--sca-java-2.x/trunk/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/impl/ScriptImplementationImpl.java47
-rw-r--r--sca-java-2.x/trunk/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/xml/ScriptImplementationProcessor.java2
3 files changed, 36 insertions, 17 deletions
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<Scri
*/
private void error(Monitor monitor, String message, Object model, Object... messageParameters) {
if (monitor != null) {
- Problem problem = monitor.createProblem(this.getClass().getName(), "impl-widget-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
+ Problem problem = monitor.createProblem(this.getClass().getName(), "impl-script-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
monitor.problem(problem);
}
}