turbine-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lud...@apache.org
Subject svn commit: r1066955 - in /turbine/core/trunk/src/java/org/apache/turbine/services/pull: TurbinePullService.java tools/TemplateLink.java util/SessionData.java util/UIManager.java
Date Thu, 03 Feb 2011 20:46:30 GMT
Author: ludwig
Date: Thu Feb  3 20:46:29 2011
New Revision: 1066955

URL: http://svn.apache.org/viewvc?rev=1066955&view=rev
Log:
Java 5 for pull service

Modified:
    turbine/core/trunk/src/java/org/apache/turbine/services/pull/TurbinePullService.java
    turbine/core/trunk/src/java/org/apache/turbine/services/pull/tools/TemplateLink.java
    turbine/core/trunk/src/java/org/apache/turbine/services/pull/util/SessionData.java
    turbine/core/trunk/src/java/org/apache/turbine/services/pull/util/UIManager.java

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=1066955&r1=1066954&r2=1066955&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 Thu
Feb  3 20:46:29 2011
@@ -150,9 +150,9 @@ public class TurbinePullService
     {
         String toolName;
         String toolClassName;
-        Class toolClass;
+        Class<ApplicationTool> toolClass;
 
-        public ToolData(String toolName, String toolClassName, Class toolClass)
+        public ToolData(String toolName, String toolClassName, Class<ApplicationTool>
toolClass)
         {
             this.toolName = toolName;
             this.toolClassName = toolClassName;
@@ -161,19 +161,19 @@ public class TurbinePullService
     }
 
     /** Internal list of global tools */
-    private List globalTools;
+    private List<ToolData> globalTools;
 
     /** Internal list of request tools */
-    private List requestTools;
+    private List<ToolData> requestTools;
 
     /** Internal list of session tools */
-    private List sessionTools;
+    private List<ToolData> sessionTools;
 
     /** Internal list of authorized tools */
-    private List authorizedTools;
+    private List<ToolData> authorizedTools;
 
     /** Internal list of persistent tools */
-    private List persistentTools;
+    private List<ToolData> persistentTools;
 
     /** Directory where application tool resources are stored.*/
     private String resourcesDirectory;
@@ -184,6 +184,7 @@ public class TurbinePullService
     /**
      * Called the first time the Service is used.
      */
+    @Override
     public void init()
         throws InitializationException
     {
@@ -313,9 +314,10 @@ public class TurbinePullService
      *
      * @param toolConfig The part of the configuration describing some tools
      */
-    private List getTools(Configuration toolConfig)
+    @SuppressWarnings("unchecked")
+    private List<ToolData> getTools(Configuration toolConfig)
     {
-        List tools = new ArrayList();
+        List<ToolData> tools = new ArrayList<ToolData>();
 
         // There might not be any tools for this prefix
         // so return an empty list.
@@ -324,15 +326,15 @@ public class TurbinePullService
             return tools;
         }
 
-        for (Iterator it = toolConfig.getKeys(); it.hasNext();)
+        for (Iterator<String> it = toolConfig.getKeys(); it.hasNext();)
         {
-            String toolName = (String) it.next();
+            String toolName = it.next();
             String toolClassName = toolConfig.getString(toolName);
 
             try
             {
                 // Create an instance of the tool class.
-                Class toolClass = Class.forName(toolClassName);
+                Class<ApplicationTool> toolClass = (Class<ApplicationTool>) Class.forName(toolClassName);
 
                 // Add the tool to the list being built.
                 tools.add(new ToolData(toolName, toolClassName, toolClass));
@@ -459,9 +461,9 @@ public class TurbinePullService
      */
     private void populateWithGlobalTools(Context context)
     {
-        for (Iterator it = globalTools.iterator(); it.hasNext();)
+        for (Iterator<ToolData> it = globalTools.iterator(); it.hasNext();)
         {
-            ToolData toolData = (ToolData) it.next();
+            ToolData toolData = it.next();
             try
             {
                 Object tool = toolData.toolClass.newInstance();
@@ -490,9 +492,9 @@ public class TurbinePullService
     private void populateWithRequestTools(Context context, RunData data)
     {
         // Iterate the tools
-        for (Iterator it = requestTools.iterator(); it.hasNext();)
+        for (Iterator<ToolData> it = requestTools.iterator(); it.hasNext();)
         {
-            ToolData toolData = (ToolData) it.next();
+            ToolData toolData = it.next();
             try
             {
                 // Fetch Object through the Pool.
@@ -523,9 +525,9 @@ public class TurbinePullService
     private void populateWithRequestTools(Context context, PipelineData pipelineData)
     {
         // Iterate the tools
-        for (Iterator it = requestTools.iterator(); it.hasNext();)
+        for (Iterator<ToolData> it = requestTools.iterator(); it.hasNext();)
         {
-            ToolData toolData = (ToolData) it.next();
+            ToolData toolData = it.next();
             try
             {
                 // Fetch Object through the Pool.
@@ -555,16 +557,16 @@ public class TurbinePullService
      * @param user The <code>User</code> object whose storage to
      * retrieve the tool from.
      */
-    private void populateWithSessionTools(List tools, Context context,
+    private void populateWithSessionTools(List<ToolData> tools, Context context,
             PipelineData pipelineData, User user)
     {
         //Map runDataMap = (Map)pipelineData.get(RunData.class);
         //RunData data = (RunData) runDataMap.get(RunData.class);
         RunData runData = (RunData)pipelineData;
         // Iterate the tools
-        for (Iterator it = tools.iterator(); it.hasNext();)
+        for (Iterator<ToolData> it = tools.iterator(); it.hasNext();)
         {
-            ToolData toolData = (ToolData) it.next();
+            ToolData toolData = it.next();
             try
             {
                 // ensure that tool is created only once for a user
@@ -644,13 +646,13 @@ public class TurbinePullService
      * @param user The <code>User</code> object whose storage to
      * retrieve the tool from.
      */
-    private void populateWithSessionTools(List tools, Context context,
+    private void populateWithSessionTools(List<ToolData> tools, Context context,
             RunData data, User user)
     {
         // Iterate the tools
-        for (Iterator it = tools.iterator(); it.hasNext();)
+        for (Iterator<ToolData> it = tools.iterator(); it.hasNext();)
         {
-            ToolData toolData = (ToolData) it.next();
+            ToolData toolData = it.next();
             try
             {
                 // ensure that tool is created only once for a user
@@ -732,13 +734,13 @@ public class TurbinePullService
      * @param user The <code>User</code> object whose storage to
      * retrieve the tool from.
      */
-    private void populateWithPermTools(List tools, Context context,
+    private void populateWithPermTools(List<ToolData> tools, Context context,
             PipelineData pipelineData, User user)
     {
         // Iterate the tools
-        for (Iterator it = tools.iterator(); it.hasNext();)
+        for (Iterator<ToolData> it = tools.iterator(); it.hasNext();)
         {
-            ToolData toolData = (ToolData) it.next();
+            ToolData toolData = it.next();
             try
             {
                 // ensure that tool is created only once for a user
@@ -815,13 +817,13 @@ public class TurbinePullService
      * @param user The <code>User</code> object whose storage to
      * retrieve the tool from.
      */
-    private void populateWithPermTools(List tools, Context context,
+    private void populateWithPermTools(List<ToolData> tools, Context context,
             RunData data, User user)
     {
         // Iterate the tools
-        for (Iterator it = tools.iterator(); it.hasNext();)
+        for (Iterator<ToolData> it = tools.iterator(); it.hasNext();)
         {
-            ToolData toolData = (ToolData) it.next();
+            ToolData toolData = it.next();
             try
             {
                 // ensure that tool is created only once for a user
@@ -921,9 +923,9 @@ public class TurbinePullService
      */
     private void refreshGlobalTools()
     {
-        for (Iterator it = globalTools.iterator(); it.hasNext();)
+        for (Iterator<ToolData> it = globalTools.iterator(); it.hasNext();)
         {
-            ToolData toolData = (ToolData) it.next();
+            ToolData toolData = it.next();
             Object tool = globalContext.get(toolData.toolName);
             refreshTool(tool, null);
         }
@@ -949,11 +951,11 @@ public class TurbinePullService
      * @param context the Context containing the tools
      * @param tools a List of ToolData objects
      */
-    private void releaseTools(Context context, List tools)
+    private void releaseTools(Context context, List<ToolData> tools)
     {
-        for (Iterator it = tools.iterator(); it.hasNext();)
+        for (Iterator<ToolData> it = tools.iterator(); it.hasNext();)
         {
-            ToolData toolData = (ToolData) it.next();
+            ToolData toolData = it.next();
             Object tool = context.remove(toolData.toolName);
 
             if (tool != null)
@@ -978,7 +980,7 @@ public class TurbinePullService
         {
             if (tool instanceof PipelineDataApplicationTool)
             {
-                ((PipelineDataApplicationTool) tool).init((PipelineData)param);
+                ((PipelineDataApplicationTool) tool).init(param);
             }
             else if (tool instanceof RunDataApplicationTool)
             {

Modified: turbine/core/trunk/src/java/org/apache/turbine/services/pull/tools/TemplateLink.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/services/pull/tools/TemplateLink.java?rev=1066955&r1=1066954&r2=1066955&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/services/pull/tools/TemplateLink.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/services/pull/tools/TemplateLink.java Thu
Feb  3 20:46:29 2011
@@ -610,6 +610,7 @@ public class TemplateLink
      * @return A String with the URI represented by this object.
      *
      */
+    @Override
     public String toString()
     {
         return getLink();

Modified: turbine/core/trunk/src/java/org/apache/turbine/services/pull/util/SessionData.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/services/pull/util/SessionData.java?rev=1066955&r1=1066954&r2=1066955&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/services/pull/util/SessionData.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/services/pull/util/SessionData.java Thu
Feb  3 20:46:29 2011
@@ -39,7 +39,7 @@ import org.apache.turbine.services.pull.
 public class SessionData implements ApplicationTool
 {
     /** Storage of user defined data */
-    private Map dataStorage;
+    private Map<String, Object> dataStorage;
 
     /**
      * Initialize the application tool.
@@ -48,7 +48,7 @@ public class SessionData implements Appl
      */
     public void init(Object data)
     {
-        dataStorage = new HashMap();
+        dataStorage = new HashMap<String, Object>();
     }
 
     /**
@@ -109,7 +109,7 @@ public class SessionData implements Appl
      *
      * @return <code>Iterator</code> for the keys
      */
-    public Iterator iterator()
+    public Iterator<String> iterator()
     {
         return dataStorage.keySet().iterator();
     }

Modified: turbine/core/trunk/src/java/org/apache/turbine/services/pull/util/UIManager.java
URL: http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/services/pull/util/UIManager.java?rev=1066955&r1=1066954&r2=1066955&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/services/pull/util/UIManager.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/services/pull/util/UIManager.java Thu Feb
 3 20:46:29 2011
@@ -81,6 +81,7 @@ import org.apache.turbine.util.uri.DataU
  * @deprecated Use UITool instead.
  * @version $Id$
  */
+@Deprecated
 public class UIManager implements ApplicationTool
 {
     /** Logging */
@@ -186,6 +187,7 @@ public class UIManager implements Applic
      * @param data This is null, RunData or User depending upon specified tool scope.
      * @deprecated Use UITool.init() instead.
      */
+    @Deprecated
     public void init(Object data)
     {
         /**
@@ -254,6 +256,7 @@ public class UIManager implements Applic
      * 
      * @deprecated Use UITool.refresh() instead.
      */
+    @Deprecated
     public void refresh()
     {
         log.debug("Refreshing UI manager");
@@ -267,6 +270,7 @@ public class UIManager implements Applic
      *
      * @deprecated Use UITool.get(String key) instead.
      */
+    @Deprecated
     public String get(String key)
     {
         return skinProperties.getProperty(key);
@@ -277,6 +281,7 @@ public class UIManager implements Applic
      *
      * @deprecated Use UITool.getSkin() instead.
      */
+    @Deprecated
     public String getSkin()
     {
         return skinName;
@@ -298,6 +303,7 @@ public class UIManager implements Applic
      *
      * @deprecated Use UITool.image(String imageId, RunData data) instead.
      */
+    @Deprecated
     public String image(String imageId, RunData data)
     {
         DataURI du = new DataURI(data);
@@ -327,6 +333,7 @@ public class UIManager implements Applic
      *
      * @deprecated Use UITool.image(String imageId) instead.
      */
+    @Deprecated
     public String image(String imageId)
     {
         ServerData sd = Turbine.getDefaultServerData();
@@ -364,6 +371,7 @@ public class UIManager implements Applic
      *
      * @deprecated Use UITool.getStylecss(RunData data) instead.
      */
+    @Deprecated
     public String getStylecss(RunData data)
     {
         return getScript(cssFile, data);
@@ -377,6 +385,7 @@ public class UIManager implements Applic
      *
      * @deprecated Use UITool.getStylecss() instead.
      */
+    @Deprecated
     public String getStylecss()
     {
         return getScript(cssFile);
@@ -389,6 +398,7 @@ public class UIManager implements Applic
      *
      * @deprecated Use UITool.getScript(String filename, RunData data) instead.
      */
+    @Deprecated
     public String getScript(String filename, RunData data)
     {
         DataURI du = new DataURI(data);
@@ -414,6 +424,7 @@ public class UIManager implements Applic
      *
      * @deprecated Use UITool.getScript(String filename) instead.
      */
+    @Deprecated
     public String getScript(String filename)
     {
         ServerData sd = Turbine.getDefaultServerData();
@@ -471,6 +482,7 @@ public class UIManager implements Applic
      *
      * @deprecated Use UITool.setSkin() instead.
      */
+    @Deprecated
     public void setSkin()
     {
         this.skinName = Turbine.getConfiguration()
@@ -484,6 +496,7 @@ public class UIManager implements Applic
      * @param skinName the skin name to use.
      * @deprecated Use UITool.setSkin(String skinName) instead.
      */
+    @Deprecated
     public void setSkin(String skinName)
     {
         this.skinName = skinName;
@@ -499,6 +512,7 @@ public class UIManager implements Applic
      * @param data a RunData instance
      * @deprecated Use UITool.setSkin(RunData data) instead.
      */
+    @Deprecated
     protected void setSkin(RunData data)
     {
         setSkin();
@@ -514,6 +528,7 @@ public class UIManager implements Applic
      * @param user a User instance
      * @deprecated Use UITool.setSkin(User user) instead.
      */
+    @Deprecated
     protected void setSkin(User user)
     {
         if (user.getTemp(SKIN_ATTRIBUTE) == null)
@@ -533,6 +548,7 @@ public class UIManager implements Applic
      * @param skin the skin name for the session
      * @deprecated Use UITool.setSkin(User user, String skin) instead.
      */
+    @Deprecated
     public static void setSkin(User user, String skin)
     {
         user.setTemp(SKIN_ATTRIBUTE, skin);



Mime
View raw message