You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by jo...@apache.org on 2002/04/04 02:57:25 UTC
cvs commit: jakarta-turbine-fulcrum/src/services/org/apache/fulcrum/velocity TurbineVelocityService.java VelocityService.java
jon 02/04/03 16:57:25
Modified: src/services/org/apache/fulcrum/velocity
TurbineVelocityService.java VelocityService.java
Log:
added a feature to be able to disable the EC processing.
-jon
Revision Changes Path
1.15 +23 -3 jakarta-turbine-fulcrum/src/services/org/apache/fulcrum/velocity/TurbineVelocityService.java
Index: TurbineVelocityService.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-fulcrum/src/services/org/apache/fulcrum/velocity/TurbineVelocityService.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- TurbineVelocityService.java 6 Feb 2002 16:20:15 -0000 1.14
+++ TurbineVelocityService.java 4 Apr 2002 00:57:24 -0000 1.15
@@ -100,7 +100,7 @@
* @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
* @author <a href="mailto:jon@latchkey.com">Jon S. Stevens</a>
* @author <a href="mailto:mpoeschl@marmot.at">Martin Poeschl</a>
- * @version $Id: TurbineVelocityService.java,v 1.14 2002/02/06 16:20:15 mpoeschl Exp $
+ * @version $Id: TurbineVelocityService.java,v 1.15 2002/04/04 00:57:24 jon Exp $
*/
public class TurbineVelocityService
extends BaseTemplateEngineService
@@ -133,6 +133,12 @@
private EventCartridge eventCartridge;
/**
+ * Whether or not to use the eventCartridge. Defaults to true.
+ * Can be used to turn off EC processing.
+ */
+ private boolean eventCartridgeEnabled = true;
+
+ /**
* Performs early initialization of this Turbine service.
*/
public void init()
@@ -279,7 +285,11 @@
VelocityContext velocityContext = new VelocityContext(context);
// Attach the EC to the context
- getEventCartridge().attachToContext(velocityContext);
+ EventCartridge ec = getEventCartridge();
+ if (ec != null && eventCartridgeEnabled)
+ {
+ ec.attachToContext(velocityContext);
+ }
if (encoding != null)
{
@@ -299,7 +309,17 @@
}
/**
- * Returns the populated event cartridge
+ * By default, this is true if there is configured event cartridges.
+ * You can disable EC processing if you first disable it and then call
+ * handleRequest.
+ */
+ public void setEventCartridgeEnabled(boolean value)
+ {
+ this.eventCartridgeEnabled = value;
+ }
+
+ /**
+ * @return EventCartridge the event cartridge
*/
public EventCartridge getEventCartridge()
{
1.5 +14 -1 jakarta-turbine-fulcrum/src/services/org/apache/fulcrum/velocity/VelocityService.java
Index: VelocityService.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-fulcrum/src/services/org/apache/fulcrum/velocity/VelocityService.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- VelocityService.java 4 Dec 2001 03:16:40 -0000 1.4
+++ VelocityService.java 4 Apr 2002 00:57:24 -0000 1.5
@@ -60,6 +60,7 @@
import org.apache.fulcrum.ServiceException;
import org.apache.velocity.Template;
import org.apache.velocity.context.Context;
+import org.apache.velocity.app.event.EventCartridge;
/**
* The Turbine service interface to
@@ -69,7 +70,7 @@
* @author <a href="mailto:mbryson@mont.mindspring.com">Dave Bryson</a>
* @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
* @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
- * @version $Id: VelocityService.java,v 1.4 2001/12/04 03:16:40 jmcnally Exp $
+ * @version $Id: VelocityService.java,v 1.5 2002/04/04 00:57:24 jon Exp $
*/
public interface VelocityService extends Service
{
@@ -172,4 +173,16 @@
public void handleRequest(Context context, String filename,
Writer writer, String encoding)
throws ServiceException;
+
+ /**
+ * Returns the populated event cartridge or null if it has not been populated
+ */
+ public EventCartridge getEventCartridge();
+
+ /**
+ * By default, this is true if there is configured event cartridges.
+ * You can disable EC processing if you first disable it and then call
+ * handleRequest.
+ */
+ public void setEventCartridgeEnabled(boolean value);
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>