You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2016/03/03 23:40:53 UTC

svn commit: r1733532 - in /webservices/axiom/branches/stax-stream/aspects: core-aspects/src/main/java/org/apache/axiom/core/stream/stax/ om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/ om-aspects/src/main/java/org/apache/axiom/om/impl/stream/s...

Author: veithen
Date: Thu Mar  3 22:40:53 2016
New Revision: 1733532

URL: http://svn.apache.org/viewvc?rev=1733532&view=rev
Log:
Add support for the various XMLStreamReader extensions defined by the Axiom API.

Added:
    webservices/axiom/branches/stax-stream/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/stax/InternalXMLStreamReader.java   (with props)
    webservices/axiom/branches/stax-stream/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/stax/XMLStreamReaderExtensionFactory.java   (with props)
    webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/stream/stax/AxiomXMLStreamReaderExtensionFactory.java   (with props)
    webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/stream/stax/CharacterDataReaderImpl.java   (with props)
    webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/stream/stax/DTDReaderImpl.java   (with props)
    webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/stream/stax/DataHandlerReaderImpl.java   (with props)
Modified:
    webservices/axiom/branches/stax-stream/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/stax/StAXPivot.java
    webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomContainerSupport.aj

Added: webservices/axiom/branches/stax-stream/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/stax/InternalXMLStreamReader.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/stax-stream/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/stax/InternalXMLStreamReader.java?rev=1733532&view=auto
==============================================================================
--- webservices/axiom/branches/stax-stream/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/stax/InternalXMLStreamReader.java (added)
+++ webservices/axiom/branches/stax-stream/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/stax/InternalXMLStreamReader.java Thu Mar  3 22:40:53 2016
@@ -0,0 +1,28 @@
+/*
+ * 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.core.stream.stax;
+
+import javax.xml.stream.XMLStreamReader;
+
+public interface InternalXMLStreamReader extends XMLStreamReader {
+    String getRootName();
+    String getPublicId();
+    String getSystemId();
+    Object getCharacterData();
+}

Propchange: webservices/axiom/branches/stax-stream/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/stax/InternalXMLStreamReader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axiom/branches/stax-stream/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/stax/StAXPivot.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/stax-stream/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/stax/StAXPivot.java?rev=1733532&r1=1733531&r2=1733532&view=diff
==============================================================================
--- webservices/axiom/branches/stax-stream/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/stax/StAXPivot.java (original)
+++ webservices/axiom/branches/stax-stream/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/stax/StAXPivot.java Thu Mar  3 22:40:53 2016
@@ -18,7 +18,9 @@
  */
 package org.apache.axiom.core.stream.stax;
 
+import java.util.HashMap;
 import java.util.Iterator;
+import java.util.Map;
 import java.util.NoSuchElementException;
 
 import javax.xml.XMLConstants;
@@ -33,7 +35,7 @@ import org.apache.axiom.core.stream.XmlH
 import org.apache.axiom.core.stream.XmlReader;
 import org.apache.axiom.core.stream.util.CharacterDataAccumulator;
 
-public final class StAXPivot implements XMLStreamReader, XmlHandler {
+public final class StAXPivot implements InternalXMLStreamReader, XmlHandler {
     private class NamespaceContextImpl implements NamespaceContext {
         @Override
         public String getNamespaceURI(String prefix) {
@@ -137,7 +139,9 @@ public final class StAXPivot implements
      */
     private static final int STATE_SKIP_CONTENT = 4;
     
+    private final XMLStreamReaderExtensionFactory extensionFactory;
     private XmlReader reader;
+    private Map<String,Object> extensions;
     private int state = STATE_DEFAULT;
     private int eventType = -1;
     private int depth;
@@ -155,10 +159,14 @@ public final class StAXPivot implements
     private String rootName;
     private String publicId;
     private String systemId;
-    private String text;
+    private Object text;
     // Entity reference name or processing instruction target
     private String name;
     
+    public StAXPivot(XMLStreamReaderExtensionFactory extensionFactory) {
+        this.extensionFactory = extensionFactory;
+    }
+
     private static String emptyToNull(String value) {
         return value == null || value.isEmpty() ? null : value;
     }
@@ -294,7 +302,7 @@ public final class StAXPivot implements
         } else {
             checkState();
             eventType = ignorable ? SPACE : CHARACTERS;
-            text = data.toString();
+            text = data;
             state = STATE_EVENT_COMPLETE;
         }
     }
@@ -354,7 +362,22 @@ public final class StAXPivot implements
 
     @Override
     public Object getProperty(String name) throws IllegalArgumentException {
-        // TODO Auto-generated method stub
+        if (extensions != null) {
+            Object extension = extensions.get(name);
+            if (extension != null) {
+                return extension;
+            }
+        }
+        if (extensionFactory != null) {
+            Object extension = extensionFactory.createExtension(name, this);
+            if (extension != null) {
+                if (extensions == null) {
+                    extensions = new HashMap<String,Object>();
+                }
+                extensions.put(name, extension);
+                return extension;
+            }
+        }
         return null;
     }
 
@@ -486,6 +509,7 @@ public final class StAXPivot implements
                 // points to a character data event that consists of all whitespace". This
                 // means that this method may return true for a CHARACTER event and we need
                 // to scan the text of the node.
+                String text = this.text.toString();
                 for (int i=0; i<text.length(); i++) {
                     char c = text.charAt(i);
                     if (c != ' ' && c != '\t' && c != '\r' && c != '\n') {
@@ -642,7 +666,7 @@ public final class StAXPivot implements
             case COMMENT:
             case DTD:
             case ENTITY_REFERENCE:
-                return text;
+                return text == null ? null : text.toString();
             default:
                 throw new IllegalStateException();
         }
@@ -655,7 +679,8 @@ public final class StAXPivot implements
             case CDATA:
             case SPACE:
             case COMMENT:
-                return text.toCharArray();
+                // TODO: optimize this
+                return text.toString().toCharArray();
             default:
                 throw new IllegalStateException();
         }
@@ -688,7 +713,8 @@ public final class StAXPivot implements
             case CDATA:
             case SPACE:
             case COMMENT:
-                return text.length();
+                // TODO: optimize this
+                return text.toString().length();
             default:
                 throw new IllegalStateException();
         }
@@ -777,9 +803,29 @@ public final class StAXPivot implements
     @Override
     public String getPIData() {
         if (eventType == PROCESSING_INSTRUCTION) {
-            return text;
+            return text.toString();
         } else {
             throw new IllegalStateException();
         }
     }
+
+    @Override
+    public String getRootName() {
+        return rootName;
+    }
+
+    @Override
+    public String getPublicId() {
+        return publicId;
+    }
+
+    @Override
+    public String getSystemId() {
+        return systemId;
+    }
+
+    @Override
+    public Object getCharacterData() {
+        return text;
+    }
 }

Added: webservices/axiom/branches/stax-stream/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/stax/XMLStreamReaderExtensionFactory.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/stax-stream/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/stax/XMLStreamReaderExtensionFactory.java?rev=1733532&view=auto
==============================================================================
--- webservices/axiom/branches/stax-stream/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/stax/XMLStreamReaderExtensionFactory.java (added)
+++ webservices/axiom/branches/stax-stream/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/stax/XMLStreamReaderExtensionFactory.java Thu Mar  3 22:40:53 2016
@@ -0,0 +1,23 @@
+/*
+ * 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.core.stream.stax;
+
+public interface XMLStreamReaderExtensionFactory {
+    Object createExtension(String propertyName, InternalXMLStreamReader reader);
+}

Propchange: webservices/axiom/branches/stax-stream/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/stax/XMLStreamReaderExtensionFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomContainerSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomContainerSupport.aj?rev=1733532&r1=1733531&r2=1733532&view=diff
==============================================================================
--- webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomContainerSupport.aj (original)
+++ webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomContainerSupport.aj Thu Mar  3 22:40:53 2016
@@ -68,6 +68,7 @@ import org.apache.axiom.om.impl.common.s
 import org.apache.axiom.om.impl.intf.AxiomChildNode;
 import org.apache.axiom.om.impl.intf.AxiomContainer;
 import org.apache.axiom.om.impl.intf.OMFactoryEx;
+import org.apache.axiom.om.impl.stream.stax.AxiomXMLStreamReaderExtensionFactory;
 import org.apache.axiom.om.util.OMXMLStreamReaderValidator;
 import org.apache.axiom.om.util.StAXUtils;
 import org.apache.commons.logging.Log;
@@ -126,7 +127,7 @@ public aspect AxiomContainerSupport {
 //        
 //        return reader;
         
-        StAXPivot pivot = new StAXPivot();
+        StAXPivot pivot = new StAXPivot(AxiomXMLStreamReaderExtensionFactory.INSTANCE);
         try {
             pivot.setReader(coreGetReader(pivot, cache));
         } catch (StreamException ex) {

Added: webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/stream/stax/AxiomXMLStreamReaderExtensionFactory.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/stream/stax/AxiomXMLStreamReaderExtensionFactory.java?rev=1733532&view=auto
==============================================================================
--- webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/stream/stax/AxiomXMLStreamReaderExtensionFactory.java (added)
+++ webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/stream/stax/AxiomXMLStreamReaderExtensionFactory.java Thu Mar  3 22:40:53 2016
@@ -0,0 +1,44 @@
+/*
+ * 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.stream.stax;
+
+import org.apache.axiom.core.stream.stax.InternalXMLStreamReader;
+import org.apache.axiom.core.stream.stax.XMLStreamReaderExtensionFactory;
+import org.apache.axiom.ext.stax.CharacterDataReader;
+import org.apache.axiom.ext.stax.DTDReader;
+import org.apache.axiom.ext.stax.datahandler.DataHandlerReader;
+
+public final class AxiomXMLStreamReaderExtensionFactory implements XMLStreamReaderExtensionFactory {
+    public static final AxiomXMLStreamReaderExtensionFactory INSTANCE = new AxiomXMLStreamReaderExtensionFactory();
+
+    private AxiomXMLStreamReaderExtensionFactory() {}
+    
+    @Override
+    public Object createExtension(String propertyName, InternalXMLStreamReader reader) {
+        if (propertyName.equals(DataHandlerReader.PROPERTY)) {
+            return new DataHandlerReaderImpl(reader);
+        } else if (propertyName.equals(DTDReader.PROPERTY)) {
+            return new DTDReaderImpl(reader);
+        } else if (propertyName.equals(CharacterDataReader.PROPERTY)) {
+            return new CharacterDataReaderImpl(reader);
+        } else {
+            return null;
+        }
+    }
+}

Propchange: webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/stream/stax/AxiomXMLStreamReaderExtensionFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/stream/stax/CharacterDataReaderImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/stream/stax/CharacterDataReaderImpl.java?rev=1733532&view=auto
==============================================================================
--- webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/stream/stax/CharacterDataReaderImpl.java (added)
+++ webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/stream/stax/CharacterDataReaderImpl.java Thu Mar  3 22:40:53 2016
@@ -0,0 +1,59 @@
+/*
+ * 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.stream.stax;
+
+import java.io.IOException;
+import java.io.Writer;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.axiom.core.CharacterData;
+import org.apache.axiom.core.stream.stax.InternalXMLStreamReader;
+import org.apache.axiom.ext.stax.CharacterDataReader;
+
+final class CharacterDataReaderImpl implements CharacterDataReader {
+    private final InternalXMLStreamReader reader;
+
+    CharacterDataReaderImpl(InternalXMLStreamReader reader) {
+        this.reader = reader;
+    }
+
+    @Override
+    public void writeTextTo(Writer writer) throws XMLStreamException, IOException {
+        switch (reader.getEventType()) {
+            case XMLStreamReader.CHARACTERS:
+                Object data = reader.getCharacterData();
+                if (data instanceof CharacterData) {
+                    ((CharacterData)data).writeTo(writer);
+                } else {
+                    writer.write(data.toString());
+                }
+                break;
+            case XMLStreamReader.CDATA:
+            case XMLStreamReader.SPACE:
+            case XMLStreamReader.COMMENT:
+                // TODO: optimize this for CDATA and COMMENT
+                writer.write(reader.getText());
+                break;
+            default:
+                throw new IllegalStateException();
+        }
+    }
+}

Propchange: webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/stream/stax/CharacterDataReaderImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/stream/stax/DTDReaderImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/stream/stax/DTDReaderImpl.java?rev=1733532&view=auto
==============================================================================
--- webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/stream/stax/DTDReaderImpl.java (added)
+++ webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/stream/stax/DTDReaderImpl.java Thu Mar  3 22:40:53 2016
@@ -0,0 +1,59 @@
+/*
+ * 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.stream.stax;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.axiom.core.stream.stax.InternalXMLStreamReader;
+import org.apache.axiom.ext.stax.DTDReader;
+
+final class DTDReaderImpl implements DTDReader {
+    private final InternalXMLStreamReader reader;
+
+    DTDReaderImpl(InternalXMLStreamReader reader) {
+        this.reader = reader;
+    }
+
+    @Override
+    public String getRootName() {
+        if (reader.getEventType() == XMLStreamReader.DTD) {
+            return reader.getRootName();
+        } else {
+            throw new IllegalStateException();
+        }
+    }
+
+    @Override
+    public String getPublicId() {
+        if (reader.getEventType() == XMLStreamReader.DTD) {
+            return reader.getPublicId();
+        } else {
+            throw new IllegalStateException();
+        }
+    }
+
+    @Override
+    public String getSystemId() {
+        if (reader.getEventType() == XMLStreamReader.DTD) {
+            return reader.getSystemId();
+        } else {
+            throw new IllegalStateException();
+        }
+    }
+}

Propchange: webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/stream/stax/DTDReaderImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/stream/stax/DataHandlerReaderImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/stream/stax/DataHandlerReaderImpl.java?rev=1733532&view=auto
==============================================================================
--- webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/stream/stax/DataHandlerReaderImpl.java (added)
+++ webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/stream/stax/DataHandlerReaderImpl.java Thu Mar  3 22:40:53 2016
@@ -0,0 +1,71 @@
+/*
+ * 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.stream.stax;
+
+import javax.activation.DataHandler;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.axiom.core.stream.stax.InternalXMLStreamReader;
+import org.apache.axiom.ext.stax.datahandler.DataHandlerProvider;
+import org.apache.axiom.ext.stax.datahandler.DataHandlerReader;
+import org.apache.axiom.om.impl.intf.TextContent;
+
+final class DataHandlerReaderImpl implements DataHandlerReader {
+    private final InternalXMLStreamReader reader;
+
+    DataHandlerReaderImpl(InternalXMLStreamReader reader) {
+        this.reader = reader;
+    }
+
+    @Override
+    public boolean isBinary() {
+        if (reader.getEventType() == XMLStreamReader.CHARACTERS) {
+            Object data = reader.getCharacterData();
+            return data instanceof TextContent && ((TextContent)data).isBinary();
+        } else {
+            return false;
+        }
+    }
+
+    @Override
+    public boolean isOptimized() {
+        return ((TextContent)reader.getCharacterData()).isOptimize();
+    }
+
+    @Override
+    public boolean isDeferred() {
+        return ((TextContent)reader.getCharacterData()).getDataHandlerObject() instanceof DataHandlerProvider;
+    }
+
+    @Override
+    public String getContentID() {
+        return ((TextContent)reader.getCharacterData()).getContentID();
+    }
+
+    @Override
+    public DataHandler getDataHandler() throws XMLStreamException {
+        return ((TextContent)reader.getCharacterData()).getDataHandler();
+    }
+
+    @Override
+    public DataHandlerProvider getDataHandlerProvider() {
+        return (DataHandlerProvider)((TextContent)reader.getCharacterData()).getDataHandlerObject();
+    }
+}

Propchange: webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/stream/stax/DataHandlerReaderImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native