dlr         02/01/02 01:26:41

  Modified:    src/java/org/apache/stratum/xo Mapper.java
  Log:
  Minor clean up, including some tweaks to map() to move towards a more
  streamy implementation (looking towards the day when class loading can
  be used instead of file system access).
  
  Revision  Changes    Path
  1.3       +11 -8     
jakarta-turbine-stratum/src/java/org/apache/stratum/xo/Mapper.java
  
  Index: Mapper.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-stratum/src/java/org/apache/stratum/xo/Mapper.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -u -r1.2 -r1.3
  --- Mapper.java       31 Dec 2001 22:19:37 -0000      1.2
  +++ Mapper.java       2 Jan 2002 09:26:41 -0000       1.3
  @@ -54,7 +54,8 @@
    * <http://www.apache.org/>.
    */
   
  -import java.io.File;
  +import java.io.FileInputStream;
  +import java.io.InputStream;
   
   import java.util.HashMap;
   import java.util.Map;
  @@ -134,7 +135,7 @@
    *
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Jason van Zyl</a>
  - * @version $Id: Mapper.java,v 1.2 2001/12/31 22:19:37 dlr Exp $
  + * @version $Id: Mapper.java,v 1.3 2002/01/02 09:26:41 dlr Exp $
    */
   
   // How to use the resources package to pull in the
  @@ -219,17 +220,19 @@
       /**
        * Loads a document from a file.
        *
  -     * @throw a org.dom4j.DocumentException occurs whenever the buildprocess fails.
  +     * @param source The file system path to the XML data file.
  +     * @param beanClass The fully qualified class name of the parent bean.
  +     * @exception DocumentException If the buildprocess fails.
        */
       public Object map(String source, String beanClass)
           throws Exception 
       {
  -        SAXReader xmlReader = new SAXReader();
  -        
  -        // We want to be able to use the resource package
  -        // what is the best way to hook in.
  +        // We want to be able to use the resource package.
  +        // What is the best way to hook in?
           
  -        document = xmlReader.read(new File(source));
  +        InputStream in = new FileInputStream(source);
  +        SAXReader xmlReader = new SAXReader();
  +        document = xmlReader.read(in);
           
           // Get the base directory
           baseDirectory = FileUtils.dirname(source);
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to