Author: tv
Date: Wed Sep 11 19:20:01 2013
New Revision: 1521996
URL: http://svn.apache.org/r1521996
Log:
Use @TurbineService annotation instead of static accessors
Modified:
turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityCachedLayout.java
turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityDirectLayout.java
turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityOnlyLayout.java
turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityXslLayout.java
Modified:
turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityCachedLayout.java
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityCachedLayout.java?rev=1521996&r1=1521995&r2=1521996&view=diff
==============================================================================
---
turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityCachedLayout.java
(original)
+++
turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityCachedLayout.java
Wed Sep 11 19:20:01 2013
@@ -22,16 +22,17 @@ package org.apache.turbine.modules.layou
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.turbine.TurbineConstants;
+import org.apache.turbine.annotation.TurbineService;
import org.apache.turbine.modules.Layout;
import org.apache.turbine.pipeline.PipelineData;
-import org.apache.turbine.services.velocity.TurbineVelocity;
+import org.apache.turbine.services.velocity.VelocityService;
import org.apache.turbine.util.RunData;
import org.apache.turbine.util.template.TemplateNavigation;
import org.apache.turbine.util.template.TemplateScreen;
import org.apache.velocity.context.Context;
/**
- * This Layout module is Turbine 2.3.3 VelocityDirectLayout (same package)
+ * This Layout module is Turbine 2.3.3 VelocityDirectLayout (same package)
* with methods added for {@link PipelineData}. It is used in Jetspeed-1
portal.
*
* @author <a href="mailto:[email protected]">Raphaël Luta</a>
@@ -49,6 +50,10 @@ public class VelocityCachedLayout
/** The prefix for lookup up layout pages */
private String prefix = getPrefix() + "/";
+ /** Injected service instance */
+ @TurbineService
+ private VelocityService velocityService;
+
/**
* Method called by LayoutLoader.
*
@@ -59,7 +64,7 @@ public class VelocityCachedLayout
throws Exception
{
// Get the context needed by Velocity.
- Context context = TurbineVelocity.getContext(data);
+ Context context = velocityService.getContext(data);
// variable for the screen in the layout template
context.put(TurbineConstants.SCREEN_PLACEHOLDER,
@@ -81,10 +86,10 @@ public class VelocityCachedLayout
log.debug("Now trying to render layout " + templateName);
// Finally, generate the layout template and send it to the browser
- TurbineVelocity.handleRequest(context,
+ velocityService.handleRequest(context,
prefix + templateName, data.getOut());
}
-
+
/**
* Method called by LayoutLoader.
*
@@ -98,7 +103,7 @@ public class VelocityCachedLayout
{
RunData data = getRunData(pipelineData);
// Get the context needed by Velocity.
- Context context = TurbineVelocity.getContext(pipelineData);
+ Context context = velocityService.getContext(pipelineData);
// variable for the screen in the layout template
context.put(TurbineConstants.SCREEN_PLACEHOLDER,
@@ -120,7 +125,7 @@ public class VelocityCachedLayout
log.debug("Now trying to render layout " + templateName);
// Finally, generate the layout template and send it to the browser
- TurbineVelocity.handleRequest(context,
+ velocityService.handleRequest(context,
prefix + templateName, data.getOut());
}
}
Modified:
turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityDirectLayout.java
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityDirectLayout.java?rev=1521996&r1=1521995&r2=1521996&view=diff
==============================================================================
---
turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityDirectLayout.java
(original)
+++
turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityDirectLayout.java
Wed Sep 11 19:20:01 2013
@@ -24,9 +24,10 @@ package org.apache.turbine.modules.layou
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.turbine.TurbineConstants;
+import org.apache.turbine.annotation.TurbineService;
import org.apache.turbine.modules.Layout;
import org.apache.turbine.pipeline.PipelineData;
-import org.apache.turbine.services.velocity.TurbineVelocity;
+import org.apache.turbine.services.velocity.VelocityService;
import org.apache.turbine.util.RunData;
import org.apache.turbine.util.template.TemplateNavigation;
import org.apache.turbine.util.template.TemplateScreen;
@@ -55,6 +56,10 @@ public class VelocityDirectLayout
/** The prefix for lookup up layout pages */
private String prefix = Layout.PREFIX + "/";
+ /** Injected service instance */
+ @TurbineService
+ private VelocityService velocityService;
+
/**
* Method called by LayoutLoader.
*
@@ -68,7 +73,7 @@ public class VelocityDirectLayout
throws Exception
{
// Get the context needed by Velocity.
- Context context = TurbineVelocity.getContext(data);
+ Context context = velocityService.getContext(data);
// variable for the screen in the layout template
context.put(TurbineConstants.SCREEN_PLACEHOLDER,
@@ -90,7 +95,7 @@ public class VelocityDirectLayout
log.debug("Now trying to render layout " + templateName);
// Finally, generate the layout template and send it to the browser
- TurbineVelocity.handleRequest(context,
+ velocityService.handleRequest(context,
prefix + templateName, data.getResponse().getOutputStream());
}
@@ -107,7 +112,7 @@ public class VelocityDirectLayout
{
RunData data = getRunData(pipelineData);
// Get the context needed by Velocity.
- Context context = TurbineVelocity.getContext(pipelineData);
+ Context context = velocityService.getContext(pipelineData);
// variable for the screen in the layout template
context.put(TurbineConstants.SCREEN_PLACEHOLDER,
@@ -129,7 +134,7 @@ public class VelocityDirectLayout
log.debug("Now trying to render layout " + templateName);
// Finally, generate the layout template and send it to the browser
- TurbineVelocity.handleRequest(context,
+ velocityService.handleRequest(context,
prefix + templateName, data.getResponse().getOutputStream());
}
Modified:
turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityOnlyLayout.java
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityOnlyLayout.java?rev=1521996&r1=1521995&r2=1521996&view=diff
==============================================================================
---
turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityOnlyLayout.java
(original)
+++
turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityOnlyLayout.java
Wed Sep 11 19:20:01 2013
@@ -25,12 +25,13 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ecs.ConcreteElement;
import org.apache.turbine.TurbineConstants;
+import org.apache.turbine.annotation.TurbineService;
import org.apache.turbine.modules.Layout;
import org.apache.turbine.modules.Screen;
import org.apache.turbine.modules.ScreenLoader;
import org.apache.turbine.pipeline.PipelineData;
import org.apache.turbine.services.assemblerbroker.TurbineAssemblerBroker;
-import org.apache.turbine.services.velocity.TurbineVelocity;
+import org.apache.turbine.services.velocity.VelocityService;
import org.apache.turbine.util.RunData;
import org.apache.turbine.util.template.TemplateNavigation;
import org.apache.velocity.context.Context;
@@ -78,6 +79,10 @@ public class VelocityOnlyLayout
private final ScreenLoader screenLoader;
+ /** Injected service instance */
+ @TurbineService
+ private VelocityService velocityService;
+
/**
* Default constructor
*/
@@ -101,7 +106,7 @@ public class VelocityOnlyLayout
throws Exception
{
// Get the context needed by Velocity.
- Context context = TurbineVelocity.getContext(data);
+ Context context = velocityService.getContext(data);
String screenName = data.getScreen();
@@ -133,7 +138,7 @@ public class VelocityOnlyLayout
log.debug("Now trying to render layout " + templateName);
// Finally, generate the layout template and send it to the browser
- TurbineVelocity.handleRequest(context,
+ velocityService.handleRequest(context,
prefix + templateName, data.getResponse().getOutputStream());
}
@@ -151,7 +156,7 @@ public class VelocityOnlyLayout
{
RunData data = getRunData(pipelineData);
// Get the context needed by Velocity.
- Context context = TurbineVelocity.getContext(pipelineData);
+ Context context = velocityService.getContext(pipelineData);
String screenName = data.getScreen();
@@ -183,7 +188,7 @@ public class VelocityOnlyLayout
log.debug("Now trying to render layout " + templateName);
// Finally, generate the layout template and send it to the browser
- TurbineVelocity.handleRequest(context,
+ velocityService.handleRequest(context,
prefix + templateName, data.getResponse().getOutputStream());
}
}
Modified:
turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityXslLayout.java
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityXslLayout.java?rev=1521996&r1=1521995&r2=1521996&view=diff
==============================================================================
---
turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityXslLayout.java
(original)
+++
turbine/core/trunk/src/java/org/apache/turbine/modules/layouts/VelocityXslLayout.java
Wed Sep 11 19:20:01 2013
@@ -26,14 +26,15 @@ import java.io.StringReader;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ecs.ConcreteElement;
-import org.apache.fulcrum.xslt.XSLTServiceFacade;
+import org.apache.fulcrum.xslt.XSLTService;
import org.apache.turbine.TurbineConstants;
+import org.apache.turbine.annotation.TurbineService;
import org.apache.turbine.modules.Layout;
import org.apache.turbine.modules.Screen;
import org.apache.turbine.modules.ScreenLoader;
import org.apache.turbine.pipeline.PipelineData;
import org.apache.turbine.services.assemblerbroker.TurbineAssemblerBroker;
-import org.apache.turbine.services.velocity.TurbineVelocity;
+import org.apache.turbine.services.velocity.VelocityService;
import org.apache.turbine.util.RunData;
import org.apache.turbine.util.template.TemplateNavigation;
import org.apache.velocity.context.Context;
@@ -67,6 +68,14 @@ public class VelocityXslLayout extends L
private final ScreenLoader screenLoader;
+ /** Injected service instance */
+ @TurbineService
+ private VelocityService velocityService;
+
+ /** Injected service instance */
+ @TurbineService
+ private XSLTService xsltService;
+
/**
* Default constructor
*/
@@ -90,7 +99,7 @@ public class VelocityXslLayout extends L
throws Exception
{
// Get the context needed by Velocity.
- Context context = TurbineVelocity.getContext(data);
+ Context context = velocityService.getContext(data);
data.getResponse().setContentType("text/html");
@@ -120,12 +129,12 @@ public class VelocityXslLayout extends L
log.debug("Now trying to render layout " + templateName);
// Now, generate the layout template.
- String temp = TurbineVelocity.handleRequest(context,
+ String temp = velocityService.handleRequest(context,
prefix + templateName);
// Finally we do a transformation and send the result
// back to the browser
- XSLTServiceFacade.transform(
+ xsltService.transform(
data.getTemplateInfo().getScreenTemplate(),
new StringReader(temp), data.getResponse().getWriter());
}
@@ -143,7 +152,7 @@ public class VelocityXslLayout extends L
{
RunData data = getRunData(pipelineData);
// Get the context needed by Velocity.
- Context context = TurbineVelocity.getContext(pipelineData);
+ Context context = velocityService.getContext(pipelineData);
data.getResponse().setContentType("text/html");
@@ -173,12 +182,12 @@ public class VelocityXslLayout extends L
log.debug("Now trying to render layout " + templateName);
// Now, generate the layout template.
- String temp = TurbineVelocity.handleRequest(context,
+ String temp = velocityService.handleRequest(context,
prefix + templateName);
// Finally we do a transformation and send the result
// back to the browser
- XSLTServiceFacade.transform(
+ xsltService.transform(
data.getTemplateInfo().getScreenTemplate(),
new StringReader(temp), data.getResponse().getWriter());
}