You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by he...@apache.org on 2003/07/15 10:27:12 UTC

cvs commit: jakarta-turbine-2/src/java/org/apache/turbine/services/pull TurbinePullService.java

henning     2003/07/15 01:27:12

  Modified:    src/java/org/apache/turbine/services/pull
                        TurbinePullService.java
  Log:
  Use the velocity.getNewContext() method to fetch a new object and remove
  a direct velocity dependency. This won't help other templating engines yet,
  but it will help us tons with velocity exception handling
  
  Revision  Changes    Path
  1.27      +23 -4     jakarta-turbine-2/src/java/org/apache/turbine/services/pull/TurbinePullService.java
  
  Index: TurbinePullService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/pull/TurbinePullService.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- TurbinePullService.java	7 May 2003 14:34:37 -0000	1.26
  +++ TurbinePullService.java	15 Jul 2003 08:27:12 -0000	1.27
  @@ -70,9 +70,10 @@
   import org.apache.turbine.services.pool.PoolService;
   import org.apache.turbine.services.pool.TurbinePool;
   import org.apache.turbine.services.security.TurbineSecurity;
  +import org.apache.turbine.services.velocity.VelocityService;
  +import org.apache.turbine.services.velocity.TurbineVelocity;
   import org.apache.turbine.util.RunData;
   
  -import org.apache.velocity.VelocityContext;
   import org.apache.velocity.context.Context;
   
   /**
  @@ -161,6 +162,9 @@
       /** Reference to the pool service */
       private PoolService pool = null;
   
  +    /** Reference to the templating (nee Velocity) service */
  +    private VelocityService velocity = null;
  +
       /**
        * This is the container for the global web application
        * tools that are used in conjunction with the
  @@ -233,7 +237,17 @@
               // which causes an init loop.
               setInit(true);
   
  -            initPullTools();
  +            // Do _NOT_ move this before the setInit(true)
  +            velocity = TurbineVelocity.getService();
  +
  +            if (velocity != null)
  +            {
  +                initPullTools();
  +            }
  +            else
  +            {
  +                log.info("Velocity Service not configured, skipping pull tools!");
  +            }
           }
           catch (Exception e)
           {
  @@ -318,7 +332,12 @@
           persistentTools = getTools(conf.subset(PERSISTENT_TOOL));
   
           // Create and populate the global context right now
  -        globalContext = new VelocityContext();
  +
  +        // This is unholy, because it entwines the VelocityService and 
  +        // the Pull Service even further. However, there isn't much we can
  +        // do for the 2.3 release. Expect this to go post-2.3
  +        globalContext = velocity.getNewContext();
  +
           populateWithGlobalTools(globalContext);
       }
   
  
  
  

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