avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blorit...@apache.org
Subject cvs commit: jakarta-avalon/src/java/org/apache/avalon/framework/configuration AbstractConfiguration.java Configuration.java DefaultConfiguration.java DefaultConfigurationSerializer.java SAXConfigurationHandler.java Namespace.java
Date Mon, 19 Nov 2001 16:59:16 GMT
bloritsch    01/11/19 08:59:16

  Modified:    src/java/org/apache/avalon/framework/configuration
                        AbstractConfiguration.java Configuration.java
                        DefaultConfiguration.java
                        DefaultConfigurationSerializer.java
                        SAXConfigurationHandler.java
  Removed:     src/java/org/apache/avalon/framework/configuration
                        Namespace.java
  Log:
  Remove the Namespace object
  
  Revision  Changes    Path
  1.10      +12 -5     jakarta-avalon/src/java/org/apache/avalon/framework/configuration/AbstractConfiguration.java
  
  Index: AbstractConfiguration.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon/src/java/org/apache/avalon/framework/configuration/AbstractConfiguration.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- AbstractConfiguration.java	2001/11/19 11:47:37	1.9
  +++ AbstractConfiguration.java	2001/11/19 16:59:15	1.10
  @@ -15,12 +15,19 @@
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
    * @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
  - * @version CVS $Revision: 1.9 $ $Date: 2001/11/19 11:47:37 $
  + * @version CVS $Revision: 1.10 $ $Date: 2001/11/19 16:59:15 $
    */
   public abstract class AbstractConfiguration
       implements Configuration
   {
       /**
  +     * Returns the prefix of the namespace.  This is only used as a serialization
  +     * hint, therefore is not part of the client API.  It should be included in
  +     * all Configuration implementations though.
  +     */
  +    protected abstract String getPrefix();
  +
  +    /**
        * Returns the value of the configuration element as an <code>int</code>.
        *
        * Hexadecimal numbers begin with 0x, Octal numbers begin with 0o and binary
  @@ -281,7 +288,7 @@
           catch( final Exception nfe )
           {
               throw new ConfigurationException( "Cannot parse the value \"" + value +
  -                                              "\" as an integer in the attribute \"" +

  +                                              "\" as an integer in the attribute \"" +
                                                 name + "\" at " + getLocation() );
           }
       }
  @@ -347,7 +354,7 @@
           catch( final Exception nfe )
           {
               throw new ConfigurationException( "Cannot parse the value \"" + value +
  -                                              "\" as a long in the attribute \"" + 
  +                                              "\" as a long in the attribute \"" +
                                                 name + "\" at " + getLocation() );
           }
       }
  @@ -394,7 +401,7 @@
           catch( final Exception e )
           {
               throw new ConfigurationException( "Cannot parse the value \"" + value +
  -                                              "\" as a float in the attribute \"" + 
  +                                              "\" as a float in the attribute \"" +
                                                 name + "\" at " + getLocation() );
           }
       }
  @@ -443,7 +450,7 @@
           else
           {
               throw new ConfigurationException( "Cannot parse the value \"" + value +
  -                                              "\" as a boolean in the attribute \"" + 
  +                                              "\" as a boolean in the attribute \"" +
                                                 name + "\" at " + getLocation() );
           }
       }
  
  
  
  1.7       +2 -2      jakarta-avalon/src/java/org/apache/avalon/framework/configuration/Configuration.java
  
  Index: Configuration.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon/src/java/org/apache/avalon/framework/configuration/Configuration.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Configuration.java	2001/11/19 11:47:37	1.6
  +++ Configuration.java	2001/11/19 16:59:15	1.7
  @@ -32,7 +32,7 @@
    * <p>
    * Type-safe utility methods are provided for retrieving attribute and element
    * values as <code>String</code>, <code>int</code>, <code>long</code>,
  - * <code>float</code> and <code>boolean</code>. 
  + * <code>float</code> and <code>boolean</code>.
    * </p>
    * <p>
    * As an example, consider a <code>Configuration</code> built from this XML:
  @@ -102,7 +102,7 @@
        *
        * @return a Namespace object describing the namespace of the Configuration
        */
  -    Namespace getNamespace();
  +    String getNamespace();
   
       /**
        * Return a new <code>Configuration</code> instance encapsulating the
  
  
  
  1.10      +14 -4     jakarta-avalon/src/java/org/apache/avalon/framework/configuration/DefaultConfiguration.java
  
  Index: DefaultConfiguration.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon/src/java/org/apache/avalon/framework/configuration/DefaultConfiguration.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- DefaultConfiguration.java	2001/11/19 11:47:37	1.9
  +++ DefaultConfiguration.java	2001/11/19 16:59:15	1.10
  @@ -27,7 +27,8 @@
   
       private final String                     m_name;
       private final String                     m_location;
  -    private final Namespace                  m_namespace;
  +    private final String                     m_namespace;
  +    private final String                     m_prefix;
       private HashMap                          m_attributes;
       private ArrayList                        m_children;
       private String                           m_value;
  @@ -38,17 +39,18 @@
        */
       public DefaultConfiguration( final String name, final String location )
       {
  -        this (name, location, Namespace.getNamespace(null));
  +        this (name, location, "", "");
       }
   
       /**
        * Create a new <code>DefaultConfiguration</code> instance.
        */
  -    public DefaultConfiguration( final String name, final String location, final Namespace
ns )
  +    public DefaultConfiguration( final String name, final String location, final String
ns, final String prefix )
       {
           m_name = name;
           m_location = location;
           m_namespace = ns;
  +        m_prefix = prefix;  // only used as a serialization hint
       }
   
       /**
  @@ -62,9 +64,17 @@
       /**
        * Returns the namespace of this configuration element
        */
  -    public Namespace getNamespace()
  +    public String getNamespace()
       {
           return m_namespace;
  +    }
  +
  +    /**
  +     * Returns the prefix of the namespace
  +     */
  +    protected String getPrefix()
  +    {
  +        return m_prefix;
       }
   
       /**
  
  
  
  1.6       +8 -3      jakarta-avalon/src/java/org/apache/avalon/framework/configuration/DefaultConfigurationSerializer.java
  
  Index: DefaultConfigurationSerializer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon/src/java/org/apache/avalon/framework/configuration/DefaultConfigurationSerializer.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DefaultConfigurationSerializer.java	2001/11/19 11:47:37	1.5
  +++ DefaultConfigurationSerializer.java	2001/11/19 16:59:15	1.6
  @@ -111,9 +111,14 @@
               }
           }
   
  -        final Namespace namespace = element.getNamespace();
  -        final String nsURI = namespace.getURI();
  -        final String nsPrefix = namespace.getPrefix();
  +        final String nsURI = element.getNamespace();
  +        String nsPrefix = "";
  +
  +        if ( element instanceof AbstractConfiguration )
  +        {
  +            nsPrefix = ((AbstractConfiguration) element).getPrefix();
  +        }
  +
           boolean nsWasDeclared = false;
   
           // Is this namespace already declared?
  
  
  
  1.10      +1 -2      jakarta-avalon/src/java/org/apache/avalon/framework/configuration/SAXConfigurationHandler.java
  
  Index: SAXConfigurationHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon/src/java/org/apache/avalon/framework/configuration/SAXConfigurationHandler.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- SAXConfigurationHandler.java	2001/11/19 11:47:37	1.9
  +++ SAXConfigurationHandler.java	2001/11/19 16:59:15	1.10
  @@ -123,8 +123,7 @@
                                                           final String location )
       {
           final String    prefix    = m_namespaceSupport.getPrefix( namespaceURI );
  -        final Namespace namespace = Namespace.getNamespace( prefix, namespaceURI );
  -        return new DefaultConfiguration( localName, location, namespace );
  +        return new DefaultConfiguration( localName, location, namespaceURI, prefix );
       }
   
       public void startElement( final String namespaceURI,
  
  
  

--
To unsubscribe, e-mail:   <mailto:avalon-cvs-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-cvs-help@jakarta.apache.org>


Mime
View raw message