jon         00/12/17 13:54:43

  Modified:    src/java/org/apache/velocity/runtime Runtime.java
                        RuntimeConstants.java
  Log:
  trying to make Runtime a bit smaller. it is getting tooo large. :-)
  
  moved constants into RuntimeConstants
  moved fileToURL to StringUtils.
  
  Revision  Changes    Path
  1.69      +4 -63     
jakarta-velocity/src/java/org/apache/velocity/runtime/Runtime.java
  
  Index: Runtime.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/Runtime.java,v
  retrieving revision 1.68
  retrieving revision 1.69
  diff -u -r1.68 -r1.69
  --- Runtime.java      2000/12/11 04:14:52     1.68
  +++ Runtime.java      2000/12/17 21:54:42     1.69
  @@ -154,45 +154,13 @@
    * @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
    * @author <a href="mailto:[EMAIL PROTECTED]">Jeff Bowden</a>
    * @author <a href="mailto:[EMAIL PROTECTED]">Geir Magusson Jr.</a>
  - * @version $Id: Runtime.java,v 1.68 2000/12/11 04:14:52 geirm Exp $
  + * @version $Id: Runtime.java,v 1.69 2000/12/17 21:54:42 jon Exp $
    */
   public class Runtime implements RuntimeConstants
  -{
  -    /** Prefix for warning messages */
  -    private final static String WARN  = "  [warn] ";
  -    
  -    /** Prefix for info messages */
  -    private final static String INFO  = "  [info] ";
  -    
  -    /**  Prefix for debug messages */
  -    private final static String DEBUG = " [debug] ";
  -    
  -    /** Prefix for error messages */
  -    private final static String ERROR = " [error] ";
  -
  -    /** Turn Runtime debugging on with this field */
  -    private final static boolean DEBUG_ON = true;
  -
  -    /** Default Runtime properties */
  -    private final static String DEFAULT_RUNTIME_PROPERTIES = 
  -        "org/apache/velocity/runtime/defaults/velocity.properties";
  -
  -    /** Default Runtime properties */
  -    private final static String DEFAULT_RUNTIME_DIRECTIVES = 
  -        "org/apache/velocity/runtime/defaults/directive.properties";
  -
  -    /** Include paths property used by Runtime for #included content */
  -    private final static String INCLUDE_PATHS = "include.path";
  -
  +{    
       /**
  -      * Number of parsers to create
  -      */
  -    private static final int NUMBER_OF_PARSERS = 20;
  -    
  -    /**
        *  VelocimacroFactory object to manage VMs
        */
  -
       private static VelocimacroFactory vmFactory = new VelocimacroFactory();
   
       /** A list of paths that we can pull static content from. */
  @@ -552,7 +520,7 @@
            * Initialize the logger.
            */
           logger = LogKit.createLogger("velocity", 
  -        fileToURL(logFile), "DEBUG");
  +        StringUtils.fileToURL(logFile), "DEBUG");
                   
           LogTarget[] t = logger.getLogTargets();            
   
  @@ -575,33 +543,6 @@
       }
   
       /**
  -     * This was borrowed form xml-fop. Convert a file
  -     * name into a string that represents a well-formed
  -     * URL.
  -     *
  -     * d:\path\to\logfile
  -     * file://d:/path/to/logfile
  -     *
  -     * NOTE: this is a total hack-a-roo! This should
  -     * be dealt with in the org.apache.log package. Client
  -     * packages should not have to mess around making
  -     * properly formed URLs when log files are almost
  -     * always going to be specified with file paths!
  -     */
  -    private static String fileToURL(String filename)
  -        throws MalformedURLException
  -    {
  -        File file = new File(filename);
  -        String path = file.getAbsolutePath();
  -        String fSep = System.getProperty("file.separator");
  -        
  -        if (fSep != null && fSep.length() == 1)
  -            path = "file://" + path.replace(fSep.charAt(0), '/');
  -        
  -        return path;
  -    }
  -
  -    /**
        * Initialize the template loader if there
        * is a real path set for the template.path
        * property. Otherwise defer initialization
  @@ -1024,7 +965,7 @@
   
       public static void main(String[] args) throws Exception
       {
  -        System.out.println(fileToURL(args[0]));
  +        System.out.println(StringUtils.fileToURL(args[0]));
       }
   
       /**
  
  
  
  1.8       +33 -2     
jakarta-velocity/src/java/org/apache/velocity/runtime/RuntimeConstants.java
  
  Index: RuntimeConstants.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/RuntimeConstants.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- RuntimeConstants.java     2000/12/10 19:36:24     1.7
  +++ RuntimeConstants.java     2000/12/17 21:54:42     1.8
  @@ -56,6 +56,34 @@
   
   public interface RuntimeConstants
   {
  +    /** Prefix for warning messages */
  +    final static String WARN  = "  [warn] ";
  +    
  +    /** Prefix for info messages */
  +    final static String INFO  = "  [info] ";
  +    
  +    /**  Prefix for debug messages */
  +    final static String DEBUG = " [debug] ";
  +    
  +    /** Prefix for error messages */
  +    final static String ERROR = " [error] ";
  +
  +    /** Turn Runtime debugging on with this field */
  +    final static boolean DEBUG_ON = true;
  +
  +    /** Default Runtime properties */
  +    final static String DEFAULT_RUNTIME_PROPERTIES = 
  +        "org/apache/velocity/runtime/defaults/velocity.properties";
  +
  +    /** Default Runtime properties */
  +    final static String DEFAULT_RUNTIME_DIRECTIVES = 
  +        "org/apache/velocity/runtime/defaults/directive.properties";
  +
  +    /**
  +      * Number of parsers to create
  +      */
  +    final static int NUMBER_OF_PARSERS = 20;
  +
       /** Location of the log file */
       public static final String RUNTIME_LOG = "runtime.log";
       
  @@ -78,9 +106,12 @@
   
       /** External service initialization of the Velocity Runtime */
       public static final String EXTERNAL_INIT = "external.init";
  +
  +    /** Include paths property used by Runtime for #included content */
  +    public final static String INCLUDE_PATHS = "include.path";
   
  -    public static final String FILE_TEMPLATE_PATH = "File.template.path";
  -    public static final String FILE_TEMPLATE_CACHE = "File.template.cache";
  +    public static final String FILE_TEMPLATE_PATH = "file.template.path";
  +    public static final String FILE_TEMPLATE_CACHE = "file.template.cache";
   
       public static final String RUNTIME_LOG_REFERENCE_LOG_INVALID  = 
"runtime.log.reference.log_invalid";
   
  
  
  

Reply via email to