From 08adcf2e783e4733e0fd646d353db3592c62140d Mon Sep 17 00:00:00 2001 From: antelder Date: Thu, 16 Feb 2012 15:43:08 +0000 Subject: Delete old RC tags git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1245046 13f79535-47bb-0310-9956-ffa450edef68 --- .../tuscany/sca/interfacedef/Compatibility.java | 29 - .../apache/tuscany/sca/interfacedef/DataType.java | 120 ----- .../sca/interfacedef/FaultExceptionMapper.java | 63 --- .../IncompatibleInterfaceContractException.java | 69 --- .../apache/tuscany/sca/interfacedef/Interface.java | 116 ---- .../sca/interfacedef/InterfaceContract.java | 100 ---- .../sca/interfacedef/InterfaceContractMapper.java | 232 -------- .../interfacedef/InvalidAnnotationException.java | 40 -- .../sca/interfacedef/InvalidCallbackException.java | 35 -- .../interfacedef/InvalidInterfaceException.java | 43 -- .../interfacedef/InvalidOperationException.java | 43 -- .../apache/tuscany/sca/interfacedef/Operation.java | 229 -------- .../interfacedef/OverloadedOperationException.java | 46 -- .../tuscany/sca/interfacedef/ParameterMode.java | 28 - .../sca/interfacedef/impl/DataTypeImpl.java | 227 -------- .../interfacedef/impl/InterfaceContractImpl.java | 142 ----- .../impl/InterfaceContractMapperImpl.java | 586 --------------------- .../sca/interfacedef/impl/InterfaceImpl.java | 334 ------------ .../sca/interfacedef/impl/OperationImpl.java | 311 ----------- .../tuscany/sca/interfacedef/util/Audit.java | 45 -- .../tuscany/sca/interfacedef/util/ElementInfo.java | 115 ---- .../sca/interfacedef/util/FaultException.java | 83 --- .../sca/interfacedef/util/JavaXMLMapper.java | 144 ----- .../tuscany/sca/interfacedef/util/TypeInfo.java | 101 ---- .../tuscany/sca/interfacedef/util/WrapperInfo.java | 199 ------- .../tuscany/sca/interfacedef/util/XMLType.java | 153 ------ 26 files changed, 3633 deletions(-) delete mode 100644 sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/Compatibility.java delete mode 100644 sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/DataType.java delete mode 100644 sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/FaultExceptionMapper.java delete mode 100644 sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/IncompatibleInterfaceContractException.java delete mode 100644 sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/Interface.java delete mode 100644 sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContract.java delete mode 100644 sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContractMapper.java delete mode 100644 sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidAnnotationException.java delete mode 100644 sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidCallbackException.java delete mode 100644 sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidInterfaceException.java delete mode 100644 sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidOperationException.java delete mode 100644 sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/Operation.java delete mode 100644 sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/OverloadedOperationException.java delete mode 100644 sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/ParameterMode.java delete mode 100644 sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/DataTypeImpl.java delete mode 100644 sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractImpl.java delete mode 100644 sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java delete mode 100644 sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java delete mode 100644 sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/OperationImpl.java delete mode 100644 sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/util/Audit.java delete mode 100644 sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/util/ElementInfo.java delete mode 100644 sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/util/FaultException.java delete mode 100644 sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/util/JavaXMLMapper.java delete mode 100644 sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/util/TypeInfo.java delete mode 100644 sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/util/WrapperInfo.java delete mode 100644 sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/util/XMLType.java (limited to 'sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef') diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/Compatibility.java b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/Compatibility.java deleted file mode 100644 index e05a05476a..0000000000 --- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/Compatibility.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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; - -/** - * Types of compatibility - */ -public enum Compatibility { - SUPERSET, // The source is a superset of the target - SUBSET, // The source is a subset of the target - MUTUAL, // The source is the same set as the target - INCOMPATIBLE // The source is not compatible with the target -} \ No newline at end of file diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/DataType.java b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/DataType.java deleted file mode 100644 index 386275b41b..0000000000 --- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/DataType.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * 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; - -import java.lang.reflect.Type; - -/** - * Representation of the type of data associated with an operation. Data is - * represented in two forms: the physical form used by the runtime and a logical - * form used by the assembly. The physical form is a Java Type because the - * runtime is written in Java. This may be the same form used by the application - * but it may not; for example, an application that is performing stream - * processing may want a physical form such as an - * {@link java.io.InputStream InputStream} to semantically operate on application - * data such as a purchase order. The logical description is that used by the - * assembly model and is an identifier into some well-known type space; examples - * may be a Java type represented by its Class or an XML type represented by its - * QName. Every data type may also contain metadata describing the expected - * data; for example, it could specify a preferred data binding technology or - * the size of a typical instance. - * - * @version $Rev$ $Date$ - * @tuscany.spi.extension.asclient - */ -public interface DataType extends Cloneable { - /** - * Set the java type for the data - * @param cls - */ - void setPhysical(Class cls); - - /** - * Returns the physical type used by the runtime. - * - * @return the physical type used by the runtime - */ - Class getPhysical(); - - /** - * Get the java generic type - * @return The java generic type - */ - Type getGenericType(); - - /** - * Set the java generic type - * @param genericType - */ - void setGenericType(Type genericType); - - /** - * Returns the logical identifier used by the assembly. The type of this - * value identifies the logical type system in use. Known values are: - * - * - * @return the logical type name - */ - L getLogical(); - - /** - * Get the databinding for the given data type - * @return the databinding - */ - String getDataBinding(); - - /** - * Set the databinding for the given data type - * @param dataBinding the dataBinding to set - */ - void setDataBinding(String dataBinding); - - /** - * Clone a data type - * @return The cloned data type - * @throws CloneNotSupportedException - */ - Object clone() throws CloneNotSupportedException; - - /** - * Set the logical type of the data type - * @param logical the logical to set - */ - void setLogical(L logical); - - /** - * Get the databinding-specific metadata - * @param type The java type of the metadata - * @return the databinding-specific metadata - */ - T getMetaData(Class type); - /** - * Set the databinding-specific metadata - * @param type The java type of the metadata - * @param metaData the databinding-specific metadata, such as SDO's commonj.sdo.Type or - * JAXB's javax.xml.bind.JAXBContext - */ - void setMetaData(Class type, T metaData); -} diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/FaultExceptionMapper.java b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/FaultExceptionMapper.java deleted file mode 100644 index 4aa5f2780a..0000000000 --- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/FaultExceptionMapper.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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; - -/** - * This interface represents the mapping between WSDL faults and Java exceptions - * - * @version $Rev$ $Date$ - * @tuscany.spi.extension.inheritfrom - */ -@SuppressWarnings("unchecked") -public interface FaultExceptionMapper { - /** - * Introspect an exception class to find out the fault data type following the WSDL2Java - * mapping rules. The result will be populated into the logical type of the exception data - * type - * - * @param exceptionDataType The data type representing a java exception class - * @param operation TODO - * @param generatingFaultBean If JAXWS Section 3.7 Fault Bean will be generated - * @return true if the introspection can recognize the exception data type - */ - boolean introspectFaultDataType(DataType exceptionDataType, Operation operation, boolean generatingFaultBean); - - /** - * Create a java exception to wrap the fault data - * - * @param exceptionType The DataType for the exception - * @param message message for the exception - * @param faultInfo The fault data - * @param cause of the exception - * @param operation TODO - * @return An instance of java exception to represent the fault - */ - Throwable wrapFaultInfo(DataType exceptionType, String message, Object faultInfo, Throwable cause, Operation operation); - - /** - * Retrieve the fault info from a java exception - * - * @param exception The java exception that represents the fault data - * @param faultBeanClass - * @param operation TODO - * @return The fault data - */ - Object getFaultInfo(Throwable exception, Class faultBeanClass, Operation operation); -} diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/IncompatibleInterfaceContractException.java b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/IncompatibleInterfaceContractException.java deleted file mode 100644 index 179dc1755e..0000000000 --- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/IncompatibleInterfaceContractException.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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; - -/** - * Denotes incompatible service contracts for a wire - * - * @version $Rev$ $Date$ - */ -public class IncompatibleInterfaceContractException extends Exception { - private static final long serialVersionUID = 5127478601823295587L; - private final InterfaceContract source; - private final InterfaceContract target; - private final Operation sourceOperation; - private final Operation targetOperation; - - public IncompatibleInterfaceContractException(String message, InterfaceContract source, InterfaceContract target) { - super(message); - this.source = source; - this.target = target; - this.sourceOperation = null; - this.targetOperation = null; - } - - public IncompatibleInterfaceContractException(String message, - InterfaceContract source, - InterfaceContract target, - Operation sourceOperation, - Operation targetOperation) { - super(message); - this.source = source; - this.target = target; - this.sourceOperation = sourceOperation; - this.targetOperation = targetOperation; - } - - public InterfaceContract getTarget() { - return target; - } - - public InterfaceContract getSource() { - return source; - } - - public Operation getSourceOperation() { - return sourceOperation; - } - - public Operation getTargetOperation() { - return targetOperation; - } -} diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/Interface.java b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/Interface.java deleted file mode 100644 index e3103b768a..0000000000 --- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/Interface.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * 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; - -import java.util.List; -import java.util.Map; - -import org.apache.tuscany.sca.policy.PolicySubject; - -/** - * Represents a service interface. This interface will typically be extended to - * support concrete interface type systems, such as Java interfaces, WSDL 1.1 - * portTypes and WSDL 2.0 interfaces. - * - * @version $Rev$ $Date$ - * @tuscany.spi.extension.inheritfrom - */ -public interface Interface extends Cloneable, PolicySubject { - - /** - * Returns true if the interface is a remotable interface.. - * - * @return true if the interface is a remotable interface - */ - boolean isRemotable(); - - /** - * Sets whether the interface is a remotable or local interface. - * - * @param remotable indicates whether the interface is remotable or local - */ - void setRemotable(boolean remotable); - - /** - * Returns true if the interface remotable property is set.. - * - * This is used to verify if a @remotable attribute is used in the - * SCDL element. If true, use isRemotable to verify the - * current value - * - * @return - */ - boolean isRemotableSet(); - - /** - * Returns the operations defined on this interface. - * - * @return the operations defined on this interface - */ - List getOperations(); - - /** - * Set the databinding for the interface - * @param dataBinding - * @deprecated Please use resetDataBinding - */ - @Deprecated - void setDefaultDataBinding(String dataBinding); - - /** - * Reset the databinding for the interface - * @param dataBinding - */ - void resetDataBinding(String dataBinding); - - /** - * Set the interface input types by copying those from the - * interface provided - * - * @param newInterface - */ - public void resetInterfaceInputTypes(Interface newInterface); - - /** - * Set the interface output types by copying those from the - * interface provided - * - * @param newInterface - */ - public void resetInterfaceOutputTypes(Interface newInterface); - - /** - * Returns true if the Interface is dynamic. - * - * @return true if the Interface is dynamic. - */ - boolean isDynamic(); - - /** - * Get a map of attributes associated with the interface - * @return A map of attributes - */ - Map getAttributes(); - - /** - * Implementations must support cloning. - */ - Object clone() throws CloneNotSupportedException; - -} diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContract.java b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContract.java deleted file mode 100644 index 3eda9f37e5..0000000000 --- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContract.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * 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; - - -/** - * Interface contracts define one or more business functions. These business - * functions are provided by services and are used by references. - * - * @version $Rev$ $Date$ - * @tuscany.spi.extension.inheritfrom - */ -public interface InterfaceContract extends Cloneable { - - /** - * Returns the interface definition representing the interface for - * invocations from the requestor to the provider. - * - * @return the interface definition representing the interface for - * invocations from the requestor to the provider - */ - Interface getInterface(); - - /** - * Sets the interface definition representing the interface for invocations - * from the requestor to the provider. - * - * @param callInterface the interface definition representing the interface - * for invocations from the requestor to the provider - */ - void setInterface(Interface callInterface); - - /** - * Returns the interface definition representing the interface for - * invocations from the provider to the requestor. - * - * @return the interface definition representing the interface for - * invocations from the provider to the requestor. - */ - Interface getCallbackInterface(); - - /** - * Sets the interface definition representing the interface for invocations - * from the provider to the requestor. - * - * @param callbackInterface the interface definition representing the - * interface for invocations from the provider to the requestor. - */ - void setCallbackInterface(Interface callbackInterface); - - // FIXME: We need a better way to do this - /** - * Convert an interface contract to a unidirectional interface contract - * - * @param isCallback true for a callback interface contract, false for - * a forward interface contract - * @return A unidirectional interface contract, cloned if necessary - */ - InterfaceContract makeUnidirectional(boolean isCallback); - - /** - * Implementations must support cloning. - */ - Object clone() throws CloneNotSupportedException; - - /** - * For matching purposes the Java interface contract is - * turned into a WSDL contract in the cases where it needs to be matched - * against another WSDL contract - * - * @return WSDL interface contract - */ - InterfaceContract getNormalizedWSDLContract(); - - /** - * For matching purposes the Java interface contract is - * turned into a WSDL contract in the cases where it needs to be matched - * against another WSDL contract - * - * @param wsdlInterfaceContract - */ - void setNormailizedWSDLContract(InterfaceContract wsdlInterfaceContract); - -} diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContractMapper.java b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContractMapper.java deleted file mode 100644 index 94bce6d6b4..0000000000 --- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContractMapper.java +++ /dev/null @@ -1,232 +0,0 @@ -/* - * 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; - -import org.apache.tuscany.sca.interfacedef.util.Audit; - -/** - * The InterfaceContractMapper is responsible to match interfaces - * - * @version $Rev$ $Date$ - * @tuscany.spi.extension.asclient - */ -public interface InterfaceContractMapper { - /** - * @param source The source interface contract - * @param target The target interface contract - * @param compatibility The compatibility style - * @param ignoreCallback - * @param silent - * @return - * @throws IncompatibleInterfaceContractException - */ - boolean checkCompatibility(InterfaceContract source, - InterfaceContract target, - Compatibility compatibility, - boolean ignoreCallback, - boolean silent) throws IncompatibleInterfaceContractException; - - /** - * @param source The source interface contract - * @param target The target interface contract - * @param compatibility The compatibility style - * @param ignoreCallback - * @param silent - * @return - * @throws IncompatibleInterfaceContractException - * this interface is intended to incrementally replace the variant without the audit trail - * the presence of both interfaces implies a state of partial development - */ - boolean checkCompatibility(InterfaceContract source, - InterfaceContract target, - Compatibility compatibility, - boolean ignoreCallback, - boolean silent, - Audit audit) throws IncompatibleInterfaceContractException; - - /** - * Test if the source data type is compatible with the target data type. The - * compatibility is defined as follows. - *
    - *
  • source's logical type is either the same or subtype of the target's - * logical type - *
- * For example, if the source type is a SDO Customer and the target type is - * a JAXB Customer and both Customer are generated from the same XSD type. - * - * @param source The source data type - * @param target The target data type - * @param passByValue A flag to indicate how the compatibility is checked - *
    - *
  • true: Check the two types as compatible "by-value" (can be copied) - *
  • false: Check the two types as compatible "by-reference" (can be assigned) - *
- * @return true if the source data type is the same or subtype of the target data type - */ - boolean isCompatible(DataType source, DataType target, boolean passByValue); - - /** - * Check if source operation is compatible with the target operation. A source operation is - * compatible with the target operation means the following: - * - *
    - *
  1. compatibility for the two operations is defined as compatibility - * of the signature, i.e., the operation name, the input types, and the output types are the same - * - *
  2. the order of the input and output types of the source operation is the same as the order of - * the input and output types for the corresponding target operation - *
  3. the set of Faults and Exceptions expected by the source operation is the same as or is - * a SUPERSET of the set of Faults and Exceptions specified by the corresponding target operation - *
- * - * Simply speaking, any request from the source operation can be processed by the target operation and - * the normal response or fault/exception from the target operation can be handled by the source operation. - * - * Please note this compatibility check is NOT symmetric. But the following should be guaranteed: - *
    - *
  • (source, target, SUB) == (target, source, SUPER) - *
  • (source, target, MUTUAL) == (source, target, SUB) && (target, source, SUB) == (source, target, SUPER) && (source, target, SUPER) - * - * @param source The source operation - * @param target The target operation - * @param compatibilityType The type of compatibility - * @return true if the source operation is compatible with the target - * operation - */ - boolean isCompatible(Operation source, Operation target, Compatibility compatibilityType); - - boolean isCompatibleByReference(Operation source, Operation target, Compatibility compatibilityType); - boolean isCompatibleByValue(Operation source, Operation target, Compatibility compatibilityType); - - /** - * An interface A is a Compatible Subset of a second interface B if and only if all of points 1 through 6 - * in the following list apply: - *
      - *
    1. interfaces A and B are either both remotable or else both local - *
    2. the set of operations in interface A is the same as or is a subset of the set of operations in - * interface B - *
    3. compatibility for individual operations of the interfaces A and B is defined as compatibility - * of the signature, i.e., the operation name, the input types, and the output types are the same - *
    4. the order of the input and output types for each operation in interface A is the same as the - * order of the input and output types for the corresponding operation in interface B - *
    5. the set of Faults and Exceptions expected by each operation in interface A is the same as or is - * a superset of the set of Faults and Exceptions specified by the corresponding operation in interface B - *
    6. for checking the compatibility of 2 remotable interfaces which are in different interface - * languages, both are mapped to WSDL 1.1 (if not already WSDL 1.1) and compatibility checking is done - * between the WSDL 1.1 mapped interfaces.
      - * For checking the compatibility of 2 local interfaces which are in different interface languages, the - * method of checking compatibility is defined by the specifications which define those interface types, - * which must define mapping rules for the 2 interface types concerned. - * - *
    - * - * The callback interfaces are not considered her. - * - * @param source The source interface - * @param target The target interface - * @return true if the source interface is a compatible subset of the target interface - */ - boolean isCompatibleSubset(Interface source, Interface target); - - /** - * An interface A is a Compatible Subset of a second interface B if and only if all of points 1 through 7 - * in the following list apply: - *
      - *
    1. interfaces A and B are either both remotable or else both local - *
    2. the set of operations in interface A is the same as or is a subset of the set of operations in - * interface B - *
    3. compatibility for individual operations of the interfaces A and B is defined as compatibility - * of the signature, i.e., the operation name, the input types, and the output types are the same - *
    4. the order of the input and output types for each operation in interface A is the same as the - * order of the input and output types for the corresponding operation in interface B - *
    5. the set of Faults and Exceptions expected by each operation in interface A is the same as or is - * a superset of the set of Faults and Exceptions specified by the corresponding operation in interface B - *
    6. for checking the compatibility of 2 remotable interfaces which are in different interface - * languages, both are mapped to WSDL 1.1 (if not already WSDL 1.1) and compatibility checking is done - * between the WSDL 1.1 mapped interfaces.
      - * For checking the compatibility of 2 local interfaces which are in different interface languages, the - * method of checking compatibility is defined by the specifications which define those interface types, - * which must define mapping rules for the 2 interface types concerned. - *
    7. if either interface A or interface B declares a callback interface then both interface - * A and interface B declare callback interfaces and the callback interface declared on interface B is a - * compatible subset of the callback interface declared on interface A, according to points 1 through 6 - * above - *
    - * - * @param source The source interface contract - * @param target The target interface contract - * @return true if the source interface contract is a compatible subset of the target interface contract - */ - boolean isCompatibleSubset(InterfaceContract source, InterfaceContract target); - /* - * the variant of isCompatibleSubset with the audit parameter is intended to supersed the other - * -- the presence of both indicates a partial development state - */ - boolean isCompatibleSubset(InterfaceContract source, InterfaceContract target, Audit audit); - - /** - * Check that two interfaces are mutually compatible. The interfaces are mutually compatible if the two - * interfaces have the same set of operations, with each operation having the same signature (name, input - * types, output types and fault/exception types). - * - * @param source an interface - * @param target a second interface - * @return true if the two interfaces are mutually compatible, otherwise return false - */ - public boolean isMutuallyCompatible(Interface source, Interface target); - - /** - * An interface A is Compatible with a second interface B if and only if all of points 1 through 7 in the - * following list apply:

    - *

      - *
    1. interfaces A and B are either both remotable or else both local - *
    2. the set of operations in interface A is the same as the set of operations in interface B - *
    3. compatibility for individual operations of the interfaces A and B is defined as compatibility - * of the signature, i.e., the operation name, the input types, and the output types are the same - *
    4. the order of the input and output types for each operation in interface A is the same as the - * order of the input and output types for the corresponding operation in interface B - *
    5. the set of Faults and Exceptions expected by each operation in interface A is the - * same as the set of Faults and Exceptions specified by the corresponding operation in interface B - *
    6. for checking the compatibility of 2 remotable interfaces which are in different interface - * languages, both are mapped to WSDL 1.1 (if not already WSDL 1.1) and compatibility checking is done - * between the WSDL 1.1 mapped interfaces. - *
      For checking the compatibility of 2 local interfaces which are in different interface languages, - * the method of checking compatibility is defined by the specifications which define those interface types, - * which must define mapping rules for the 2 interface types concerned. - *
    7. if either interface A or interface B declares a callback interface then both interface - * A and interface B declare callback interfaces and the callback interface declared on interface A is - * compatible with the callback interface declared on interface B, according to points 1 through 6 above - * - * @param source - the source interface contract - * @param target - the target interface contract - * @return true if the source and target interface contracts are mutually compatible - */ - boolean isMutuallyCompatible(InterfaceContract source, InterfaceContract target); - - /** - * Map the source operation to a compatible operation in the target interface - * - * @param target The target interface - * @param source The source operation - * @return A compatible operation if the target interface is compatible superset of the source interface - */ - Operation map(Interface target, Operation source); - -} diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidAnnotationException.java b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidAnnotationException.java deleted file mode 100644 index db1d5f7fd7..0000000000 --- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidAnnotationException.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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; - -/** - * - * @tuscany.spi.extension.asclient - * - */ -public class InvalidAnnotationException extends InvalidInterfaceException { - - private static final long serialVersionUID = 4923028138353415223L; - private final Class clazz; - - public InvalidAnnotationException(String message, Class clazz) { - super(message); - this.clazz = clazz; - } - - public Class getAnnotation() { - return clazz; - } -} diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidCallbackException.java b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidCallbackException.java deleted file mode 100644 index 392e81a8fa..0000000000 --- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidCallbackException.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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; - - -/** - * Denotes an illegal callback interface - * - * @version $Rev$ $Date$ - * @tuscany.spi.extension.asclient - */ - -public class InvalidCallbackException extends InvalidInterfaceException { - private static final long serialVersionUID = 2727755895702116397L; - - public InvalidCallbackException(String message) { - super(message); - } -} diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidInterfaceException.java b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidInterfaceException.java deleted file mode 100644 index 0cac606e1a..0000000000 --- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidInterfaceException.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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; - -/** - * @version $Rev$ $Date$ - * @tuscany.spi.extension.inheritfrom - */ -public abstract class InvalidInterfaceException extends Exception { - private static final long serialVersionUID = -3850574026273544538L; - - public InvalidInterfaceException() { - super(); - } - - public InvalidInterfaceException(String message) { - super(message); - } - - public InvalidInterfaceException(String message, Throwable cause) { - super(message, cause); - } - - public InvalidInterfaceException(Throwable cause) { - super(cause); - } -} diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidOperationException.java b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidOperationException.java deleted file mode 100644 index 2e82c201d9..0000000000 --- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidOperationException.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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; - -import java.lang.reflect.Method; - -/** - * Denotes an invalid conversational interface definition - * - * @version $Rev$ $Date$ - * @tuscany.spi.extension.asclient - */ -public class InvalidOperationException extends InvalidInterfaceException { - - private static final long serialVersionUID = -1797615361821517091L; - private final Method operation; - - public InvalidOperationException(String message, Method operation) { - super(message); - this.operation = operation; - } - - public Method getOperation() { - return operation; - } - -} diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/Operation.java b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/Operation.java deleted file mode 100644 index c3a7ca972a..0000000000 --- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/Operation.java +++ /dev/null @@ -1,229 +0,0 @@ -/* - * 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; - -import java.util.List; -import java.util.Map; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.sca.interfacedef.util.WrapperInfo; -import org.apache.tuscany.sca.interfacedef.util.XMLType; -import org.apache.tuscany.sca.policy.PolicySubject; - -/** - * Represents an operation on a service interface. - * - * @version $Rev$ $Date$ - * @tuscany.spi.extension.inheritfrom - */ -public interface Operation extends Cloneable, PolicySubject { - /** - * Returns the name of the operation. - * - * @return the name of the operation - */ - String getName(); - - /** - * Sets the name of the operation. - * - * @param name the name of the operation - */ - void setName(String name); - - /** - * 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); - - /** - * Get the data type that represents the input of this operation. The logic - * type is a list of data types and each element represents a parameter - * - * @return the inputType - */ - DataType> getInputType(); - - /** - * @param inputType - */ - void setInputType(DataType> inputType); - - /** - * Get the data type for the output - * - * @return the outputType - */ - DataType> getOutputType(); - /** - * @param outputType - */ - void setOutputType(DataType> outputType); - - /** - * Get a list of data types to represent the faults/exceptions - * - * @return the faultTypes - */ - List getFaultTypes(); - - /** - * @param faultTypes - */ - void setFaultTypes(List faultTypes); - - /** - * Get the owning interface - * @return - */ - Interface getInterface(); - - /** - * Set the owning interface - * @param interfaze - */ - void setInterface(Interface interfaze); - - /** - * Indicate if the operation is non-blocking - * @return - */ - boolean isNonBlocking(); - - /** - * Indicate if the operation is an async server operation - * @return - true if the operation is an async server operation - */ - boolean isAsyncServer(); - - /** - * Set the operation to be non-blocking - */ - void setNonBlocking(boolean nonBlocking); - - /** - * @return the wrapperInfo - */ - WrapperInfo getWrapper(); - - /** - * @param wrapperInfo the wrapperInfo to set - */ - void setWrapper(WrapperInfo wrapperInfo); - - /** - * @return the wrapperStyle - */ - boolean isWrapperStyle(); - - /** - * @param wrapperStyle the wrapperStyle to set - */ - void setWrapperStyle(boolean wrapperStyle); - - /** - * @deprecated This should be the WrapperInfo.getDataBinding() - * Get the databinding for the operation - * @return - */ - @Deprecated - String getDataBinding(); - - /** - * @deprecated This should be the WrapperInfo.setDataBinding() - * Set the databinding for the operation - * @param dataBinding - */ - @Deprecated - void setDataBinding(String dataBinding); - - /** - * Returns true if the operation is dynamic. - * - * @return true if the operation is dynamic otherwise false - */ - boolean isDynamic(); - - /** - * Set if the operation is dynamic - * @param b - */ - void setDynamic(boolean b); - - /** - * Get the synthesized fault beans for this operation - * - * @return the fault beans - */ - Map>> getFaultBeans(); - - /** - * Set the synthesized fault beans for this operation - * @param faultBeans - */ - void setFaultBeans(Map>> faultBeans); - - /** - * Get a map of attributes assoicated with the operation - * @return A map of attributes - */ - Map getAttributes(); - - /** - * Implementations must support cloning. - */ - Object clone() throws CloneNotSupportedException; - - /** - * Returns the ParameterModes - * @return - */ - List getParameterModes(); - - /** - * Returns true - * @return - */ - public boolean hasArrayWrappedOutput(); - - public void setHasArrayWrappedOutput(boolean value); - - /** - * A special databinding for input message of an operation - */ - String IDL_INPUT = "idl:input"; - /** - * A special databinding for output message of an operation - */ - String IDL_OUTPUT = "idl:output"; - /** - * A special databinding for fault message of an operation - */ - String IDL_FAULT = "idl:fault"; -} diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/OverloadedOperationException.java b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/OverloadedOperationException.java deleted file mode 100644 index 92ac0850e7..0000000000 --- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/OverloadedOperationException.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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; - -import java.lang.reflect.Method; - -/** - * Exception thrown to indicate that a service contract specification contains - * an overloaded method. - * - * @version $Rev$ $Date$ - * @tuscany.spi.extension.asclient - */ -public class OverloadedOperationException extends InvalidInterfaceException { - private static final long serialVersionUID = -4658711318608885638L; - private final Method operation; - - public OverloadedOperationException(Method operation) { - super(operation == null ? - null : "[JCA20001] Cannot overload operation " + operation.getName() - + " on " + operation.getDeclaringClass().getName() - + " as it is a @Remotable interface"); - this.operation = operation; - } - - public Method getOperation() { - return operation; - } - -} diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/ParameterMode.java b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/ParameterMode.java deleted file mode 100644 index c4244a3480..0000000000 --- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/ParameterMode.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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; - -/** - * Parameter mode - * @see http://java.sun.com/javase/6/docs/api/javax/jws/WebParam.Mode.html - */ -public enum ParameterMode { - IN, OUT, INOUT; -} diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/DataTypeImpl.java b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/DataTypeImpl.java deleted file mode 100644 index 572dd7e356..0000000000 --- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/DataTypeImpl.java +++ /dev/null @@ -1,227 +0,0 @@ -/* - * 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.impl; - -import java.lang.reflect.Type; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -import org.apache.tuscany.sca.interfacedef.DataType; - -/** - * Representation of the type of data associated with an operation. Data is - * represented in two forms: the physical form used by the runtime and a logical - * form used by the assembly. The physical form is a Java Type because the - * runtime is written in Java. This may be the same form used by the application - * but it may not; for example, an application that is performing stream - * processing may want a physical form such as an - * {@link java.io.InputStream InputStream} to semantically operate on application - * data such as a purchase order. The logical description is that used by the - * assembly model and is an identifier into some well-known type space; examples - * may be a Java type represented by its Class or an XML type represented by its - * QName. Every data type may also contain metadata describing the expected - * data; for example, it could specify a preferred data binding technology or - * the size of a typical instance. - * - * @version $Rev$ $Date$ - * @tuscany.spi.extension.asclient - */ -public class DataTypeImpl implements DataType { - private String dataBinding; - private Class physical; - private Type genericType; - private L logical; - private Map, Object> metaDataMap; - - /** - * Construct a data type specifying the physical and logical types. - * - * @param physical the physical class used by the runtime - * @param logical the logical type - * @see #getLogical() - */ - public DataTypeImpl(Class physical, L logical) { - this(null, physical, physical, logical); - } - - /** - * @param dataBinding - * @param physical - * @param logical - */ - public DataTypeImpl(String dataBinding, Class physical, L logical) { - this(dataBinding, physical, physical, logical); - } - - /** - * @param dataBinding - * @param physical - * @param genericType - * @param logical - */ - public DataTypeImpl(String dataBinding, Class physical, Type genericType, L logical) { - super(); - this.dataBinding = dataBinding; - this.physical = physical; - this.genericType = genericType; - this.logical = logical; - } - - /** - * Returns the physical type used by the runtime. - * - * @return the physical type used by the runtime - */ - public Class getPhysical() { - return physical; - } - - /** - * @param physical the physical to set - */ - public void setPhysical(Class physical) { - this.physical = physical; - } - - /** - * Get the java generic type - * @return The java generic type - */ - public Type getGenericType() { - return genericType; - } - - /** - * Set the java generic type - * @param genericType - */ - public void setGenericType(Type genericType) { - this.genericType = genericType; - } - - /** - * Returns the logical identifier used by the assembly. The type of this - * value identifies the logical type system in use. Known values are: - *
        - *
      • a java.lang.reflect.Type identifies a Java type by name and - * ClassLoader; this includes Java Classes as they are specializations of - * Type
      • - *
      • a javax.xml.namespace.QName identifies an XML type by local name and - * namespace
      • - *
      - * - * @return the logical type name - */ - public L getLogical() { - return logical; - } - - /** - * @param logical the logical to set - */ - public void setLogical(L logical) { - this.logical = logical; - } - - public String getDataBinding() { - return dataBinding; - } - - /** - * @param dataBinding the dataBinding to set - */ - public void setDataBinding(String dataBinding) { - this.dataBinding = dataBinding; - } - - - @Override - public String toString() { - StringBuilder b = new StringBuilder( 256 ); - b.append( "DataType[" ); - b.append( "dataBinding=" + ((dataBinding==null) ? "null" : dataBinding) ); - b.append( ", genericType=" + ((genericType==null) ? "null" : genericType) ); - b.append( ", physical=" + ((physical==null) ? "null" : physical) ); - b.append( ", logical=" + ((logical==null) ? "null" : logical) ); - b.append( ", metaData size=" + ((metaDataMap==null) ? "0" : metaDataMap.size()) ); - b.append( "]" ); - return b.toString(); - } - - @SuppressWarnings("unchecked") - @Override - public Object clone() throws CloneNotSupportedException { - DataTypeImpl copy = (DataTypeImpl)super.clone(); - return copy; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((dataBinding == null) ? 0 : dataBinding.hashCode()); - result = prime * result + ((genericType == null) ? 0 : genericType.hashCode()); - result = prime * result + ((logical == null) ? 0 : logical.hashCode()); - result = prime * result + ((physical == null) ? 0 : physical.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - final DataTypeImpl other = (DataTypeImpl)obj; - if (dataBinding == null) { - if (other.dataBinding != null) - return false; - } else if (!dataBinding.equals(other.dataBinding)) - return false; - if (genericType == null) { - if (other.genericType != null) - return false; - } else if (!genericType.equals(other.genericType)) - return false; - if (logical == null) { - if (other.logical != null) - return false; - } else if (!logical.equals(other.logical)) - return false; - if (physical == null) { - if (other.physical != null) - return false; - } else if (!physical.equals(other.physical)) - return false; - return true; - } - - public T getMetaData(Class type) { - return metaDataMap == null ? null : type.cast(metaDataMap.get(type)); - } - - public void setMetaData(Class type, T metaData) { - if (metaDataMap == null) { - metaDataMap = new ConcurrentHashMap, Object>(); - } - metaDataMap.put(type, metaData); - } -} diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractImpl.java b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractImpl.java deleted file mode 100644 index 4fad64ac89..0000000000 --- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractImpl.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * 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.impl; - -import org.apache.tuscany.sca.interfacedef.Interface; -import org.apache.tuscany.sca.interfacedef.InterfaceContract; - -/** - * Represents an interface contract. InterfaceContractImpl - * - * @version $Rev$ $Date$ - * @tuscany.spi.extension.inheritfrom - */ -public abstract class InterfaceContractImpl implements InterfaceContract { - private Interface callInterface; - private Interface callbackInterface; - - public Interface getCallbackInterface() { - return callbackInterface; - } - - public Interface getInterface() { - return callInterface; - } - - public void setCallbackInterface(Interface callbackInterface) { - this.callbackInterface = callbackInterface; - } - - public void setInterface(Interface callInterface) { - this.callInterface = callInterface; - } - - public InterfaceContract makeUnidirectional(boolean isCallback) { - if (!isCallback && callbackInterface == null) - return this; // already a unidirectional forward interface contract - - if (isCallback && callInterface == null) - return this; // already a unidirectional callback interface contract - - // contract is bidirectional, so create a new unidirectional contract - try { - InterfaceContract newContract = clone(); - if (!isCallback) { - newContract.setCallbackInterface(null); // create unidirectional forward interface contract - } else { - newContract.setInterface(null); // create unidirectional callback interface contract - } - return newContract; - } catch (CloneNotSupportedException e) { - // will not happen - return null; - } - } - - @Override - public InterfaceContractImpl clone() throws CloneNotSupportedException { - InterfaceContractImpl copy = (InterfaceContractImpl)super.clone(); - if (this.callbackInterface != null) { - copy.callbackInterface = (Interface)this.callbackInterface.clone(); - } - if (this.callInterface != null) { - copy.callInterface = (Interface)this.callInterface.clone(); - } - return copy; - } - - /** - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((callInterface == null) ? 0 : callInterface.hashCode()); - result = prime * result + ((callbackInterface == null) ? 0 : callbackInterface.hashCode()); - return result; - } - - /** - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final InterfaceContractImpl other = (InterfaceContractImpl)obj; - if (callInterface == null) { - if (other.callInterface != null) { - return false; - } - } else if (!callInterface.equals(other.callInterface)) { - return false; - } - if (callbackInterface == null) { - if (other.callbackInterface != null) { - return false; - } - } else if (!callbackInterface.equals(other.callbackInterface)) { - return false; - } - return true; - } - - // By default there is no normailized contract - // as only Java needs it - public InterfaceContract getNormalizedWSDLContract() { - return null; - } - - // By default there is no normailized contract - // as only Java needs it - public void setNormailizedWSDLContract( - InterfaceContract wsdlInterfaceContract) { - // do nothing - } - -} diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java deleted file mode 100644 index 486081dfec..0000000000 --- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java +++ /dev/null @@ -1,586 +0,0 @@ -/* - * 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.impl; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.sca.assembly.builder.BuilderExtensionPoint; -import org.apache.tuscany.sca.assembly.builder.ContractBuilder; -import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.interfacedef.Compatibility; -import org.apache.tuscany.sca.interfacedef.DataType; -import org.apache.tuscany.sca.interfacedef.IncompatibleInterfaceContractException; -import org.apache.tuscany.sca.interfacedef.Interface; -import org.apache.tuscany.sca.interfacedef.InterfaceContract; -import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.interfacedef.util.Audit; -import org.apache.tuscany.sca.interfacedef.util.XMLType; -import org.apache.tuscany.sca.policy.ExtensionType; - -/** - * @version $Rev$ $Date$ - */ -public class InterfaceContractMapperImpl implements InterfaceContractMapper { - - protected ExtensionPointRegistry registry; - protected BuilderExtensionPoint builders; - protected ContractBuilder contractBuilder; - - public InterfaceContractMapperImpl(ExtensionPointRegistry registry){ - this.registry = registry; - this.builders = registry.getExtensionPoint(BuilderExtensionPoint.class); - } - - public boolean isCompatible(DataType source, DataType target, boolean passByValue) { - return isCompatible(source, target, passByValue, null); - } - - public boolean isCompatible(DataType source, DataType target, boolean passByValue, Audit audit) { - if (source == target) { - return true; - } - if (!passByValue) { - if (source == null || target == null) { - if (audit != null){ - audit.append("One of either the source or target data types is null for"); - } - return false; - } - // For local case - return target.getPhysical().isAssignableFrom(source.getPhysical()); - } else { - // For remote interfaces where the target is represented with WSDL - // the source will have been converted to WSDL so we rely on JAXB mappings - // being the same in both cases and just compare the type names directly. - // TODO - is this right? - XMLType sourceLogicalType = null; - - // There is some nesting of data types (when GeneratedDataType is used) so - // dig a bit deeper to find the real data type - if (source.getLogical() instanceof DataType){ - sourceLogicalType = (XMLType)((DataType)source.getLogical()).getLogical(); - } else { - sourceLogicalType = (XMLType)source.getLogical(); - } - - XMLType targetLogicalType = null; - - if (target.getLogical() instanceof DataType){ - targetLogicalType = (XMLType)((DataType)target.getLogical()).getLogical(); - } else { - targetLogicalType = (XMLType)target.getLogical(); - } - - // The logical type seems to be null in some cases, e.g. when the - // argument or return type is something like a Map. - // TODO - check when some type give rise to a null logical type - if (sourceLogicalType.getTypeName() == null || - targetLogicalType.getTypeName() == null) { - return true; - } - - boolean match = sourceLogicalType.getTypeName().equals(targetLogicalType.getTypeName()); - - if (!match){ - - QName anyType = new QName("http://www.w3.org/2001/XMLSchema", "anyType"); - if (sourceLogicalType.getTypeName().equals(anyType) || - targetLogicalType.getTypeName().equals(anyType)){ - // special case where a Java interface uses a generic type, e.g. - // public OMElement getGreetings(OMElement om) - // while the provided WSDL uses a specific type. So we assume - // that xsd:anyType matched anything - match = true; - } else { - if (audit != null){ - audit.append("Operation argument types source = " + - sourceLogicalType.getTypeName() + - " target = " + - targetLogicalType.getTypeName() + - " don't match for"); - } - } - } - - return match; - } - - } - - /** - * Check that two interface contracts are equal. The contracts are equal if the two contracts have the - * same set of operations, with each operation having the same signature, both for forward and callback - * interfaces - * @param source - * @param target - * @return - */ - public boolean isMutuallyCompatible(InterfaceContract source, InterfaceContract target) { - ExtensionType ext = source.getInterface().getExtensionType(); - InterfaceContract sourceContract = null; - - // Are the forward interfaces equal? - if (isMutuallyCompatible(source.getInterface(), target.getInterface())) { - // Is there a Callback interface? - if (source.getCallbackInterface() == null && target.getCallbackInterface() == null) { - return true; - } else { - if (isMutuallyCompatible(source.getCallbackInterface(), target.getCallbackInterface())) { - return true; - } // end if - } // end if - } // end if - return false; - } // end method isEqual - - /** - * Check that two interfaces are equal. The interfaces are equal if the two interfaces have the - * same set of operations, with each operation having the same signature. - * @param source - * @param target - * @return - */ - public boolean isMutuallyCompatible(Interface source, Interface target) { - if (source == target) { - // Shortcut for performance - return true; - } // end if - if (source == null || target == null) { - return false; - } // end if - - if (source.isDynamic() || target.isDynamic()) { - return true; - } - - if (source.isRemotable() != target.isRemotable()) { - return false; - } - if (source.getOperations().size() != target.getOperations().size()) { - return false; - } - - for (Operation operation : source.getOperations()) { - Operation targetOperation = getOperation(target.getOperations(), operation.getName()); - if (targetOperation == null) { - return false; - } - if (!isCompatible(operation, targetOperation, Compatibility.SUBSET)) { - return false; - } - } - return true; - } // end method isEqual - - public boolean isCompatible(Operation source, Operation target, Compatibility compatibilityType) { - return isCompatible(source, target, compatibilityType, true); - } - - public boolean isCompatible(Operation source, Operation target, Compatibility compatibilityType, boolean byValue) { - return isCompatible(source, target, compatibilityType, true, null); - } - - public boolean isCompatible(Operation source, Operation target, Compatibility compatibilityType, boolean byValue, Audit audit) { - if (source == target) { - return true; - } - - if (source.isDynamic() || target.isDynamic()) { - return true; - } - - // Check name - if (!source.getName().equals(target.getName())) { - if (audit != null){ - audit.append("operation names are not the same source = " + - source.getName() + - " target = " + - target.getName()); - audit.appendSeperator(); - } - return false; - } - - if (source.getInterface().isRemotable() != target.getInterface().isRemotable()) { - if (audit != null){ - audit.append("Interfaces have different remote settings source = " + - source.getName() + - " target = " + - target.getName()); - audit.appendSeperator(); - } - return false; - } - - if (source.isNonBlocking() != target.isNonBlocking()) { - if (audit != null){ - audit.append("operations one-way not the same, source = " + - source.isNonBlocking() + - " target = " + - target.isNonBlocking()); - audit.appendSeperator(); - } - return false; - } - - boolean passByValue = (source.getInterface().isRemotable()) && byValue; - - // if (source.getInterface().isRemotable()) { - // return true; - // } - - // FIXME: We need to deal with wrapped<-->unwrapped conversion - - // Check output type - List sourceOutputType = source.getOutputType().getLogical(); - List targetOutputType = target.getOutputType().getLogical(); - - boolean checkSourceWrapper = true; - List sourceInputType = source.getInputType().getLogical(); - if (source.isWrapperStyle() && source.getWrapper() != null) { - sourceInputType = source.getWrapper().getUnwrappedInputType().getLogical(); - sourceOutputType = source.getWrapper().getUnwrappedOutputType().getLogical(); - checkSourceWrapper = false; - } - boolean checkTargetWrapper = true; - List targetInputType = target.getInputType().getLogical(); - if (target.isWrapperStyle() && target.getWrapper() != null) { - targetInputType = target.getWrapper().getUnwrappedInputType().getLogical(); - targetOutputType = target.getWrapper().getUnwrappedOutputType().getLogical(); - checkTargetWrapper = false; - } - -/* TODO - Why are we assuming compatibility if one side is wrapped and the other is not? - if (checkSourceWrapper != checkTargetWrapper) { - return true; - } -*/ - - if ( sourceOutputType.size() != targetOutputType.size()) { - if (audit != null){ - audit.append("different number of output types"); - audit.appendSeperator(); - } - return false; - } - - for ( int i=0; i < sourceOutputType.size(); i++) { - if (!isCompatible(targetOutputType.get(i), sourceOutputType.get(i), passByValue, audit)) { - if (audit != null){ - audit.append(" output types"); - audit.appendSeperator(); - } - return false; - } - } - - - if (sourceInputType.size() != targetInputType.size()) { - if (audit != null){ - audit.append("different number of input types"); - audit.appendSeperator(); - } - return false; - } - - int size = sourceInputType.size(); - for (int i = 0; i < size; i++) { - if (!isCompatible(sourceInputType.get(i), targetInputType.get(i), passByValue, audit)) { - if (audit != null){ - audit.append(" input types"); - audit.appendSeperator(); - } - return false; - } - } - - // Check fault types - for (DataType targetFaultType : target.getFaultTypes()) { - // Source fault types must be the same or superset of target fault - // types - boolean found = true; - for (DataType sourceFaultType : source.getFaultTypes()) { - found = false; - if (isCompatible(targetFaultType, sourceFaultType, passByValue, audit)) { - // Target fault type can be covered by the source fault type - found = true; - break; - } - } - if (!found) { - if (audit != null){ - audit.append("Fault types incompatible"); - audit.appendSeperator(); - } - return false; - } - } - - return true; - } - public boolean isCompatibleByReference(Operation source, Operation target, Compatibility compatibilityType) { - return isCompatible(source, target, compatibilityType, false); - } - - public boolean isCompatibleByValue(Operation source, Operation target, Compatibility compatibilityType) { - return isCompatible(source, target, compatibilityType, true); - } - - // FIXME: How to improve the performance for the lookup - private Operation getOperation(List operations, String name) { - for (Operation op : operations) { - if (op.getName().equals(name)) { - return op; - } - } - return null; - } - - /* - * this variant of the checkCompatibility method is intended to supersede the one without an audit argument - * Presence of both method variants indicates a state of partial development - */ - public boolean checkCompatibility(InterfaceContract source, - InterfaceContract target, - Compatibility compatibility, - boolean ignoreCallback, - boolean silent, - Audit audit) - throws IncompatibleInterfaceContractException { - - if (source == target) { - // Shortcut for performance - return true; - } - - if (source == null || target == null) { - return false; - } - - if (source.getInterface() == target.getInterface()) { - return ignoreCallback - || isCallbackCompatible(source, target, silent); - } - - if (source.getInterface() == null || target.getInterface() == null) { - return false; - } - - if (source.getInterface().isDynamic() - || target.getInterface().isDynamic()) { - return ignoreCallback - || isCallbackCompatible(source, target, silent); - } - - if (source.getInterface().isRemotable() != target.getInterface() - .isRemotable()) { - if (!silent) { - audit.append("Remotable settings do not match: "+ source + "," + target); // TODO see if serialization is sufficient - audit.appendSeperator(); - throw new IncompatibleInterfaceContractException( - "Remotable settings do not match", source, target); - - } else { - return false; - } - } - - for (Operation operation : source.getInterface().getOperations()) { - Operation targetOperation = map(target.getInterface(), operation); - if (targetOperation == null) { - if (!silent) { - audit.append("Operation " + operation.getName()+ " not found on target"); - audit.appendSeperator(); - throw new IncompatibleInterfaceContractException( - "Operation " + operation.getName() - + " not found on target", source, target); - } else { - return false; - } - } - - if (!silent) { - if (audit == null) - audit = new Audit(); - if (!isCompatible(operation, targetOperation, - Compatibility.SUBSET, true, audit)) { - audit.append("Operations called " + operation.getName()+ " are not compatible"); - audit.appendSeperator(); - throw new IncompatibleInterfaceContractException( - "Operations called " + operation.getName() - + " are not compatible " + audit, source, - target); - } - } else { - if (!isCompatible(operation, targetOperation, - Compatibility.SUBSET)) { - return false; - } - } - } - - return ignoreCallback || isCallbackCompatible(source, target, silent); - } - - /* - * The old checkCompatibility operation without auditing. This just delegates to the new one for the time - * being while there are still calls that don't provide and audit object. In the medium term when the calls have - * been converted to sue the new opetion directly this should be removed. - */ - public boolean checkCompatibility(InterfaceContract source, - InterfaceContract target, - Compatibility compatibility, - boolean ignoreCallback, - boolean silent) - throws IncompatibleInterfaceContractException { - - // create dummy audit object. - Audit audit = new Audit(); - - return checkCompatibility(source, - target, - compatibility, - ignoreCallback, - silent, - audit); - } - - - - protected boolean isCallbackCompatible(InterfaceContract source, InterfaceContract target, boolean silent) - throws IncompatibleInterfaceContractException { - if (source.getCallbackInterface() == null && target.getCallbackInterface() == null) { - return true; - } - if (source.getCallbackInterface() == null || target.getCallbackInterface() == null) { - if (!silent) { - throw new IncompatibleInterfaceContractException("Callback interface doesn't match as one of the callback interfaces is null", source, target); - } else { - return false; - } - } - - for (Operation operation : source.getCallbackInterface().getOperations()) { - Operation targetOperation = - getOperation(target.getCallbackInterface().getOperations(), operation.getName()); - if (targetOperation == null) { - if (!silent) { - throw new IncompatibleInterfaceContractException("Callback operation not found on target", source, - target, null, targetOperation); - } else { - return false; - } - } - if (!source.getCallbackInterface().isRemotable()) { - // FIXME: for remotable operation, only compare name for now - if (!operation.equals(targetOperation)) { - if (!silent) { - throw new IncompatibleInterfaceContractException("Target callback operation is not compatible", - source, target, operation, targetOperation); - } else { - return false; - } - } - } - } - return true; - } - - public boolean isCompatibleSubset(Interface source, Interface target) { - if (source == target) { - // Shortcut for performance - return true; - } - if (source == null || target == null) { - return false; - } - - if (source.isDynamic() || target.isDynamic()) { - return true; - } - - if (source.isRemotable() != target.isRemotable()) { - return false; - } - - for (Operation operation : source.getOperations()) { - Operation targetOperation = getOperation(target.getOperations(), operation.getName()); - if (targetOperation == null) { - return false; - } - if (!isCompatible(operation, targetOperation, Compatibility.SUBSET)) { - return false; - } - } - return true; - } - - /* - * the variant of isCompatibleSubset with the audit parameter is intended to supersede the other - * -- the presence of both indicates a partial development state - */ - public boolean isCompatibleSubset(InterfaceContract source, InterfaceContract target, Audit audit) { - - try { - return checkCompatibility(source, target, Compatibility.SUBSET, false, false, audit); - } catch (IncompatibleInterfaceContractException e) { - return false; - } - } - - public boolean isCompatibleSubset(InterfaceContract source, InterfaceContract target) { - - try { - return checkCompatibility(source, target, Compatibility.SUBSET, false, false); - } catch (IncompatibleInterfaceContractException e) { - return false; - } - } - - /** - * @see org.apache.tuscany.sca.interfacedef.InterfaceContractMapper#map(org.apache.tuscany.sca.interfacedef.Interface, - * org.apache.tuscany.sca.interfacedef.Operation) - */ - public Operation map(Interface target, Operation source) { - // TODO: How to handle the case that source operation is dynamic? - if (target == null || target.isDynamic()) { - return source; - } else if (target.isRemotable()) { - for (Operation op : target.getOperations()) { - if (op.getName().equals(source.getName())) { - return op; - } - } - return null; - } else { - for (Operation op : target.getOperations()) { - if (isCompatible(source, op, Compatibility.SUBSET)) { - return op; - } - } - return null; - } - } - -} diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java deleted file mode 100644 index 1daa6baf9c..0000000000 --- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java +++ /dev/null @@ -1,334 +0,0 @@ -/* - * 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.impl; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -import org.apache.tuscany.sca.interfacedef.DataType; -import org.apache.tuscany.sca.interfacedef.Interface; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.interfacedef.util.WrapperInfo; -import org.apache.tuscany.sca.policy.ExtensionType; -import org.apache.tuscany.sca.policy.Intent; -import org.apache.tuscany.sca.policy.PolicySet; - -/** - * Represents a service interface. - * - * @version $Rev$ $Date$ - * @tuscany.spi.extension.inheritfrom - */ -public class InterfaceImpl implements Interface { - - private Boolean remotable; - private boolean conversational; - private OperationList operations = new OperationList(); - private boolean unresolved; - - private ExtensionType type; - private List policySets = new ArrayList(); - private List requiredIntents = new ArrayList(); - private Map attributes = new ConcurrentHashMap(); - - public boolean isRemotable() { - boolean value = false; - if (remotable != null && remotable.booleanValue()) { - value = true; - } - return value; - } - - public void setRemotable(boolean remotable) { - this.remotable = Boolean.valueOf(remotable); - } - - public boolean isRemotableSet() { - return remotable == null ? false : true; - } - - public List getOperations() { - return operations; - } - - public boolean isUnresolved() { - return unresolved; - } - - public void setUnresolved(boolean undefined) { - this.unresolved = undefined; - } - - /** - * @return the conversational - */ - public boolean isConversational() { - return conversational; - } - - /** - * @param conversational the conversational to set - */ - public void setConversational(boolean conversational) { - this.conversational = conversational; - } - - private class OperationList extends ArrayList { - private static final long serialVersionUID = -903469106307606099L; - - @Override - public Operation set(int index, Operation element) { - element.setInterface(InterfaceImpl.this); - return super.set(index, element); - } - - @Override - public void add(int index, Operation element) { - element.setInterface(InterfaceImpl.this); - super.add(index, element); - } - - @Override - public boolean add(Operation o) { - o.setInterface(InterfaceImpl.this); - return super.add(o); - } - - @Override - public boolean addAll(Collection c) { - for (Operation op : c) { - op.setInterface(InterfaceImpl.this); - } - return super.addAll(c); - } - - @Override - public boolean addAll(int index, Collection c) { - for (Operation op : c) { - op.setInterface(InterfaceImpl.this); - } - return super.addAll(index, c); - } - - } - - @Deprecated - public void setDefaultDataBinding(String dataBinding) { - for (Operation op : getOperations()) { - if (op.getDataBinding() == null) { - op.setDataBinding(dataBinding); - DataType> inputType = op.getInputType(); - if (inputType != null) { - for (DataType d : inputType.getLogical()) { - if (d.getDataBinding() == null) { - d.setDataBinding(dataBinding); - } - } - } - DataType outputType = op.getOutputType(); - if (outputType != null && outputType.getDataBinding() == null) { - outputType.setDataBinding(dataBinding); - } - List faultTypes = op.getFaultTypes(); - if (faultTypes != null) { - for (DataType d : faultTypes) { - if (d.getDataBinding() == null) { - d.setDataBinding(dataBinding); - } - DataType ft = (DataType) d.getLogical(); - if (ft.getDataBinding() == null) { - ft.setDataBinding(dataBinding); - } - - } - } - if (op.isWrapperStyle()) { - WrapperInfo wrapper = op.getWrapper(); - if (wrapper != null) { - DataType> unwrappedInputType = wrapper.getUnwrappedInputType(); - if (unwrappedInputType != null) { - for (DataType d : unwrappedInputType.getLogical()) { - if (d.getDataBinding() == null) { - d.setDataBinding(dataBinding); - } - } - } - DataType unwrappedOutputType = wrapper.getUnwrappedOutputType(); - if (unwrappedOutputType != null && unwrappedOutputType.getDataBinding() == null) { - unwrappedOutputType.setDataBinding(dataBinding); - } - } - } - } - } - } - - private void setDataBinding(DataType dataType, String dataBinding) { - if ("java:array".equals(dataType.getDataBinding())) { - setDataBinding((DataType)dataType.getLogical(), dataBinding); - } else { - dataType.setDataBinding(dataBinding); - } - } - - public void resetDataBinding(String dataBinding) { - for (Operation op : getOperations()) { - op.setDataBinding(dataBinding); - DataType> inputType = op.getInputType(); - if (inputType != null) { - for (DataType d : inputType.getLogical()) { - setDataBinding(d, dataBinding); - } - } - List outputTypes = op.getOutputType().getLogical(); - for ( DataType outputType : outputTypes ) { - if (outputType != null) { - setDataBinding(outputType, dataBinding); - } - } - - List faultTypes = op.getFaultTypes(); - if (faultTypes != null) { - for (DataType d : faultTypes) { - setDataBinding(d, dataBinding); - setDataBinding((DataType) d.getLogical(), dataBinding); - } - } - if (op.isWrapperStyle()) { - WrapperInfo wrapper = op.getWrapper(); - if (wrapper != null) { - DataType> unwrappedInputType = wrapper.getUnwrappedInputType(); - if (unwrappedInputType != null) { - for (DataType d : unwrappedInputType.getLogical()) { - setDataBinding(d, dataBinding); - } - } - DataType> unwrappedOutputType = wrapper.getUnwrappedOutputType(); - if (unwrappedOutputType != null) { - for (DataType d : unwrappedOutputType.getLogical()) { - setDataBinding(d, dataBinding); - } - } - } - } - } - } - - public void resetInterfaceInputTypes(Interface newInterface){ - for (int i = 0; i < getOperations().size(); i++) { - // only remote interfaces only have a data type model defined - // and in this case operations cannot be overloaded so match - // operations by name - Operation oldOperation = getOperations().get(i); - Operation newOperation = null; - - for (Operation tmpOperation : newInterface.getOperations()){ - if (tmpOperation.getName().equals(oldOperation.getName())){ - newOperation = tmpOperation; - } - } - - if (newOperation == null){ - break; - } - - // set input types - oldOperation.setInputType(newOperation.getInputType()); - - // set wrapper - if (newOperation.isWrapperStyle()) { - oldOperation.setWrapperStyle(true); - oldOperation.setWrapper(newOperation.getWrapper()); - } - } - } - - public void resetInterfaceOutputTypes(Interface newInterface){ - for (int i = 0; i < getOperations().size(); i++) { - // only remote interfaces only have a data type model defined - // and in this case operations cannot be overloaded so match - // operations by name - Operation oldOperation = getOperations().get(i); - Operation newOperation = null; - - for (Operation tmpOperation : newInterface.getOperations()){ - if (tmpOperation.getName().equals(oldOperation.getName())){ - newOperation = tmpOperation; - } - } - - if (newOperation == null){ - break; - } - - // set output types - oldOperation.setOutputType(newOperation.getOutputType()); - - // set fault types - oldOperation.setFaultTypes(newOperation.getFaultTypes()); - - // set wrapper - if (newOperation.isWrapperStyle()) { - oldOperation.setWrapperStyle(true); - oldOperation.setWrapper(newOperation.getWrapper()); - } - } - } - - public boolean isDynamic() { - return false; - } - - public List getPolicySets() { - return policySets; - } - - public List getRequiredIntents() { - return requiredIntents; - } - - public ExtensionType getExtensionType() { - return type; - } - - public void setExtensionType(ExtensionType type) { - this.type = type; - } - - @Override - public Object clone() throws CloneNotSupportedException { - InterfaceImpl copy = (InterfaceImpl)super.clone(); - copy.operations = new OperationList(); - for (Operation operation : this.operations) { - Operation clonedOperation = (Operation)operation.clone(); - copy.operations.add(clonedOperation); - } - copy.attributes = new ConcurrentHashMap(); - copy.attributes.putAll(attributes); - return copy; - } - - public Map getAttributes() { - return attributes; - } - -} diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/OperationImpl.java b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/OperationImpl.java deleted file mode 100644 index 95256101d0..0000000000 --- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/impl/OperationImpl.java +++ /dev/null @@ -1,311 +0,0 @@ -/* - * 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.impl; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.sca.interfacedef.DataType; -import org.apache.tuscany.sca.interfacedef.Interface; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.interfacedef.ParameterMode; -import org.apache.tuscany.sca.interfacedef.util.WrapperInfo; -import org.apache.tuscany.sca.interfacedef.util.XMLType; -import org.apache.tuscany.sca.policy.ExtensionType; -import org.apache.tuscany.sca.policy.Intent; -import org.apache.tuscany.sca.policy.PolicySet; - -/** - * Represents an operation on a service interface. - * - * @version $Rev$ $Date$ - * @tuscany.spi.extension.inheritfrom - */ -public class OperationImpl implements Operation { - - private String name; - private boolean unresolved; - private DataType> inputType; - private List faultTypes; - private Interface interfaze; - private List parameterModes = new ArrayList(); - private boolean nonBlocking; - private boolean wrapperStyle; - private WrapperInfo wrapper; - private boolean dynamic; - - private Map attributes = new ConcurrentHashMap(); - - private Map>> faultBeans; - - private List applicablePolicySets = new ArrayList(); - private List policySets = new ArrayList(); - private List requiredIntents = new ArrayList(); - private ExtensionType type; - private DataType> outputType; - private boolean hasArrayWrappedOutput; - - /** - * @param name - */ - public OperationImpl() { - inputType = new DataTypeImpl>(IDL_INPUT, Object[].class, new ArrayList()); - outputType = new DataTypeImpl>(IDL_OUTPUT, Object[].class, new ArrayList()); - faultTypes = new ArrayList(); - faultBeans = new HashMap>>(); - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public boolean isUnresolved() { - return unresolved; - } - - public void setUnresolved(boolean undefined) { - this.unresolved = undefined; - } - - /** - * @return the faultTypes - */ - public List getFaultTypes() { - return faultTypes; - } - - /** - * @param faultTypes the faultTypes to set - */ - public void setFaultTypes(List faultTypes) { - this.faultTypes = faultTypes; - } - - /** - * @return the inputType - */ - public DataType> getInputType() { - return inputType; - } - - /** - * @param inputType the inputType to set - */ - public void setInputType(DataType> inputType) { - this.inputType = inputType; - } - - /** - * @return the outputType - */ - public DataType> getOutputType() { - return this.outputType; - } - - - /** - * @param outputType the outputType to set - */ - public void setOutputType(DataType> outputType) { - this.outputType = outputType; - } - - /** - * @return the interface - */ - public Interface getInterface() { - return interfaze; - } - - /** - * @param interfaze the interface to set - */ - public void setInterface(Interface interfaze) { - this.interfaze = interfaze; - } - - /** - * @return the nonBlocking - */ - public boolean isNonBlocking() { - return nonBlocking; - } - - /** - * @param nonBlocking the nonBlocking to set - */ - public void setNonBlocking(boolean nonBlocking) { - this.nonBlocking = nonBlocking; - } - - /** - * @return the wrapperInfo - */ - public WrapperInfo getWrapper() { - return wrapper; - } - - /** - * @param wrapperInfo the wrapperInfo to set - */ - public void setWrapper(WrapperInfo wrapperInfo) { - this.wrapper = wrapperInfo; - } - - /** - * @return the wrapperStyle - */ - public boolean isWrapperStyle() { - return wrapperStyle; - } - - /** - * @param wrapperStyle the wrapperStyle to set - */ - public void setWrapperStyle(boolean wrapperStyle) { - this.wrapperStyle = wrapperStyle; - } - - public String getDataBinding() { - return wrapper != null ? wrapper.getDataBinding() : null; - } - - public void setDataBinding(String dataBinding) { - if (wrapper != null) { - wrapper.setDataBinding(dataBinding); - } - } - - public boolean isDynamic() { - return dynamic; - } - - public void setDynamic(boolean b) { - this.dynamic = b; - } - - public Map>> getFaultBeans() { - return faultBeans; - } - - public void setFaultBeans(Map>> faultBeans) { - this.faultBeans = faultBeans; - } - - @Override - public OperationImpl clone() throws CloneNotSupportedException { - OperationImpl copy = (OperationImpl) super.clone(); - - final List clonedFaultTypes = new ArrayList(this.faultTypes.size()); - for (DataType t : this.faultTypes) { - clonedFaultTypes.add((DataType) t.clone()); - } - copy.faultTypes = clonedFaultTypes; - - List clonedLogicalTypes = new ArrayList(); - for (DataType t : inputType.getLogical()) { - DataType type = (DataType) t.clone(); - clonedLogicalTypes.add(type); - } - DataType> clonedInputType = - new DataTypeImpl>(inputType.getPhysical(), clonedLogicalTypes); - clonedInputType.setDataBinding(inputType.getDataBinding()); - copy.inputType = clonedInputType; - - if ( outputType != null ) { - List clonedLogicalOutputTypes = new ArrayList(); - for ( DataType t : outputType.getLogical()) { - if ( t == null ) { - clonedLogicalOutputTypes.add(null); - } else { - DataType type = (DataType) t.clone(); - clonedLogicalOutputTypes.add(type); - } - } - DataType> clonedOutputType = - new DataTypeImpl>(outputType.getPhysical(), clonedLogicalOutputTypes); - clonedOutputType.setDataBinding(outputType.getDataBinding()); - copy.outputType = clonedOutputType; - } - - copy.attributes = new ConcurrentHashMap(); - copy.attributes.putAll(attributes); - - // [rfeng] We need to clone the wrapper as it holds the databinding information - if (wrapper != null) { - copy.wrapper = (WrapperInfo)wrapper.clone(); - } - - return copy; - } - - public List getApplicablePolicySets() { - return applicablePolicySets; - } - - public List getPolicySets() { - return policySets; - } - - public List getRequiredIntents() { - return requiredIntents; - } - - public ExtensionType getExtensionType() { - return type; - } - - public void setExtensionType(ExtensionType type) { - this.type = type; - } - - public Map getAttributes() { - return attributes; - } - - /** - * Indicates if this operation is an async server style of operation - * @return true if the operation is async server style - */ - public boolean isAsyncServer() { - return false; - } - - public List getParameterModes() { - return this.parameterModes; - } - - public boolean hasArrayWrappedOutput() { - return this.hasArrayWrappedOutput; - } - - public void setHasArrayWrappedOutput(boolean value) { - this.hasArrayWrappedOutput = value; - } - -} diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/util/Audit.java b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/util/Audit.java deleted file mode 100644 index 343d369fdb..0000000000 --- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/util/Audit.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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.util; - - -/* - * utility to allow building up an audit trail in case reporting is necessary later - * - */ -public class Audit { - - public static final String seperator = "|||"; - private StringBuffer buf; - - public Audit() { - this.buf = new StringBuffer(); - } - public void append(String str) { - buf.append(str); - } - - public void appendSeperator() { - buf.append(seperator); - } - public String toString() { - return buf.toString(); - } -} diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/util/ElementInfo.java b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/util/ElementInfo.java deleted file mode 100644 index 38e33e33d9..0000000000 --- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/util/ElementInfo.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * 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.util; - -import javax.xml.namespace.QName; - -/** - * An abstraction of XML schema elements. - * - * @version $Rev$ $Date$ - * @tuscany.spi.extension.asclient - */ -public class ElementInfo { - private final QName name; - private final TypeInfo type; - private boolean many = false; - private boolean nillable = false; - - /** - * @param name - * @param type - */ - public ElementInfo(QName name, TypeInfo type) { - super(); - this.name = name; - this.type = type; - } - - /** - * @return the name - */ - public QName getQName() { - return name; - } - - /** - * @return the type - */ - public TypeInfo getType() { - return type; - } - - @Override - public String toString() { - StringBuffer sb = new StringBuffer(); - sb.append("Element: ").append(name).append(" ").append(type); - return sb.toString(); - } - - public boolean isMany() { - return many; - } - - public void setMany(boolean many) { - this.many = many; - } - - public boolean isNillable() { - return nillable; - } - - public void setNillable(boolean nillable) { - this.nillable = nillable; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((name == null) ? 0 : name.hashCode()); - result = prime * result + ((type == null) ? 0 : type.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - final ElementInfo other = (ElementInfo)obj; - if (name == null) { - if (other.name != null) - return false; - } else if (!name.equals(other.name)) - return false; - /* - if (type == null) { - if (other.type != null) - return false; - } else if (!type.equals(other.type)) - return false; - */ - return true; - } -} diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/util/FaultException.java b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/util/FaultException.java deleted file mode 100644 index 334c826f86..0000000000 --- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/util/FaultException.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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.util; - -import javax.xml.namespace.QName; - -/** - * The generic java exception to wrap service faults - * - * @version $Rev$ $Date$ - * @tuscany.spi.extension.asclient - */ -public class FaultException extends Exception { - private static final long serialVersionUID = -8002583655240625792L; - private transient Object faultInfo; // FIXME: How to serialize it? - private QName faultName; - - /** - * @param message - * @param faultInfo - */ - public FaultException(String message, Object faultInfo) { - super(message); - this.faultInfo = faultInfo; - } - - /** - * @param message - * @param faultInfo - * @param cause - */ - public FaultException(String message, Object faultInfo, Throwable cause) { - super(message, cause); - this.faultInfo = faultInfo; - } - - /** - * @return the faultInfo - */ - public Object getFaultInfo() { - return faultInfo; - } - - public QName getFaultName() { - return faultName; - } - - public void setFaultName(QName logical) { - this.faultName = logical; - } - - public boolean isMatchingType(Object type) { - if (faultName == null) { - return false; - } - - if ((type instanceof QName) && faultName.equals(type)) { - return true; - } - if (type instanceof XMLType && faultName.equals(((XMLType)type).getElementName())) { - return true; - } - return false; - } - -} diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/util/JavaXMLMapper.java b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/util/JavaXMLMapper.java deleted file mode 100644 index 849b922285..0000000000 --- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/util/JavaXMLMapper.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * 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.util; - -import java.util.HashMap; -import java.util.Map; - -import javax.xml.namespace.QName; - -/** - * Utility class that can be used to map XSD types to Java classes and Java classes to XSD types. - * - * @version $Rev$ $Date$ - * @tuscany.spi.extension.asclient - */ -public final class JavaXMLMapper { - public static final String URI_2001_SCHEMA_XSD = "http://www.w3.org/2001/XMLSchema"; - private static final Map JAVA2XML = new HashMap(); - private static final Map XML2JAVA = new HashMap(); - - private JavaXMLMapper() { - } - - static { - JAVA2XML.put(boolean.class, getTypeName("boolean")); - JAVA2XML.put(byte.class, getTypeName("byte")); - JAVA2XML.put(short.class, getTypeName("short")); - JAVA2XML.put(int.class, getTypeName("int")); - JAVA2XML.put(long.class, getTypeName("long")); - JAVA2XML.put(float.class, getTypeName("float")); - JAVA2XML.put(double.class, getTypeName("double")); - JAVA2XML.put(Boolean.class, getTypeName("boolean")); - JAVA2XML.put(Byte.class, getTypeName("byte")); - JAVA2XML.put(Short.class, getTypeName("short")); - JAVA2XML.put(Integer.class, getTypeName("int")); - JAVA2XML.put(Long.class, getTypeName("long")); - JAVA2XML.put(Float.class, getTypeName("float")); - JAVA2XML.put(Double.class, getTypeName("double")); - JAVA2XML.put(java.lang.String.class, getTypeName("string")); - JAVA2XML.put(java.math.BigInteger.class, getTypeName("integer")); - JAVA2XML.put(java.math.BigDecimal.class, getTypeName("decimal")); - JAVA2XML.put(java.util.Calendar.class, getTypeName("dateTime")); - JAVA2XML.put(java.util.Date.class, getTypeName("dateTime")); - JAVA2XML.put(javax.xml.namespace.QName.class, getTypeName("QName")); - JAVA2XML.put(java.net.URI.class, getTypeName("string")); - JAVA2XML.put(javax.xml.datatype.XMLGregorianCalendar.class, getTypeName("anySimpleType")); - JAVA2XML.put(javax.xml.datatype.Duration.class, getTypeName("duration")); - JAVA2XML.put(java.lang.Object.class, getTypeName("anyType")); - JAVA2XML.put(java.awt.Image.class, getTypeName("base64Binary")); - JAVA2XML.put(byte[].class, getTypeName("base64Binary")); - // java2XSD.put(javax.activation.DataHandler.class, getTypeName("base64Binary")); - JAVA2XML.put(javax.xml.transform.Source.class, getTypeName("base64Binary")); - JAVA2XML.put(java.util.UUID.class, getTypeName("string")); - } - - static { - XML2JAVA.put("string", java.lang.String.class); - XML2JAVA.put("integer", java.math.BigInteger.class); - XML2JAVA.put("int", int.class); - XML2JAVA.put("long", long.class); - XML2JAVA.put("short", short.class); - XML2JAVA.put("decimal", java.math.BigDecimal.class); - XML2JAVA.put("float", float.class); - XML2JAVA.put("double", double.class); - XML2JAVA.put("boolean", boolean.class); - XML2JAVA.put("byte", byte.class); - XML2JAVA.put("QName", javax.xml.namespace.QName.class); - XML2JAVA.put("dateTime", javax.xml.datatype.XMLGregorianCalendar.class); - XML2JAVA.put("base64Binary", byte[].class); - XML2JAVA.put("hexBinary", byte[].class); - XML2JAVA.put("unsignedInt", long.class); - XML2JAVA.put("unsignedShort", int.class); - XML2JAVA.put("unsignedByte", short.class); - XML2JAVA.put("time", javax.xml.datatype.XMLGregorianCalendar.class); - XML2JAVA.put("date", javax.xml.datatype.XMLGregorianCalendar.class); - XML2JAVA.put("gDay", javax.xml.datatype.XMLGregorianCalendar.class); - XML2JAVA.put("gMonth", javax.xml.datatype.XMLGregorianCalendar.class); - XML2JAVA.put("gYear", javax.xml.datatype.XMLGregorianCalendar.class); - XML2JAVA.put("gYearMonth", javax.xml.datatype.XMLGregorianCalendar.class); - XML2JAVA.put("gMonthDay", javax.xml.datatype.XMLGregorianCalendar.class); - XML2JAVA.put("anySimpleType", java.lang.Object.class); // For elements - // XML2JAVA.put("anySimpleType", java.lang.String.class); // For - // attributes - XML2JAVA.put("duration", javax.xml.datatype.Duration.class); - XML2JAVA.put("NOTATION", javax.xml.namespace.QName.class); - } - - public static Class getJavaType(QName xmlType) { - if (URI_2001_SCHEMA_XSD.equals(xmlType.getNamespaceURI())) { - return XML2JAVA.get(xmlType.getLocalPart()); - } else { - return null; - } - } - - private static QName getTypeName(String name) { - return new QName(URI_2001_SCHEMA_XSD, name); - } - - public static QName getXMLType(Class javaType) { - return JAVA2XML.get(javaType); - } - - private static String getPackageName(Class cls) { - String name = cls.getName(); - int index = name.lastIndexOf('.'); - return index == -1 ? "" : name.substring(0, index); - } - - public static String getNamespace(Class cls) { - String packageName = getPackageName(cls); - if ("".equals(packageName)) { - return ""; - } - StringBuffer ns = new StringBuffer("http://"); - String[] names = packageName.split("\\."); - for (int i = names.length - 1; i >= 0; i--) { - ns.append(names[i]); - if (i != 0) { - ns.append('.'); - } - } - ns.append('/'); - return ns.toString(); - } - -} diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/util/TypeInfo.java b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/util/TypeInfo.java deleted file mode 100644 index abae4e7e38..0000000000 --- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/util/TypeInfo.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * 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.util; - -import javax.xml.namespace.QName; - -/** - * An abstraction of XML schema types - * - * @version $Rev$ $Date$ - * @tuscany.spi.extension.asclient - */ -public class TypeInfo { - private QName name; - - private boolean isSimpleType; - - private TypeInfo baseType; - - /** - * @param name - * @param isSimpleType - */ - public TypeInfo(QName name, boolean isSimpleType, TypeInfo baseType) { - super(); - this.name = name; - this.isSimpleType = isSimpleType; - this.baseType = baseType; - } - - /** - * @return the isSimpleType - */ - public boolean isSimpleType() { - return isSimpleType; - } - - /** - * @return the name - */ - public QName getQName() { - return name; - } - - /** - * @return the baseType - */ - public TypeInfo getBaseType() { - return baseType; - } - - @Override - public String toString() { - StringBuffer sb = new StringBuffer(); - sb.append("Type: ").append(name); - return sb.toString(); - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((name == null) ? 0 : name.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - final TypeInfo other = (TypeInfo)obj; - if (name == null) { - if (other.name != null) - return false; - } else if (!name.equals(other.name)) - return false; - return true; - } - -} diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/util/WrapperInfo.java b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/util/WrapperInfo.java deleted file mode 100644 index 9f083a4083..0000000000 --- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/util/WrapperInfo.java +++ /dev/null @@ -1,199 +0,0 @@ -/* - * 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.util; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.tuscany.sca.interfacedef.DataType; -import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl; - -/** - * The "Wrapper Style" WSDL operation is defined by The Java API for XML-Based - * Web Services (JAX-WS) 2.0 specification, section 2.3.1.2 Wrapper Style.

      - * A WSDL operation qualifies for wrapper style mapping only if the following - * criteria are met: - *

        - *
      • (i) The operation�s input and output messages (if present) each contain - * only a single part - *
      • (ii) The input message part refers to a global element declaration whose - * localname is equal to the operation name - *
      • (iii) The output message part refers to a global element declaration - *
      • (iv) The elements referred to by the input and output message parts - * (henceforth referred to as wrapper elements) are both complex types defined - * using the xsd:sequence compositor - *
      • (v) The wrapper elements only contain child elements, they must not - * contain other structures such as wildcards (element or attribute), - * xsd:choice, substitution groups (element references are not permitted) or - * attributes; furthermore, they must not be nillable. - *
      - * - * @version $Rev$ $Date$ - * @tuscany.spi.extension.asclient - */ -public class WrapperInfo implements Cloneable { - private ElementInfo inputWrapperElement; - - private ElementInfo outputWrapperElement; - - private List inputChildElements; - - private List outputChildElements; - - // The data type of the unwrapped input child elements - private DataType> unwrappedInputType; - - // The data type of the unwrapped output child elements - private DataType> unwrappedOutputType; - - // The data for the input/output wrappers - private String dataBinding; - - // The data type for the input (request) wrapper bean - private DataType inputWrapperType; - // The data type for the output (response) wrapper bean - private DataType outputWrapperType; - - public WrapperInfo(String dataBinding, - ElementInfo inputWrapperElement, - ElementInfo outputWrapperElement, - List inputElements, - List outputElements) { - super(); - this.dataBinding = dataBinding; - this.inputWrapperElement = inputWrapperElement; - this.outputWrapperElement = outputWrapperElement; - this.inputChildElements = inputElements; - this.outputChildElements = outputElements; - } - - /** - * @return the inputElements - */ - public List getInputChildElements() { - return inputChildElements; - } - - /** - * @return the inputWrapperElement - */ - public ElementInfo getInputWrapperElement() { - return inputWrapperElement; - } - - /** - * @return the outputElements - */ - public List getOutputChildElements() { - return outputChildElements; - } - - /** - * @return the outputWrapperElement - */ - public ElementInfo getOutputWrapperElement() { - return outputWrapperElement; - } - - /** - * @return the unwrappedInputType - */ - public DataType> getUnwrappedInputType() { - if (unwrappedInputType == null) { - List childTypes = new ArrayList(); - for (ElementInfo element : getInputChildElements()) { - DataType type = getDataType(element); - childTypes.add(type); - } - unwrappedInputType = new DataTypeImpl>("idl:unwrapped.input", Object[].class, childTypes); - } - return unwrappedInputType; - } - - private DataType getDataType(ElementInfo element) { - DataType type = null; - if (element.isMany()) { - DataType logical = new DataTypeImpl(dataBinding, Object.class, new XMLType(element)); - type = new DataTypeImpl("java:array", Object[].class, logical); - } else { - type = new DataTypeImpl(dataBinding, Object.class, new XMLType(element)); - } - return type; - } - - /** - * @return the unwrappedOutputType - */ - public DataType> getUnwrappedOutputType() { - if (unwrappedOutputType == null) { - List childTypes = new ArrayList(); - for (ElementInfo element : getOutputChildElements()) { - DataType type = getDataType(element); - childTypes.add(type); - } - unwrappedOutputType = new DataTypeImpl>("idl:unwrapped.input", Object[].class, childTypes); - } - return unwrappedOutputType; } - - public Class getInputWrapperClass() { - return inputWrapperType == null ? null : inputWrapperType.getPhysical(); - } - - public Class getOutputWrapperClass() { - return outputWrapperType == null ? null : outputWrapperType.getPhysical(); - } - - public String getDataBinding() { - return dataBinding; - } - - public void setDataBinding(String dataBinding) { - this.dataBinding = dataBinding; - } - - public DataType getInputWrapperType() { - return inputWrapperType; - } - - public void setInputWrapperType(DataType inputWrapperType) { - this.inputWrapperType = inputWrapperType; - } - - public DataType getOutputWrapperType() { - return outputWrapperType; - } - - public void setOutputWrapperType(DataType outputWrapperType) { - this.outputWrapperType = outputWrapperType; - } - - @Override - public Object clone() throws CloneNotSupportedException { - WrapperInfo copy = (WrapperInfo) super.clone(); - if (inputWrapperType != null) { - copy.inputWrapperType = (DataType)inputWrapperType.clone(); - } - if (outputWrapperType != null) { - copy.outputWrapperType = (DataType)outputWrapperType.clone(); - } - return copy; - - } -} diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/util/XMLType.java b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/util/XMLType.java deleted file mode 100644 index fd1b840b17..0000000000 --- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/assembly/src/main/java/org/apache/tuscany/sca/interfacedef/util/XMLType.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * 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.util; - -import javax.xml.namespace.QName; - -/** - * The metadata for an XML element or type. - * - * @version $Rev$ $Date$ - * @tuscany.spi.extension.asclient - */ -public class XMLType { - public static final XMLType UNKNOWN = new XMLType(null, null); - protected QName element; - protected QName type; - protected boolean nillable = true; - protected boolean many = false; - - /** - * @param element - */ - public XMLType(ElementInfo element) { - super(); - this.element = element.getQName(); - if (element.getType() != null) { - this.type = element.getType().getQName(); - } - } - - /** - * @param element - */ - public XMLType(TypeInfo type) { - this.element = null; - this.type = type.getQName(); - } - - public XMLType(QName element, QName type) { - this.element = element; - this.type = type; - } - - /** - * @return the type - */ - public QName getTypeName() { - return type; - } - - public boolean isElement() { - return element != null; - } - - public QName getElementName() { - return element; - } - - public void setElementName(QName element) { - this.element = element; - } - - public void setTypeName(QName type) { - this.type = type; - } - - public static XMLType getType(QName type) { - return new XMLType(null, type); - } - - /** - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() { - final int PRIME = 31; - int result = 1; - result = PRIME * result + ((element == null) ? 0 : element.hashCode()); - result = PRIME * result + ((type == null) ? 0 : type.hashCode()); - return result; - } - - /** - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final XMLType other = (XMLType)obj; - if (element == null) { - if (other.element != null) { - return false; - } - } else if (!element.equals(other.element)) { - return false; - } - if (type == null) { - if (other.type != null) { - return false; - } - } else if (!type.equals(other.type)) { - return false; - } - return true; - } - - @Override - public String toString() { - return "Element: " + element + " Type: " + type; - } - - public boolean isNillable() { - return nillable; - } - - public void setNillable(boolean niable) { - this.nillable = niable; - } - - public boolean isMany() { - return many; - } - - public void setMany(boolean many) { - this.many = many; - } - -} -- cgit v1.2.3