Author: jboynes
Date: Thu Mar 30 09:07:34 2006
New Revision: 390179

URL: http://svn.apache.org/viewcvs?rev=390179&view=rev
Log:
strawman interface for adding StAX support to SDO

Added:
    
incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/XMLStreamHelper.java
   (with props)
    
incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/XMLStreamHelperImpl.java
   (with props)
Modified:
    incubator/tuscany/java/sdo/impl/pom.xml

Modified: incubator/tuscany/java/sdo/impl/pom.xml
URL: 
http://svn.apache.org/viewcvs/incubator/tuscany/java/sdo/impl/pom.xml?rev=390179&r1=390178&r2=390179&view=diff
==============================================================================
--- incubator/tuscany/java/sdo/impl/pom.xml (original)
+++ incubator/tuscany/java/sdo/impl/pom.xml Thu Mar 30 09:07:34 2006
@@ -45,6 +45,14 @@
         </dependency>
 
         <dependency>
+            <groupId>stax</groupId>
+            <artifactId>stax-api</artifactId>
+            <version>1.0</version>
+            <!-- mark as provided to avoid adding this to the classpath for 
users that are not using StAX --> 
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
             <groupId>asm</groupId>
             <artifactId>asm</artifactId>
             <version>2.2</version>

Added: 
incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/XMLStreamHelper.java
URL: 
http://svn.apache.org/viewcvs/incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/XMLStreamHelper.java?rev=390179&view=auto
==============================================================================
--- 
incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/XMLStreamHelper.java
 (added)
+++ 
incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/XMLStreamHelper.java
 Thu Mar 30 09:07:34 2006
@@ -0,0 +1,71 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed 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.sdo;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.XMLDocument;
+
+/**
+ * Helper interface for reading and writing SDO DataObjects from XML streams.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface XMLStreamHelper {
+    /**
+     * Creates and returns an XMLDocument from an XML input stream.
+     * The reader must be positioned on a START_DOCUMENT event.
+     *
+     * @param reader the stream to read
+     * @return an XMLDocument created from the stream
+     * @throws XMLStreamException    if there was a problem reading the stream
+     * @throws IllegalStateException if the reader is not positioned on a 
START_DOCUMENT event
+     */
+    public XMLDocument load(XMLStreamReader reader) throws XMLStreamException, 
IllegalStateException;
+
+    /**
+     * Save a XMLDocument to an XML stream.
+     *
+     * @param document the document to be written
+     * @param writer   the stream to write to
+     * @throws XMLStreamException if there was a problem writing to the stream
+     */
+    public void save(XMLDocument document, XMLStreamWriter writer) throws 
XMLStreamException;
+
+    /**
+     * Create a DataObject from an element in a XML stream.
+     * The reader must be positioned on a START_ELEMENT event.
+     *
+     * @param reader the stream to read
+     * @return a DataObject created from the element in the stream
+     * @throws XMLStreamException    if there was a problem reading the stream
+     * @throws IllegalStateException if the reader is not positioned on a 
START_ELEMENT event
+     */
+    public DataObject loadObject(XMLStreamReader reader) throws 
XMLStreamException, IllegalStateException;
+
+    /**
+     * Save a DataObject to an XML stream.
+     *
+     * @param sdo    the DataObject to be written
+     * @param writer the stream to write to
+     * @throws XMLStreamException if there was a problem writing to the stream
+     */
+    public void saveObject(DataObject sdo, XMLStreamWriter writer) throws 
XMLStreamException;
+}

Propchange: 
incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/XMLStreamHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/XMLStreamHelper.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: 
incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/XMLStreamHelperImpl.java
URL: 
http://svn.apache.org/viewcvs/incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/XMLStreamHelperImpl.java?rev=390179&view=auto
==============================================================================
--- 
incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/XMLStreamHelperImpl.java
 (added)
+++ 
incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/XMLStreamHelperImpl.java
 Thu Mar 30 09:07:34 2006
@@ -0,0 +1,47 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed 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.sdo.helper;
+
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import commonj.sdo.helper.XMLDocument;
+import commonj.sdo.DataObject;
+
+import org.apache.tuscany.sdo.XMLStreamHelper;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class XMLStreamHelperImpl implements XMLStreamHelper {
+    public XMLDocument load(XMLStreamReader reader) throws XMLStreamException, 
IllegalStateException {
+        throw new UnsupportedOperationException();
+    }
+
+    public void save(XMLDocument document, XMLStreamWriter writer) throws 
XMLStreamException {
+        throw new UnsupportedOperationException();
+    }
+
+    public DataObject loadObject(XMLStreamReader reader) throws 
XMLStreamException, IllegalStateException {
+        throw new UnsupportedOperationException();
+    }
+
+    public void saveObject(DataObject sdo, XMLStreamWriter writer) throws 
XMLStreamException {
+        throw new UnsupportedOperationException();
+    }
+}

Propchange: 
incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/XMLStreamHelperImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/helper/XMLStreamHelperImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date


Reply via email to