User: user57  
  Date: 02/02/06 18:15:25

  Added:       src/main/org/jboss/util DirectoryBuilder.java
  Log:
   o Added DirectoryBuilder, a simple util to help make directory paths by
     cd()'ing
   o Cleaned up HypersonicDatabase stuff, found out just how non-emembedeable
     this stuff really is... what a pain.
   o Now shows the directory path where the db is running from (mostly)
  
  Revision  Changes    Path
  1.1                  jboss/src/main/org/jboss/util/DirectoryBuilder.java
  
  Index: DirectoryBuilder.java
  ===================================================================
  /*
   * JBoss, the OpenSource J2EE webOS
   *
   * Distributable under LGPL license.
   * See terms of license at gnu.org.
   */
  
  package org.jboss.util;
  
  import java.io.File;
  
  /**
   * A simple utility to make it easier to build File objects for nested
   * directories based on the command line 'cd' pattern.
   *      
   * @author <a href="mailto:[EMAIL PROTECTED]";>Jason Dillon</a>
   * @version $Revision: 1.1 $
   */
  public class DirectoryBuilder
  {
     protected File root;
  
     public DirectoryBuilder() {
        // empty
     } 
  
     public DirectoryBuilder(final File root) {
        this.root = root;
     } 
  
     public DirectoryBuilder(final File root, final File child) {
        this(root);
        cd(child);
     }
  
     public DirectoryBuilder(final String rootname) {
        this(new File(rootname));
     }
  
     public DirectoryBuilder(final String rootname, final String childname) {
        this(new File(rootname), new File(childname));
     }
  
     public DirectoryBuilder cd(final File child) {
        if (child.isAbsolute()) {
         root = child;
        }
        else {
         root = new File(root, child.getPath());
        }
        return this;
     }
  
     public DirectoryBuilder cd(final String childname) {
        return cd(new File(childname));
     }
  
     public File get() {
        return root;
     }
  
     public String toString() {
        return root.toString();
     }
  }
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to