From bdd0a41aed7edf21ec2a65cfa17a86af2ef8c48a Mon Sep 17 00:00:00 2001 From: dims Date: Tue, 17 Jun 2008 00:23:01 +0000 Subject: Move Tuscany from Incubator to top level. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@668359 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/interfacedef/wsdl/DefaultWSDLFactory.java | 30 +++++++ .../sca/interfacedef/wsdl/WSDLDefinition.java | 78 +++++++++++++++++ .../tuscany/sca/interfacedef/wsdl/WSDLFactory.java | 56 ++++++++++++ .../sca/interfacedef/wsdl/WSDLInterface.java | 66 +++++++++++++++ .../interfacedef/wsdl/WSDLInterfaceContract.java | 43 ++++++++++ .../sca/interfacedef/wsdl/XSDefinition.java | 69 +++++++++++++++ .../interfacedef/wsdl/impl/WSDLDefinitionImpl.java | 99 ++++++++++++++++++++++ .../interfacedef/wsdl/impl/WSDLFactoryImpl.java | 50 +++++++++++ .../wsdl/impl/WSDLInterfaceContractImpl.java | 42 +++++++++ .../interfacedef/wsdl/impl/WSDLInterfaceImpl.java | 93 ++++++++++++++++++++ .../interfacedef/wsdl/impl/XSDefinitionImpl.java | 92 ++++++++++++++++++++ 11 files changed, 718 insertions(+) create mode 100644 branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/DefaultWSDLFactory.java create mode 100644 branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLDefinition.java create mode 100644 branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLFactory.java create mode 100644 branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLInterface.java create mode 100644 branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLInterfaceContract.java create mode 100644 branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/XSDefinition.java create mode 100644 branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLDefinitionImpl.java create mode 100644 branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLFactoryImpl.java create mode 100644 branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceContractImpl.java create mode 100644 branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceImpl.java create mode 100644 branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/XSDefinitionImpl.java (limited to 'branches/sca-java-0.90/modules/interface-wsdl/src') diff --git a/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/DefaultWSDLFactory.java b/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/DefaultWSDLFactory.java new file mode 100644 index 0000000000..8f75de59e2 --- /dev/null +++ b/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/DefaultWSDLFactory.java @@ -0,0 +1,30 @@ +/* + * 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.sca.interfacedef.wsdl; + +import org.apache.tuscany.sca.interfacedef.wsdl.impl.WSDLFactoryImpl; + +/** + * A factory for the WSDL model. + * + * @version $Rev$ $Date$ + */ +public class DefaultWSDLFactory extends WSDLFactoryImpl implements WSDLFactory { + +} diff --git a/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLDefinition.java b/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLDefinition.java new file mode 100644 index 0000000000..2cbc04bd54 --- /dev/null +++ b/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLDefinition.java @@ -0,0 +1,78 @@ +/* + * 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.sca.interfacedef.wsdl; + +import javax.wsdl.Definition; + +import org.apache.ws.commons.schema.XmlSchemaCollection; + +/** + * 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 a list of XML schemas inlined in this WSDL definition. + * @return + */ + XmlSchemaCollection getInlinedSchemas(); + + /** + * 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); + +} diff --git a/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLFactory.java b/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLFactory.java new file mode 100644 index 0000000000..dfaf06b0be --- /dev/null +++ b/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLFactory.java @@ -0,0 +1,56 @@ +/* + * 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.sca.interfacedef.wsdl; + +/** + * Factory for the WSDL model. + * + * @version $Rev$ $Date$ + */ +public interface WSDLFactory { + + /** + * Creates a new WSDL interface. + * + * @return a new WSDL interface + */ + WSDLInterface createWSDLInterface(); + + /** + * Creates a new WSDL definition. + * + * @return a new WSDL definition + */ + WSDLDefinition createWSDLDefinition(); + + /** + * Creates a new XML Schema definition. + * + * @return a new XML Schema definition + */ + XSDefinition createXSDefinition(); + + /** + * Creates a new WSDL interface contract. + * + * @return + */ + WSDLInterfaceContract createWSDLInterfaceContract(); + +} diff --git a/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLInterface.java b/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLInterface.java new file mode 100644 index 0000000000..92bebed7de --- /dev/null +++ b/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLInterface.java @@ -0,0 +1,66 @@ +/* + * 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.sca.interfacedef.wsdl; + +import javax.wsdl.PortType; +import javax.xml.namespace.QName; + +import org.apache.tuscany.sca.interfacedef.Interface; + + +/** + * Represents a WSDL interface. + * + * @version $Rev$ $Date$ + */ +public interface WSDLInterface extends Interface { + + /** + * Returns the name of the WSDL interface. + * + * @return the name of the WSDL interface + */ + QName getName(); + + /** + * Sets the name of the WSDL interface. + * + * @param className the name of the WSDL interface + */ + void setName(QName interfaceName); + + /** + * Returns the WSDL interface portType. + * + * @return the WSDL interface portType + */ + PortType getPortType(); + + /** + * Sets the WSDL interface portType + * + * @param portType the WSDL interface portType + */ + void setPortType(PortType portType); + + public WSDLDefinition getWsdlDefinition(); + + public void setWsdlDefinition(WSDLDefinition wsdlDefinition); + +} diff --git a/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLInterfaceContract.java b/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLInterfaceContract.java new file mode 100644 index 0000000000..59db17116b --- /dev/null +++ b/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLInterfaceContract.java @@ -0,0 +1,43 @@ +/* + * 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.sca.interfacedef.wsdl; + +import org.apache.tuscany.sca.interfacedef.InterfaceContract; + + +/** + * Represents a WSDL interface contract. + * + * @version $Rev$ $Date$ + */ +public interface WSDLInterfaceContract extends InterfaceContract { + + /** + * Sets the WSDL location. + * @param location the WSDL location + */ + void setLocation(String location); + + /** + * Returns the WSDL location + * @return the WSDL location + */ + String getLocation(); + +} diff --git a/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/XSDefinition.java b/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/XSDefinition.java new file mode 100644 index 0000000000..99bd23de25 --- /dev/null +++ b/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/XSDefinition.java @@ -0,0 +1,69 @@ +/* + * 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.sca.interfacedef.wsdl; + +import org.apache.ws.commons.schema.XmlSchema; + +/** + * Represents an XML Schema definition. + * + * @version $Rev$ $Date$ + */ +public interface XSDefinition { + + /** + * Returns the XmlSchema definition model + * @return the XmlSchema definition model + */ + XmlSchema getSchema(); + + /** + * Sets the XmlSchema definition model + * @param definition the XmlSchema definition model + */ + void setSchema(XmlSchema definition); + + /** + * Returns the namespace of this XmlSchema definition. + * @return the namespace of this XmlSchema definition + */ + String getNamespace(); + + /** + * Sets the namespace of this XmlSchema definition. + * @param namespace the namespace of this XmlSchema 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); + +} diff --git a/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLDefinitionImpl.java b/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLDefinitionImpl.java new file mode 100644 index 0000000000..d5d61d2bf1 --- /dev/null +++ b/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLDefinitionImpl.java @@ -0,0 +1,99 @@ +/* + * 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.sca.interfacedef.wsdl.impl; + +import javax.wsdl.Definition; + +import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition; +import org.apache.ws.commons.schema.XmlSchemaCollection; + +/** + * Represents a WSDL definition. + * + * @version $Rev$ $Date$ + */ +public class WSDLDefinitionImpl implements WSDLDefinition { + + private Definition definition; + private String namespace; + private XmlSchemaCollection inlineSchemas = new XmlSchemaCollection(); + private boolean unresolved; + + protected WSDLDefinitionImpl() { + } + + public Definition getDefinition() { + return definition; + } + + public void setDefinition(Definition definition) { + this.definition = definition; + } + + public XmlSchemaCollection getInlinedSchemas() { + return inlineSchemas; + } + + 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) { + if (getNamespace() != null) { + return getNamespace().equals(((WSDLDefinition)obj).getNamespace()); + } else { + return ((WSDLDefinition)obj).getNamespace() == null; + } + } else { + return false; + } + } +} diff --git a/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLFactoryImpl.java b/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLFactoryImpl.java new file mode 100644 index 0000000000..4639d2187e --- /dev/null +++ b/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLFactoryImpl.java @@ -0,0 +1,50 @@ +/* + * 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.sca.interfacedef.wsdl.impl; + +import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition; +import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory; +import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface; +import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract; +import org.apache.tuscany.sca.interfacedef.wsdl.XSDefinition; + +/** + * A factory for the WSDL model. + * + * @version $Rev$ $Date$ + */ +public abstract class WSDLFactoryImpl implements WSDLFactory { + + public WSDLInterface createWSDLInterface() { + return new WSDLInterfaceImpl(); + } + + public WSDLDefinition createWSDLDefinition() { + return new WSDLDefinitionImpl(); + } + + public WSDLInterfaceContract createWSDLInterfaceContract() { + return new WSDLInterfaceContractImpl(); + } + + public XSDefinition createXSDefinition() { + return new XSDefinitionImpl(); + } + +} diff --git a/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceContractImpl.java b/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceContractImpl.java new file mode 100644 index 0000000000..a34cbe35b1 --- /dev/null +++ b/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceContractImpl.java @@ -0,0 +1,42 @@ +/* + * 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.sca.interfacedef.wsdl.impl; + +import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractImpl; +import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract; + +/** + * Represents a WSDL interface contract. + * + * @version $Rev$ $Date$ + */ +public class WSDLInterfaceContractImpl extends InterfaceContractImpl implements WSDLInterfaceContract { + private String location; + + protected WSDLInterfaceContractImpl() { + } + + public String getLocation() { + return location; + } + + public void setLocation(String location) { + this.location = location; + } +} diff --git a/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceImpl.java b/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceImpl.java new file mode 100644 index 0000000000..31286147aa --- /dev/null +++ b/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceImpl.java @@ -0,0 +1,93 @@ +/* + * 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.sca.interfacedef.wsdl.impl; + +import javax.wsdl.PortType; +import javax.xml.namespace.QName; + +import org.apache.tuscany.sca.interfacedef.impl.InterfaceImpl; +import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition; +import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface; + +/** + * Represents a WSDL interface. + * + * @version $Rev$ $Date$ + */ +public class WSDLInterfaceImpl extends InterfaceImpl implements WSDLInterface { + + private QName name; + private PortType portType; + private WSDLDefinition wsdlDefinition; + + protected WSDLInterfaceImpl() { + setRemotable(true); + } + + public QName getName() { + if (isUnresolved()) { + return name; + } else { + return portType.getQName(); + } + } + + public void setName(QName interfaceName) { + if (!isUnresolved()) { + throw new IllegalStateException(); + } + this.name = interfaceName; + } + + public PortType getPortType() { + return portType; + } + + public void setPortType(PortType portType) { + this.portType = portType; + } + + @Override + public int hashCode() { + return String.valueOf(getName()).hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (obj == this) { + return true; + } else if (obj instanceof WSDLInterface) { + if (getName() != null) { + return getName().equals(((WSDLInterface)obj).getName()); + } else { + return ((WSDLInterface)obj).getName() == null; + } + } else { + return false; + } + } + + public WSDLDefinition getWsdlDefinition() { + return wsdlDefinition; + } + + public void setWsdlDefinition(WSDLDefinition wsdlDefinition) { + this.wsdlDefinition = wsdlDefinition; + } +} diff --git a/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/XSDefinitionImpl.java b/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/XSDefinitionImpl.java new file mode 100644 index 0000000000..d4ed9538e7 --- /dev/null +++ b/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/XSDefinitionImpl.java @@ -0,0 +1,92 @@ +/* + * 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.sca.interfacedef.wsdl.impl; + +import org.apache.tuscany.sca.interfacedef.wsdl.XSDefinition; +import org.apache.ws.commons.schema.XmlSchema; + +/** + * Represents a XML schema definition. + * + * @version $Rev$ $Date$ + */ +public class XSDefinitionImpl implements XSDefinition { + + private XmlSchema definition; + private String namespace; + private boolean unresolved; + + protected XSDefinitionImpl() { + } + + public XmlSchema getSchema() { + return definition; + } + + public void setSchema(XmlSchema 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 XSDefinition) { + if (getNamespace() != null) { + return getNamespace().equals(((XSDefinition)obj).getNamespace()); + } else { + return ((XSDefinition)obj).getNamespace() == null; + } + } else { + return false; + } + } +} -- cgit v1.2.3