[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jakarta-commons-dev
Subject:    cvs commit: jakarta-commons-sandbox/resources/src/test/org/apache/commons/resources/tests FileResour
From:       martinc () apache ! org
Date:       2001-10-17 5:44:45
[Download RAW message or body]

martinc     01/10/16 22:44:45

  Modified:    resources/src/java/org/apache/commons/resources
                        AbstractResource.java Resource.java
               resources/src/java/org/apache/commons/resources/file
                        FileResource.java
               resources/src/java/org/apache/commons/resources/message
                        MessageResources.java
               resources/src/test/org/apache/commons/resources/tests
                        FileResourceTest.java
  Log:
  Method renames:
   - getData() -> getBytes()
   - getStream() -> getInputStream()
  
  Revision  Changes    Path
  1.7       +12 -12    \
jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/AbstractResource.java
  
  Index: AbstractResource.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/AbstractResource.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- AbstractResource.java	2001/10/16 05:44:02	1.6
  +++ AbstractResource.java	2001/10/17 05:44:45	1.7
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/AbstractResource.java,v \
                1.6 2001/10/16 05:44:02 martinc Exp $
  - * $Revision: 1.6 $
  - * $Date: 2001/10/16 05:44:02 $
  + * $Header: /home/cvs/jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/AbstractResource.java,v \
1.7 2001/10/17 05:44:45 martinc Exp $  + * $Revision: 1.7 $
  + * $Date: 2001/10/17 05:44:45 $
    *
    * ====================================================================
    * 
  @@ -77,11 +77,11 @@
    * This class implements some of the methods of the Resource interface
    * and should be extended to shield developers from changes in the interface.
    * The only method not implemented is 
  - * {@link Resource#getData(String,Locale,TimeZone) \
getData(String,Locale,TimeZone)}.  + * {@link \
                Resource#getBytes(String,Locale,TimeZone) \
                getBytes(String,Locale,TimeZone)}.
    * Implementators are encouraged to implement more efficient getReader() and
  - * getStream() methods for large-sized content.
  + * getInputStream() methods for large-sized content.
    * @author Mike Schachter (mschachter@hp.com)
  - * @version $Revision: 1.6 $ $Date: 2001/10/16 05:44:02 $
  + * @version $Revision: 1.7 $ $Date: 2001/10/17 05:44:45 $
    */
   public abstract class AbstractResource implements Resource {
   
  @@ -97,7 +97,7 @@
       
       /**
        * This is called on to initialize the Resource, before any of the
  -     * getData methods are called, and after the setConfigurationURL() method
  +     * get* methods are called, and after the setConfig() method
        * is called.
        */
       public void init() throws ResourceException {
  @@ -132,7 +132,7 @@
        * Retrieves content based on the locale and time zone specified.  Note
        * that this method has the potential to cause memory problems for content
        * that is relatively large.  The default implementation of this returns
  -     * the String value of {@link #getData(String,Locale,TimeZone) getData}
  +     * the String value of {@link #getBytes(String,Locale,TimeZone) getBytes}
        * with the arguments given in the default system encoding.
        * @param key The key for the content
        * @param locale The locale to retreive the content in, if <code>null</code>,
  @@ -145,14 +145,14 @@
        */
       public String getString(String key, Locale locale, TimeZone timeZone) 
           throws ResourceException    {
  -            return new String(getData(key, locale, timeZone));
  +            return new String(getBytes(key, locale, timeZone));
       }
       
       /**
        * Retrieves an InputStream representing the content based on the key, locale,
        * and time zone specified.  The default implementation constructs a
        * ByteArrayInputStream based on the bytes retrieved from
  -     * {@link #getData(String,Locale,TimeZone) getData}.
  +     * {@link #getBytes(String,Locale,TimeZone) getBytes}.
        * @param key The key for the content
        * @param locale The locale to retreive the content in, if <code>null</code>,
        *               the default locale
  @@ -160,9 +160,9 @@
        *                 the default time zone.  Resource implementations may ignore
        *                 the time zone argument all together.
        */
  -    public InputStream getStream(String key, Locale locale, TimeZone timeZone)
  +    public InputStream getInputStream(String key, Locale locale, TimeZone \
timeZone)  throws ResourceException {            
  -            return new ByteArrayInputStream(getData(key, locale, timeZone));
  +            return new ByteArrayInputStream(getBytes(key, locale, timeZone));
       }
       
       /**
  
  
  
  1.7       +8 -8      \
jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/Resource.java \
  Index: Resource.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/Resource.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Resource.java	2001/10/16 05:44:02	1.6
  +++ Resource.java	2001/10/17 05:44:45	1.7
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/Resource.java,v \
                1.6 2001/10/16 05:44:02 martinc Exp $
  - * $Revision: 1.6 $
  - * $Date: 2001/10/16 05:44:02 $
  + * $Header: /home/cvs/jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/Resource.java,v \
1.7 2001/10/17 05:44:45 martinc Exp $  + * $Revision: 1.7 $
  + * $Date: 2001/10/17 05:44:45 $
    *
    * ====================================================================
    * 
  @@ -78,7 +78,7 @@
    * optionally time zone.  The basic idea is that each peice of content is
    * associated with a String key, and that key is used to retrieve the content.
    * Developers using implementations of this class should keep in mind that
  - * they should use the getStream method that returns an InputStream and write
  + * they should use the getInputStream method that returns an InputStream and write
    * directly to the Stream they're using for resources that contain large size
    * content.<br />
    * Developers implementing resources should extend the 
  @@ -86,14 +86,14 @@
    * class and override the necessary methods to shield themselves from any
    * changes that may occur in this interface.
    * @author Mike Schachter (mschachter@hp.com)
  - * @version $Revision: 1.6 $ $Date: 2001/10/16 05:44:02 $
  + * @version $Revision: 1.7 $ $Date: 2001/10/17 05:44:45 $
    */
   public interface Resource extends Serializable {
   
       
       /**
        * This is called on to initialize the Resource, before any of the
  -     * getData* methods are called, and after the setConfigurationURL() method
  +     * get* methods are called, and after the setConfig() method
        * is called.
        */
       public void init() throws ResourceException;
  @@ -127,7 +127,7 @@
        *                 the default time zone.  Resource implementations may ignore
        *                 the time zone argument all together.
        */
  -    public byte[] getData(String key, Locale locale, TimeZone timeZone)
  +    public byte[] getBytes(String key, Locale locale, TimeZone timeZone)
           throws ResourceException;
       
       /**
  @@ -156,7 +156,7 @@
        *                 the default time zone.  Resource implementations may ignore
        *                 the time zone argument all together.
        */
  -    public InputStream getStream(String key, Locale locale, TimeZone timeZone)
  +    public InputStream getInputStream(String key, Locale locale, TimeZone \
timeZone)  throws ResourceException;
       
       /**
  
  
  
  1.5       +7 -7      \
jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/file/FileResource.java
  
  Index: FileResource.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/file/FileResource.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- FileResource.java	2001/10/16 05:44:02	1.4
  +++ FileResource.java	2001/10/17 05:44:45	1.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/file/FileResource.java,v \
                1.4 2001/10/16 05:44:02 martinc Exp $
  - * $Revision: 1.4 $
  - * $Date: 2001/10/16 05:44:02 $
  + * $Header: /home/cvs/jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/file/FileResource.java,v \
1.5 2001/10/17 05:44:45 martinc Exp $  + * $Revision: 1.5 $
  + * $Date: 2001/10/17 05:44:45 $
    *
    * ====================================================================
    * 
  @@ -95,7 +95,7 @@
    * <li><b>maxCacheSize</b> - The maximum size in bytes that is allowed for a \
                cached
    * file, or -1 for an unlimited cache size [100K]
    * @author Mike Schachter (mschachter@hp.com)
  - * @version $Revision: 1.4 $ $Date: 2001/10/16 05:44:02 $
  + * @version $Revision: 1.5 $ $Date: 2001/10/17 05:44:45 $
    */
   public class FileResource extends AbstractResource {
    
  @@ -185,11 +185,11 @@
        * @param timeZone The time zone to retrieve the content for, if \
                <code>null</code>,
        *                 the default time zone
        */
  -    public byte[] getData(String key, Locale locale, TimeZone timeZone)
  +    public byte[] getBytes(String key, Locale locale, TimeZone timeZone)
           throws ResourceException {
               try {
                   
  -                InputStream stream = getStream(key, locale, timeZone);             \
  +                InputStream stream = getInputStream(key, locale, timeZone);        \
  byte[] buffer = new byte[bufferSize];
                   ByteArrayOutputStream baos = new ByteArrayOutputStream();
                   int read = 0;
  @@ -215,7 +215,7 @@
        * @param timeZone The time zone to retrieve the content for, if \
                <code>null</code>,
        *                 the default time zone
        */
  -    public InputStream getStream(String key, Locale locale, TimeZone timeZone)
  +    public InputStream getInputStream(String key, Locale locale, TimeZone \
timeZone)  throws ResourceException {            
               
               String stringKey = toStringKey(key, locale, timeZone);
  
  
  
  1.2       +6 -6      \
jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/message/MessageResources.java
  
  Index: MessageResources.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/message/MessageResources.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MessageResources.java	2001/06/27 22:07:23	1.1
  +++ MessageResources.java	2001/10/17 05:44:45	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/message/MessageResources.java,v \
                1.1 2001/06/27 22:07:23 mschachter Exp $
  - * $Revision: 1.1 $
  - * $Date: 2001/06/27 22:07:23 $
  + * $Header: /home/cvs/jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/message/MessageResources.java,v \
1.2 2001/10/17 05:44:45 martinc Exp $  + * $Revision: 1.2 $
  + * $Date: 2001/10/17 05:44:45 $
    *
    * ====================================================================
    * 
  @@ -91,7 +91,7 @@
    * application server environments.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.1 $ $Date: 2001/06/27 22:07:23 $
  + * @version $Revision: 1.2 $ $Date: 2001/10/17 05:44:45 $
    */
   
   public abstract class MessageResources extends AbstractResource {
  @@ -186,9 +186,9 @@
   
   
       /**
  -     * Implements the getData method of the Resource interface
  +     * Implements the getBytes method of the Resource interface
        */
  -    public byte[] getData(String key, Locale locale, TimeZone timeZone) {
  +    public byte[] getBytes(String key, Locale locale, TimeZone timeZone) {
           String data = getMessage(locale, key);
           if (data != null) {
               return data.getBytes();
  
  
  
  1.2       +2 -2      \
jakarta-commons-sandbox/resources/src/test/org/apache/commons/resources/tests/FileResourceTest.java
  
  Index: FileResourceTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/resources/src/test/org/apache/commons/resources/tests/FileResourceTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FileResourceTest.java	2001/07/06 19:51:09	1.1
  +++ FileResourceTest.java	2001/10/17 05:44:45	1.2
  @@ -90,11 +90,11 @@
           assertEquals(FILE_TEST1_VALID_PATH, validPath);
       }
       
  -    public void testGetData() throws Exception {
  +    public void testGetBytes() throws Exception {
           
           try {
           
  -            byte[] data = fileResource.getData(FILE_TEST1_KEY, locale_en_US, \
timeZone_EST);  +            byte[] data = fileResource.getBytes(FILE_TEST1_KEY, \
locale_en_US, timeZone_EST);  String stringData = new String(data, 0, data.length);
               assertEquals(FILE_TEST1_DATA, stringData);
           }
  
  
  


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic