You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by jb...@apache.org on 2006/08/12 20:38:21 UTC
svn commit: r431065 - in
/incubator/tuscany/java/sca/spi/src/main/java/org/apache/tuscany/spi/model:
DataType.java Operation.java ServiceContract.java
Author: jboynes
Date: Sat Aug 12 11:38:21 2006
New Revision: 431065
URL: http://svn.apache.org/viewvc?rev=431065&view=rev
Log:
add abstract service contract configuration objects
Added:
incubator/tuscany/java/sca/spi/src/main/java/org/apache/tuscany/spi/model/DataType.java (with props)
incubator/tuscany/java/sca/spi/src/main/java/org/apache/tuscany/spi/model/Operation.java (with props)
Modified:
incubator/tuscany/java/sca/spi/src/main/java/org/apache/tuscany/spi/model/ServiceContract.java
Added: incubator/tuscany/java/sca/spi/src/main/java/org/apache/tuscany/spi/model/DataType.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/spi/src/main/java/org/apache/tuscany/spi/model/DataType.java?rev=431065&view=auto
==============================================================================
--- incubator/tuscany/java/sca/spi/src/main/java/org/apache/tuscany/spi/model/DataType.java (added)
+++ incubator/tuscany/java/sca/spi/src/main/java/org/apache/tuscany/spi/model/DataType.java Sat Aug 12 11:38:21 2006
@@ -0,0 +1,109 @@
+/*
+ * 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.spi.model;
+
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * 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 Class 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 semantially 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$
+ */
+public class DataType<P,L> extends ModelObject {
+ private final Class<P> physical;
+ private final L logical;
+ private final Map<String, Object> metadata = new HashMap<String, Object>();
+
+ /**
+ * 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 DataType(Class<P> physical, L logical) {
+ this.physical = physical;
+ this.logical = logical;
+ }
+
+ /**
+ * Returns the physical class used by the runtime.
+ * @return the physical class used by the runtime
+ */
+ public Class<P> getPhysical() {
+ return physical;
+ }
+
+ /**
+ * Returns the logical identifier used by the assembly.
+ * The type of this value identifies the logical type system in use. Known values are:
+ * <ul>
+ * <li>a java.lang.Class identifies a Java type by name and ClassLoader</li>
+ * <li>a javax.xml.namespace.QName identifies an XML type by local name and namespace</li>
+ * </ul>
+ * @return the logical type name
+ */
+ public L getLogical() {
+ return logical;
+ }
+
+ /**
+ * Returns all metadata about this type.
+ *
+ * @return all metadata about this type
+ */
+ public Map<String, ?> getMetadata() {
+ return metadata;
+ }
+
+ /**
+ * Returns the specified metadata item or null if not present.
+ *
+ * @param name the name of the metadata item
+ * @return the value, or null if not present
+ */
+ public Object getMetadata(String name) {
+ return metadata.get(name);
+ }
+
+ /**
+ * Sets the specified metadata value. A null value undefines it.
+ *
+ * @param name the name of the metadata item
+ * @param value the value, or null to undefine
+ * @return the old value for the item, or null if not present
+ */
+ public Object setMetadata(String name, Object value) {
+ if (value == null) {
+ return metadata.remove(name);
+ } else {
+ return metadata.put(name, value);
+ }
+ }
+}
Propchange: incubator/tuscany/java/sca/spi/src/main/java/org/apache/tuscany/spi/model/DataType.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/spi/src/main/java/org/apache/tuscany/spi/model/DataType.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/spi/src/main/java/org/apache/tuscany/spi/model/Operation.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/spi/src/main/java/org/apache/tuscany/spi/model/Operation.java?rev=431065&view=auto
==============================================================================
--- incubator/tuscany/java/sca/spi/src/main/java/org/apache/tuscany/spi/model/Operation.java (added)
+++ incubator/tuscany/java/sca/spi/src/main/java/org/apache/tuscany/spi/model/Operation.java Sat Aug 12 11:38:21 2006
@@ -0,0 +1,97 @@
+/*
+ * 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.spi.model;
+
+import java.util.List;
+
+/**
+ * Represents an operation that is part of a service contract.
+ *
+ * @version $Rev$ $Date$
+ */
+public class Operation {
+ private final String name;
+ private final DataType<?,?> returnType;
+ private final List<DataType<?,?>> parameterTypes;
+ private final List<DataType<? extends Exception, ?>> faultTypes;
+ private final boolean nonBlocking;
+
+ /**
+ * Construct an operation specifying all characteristics.
+ *
+ * @param name the name of the operation
+ * @param returnType the data type returned by the operation
+ * @param parameterTypes the data types of parameters passed to the operation
+ * @param faultTypes the data type of faults raised by the operation
+ * @param nonBlocking true if the operation is non-blocking
+ */
+ public Operation(String name,
+ DataType<?, ?> returnType,
+ List<DataType<?, ?>> parameterTypes,
+ List<DataType<? extends Exception, ?>> faultTypes,
+ boolean nonBlocking) {
+ this.name = name;
+ this.returnType = returnType;
+ this.parameterTypes = parameterTypes;
+ this.faultTypes = faultTypes;
+ this.nonBlocking = nonBlocking;
+ }
+
+ /**
+ * Returns the name of the operation.
+ * @return the name of the operation
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Returns the data type returned by the operation.
+ * @return the data type returned by the operation
+ */
+ public DataType<?, ?> getReturnType() {
+ return returnType;
+ }
+
+ /**
+ * Returns the data types of the parameters passed to the operation.
+ * @return the data types of the parameters passed to the operation
+ */
+ public List<DataType<?, ?>> getParameterTypes() {
+ return parameterTypes;
+ }
+
+ /**
+ * Returns the data types of the faults raised by the operation.
+ * @return the data types of the faults raised by the operation
+ */
+ public List<DataType<? extends Exception, ?>> getFaultTypes() {
+ return faultTypes;
+ }
+
+ /**
+ * Returns true if the operation is non-blocking.
+ * A non-blocking operation may not have completed execution at the time an invocation of the operation returns.
+ *
+ * @return true if the operation is non-blocking
+ */
+ public boolean isNonBlocking() {
+ return nonBlocking;
+ }
+}
Propchange: incubator/tuscany/java/sca/spi/src/main/java/org/apache/tuscany/spi/model/Operation.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/spi/src/main/java/org/apache/tuscany/spi/model/Operation.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/java/sca/spi/src/main/java/org/apache/tuscany/spi/model/ServiceContract.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/spi/src/main/java/org/apache/tuscany/spi/model/ServiceContract.java?rev=431065&r1=431064&r2=431065&view=diff
==============================================================================
--- incubator/tuscany/java/sca/spi/src/main/java/org/apache/tuscany/spi/model/ServiceContract.java (original)
+++ incubator/tuscany/java/sca/spi/src/main/java/org/apache/tuscany/spi/model/ServiceContract.java Sat Aug 12 11:38:21 2006
@@ -18,6 +18,8 @@
*/
package org.apache.tuscany.spi.model;
+import java.util.Map;
+
/**
* Base class representing service contract information
*
@@ -29,6 +31,8 @@
private String interfaceName;
private String callbackName;
private Class<?> callbackClass;
+ private Map<String, Operation> operations;
+ private Map<String, Operation> callbacksOperations;
protected ServiceContract() {
}
@@ -100,5 +104,21 @@
public void setCallbackClass(Class<?> callbackClass) {
this.callbackClass = callbackClass;
+ }
+
+ public Map<String, Operation> getOperations() {
+ return operations;
+ }
+
+ public void setOperations(Map<String, Operation> operations) {
+ this.operations = operations;
+ }
+
+ public Map<String, Operation> getCallbacksOperations() {
+ return callbacksOperations;
+ }
+
+ public void setCallbacksOperations(Map<String, Operation> callbacksOperations) {
+ this.callbacksOperations = callbacksOperations;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org