You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by js...@apache.org on 2007/04/09 19:11:27 UTC
svn commit: r526839 - in
/incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/interfacedef/wsdl:
WSDLDefinition.java WSDLFactory.java impl/DefaultWSDLFactory.java
impl/WSDLDefinitionImpl.java impl/WSDLInterfaceImpl.java
Author: jsdelfino
Date: Mon Apr 9 10:11:26 2007
New Revision: 526839
URL: http://svn.apache.org/viewvc?view=rev&rev=526839
Log:
Fixed implementations of hashCode and equals to use getter methods instead of the fields directly, as they may not represent the correct state of the model object. Also added a WSDLDefinition model to wrap WSDL definitions.
Added:
incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/interfacedef/wsdl/WSDLDefinition.java (with props)
incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/interfacedef/wsdl/impl/WSDLDefinitionImpl.java (with props)
Modified:
incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/interfacedef/wsdl/WSDLFactory.java
incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/interfacedef/wsdl/impl/DefaultWSDLFactory.java
incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/interfacedef/wsdl/impl/WSDLInterfaceImpl.java
Added: incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/interfacedef/wsdl/WSDLDefinition.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/interfacedef/wsdl/WSDLDefinition.java?view=auto&rev=526839
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/interfacedef/wsdl/WSDLDefinition.java (added)
+++ incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/interfacedef/wsdl/WSDLDefinition.java Mon Apr 9 10:11:26 2007
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.interfacedef.wsdl;
+
+import javax.wsdl.Definition;
+
+/**
+ * Represents a WSDL definition.
+ * WSDLDefinition
+ *
+ * @version $Rev$ $Date$
+ */
+public interface WSDLDefinition {
+
+ /**
+ * Returns the WSDL definition model
+ * @return the WSDL definition model
+ */
+ Definition getDefinition();
+
+ /**
+ * Sets the WSDL definition model
+ * @param definition the WSDL definition model
+ */
+ void setDefinition(Definition definition);
+
+ /**
+ * Returns the namespace of this WSDL definition.
+ * @return the namespace of this WSDL definition
+ */
+ String getNamespace();
+
+ /**
+ * Sets the namespace of this WSDL definition.
+ * @param namespace the namespace of this WSDL definition
+ */
+ void setNamespace(String namespace);
+
+ /**
+ * Returns true if the model element is unresolved.
+ *
+ * @return true if the model element is unresolved.
+ */
+ boolean isUnresolved();
+
+ /**
+ * Sets whether the model element is unresolved.
+ *
+ * @param unresolved whether the model element is unresolved
+ */
+ void setUnresolved(boolean unresolved);
+
+}
Propchange: incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/interfacedef/wsdl/WSDLDefinition.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/interfacedef/wsdl/WSDLDefinition.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/interfacedef/wsdl/WSDLFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/interfacedef/wsdl/WSDLFactory.java?view=diff&rev=526839&r1=526838&r2=526839
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/interfacedef/wsdl/WSDLFactory.java (original)
+++ incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/interfacedef/wsdl/WSDLFactory.java Mon Apr 9 10:11:26 2007
@@ -31,5 +31,12 @@
* @return a new WSDL interface
*/
WSDLInterface createWSDLInterface();
+
+ /**
+ * Creates a new WSDL definition.
+ *
+ * @return a new WSDL definition
+ */
+ WSDLDefinition createWSDLDefinition();
}
Modified: incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/interfacedef/wsdl/impl/DefaultWSDLFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/interfacedef/wsdl/impl/DefaultWSDLFactory.java?view=diff&rev=526839&r1=526838&r2=526839
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/interfacedef/wsdl/impl/DefaultWSDLFactory.java (original)
+++ incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/interfacedef/wsdl/impl/DefaultWSDLFactory.java Mon Apr 9 10:11:26 2007
@@ -18,6 +18,7 @@
*/
package org.apache.tuscany.interfacedef.wsdl.impl;
+import org.apache.tuscany.interfacedef.wsdl.WSDLDefinition;
import org.apache.tuscany.interfacedef.wsdl.WSDLFactory;
import org.apache.tuscany.interfacedef.wsdl.WSDLInterface;
@@ -30,6 +31,10 @@
public WSDLInterface createWSDLInterface() {
return new WSDLInterfaceImpl();
+ }
+
+ public WSDLDefinition createWSDLDefinition() {
+ return new WSDLDefinitionImpl();
}
}
Added: incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/interfacedef/wsdl/impl/WSDLDefinitionImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/interfacedef/wsdl/impl/WSDLDefinitionImpl.java?view=auto&rev=526839
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/interfacedef/wsdl/impl/WSDLDefinitionImpl.java (added)
+++ incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/interfacedef/wsdl/impl/WSDLDefinitionImpl.java Mon Apr 9 10:11:26 2007
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.interfacedef.wsdl.impl;
+
+import javax.wsdl.Definition;
+
+import org.apache.tuscany.interfacedef.wsdl.WSDLDefinition;
+
+/**
+ * Represents a WSDL definition.
+ *
+ * @version $Rev$ $Date$
+ */
+public class WSDLDefinitionImpl implements WSDLDefinition {
+
+ private Definition definition;
+ private String namespace;
+ private boolean unresolved;
+
+ public Definition getDefinition() {
+ return definition;
+ }
+
+ public void setDefinition(Definition definition) {
+ this.definition = definition;
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean undefined) {
+ this.unresolved = undefined;
+ }
+
+ public String getNamespace() {
+ if (isUnresolved()) {
+ return namespace;
+ } else if (definition != null) {
+ return definition.getTargetNamespace();
+ } else {
+ return null;
+ }
+ }
+
+ public void setNamespace(String namespace) {
+ if (!isUnresolved()) {
+ throw new IllegalStateException();
+ } else {
+ this.namespace = namespace;
+ }
+ }
+
+ @Override
+ public int hashCode() {
+ return String.valueOf(getNamespace()).hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this)
+ return true;
+ else if (obj instanceof WSDLDefinition && getNamespace().equals(((WSDLDefinition)obj).getNamespace()))
+ return true;
+ else
+ return false;
+ }
+}
Propchange: incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/interfacedef/wsdl/impl/WSDLDefinitionImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/interfacedef/wsdl/impl/WSDLDefinitionImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/interfacedef/wsdl/impl/WSDLInterfaceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/interfacedef/wsdl/impl/WSDLInterfaceImpl.java?view=diff&rev=526839&r1=526838&r2=526839
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/interfacedef/wsdl/impl/WSDLInterfaceImpl.java (original)
+++ incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/interfacedef/wsdl/impl/WSDLInterfaceImpl.java Mon Apr 9 10:11:26 2007
@@ -72,14 +72,14 @@
@Override
public int hashCode() {
- return String.valueOf(name).hashCode();
+ return String.valueOf(getName()).hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == this)
return true;
- else if (obj instanceof WSDLInterface && name.equals(((WSDLInterface)obj).getName()))
+ else if (obj instanceof WSDLInterface && getName().equals(((WSDLInterface)obj).getName()))
return true;
else
return false;
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org