xmlbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eric...@apache.org
Subject cvs commit: xml-xmlbeans/v2/test/src/erictest EricTest.java
Date Mon, 12 Apr 2004 21:34:34 GMT
ericvas     2004/04/12 14:34:34

  Modified:    v2/src/newstore2/org/apache/xmlbeans/impl/newstore2
                        Cursor.java Jsr173.java Public2.java
               v2/test/src/erictest EricTest.java
  Log:
  Misc changes
  
  Revision  Changes    Path
  1.17      +3 -3      xml-xmlbeans/v2/src/newstore2/org/apache/xmlbeans/impl/newstore2/Cursor.java
  
  Index: Cursor.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/newstore2/org/apache/xmlbeans/impl/newstore2/Cursor.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- Cursor.java	12 Apr 2004 20:55:13 -0000	1.16
  +++ Cursor.java	12 Apr 2004 21:34:34 -0000	1.17
  @@ -500,7 +500,7 @@
   
           try
           {
  -            save( os, options );
  +            _save( os, options );
           }
           finally
           {
  @@ -510,7 +510,7 @@
       
       public void _save ( OutputStream os, XmlOptions options ) throws IOException
       {
  -        InputStream is = newInputStream( options );
  +        InputStream is = _newInputStream( options );
   
           try
           {
  @@ -534,7 +534,7 @@
       
       public void _save ( Writer w, XmlOptions options ) throws IOException
       {
  -        Reader r = newReader( options );
  +        Reader r = _newReader( options );
   
           try
           {
  
  
  
  1.9       +34 -11    xml-xmlbeans/v2/src/newstore2/org/apache/xmlbeans/impl/newstore2/Jsr173.java
  
  Index: Jsr173.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/newstore2/org/apache/xmlbeans/impl/newstore2/Jsr173.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Jsr173.java	26 Mar 2004 23:37:27 -0000	1.8
  +++ Jsr173.java	12 Apr 2004 21:34:34 -0000	1.9
  @@ -30,8 +30,30 @@
   
   import org.apache.xmlbeans.XmlOptions;
   
  +import org.w3c.dom.Node;
  +
   public class Jsr173
   {
  +    public static Node nodeFromStream ( XMLStreamReader xs )
  +    {
  +        assert xs instanceof Jsr173GateWay;
  +
  +        Jsr173GateWay gw = (Jsr173GateWay) xs;
  +
  +        Locale l = gw._l;
  +                  
  +        if (l.noSync())         { l.enter(); try { return nodeFromStreamImpl( gw ); } finally
{ l.exit(); } }
  +        else synchronized ( l ) { l.enter(); try { return nodeFromStreamImpl( gw ); } finally
{ l.exit(); } }
  +        
  +    }
  +    
  +    public static Node nodeFromStreamImpl ( Jsr173GateWay gw )
  +    {
  +        Cur c = gw._xs.getCur();
  +
  +        return c.isNode() ? (Node) c.getDom() : (Node) null;
  +    }
  +
       public static XMLStreamReader newXmlStreamReader ( Cur c, Object src, int off, int
cch )
       {
           XMLStreamReaderBase xs = new XMLStreamReaderForString( c, src, off, cch );
  @@ -1114,10 +1136,17 @@
       //
       //
   
  -    private static final class SyncedJsr173 implements XMLStreamReader, Location, NamespaceContext
  +    private static class Jsr173GateWay
  +    {
  +        public Jsr173GateWay ( Locale l, XMLStreamReaderBase xs ) { _l = l; _xs = xs; }
  +        
  +        Locale              _l;
  +        XMLStreamReaderBase _xs;
  +    }
  +
  +    private static final class SyncedJsr173 extends Jsr173GateWay implements XMLStreamReader,
Location, NamespaceContext
       {
  -//        public SyncedJsr173 ( XMLStreamReaderBase xs ) { _xs = xs; }
  -        public SyncedJsr173 ( Locale l, XMLStreamReaderBase xs ) { _l = l; _xs = xs; }
  +        public SyncedJsr173 ( Locale l, XMLStreamReaderBase xs ) { super( l, xs ); }
           
           public Object getProperty ( java.lang.String name ) { synchronized ( _l ) { _l.enter();
try { return _xs.getProperty( name ); } finally { _l.exit(); } } }
           public int next ( ) throws XMLStreamException { synchronized ( _l ) { _l.enter();
try { return _xs.next(); } finally { _l.exit(); } } }
  @@ -1172,14 +1201,11 @@
           public String getLocationURI ( ) { synchronized ( _l ) { _l.enter(); try { return
_xs.getLocationURI(); } finally { _l.exit(); } } }
           public String getPublicId() { synchronized ( _l ) { _l.enter(); try { return _xs.getPublicId();
} finally { _l.exit(); } } }
           public String getSystemId() { synchronized ( _l ) { _l.enter(); try { return _xs.getSystemId();
} finally { _l.exit(); } } }
  -        
  -        private Locale              _l;
  -        private XMLStreamReaderBase _xs;
       }
   
  -    private static final class UnsyncedJsr173 implements XMLStreamReader, Location, NamespaceContext
  +    private static final class UnsyncedJsr173 extends Jsr173GateWay implements XMLStreamReader,
Location, NamespaceContext
       {
  -        public UnsyncedJsr173 ( Locale l, XMLStreamReaderBase xs ) { _l = l; _xs = xs;
}
  +        public UnsyncedJsr173 ( Locale l, XMLStreamReaderBase xs ) { super( l, xs ); }
           
           public Object getProperty ( java.lang.String name ) { try { _l.enter(); return
_xs.getProperty( name ); } finally { _l.exit(); } }
           public int next ( ) throws XMLStreamException { try { _l.enter(); return _xs.next();
} finally { _l.exit(); } }
  @@ -1234,9 +1260,6 @@
           public String getLocationURI ( ) { synchronized ( _l ) { _l.enter(); try { return
_xs.getLocationURI(); } finally { _l.exit(); } } }
           public String getPublicId() { synchronized ( _l ) { _l.enter(); try { return _xs.getPublicId();
} finally { _l.exit(); } } }
           public String getSystemId() { synchronized ( _l ) { _l.enter(); try { return _xs.getSystemId();
} finally { _l.exit(); } } }
  -        
  -        private Locale              _l;
  -        private XMLStreamReaderBase _xs;
       }
   }
   
  
  
  
  1.15      +5 -0      xml-xmlbeans/v2/src/newstore2/org/apache/xmlbeans/impl/newstore2/Public2.java
  
  Index: Public2.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/newstore2/org/apache/xmlbeans/impl/newstore2/Public2.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- Public2.java	12 Apr 2004 20:55:13 -0000	1.14
  +++ Public2.java	12 Apr 2004 21:34:34 -0000	1.15
  @@ -149,6 +149,11 @@
           return (Document) d;
       }
       
  +    public static Node getNode ( XMLStreamReader s )
  +    {
  +        return Jsr173.nodeFromStream( s );
  +    }
  +    
       public static XMLStreamReader getStream ( Node n )
       {
           assert n instanceof Dom;
  
  
  
  1.46      +10 -3     xml-xmlbeans/v2/test/src/erictest/EricTest.java
  
  Index: EricTest.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/test/src/erictest/EricTest.java,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- EricTest.java	12 Apr 2004 20:55:13 -0000	1.45
  +++ EricTest.java	12 Apr 2004 21:34:34 -0000	1.46
  @@ -115,10 +115,17 @@
       {
           Document doc = Public2.parse( "<a><b id='1'/><b id='2'/></a>"
);
   
  -        Cache cache = new Cache( doc, new QName( "id" ) );
  +        XMLStreamReader xs = Public2.getStream( doc );
   
  -        Public2.dump( cache.lookup( "1" ) );
  -        Public2.dump( cache.lookup( "2" ) );
  +        xs.next();
  +        xs.next();
  +
  +        Public2.dump( Public2.getNode( xs ) );
  +
  +//        Cache cache = new Cache( doc, new QName( "id" ) );
  +//
  +//        Public2.dump( cache.lookup( "1" ) );
  +//        Public2.dump( cache.lookup( "2" ) );
       }
   
       public static class Cache
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xmlbeans-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-cvs-help@xml.apache.org


Mime
View raw message