You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by rf...@apache.org on 2007/03/16 17:53:59 UTC
svn commit: r519057 - in
/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model:
DataType.java Operation.java ServiceContract.java WrapperInfo.java
Author: rfeng
Date: Fri Mar 16 09:53:58 2007
New Revision: 519057
URL: http://svn.apache.org/viewvc?view=rev&rev=519057
Log:
Add "setLogical()" for DataType so that further introspection can update the logical type with more information
Minor improvements for ServiceContract/Operation/WrapperInfo
Modified:
incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/DataType.java
incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Operation.java
incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ServiceContract.java
incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/WrapperInfo.java
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/DataType.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/DataType.java?view=diff&rev=519057&r1=519056&r2=519057
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/DataType.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/DataType.java Fri Mar 16 09:53:58 2007
@@ -35,11 +35,11 @@
* @version $Rev$ $Date$
*/
public class DataType<L> extends ModelObject implements Cloneable {
- private String dataBinding = Object.class.getName();
+ private String dataBinding;
private final Type physical;
- private final L logical;
+ private L logical;
private Map<String, Object> metadata = new HashMap<String, Object>();
@@ -237,6 +237,13 @@
public void setOperation(Operation operation) {
this.operation = operation;
+ }
+
+ /**
+ * @param logical the logical to set
+ */
+ public void setLogical(L logical) {
+ this.logical = logical;
}
}
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Operation.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Operation.java?view=diff&rev=519057&r1=519056&r2=519057
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Operation.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Operation.java Fri Mar 16 09:53:58 2007
@@ -24,6 +24,7 @@
import java.util.List;
import java.util.Map;
+
/**
* Represents an operation that is part of a service contract. The type paramter of this operation identifies the
* logical type system for all data types.
@@ -38,9 +39,9 @@
protected Map<String, Object> metaData;
private final String name;
private ServiceContract<T> contract;
- private final DataType<T> outputType;
- private final DataType<List<DataType<T>>> inputType;
- private final List<DataType<T>> faultTypes;
+ private DataType<T> outputType;
+ private DataType<List<DataType<T>>> inputType;
+ private List<DataType<T>> faultTypes;
private String dataBinding;
private boolean wrapperStyle;
private WrapperInfo wrapper;
@@ -72,8 +73,8 @@
* @param faultTypes the data type of faults raised by the operation
* @param nonBlocking if the operation is non-blocking
* @param dataBinding the data-binding type required by the operation
- * @param sequence the conversational attributes of the operation {@link #CONVERSATION_CONTINUE}, or {@link
- * #CONVERSATION_END}
+ * @param sequence the conversational attributes of the operation, {@link NO_CONVERSATION}, {@link
+ * CONVERSATION_CONTINUE}, or {@link CONVERSATION_END}
*/
public Operation(final String name,
final DataType<List<DataType<T>>> inputType,
@@ -197,8 +198,8 @@
}
/**
- * Returns the sequence the operation is called in a conversation, {@link #CONVERSATION_CONTINUE}, or {@link
- * #CONVERSATION_END}
+ * Returns the sequence the operation is called in a conversation, {@link NO_CONVERSATION}, {@link
+ * CONVERSATION_CONTINUE}, or {@link CONVERSATION_END}
*
* @return the sequence the operation is called in a conversation
*/
@@ -207,8 +208,8 @@
}
/**
- * Sets the sequence the operation is called in a conversation, {@link #CONVERSATION_CONTINUE}, or {@link
- * #CONVERSATION_END}
+ * Sets the sequence the operation is called in a conversation, {@link NO_CONVERSATION}, {@link
+ * CONVERSATION_CONTINUE}, or {@link CONVERSATION_END}
*/
public void setConversationSequence(int conversationSequence) {
this.conversationSequence = conversationSequence;
@@ -279,6 +280,11 @@
if (isMappable()) {
return true;
}
+
+ // FIXME: TUSCANY-1111, currently comparing different IDLs fail
+ if (contract != null && contract.getClass() != operation.getServiceContract().getClass()) {
+ return true;
+ }
if (faultTypes == null && operation.faultTypes != null) {
return false;
@@ -364,9 +370,10 @@
this.wrapperStyle = wrapperStyle;
}
- @SuppressWarnings({"unchecked", "CloneDoesntCallSuperClone"})
+ @SuppressWarnings("unchecked")
@Override
public Operation<T> clone() throws CloneNotSupportedException {
+ Operation<T> copy = (Operation<T>) super.clone();
final List<DataType<T>> clonedFaultTypes = new ArrayList<DataType<T>>(this.faultTypes.size());
for (DataType<T> t : this.faultTypes) {
clonedFaultTypes.add((DataType<T>) t.clone());
@@ -382,20 +389,11 @@
new DataType<List<DataType<T>>>(inputType.getPhysical(), clonedTypes);
clonedInputType.setDataBinding(inputType.getDataBinding());
- DataType<T> outputType = (DataType<T>) this.outputType.clone();
- Operation<T> copy =
- new Operation<T>(name,
- clonedInputType,
- outputType,
- clonedFaultTypes,
- nonBlocking,
- dataBinding,
- conversationSequence);
-
- copy.callback = this.callback;
- copy.contract = this.contract;
- copy.wrapper = this.wrapper;
- copy.wrapperStyle = this.wrapperStyle;
+ DataType<T> clonedOutputType = (DataType<T>) this.outputType.clone();
+
+ copy.inputType = clonedInputType;
+ copy.outputType = clonedOutputType;
+ copy.faultTypes = clonedFaultTypes;
if (this.metaData != null) {
assert this.metaData instanceof HashMap;
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ServiceContract.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ServiceContract.java?view=diff&rev=519057&r1=519056&r2=519057
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ServiceContract.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ServiceContract.java Fri Mar 16 09:53:58 2007
@@ -137,6 +137,10 @@
this.callbackClass = callbackClass;
}
+ public Operation getOperation(String name) {
+ return operations == null ? null : operations.get(name);
+ }
+
public Map<String, Operation<T>> getOperations() {
if (operations == null) {
return Collections.emptyMap();
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/WrapperInfo.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/WrapperInfo.java?view=diff&rev=519057&r1=519056&r2=519057
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/WrapperInfo.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/WrapperInfo.java Fri Mar 16 09:53:58 2007
@@ -19,22 +19,30 @@
package org.apache.tuscany.spi.model;
+import java.util.ArrayList;
import java.util.List;
-import javax.xml.namespace.QName;
+
/**
- * 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.
- * <p/>
- * A WSDL operation qualifies for wrapper style mapping only if the following criteria are met: <ul> <li>(i) The
- * operations input and output messages (if present) each contain only a single part <li>(ii) The input message part
- * refers to a global element declaration whose localname is equal to the operation name <li>(iii) The output message
- * part refers to a global element declaration <li>(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 <li>(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. </ul>
- *
+ * 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. <p/>
+ * A WSDL operation qualifies for wrapper style mapping only if the following
+ * criteria are met:
+ * <ul>
+ * <li>(i) The operations input and output messages (if present) each contain
+ * only a single part
+ * <li>(ii) The input message part refers to a global element declaration whose
+ * localname is equal to the operation name
+ * <li>(iii) The output message part refers to a global element declaration
+ * <li>(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
+ * <li>(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.
+ * </ul>
+ *
* @version $Rev$ $Date$
*/
public class WrapperInfo {
@@ -46,23 +54,23 @@
private List<ElementInfo> outputChildElements;
- private DataType<List<DataType<QName>>> unwrappedInputType;
+ private DataType<List<DataType<XMLType>>> unwrappedInputType;
+
+ private DataType<XMLType> unwrappedOutputType;
- private DataType<QName> unwrappedOutputType;
+ private String dataBinding;
- public WrapperInfo(ElementInfo inputWrapperElement,
+ public WrapperInfo(String dataBinding,
+ ElementInfo inputWrapperElement,
ElementInfo outputWrapperElement,
List<ElementInfo> inputElements,
- List<ElementInfo> outputElements,
- DataType<List<DataType<QName>>> unwrappedInputType,
- DataType<QName> unwrappedOutputType) {
+ List<ElementInfo> outputElements) {
super();
+ this.dataBinding = dataBinding;
this.inputWrapperElement = inputWrapperElement;
this.outputWrapperElement = outputWrapperElement;
this.inputChildElements = inputElements;
this.outputChildElements = outputElements;
- this.unwrappedInputType = unwrappedInputType;
- this.unwrappedOutputType = unwrappedOutputType;
}
/**
@@ -96,14 +104,36 @@
/**
* @return the unwrappedInputType
*/
- public DataType<List<DataType<QName>>> getUnwrappedInputType() {
+ public DataType<List<DataType<XMLType>>> getUnwrappedInputType() {
+ if (unwrappedInputType == null) {
+ List<DataType<XMLType>> childTypes = new ArrayList<DataType<XMLType>>();
+ for (ElementInfo element : getInputChildElements()) {
+ DataType<XMLType> type = new DataType<XMLType>(dataBinding, Object.class, new XMLType(element));
+ // type.setMetadata(ElementInfo.class.getName(),
+ // getElementInfo(element));
+ childTypes.add(type);
+ }
+ unwrappedInputType =
+ new DataType<List<DataType<XMLType>>>("idl:unwrapped.input", Object[].class, childTypes);
+ }
return unwrappedInputType;
}
/**
* @return the unwrappedOutputType
*/
- public DataType<QName> getUnwrappedOutputType() {
+ public DataType<XMLType> getUnwrappedOutputType() {
+ if (unwrappedOutputType == null) {
+ List<ElementInfo> elements = getOutputChildElements();
+ if (elements != null && elements.size() > 0) {
+ if (elements.size() > 1) {
+ // We don't support output with multiple parts
+ throw new IllegalArgumentException("Multi-part output is not supported");
+ }
+ ElementInfo element = elements.get(0);
+ unwrappedOutputType = new DataType<XMLType>(dataBinding, Object.class, new XMLType(element));
+ }
+ }
return unwrappedOutputType;
}
-}
\ No newline at end of file
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org