Author: tv
Date: Sat Jul 30 20:14:38 2011
New Revision: 1152507
URL: http://svn.apache.org/viewvc?rev=1152507&view=rev
Log:
Some more generification
Modified:
turbine/core/trunk/src/java/org/apache/turbine/modules/ActionEvent.java
turbine/core/trunk/src/java/org/apache/turbine/modules/GenericLoader.java
turbine/core/trunk/src/java/org/apache/turbine/modules/screens/Error.java
turbine/core/trunk/src/java/org/apache/turbine/pipeline/DefaultPipelineData.java
turbine/core/trunk/src/java/org/apache/turbine/services/BaseUnicastRemoteService.java
turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/AssemblerBrokerService.java
turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/TurbineAssemblerBroker.java
turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/TurbineAssemblerBrokerService.java
turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaActionFactory.java
turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/python/PythonActionFactory.java
turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/python/PythonBaseFactory.java
turbine/core/trunk/src/java/org/apache/turbine/services/pull/TurbinePullService.java
turbine/core/trunk/src/java/org/apache/turbine/services/template/TurbineTemplateService.java
turbine/core/trunk/src/java/org/apache/turbine/services/template/mapper/ClassMapper.java
turbine/core/trunk/src/java/org/apache/turbine/services/velocity/TurbineVelocityService.java
turbine/core/trunk/src/java/org/apache/turbine/util/FormMessages.java
turbine/core/trunk/src/java/org/apache/turbine/util/TurbineConfig.java
turbine/core/trunk/src/java/org/apache/turbine/util/template/HtmlPageAttributes.java
turbine/core/trunk/src/java/org/apache/turbine/util/uri/DataURI.java
turbine/core/trunk/src/java/org/apache/turbine/util/velocity/VelocityActionEvent.java
turbine/core/trunk/src/java/org/apache/turbine/util/velocity/VelocityHtmlEmail.java
Modified:
turbine/core/trunk/src/java/org/apache/turbine/modules/ActionEvent.java
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/ActionEvent.java?rev=1152507&r1=1152506&r2=1152507&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/ActionEvent.java
(original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/ActionEvent.java Sat
Jul 30 20:14:38 2011
@@ -83,10 +83,6 @@ public abstract class ActionEvent extend
/** Logging */
protected Log log = LogFactory.getLog(this.getClass());
- /** Constant needed for Reflection */
- private static final Class [] methodParams
- = new Class [] { RunData.class };
-
/**
* You need to implement this in your classes that extend this class.
* @deprecated use PipelineData version instead.
@@ -226,9 +222,9 @@ public abstract class ActionEvent extend
String key = null;
// Loop through and find the button.
- for (Iterator it = pp.keySet().iterator(); it.hasNext();)
+ for (Iterator<String> it = pp.keySet().iterator();
it.hasNext();)
{
- key = (String) it.next();
+ key = it.next();
if (key.startsWith(button))
{
if (considerKey(key, pp))
@@ -248,15 +244,14 @@ public abstract class ActionEvent extend
try
{
- method = getClass().getMethod(theButton, methodParams);
- Object[] methodArgs = new Object[] { data };
+ method = getClass().getMethod(theButton, RunData.class);
if (log.isDebugEnabled())
{
log.debug("Invoking " + method);
}
- method.invoke(this, methodArgs);
+ method.invoke(this, data);
}
catch (InvocationTargetException ite)
{
@@ -290,9 +285,9 @@ public abstract class ActionEvent extend
String key = null;
// Loop through and find the button.
- for (Iterator it = pp.keySet().iterator(); it.hasNext();)
+ for (Iterator<String> it = pp.keySet().iterator();
it.hasNext();)
{
- key = (String) it.next();
+ key = it.next();
if (key.startsWith(button))
{
if (considerKey(key, pp))
@@ -312,15 +307,14 @@ public abstract class ActionEvent extend
try
{
- method = getClass().getMethod(theButton, methodParams);
- Object[] methodArgs = new Object[] { pipelineData };
+ method = getClass().getMethod(theButton,
PipelineData.class);
if (log.isDebugEnabled())
{
log.debug("Invoking " + method);
}
- method.invoke(this, methodArgs);
+ method.invoke(this, pipelineData);
}
catch (InvocationTargetException ite)
{
Modified:
turbine/core/trunk/src/java/org/apache/turbine/modules/GenericLoader.java
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/GenericLoader.java?rev=1152507&r1=1152506&r2=1152507&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/GenericLoader.java
(original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/GenericLoader.java
Sat Jul 30 20:14:38 2011
@@ -117,7 +117,7 @@ public abstract class GenericLoader<T ex
* @param reload True if the action must be marked as reload.
* @return Itself.
*/
- public GenericLoader setReload(boolean reload)
+ public GenericLoader<T> setReload(boolean reload)
{
this.reload = reload;
return this;
Modified:
turbine/core/trunk/src/java/org/apache/turbine/modules/screens/Error.java
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/modules/screens/Error.java?rev=1152507&r1=1152506&r2=1152507&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/modules/screens/Error.java
(original)
+++ turbine/core/trunk/src/java/org/apache/turbine/modules/screens/Error.java
Sat Jul 30 20:14:38 2011
@@ -57,10 +57,10 @@ public class Error extends Screen
Table table = new Table().setBorder(0);
boolean hasValues = false;
- for (Iterator it = data.getParameters().keySet().iterator();
+ for (Iterator<String> it = data.getParameters().keySet().iterator();
it.hasNext();)
{
- String key = (String) it.next();
+ String key = it.next();
String value = data.getParameters().getString(key);
TR tr =
new TR().addElement(
@@ -71,13 +71,13 @@ public class Error extends Screen
}
Table table2 = new Table().setBorder(0);
- Map varDebug = data.getDebugVariables();
+ Map<String, Object> varDebug = data.getDebugVariables();
boolean hasValues2 = false;
- for (Iterator i = varDebug.keySet().iterator(); i.hasNext();)
+ for (Map.Entry<String, Object> entry : varDebug.entrySet())
{
- String key = (String) i.next();
- String value = varDebug.get(key).toString();
+ String key = entry.getKey();
+ String value = entry.getValue().toString();
TR tr =
new TR().addElement(
new TD().addElement(new B(key))).addElement(
Modified:
turbine/core/trunk/src/java/org/apache/turbine/pipeline/DefaultPipelineData.java
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/pipeline/DefaultPipelineData.java?rev=1152507&r1=1152506&r2=1152507&view=diff
==============================================================================
---
turbine/core/trunk/src/java/org/apache/turbine/pipeline/DefaultPipelineData.java
(original)
+++
turbine/core/trunk/src/java/org/apache/turbine/pipeline/DefaultPipelineData.java
Sat Jul 30 20:14:38 2011
@@ -46,7 +46,7 @@ public class DefaultPipelineData impleme
map.put(key, value);
}
- public Map<?, ?> get(Class key)
+ public Map<?, ?> get(Class<?> key)
{
return map.get(key);
}
Modified:
turbine/core/trunk/src/java/org/apache/turbine/services/BaseUnicastRemoteService.java
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/services/BaseUnicastRemoteService.java?rev=1152507&r1=1152506&r2=1152507&view=diff
==============================================================================
---
turbine/core/trunk/src/java/org/apache/turbine/services/BaseUnicastRemoteService.java
(original)
+++
turbine/core/trunk/src/java/org/apache/turbine/services/BaseUnicastRemoteService.java
Sat Jul 30 20:14:38 2011
@@ -24,6 +24,7 @@ package org.apache.turbine.services;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
import java.util.Properties;
+
import javax.servlet.ServletConfig;
import org.apache.commons.configuration.Configuration;
@@ -42,7 +43,7 @@ public class BaseUnicastRemoteService ex
* Serial version.
*/
private static final long serialVersionUID = -7775459623190960297L;
-
+
protected Configuration configuration;
private boolean isInitialized;
private InitableBroker initableBroker;
@@ -80,7 +81,6 @@ public class BaseUnicastRemoteService ex
}
public void init(ServletConfig config)
- throws InitializationException
{
setInit(true);
}
Modified:
turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/AssemblerBrokerService.java
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/AssemblerBrokerService.java?rev=1152507&r1=1152506&r2=1152507&view=diff
==============================================================================
---
turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/AssemblerBrokerService.java
(original)
+++
turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/AssemblerBrokerService.java
Sat Jul 30 20:14:38 2011
@@ -47,7 +47,7 @@ public interface AssemblerBrokerService
* @param type Type of the Factory
* @param factory The factory object
*/
- void registerFactory(String type, AssemblerFactory factory);
+ void registerFactory(String type, AssemblerFactory<? extends Assembler>
factory);
/**
* Attempts to load an Assembler of a type with a given name
@@ -66,5 +66,5 @@ public interface AssemblerBrokerService
* @param type The Type of the Assembler
* @return A Loader instance for the requested type
*/
- Loader getLoader(String type);
+ Loader<? extends Assembler> getLoader(String type);
}
Modified:
turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/TurbineAssemblerBroker.java
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/TurbineAssemblerBroker.java?rev=1152507&r1=1152506&r2=1152507&view=diff
==============================================================================
---
turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/TurbineAssemblerBroker.java
(original)
+++
turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/TurbineAssemblerBroker.java
Sat Jul 30 20:14:38 2011
@@ -55,7 +55,7 @@ public abstract class TurbineAssemblerBr
* @param type The type of Assembler Factory
* @param factory The actual Factory Object
*/
- public static void registerFactory(String type, AssemblerFactory factory)
+ public static void registerFactory(String type, AssemblerFactory<? extends
Assembler> factory)
{
getService().registerFactory(type, factory);
}
@@ -63,12 +63,12 @@ public abstract class TurbineAssemblerBr
/**
* Return an Assembler for a given type and object name.
*
- * @param type The Type of Assember we want
+ * @param type The Type of Assembler we want
* @param name The name of the Assembler
*
* @return An Assembler Object.
*
- * @throws TurbineException If a problem locating the Assember occured.
+ * @throws TurbineException If a problem locating the Assembler occured.
*/
public static Assembler getAssembler(String type, String name)
throws TurbineException
@@ -82,7 +82,7 @@ public abstract class TurbineAssemblerBr
* @param type The Type of the Assembler
* @return A Loader instance for the requested type
*/
- public static Loader getLoader(String type)
+ public static Loader<? extends Assembler> getLoader(String type)
{
return getService().getLoader(type);
}
Modified:
turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/TurbineAssemblerBrokerService.java
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/TurbineAssemblerBrokerService.java?rev=1152507&r1=1152506&r2=1152507&view=diff
==============================================================================
---
turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/TurbineAssemblerBrokerService.java
(original)
+++
turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/TurbineAssemblerBrokerService.java
Sat Jul 30 20:14:38 2011
@@ -59,13 +59,13 @@ public class TurbineAssemblerBrokerServi
= LogFactory.getLog(TurbineAssemblerBrokerService.class);
/** A structure that holds the registered AssemblerFactories */
- private Map<String, List<AssemblerFactory>> factories = null;
+ private Map<String, List<AssemblerFactory<? extends Assembler>>> factories
= null;
/** A cache that holds the generated Assemblers */
private Map<String, Assembler> assemblerCache = null;
/** A cache that holds the Loaders */
- private Map<String, Loader> loaderCache = null;
+ private Map<String, Loader<? extends Assembler>> loaderCache = null;
/** Caching on/off */
private boolean isCaching;
@@ -76,17 +76,17 @@ public class TurbineAssemblerBrokerServi
* @param type type of Assembler
* @return list of AssemblerFactories
*/
- private List<AssemblerFactory> getFactoryGroup(String type)
+ private List<AssemblerFactory<? extends Assembler>> getFactoryGroup(String
type)
{
if (!factories.containsKey(type))
{
- factories.put(type, new Vector<AssemblerFactory>());
+ factories.put(type, new Vector<AssemblerFactory<? extends
Assembler>>());
}
return factories.get(type);
}
/**
- * Utiltiy method to register all factories for a given type.
+ * Utility method to register all factories for a given type.
*
* @param type type of Assembler
* @throws TurbineException
@@ -104,7 +104,7 @@ public class TurbineAssemblerBrokerServi
try
{
Object o = Class.forName(factory).newInstance();
- registerFactory(type, (AssemblerFactory) o);
+ registerFactory(type, (AssemblerFactory<? extends Assembler>)
o);
}
// these must be passed to the VM
catch (ThreadDeath e)
@@ -136,7 +136,7 @@ public class TurbineAssemblerBrokerServi
public void init()
throws InitializationException
{
- factories = new HashMap<String, List<AssemblerFactory>>();
+ factories = new HashMap<String, List<AssemblerFactory<? extends
Assembler>>>();
try
{
@@ -181,7 +181,7 @@ public class TurbineAssemblerBrokerServi
* @param type type of Assembler
* @param factory factory to register
*/
- public void registerFactory(String type, AssemblerFactory factory)
+ public void registerFactory(String type, AssemblerFactory<? extends
Assembler> factory)
{
getFactoryGroup(type).add(factory);
}
@@ -211,11 +211,11 @@ public class TurbineAssemblerBrokerServi
else
{
log.debug("Loading " + key);
- List<AssemblerFactory> facs = getFactoryGroup(type);
+ List<AssemblerFactory<? extends Assembler>> facs =
getFactoryGroup(type);
- for (Iterator<AssemblerFactory> it = facs.iterator(); (assembler
== null) && it.hasNext();)
+ for (Iterator<AssemblerFactory<? extends Assembler>> it =
facs.iterator(); (assembler == null) && it.hasNext();)
{
- AssemblerFactory fac = it.next();
+ AssemblerFactory<? extends Assembler> fac = it.next();
try
{
@@ -245,9 +245,9 @@ public class TurbineAssemblerBrokerServi
* @param type The Type of the Assembler
* @return A Loader instance for the requested type
*/
- public Loader getLoader(String type)
+ public Loader<? extends Assembler> getLoader(String type)
{
- Loader loader = null;
+ Loader<? extends Assembler> loader = null;
if (isCaching && loaderCache.containsKey(type))
{
@@ -257,12 +257,11 @@ public class TurbineAssemblerBrokerServi
else
{
log.debug("Getting Loader for " + type);
- List facs = getFactoryGroup(type);
+ List<AssemblerFactory<? extends Assembler>> facs =
getFactoryGroup(type);
- for (Iterator it = facs.iterator(); (loader == null) &&
it.hasNext();)
+ for (Iterator<AssemblerFactory<? extends Assembler>> it =
facs.iterator(); (loader == null) && it.hasNext();)
{
- AssemblerFactory fac = (AssemblerFactory) it.next();
-
+ AssemblerFactory<? extends Assembler> fac = it.next();
loader = fac.getLoader();
}
Modified:
turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaActionFactory.java
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaActionFactory.java?rev=1152507&r1=1152506&r2=1152507&view=diff
==============================================================================
---
turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaActionFactory.java
(original)
+++
turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaActionFactory.java
Sat Jul 30 20:14:38 2011
@@ -23,7 +23,6 @@ package org.apache.turbine.services.asse
import org.apache.turbine.modules.Action;
import org.apache.turbine.modules.ActionLoader;
-import org.apache.turbine.modules.Assembler;
import org.apache.turbine.modules.Loader;
/**
@@ -35,7 +34,7 @@ import org.apache.turbine.modules.Loader
* @version $Id$
*/
public class JavaActionFactory
- extends JavaBaseFactory
+ extends JavaBaseFactory<Action>
{
/**
* Get an Assembler.
@@ -43,17 +42,17 @@ public class JavaActionFactory
* @param name name of the requested Assembler
* @return an Assembler
*/
- public Assembler getAssembler(String name)
+ public Action getAssembler(String name)
{
return getAssembler(Action.PREFIX, name);
}
/**
* Get the loader for this type of assembler
- *
+ *
* @return a Loader
*/
- public Loader getLoader()
+ public Loader<Action> getLoader()
{
return ActionLoader.getInstance();
}
Modified:
turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/python/PythonActionFactory.java
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/python/PythonActionFactory.java?rev=1152507&r1=1152506&r2=1152507&view=diff
==============================================================================
---
turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/python/PythonActionFactory.java
(original)
+++
turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/python/PythonActionFactory.java
Sat Jul 30 20:14:38 2011
@@ -23,7 +23,6 @@ package org.apache.turbine.services.asse
import org.apache.turbine.modules.Action;
import org.apache.turbine.modules.ActionLoader;
-import org.apache.turbine.modules.Assembler;
import org.apache.turbine.modules.Loader;
/**
@@ -37,7 +36,7 @@ import org.apache.turbine.modules.Loader
* @version $Id$
*/
public class PythonActionFactory
- extends PythonBaseFactory
+ extends PythonBaseFactory<Action>
{
/**
* Get an Assembler.
@@ -46,7 +45,7 @@ public class PythonActionFactory
* @return an Assembler
* @throws Exception generic exception
*/
- public Assembler getAssembler(String name)
+ public Action getAssembler(String name)
throws Exception
{
return getAssembler(Action.PREFIX, name);
@@ -54,10 +53,10 @@ public class PythonActionFactory
/**
* Get the loader for this type of assembler
- *
+ *
* @return a Loader
*/
- public Loader getLoader()
+ public Loader<Action> getLoader()
{
return ActionLoader.getInstance();
}
Modified:
turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/python/PythonBaseFactory.java
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/python/PythonBaseFactory.java?rev=1152507&r1=1152506&r2=1152507&view=diff
==============================================================================
---
turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/python/PythonBaseFactory.java
(original)
+++
turbine/core/trunk/src/java/org/apache/turbine/services/assemblerbroker/util/python/PythonBaseFactory.java
Sat Jul 30 20:14:38 2011
@@ -115,7 +115,7 @@ public abstract class PythonBaseFactory<
this.getClass().getClassLoader());
// We import the Python SYS module. Now we don't need to do
this
- // explicitely in the script. We always use the sys module to
+ // explicitly in the script. We always use the sys module to
// do stuff like loading java package
// org.apache.turbine.services.assemblerbroker.util.python;
interp.exec("import sys");
@@ -141,7 +141,7 @@ public abstract class PythonBaseFactory<
+ "Expected class name: " + name + "\n");
}
- // Here we convert the python sceen instance to a java
instance.
+ // Here we convert the python screen instance to a java
instance.
assembler = (T) interp.get("scr", Assembler.class);
}
catch (Exception e)
Modified:
turbine/core/trunk/src/java/org/apache/turbine/services/pull/TurbinePullService.java
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/services/pull/TurbinePullService.java?rev=1152507&r1=1152506&r2=1152507&view=diff
==============================================================================
---
turbine/core/trunk/src/java/org/apache/turbine/services/pull/TurbinePullService.java
(original)
+++
turbine/core/trunk/src/java/org/apache/turbine/services/pull/TurbinePullService.java
Sat Jul 30 20:14:38 2011
@@ -557,7 +557,7 @@ public class TurbinePullService
* @param user The <code>User</code> object whose storage to
* retrieve the tool from.
*/
- @SuppressWarnings({ "unused", "null" })
+ @SuppressWarnings({ "null" })
private void populateWithSessionTools(List<ToolData> tools, Context
context,
PipelineData pipelineData, User user)
{
@@ -647,7 +647,7 @@ public class TurbinePullService
* @param user The <code>User</code> object whose storage to
* retrieve the tool from.
*/
- @SuppressWarnings({ "unused", "null" })
+ @SuppressWarnings({ "null" })
private void populateWithSessionTools(List<ToolData> tools, Context
context,
RunData data, User user)
{
Modified:
turbine/core/trunk/src/java/org/apache/turbine/services/template/TurbineTemplateService.java
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/services/template/TurbineTemplateService.java?rev=1152507&r1=1152506&r2=1152507&view=diff
==============================================================================
---
turbine/core/trunk/src/java/org/apache/turbine/services/template/TurbineTemplateService.java
(original)
+++
turbine/core/trunk/src/java/org/apache/turbine/services/template/TurbineTemplateService.java
Sat Jul 30 20:14:38 2011
@@ -34,6 +34,7 @@ import org.apache.fulcrum.factory.Factor
import org.apache.fulcrum.factory.FactoryService;
import org.apache.turbine.Turbine;
import org.apache.turbine.TurbineConstants;
+import org.apache.turbine.modules.Assembler;
import org.apache.turbine.modules.Layout;
import org.apache.turbine.modules.Loader;
import org.apache.turbine.modules.Navigation;
@@ -708,7 +709,7 @@ public class TurbineTemplateService
.getService(AssemblerBrokerService.SERVICE_NAME);
int [] mapperCacheSize = new int [mapperKeys.length];
- Loader [] mapperLoader = new Loader [mapperKeys.length];
+ Loader<? extends Assembler> [] mapperLoader = new
Loader<?>[mapperKeys.length];
for (int i = 0; i < mapperKeys.length; i++)
{
Modified:
turbine/core/trunk/src/java/org/apache/turbine/services/template/mapper/ClassMapper.java
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/services/template/mapper/ClassMapper.java?rev=1152507&r1=1152506&r2=1152507&view=diff
==============================================================================
---
turbine/core/trunk/src/java/org/apache/turbine/services/template/mapper/ClassMapper.java
(original)
+++
turbine/core/trunk/src/java/org/apache/turbine/services/template/mapper/ClassMapper.java
Sat Jul 30 20:14:38 2011
@@ -28,6 +28,7 @@ import java.util.List;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.turbine.modules.Assembler;
import org.apache.turbine.modules.Loader;
import org.apache.turbine.services.template.TemplateService;
@@ -55,7 +56,7 @@ public class ClassMapper
implements Mapper
{
/** The loader for actually trying out the package names */
- private Loader loader = null;
+ private Loader<? extends Assembler> loader = null;
/** Logging */
private static Log log = LogFactory.getLog(ClassMapper.class);
@@ -74,7 +75,7 @@ public class ClassMapper
* Get the Loader value.
* @return the Loader value.
*/
- public Loader getLoader()
+ public Loader<? extends Assembler> getLoader()
{
return loader;
}
@@ -83,7 +84,7 @@ public class ClassMapper
* Set the Loader value.
* @param loader The new Loader value.
*/
- public void setLoader(Loader loader)
+ public void setLoader(Loader<? extends Assembler> loader)
{
this.loader = loader;
log.debug("Loader is " + this.loader);
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=1152507&r1=1152506&r2=1152507&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
Sat Jul 30 20:14:38 2011
@@ -90,10 +90,10 @@ public class TurbineVelocityService
/** Encoding used when reading the templates. */
private static String defaultInputEncoding;
-
+
/** Encoding used by the outputstream when handling the requests. */
private static String defaultOutputEncoding;
-
+
/** The prefix used for URIs which are of type <code>jar</code>. */
private static final String JAR_PREFIX = "jar:";
@@ -143,7 +143,7 @@ public class TurbineVelocityService
// Register with the template service.
registerConfiguration(VelocityService.VELOCITY_EXTENSION);
-
+
defaultInputEncoding =
getConfiguration().getString("input.encoding", DEFAULT_CHAR_SET);
defaultOutputEncoding =
getConfiguration().getString("output.encoding", defaultInputEncoding);
@@ -295,7 +295,7 @@ public class TurbineVelocityService
* @param filename The file name of the template.
* @return 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.
*/
public String handleRequest(Context context, String filename)
@@ -346,7 +346,7 @@ public class TurbineVelocityService
* @param output 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.
*/
public void handleRequest(Context context, String filename,
@@ -391,7 +391,7 @@ public class TurbineVelocityService
* @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.
*/
public void handleRequest(Context context, String filename, Writer writer)
@@ -432,7 +432,7 @@ public class TurbineVelocityService
* @param writer A OutputStream where we will write the process template as
* a String.
*
- * @throws Exception A problem occured.
+ * @throws Exception A problem occurred.
*/
private void executeRequest(Context context, String filename,
Writer writer)
@@ -506,7 +506,7 @@ public class TurbineVelocityService
* Setup the velocity runtime by using a subset of the
* Turbine configuration which relates to velocity.
*
- * @exception Exception An Error occured.
+ * @exception Exception An Error occurred.
*/
private synchronized void initVelocity()
throws Exception
@@ -535,7 +535,7 @@ public class TurbineVelocityService
*
* @return An ExtendedProperties Object for Velocity
*
- * @throws Exception If a problem occured while converting the properties.
+ * @throws Exception If a problem occurred while converting the properties.
*/
public ExtendedProperties createVelocityProperties(Configuration conf)
@@ -550,14 +550,14 @@ public class TurbineVelocityService
// webapp relative. Copy all other keys verbatim into the
// veloConfiguration.
- for (Iterator i = conf.getKeys(); i.hasNext();)
+ for (Iterator<String> i = conf.getKeys(); i.hasNext();)
{
- String key = (String) i.next();
+ String key = i.next();
if (!key.endsWith(RESOURCE_LOADER_PATH))
{
Object value = conf.getProperty(key);
- if (value instanceof List) {
- for (Iterator itr = ((List)value).iterator();
itr.hasNext();)
+ if (value instanceof List<?>) {
+ for (Iterator<?> itr = ((List<?>)value).iterator();
itr.hasNext();)
{
veloConfig.addProperty(key, itr.next());
}
@@ -569,7 +569,7 @@ public class TurbineVelocityService
continue; // for()
}
- List paths = conf.getList(key, null);
+ List<String> paths = conf.getList(key, null);
if (paths == null)
{
// We don't copy this into VeloProperties, because
@@ -586,10 +586,8 @@ public class TurbineVelocityService
// jar:file://path-component!/entry-component
// file://path-component
// path/component
- for (Iterator j = paths.iterator(); j.hasNext();)
+ for (String path : paths)
{
- String path = (String) j.next();
-
log.debug("Translating " + path);
if (path.startsWith(JAR_PREFIX))
Modified: turbine/core/trunk/src/java/org/apache/turbine/util/FormMessages.java
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/util/FormMessages.java?rev=1152507&r1=1152506&r2=1152507&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/util/FormMessages.java
(original)
+++ turbine/core/trunk/src/java/org/apache/turbine/util/FormMessages.java Sat
Jul 30 20:14:38 2011
@@ -198,8 +198,8 @@ public class FormMessages
private boolean formHasField(String formName,
String fieldName)
{
- List fields = getValues(forms_fields, formName);
- for (Iterator iter = fields.iterator(); iter.hasNext();)
+ List<String> fields = getValues(forms_fields, formName);
+ for (Iterator<String> iter = fields.iterator(); iter.hasNext();)
{
if (fieldName.equals(iter.next().toString()))
{
Modified: turbine/core/trunk/src/java/org/apache/turbine/util/TurbineConfig.java
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/util/TurbineConfig.java?rev=1152507&r1=1152506&r2=1152507&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/util/TurbineConfig.java
(original)
+++ turbine/core/trunk/src/java/org/apache/turbine/util/TurbineConfig.java Sat
Jul 30 20:14:38 2011
@@ -274,7 +274,7 @@ public class TurbineConfig
*
* @return an Enumeration of initialization parameter names.
*/
- public Enumeration getInitParameterNames()
+ public Enumeration<String> getInitParameterNames()
{
return new Vector<String>(initParams.keySet()).elements();
}
@@ -397,7 +397,7 @@ public class TurbineConfig
* Returns an Enumeration containing the attribute names available
* within this servlet context.
*/
- public Enumeration getAttributeNames()
+ public Enumeration<String> getAttributeNames()
{
return new Vector<String>(attributes.keySet()).elements();
}
@@ -482,7 +482,7 @@ public class TurbineConfig
* A method in ServletContext (2.3) interface that is not implemented and
* will throw <code>UnsuportedOperationException</code> upon invocation
*/
- public Set getResourcePaths(String s)
+ public Set<String> getResourcePaths(String s)
{
throw new UnsupportedOperationException();
}
@@ -519,7 +519,7 @@ public class TurbineConfig
* @deprecated As of Java Servlet API 2.1, with no replacement.
*/
@Deprecated
- public Enumeration getServletNames()
+ public Enumeration<String> getServletNames()
{
throw new UnsupportedOperationException();
}
@@ -532,7 +532,7 @@ public class TurbineConfig
* @deprecated As of Java Servlet API 2.0, with no replacement.
*/
@Deprecated
- public Enumeration getServlets()
+ public Enumeration<Servlet> getServlets()
{
throw new UnsupportedOperationException();
}
Modified:
turbine/core/trunk/src/java/org/apache/turbine/util/template/HtmlPageAttributes.java
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/util/template/HtmlPageAttributes.java?rev=1152507&r1=1152506&r2=1152507&view=diff
==============================================================================
---
turbine/core/trunk/src/java/org/apache/turbine/util/template/HtmlPageAttributes.java
(original)
+++
turbine/core/trunk/src/java/org/apache/turbine/util/template/HtmlPageAttributes.java
Sat Jul 30 20:14:38 2011
@@ -214,7 +214,7 @@ public class HtmlPageAttributes
*
* @return the map
*/
- public Map getBodyAttributes()
+ public Map<String, String> getBodyAttributes()
{
return this.bodyAttributes;
}
@@ -234,10 +234,10 @@ public class HtmlPageAttributes
/**
* Returns a collection of script URLs
*
- * @return list of String objects constainings URLs of javascript files
+ * @return list of String objects containing URLs of javascript files
* to include
*/
- public List getScripts()
+ public List<String> getScripts()
{
return this.scripts;
}
@@ -323,7 +323,7 @@ public class HtmlPageAttributes
*
* @return list LinkTag objects (inner class)
*/
- public List getLinks()
+ public List<LinkTag> getLinks()
{
return this.linkTags;
}
@@ -345,7 +345,7 @@ public class HtmlPageAttributes
*
* @return list of String objects containing the contents of style tags
*/
- public List getStyles()
+ public List<String> getStyles()
{
return this.styles;
}
@@ -470,7 +470,7 @@ public class HtmlPageAttributes
*
* @return Map of http equiv names to the contents
*/
- public Map getHttpEquivs()
+ public Map<String, String> getHttpEquivs()
{
return this.httpEquivs;
}
@@ -480,7 +480,7 @@ public class HtmlPageAttributes
*
* @return Map of http equiv names to the contents
*/
- public Map getMetaTags()
+ public Map<String, String> getMetaTags()
{
return this.metaTags;
}
@@ -688,5 +688,4 @@ public class HtmlPageAttributes
return doctypeBuf.toString();
}
-
}
Modified: turbine/core/trunk/src/java/org/apache/turbine/util/uri/DataURI.java
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/util/uri/DataURI.java?rev=1152507&r1=1152506&r2=1152507&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/util/uri/DataURI.java
(original)
+++ turbine/core/trunk/src/java/org/apache/turbine/util/uri/DataURI.java Sat
Jul 30 20:14:38 2011
@@ -39,7 +39,6 @@ import org.apache.turbine.util.ServerDat
public class DataURI
extends BaseURI
- implements URIConstants
{
/**
* Empty C'tor. Uses Turbine.getDefaultServerData().
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=1152507&r1=1152506&r2=1152507&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
Sat Jul 30 20:14:38 2011
@@ -53,10 +53,6 @@ import org.apache.velocity.context.Conte
*/
public abstract class VelocityActionEvent extends ActionEvent
{
- /** Constant needed for Reflection */
- private static final Class [] methodParams
- = new Class [] { RunData.class, Context.class };
-
/** Indicates whether or not this module has been initialized. */
protected boolean initialized = false;
@@ -169,9 +165,9 @@ public abstract class VelocityActionEven
String key = null;
// Loop through and find the button.
- for (Iterator it = pp.keySet().iterator(); it.hasNext();)
+ for (Iterator<String> it = pp.keySet().iterator(); it.hasNext();)
{
- key = (String) it.next();
+ key = it.next();
if (key.startsWith(button))
{
if (considerKey(key, pp))
@@ -191,15 +187,14 @@ public abstract class VelocityActionEven
Method method = null;
try
{
- method = getClass().getMethod(theButton, methodParams);
- Object[] methodArgs = new Object[] { data, context };
+ method = getClass().getMethod(theButton, RunData.class,
Context.class);
if (log.isDebugEnabled())
{
log.debug("Invoking " + method);
}
- method.invoke(this, methodArgs);
+ method.invoke(this, data, context);
}
catch (NoSuchMethodException nsme)
{
@@ -246,9 +241,9 @@ public abstract class VelocityActionEven
String key = null;
// Loop through and find the button.
- for (Iterator it = pp.keySet().iterator(); it.hasNext();)
+ for (Iterator<String> it = pp.keySet().iterator(); it.hasNext();)
{
- key = (String) it.next();
+ key = it.next();
if (key.startsWith(button))
{
if (considerKey(key, pp))
@@ -268,15 +263,14 @@ public abstract class VelocityActionEven
Method method = null;
try
{
- method = getClass().getMethod(theButton, methodParams);
- Object[] methodArgs = new Object[] { pipelineData, context };
+ method = getClass().getMethod(theButton, PipelineData.class,
Context.class);
if (log.isDebugEnabled())
{
log.debug("Invoking " + method);
}
- method.invoke(this, methodArgs);
+ method.invoke(this, pipelineData, context);
}
catch (NoSuchMethodException nsme)
{
Modified:
turbine/core/trunk/src/java/org/apache/turbine/util/velocity/VelocityHtmlEmail.java
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/util/velocity/VelocityHtmlEmail.java?rev=1152507&r1=1152506&r2=1152507&view=diff
==============================================================================
---
turbine/core/trunk/src/java/org/apache/turbine/util/velocity/VelocityHtmlEmail.java
(original)
+++
turbine/core/trunk/src/java/org/apache/turbine/util/velocity/VelocityHtmlEmail.java
Sat Jul 30 20:14:38 2011
@@ -102,7 +102,7 @@ public class VelocityHtmlEmail extends H
private Context context = null;
/** The map of embedded files. */
- private Hashtable embmap = null;
+ private Hashtable<String, String> embmap = null;
/** Address of outgoing mail server */
private String mailServer;
@@ -114,8 +114,7 @@ public class VelocityHtmlEmail extends H
*/
public VelocityHtmlEmail(RunData data)
{
- this.context = TurbineVelocity.getContext(data);
- embmap = new Hashtable();
+ this(TurbineVelocity.getContext(data));
}
/**
@@ -125,8 +124,7 @@ public class VelocityHtmlEmail extends H
*/
public VelocityHtmlEmail(PipelineData pipelineData)
{
- this.context = TurbineVelocity.getContext(pipelineData);
- embmap = new Hashtable();
+ this(TurbineVelocity.getContext(pipelineData));
}
/**
@@ -137,7 +135,7 @@ public class VelocityHtmlEmail extends H
public VelocityHtmlEmail(Context context)
{
this.context = context;
- embmap = new Hashtable();
+ embmap = new Hashtable<String, String>();
}
/**
@@ -247,7 +245,7 @@ public class VelocityHtmlEmail extends H
* @param surl A String.
* @param name A String.
* @return A String with the cid of the embedded file.
- *
+ *
* @see HtmlEmail#embed(URL surl, String name) embed.
*/
public String embed(String surl, String name)
@@ -256,7 +254,8 @@ public class VelocityHtmlEmail extends H
try
{
URL url = new URL(surl);
- cid = embed(url, name);
+ cid = super.embed(url, name);
+ embmap.put(name, cid);
}
catch (Exception e)
{
@@ -274,7 +273,7 @@ public class VelocityHtmlEmail extends H
*/
public String getCid(String filename)
{
- String cid = (String) embmap.get(filename);
+ String cid = embmap.get(filename);
return "cid:" + cid;
}