User: janb    
  Date: 02/02/19 21:33:46

  Modified:    jetty/src/main/org/mortbay/xml XmlConfiguration.java
                        XmlParser.java configure_1_0.dtd configure_1_1.dtd
                        configure_1_2.dtd
  Log:
  Updating to latest Jetty with tag JBOSS_20020220222111
  
  Revision  Changes    Path
  1.3       +79 -54    contrib/jetty/src/main/org/mortbay/xml/XmlConfiguration.java
  
  Index: XmlConfiguration.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/contrib/jetty/src/main/org/mortbay/xml/XmlConfiguration.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XmlConfiguration.java     10 Feb 2002 17:57:46 -0000      1.2
  +++ XmlConfiguration.java     20 Feb 2002 05:33:46 -0000      1.3
  @@ -1,10 +1,11 @@
   // ========================================================================
   // Copyright (c) 1999 Mort Bay Consulting (Australia) Pty. Ltd.
  -// $Id: XmlConfiguration.java,v 1.2 2002/02/10 17:57:46 olegnitz Exp $
  +// $Id: XmlConfiguration.java,v 1.3 2002/02/20 05:33:46 janb Exp $
   // ========================================================================
   
   package org.mortbay.xml;
   
  +import java.io.StringReader;
   import java.io.IOException;
   import java.lang.reflect.Array;
   import java.lang.reflect.Constructor;
  @@ -22,6 +23,7 @@
   import org.mortbay.util.Primitive;
   import org.mortbay.util.Resource;
   import org.xml.sax.SAXException;
  +import org.xml.sax.InputSource;
   
   
   /* ------------------------------------------------------------ */
  @@ -30,8 +32,7 @@
    * and uses it to configure and object by calling set, put or other
    * methods on the object.
    *
  - * @see configure.dtd
  - * @version $Id: XmlConfiguration.java,v 1.2 2002/02/10 17:57:46 olegnitz Exp $
  + * @version $Id: XmlConfiguration.java,v 1.3 2002/02/20 05:33:46 janb Exp $
    * @author Greg Wilkins (gregw)
    */
   public class XmlConfiguration
  @@ -48,10 +49,59 @@
           Long.class, Float.class, Double.class, Void.class
       };
       
  -    
       /* ------------------------------------------------------------ */
       private static XmlParser __parser;
  -    XmlParser.Node _config;
  +    private XmlParser.Node _config;
  +
  +    /* ------------------------------------------------------------ */
  +    private synchronized static void initParser()
  +        throws IOException
  +    {
  +        if (__parser!=null)
  +            return;
  +        
  +        __parser = new XmlParser();
  +        Resource 
config12Resource=Resource.newSystemResource("org/mortbay/xml/configure_1_2.dtd");
  +        Code.assertTrue(config12Resource.exists(),
  +                        "org/mortbay/xml/configure_1_2.dtd");
  +        __parser.redirectEntity
  +            ("configure.dtd",config12Resource);
  +        __parser.redirectEntity
  +            ("configure_1_2.dtd",
  +                     config12Resource);
  +        __parser.redirectEntity
  +            ("http://jetty.mortbay.org/configure_1_2.dtd";,
  +             config12Resource);
  +        __parser.redirectEntity
  +            ("-//Mort Bay Consulting//DTD Configure 1.2//EN",
  +             config12Resource);
  +        
  +        Resource 
config11Resource=Resource.newSystemResource("org/mortbay/xml/configure_1_1.dtd");
  +        Code.assertTrue(config11Resource.exists(),
  +                        "org/mortbay/xml/configure_1_1.dtd");
  +        __parser.redirectEntity
  +            ("configure_1_1.dtd",
  +             config11Resource);
  +        __parser.redirectEntity
  +            ("http://jetty.mortbay.org/configure_1_1.dtd";,
  +             config11Resource);
  +        __parser.redirectEntity
  +            ("-//Mort Bay Consulting//DTD Configure 1.1//EN",
  +             config11Resource);
  +        
  +        Resource 
config10Resource=Resource.newSystemResource("org/mortbay/xml/configure_1_0.dtd");  
  +        Code.assertTrue(config10Resource.exists(),
  +                        "org/mortbay/xml/configure_1_0.dtd");  
  +        __parser.redirectEntity
  +            ("configure_1_0.dtd",
  +             config10Resource);
  +        __parser.redirectEntity
  +            ("http://jetty.mortbay.org/configure_1_0.dtd";,
  +             config10Resource);
  +        __parser.redirectEntity
  +            ("-//Mort Bay Consulting//DTD Configure 1.0//EN",
  +             config10Resource);
  +    }
       
       /* ------------------------------------------------------------ */
       /** Constructor.
  @@ -61,59 +111,34 @@
       public XmlConfiguration(URL configuration)
           throws SAXException, IOException
       {
  -        synchronized(this.getClass())
  +        initParser();
  +        synchronized(__parser)
           {
  -            if (__parser==null)
  -            {
  -                __parser = new XmlParser();
  -                Resource config12Resource=Resource.newSystemResource
  -                    ("org/mortbay/xml/configure_1_2.dtd");
  -                Code.assertTrue(config12Resource.exists(),
  -                                "org/mortbay/xml/configure_1_2.dtd");
  -                __parser.redirectEntity
  -                    ("configure.dtd",config12Resource);
  -                __parser.redirectEntity
  -                    ("configure_1_2.dtd",
  -                     config12Resource);
  -                __parser.redirectEntity
  -                    ("http://jetty.mortbay.org/configure_1_2.dtd";,
  -                     config12Resource);
  -                __parser.redirectEntity
  -                    ("-//Mort Bay Consulting//DTD Configure 1.2//EN",
  -                     config12Resource);
  -                
  -                Resource config11Resource=Resource.newSystemResource
  -                    ("org/mortbay/xml/configure_1_1.dtd");
  -                Code.assertTrue(config11Resource.exists(),
  -                                "org/mortbay/xml/configure_1_1.dtd");
  -                __parser.redirectEntity
  -                    ("configure_1_1.dtd",
  -                     config11Resource);
  -                __parser.redirectEntity
  -                    ("http://jetty.mortbay.org/configure_1_1.dtd";,
  -                     config11Resource);
  -                __parser.redirectEntity
  -                    ("-//Mort Bay Consulting//DTD Configure 1.1//EN",
  -                     config11Resource);
  -
  -                Resource config10Resource=Resource.newSystemResource
  -                    ("org/mortbay/xml/configure_1_0.dtd");  
  -                Code.assertTrue(config10Resource.exists(),
  -                                "org/mortbay/xml/configure_1_0.dtd");  
  -                __parser.redirectEntity
  -                    ("configure_1_0.dtd",
  -                     config10Resource);
  -                __parser.redirectEntity
  -                    ("http://jetty.mortbay.org/configure_1_0.dtd";,
  -                     config10Resource);
  -                __parser.redirectEntity
  -                    ("-//Mort Bay Consulting//DTD Configure 1.0//EN",
  -                     config10Resource);
  -            }
  +            _config = __parser.parse(configuration.toString());      
           }
  -        _config = __parser.parse(configuration.toString());  
       }
  +    
   
  +    /* ------------------------------------------------------------ */
  +    /** Constructor. 
  +     * @param configuration String of XML configuration commands
  +     * excluding the normal XML preamble. The String should start with
  +     * a "<Configure ...." element.
  +     * @exception SAXException 
  +     * @exception IOException 
  +     */
  +    public XmlConfiguration(String configuration)
  +        throws SAXException, IOException
  +    {
  +        initParser();
  +        configuration="<?xml version=\"1.0\"  encoding=\"ISO-8859-1\"?>\n<!DOCTYPE 
Configure PUBLIC \"-//Mort Bay Consulting//DTD Configure 1.0//EN\" 
\"http://jetty.mortbay.org/configure_1_2.dtd\";>"+
  +            configuration;
  +        InputSource source = new InputSource(new StringReader(configuration));
  +        synchronized(__parser)
  +        {
  +            _config = __parser.parse(source);        
  +        }
  +    }
   
       /* ------------------------------------------------------------ */
       /** Configure an object.
  
  
  
  1.3       +20 -23    contrib/jetty/src/main/org/mortbay/xml/XmlParser.java
  
  Index: XmlParser.java
  ===================================================================
  RCS file: /cvsroot/jboss/contrib/jetty/src/main/org/mortbay/xml/XmlParser.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XmlParser.java    10 Feb 2002 17:57:46 -0000      1.2
  +++ XmlParser.java    20 Feb 2002 05:33:46 -0000      1.3
  @@ -1,6 +1,6 @@
   // ========================================================================
   // Copyright (c) 1999 Mort Bay Consulting (Australia) Pty. Ltd.
  -// $Id: XmlParser.java,v 1.2 2002/02/10 17:57:46 olegnitz Exp $
  +// $Id: XmlParser.java,v 1.3 2002/02/20 05:33:46 janb Exp $
   // ========================================================================
   
   package org.mortbay.xml;
  @@ -35,7 +35,7 @@
    * This class wraps any standard JAXP1.1 parser with convieniant error and
    * entity handlers and a mini dom-like document tree.
    *
  - * @version $Id: XmlParser.java,v 1.2 2002/02/10 17:57:46 olegnitz Exp $
  + * @version $Id: XmlParser.java,v 1.3 2002/02/20 05:33:46 janb Exp $
    * @author Greg Wilkins (gregw)
    */
   public class XmlParser 
  @@ -92,13 +92,7 @@
       }
   
       /* ------------------------------------------------------------ */
  -    /** Parse URL.
  -     * @param url 
  -     * @return 
  -     * @exception IOException 
  -     * @exception SAXException 
  -     */
  -    public synchronized Node parse(String url)
  +    public synchronized Node parse(InputSource source)
           throws IOException,SAXException
       {
           Handler handler= new Handler();
  @@ -106,7 +100,7 @@
           reader.setContentHandler(handler);
        reader.setErrorHandler(handler);
        reader.setEntityResolver(handler);
  -        _parser.parse(url, handler);
  +        _parser.parse(source, handler);
           if (handler._error!=null)
               throw handler._error;
           Node doc=(Node)handler._top.get(0);
  @@ -114,25 +108,27 @@
           return doc;
       }
       
  +    
  +    /* ------------------------------------------------------------ */
  +    /** Parse URL.
  +     */
  +    public synchronized Node parse(String url)
  +        throws IOException,SAXException
  +    {
  +        return parse(new InputSource(url));
  +    }
  +    
       /* ------------------------------------------------------------ */
       /** Parse File. 
  -     * @param file 
  -     * @return 
  -     * @exception IOException 
  -     * @exception SAXException 
        */
       public synchronized Node parse(File file)
           throws IOException,SAXException
       {
  -        return parse(file.toURL().toString());
  +        return parse(new InputSource(file.toURL().toString()));
       }
   
       /* ------------------------------------------------------------ */
       /** Parse InputStream.
  -     * @param url 
  -     * @return 
  -     * @exception IOException 
  -     * @exception SAXException 
        */
       public synchronized Node parse(InputStream in)
           throws IOException,SAXException
  @@ -466,10 +462,11 @@
           }
           
           /* ------------------------------------------------------------ */
  -        /** Combined get(tag).toString(tags).
  -         * @param tag 
  -         * @param tags 
  -         * @return 
  +        /** Get a tag as a string.
  +         * @param tag The tag to get 
  +         * @param tags IF true, tags are included in the value.
  +         * @param trim If true, trim the value.
  +         * @return  results of get(tag).toString(tags).
            */
           public String getString(String tag, boolean tags, boolean trim)
           {
  
  
  
  1.3       +0 -0      contrib/jetty/src/main/org/mortbay/xml/configure_1_0.dtd
  
  Index: configure_1_0.dtd
  ===================================================================
  RCS file: /cvsroot/jboss/contrib/jetty/src/main/org/mortbay/xml/configure_1_0.dtd,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- configure_1_0.dtd 10 Feb 2002 17:57:46 -0000      1.2
  +++ configure_1_0.dtd 20 Feb 2002 05:33:46 -0000      1.3
  @@ -16,7 +16,7 @@
   Values are matched to arguments on a best effort approach, but types
   my be specified if a match is not achieved.
   
  -$Id: configure_1_0.dtd,v 1.2 2002/02/10 17:57:46 olegnitz Exp $
  +$Id: configure_1_0.dtd,v 1.3 2002/02/20 05:33:46 janb Exp $
   -->
   
   
  
  
  
  1.3       +0 -0      contrib/jetty/src/main/org/mortbay/xml/configure_1_1.dtd
  
  Index: configure_1_1.dtd
  ===================================================================
  RCS file: /cvsroot/jboss/contrib/jetty/src/main/org/mortbay/xml/configure_1_1.dtd,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- configure_1_1.dtd 10 Feb 2002 17:57:46 -0000      1.2
  +++ configure_1_1.dtd 20 Feb 2002 05:33:46 -0000      1.3
  @@ -16,7 +16,7 @@
   Values are matched to arguments on a best effort approach, but types
   my be specified if a match is not achieved.
   
  -$Id: configure_1_1.dtd,v 1.2 2002/02/10 17:57:46 olegnitz Exp $
  +$Id: configure_1_1.dtd,v 1.3 2002/02/20 05:33:46 janb Exp $
   -->
   
   <!ENTITY % CONFIG "Set|Put|Call|New">
  
  
  
  1.2       +0 -0      contrib/jetty/src/main/org/mortbay/xml/configure_1_2.dtd
  
  Index: configure_1_2.dtd
  ===================================================================
  RCS file: /cvsroot/jboss/contrib/jetty/src/main/org/mortbay/xml/configure_1_2.dtd,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- configure_1_2.dtd 10 Feb 2002 17:57:46 -0000      1.1
  +++ configure_1_2.dtd 20 Feb 2002 05:33:46 -0000      1.2
  @@ -16,7 +16,7 @@
   Values are matched to arguments on a best effort approach, but types
   my be specified if a match is not achieved.
   
  -$Id: configure_1_2.dtd,v 1.1 2002/02/10 17:57:46 olegnitz Exp $
  +$Id: configure_1_2.dtd,v 1.2 2002/02/20 05:33:46 janb Exp $
   -->
   
   <!ENTITY % CONFIG "Set|Put|Call|New">
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to