portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From woon...@apache.org
Subject svn commit: r724757 - /portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/wicket/AdminWicketPortlet.java
Date Tue, 09 Dec 2008 15:29:16 GMT
Author: woonsan
Date: Tue Dec  9 07:29:15 2008
New Revision: 724757

URL: http://svn.apache.org/viewvc?rev=724757&view=rev
Log:
Added init params

Modified:
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/wicket/AdminWicketPortlet.java

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/wicket/AdminWicketPortlet.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/wicket/AdminWicketPortlet.java?rev=724757&r1=724756&r2=724757&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/wicket/AdminWicketPortlet.java
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/wicket/AdminWicketPortlet.java
Tue Dec  9 07:29:15 2008
@@ -17,6 +17,7 @@
 package org.apache.jetspeed.portlets.wicket;
 
 import java.io.IOException;
+import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -28,7 +29,6 @@
 import org.apache.jetspeed.container.InternalPortletContext;
 import org.apache.jetspeed.om.portlet.PortletApplication;
 import org.apache.wicket.protocol.http.portlet.WicketPortlet;
-import org.apache.wicket.util.string.IStringIterator;
 import org.apache.wicket.util.string.StringList;
 
 /**
@@ -39,33 +39,39 @@
  */
 public class AdminWicketPortlet extends WicketPortlet
 {
+    public static final String INIT_PARAMS = AdminWicketPortlet.class.getName() + ".initParams";
     public static final String JETSPEED_PA_IDENTIFIER = "JetspeedPAName";
     public static final String SERVICE_COMPONENT_NAMES = "serviceComponentNames";
     
     protected String paName;
-    protected StringList serviceComponentNameList;
-    protected Map serviceComponentsMap = null;
-
+    protected Map<String, Object> serviceComponentsMap = null;
+    protected Map<String, String> initParams = null;
+    
     public void init(PortletConfig config) throws PortletException
     {
         super.init(config);
         
+        this.initParams = new HashMap<String, String>();
+        
+        for (Enumeration paramNames = config.getInitParameterNames(); paramNames.hasMoreElements();
)
+        {
+            String paramName = (String) paramNames.nextElement();
+            String paramValue = config.getInitParameter(paramName);
+            this.initParams.put(paramName, paramValue);
+        }
+        
         String serviceComponentNames = config.getInitParameter(SERVICE_COMPONENT_NAMES);
         
         if (serviceComponentNames != null)
         {
-            this.serviceComponentNameList = StringList.tokenize(serviceComponentNames);
-            this.serviceComponentsMap = new HashMap();
+            StringList serviceComponentNameList = StringList.tokenize(serviceComponentNames);
+            this.serviceComponentsMap = new HashMap<String, Object>();
             
             for (int i = serviceComponentNameList.size() - 1; i >= 0; i--)
             {
                 String serviceComponentName = serviceComponentNameList.get(i).trim();
                 
-                if ("".equals(serviceComponentName))
-                {
-                    this.serviceComponentNameList.remove(i);
-                }
-                else
+                if (!"".equals(serviceComponentName))
                 {
                     Object component = getPortletContext().getAttribute(serviceComponentName);
                     this.serviceComponentsMap.put(serviceComponentName, component);
@@ -79,15 +85,11 @@
 	protected void processRequest(PortletRequest request, PortletResponse response, String requestType,
String pageType) throws PortletException, IOException
     {
         request.setAttribute(JETSPEED_PA_IDENTIFIER, this.paName);
+        request.setAttribute(INIT_PARAMS, this.initParams);
         
-        if (this.serviceComponentNameList != null)
+        for (Map.Entry<String, Object> entry : this.serviceComponentsMap.entrySet())
         {
-            for (IStringIterator it = this.serviceComponentNameList.iterator(); it.hasNext();
)
-            {
-                String serviceComponentName = it.next();
-                Object component = this.serviceComponentsMap.get(serviceComponentName);
-                request.setAttribute(serviceComponentName, component);
-            }
+            request.setAttribute(entry.getKey(), entry.getValue());
         }
         
         super.processRequest(request, response, requestType, pageType);



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message