commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From craig...@apache.org
Subject cvs commit: jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/message MessageResourcesFactory.java
Date Sat, 28 Dec 2002 00:04:07 GMT
craigmcc    2002/12/27 16:04:07

  Modified:    resources/src/java/org/apache/commons/resources
                        Resources.java ResourcesFactory.java
                        XMLConfigurationReader.java
               resources/src/java/org/apache/commons/resources/file
                        FileResourcesFactory.java
               resources/src/java/org/apache/commons/resources/file/web
                        WebappFileResourcesFactory.java
               resources/src/java/org/apache/commons/resources/message
                        MessageResourcesFactory.java
  Log:
  Modify ResourcesFactory to support two different creator methods -- one
  with a configuration String and one without.  Both of them take the logical
  name of the Resources instance to be returned.
  
  Create a new "impl" subdirectory, where the refactored versions of the
  existing Resources and ResourcesFactory implementations will go.  Create
  convenience base classes for Resources and ResourcesFactory implementations.
  
  NOTE:  Althought things compile now, unit tests don't work.  The refactored
  versions will clean this up.
  
  Revision  Changes    Path
  1.4       +6 -15     jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/Resources.java
  
  Index: Resources.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/Resources.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Resources.java	27 Dec 2002 21:54:32 -0000	1.3
  +++ Resources.java	28 Dec 2002 00:04:07 -0000	1.4
  @@ -123,22 +123,13 @@
       public void destroy() throws ResourcesException;
   
   
  -    // ----------------------------------------------- Resources Naming Methods
  +    // ------------------------------------------------------------- Properties
   
   
       /**
  -     * <p>Return the name of this resource.</p>
  +     * <p>Return the logical name of this {@link Resources} instance.</p>
        */
       public String getName();
  -
  -
  -    /**
  -     * <p>Set the name of this resource.  This method should only be called
  -     * by the {@link ResourcesFactory} that is creating new instances.</p>
  -     *
  -     * @param name A logical String representation of the name of this resource
  -     */
  -    public void setName(String name);
   
   
       // ---------------------------------------------- Content Retrieval Methods
  
  
  
  1.3       +24 -5     jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/ResourcesFactory.java
  
  Index: ResourcesFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/ResourcesFactory.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ResourcesFactory.java	27 Dec 2002 23:27:12 -0000	1.2
  +++ ResourcesFactory.java	28 Dec 2002 00:04:07 -0000	1.3
  @@ -90,7 +90,7 @@
   
       /**
        * <p>Create (if necessary) and return a {@link Resources} instance
  -     * for the specified logical name.</p>
  +     * for the specified logical name, with a default configuration.</p>
        *
        * @param name Logical name of the {@link Resources} instance to
        *  be returned
  @@ -99,6 +99,25 @@
        *  of the specified logical name cannot be returned.
        */
       public Resources getResources(String name)
  +        throws ResourcesException;
  +
  +
  +    /**
  +     * <p>Create (if necessary) and return a {@link Resources} instance
  +     * for the specified logical name, with a configuration based on
  +     * the specified configuration String.</p>
  +     *
  +     * @param name Logical name of the {@link Resources} instance to
  +     *  be returned
  +     * @param config Configuration string for this resource (meaning
  +     *  is dependent upon the {@link ResourcesFactory} implementation
  +     *  being utilized), or <code>null</code> for the default
  +     *  configuration
  +     *
  +     * @exception ResourcesException if a {@link Resources} instance
  +     *  of the specified logical name cannot be returned.
  +     */
  +    public Resources getResources(String name, String config)
           throws ResourcesException;
   
   
  
  
  
  1.9       +5 -5      jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/XMLConfigurationReader.java
  
  Index: XMLConfigurationReader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/XMLConfigurationReader.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- XMLConfigurationReader.java	27 Dec 2002 23:27:12 -0000	1.8
  +++ XMLConfigurationReader.java	28 Dec 2002 00:04:07 -0000	1.9
  @@ -294,7 +294,7 @@
           }
   
           //push to top of digester stack for property population
  -        resource.setName(name);
  +        //        resource.setName(name);
           digester.push(resource);
   
       }
  
  
  
  1.3       +8 -5      jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/file/FileResourcesFactory.java
  
  Index: FileResourcesFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/file/FileResourcesFactory.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- FileResourcesFactory.java	27 Dec 2002 23:27:12 -0000	1.2
  +++ FileResourcesFactory.java	28 Dec 2002 00:04:07 -0000	1.3
  @@ -72,7 +72,10 @@
    * @version $Revision$ $Date$
    */
   public class FileResourcesFactory implements ResourcesFactory {
  -    public Resources getResources(String config) {
  +    public Resources getResources(String name) {
  +        return new FileResources();
  +    }
  +    public Resources getResources(String name, String config) {
           return new FileResources();
       }
       public void release() {
  
  
  
  1.3       +8 -5      jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/file/web/WebappFileResourcesFactory.java
  
  Index: WebappFileResourcesFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/file/web/WebappFileResourcesFactory.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- WebappFileResourcesFactory.java	27 Dec 2002 23:27:12 -0000	1.2
  +++ WebappFileResourcesFactory.java	28 Dec 2002 00:04:07 -0000	1.3
  @@ -73,7 +73,10 @@
       /**
        * Basic implementation, just creates a new instance of WebappFileResources.
        */
  -    public Resources getResources(String config) {
  +    public Resources getResources(String name) {
  +        return new WebappFileResources();
  +    }
  +    public Resources getResources(String name, String config) {
           return new WebappFileResources();
       }
       public void release() {
  
  
  
  1.5       +9 -5      jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/message/MessageResourcesFactory.java
  
  Index: MessageResourcesFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/message/MessageResourcesFactory.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- MessageResourcesFactory.java	27 Dec 2002 23:27:12 -0000	1.4
  +++ MessageResourcesFactory.java	28 Dec 2002 00:04:07 -0000	1.5
  @@ -121,7 +121,11 @@
       /**
        * Implementation of ResourcesFactory method
        */
  -    public Resources getResources(String config) {
  +    public Resources getResources(String name) {
  +        return createResources(name);
  +    }       
  +
  +    public Resources getResources(String name, String config) {
           return createResources(config);
       }       
   
  
  
  

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


Mime
View raw message