← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1891: Trimmed xmlreader and xmlwriter methods in XMLPipe so as to only implement required functionality.

 

------------------------------------------------------------
revno: 1891
committer: Bob Jolliffe <bobj@bobj-laptop>
branch nick: trunk
timestamp: Fri 2010-05-21 14:31:42 +0100
message:
  Trimmed xmlreader and xmlwriter methods in XMLPipe so as to only implement required functionality.
modified:
  dhis-2/dhis-services/dhis-service-xml/src/main/java/org/amplecode/staxwax/framework/XMLPipe.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-xml/src/main/java/org/amplecode/staxwax/framework/XMLPipe.java'
--- dhis-2/dhis-services/dhis-service-xml/src/main/java/org/amplecode/staxwax/framework/XMLPipe.java	2010-02-22 09:37:31 +0000
+++ dhis-2/dhis-services/dhis-service-xml/src/main/java/org/amplecode/staxwax/framework/XMLPipe.java	2010-05-21 13:31:42 +0000
@@ -47,6 +47,8 @@
  * 
  * The input of the pipe looks like an XMLEventWriter and can be used as a
  * Result of a transformation.
+ *
+ * Only minimal required methods of XMLReader and XMLWriter are implemented.
  * 
  * @author bobj
  * @version created 08-Dec-2009
@@ -69,15 +71,6 @@
         return output;
     }
 
-    public boolean inputClosed()
-    {
-        return ((PipeReader) input).isClosed();
-    }
-
-    public boolean outputClosed()
-    {
-        return ((PipeWriter) input).isClosed();
-    }
 
     public int getEventCount()
     {
@@ -99,17 +92,6 @@
     private class PipeReader
         implements XMLEventReader2
     {
-        protected boolean closed;
-
-        public boolean isClosed()
-        {
-            return closed;
-        }
-
-        PipeReader()
-        {
-            closed = false;
-        }
 
         // ------------------- XMLEventReader methods ------------------
         @Override
@@ -172,70 +154,56 @@
         public XMLEvent nextTag()
             throws XMLStreamException
         {
-            XMLEvent ev = null;
-            while ( !ev.isEndElement() && !ev.isStartElement() )
-            {
-                ev = nextEvent();
-                if ( ev.getEventType() != XMLEvent.SPACE )
-                {
-                    throw new XMLStreamException( "XMLPipe nextTag() problem" );
-                }
-            }
-            return ev;
+            throw new UnsupportedOperationException("Unused functionality.  Not implemented" );
+
         }
 
         @Override
         public Object getProperty( String name )
             throws IllegalArgumentException
         {
-            throw new UnsupportedOperationException( "Not supported yet." );
+            throw new UnsupportedOperationException("Unused functionality.  Not implemented" );
         }
 
         @Override
         public void close()
             throws XMLStreamException
         {
-            closed = true;
-            // TODO: think about emptying eventq?
-            return;
+            throw new UnsupportedOperationException("Unused functionality.  Not implemented" );
+//            closed = true;
+//            // TODO: think about emptying eventq?
+//            return;
         }
 
         @Override
         public Object next()
         {
-            if ( !this.hasNext() )
-            {
-                throw new NoSuchElementException();
-            }
-            else
-            {
-                return this.next();
-            }
+            throw new UnsupportedOperationException("Unused functionality.  Not implemented" );
         }
 
         @Override
         public void remove()
         {
-            throw new UnsupportedOperationException( "Not supported yet." );
+            throw new UnsupportedOperationException("Unused functionality.  Not implemented" );
         }
 
         @Override
         public boolean hasNextEvent()
             throws XMLStreamException
         {
-            throw new UnsupportedOperationException( "Not supported yet." );
+            throw new UnsupportedOperationException("Unused functionality.  Not implemented" );
         }
 
         @Override
         public boolean isPropertySupported( String string )
         {
-            throw new UnsupportedOperationException( "Not supported yet." );
+            throw new UnsupportedOperationException("Unused functionality.  Not implemented" );
         }
 
         @Override
         public boolean setProperty( String string, Object o )
         {
-            throw new UnsupportedOperationException( "Not supported yet." );
+            throw new UnsupportedOperationException("Unused functionality.  Not implemented" );
         }
     };
 
@@ -243,18 +211,6 @@
         implements XMLEventWriter
     {
 
-        protected boolean closed;
-
-        public boolean isClosed()
-        {
-            return closed;
-        }
-
-        PipeWriter()
-        {
-            closed = false;
-        }
-
         // ---------------------------------------------------------------------
         // XMLEventWriter methods
         // ---------------------------------------------------------------------
@@ -288,42 +244,41 @@
         public String getPrefix( String uri )
             throws XMLStreamException
         {
-            throw new UnsupportedOperationException( "Not supported yet." );
+            throw new UnsupportedOperationException("Unused functionality.  Not implemented" );
         }
 
         @Override
         public void setPrefix( String prefix, String uri )
             throws XMLStreamException
         {
-            throw new UnsupportedOperationException( "Not supported yet." );
+            throw new UnsupportedOperationException("Unused functionality.  Not implemented" );
         }
 
         @Override
         public void setDefaultNamespace( String uri )
             throws XMLStreamException
         {
-            throw new UnsupportedOperationException( "Not supported yet." );
+            throw new UnsupportedOperationException("Unused functionality.  Not implemented" );
         }
 
         @Override
         public void setNamespaceContext( NamespaceContext context )
             throws XMLStreamException
         {
-            throw new UnsupportedOperationException( "Not supported yet." );
+            throw new UnsupportedOperationException("Unused functionality.  Not implemented" );
         }
 
         @Override
         public NamespaceContext getNamespaceContext()
         {
-            throw new UnsupportedOperationException( "Not supported yet." );
+            throw new UnsupportedOperationException("Unused functionality.  Not implemented" );
         }
 
         @Override
         public void close()
             throws XMLStreamException
         {
-            closed = true;
-            return;
+            throw new UnsupportedOperationException("Unused functionality.  Not implemented" );
         }
     };
 }