avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcconn...@apache.org
Subject cvs commit: avalon/util/defaults/src/java/org/apache/avalon/util/defaults Defaults.java
Date Fri, 20 Feb 2004 22:50:53 GMT
mcconnell    2004/02/20 14:50:53

  Modified:    util/criteria/src/java/org/apache/avalon/util/criteria
                        Criteria.java
               util/defaults/src/java/org/apache/avalon/util/defaults
                        Defaults.java
  Log:
  Enhance criteria to provide direct access to keys.
  
  Revision  Changes    Path
  1.3       +12 -1     avalon/util/criteria/src/java/org/apache/avalon/util/criteria/Criteria.java
  
  Index: Criteria.java
  ===================================================================
  RCS file: /home/cvs/avalon/util/criteria/src/java/org/apache/avalon/util/criteria/Criteria.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Criteria.java	24 Jan 2004 23:18:55 -0000	1.2
  +++ Criteria.java	20 Feb 2004 22:50:53 -0000	1.3
  @@ -146,6 +146,15 @@
       }
   
      /**
  +    * Return the parameter keys associated with the criteria.
  +    * @return the keys
  +    */
  +    protected String[] getKeys()
  +    {
  +        return Parameter.getKeys( getParameters() );
  +    }
  +
  +   /**
       * Return the parameter associated to the criteria.
       * @return the parameters
       */
  @@ -179,4 +188,6 @@
               return getParameter( key.toString() );
           }
       }
  +
  +
   }
  
  
  
  1.4       +23 -1     avalon/util/defaults/src/java/org/apache/avalon/util/defaults/Defaults.java
  
  Index: Defaults.java
  ===================================================================
  RCS file: /home/cvs/avalon/util/defaults/src/java/org/apache/avalon/util/defaults/Defaults.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Defaults.java	24 Jan 2004 23:18:55 -0000	1.3
  +++ Defaults.java	20 Feb 2004 22:50:53 -0000	1.4
  @@ -346,6 +346,28 @@
       }
   
      /**
  +    * Read in a static properties resource relative to a supplied class.
  +    * The implementation will attempt to locate a property file colocated
  +    * with the class with the name [class].properties.
  +    *
  +    * @param ref a class used to establish a classloader and anchors 
  +    *    relative path references
  +    * @return the static properties
  +    */
  +    public static Properties getStaticProperties( Class ref ) throws IOException
  +    {
  +        final Properties properties = new Properties();
  +        final String address = ref.toString().replace( '.','/' );
  +        final String path = address + ".properties";
  +        InputStream input = ref.getResourceAsStream( path );
  +        if( null != input )
  +        {
  +            properties.load( input );
  +        }
  +        return properties;
  +    }
  +
  +   /**
       * Read in a static properties resource relative to a supplied class
       * and path.
       *
  
  
  

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


Mime
View raw message