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

List:       xml-cocoon-cvs
Subject:    cvs commit: xml-cocoon/src/org/apache/cocoon/util NetUtils.java
From:       bloritsch () locus ! apache ! org
Date:       2000-12-29 18:50:46
[Download RAW message or body]

bloritsch    00/12/29 10:50:46

  Modified:    src/org/apache/cocoon Tag: xml-cocoon2 Cocoon.java
               src/org/apache/cocoon/util Tag: xml-cocoon2 NetUtils.java
  Log:
  Added hack so that we can have relative paths to builtin-logicsheets
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.4.2.39  +6 -2      xml-cocoon/src/org/apache/cocoon/Cocoon.java
  
  Index: Cocoon.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Cocoon.java,v
  retrieving revision 1.4.2.38
  retrieving revision 1.4.2.39
  diff -u -r1.4.2.38 -r1.4.2.39
  --- Cocoon.java	2000/12/07 17:10:29	1.4.2.38
  +++ Cocoon.java	2000/12/29 18:50:44	1.4.2.39
  @@ -34,6 +34,7 @@
   import org.apache.cocoon.serialization.Serializer;
   import org.apache.cocoon.sitemap.Manager;
   import org.apache.cocoon.util.ClassUtils;
  +import org.apache.cocoon.util.NetUtils;
   import org.apache.cocoon.DefaultComponentManager;
   
   import org.apache.log.Logger;
  @@ -46,7 +47,7 @@
    * @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
    *         (Apache Software Foundation, Exoffice Technologies)
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.4.2.38 $ $Date: 2000/12/07 17:10:29 $
  + * @version CVS $Revision: 1.4.2.39 $ $Date: 2000/12/29 18:50:44 $
    */
   public class Cocoon
     implements Component, Configurable, ComponentManager, Modifiable, Processor, Constants {
  @@ -131,7 +132,10 @@
           p.parse(is);
   
           this.configure(b.getConfiguration());
  -        this.root = new File(root).toURL();
  +
  +        File rootFile = new File(root);
  +        NetUtils.setRoot(rootFile);
  +        this.root = rootFile.toURL();
       }
   
       /**
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.4   +17 -1     xml-cocoon/src/org/apache/cocoon/util/Attic/NetUtils.java
  
  Index: NetUtils.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/util/Attic/NetUtils.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- NetUtils.java	2000/12/18 15:01:21	1.1.2.3
  +++ NetUtils.java	2000/12/29 18:50:46	1.1.2.4
  @@ -18,12 +18,24 @@
    * utility methods
    *
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.1.2.3 $ $Date: 2000/12/18 15:01:21 $
  + * @version CVS $Revision: 1.1.2.4 $ $Date: 2000/12/29 18:50:46 $
    */
   
   public class NetUtils {
  +    /** The root directory for relative resolution */
  +    private static File root = null;
   
       /**
  +     * This is a write once function that Cocoon uses to register the
  +     * root directory.
  +     */
  +    public static void setRoot(File directory) {
  +        if (NetUtils.root == null) {
  +            NetUtils.root = directory;
  +        }
  +    }
  +
  +    /**
        * Create a URL from a location. This method supports the
        * <i>resource://</i> pseudo-protocol for loading resources
        * accessible to this same class' <code>ClassLoader</code>
  @@ -34,6 +46,10 @@
        */
       public static URL getURL(String location) throws MalformedURLException {
           if (location.indexOf("://") < 0) {
  +            if (NetUtils.root != null) {
  +                return (new File(NetUtils.root, location)).toURL();
  +            }
  +
               return (new File(location)).toURL();
           } else if (location.startsWith("resource://")) {
               URL u = ClassUtils.getResource(location.substring("resource://".length()));
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org

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

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