You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by me...@apache.org on 2007/03/03 12:22:49 UTC
svn commit: r514127 - in /incubator/tuscany/java/sca/kernel:
core/src/main/java/org/apache/tuscany/core/marshaller/
spi/src/main/java/org/apache/tuscany/spi/model/physical/
Author: meerajk
Date: Sat Mar 3 03:22:48 2007
New Revision: 514127
URL: http://svn.apache.org/viewvc?view=rev&rev=514127
Log:
first cut of the model finished
Modified:
incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/marshaller/PhysicalChangeSetMarshaller.java
incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/physical/PhysicalChangeSet.java
incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/physical/PhysicalOperationDefinition.java
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/marshaller/PhysicalChangeSetMarshaller.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/marshaller/PhysicalChangeSetMarshaller.java?view=diff&rev=514127&r1=514126&r2=514127
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/marshaller/PhysicalChangeSetMarshaller.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/marshaller/PhysicalChangeSetMarshaller.java Sat Mar 3 03:22:48 2007
@@ -29,6 +29,8 @@
import org.apache.tuscany.spi.marshaller.MarshallException;
import org.apache.tuscany.spi.model.ModelObject;
import org.apache.tuscany.spi.model.physical.PhysicalChangeSet;
+import org.apache.tuscany.spi.model.physical.PhysicalComponentDefinition;
+import org.apache.tuscany.spi.model.physical.PhysicalWireDefinition;
/**
* Marshaller for physical changeset.
@@ -41,6 +43,13 @@
// QName for the root element
private static final QName QNAME = new QName("http://tuscany.apache.org/xmlns/marshaller/1.0-SNAPSHOT", "changeSet");
+ // Local part for wire
+ private static final String WIRE = "wire";
+
+ // Local part for component
+ private static final String COMPONENT = "component";
+
+
/**
* Marshalls a physical change set to the xml writer.
*/
@@ -58,9 +67,13 @@
while (true) {
switch (reader.next()) {
case START_ELEMENT:
- // Marshall the wire definitions and component definitions
ModelObject modelObject = registry.unmarshall(reader);
- changeSet.addModelObject(modelObject);
+ String name = reader.getName().getLocalPart();
+ if(COMPONENT.equals(name)) {
+ changeSet.addComponentDefinition((PhysicalComponentDefinition) modelObject);
+ } else if(WIRE.equals(name)) {
+ changeSet.addWireDefinition((PhysicalWireDefinition) modelObject);
+ }
break;
case END_ELEMENT:
return changeSet;
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/physical/PhysicalChangeSet.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/physical/PhysicalChangeSet.java?view=diff&rev=514127&r1=514126&r2=514127
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/physical/PhysicalChangeSet.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/physical/PhysicalChangeSet.java Sat Mar 3 03:22:48 2007
@@ -33,7 +33,7 @@
public class PhysicalChangeSet extends ModelObject {
// Set of physical component definitions
- private Set<PhysicalComponentDefinition> physicalComponentDefinitions = new HashSet<PhysicalComponentDefinition>();
+ private Set<PhysicalComponentDefinition> componentDefinitions = new HashSet<PhysicalComponentDefinition>();
// Set of wire definitions
private Set<PhysicalWireDefinition> wireDefinitions = new HashSet<PhysicalWireDefinition>();
@@ -42,8 +42,8 @@
* Get all the physical component definitions.
* @return Physical component definitions in the changeset.
*/
- public Set<? extends PhysicalComponentDefinition> getPhysicalComponentDefinitions() {
- return Collections.unmodifiableSet(physicalComponentDefinitions);
+ public Set<? extends PhysicalComponentDefinition> getComponentDefinitions() {
+ return Collections.unmodifiableSet(componentDefinitions);
}
/**
@@ -58,14 +58,16 @@
* Adds a physical component definition to the physical change set.
* @param physicalComponentDefinition Physical component definition.
*/
- public void addModelObject(ModelObject modelObject) {
- if(modelObject instanceof PhysicalComponentDefinition) {
- physicalComponentDefinitions.add((PhysicalComponentDefinition) modelObject);
- } else if(modelObject instanceof PhysicalWireDefinition) {
- wireDefinitions.add((PhysicalWireDefinition) modelObject);
- } else {
- throw new IllegalArgumentException("Unexpected model object " + modelObject.getClass());
- }
+ public void addComponentDefinition(PhysicalComponentDefinition componentDefinition) {
+ componentDefinitions.add(componentDefinition);
+ }
+
+ /**
+ * Adds a physical wire definition to the physical change set.
+ * @param wireDefinition Physical wire definition.
+ */
+ public void addWireDefinition(PhysicalWireDefinition wireDefinition) {
+ wireDefinitions.add(wireDefinition);
}
}
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/physical/PhysicalOperationDefinition.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/physical/PhysicalOperationDefinition.java?view=diff&rev=514127&r1=514126&r2=514127
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/physical/PhysicalOperationDefinition.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/physical/PhysicalOperationDefinition.java Sat Mar 3 03:22:48 2007
@@ -20,6 +20,8 @@
import java.util.Collections;
import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
import java.util.Set;
import org.apache.tuscany.spi.model.ModelObject;
@@ -29,11 +31,17 @@
*
* @version $Revision$ $Date$
*
- * TODO Add parameters, return types and fault types
+ * TODO Discuss with Jeremy/Jim on how to model MEPs, INOUT parameters, faults etc
*
*/
public class PhysicalOperationDefinition extends ModelObject {
+ // Parameters
+ private List<Class<?>> parameterTypes = new LinkedList<Class<?>>();
+
+ // Return
+ private Class<?> returnType;
+
// Name of the operation
private String name;
@@ -42,6 +50,38 @@
// Interceptors defined against the operation
private Set<PhysicalInterceptorDefinition> interceptors = new HashSet<PhysicalInterceptorDefinition>();
+
+ /**
+ * Returns the parameter types for this operation.
+ * @return Parameter types.
+ */
+ public List<Class<?>> getParameters() {
+ return Collections.unmodifiableList(parameterTypes);
+ }
+
+ /**
+ * Adds a parameter type.
+ * @param parameter Parameter type to be added.
+ */
+ public void addParameter(Class<?> parameter) {
+ parameterTypes.add(parameter);
+ }
+
+ /**
+ * Gets the return type for this operation.
+ * @return Return type for this operation.
+ */
+ public Class<?> getReturnType() {
+ return returnType;
+ }
+
+ /**
+ * Sets the return type for this operation.
+ * @param returnType Return type for this operation.
+ */
+ public void setReturnType(Class<?> returnType) {
+ this.returnType = returnType;
+ }
/**
* Returns the interceptor definitions available for this operation.
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org