ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1334147 - in /webservices/axiom/branches/AXIOM-420/modules: axiom-api/src/main/java/org/apache/axiom/om/ds/ axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/
Date Fri, 04 May 2012 20:04:14 GMT
Author: veithen
Date: Fri May  4 20:04:14 2012
New Revision: 1334147

URL: http://svn.apache.org/viewvc?rev=1334147&view=rev
Log:
Some unfinished code.

Added:
    webservices/axiom/branches/AXIOM-420/modules/axiom-api/src/main/java/org/apache/axiom/om/ds/AbstractOMDataSource.java
  (with props)
    webservices/axiom/branches/AXIOM-420/modules/axiom-api/src/main/java/org/apache/axiom/om/ds/AbstractPushOMDataSource.java
  (with props)
    webservices/axiom/branches/AXIOM-420/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/PushOMBuilder.java
  (with props)
Modified:
    webservices/axiom/branches/AXIOM-420/modules/axiom-api/src/main/java/org/apache/axiom/om/ds/AbstractPullOMDataSource.java

Added: webservices/axiom/branches/AXIOM-420/modules/axiom-api/src/main/java/org/apache/axiom/om/ds/AbstractOMDataSource.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-420/modules/axiom-api/src/main/java/org/apache/axiom/om/ds/AbstractOMDataSource.java?rev=1334147&view=auto
==============================================================================
--- webservices/axiom/branches/AXIOM-420/modules/axiom-api/src/main/java/org/apache/axiom/om/ds/AbstractOMDataSource.java
(added)
+++ webservices/axiom/branches/AXIOM-420/modules/axiom-api/src/main/java/org/apache/axiom/om/ds/AbstractOMDataSource.java
Fri May  4 20:04:14 2012
@@ -0,0 +1,100 @@
+/*
+ * 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.axiom.om.ds;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
+import java.io.Writer;
+import java.util.HashMap;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.axiom.om.OMDataSourceExt;
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMOutputFormat;
+import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
+import org.apache.axiom.om.util.StAXUtils;
+
+public abstract class AbstractOMDataSource implements OMDataSourceExt {
+    private HashMap properties = null;
+
+    public final Object getProperty(String key) {
+        return properties == null ? null : properties.get(key);
+    }
+
+    public final boolean hasProperty(String key) {
+        return properties != null && properties.containsKey(key);
+    }
+
+    public final Object setProperty(String key, Object value) {
+        if (properties == null) {
+            properties = new HashMap();
+        }
+        return properties.put(key, value);
+    }
+
+    public final void serialize(OutputStream out, OMOutputFormat format) throws XMLStreamException
{
+        XMLStreamWriter writer = new MTOMXMLStreamWriter(out, format);
+        serialize(writer);
+        writer.flush();
+    }
+
+    public final void serialize(Writer writer, OMOutputFormat format) throws XMLStreamException
{
+        MTOMXMLStreamWriter xmlWriter =
+            new MTOMXMLStreamWriter(StAXUtils.createXMLStreamWriter(writer));
+        xmlWriter.setOutputFormat(format);
+        serialize(xmlWriter);
+        xmlWriter.flush();
+    }
+
+    public final byte[] getXMLBytes(String encoding) throws UnsupportedEncodingException
{
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        OMOutputFormat format = new OMOutputFormat();
+        format.setCharSetEncoding(encoding);
+        try {
+            serialize(baos, format);
+        } catch (XMLStreamException ex) {
+            throw new OMException(ex);
+        }
+        return baos.toByteArray();
+    }
+    
+    public final InputStream getXMLInputStream(String encoding) throws UnsupportedEncodingException
{
+        return new ByteArrayInputStream(getXMLBytes(encoding));
+    }
+
+    // 
+    // Default implementations that may be overridden by subclasses
+    //
+    
+    public Object getObject() {
+        return null;
+    }
+
+    public void close() {
+    }
+
+    public OMDataSourceExt copy() {
+        throw new UnsupportedOperationException();
+    }
+}

Propchange: webservices/axiom/branches/AXIOM-420/modules/axiom-api/src/main/java/org/apache/axiom/om/ds/AbstractOMDataSource.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axiom/branches/AXIOM-420/modules/axiom-api/src/main/java/org/apache/axiom/om/ds/AbstractPullOMDataSource.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-420/modules/axiom-api/src/main/java/org/apache/axiom/om/ds/AbstractPullOMDataSource.java?rev=1334147&r1=1334146&r2=1334147&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-420/modules/axiom-api/src/main/java/org/apache/axiom/om/ds/AbstractPullOMDataSource.java
(original)
+++ webservices/axiom/branches/AXIOM-420/modules/axiom-api/src/main/java/org/apache/axiom/om/ds/AbstractPullOMDataSource.java
Fri May  4 20:04:14 2012
@@ -18,101 +18,27 @@
  */
 package org.apache.axiom.om.ds;
 
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
-import java.io.Writer;
-import java.util.HashMap;
-
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
 
 import org.apache.axiom.om.OMDataSourceExt;
-import org.apache.axiom.om.OMException;
-import org.apache.axiom.om.OMOutputFormat;
-import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
 import org.apache.axiom.om.impl.serialize.StreamingOMSerializer;
-import org.apache.axiom.om.util.StAXUtils;
 
 /**
  * Base class for {@link OMDataSourceExt} implementations that can easily produce the content
as an
  * {@link XMLStreamReader} and that don't implement any kind of optimization for serializing
the
  * content.
  */
-public abstract class AbstractPullOMDataSource implements OMDataSourceExt {
-    private HashMap properties = null;
-
-    public final Object getProperty(String key) {
-        return properties == null ? null : properties.get(key);
-    }
-
-    public final boolean hasProperty(String key) {
-        return properties != null && properties.containsKey(key);
-    }
-
-    public final Object setProperty(String key, Object value) {
-        if (properties == null) {
-            properties = new HashMap();
-        }
-        return properties.put(key, value);
-    }
-    
+public abstract class AbstractPullOMDataSource extends AbstractOMDataSource {
     public final boolean isDestructiveWrite() {
         // Since we serialize by copying the events from the XMLStreamReader returned by
getReader(),
         // obviously write is destructive if and only if read is destructive├▒
         return isDestructiveRead();
     }
 
-    public final void serialize(OutputStream out, OMOutputFormat format) throws XMLStreamException
{
-        XMLStreamWriter writer = new MTOMXMLStreamWriter(out, format);
-        serialize(writer);
-        writer.flush();
-    }
-
-    public final void serialize(Writer writer, OMOutputFormat format) throws XMLStreamException
{
-        MTOMXMLStreamWriter xmlWriter =
-            new MTOMXMLStreamWriter(StAXUtils.createXMLStreamWriter(writer));
-        xmlWriter.setOutputFormat(format);
-        serialize(xmlWriter);
-        xmlWriter.flush();
-    }
-
     public final void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException {
         StreamingOMSerializer serializer = new StreamingOMSerializer();
         serializer.serialize(getReader(), xmlWriter);
     }
-
-    public final byte[] getXMLBytes(String encoding) throws UnsupportedEncodingException
{
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        OMOutputFormat format = new OMOutputFormat();
-        format.setCharSetEncoding(encoding);
-        try {
-            serialize(baos, format);
-        } catch (XMLStreamException ex) {
-            throw new OMException(ex);
-        }
-        return baos.toByteArray();
-    }
-    
-    public final InputStream getXMLInputStream(String encoding) throws UnsupportedEncodingException
{
-        return new ByteArrayInputStream(getXMLBytes(encoding));
-    }
-
-    // 
-    // Default implementations that may be overridden by subclasses
-    //
-    
-    public Object getObject() {
-        return null;
-    }
-
-    public void close() {
-    }
-
-    public OMDataSourceExt copy() {
-        throw new UnsupportedOperationException();
-    }
 }

Added: webservices/axiom/branches/AXIOM-420/modules/axiom-api/src/main/java/org/apache/axiom/om/ds/AbstractPushOMDataSource.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-420/modules/axiom-api/src/main/java/org/apache/axiom/om/ds/AbstractPushOMDataSource.java?rev=1334147&view=auto
==============================================================================
--- webservices/axiom/branches/AXIOM-420/modules/axiom-api/src/main/java/org/apache/axiom/om/ds/AbstractPushOMDataSource.java
(added)
+++ webservices/axiom/branches/AXIOM-420/modules/axiom-api/src/main/java/org/apache/axiom/om/ds/AbstractPushOMDataSource.java
Fri May  4 20:04:14 2012
@@ -0,0 +1,41 @@
+/*
+ * 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.axiom.om.ds;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.axiom.om.OMDataSourceExt;
+
+/**
+ * Base class for {@link OMDataSourceExt} implementations that can easily serialize the content
to
+ * an {@link XMLStreamWriter} but that are unable to produce the content as an
+ * {@link XMLStreamReader}.
+ */
+public abstract class AbstractPushOMDataSource extends AbstractOMDataSource {
+    public final boolean isDestructiveRead() {
+        return isDestructiveWrite();
+    }
+
+    public XMLStreamReader getReader() throws XMLStreamException {
+        // TODO: returning null here for the moment; for completeness we should serialize
to a byte stream and create an XMLStreamReader from it
+        return null;
+    }
+}

Propchange: webservices/axiom/branches/AXIOM-420/modules/axiom-api/src/main/java/org/apache/axiom/om/ds/AbstractPushOMDataSource.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axiom/branches/AXIOM-420/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/PushOMBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-420/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/PushOMBuilder.java?rev=1334147&view=auto
==============================================================================
--- webservices/axiom/branches/AXIOM-420/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/PushOMBuilder.java
(added)
+++ webservices/axiom/branches/AXIOM-420/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/PushOMBuilder.java
Fri May  4 20:04:14 2012
@@ -0,0 +1,154 @@
+/*
+ * 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.axiom.om.impl.llom;
+
+import javax.xml.stream.XMLStreamException;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.util.stax.AbstractXMLStreamWriter;
+
+// TODO: need to seed the namespace context with the namespace context from the parent!
+public class PushOMBuilder extends AbstractXMLStreamWriter {
+    private final OMFactory factory;
+    private OMElement parent;
+    private int depth;
+    
+    public PushOMBuilder(OMSourcedElementImpl root) {
+        factory = root.getOMFactory();
+        parent = root;
+    }
+    
+    public Object getProperty(String name) throws IllegalArgumentException {
+        // TODO
+        throw new UnsupportedOperationException();
+    }
+
+    protected void doWriteStartDocument() throws XMLStreamException {
+        // Do nothing
+    }
+
+    protected void doWriteStartDocument(String encoding, String version) throws XMLStreamException
{
+        // Do nothing
+    }
+
+    protected void doWriteStartDocument(String version) throws XMLStreamException {
+        // Do nothing
+    }
+
+    protected void doWriteEndDocument() throws XMLStreamException {
+        // Do nothing
+    }
+
+    protected void doWriteDTD(String dtd) throws XMLStreamException {
+        throw new XMLStreamException("A DTD must not appear in element content");
+    }
+
+    protected void doWriteStartElement(String prefix, String localName, String namespaceURI)
+            throws XMLStreamException {
+        // TODO
+        throw new UnsupportedOperationException();
+    }
+
+    protected void doWriteStartElement(String localName) throws XMLStreamException {
+        // TODO
+        throw new UnsupportedOperationException();
+    }
+
+    protected void doWriteEndElement() throws XMLStreamException {
+        // TODO
+        throw new UnsupportedOperationException();
+    }
+
+    protected void doWriteEmptyElement(String prefix, String localName, String namespaceURI)
+            throws XMLStreamException {
+        doWriteStartElement(prefix, localName, namespaceURI);
+        doWriteEndElement();
+    }
+
+    protected void doWriteEmptyElement(String localName) throws XMLStreamException {
+        // TODO
+        throw new UnsupportedOperationException();
+    }
+
+    protected void doWriteAttribute(String prefix, String namespaceURI, String localName,
+            String value) throws XMLStreamException {
+        // TODO
+        throw new UnsupportedOperationException();
+    }
+
+    protected void doWriteAttribute(String localName, String value) throws XMLStreamException
{
+        // TODO
+        throw new UnsupportedOperationException();
+    }
+
+    protected void doWriteNamespace(String prefix, String namespaceURI) throws XMLStreamException
{
+        // TODO
+        throw new UnsupportedOperationException();
+    }
+
+    protected void doWriteDefaultNamespace(String namespaceURI) throws XMLStreamException
{
+        // TODO
+        throw new UnsupportedOperationException();
+    }
+
+    protected void doWriteCharacters(char[] text, int start, int len) throws XMLStreamException
{
+        // TODO
+        throw new UnsupportedOperationException();
+    }
+
+    protected void doWriteCharacters(String text) throws XMLStreamException {
+        // TODO
+        throw new UnsupportedOperationException();
+    }
+
+    protected void doWriteCData(String data) throws XMLStreamException {
+        // TODO
+        throw new UnsupportedOperationException();
+    }
+
+    protected void doWriteComment(String data) throws XMLStreamException {
+        // TODO
+        throw new UnsupportedOperationException();
+    }
+
+    protected void doWriteEntityRef(String name) throws XMLStreamException {
+        // TODO
+        throw new UnsupportedOperationException();
+    }
+
+    protected void doWriteProcessingInstruction(String target, String data)
+            throws XMLStreamException {
+        // TODO
+        throw new UnsupportedOperationException();
+    }
+
+    protected void doWriteProcessingInstruction(String target) throws XMLStreamException
{
+        // TODO
+        throw new UnsupportedOperationException();
+    }
+
+    public void flush() throws XMLStreamException {
+        // Do nothing
+    }
+
+    public void close() throws XMLStreamException {
+        // Do nothing
+    }
+}

Propchange: webservices/axiom/branches/AXIOM-420/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/PushOMBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message