tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From meer...@apache.org
Subject svn commit: r514132 - in /incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/marshaller: ./ java/
Date Sat, 03 Mar 2007 11:36:04 GMT
Author: meerajk
Date: Sat Mar  3 03:36:03 2007
New Revision: 514132

URL: http://svn.apache.org/viewvc?view=rev&rev=514132
Log:
Added implementation for unmarshalling Java physical service and reference definitions

Modified:
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/marshaller/PhysicalOperationDefinitionMarshaller.java
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/marshaller/PhysicalWireDefinitionMarshaller.java
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/marshaller/java/JavaPhysicalReferenceDefinitionMarshaller.java
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/marshaller/java/JavaPhysicalServiceDefinitionMarshaller.java

Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/marshaller/PhysicalOperationDefinitionMarshaller.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/marshaller/PhysicalOperationDefinitionMarshaller.java?view=diff&rev=514132&r1=514131&r2=514132
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/marshaller/PhysicalOperationDefinitionMarshaller.java
(original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/marshaller/PhysicalOperationDefinitionMarshaller.java
Sat Mar  3 03:36:03 2007
@@ -32,7 +32,7 @@
  */
 public class PhysicalOperationDefinitionMarshaller extends AbstractMarshallerExtension<PhysicalOperationDefinition>
{
 
-    // Source URI attribute
+    // Source name attribute
     private static final String NAME = "name";
 
     // QName for the root element

Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/marshaller/PhysicalWireDefinitionMarshaller.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/marshaller/PhysicalWireDefinitionMarshaller.java?view=diff&rev=514132&r1=514131&r2=514132
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/marshaller/PhysicalWireDefinitionMarshaller.java
(original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/marshaller/PhysicalWireDefinitionMarshaller.java
Sat Mar  3 03:36:03 2007
@@ -30,6 +30,7 @@
 import javax.xml.stream.XMLStreamWriter;
 
 import org.apache.tuscany.spi.marshaller.MarshallException;
+import org.apache.tuscany.spi.model.ModelObject;
 import org.apache.tuscany.spi.model.physical.PhysicalOperationDefinition;
 import org.apache.tuscany.spi.model.physical.PhysicalWireDefinition;
 
@@ -68,10 +69,8 @@
             while (true) {
                 switch (reader.next()) {
                     case START_ELEMENT:
-                        // Marshall the operation definitions
-                        PhysicalOperationDefinition operation =
-                            (PhysicalOperationDefinition)registry.unmarshall(reader);
-                        wireDefinition.addOperation(operation);
+                        ModelObject modelObject = registry.unmarshall(reader);
+                        wireDefinition.addOperation((PhysicalOperationDefinition)modelObject);
                         break;
                     case END_ELEMENT:
                         return wireDefinition;

Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/marshaller/java/JavaPhysicalReferenceDefinitionMarshaller.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/marshaller/java/JavaPhysicalReferenceDefinitionMarshaller.java?view=diff&rev=514132&r1=514131&r2=514132
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/marshaller/java/JavaPhysicalReferenceDefinitionMarshaller.java
(original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/marshaller/java/JavaPhysicalReferenceDefinitionMarshaller.java
Sat Mar  3 03:36:03 2007
@@ -18,13 +18,19 @@
  */
 package org.apache.tuscany.core.marshaller.java;
 
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
 import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
 
 import org.apache.tuscany.core.marshaller.AbstractMarshallerExtension;
 import org.apache.tuscany.core.model.physical.java.JavaPhysicalReferenceDefinition;
 import org.apache.tuscany.spi.marshaller.MarshallException;
+import org.apache.tuscany.spi.model.ModelObject;
+import org.apache.tuscany.spi.model.physical.PhysicalOperationDefinition;
 
 /**
  * Marshaller for java physical reference definition.
@@ -33,6 +39,12 @@
  */
 public class JavaPhysicalReferenceDefinitionMarshaller extends AbstractMarshallerExtension<JavaPhysicalReferenceDefinition>
{
 
+    // Local part for operation
+    private static final String OPERATION = "operation";
+    
+    // Source name attribute
+    private static final String NAME = "name";
+    
     // QName for the root element
     private static final QName QNAME = new QName("http://tuscany.apache.org/xmlns/marshaller/reference/java/1.0-SNAPSHOT",
"service");
 
@@ -47,7 +59,28 @@
      * Unmarshalls a java physical reference definition from the xml reader.
      */
     public JavaPhysicalReferenceDefinition unmarshall(XMLStreamReader reader) throws MarshallException
{
-        throw new UnsupportedOperationException();
+        
+        try {
+            JavaPhysicalReferenceDefinition referenceDefinition = new JavaPhysicalReferenceDefinition();
+            referenceDefinition.setName(reader.getAttributeValue(null, NAME));
+            while (true) {
+                switch (reader.next()) {
+                    case START_ELEMENT:
+                        ModelObject modelObject = registry.unmarshall(reader);
+                        String name = reader.getName().getLocalPart();
+                        if(OPERATION.equals(name)) {
+                            referenceDefinition.addOperation((PhysicalOperationDefinition)modelObject);
+                        }
+                        break;
+                    case END_ELEMENT:
+                        return referenceDefinition;
+
+                }
+            }
+        } catch (XMLStreamException ex) {
+            throw new MarshallException(ex);
+        }
+        
     }
 
     @Override

Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/marshaller/java/JavaPhysicalServiceDefinitionMarshaller.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/marshaller/java/JavaPhysicalServiceDefinitionMarshaller.java?view=diff&rev=514132&r1=514131&r2=514132
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/marshaller/java/JavaPhysicalServiceDefinitionMarshaller.java
(original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/marshaller/java/JavaPhysicalServiceDefinitionMarshaller.java
Sat Mar  3 03:36:03 2007
@@ -18,13 +18,19 @@
  */
 package org.apache.tuscany.core.marshaller.java;
 
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
 import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
 
 import org.apache.tuscany.core.marshaller.AbstractMarshallerExtension;
 import org.apache.tuscany.core.model.physical.java.JavaPhysicalServiceDefinition;
 import org.apache.tuscany.spi.marshaller.MarshallException;
+import org.apache.tuscany.spi.model.ModelObject;
+import org.apache.tuscany.spi.model.physical.PhysicalOperationDefinition;
 
 /**
  * Marshaller for java physical service definition.
@@ -33,6 +39,12 @@
  */
 public class JavaPhysicalServiceDefinitionMarshaller extends AbstractMarshallerExtension<JavaPhysicalServiceDefinition>
{
 
+    // Local part for operation
+    private static final String OPERATION = "operation";
+    
+    // Source name attribute
+    private static final String NAME = "name";
+    
     // QName for the root element
     private static final QName QNAME = new QName("http://tuscany.apache.org/xmlns/marshaller/service/java/1.0-SNAPSHOT",
"service");
 
@@ -47,7 +59,28 @@
      * Unmarshalls a java physical service definition from the xml reader.
      */
     public JavaPhysicalServiceDefinition unmarshall(XMLStreamReader reader) throws MarshallException
{
-        throw new UnsupportedOperationException();
+        
+        try {
+            JavaPhysicalServiceDefinition serviceDefinition = new JavaPhysicalServiceDefinition();
+            serviceDefinition.setName(reader.getAttributeValue(null, NAME));
+            while (true) {
+                switch (reader.next()) {
+                    case START_ELEMENT:
+                        ModelObject modelObject = registry.unmarshall(reader);
+                        String name = reader.getName().getLocalPart();
+                        if(OPERATION.equals(name)) {
+                            serviceDefinition.addOperation((PhysicalOperationDefinition)modelObject);
+                        }
+                        break;
+                    case END_ELEMENT:
+                        return serviceDefinition;
+
+                }
+            }
+        } catch (XMLStreamException ex) {
+            throw new MarshallException(ex);
+        }
+        
     }
 
     @Override



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org


Mime
View raw message