Modified: turbine/core/trunk/src/java/org/apache/turbine/services/rundata/DefaultTurbineRunData.java URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/services/rundata/DefaultTurbineRunData.java?rev=1695634&r1=1695633&r2=1695634&view=diff ============================================================================== --- turbine/core/trunk/src/java/org/apache/turbine/services/rundata/DefaultTurbineRunData.java (original) +++ turbine/core/trunk/src/java/org/apache/turbine/services/rundata/DefaultTurbineRunData.java Thu Aug 13 00:35:47 2015 @@ -155,7 +155,7 @@ public class DefaultTurbineRunData /** A holder for stack trace. */ private String stackTrace; - /** A holder ofr stack trace exception. */ + /** A holder for stack trace exception. */ private Throwable stackTraceException; /** @@ -308,6 +308,7 @@ public class DefaultTurbineRunData /** * Recycles the object by removing its disposed flag. */ + @Override public void recycle() { disposed = false; @@ -316,6 +317,7 @@ public class DefaultTurbineRunData /** * Disposes a run data object. */ + @Override public void dispose() { // empty pipelinedata map @@ -353,11 +355,12 @@ public class DefaultTurbineRunData * * @return a parameter parser. */ + @Override public ParameterParser getParameters() { // Parse the parameters first, if not yet done. - ParameterParser parameters = get(Turbine.class, ParameterParser.class); - HttpServletRequest request = get(Turbine.class, HttpServletRequest.class); + ParameterParser parameters = getParameterParser(); + HttpServletRequest request = getRequest(); if ((parameters != null) && (parameters.getRequest() != request)) @@ -373,11 +376,12 @@ public class DefaultTurbineRunData * * @return a cookie parser. */ + @Override public CookieParser getCookies() { // Parse the cookies first, if not yet done. - CookieParser cookies = get(Turbine.class, CookieParser.class); - HttpServletRequest request = get(Turbine.class, HttpServletRequest.class); + CookieParser cookies = getCookieParser(); + HttpServletRequest request = getRequest(); if ((cookies != null) && (cookies.getRequest() != request)) @@ -393,6 +397,7 @@ public class DefaultTurbineRunData * * @return the request. */ + @Override public HttpServletRequest getRequest() { return get(Turbine.class, HttpServletRequest.class); @@ -403,6 +408,7 @@ public class DefaultTurbineRunData * * @return the response. */ + @Override public HttpServletResponse getResponse() { return get(Turbine.class, HttpServletResponse.class); @@ -413,6 +419,7 @@ public class DefaultTurbineRunData * * @return the session. */ + @Override public HttpSession getSession() { return getRequest().getSession(); @@ -423,6 +430,7 @@ public class DefaultTurbineRunData * * @return the configuration. */ + @Override public ServletConfig getServletConfig() { return get(Turbine.class, ServletConfig.class); @@ -433,6 +441,7 @@ public class DefaultTurbineRunData * * @return the context. */ + @Override public ServletContext getServletContext() { return get(Turbine.class, ServletContext.class); @@ -443,6 +452,7 @@ public class DefaultTurbineRunData * * @return the access control list. */ + @Override public <A extends AccessControlList> A getACL() { @SuppressWarnings("unchecked") @@ -455,6 +465,7 @@ public class DefaultTurbineRunData * * @param acl an access control list. */ + @Override public void setACL(AccessControlList acl) { get(Turbine.class).put(AccessControlList.class, acl); @@ -466,6 +477,7 @@ public class DefaultTurbineRunData * @return true if the page is set. * @deprecated no replacement planned, ECS is no longer a requirement */ + @Override @Deprecated public boolean isPageSet() { @@ -478,6 +490,7 @@ public class DefaultTurbineRunData * @return a document. * @deprecated no replacement planned, ECS is no longer a requirement */ + @Override @Deprecated public Document getPage() { @@ -494,6 +507,7 @@ public class DefaultTurbineRunData * * @return true if an action has been defined. */ + @Override public boolean hasAction() { return (StringUtils.isNotEmpty(this.action) @@ -507,6 +521,7 @@ public class DefaultTurbineRunData * * @return a string, "" if null. */ + @Override public String getAction() { return (hasAction() ? this.action : ""); @@ -517,6 +532,7 @@ public class DefaultTurbineRunData * * @param action a atring. */ + @Override public void setAction(String action) { this.action = action; @@ -535,6 +551,7 @@ public class DefaultTurbineRunData * @return a string. */ + @Override public String getLayout() { if (this.layout == null) @@ -560,6 +577,7 @@ public class DefaultTurbineRunData * * @param layout a string. */ + @Override public void setLayout(String layout) { this.layout = layout; @@ -571,6 +589,7 @@ public class DefaultTurbineRunData * * @return a string. */ + @Override public String getLayoutTemplate() { return getTemplateInfo().getLayoutTemplate(); @@ -585,6 +604,7 @@ public class DefaultTurbineRunData * * @param layout a layout template. */ + @Override public void setLayoutTemplate(String layout) { getTemplateInfo().setLayoutTemplate(layout); @@ -595,6 +615,7 @@ public class DefaultTurbineRunData * * @return true if a screen has been defined. */ + @Override public boolean hasScreen() { return StringUtils.isNotEmpty(this.screen); @@ -605,6 +626,7 @@ public class DefaultTurbineRunData * * @return a string. */ + @Override public String getScreen() { return (hasScreen() ? this.screen : ""); @@ -615,6 +637,7 @@ public class DefaultTurbineRunData * * @param screen a string. */ + @Override public void setScreen(String screen) { this.screen = screen; @@ -626,6 +649,7 @@ public class DefaultTurbineRunData * * @return a string. */ + @Override public String getScreenTemplate() { return getTemplateInfo().getScreenTemplate(); @@ -639,6 +663,7 @@ public class DefaultTurbineRunData * * @param screen a screen template. */ + @Override public void setScreenTemplate(String screen) { getTemplateInfo().setScreenTemplate(screen); @@ -649,6 +674,7 @@ public class DefaultTurbineRunData * * @return the template encoding or null if not specified. */ + @Override public String getTemplateEncoding() { return templateEncoding; @@ -659,6 +685,7 @@ public class DefaultTurbineRunData * * @param encoding the template encoding. */ + @Override public void setTemplateEncoding(String encoding) { templateEncoding = encoding; @@ -669,6 +696,7 @@ public class DefaultTurbineRunData * * @return a template info. */ + @Override public TemplateInfo getTemplateInfo() { TemplateInfo templateInfo = get(Turbine.class, TemplateInfo.class); @@ -687,6 +715,7 @@ public class DefaultTurbineRunData * * @return true if a message has been defined. */ + @Override public boolean hasMessage() { StringElement message = get(Turbine.class, StringElement.class); @@ -700,6 +729,7 @@ public class DefaultTurbineRunData * * @return a string. */ + @Override public String getMessage() { StringElement message = get(Turbine.class, StringElement.class); @@ -711,6 +741,7 @@ public class DefaultTurbineRunData * * @param msg a string. */ + @Override public void setMessage(String msg) { get(Turbine.class).put(StringElement.class, new StringElement(msg)); @@ -722,6 +753,7 @@ public class DefaultTurbineRunData * * @param msg a string. */ + @Override public void addMessage(String msg) { addMessage(new StringElement(msg)); @@ -733,6 +765,7 @@ public class DefaultTurbineRunData * * @return a string element. */ + @Override public StringElement getMessageAsHTML() { return get(Turbine.class, StringElement.class); @@ -743,6 +776,7 @@ public class DefaultTurbineRunData * * @param msg an element. */ + @Override public void setMessage(Element msg) { get(Turbine.class).put(StringElement.class, new StringElement(msg)); @@ -754,6 +788,7 @@ public class DefaultTurbineRunData * * @param msg an element. */ + @Override public void addMessage(Element msg) { if (msg != null) @@ -774,6 +809,7 @@ public class DefaultTurbineRunData /** * Unsets the message for the request. */ + @Override public void unsetMessage() { get(Turbine.class).remove(StringElement.class); @@ -785,6 +821,7 @@ public class DefaultTurbineRunData * * @return a FormMessages. */ + @Override public FormMessages getMessages() { FormMessages messages = get(Turbine.class, FormMessages.class); @@ -802,6 +839,7 @@ public class DefaultTurbineRunData * * @param msgs A FormMessages. */ + @Override public void setMessages(FormMessages msgs) { get(Turbine.class).put(FormMessages.class, msgs); @@ -812,6 +850,7 @@ public class DefaultTurbineRunData * * @return a string. */ + @Override public String getTitle() { return (this.title == null ? "" : this.title); @@ -822,6 +861,7 @@ public class DefaultTurbineRunData * * @param title a string. */ + @Override public void setTitle(String title) { this.title = title; @@ -832,6 +872,7 @@ public class DefaultTurbineRunData * * @return true if a user exists in this session. */ + @Override public boolean userExists() { User user = getUserFromSession(); @@ -847,6 +888,7 @@ public class DefaultTurbineRunData * * @return a user. */ + @Override public <T extends User> T getUser() { @SuppressWarnings("unchecked") @@ -859,6 +901,7 @@ public class DefaultTurbineRunData * * @param user a user. */ + @Override public void setUser(User user) { log.debug("user set: " + user.getName()); @@ -871,6 +914,7 @@ public class DefaultTurbineRunData * * @return a user. */ + @Override public <T extends User> T getUserFromSession() { return getUserFromSession(getSession()); @@ -881,6 +925,7 @@ public class DefaultTurbineRunData * * @return true if user was invalidated. */ + @Override public boolean removeUserFromSession() { return removeUserFromSession(getSession()); @@ -892,6 +937,7 @@ public class DefaultTurbineRunData * @return true if out is set. * @deprecated no replacement planned, response writer will not be cached */ + @Override @Deprecated public boolean isOutSet() { @@ -905,6 +951,7 @@ public class DefaultTurbineRunData * @return a print writer. * @throws IOException */ + @Override public PrintWriter getOut() throws IOException { @@ -924,6 +971,7 @@ public class DefaultTurbineRunData * mechanisms that may call res.getWriter() themselves * (such as JSP.) */ + @Override public void declareDirectResponse() { outSet = true; @@ -939,6 +987,7 @@ public class DefaultTurbineRunData * * @return the locale. */ + @Override public Locale getLocale() { Locale locale = get(Turbine.class, Locale.class); @@ -954,6 +1003,7 @@ public class DefaultTurbineRunData * * @param locale the new locale. */ + @Override public void setLocale(Locale locale) { get(Turbine.class).put(Locale.class, locale); @@ -982,6 +1032,7 @@ public class DefaultTurbineRunData * * @return the name of the charset or null. */ + @Override public String getCharSet() { log.debug("getCharSet()"); @@ -1002,6 +1053,7 @@ public class DefaultTurbineRunData * * @param charSet the name of the new charset. */ + @Override public void setCharSet(String charSet) { log.debug("setCharSet(" + charSet + ")"); @@ -1019,6 +1071,7 @@ public class DefaultTurbineRunData * * @return the content type or an empty string. */ + @Override public String getContentType() { if (StringUtils.isNotEmpty(contentType)) @@ -1046,6 +1099,7 @@ public class DefaultTurbineRunData * * @param contentType a string. */ + @Override public void setContentType(String contentType) { this.contentType = contentType; @@ -1057,6 +1111,7 @@ public class DefaultTurbineRunData * * @return a string, "" if null. */ + @Override public String getRedirectURI() { return (this.redirectURI == null ? "" : redirectURI); @@ -1068,6 +1123,7 @@ public class DefaultTurbineRunData * * @param ruri a string. */ + @Override public void setRedirectURI(String ruri) { this.redirectURI = ruri; @@ -1078,6 +1134,7 @@ public class DefaultTurbineRunData * * @return the status. */ + @Override public int getStatusCode() { return statusCode; @@ -1088,6 +1145,7 @@ public class DefaultTurbineRunData * * @param statusCode the status. */ + @Override public void setStatusCode(int statusCode) { this.statusCode = statusCode; @@ -1098,6 +1156,7 @@ public class DefaultTurbineRunData * * @return a SystemError[]. */ + @Override public SystemError[] getSystemErrors() { SystemError[] result = new SystemError[errors.size()]; @@ -1110,6 +1169,7 @@ public class DefaultTurbineRunData * * @param err a system error. */ + @Override public void setSystemError(SystemError err) { this.errors.add(err); @@ -1120,6 +1180,7 @@ public class DefaultTurbineRunData * * @return a hashtable. */ + @Override public Map<String, Context> getJNDIContexts() { if (jndiContexts == null) @@ -1134,6 +1195,7 @@ public class DefaultTurbineRunData * * @param contexts a hashtable. */ + @Override public void setJNDIContexts(Map<String, Context> contexts) { this.jndiContexts = contexts; @@ -1144,6 +1206,7 @@ public class DefaultTurbineRunData * * @return a string. */ + @Override public String getServerScheme() { return getServerData().getServerScheme(); @@ -1154,6 +1217,7 @@ public class DefaultTurbineRunData * * @return a string. */ + @Override public String getServerName() { return getServerData().getServerName(); @@ -1164,6 +1228,7 @@ public class DefaultTurbineRunData * * @return an int. */ + @Override public int getServerPort() { return getServerData().getServerPort(); @@ -1174,6 +1239,7 @@ public class DefaultTurbineRunData * * @return a string. */ + @Override public String getContextPath() { return getServerData().getContextPath(); @@ -1184,6 +1250,7 @@ public class DefaultTurbineRunData * * @return a string. */ + @Override public String getScriptName() { return getServerData().getScriptName(); @@ -1194,6 +1261,7 @@ public class DefaultTurbineRunData * * @return server data. */ + @Override public ServerData getServerData() { return get(Turbine.class, ServerData.class); @@ -1204,6 +1272,7 @@ public class DefaultTurbineRunData * * @return a string. */ + @Override public String getRemoteAddr() { if (this.remoteAddr == null) @@ -1219,6 +1288,7 @@ public class DefaultTurbineRunData * * @return a string. */ + @Override public String getRemoteHost() { if (this.remoteHost == null) @@ -1236,6 +1306,7 @@ public class DefaultTurbineRunData * * @return a string. */ + @Override public String getUserAgent() { if (StringUtils.isEmpty(userAgent)) @@ -1250,6 +1321,7 @@ public class DefaultTurbineRunData * Pulls a user object from the session and increments the access * counter and sets the last access date for the object. */ + @Override public void populate() { User user = getUserFromSession(); @@ -1266,6 +1338,7 @@ public class DefaultTurbineRunData /** * Saves a user object into the session. */ + @Override public void save() { getSession().setAttribute(User.SESSION_KEY, getUser()); @@ -1276,6 +1349,7 @@ public class DefaultTurbineRunData * * @return the stack trace. */ + @Override public String getStackTrace() { return stackTrace; @@ -1286,6 +1360,7 @@ public class DefaultTurbineRunData * * @return the stack exception. */ + @Override public Throwable getStackTraceException() { return stackTraceException; @@ -1297,6 +1372,7 @@ public class DefaultTurbineRunData * @param trace the stack trace. * @param exp the exception. */ + @Override public void setStackTrace(String trace, Throwable exp) { stackTrace = trace; @@ -1304,18 +1380,6 @@ public class DefaultTurbineRunData } /** - * Gets a Map of debug variables. - * - * @return a Map of debug variables. - * @deprecated use {@link #getDebugVariables} instead - */ - @Deprecated - public Map<String, Object> getVarDebug() - { - return debugVariables; - } - - /** * Sets a name/value pair in an internal Map that is accessible from the * Error screen. This is a good way to get debugging information * when an exception is thrown. @@ -1323,6 +1387,7 @@ public class DefaultTurbineRunData * @param name name of the variable * @param value value of the variable. */ + @Override public void setDebugVariable(String name, Object value) { this.debugVariables.put(name, value); @@ -1333,6 +1398,7 @@ public class DefaultTurbineRunData * * @return a Map of debug variables. */ + @Override public Map<String, Object> getDebugVariables() { return this.debugVariables; @@ -1352,90 +1418,23 @@ public class DefaultTurbineRunData * no object and thus the default or even an undefined encoding * instead of the actual request character encoding). */ + @Override public ParameterParser getParameterParser() { return get(Turbine.class, ParameterParser.class); } /** - * Sets the parameter parser. - * - * @param parser a parameter parser. - */ - public void setParameterParser(ParameterParser parser) - { - get(Turbine.class).put(ParameterParser.class, parser); - } - - /** * Gets the cookie parser without parsing the cookies. * * @return the cookie parser. */ + @Override public CookieParser getCookieParser() { return get(Turbine.class, CookieParser.class); } - /** - * Sets the cookie parser. - * - * @param parser a cookie parser. - */ - public void setCookieParser(CookieParser parser) - { - get(Turbine.class).put(CookieParser.class, parser); - } - - /** - * Sets the servlet request. - * - * @param req a request. - */ - public void setRequest(HttpServletRequest req) - { - get(Turbine.class).put(HttpServletRequest.class, req); - } - - /** - * Sets the servlet response. - * - * @param res a response. - */ - public void setResponse(HttpServletResponse res) - { - get(Turbine.class).put(HttpServletResponse.class, res); - } - - /** - * Sets the servlet configuration used during servlet init. - * - * @param config a configuration. - */ - public void setServletConfig(ServletConfig config) - { - get(Turbine.class).put(ServletConfig.class, config); - - if (config == null) - { - get(Turbine.class).put(ServletContext.class, null); - } - else - { - get(Turbine.class).put(ServletContext.class, config.getServletContext()); - } - } - - /** - * Sets the server data of the request. - * - * @param serverData server data. - */ - public void setServerData(ServerData serverData) - { - get(Turbine.class).put(ServerData.class, serverData); - } - // ******************** // Miscellanous setters // ******************** @@ -1446,6 +1445,7 @@ public class DefaultTurbineRunData * @param out a print writer. * @deprecated no replacement planned, response writer will not be cached */ + @Deprecated protected void setOut(PrintWriter out) { this.out = out; @@ -1506,6 +1506,7 @@ public class DefaultTurbineRunData * * @return true, if the object is disposed. */ + @Override public boolean isDisposed() { return disposed;
Modified: turbine/core/trunk/src/java/org/apache/turbine/services/rundata/TurbineRunData.java URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/services/rundata/TurbineRunData.java?rev=1695634&r1=1695633&r2=1695634&view=diff ============================================================================== --- turbine/core/trunk/src/java/org/apache/turbine/services/rundata/TurbineRunData.java (original) +++ turbine/core/trunk/src/java/org/apache/turbine/services/rundata/TurbineRunData.java Thu Aug 13 00:35:47 2015 @@ -19,21 +19,16 @@ package org.apache.turbine.services.rund * under the License. */ -import javax.servlet.ServletConfig; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - import org.apache.fulcrum.parser.CookieParser; import org.apache.fulcrum.parser.ParameterParser; import org.apache.fulcrum.pool.Recyclable; import org.apache.turbine.util.RunData; -import org.apache.turbine.util.ServerData; /** * TurbineRunData is an extension to the RunData interface to be * implemented by RunData implementations to be distributed by * the Turbine RunData Service. The extensions define methods - * that are used by the service for initilizing the implementation, + * that are used by the service for initializing the implementation, * but which are not meant to be called by the actual client objects. * * <p>TurbineRunData extends also the Recyclable interface making @@ -58,51 +53,9 @@ public interface TurbineRunData ParameterParser getParameterParser(); /** - * Sets the parameter parser. - * - * @param parser a parameter parser. - */ - void setParameterParser(ParameterParser parser); - - /** * Gets the cookie parser without parsing the cookies. * * @return the cookie parser. */ CookieParser getCookieParser(); - - /** - * Sets the cookie parser. - * - * @param parser a cookie parser. - */ - void setCookieParser(CookieParser parser); - - /** - * Sets the servlet request. - * - * @param req a request. - */ - void setRequest(HttpServletRequest req); - - /** - * Sets the servlet response. - * - * @param res a response. - */ - void setResponse(HttpServletResponse res); - - /** - * Sets the servlet configuration used during servlet init. - * - * @param config a configuration. - */ - void setServletConfig(ServletConfig config); - - /** - * Sets the server data of the request. - * - * @param serverData server data. - */ - void setServerData(ServerData serverData); } Modified: turbine/core/trunk/src/java/org/apache/turbine/services/rundata/TurbineRunDataService.java URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/services/rundata/TurbineRunDataService.java?rev=1695634&r1=1695633&r2=1695634&view=diff ============================================================================== --- turbine/core/trunk/src/java/org/apache/turbine/services/rundata/TurbineRunDataService.java (original) +++ turbine/core/trunk/src/java/org/apache/turbine/services/rundata/TurbineRunDataService.java Thu Aug 13 00:35:47 2015 @@ -25,6 +25,7 @@ import java.util.Locale; import java.util.Map; import javax.servlet.ServletConfig; +import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -36,6 +37,7 @@ import org.apache.fulcrum.parser.Paramet import org.apache.fulcrum.parser.ParserService; import org.apache.fulcrum.pool.PoolException; import org.apache.fulcrum.pool.PoolService; +import org.apache.turbine.Turbine; import org.apache.turbine.services.InitializationException; import org.apache.turbine.services.TurbineBaseService; import org.apache.turbine.services.TurbineServices; @@ -184,6 +186,7 @@ public class TurbineRunDataService * @return a new or recycled RunData object. * @throws TurbineException if the operation fails. */ + @Override public RunData getRunData(HttpServletRequest req, HttpServletResponse res, ServletConfig config) @@ -204,6 +207,7 @@ public class TurbineRunDataService * @throws IllegalArgumentException if any of the parameters are null. * @todo The "key" parameter should be removed in favor of just looking up what class via the roleConfig avalon file. */ + @Override public RunData getRunData(String key, HttpServletRequest req, HttpServletResponse res, @@ -259,10 +263,11 @@ public class TurbineRunDataService data = (TurbineRunData) pool.getInstance(runDataClazz); @SuppressWarnings("unchecked") // ok ParameterParser pp = parserService.getParser((Class<ParameterParser>)parameterParserClazz); - data.setParameterParser(pp); + data.get(Turbine.class).put(ParameterParser.class, pp); + @SuppressWarnings("unchecked") // ok CookieParser cp = parserService.getParser((Class<CookieParser>)cookieParserClazz); - data.setCookieParser(cp); + data.get(Turbine.class).put(CookieParser.class, cp); Locale locale = req.getLocale(); @@ -293,15 +298,15 @@ public class TurbineRunDataService } // Set the request and response. - data.setRequest(req); - data.setResponse(res); + data.get(Turbine.class).put(HttpServletRequest.class, req); + data.get(Turbine.class).put(HttpServletResponse.class, res); // Set the servlet configuration. - data.setServletConfig(config); + data.get(Turbine.class).put(ServletConfig.class, config); + data.get(Turbine.class).put(ServletContext.class, config.getServletContext()); // Set the ServerData. - ServerData sd = new ServerData(req); - data.setServerData(sd); + data.get(Turbine.class).put(ServerData.class, new ServerData(req)); return data; } @@ -312,6 +317,7 @@ public class TurbineRunDataService * @param data the used RunData object. * @return true, if pooling is supported and the object was accepted. */ + @Override public boolean putRunData(RunData data) { if (data instanceof TurbineRunData) Modified: turbine/core/trunk/src/java/org/apache/turbine/services/velocity/TurbineVelocity.java URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/services/velocity/TurbineVelocity.java?rev=1695634&r1=1695633&r2=1695634&view=diff ============================================================================== --- turbine/core/trunk/src/java/org/apache/turbine/services/velocity/TurbineVelocity.java (original) +++ turbine/core/trunk/src/java/org/apache/turbine/services/velocity/TurbineVelocity.java Thu Aug 13 00:35:47 2015 @@ -26,8 +26,6 @@ import java.io.Writer; import org.apache.turbine.pipeline.PipelineData; import org.apache.turbine.services.TurbineServices; -import org.apache.turbine.util.RunData; - import org.apache.velocity.context.Context; /** @@ -117,21 +115,8 @@ public abstract class TurbineVelocity * This returns a Context that you can pass into handleRequest * once you have populated it with information that the template * will know about. - * @deprecated Use the PipelineData version instead. - * @param data A Turbine RunData. - * @return A Context. - */ - public static Context getContext(RunData data) - { - return getService().getContext(data); - } - - /** - * 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. + * @param pipelineData A Turbine PipelineData. * @return A Context. */ public static Context getContext(PipelineData pipelineData) Modified: turbine/core/trunk/src/java/org/apache/turbine/services/velocity/TurbineVelocityService.java URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/services/velocity/TurbineVelocityService.java?rev=1695634&r1=1695633&r2=1695634&view=diff ============================================================================== --- turbine/core/trunk/src/java/org/apache/turbine/services/velocity/TurbineVelocityService.java (original) +++ turbine/core/trunk/src/java/org/apache/turbine/services/velocity/TurbineVelocityService.java Thu Aug 13 00:35:47 2015 @@ -165,6 +165,7 @@ public class TurbineVelocityService * * @return A Context object. */ + @Override public Context getContext() { Context globalContext = @@ -179,6 +180,7 @@ public class TurbineVelocityService * * @return A Context Object. */ + @Override public Context getNewContext() { Context ctx = new VelocityContext(); @@ -204,6 +206,7 @@ public class TurbineVelocityService * @return A valid value to be used as Return value * @throws Exception We threw the exception further up */ + @Override @SuppressWarnings("rawtypes") // Interface not generified public Object methodException(Class clazz, String method, Exception e) throws Exception @@ -219,48 +222,14 @@ public class TurbineVelocityService } /** - * Create a Context from the RunData object. Adds a pointer to - * the RunData object to the VelocityContext so that RunData - * is available in the templates. - * @deprecated. Use PipelineData version. - * @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(VelocityService.RUNDATA_KEY, data); - - if (pullModelActive) - { - // Populate the toolbox with request scope, session scope - // and persistent scope tools (global tools are already in - // the toolBoxContent which has been wrapped to construct - // this request-specific context). - pullService.populateContext(context, data); - } - - data.getTemplateInfo().setTemplateContext( - VelocityService.CONTEXT, context); - } - return context; - } - - /** * Create a Context from the PipelineData object. Adds a pointer to - * the RunData object to the VelocityContext so that RunData + * the PipelineData object to the VelocityContext so that PipelineData * is available in the templates. * - * @param data The Turbine RunData object. + * @param pipelineData The Turbine PipelineData object. * @return A clone of the WebContext needed by Velocity. */ + @Override public Context getContext(PipelineData pipelineData) { //Map runDataMap = (Map)pipelineData.get(RunData.class); @@ -303,6 +272,7 @@ public class TurbineVelocityService * @throws TurbineException Any exception thrown while processing will be * wrapped into a TurbineException and rethrown. */ + @Override public String handleRequest(Context context, String filename) throws TurbineException { @@ -354,6 +324,7 @@ public class TurbineVelocityService * @throws TurbineException Any exception thrown while processing will be * wrapped into a TurbineException and rethrown. */ + @Override public void handleRequest(Context context, String filename, OutputStream output) throws TurbineException @@ -399,6 +370,7 @@ public class TurbineVelocityService * @throws TurbineException Any exception thrown while processing will be * wrapped into a TurbineException and rethrown. */ + @Override public void handleRequest(Context context, String filename, Writer writer) throws TurbineException { @@ -656,6 +628,7 @@ public class TurbineVelocityService * * @param context a Velocity Context */ + @Override public void requestFinished(Context context) { if (pullModelActive) Modified: turbine/core/trunk/src/java/org/apache/turbine/services/velocity/VelocityService.java URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/services/velocity/VelocityService.java?rev=1695634&r1=1695633&r2=1695634&view=diff ============================================================================== --- turbine/core/trunk/src/java/org/apache/turbine/services/velocity/VelocityService.java (original) +++ turbine/core/trunk/src/java/org/apache/turbine/services/velocity/VelocityService.java Thu Aug 13 00:35:47 2015 @@ -26,9 +26,7 @@ import java.io.Writer; import org.apache.turbine.pipeline.PipelineData; import org.apache.turbine.services.Service; -import org.apache.turbine.util.RunData; import org.apache.turbine.util.TurbineException; - import org.apache.velocity.context.Context; /** @@ -85,7 +83,7 @@ public interface VelocityService * @param filename A String with the filename of the template. * @param out A OutputStream where we will write the process template as * a String. - * @throws TurbineException Any exception trown while processing will be + * @throws TurbineException Any exception thrown while processing will be * wrapped into a TurbineException and rethrown. */ void handleRequest(Context context, String filename, OutputStream out) @@ -99,7 +97,7 @@ public interface VelocityService * @param filename A String with the filename of the template. * @param writer A Writer where we will write the process template as * a String. - * @throws TurbineException Any exception trown while processing will be + * @throws TurbineException Any exception thrown while processing will be * wrapped into a TurbineException and rethrown. */ void handleRequest(Context context, String filename, Writer writer) @@ -120,27 +118,15 @@ public interface VelocityService Context getNewContext(); /** - * Create a Context from the RunData object. Adds a pointer to - * the RunData object to the Context so that RunData is available in + * Create a Context from the PipelineData object. Adds a pointer to + * the PipelineData object to the Context so that PipelineData is available in * the templates. * - * @param data The Turbine RunData object. - * @return A clone of the Context needed by Velocity. - */ - Context getContext(RunData data); - - /** - * 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. + * @param pipelineData The Turbine PipelineData object. * @return A clone of the Context needed by Velocity. */ Context getContext(PipelineData pipelineData); - - /** * Performs post-request actions (releases context * tools back to the object pool). Modified: turbine/core/trunk/src/java/org/apache/turbine/util/RunData.java URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/util/RunData.java?rev=1695634&r1=1695633&r2=1695634&view=diff ============================================================================== --- turbine/core/trunk/src/java/org/apache/turbine/util/RunData.java (original) +++ turbine/core/trunk/src/java/org/apache/turbine/util/RunData.java Thu Aug 13 00:35:47 2015 @@ -47,7 +47,7 @@ import org.apache.turbine.util.template. * RunData is an interface to run-time information that is passed * within Turbine. This provides the threading mechanism for the * entire system because multiple requests can potentially come in - * at the same time. Thus, there is only one RunData implementation + * at the same time. Thus, there is only one RunData instance * for each request that is being serviced. * * @author <a href="mailto:[email protected]">Ilkka Priha</a> @@ -159,7 +159,7 @@ public interface RunData extends Pipelin /** * Sets the action for the request. * - * @param action a atring. + * @param action a string. */ void setAction(String action); @@ -625,15 +625,6 @@ public interface RunData extends Pipelin Throwable exp); /** - * Gets a table of debug variables. - * - * @return a Map of debug variables. - * @deprecated use {@link #getDebugVariables} instead - */ - @Deprecated - Map<String, Object> getVarDebug(); - - /** * Sets a name/value pair in an internal Map that is accessible from the * Error screen. This is a good way to get debugging information * when an exception is thrown. Modified: turbine/core/trunk/src/java/org/apache/turbine/util/velocity/VelocityActionEvent.java URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/util/velocity/VelocityActionEvent.java?rev=1695634&r1=1695633&r2=1695634&view=diff ============================================================================== --- turbine/core/trunk/src/java/org/apache/turbine/util/velocity/VelocityActionEvent.java (original) +++ turbine/core/trunk/src/java/org/apache/turbine/util/velocity/VelocityActionEvent.java Thu Aug 13 00:35:47 2015 @@ -26,7 +26,6 @@ import org.apache.turbine.Turbine; import org.apache.turbine.modules.ActionEvent; import org.apache.turbine.pipeline.PipelineData; import org.apache.turbine.services.velocity.TurbineVelocity; -import org.apache.turbine.util.RunData; import org.apache.velocity.context.Context; /** @@ -63,30 +62,6 @@ public abstract class VelocityActionEven /** * This overrides the default Action.perform() to execute the - * doEvent() method. If that fails, then it will execute the - * doPerform() method instead. - * - * @deprecated Use PipelineData version instead. - * @param data A Turbine RunData object. - * @exception Exception a generic exception. - */ - @Deprecated - @Override - protected void perform(RunData data) - throws Exception - { - if (!initialized) - { - initialize(); - } - ParameterParser pp = data.getParameters(); - Context context = TurbineVelocity.getContext(data); - executeEvents(pp, new Class<?>[]{ RunData.class, Context.class }, - new Object[]{ data, context }); - } - - /** - * This overrides the default Action.perform() to execute the * doEvent() method. If that fails, then it will execute the * doPerform() method instead. * Modified: turbine/core/trunk/src/test/org/apache/turbine/ConfigurationTest.java URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/test/org/apache/turbine/ConfigurationTest.java?rev=1695634&r1=1695633&r2=1695634&view=diff ============================================================================== --- turbine/core/trunk/src/test/org/apache/turbine/ConfigurationTest.java (original) +++ turbine/core/trunk/src/test/org/apache/turbine/ConfigurationTest.java Thu Aug 13 00:35:47 2015 @@ -24,7 +24,6 @@ package org.apache.turbine; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; import java.io.File; import java.net.URL; @@ -113,7 +112,8 @@ public class ConfigurationTest extends B tc.dispose(); } } - + + @SuppressWarnings("boxing") @Test public void testCreateTurbineWithIncludedConfiguration() throws Exception { @@ -138,7 +138,7 @@ public class ConfigurationTest extends B @Test public void testCreateTurbineWithXMLBuilderConfiguration() throws Exception { - String configurationRessourcePath ="conf/test/ConfigurationBuilder.xml"; + String configurationRessourcePath ="conf/test/ConfigurationBuilder.xml"; tc = new TurbineXmlConfig(".",configurationRessourcePath ); try @@ -148,13 +148,13 @@ public class ConfigurationTest extends B Configuration configuration = Turbine.getConfiguration(); assertNotNull("No Configuration Object found!", configuration); assertFalse("Make sure we have values", configuration.isEmpty()); - + //assertTrue("Test combined configuration is"+ configuration, configuration instanceof CombinedConfiguration); // overridden value String key = "scheduledjob.cache.size"; assertEquals("Read a config value " + key + ", received:" + configuration.getInt(key), 100, configuration.getInt(key)); - + // double overridden value key = "module.cache"; assertEquals("Read a config value " + key + ", received:" + configuration.getBoolean(key), false, configuration.getBoolean(key)); @@ -170,7 +170,7 @@ public class ConfigurationTest extends B assertEquals("Read a config value " + key + ", received:" + configuration.getBoolean(key), true, configuration.getBoolean(key)); configuration.setProperty( key, false ); assertEquals("Read a config value " + key + ", received:" + configuration.getBoolean(key), false, configuration.getBoolean(key)); - + // converts to URL, cft. RFC2396 URL testURL = FileSystem.getDefaultFileSystem().locateFromURL(new File( Turbine.getApplicationRoot()).toURI().toString() , configurationRessourcePath); assertNotNull( "Should be a valid URL",testURL); Modified: turbine/core/trunk/src/test/org/apache/turbine/modules/ActionLoaderTest.java URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/test/org/apache/turbine/modules/ActionLoaderTest.java?rev=1695634&r1=1695633&r2=1695634&view=diff ============================================================================== --- turbine/core/trunk/src/test/org/apache/turbine/modules/ActionLoaderTest.java (original) +++ turbine/core/trunk/src/test/org/apache/turbine/modules/ActionLoaderTest.java Thu Aug 13 00:35:47 2015 @@ -19,6 +19,11 @@ package org.apache.turbine.modules; * under the License. */ +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + import java.util.HashMap; import java.util.Map; import java.util.Vector; @@ -43,8 +48,6 @@ import org.junit.Test; import com.mockobjects.servlet.MockHttpServletResponse; import com.mockobjects.servlet.MockServletConfig; -import static org.junit.Assert.*; - /** * This test case is to verify whether exceptions in Velocity actions are * properly bubbled up when action.event.bubbleexception=true. Or, if @@ -333,7 +336,6 @@ public class ActionLoaderTest extends Ba data.setAction("VelocityActionDoesNothing"); int numberOfCalls = VelocityActionDoesNothing.numberOfCalls; int pipelineDataCalls = VelocityActionDoesNothing.pipelineDataCalls; - int runDataCalls = VelocityActionDoesNothing.runDataCalls; try { ActionLoader.getInstance().exec(pipelineData, data.getAction()); @@ -344,7 +346,6 @@ public class ActionLoaderTest extends Ba fail("Should not have thrown an exception."); } assertEquals(numberOfCalls + 1, VelocityActionDoesNothing.numberOfCalls); - assertEquals(runDataCalls, VelocityActionDoesNothing.runDataCalls); assertEquals(pipelineDataCalls + 1, VelocityActionDoesNothing.pipelineDataCalls); } Modified: turbine/core/trunk/src/test/org/apache/turbine/modules/actions/VelocityActionDoesNothing.java URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/test/org/apache/turbine/modules/actions/VelocityActionDoesNothing.java?rev=1695634&r1=1695633&r2=1695634&view=diff ============================================================================== --- turbine/core/trunk/src/test/org/apache/turbine/modules/actions/VelocityActionDoesNothing.java (original) +++ turbine/core/trunk/src/test/org/apache/turbine/modules/actions/VelocityActionDoesNothing.java Thu Aug 13 00:35:47 2015 @@ -20,14 +20,14 @@ package org.apache.turbine.modules.actio */ -import static org.junit.Assert.*; +import static org.junit.Assert.assertNotNull; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.apache.turbine.annotation.TurbineActionEvent; import org.apache.turbine.pipeline.PipelineData; import org.apache.turbine.util.RunData; import org.apache.velocity.context.Context; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; /** * This action is used in testing the ExecutePageValve by the ExecutePageValveTest. * @@ -38,25 +38,8 @@ public class VelocityActionDoesNothing e { private static Log log = LogFactory.getLog(VelocityActionDoesNothing.class); public static int numberOfCalls; - public static int runDataCalls; public static int pipelineDataCalls; public static int actionEventCalls; - /** - * Default action is throw an exception. - * - * @param data Current RunData information - * @param context Context to populate - * @exception Exception Thrown on error - * @deprecated - */ - @Deprecated - @Override - public void doPerform(RunData data, Context context) throws Exception - { - log.debug("Calling doPerform"); - VelocityActionDoesNothing.numberOfCalls++; - VelocityActionDoesNothing.runDataCalls++; - } /** * Default action is throw an exception. @@ -71,7 +54,7 @@ public class VelocityActionDoesNothing e log.debug("Calling doPerform(PipelineData)"); VelocityActionDoesNothing.numberOfCalls++; RunData rd = (RunData)pipelineData; - assertNotNull("RunData object was Null.", rd); + assertNotNull("PipelineData object was Null.", rd); VelocityActionDoesNothing.pipelineDataCalls++; } Modified: turbine/core/trunk/src/test/org/apache/turbine/modules/actions/VelocityActionThrowsException.java URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/test/org/apache/turbine/modules/actions/VelocityActionThrowsException.java?rev=1695634&r1=1695633&r2=1695634&view=diff ============================================================================== --- turbine/core/trunk/src/test/org/apache/turbine/modules/actions/VelocityActionThrowsException.java (original) +++ turbine/core/trunk/src/test/org/apache/turbine/modules/actions/VelocityActionThrowsException.java Thu Aug 13 00:35:47 2015 @@ -20,11 +20,10 @@ package org.apache.turbine.modules.actio */ -import org.apache.turbine.pipeline.PipelineData; -import org.apache.turbine.util.RunData; -import org.apache.velocity.context.Context; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.turbine.pipeline.PipelineData; +import org.apache.velocity.context.Context; /** * This action is used in testing the ActionLoader for Velocity templates. Verifies * that exceptions are properly bubbled out. @@ -36,21 +35,6 @@ import org.apache.commons.logging.LogFac public class VelocityActionThrowsException extends VelocityAction { private static Log log = LogFactory.getLog(VelocityActionThrowsException.class); - /** - * Default action is throw an exception. - * - * @param data Current RunData information - * @param context Context to populate - * @exception Exception Thrown on error - * @deprecated - */ - @Override - @Deprecated - public void doPerform(RunData data, Context context) throws Exception - { - log.debug("Calling doPerform(RunData)"); - throw new Exception("From VelocityActionThrowsException.doPerform an Exception is always thrown!"); - } /** * Default action is throw an exception. @@ -66,20 +50,6 @@ public class VelocityActionThrowsExcepti throw new Exception("From VelocityActionThrowsException.doPerform an Exception is always thrown!"); } - - - /** - * This action event also throws an exception. - * @param data - * @param context - * @throws Exception - */ - public void doCauseexception(RunData data, Context context) throws Exception - { - log.debug("Calling doCauseexception(RunData)"); - throw new Exception("From Action Event VelocityActionThrowsException.doCauseexception an Exception is always thrown!"); - } - /** * This action event also throws an exception. * @param data @@ -91,6 +61,4 @@ public class VelocityActionThrowsExcepti log.debug("Calling doCauseexception(PipelineData)"); throw new Exception("From Action Event VelocityActionThrowsException.doCauseexception an Exception is always thrown!"); } - - } Modified: turbine/core/trunk/src/test/org/apache/turbine/modules/actions/VelocityActionWithServiceInjection.java URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/test/org/apache/turbine/modules/actions/VelocityActionWithServiceInjection.java?rev=1695634&r1=1695633&r2=1695634&view=diff ============================================================================== --- turbine/core/trunk/src/test/org/apache/turbine/modules/actions/VelocityActionWithServiceInjection.java (original) +++ turbine/core/trunk/src/test/org/apache/turbine/modules/actions/VelocityActionWithServiceInjection.java Thu Aug 13 00:35:47 2015 @@ -20,13 +20,12 @@ package org.apache.turbine.modules.actio */ -import static org.junit.Assert.*; +import static org.junit.Assert.assertNotNull; import org.apache.fulcrum.factory.FactoryService; import org.apache.turbine.annotation.TurbineService; import org.apache.turbine.pipeline.PipelineData; import org.apache.turbine.services.rundata.RunDataService; -import org.apache.turbine.util.RunData; import org.apache.velocity.context.Context; /** * This action is used in testing the injection of services. @@ -49,21 +48,6 @@ public class VelocityActionWithServiceIn /** * Default action is nothing. - * - * @param data Current RunData information - * @param context Context to populate - * @exception Exception Thrown on error - * @deprecated - */ - @Deprecated - @Override - public void doPerform(RunData data, Context context) throws Exception - { - log.debug("Calling doPerform"); - } - - /** - * Default action is nothing. * * @param data Current RunData information * @param context Context to populate Modified: turbine/core/trunk/src/test/org/apache/turbine/modules/layouts/TestVelocityOnlyLayout.java URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/test/org/apache/turbine/modules/layouts/TestVelocityOnlyLayout.java?rev=1695634&r1=1695633&r2=1695634&view=diff ============================================================================== --- turbine/core/trunk/src/test/org/apache/turbine/modules/layouts/TestVelocityOnlyLayout.java (original) +++ turbine/core/trunk/src/test/org/apache/turbine/modules/layouts/TestVelocityOnlyLayout.java Thu Aug 13 00:35:47 2015 @@ -19,10 +19,9 @@ package org.apache.turbine.modules.layou * under the License. */ -import static org.junit.Assert.*; +import static org.junit.Assert.assertNotNull; import org.apache.turbine.pipeline.PipelineData; -import org.apache.turbine.util.RunData; /** @@ -36,14 +35,6 @@ public class TestVelocityOnlyLayout exte public void doBuild(PipelineData pipelineData) { numberOfCalls++; - RunData data = getRunData(pipelineData); - assertNotNull("RunData object is null.", data); - } - - @Override - public void doBuild(RunData runData) - { - numberOfCalls++; - assertNotNull("RunData object is null.", runData); + assertNotNull("PipelineData object is null.", pipelineData); } } Modified: turbine/core/trunk/src/test/org/apache/turbine/modules/pages/TestVelocityPage.java URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/test/org/apache/turbine/modules/pages/TestVelocityPage.java?rev=1695634&r1=1695633&r2=1695634&view=diff ============================================================================== --- turbine/core/trunk/src/test/org/apache/turbine/modules/pages/TestVelocityPage.java (original) +++ turbine/core/trunk/src/test/org/apache/turbine/modules/pages/TestVelocityPage.java Thu Aug 13 00:35:47 2015 @@ -19,10 +19,9 @@ package org.apache.turbine.modules.pages * under the License. */ -import static org.junit.Assert.*; +import static org.junit.Assert.assertNotNull; import org.apache.turbine.pipeline.PipelineData; -import org.apache.turbine.util.RunData; /** @@ -37,60 +36,27 @@ public class TestVelocityPage extends Ve { numberOfCalls++; super.doBuild(pipelineData); - RunData data = getRunData(pipelineData); - assertNotNull("RunData object is null.", data); - } - - @Override - public void doBuild(RunData runData) throws Exception - { - numberOfCalls++; - super.doBuild(runData); - assertNotNull("RunData object is null.", runData); + assertNotNull("PipelineData object is null.", pipelineData); } @Override public void doBuildBeforeAction(PipelineData pipelineData) throws Exception { numberOfCalls++; - RunData data = getRunData(pipelineData); - assertNotNull("RunData object is null.", data); + assertNotNull("PipelineData object is null.", pipelineData); } @Override public void doPostBuild(PipelineData pipelineData) throws Exception { numberOfCalls++; - RunData data = getRunData(pipelineData); - assertNotNull("RunData object is null.", data); - } - - @Override - public void doBuildBeforeAction(RunData data) throws Exception - { - numberOfCalls++; - assertNotNull("RunData object is null.", data); - } - - @Override - public void doPostBuild(RunData data) throws Exception - { - numberOfCalls++; - assertNotNull("RunData object is null.", data); - } - - @Override - public void doBuildAfterAction(RunData data) throws Exception - { - numberOfCalls++; - assertNotNull("RunData object is null.", data); + assertNotNull("PipelineData object is null.", pipelineData); } @Override public void doBuildAfterAction(PipelineData pipelineData) throws Exception { numberOfCalls++; - RunData data = getRunData(pipelineData); - assertNotNull("RunData object is null.", data); + assertNotNull("PipelineData object is null.", pipelineData); } }
