portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wea...@apache.org
Subject cvs commit: jakarta-jetspeed-2/components/jetspeed/test/assembly TestTemplateLocator.groovy
Date Sat, 13 Mar 2004 23:56:17 GMT
weaver      2004/03/13 15:56:17

  Modified:    portal/src/webapp/WEB-INF/assembly jetspeed.groovy
               components/jetspeed/src/java/org/apache/jetspeed/locator
                        JetspeedTemplateLocator.java
               components/jetspeed/test/assembly TestTemplateLocator.groovy
  Log:
  fixed issue with having to hard-code "WEB-INF/templates" into the relative template path
  
  Revision  Changes    Path
  1.20      +4 -1      jakarta-jetspeed-2/portal/src/webapp/WEB-INF/assembly/jetspeed.groovy
  
  Index: jetspeed.groovy
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/webapp/WEB-INF/assembly/jetspeed.groovy,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- jetspeed.groovy	9 Mar 2004 16:20:49 -0000	1.19
  +++ jetspeed.groovy	13 Mar 2004 23:56:17 -0000	1.20
  @@ -46,7 +46,10 @@
   // Template Locator component assembly
   //
   roots = [ applicationRoot + "WEB-INF/templates" ]
  -container.registerComponentInstance("TemplateLocator", new JetspeedTemplateLocator(roots))
  +container.registerComponentInstance("TemplateLocator", new JetspeedTemplateLocator(roots,
applicationRoot))
  +
  +decorationRoots = [ applicationRoot + "WEB-INF/decorations" ]
  +container.registerComponentInstance("DecorationLocator", new JetspeedTemplateLocator(decorationRoots,
applicationRoot))
   
   //
   // ID Generator
  
  
  
  1.4       +22 -7     jakarta-jetspeed-2/components/jetspeed/src/java/org/apache/jetspeed/locator/JetspeedTemplateLocator.java
  
  Index: JetspeedTemplateLocator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/jetspeed/src/java/org/apache/jetspeed/locator/JetspeedTemplateLocator.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JetspeedTemplateLocator.java	8 Mar 2004 00:43:31 -0000	1.3
  +++ JetspeedTemplateLocator.java	13 Mar 2004 23:56:17 -0000	1.4
  @@ -40,6 +40,9 @@
   
       /** the template root directories, all application root relative */
       private List roots;
  +    
  +    /** Root of the application running this locator */
  +    private String appRoot;
          
       /** the Template class is factory created */     
       private Class  templateClass = JetspeedTemplateDescriptor.class;
  @@ -64,11 +67,14 @@
       /**
        * Minimal assembly with a list of resource directory roots.
        * 
  -     * @param roots A list of resource root directories where templates are located. 
  +     * @param roots A list of resource root directories where templates are located.
  +     * @param appRoot  Root from where this application runs
        */
  -    public JetspeedTemplateLocator(List roots) 
  +    public JetspeedTemplateLocator(List roots, String appRoot) 
       {
  -        this.roots = roots;        
  +        this.roots = roots;   
  +        this.appRoot = appRoot;
  +        
       }
   
       /**
  @@ -80,9 +86,11 @@
        *                           Any value is allowed. Use locator types to group templates
together. 
        */
       public JetspeedTemplateLocator(List roots, 
  -                                        String defaultLocatorType)
  +                                        String defaultLocatorType,
  +                                        String appRoot)
       {
           this.roots = roots;        
  +        this.appRoot = appRoot;
           this.defaultLocatorType = defaultLocatorType;
       }
   
  @@ -98,10 +106,12 @@
        */
       public JetspeedTemplateLocator(List roots, 
                                      List omClasses,
  -                                   String defaultLocatorType)
  +                                   String defaultLocatorType,
  +                                   String appRoot)
       {
           System.out.println("Initializing template locator component: " + locatorClass);

           this.roots = roots;
  +        this.appRoot = appRoot;
           this.defaultLocatorType = defaultLocatorType;
           if (omClasses.size() > 0)
           {
  @@ -183,7 +193,12 @@
                                   + " returning "
                                   + workingPath);
                   }
  -                return createTemplateFromPath(path, templateName, realPath, "/WEB-INF/templates"
+ workingPath);
  +                int appRootLength = appRoot.length();
  +                // remove the application root path from the reall path to
  +                // give us a app relative path
  +                String appRelativePath = realPath.substring(appRootLength, realPath.length());
  +                // return createTemplateFromPath(path, templateName, realPath, "/WEB-INF/templates"
+ workingPath);
  +                return createTemplateFromPath(path, templateName, realPath, appRelativePath);
               }
               // else strip path of one of its components and loop
               int pt = path.lastIndexOf(PATH_SEPARATOR);
  
  
  
  1.3       +1 -1      jakarta-jetspeed-2/components/jetspeed/test/assembly/TestTemplateLocator.groovy
  
  Index: TestTemplateLocator.groovy
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/jetspeed/test/assembly/TestTemplateLocator.groovy,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestTemplateLocator.groovy	21 Feb 2004 06:11:24 -0000	1.2
  +++ TestTemplateLocator.groovy	13 Mar 2004 23:56:17 -0000	1.3
  @@ -18,6 +18,6 @@
                 org.apache.jetspeed.locator.JetspeedLocatorDescriptor ]
   defaultType = "email"
   container.registerComponentInstance("TemplateLocator", 
  -                                    new JetspeedTemplateLocator(roots, omClasses, defaultType))
  +                                    new JetspeedTemplateLocator(roots, omClasses, defaultType,
applicationRoot))
   
   return container
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Mime
View raw message