You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by jv...@apache.org on 2001/07/16 17:27:26 UTC

cvs commit: jakarta-turbine/src/java/org/apache/turbine/services/velocity ContextAdapter.java TurbineVelocity.java TurbineVelocityService.java VelocityService.java

jvanzyl     01/07/16 08:27:26

  Modified:    src/java/org/apache/turbine/services/pull PullService.java
                        TurbinePull.java TurbinePullService.java
               src/java/org/apache/turbine/services/template
                        BaseTemplateEngineService.java
                        DefaultTemplateContext.java
                        TemplateEngineService.java TemplateService.java
                        TurbineTemplate.java TurbineTemplateService.java
               src/java/org/apache/turbine/services/velocity
                        ContextAdapter.java TurbineVelocity.java
                        TurbineVelocityService.java VelocityService.java
  Log:
  - making sure that the template services only use classes within
    the service namespace. i am trying to make them usable outside
    the context of turbine.
  
  Revision  Changes    Path
  1.8       +3 -3      jakarta-turbine/src/java/org/apache/turbine/services/pull/PullService.java
  
  Index: PullService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/pull/PullService.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- PullService.java	2001/07/10 01:04:27	1.7
  +++ PullService.java	2001/07/16 15:27:20	1.8
  @@ -54,9 +54,9 @@
    * <http://www.apache.org/>.
    */
   
  -import org.apache.turbine.services.Service;
   import org.apache.turbine.RunData;
  -import org.apache.turbine.TemplateContext;
  +import org.apache.turbine.services.Service;
  +import org.apache.turbine.services.template.TemplateContext;
   
   /**
    * The Pull Service manages the creation of application
  @@ -85,7 +85,7 @@
    * be specified as well.
    *
    * @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
  - * @version $Id: PullService.java,v 1.7 2001/07/10 01:04:27 jvanzyl Exp $
  + * @version $Id: PullService.java,v 1.8 2001/07/16 15:27:20 jvanzyl Exp $
    */
   public interface PullService extends Service
   {
  
  
  
  1.12      +2 -2      jakarta-turbine/src/java/org/apache/turbine/services/pull/TurbinePull.java
  
  Index: TurbinePull.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/pull/TurbinePull.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- TurbinePull.java	2001/07/10 01:04:27	1.11
  +++ TurbinePull.java	2001/07/16 15:27:20	1.12
  @@ -55,7 +55,7 @@
    */
   
   import org.apache.turbine.RunData;
  -import org.apache.turbine.TemplateContext;
  +import org.apache.turbine.services.template.TemplateContext;
   import org.apache.turbine.services.TurbineServices;
   
   /**
  @@ -67,7 +67,7 @@
    *
    * @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
    * @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
  - * @version $Id: TurbinePull.java,v 1.11 2001/07/10 01:04:27 jvanzyl Exp $
  + * @version $Id: TurbinePull.java,v 1.12 2001/07/16 15:27:20 jvanzyl Exp $
    */
   public abstract class TurbinePull
   {
  
  
  
  1.31      +2 -2      jakarta-turbine/src/java/org/apache/turbine/services/pull/TurbinePullService.java
  
  Index: TurbinePullService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/pull/TurbinePullService.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- TurbinePullService.java	2001/07/15 18:25:12	1.30
  +++ TurbinePullService.java	2001/07/16 15:27:21	1.31
  @@ -59,7 +59,7 @@
   import java.util.List;
   import java.util.Vector;
   import java.util.HashMap;
  -import org.apache.turbine.TemplateContext;
  +import org.apache.turbine.services.template.TemplateContext;
   import org.apache.turbine.services.template.DefaultTemplateContext;
   import org.apache.turbine.services.security.entity.User;
   import org.apache.turbine.RunData;
  @@ -146,7 +146,7 @@
    *
    * @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
    * @author <a href="mailto:sean@informage.net">Sean Legassick</a>
  - * @version $Id: TurbinePullService.java,v 1.30 2001/07/15 18:25:12 mpoeschl Exp $
  + * @version $Id: TurbinePullService.java,v 1.31 2001/07/16 15:27:21 jvanzyl Exp $
    */
   public class TurbinePullService
       extends BaseService
  
  
  
  1.12      +1 -2      jakarta-turbine/src/java/org/apache/turbine/services/template/BaseTemplateEngineService.java
  
  Index: BaseTemplateEngineService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/template/BaseTemplateEngineService.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- BaseTemplateEngineService.java	2001/07/14 19:36:33	1.11
  +++ BaseTemplateEngineService.java	2001/07/16 15:27:22	1.12
  @@ -58,7 +58,6 @@
   import java.util.Iterator;
   import java.util.Hashtable;
   import org.apache.turbine.RunData;
  -import org.apache.turbine.TemplateContext;
   import org.apache.turbine.services.BaseService;
   import org.apache.turbine.services.ServiceException;
   
  @@ -68,7 +67,7 @@
    *
    * @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
    * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
  - * @version $Id: BaseTemplateEngineService.java,v 1.11 2001/07/14 19:36:33 jvanzyl Exp $
  + * @version $Id: BaseTemplateEngineService.java,v 1.12 2001/07/16 15:27:22 jvanzyl Exp $
    */
   public abstract class BaseTemplateEngineService 
       extends BaseService
  
  
  
  1.2       +1 -3      jakarta-turbine/src/java/org/apache/turbine/services/template/DefaultTemplateContext.java
  
  Index: DefaultTemplateContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/template/DefaultTemplateContext.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultTemplateContext.java	2001/07/10 01:45:52	1.1
  +++ DefaultTemplateContext.java	2001/07/16 15:27:22	1.2
  @@ -58,8 +58,6 @@
   import java.util.List;
   import java.util.Iterator;
   
  -import org.apache.turbine.TemplateContext;
  -
   /**
    *  General purpose implemention of the application Context 
    *  interface for general application use.  This class should 
  @@ -80,7 +78,7 @@
    *  @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
    *  @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
    *  @author <a href="mailto:fedor.karpelevitch@home.com">Fedor Karpelevitch</a>
  - *  @version $Id: DefaultTemplateContext.java,v 1.1 2001/07/10 01:45:52 jvanzyl Exp $
  + *  @version $Id: DefaultTemplateContext.java,v 1.2 2001/07/16 15:27:22 jvanzyl Exp $
    */
   public class DefaultTemplateContext
       implements TemplateContext
  
  
  
  1.8       +1 -3      jakarta-turbine/src/java/org/apache/turbine/services/template/TemplateEngineService.java
  
  Index: TemplateEngineService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/template/TemplateEngineService.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TemplateEngineService.java	2001/07/14 19:36:33	1.7
  +++ TemplateEngineService.java	2001/07/16 15:27:22	1.8
  @@ -59,8 +59,6 @@
   import org.apache.turbine.RunData;
   import org.apache.turbine.services.ServiceException;
   
  -import org.apache.turbine.TemplateContext;
  -
   /**
    * This is the interface that all template engine services must adhere
    * to. This includes the Velocity, WebMacro, FreeMarker, and JSP
  @@ -68,7 +66,7 @@
    *
    * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
    * @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
  - * @version $Id: TemplateEngineService.java,v 1.7 2001/07/14 19:36:33 jvanzyl Exp $ */
  + * @version $Id: TemplateEngineService.java,v 1.8 2001/07/16 15:27:22 jvanzyl Exp $ */
   public interface TemplateEngineService
   {
       public static final String TEMPLATE_EXTENSIONS = "template.extension";
  
  
  
  1.19      +1 -3      jakarta-turbine/src/java/org/apache/turbine/services/template/TemplateService.java
  
  Index: TemplateService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/template/TemplateService.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- TemplateService.java	2001/07/14 19:36:33	1.18
  +++ TemplateService.java	2001/07/16 15:27:22	1.19
  @@ -59,8 +59,6 @@
   import org.apache.turbine.services.ServiceException;
   import org.apache.turbine.services.Service;
   
  -import org.apache.turbine.TemplateContext;
  -
   /**
    * This service provides a method for mapping templates to their
    * appropriate Screens or Navigations.  It also allows templates to
  @@ -72,7 +70,7 @@
    * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
    * @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
    * @author <a href="mailto:ilkka.priha@simsoft.fi">Ilkka Priha</a>
  - * @version $Id: TemplateService.java,v 1.18 2001/07/14 19:36:33 jvanzyl Exp $
  + * @version $Id: TemplateService.java,v 1.19 2001/07/16 15:27:22 jvanzyl Exp $
    */
   public interface TemplateService 
       extends Service
  
  
  
  1.12      +1 -3      jakarta-turbine/src/java/org/apache/turbine/services/template/TurbineTemplate.java
  
  Index: TurbineTemplate.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/template/TurbineTemplate.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- TurbineTemplate.java	2001/07/14 19:36:33	1.11
  +++ TurbineTemplate.java	2001/07/16 15:27:22	1.12
  @@ -59,14 +59,12 @@
   import org.apache.turbine.services.ServiceException;
   import org.apache.turbine.services.TurbineServices;
   
  -import org.apache.turbine.TemplateContext;
  -
   /**
    * This is a simple static accessor to common TemplateService tasks such as
    * getting a Screen that is associated with a screen template.
    *
    * @author <a href="mailto:john.mcnally@clearink.com">John D. McNally</a>
  - * @version $Id: TurbineTemplate.java,v 1.11 2001/07/14 19:36:33 jvanzyl Exp $
  + * @version $Id: TurbineTemplate.java,v 1.12 2001/07/16 15:27:22 jvanzyl Exp $
    */
   public abstract class TurbineTemplate
   {
  
  
  
  1.51      +1 -3      jakarta-turbine/src/java/org/apache/turbine/services/template/TurbineTemplateService.java
  
  Index: TurbineTemplateService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/template/TurbineTemplateService.java,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- TurbineTemplateService.java	2001/07/14 19:36:33	1.50
  +++ TurbineTemplateService.java	2001/07/16 15:27:22	1.51
  @@ -65,8 +65,6 @@
   import org.apache.turbine.services.InitializationException;
   import org.apache.turbine.services.pull.TurbinePull;
   
  -import org.apache.turbine.TemplateContext;
  -
   /**
    * This service provides a method for mapping templates to their
    * appropriate Screens or Navigations.  It also allows templates to
  @@ -105,7 +103,7 @@
    * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
    * @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
    * @author <a href="mailto:ilkka.priha@simsoft.fi">Ilkka Priha</a>
  - * @version $Id: TurbineTemplateService.java,v 1.50 2001/07/14 19:36:33 jvanzyl Exp $
  + * @version $Id: TurbineTemplateService.java,v 1.51 2001/07/16 15:27:22 jvanzyl Exp $
    */
   public class TurbineTemplateService 
       extends BaseService
  
  
  
  1.2       +1 -1      jakarta-turbine/src/java/org/apache/turbine/services/velocity/ContextAdapter.java
  
  Index: ContextAdapter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/velocity/ContextAdapter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ContextAdapter.java	2001/07/10 02:13:29	1.1
  +++ ContextAdapter.java	2001/07/16 15:27:24	1.2
  @@ -54,8 +54,8 @@
    * <http://www.apache.org/>.
    */
   
  -import org.apache.turbine.TemplateContext;
   import org.apache.velocity.context.Context;
  +import org.apache.turbine.services.template.TemplateContext;
   
   /**
    */
  
  
  
  1.16      +1 -25     jakarta-turbine/src/java/org/apache/turbine/services/velocity/TurbineVelocity.java
  
  Index: TurbineVelocity.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/velocity/TurbineVelocity.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- TurbineVelocity.java	2001/07/10 01:04:39	1.15
  +++ TurbineVelocity.java	2001/07/16 15:27:24	1.16
  @@ -58,7 +58,6 @@
   
   import org.apache.turbine.services.TurbineServices;
   import org.apache.turbine.services.velocity.VelocityService;
  -import org.apache.turbine.RunData;
   
   import org.apache.velocity.context.Context;
   
  @@ -76,7 +75,7 @@
    * @author <a href="mailto:john.mcnally@clearink.com">John D. McNally</a>
    * @author <a href="mailto:jon@latchkey.com">Jon S. Stevens</a>
    * @author <a href="mailto:jvanzyl@periapt.com.com">Jason van Zyl</a>
  - * @version $Id: TurbineVelocity.java,v 1.15 2001/07/10 01:04:39 jvanzyl Exp $
  + * @version $Id: TurbineVelocity.java,v 1.16 2001/07/16 15:27:24 jvanzyl Exp $
    */
   public abstract class TurbineVelocity
   {
  @@ -125,28 +124,5 @@
           throws Exception
       {
           getService().handleRequest(context, template, out);
  -    }
  -
  -    /**
  -     * This returns a Context that you can pass into handleRequest
  -     * once you have populated it with information that the template
  -     * will know about.
  -     *
  -     * @param data A Turbine RunData.
  -     * @return A Context.
  -     */
  -    public static Context getContext(RunData data)
  -    {
  -        return getService().getContext(data);
  -    }
  -
  -    /**
  -     * This method returns a blank Context object.
  -     *
  -     * @return A WebContext.
  -     */
  -    public static Context getContext()
  -    {
  -        return getService().getContext();
       }
   }
  
  
  
  1.54      +7 -47     jakarta-turbine/src/java/org/apache/turbine/services/velocity/TurbineVelocityService.java
  
  Index: TurbineVelocityService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/velocity/TurbineVelocityService.java,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- TurbineVelocityService.java	2001/07/14 19:36:34	1.53
  +++ TurbineVelocityService.java	2001/07/16 15:27:24	1.54
  @@ -65,15 +65,11 @@
   import org.apache.velocity.app.Velocity;
   import org.apache.velocity.context.Context;
   import org.apache.velocity.exception.MethodInvocationException;
  -import org.apache.turbine.util.ContentURI;
   import org.apache.turbine.RunData;
  -import org.apache.turbine.util.StringUtils;
   import org.apache.turbine.services.ServiceException;
  -import org.apache.turbine.util.template.TemplateLink;
  -import org.apache.turbine.util.template.TemplatePageAttributes;
   import org.apache.turbine.services.InitializationException;
   import org.apache.turbine.services.template.TurbineTemplate;
  -import org.apache.turbine.TemplateContext;
  +import org.apache.turbine.services.template.TemplateContext;
   import org.apache.turbine.services.template.BaseTemplateEngineService;
   
   /**
  @@ -93,7 +89,7 @@
    * @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
    * @author <a href="mailto:sean@informage.ent">Sean Legassick</a>
    * @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
  - * @version $Id: TurbineVelocityService.java,v 1.53 2001/07/14 19:36:34 jvanzyl Exp $
  + * @version $Id: TurbineVelocityService.java,v 1.54 2001/07/16 15:27:24 jvanzyl Exp $
    */
   public class TurbineVelocityService 
       extends BaseTemplateEngineService
  @@ -133,43 +129,6 @@
           }
       }
   
  -    /**
  -     * Create a Context object that also contains the globalContext.
  -     *
  -     * @return A Context object.
  -     */
  -    public Context getContext()
  -    {
  -        //return new VelocityContext(globalContext);
  -        return new VelocityContext();
  -    }
  -
  -    /**
  -     * Create a Context from the RunData object.  Adds a pointer to
  -     * the RunData object to the WC so that RunData is available in
  -     * the templates.
  -     *
  -     * @param data The Turbine RunData object.
  -     * @return A clone of the WebContext needed by Velocity.
  -     */
  -    public Context getContext(RunData data)
  -    {
  -        // Attempt to get it from the data first.  If it doesn't
  -        // exist, create it and then stuff it into the data.
  -        Context context = (Context)
  -            data.getTemplateInfo().getTemplateContext(VelocityService.CONTEXT);
  -        
  -        if (context == null)
  -        {
  -            context = getContext();
  -            context.put ( "data", data );
  -
  -            data.getTemplateInfo().setTemplateContext(
  -                VelocityService.CONTEXT, context);
  -        }
  -        return context;
  -    }
  -    
       public String handleRequest(TemplateContext context, String template)
           throws ServiceException
       {
  @@ -353,14 +312,15 @@
        *
        * @exception InitializationException For any errors during initialization.
        */
  -    private void initVelocity() throws InitializationException
  +    private void initVelocity() 
  +        throws InitializationException
       {
           // Now we have to perform a couple of path translations
           // for our log file and template paths.
  -        String path = getRealPath
  -            (getConfiguration().getString(Velocity.RUNTIME_LOG, null));
  +        String path = getRealPath(
  +            getConfiguration().getString(Velocity.RUNTIME_LOG, null));
           
  -        if (StringUtils.isValid(path))
  +        if (path != null && path.length() > 0)
           {
               getConfiguration().setProperty(Velocity.RUNTIME_LOG, path);
           }
  
  
  
  1.17      +1 -19     jakarta-turbine/src/java/org/apache/turbine/services/velocity/VelocityService.java
  
  Index: VelocityService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/velocity/VelocityService.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- VelocityService.java	2001/07/14 19:36:34	1.16
  +++ VelocityService.java	2001/07/16 15:27:24	1.17
  @@ -67,12 +67,11 @@
    * @author <a href="mailto:john.mcnally@clearink.com">John D. McNally</a>
    * @author <a href="mailto:mbryson@mont.mindspring.com">Dave Bryson</a>
    * @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
  - * @version $Id: VelocityService.java,v 1.16 2001/07/14 19:36:34 jvanzyl Exp $
  + * @version $Id: VelocityService.java,v 1.17 2001/07/16 15:27:24 jvanzyl Exp $
    */
   public interface VelocityService extends Service
   {
       public static final String SERVICE_NAME = "VelocityService";
  -    public static final String CONTEXT = "VELOCITY_CONTEXT";
   
       /**
        * Process the request and fill in the template with the values
  @@ -101,21 +100,4 @@
                                 String filename,
                                 OutputStream out)
           throws ServiceException;
  -
  -    /**
  -     * Create an empty WebContext object.
  -     *
  -     * @return An empty WebContext object.
  -     */
  -    public Context getContext();
  -
  -    /**
  -     * Create a Context from the RunData object.  Adds a pointer to
  -     * the RunData object to the Context so that RunData is available in
  -     * the templates.
  -     *
  -     * @param data The Turbine RunData object.
  -     * @return A clone of the Context needed by Velocity.
  -     */
  -    public Context getContext(RunData data);
   }
  
  
  

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