geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r1074042 - in /geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main: i18n-resources/ java/org/apache/geronimo/console/bundlemanager/ java/org/apache/geronimo/console/configmanager/ webapp/WEB-INF/ webapp/WEB-INF/vi...
Date Thu, 24 Feb 2011 04:31:32 GMT
Author: gawor
Date: Thu Feb 24 04:31:32 2011
New Revision: 1074042

URL: http://svn.apache.org/viewvc?rev=1074042&view=rev
Log:
GERONIMO-5769: A separate portlet for displaying web application bundles

Added:
    geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/bundlemanager/
    geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/bundlemanager/BundleManagerPortlet.java
  (with props)
    geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/bundlemanager/
    geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/bundlemanager/help.jsp
  (with props)
    geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/bundlemanager/maximized.jsp
  (with props)
    geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/bundlemanager/normal.jsp
  (with props)
Modified:
    geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/i18n-resources/consolebase_en.properties
    geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/i18n-resources/portletinfo_en.properties
    geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java
    geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/portlet.xml

Modified: geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/i18n-resources/consolebase_en.properties
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/i18n-resources/consolebase_en.properties?rev=1074042&r1=1074041&r2=1074042&view=diff
==============================================================================
--- geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/i18n-resources/consolebase_en.properties
(original)
+++ geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/i18n-resources/consolebase_en.properties
Thu Feb 24 04:31:32 2011
@@ -1,4 +1,4 @@
-#Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net)
+#Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net)
 #=====================================================================
 #  Licensed to the Apache Software Foundation (ASF) under one or more
 #  contributor license agreements.  See the NOTICE file distributed with
@@ -173,6 +173,10 @@ configmanager.normal.ok                 
 configmanager.normal.parentComponents   = Parent Components
 configmanager.normal.showDependencyMode = Show parent and child components
 
+bundlemanager.normal.bundleId           = Bundle ID
+bundlemanager.normal.bundleName         = Bundle Name
+bundlemanager.normal.symbolicName       = Symbolic Name
+
 consolebase.common.JVMVersions     = JVM Versions
 consolebase.common.actions         = Actions
 consolebase.common.alias           = Alias

Modified: geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/i18n-resources/portletinfo_en.properties
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/i18n-resources/portletinfo_en.properties?rev=1074042&r1=1074041&r2=1074042&view=diff
==============================================================================
--- geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/i18n-resources/portletinfo_en.properties
(original)
+++ geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/i18n-resources/portletinfo_en.properties
Thu Feb 24 04:31:32 2011
@@ -151,6 +151,7 @@ consolebase.infoMsg15  = CA Setup is suc
 consolebase.infoMsg16  = Approved CSR. id = <b>{0}</b>.
 consolebase.infoMsg17  = Rejected and deleted CSR. id = <b>{0}</b>.
 consolebase.infoMsg18  = Certificate Issued successfully. This Certificate details can also
be viewed using the serial number <b>{0}</b> with the 'View Issued Certificate'
link provided in the CA home screen.
+consolebase.infoMsg19  = Updated application
 consolebase.warnMsg01  = Invalid value for changeState: 
 consolebase.warnMsg02  = No modules found of this type
 consolebase.warnMsg03  = Web statistics are not supported for the current web container.

Added: geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/bundlemanager/BundleManagerPortlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/bundlemanager/BundleManagerPortlet.java?rev=1074042&view=auto
==============================================================================
--- geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/bundlemanager/BundleManagerPortlet.java
(added)
+++ geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/bundlemanager/BundleManagerPortlet.java
Thu Feb 24 04:31:32 2011
@@ -0,0 +1,319 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.console.bundlemanager;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletException;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.WindowState;
+
+import org.apache.geronimo.console.BasePortlet;
+import org.apache.geronimo.kernel.config.ConfigurationModuleType;
+import org.apache.geronimo.kernel.management.State;
+import org.apache.geronimo.kernel.util.BundleUtil;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class BundleManagerPortlet extends BasePortlet {
+
+    private static final Logger logger = LoggerFactory.getLogger(BundleManagerPortlet.class);
+
+    private static final String START_ACTION = "start";
+
+    private static final String STOP_ACTION = "stop";
+
+    private static final String RESTART_ACTION = "restart";
+
+    private static final String UPDATE_ACTION = "update";
+    
+    private static final String UNINSTALL_ACTION = "uninstall";
+
+    private static final String CONFIG_INIT_PARAM = "config-type";
+
+    private PortletRequestDispatcher normalView;
+
+    private PortletRequestDispatcher maximizedView;
+
+    private PortletRequestDispatcher helpView;
+
+    private String moduleType;
+
+    public void processAction(ActionRequest actionRequest, ActionResponse actionResponse)
throws PortletException, IOException {
+        String action = actionRequest.getParameter("action");
+        actionResponse.setRenderParameter("message", ""); // set to blank first
+        
+        String id = getConfigID(actionRequest);
+        BundleContext bundleContext = getBundleContext(actionRequest);
+
+        try {
+            Bundle bundle = bundleContext.getBundle(Long.parseLong(id));
+
+            if (START_ACTION.equals(action)) {
+                bundle.start();
+            } else if (STOP_ACTION.equals(action)) {
+                bundle.stop();
+                addInfoMessage(actionRequest, getLocalizedString(actionRequest, "consolebase.infoMsg02"));
+            } else if (UNINSTALL_ACTION.equals(action)) {
+                bundle.uninstall();
+                addInfoMessage(actionRequest, getLocalizedString(actionRequest, "consolebase.infoMsg04")
+ "<br />" + getSymbolicName(bundle));
+            } else if (RESTART_ACTION.equals(action)) {
+                bundle.stop();
+                bundle.start();
+                addInfoMessage(actionRequest, getLocalizedString(actionRequest, "consolebase.infoMsg03"));
+            } else if (UPDATE_ACTION.equals(action)) {
+                bundle.update();
+                addInfoMessage(actionRequest, getLocalizedString(actionRequest, "consolebase.infoMsg19"));
+            } else {
+                addWarningMessage(actionRequest, getLocalizedString(actionRequest, "consolebase.warnMsg01")
+ action + "<br />");
+                throw new PortletException("Invalid value for changeState: " + action);
+            }            
+        } catch (Throwable e) {
+            addErrorMessage(actionRequest, getLocalizedString(actionRequest, "consolebase.errorMsg03"));
+            logger.error("Exception", e);
+        }
+    }
+    
+    
+    private BundleContext getBundleContext(PortletRequest request) {
+        return (BundleContext) request.getPortletSession().getPortletContext().getAttribute("osgi-bundlecontext");
+    }
+    
+    private String getConfigID(ActionRequest actionRequest) {
+        return actionRequest.getParameter("bundleId");
+    }
+
+    protected void doView(RenderRequest renderRequest, RenderResponse renderResponse) throws
IOException, PortletException {
+        if (WindowState.MINIMIZED.equals(renderRequest.getWindowState())) {
+            return;
+        }
+
+        List<ModuleDetails> moduleDetails = new ArrayList<ModuleDetails>();
+            
+        Bundle[] bundles = getBundleContext(renderRequest).getBundles();
+        for (Bundle bundle : bundles) {
+            String contextPath = getContextPath(bundle);
+            if (ConfigurationModuleType.WAB.getName().equalsIgnoreCase(moduleType)) {
+                ModuleDetails details = new ModuleDetails(bundle, BundleType.WAB);
+                if (contextPath != null) {
+                    details.getContextPaths().add(contextPath);
+                    moduleDetails.add(details);
+                }
+            } else {
+                ModuleDetails details = new ModuleDetails(bundle, BundleType.REGULAR);
+                if (contextPath != null) {
+                    details.getContextPaths().add(contextPath);
+                }
+                moduleDetails.add(details);
+            }
+        }
+        
+        Collections.sort(moduleDetails);
+        renderRequest.setAttribute("configurations", moduleDetails);
+        renderRequest.setAttribute("showWebInfo", Boolean.valueOf(showWebInfo()));
+        if (moduleDetails.size() == 0) {
+            addWarningMessage(renderRequest, getLocalizedString(renderRequest, "consolebase.warnMsg02"));
+        }
+        if (WindowState.NORMAL.equals(renderRequest.getWindowState())) {
+            normalView.include(renderRequest, renderResponse);
+        } else {
+            maximizedView.include(renderRequest, renderResponse);
+        }
+    }
+   
+    private static String getContextPath(Bundle bundle) {
+        return (String) bundle.getHeaders().get(BundleUtil.WEB_CONTEXT_PATH_HEADER);
+    }
+    
+    private static String getBundleName(Bundle bundle) {
+        String name = (String) bundle.getHeaders().get(Constants.BUNDLE_NAME);
+        name = (name == null) ? bundle.getSymbolicName() : name;
+        name = (name == null) ? bundle.getLocation() : name;
+        return name;
+    }
+    
+    private static String getSymbolicName(Bundle bundle) {
+        String name = bundle.getSymbolicName();
+        if (name == null) {
+            name = bundle.getLocation();
+        }
+        return name;
+    }
+    
+    private boolean showWebInfo() {
+        return true;
+    }
+
+    protected void doHelp(RenderRequest renderRequest, RenderResponse renderResponse) throws
PortletException, IOException {
+        helpView.include(renderRequest, renderResponse);
+    }
+
+    public void init(PortletConfig portletConfig) throws PortletException {
+        super.init(portletConfig);
+        normalView = portletConfig.getPortletContext().getRequestDispatcher("/WEB-INF/view/bundlemanager/normal.jsp");
+        maximizedView = portletConfig.getPortletContext().getRequestDispatcher("/WEB-INF/view/bundlemanager/maximized.jsp");
+        helpView = portletConfig.getPortletContext().getRequestDispatcher("/WEB-INF/view/bundlemanager/help.jsp");
+        moduleType = getInitParameter(CONFIG_INIT_PARAM);
+    }
+
+    public void destroy() {
+        normalView = null;
+        maximizedView = null;
+        super.destroy();
+    }
+
+    public static enum BundleType { 
+        
+        REGULAR("REGULAR"), WAB("WAB");
+        
+        private final String name;
+
+        BundleType(String name) {
+            this.name = name;
+        }
+
+        public String getName() {
+            return name;
+        }      
+    }
+    
+    public static enum BundleState {
+        
+        UNINSTALLED(Bundle.UNINSTALLED, "Uninstalled"), 
+        INSTALLED(Bundle.INSTALLED, "Installed"), 
+        RESOLVED(Bundle.RESOLVED, "Resolved"),
+        STARTING(Bundle.STARTING, "Starting"), 
+        STOPPING(Bundle.STOPPING, "Stopping"), 
+        ACTIVE(Bundle.ACTIVE, "Active");
+        
+        private final int state;
+        private final String name;
+
+        BundleState(int state, String name) {
+            this.state = state;
+            this.name = name;
+        }
+
+        public int getState() {
+            return state;
+        }
+        
+        public String getName() {
+            return name;
+        }
+        
+        public String toString() {
+            return name;
+        }
+        
+        public boolean isRunning() {
+            return state == Bundle.ACTIVE || state == Bundle.STARTING;
+        }
+        
+        public boolean isStopped() {
+            return state == Bundle.INSTALLED || state == Bundle.RESOLVED || state == Bundle.STOPPING;
+        }
+        
+        public static BundleState getState(Bundle bundle) {
+            int state = bundle.getState();
+            switch (state) {
+            case Bundle.UNINSTALLED:
+                return BundleState.UNINSTALLED;
+            case Bundle.INSTALLED:
+                return BundleState.INSTALLED;
+            case Bundle.RESOLVED:
+                return BundleState.RESOLVED;
+            case Bundle.STOPPING:
+                return BundleState.STOPPING;
+            case Bundle.STARTING:
+                return BundleState.STARTING;            
+            case Bundle.ACTIVE:
+                return BundleState.ACTIVE;
+            }
+            throw new IllegalStateException("Unknown state: " + state);
+        }
+    }
+    
+    /**
+     * Convenience data holder for portlet that displays deployed modules.
+     * Includes context path information for web modules.
+     */
+    public static class ModuleDetails implements Comparable<ModuleDetails>, Serializable
{
+        private static final long serialVersionUID = -7022687152297202079L;
+        private final long bundleId;
+        private final String symbolicName;
+        private final String bundleName;
+        private final BundleType type;
+        private final BundleState state;
+        private List<String> contextPaths = new ArrayList<String>();
+
+        public ModuleDetails(Bundle bundle, BundleType type) {
+            this.bundleId = bundle.getBundleId();
+            this.symbolicName = BundleManagerPortlet.getSymbolicName(bundle);
+            this.bundleName = BundleManagerPortlet.getBundleName(bundle);
+            this.state = BundleState.getState(bundle);
+            this.type = type;
+        }
+        
+        public int compareTo(ModuleDetails o) {
+            if (o != null) {
+                return (int) (bundleId - o.bundleId);
+            } else {
+                return -1;
+            }
+        }
+
+        public long getBundleId() {
+            return bundleId;
+        }
+
+        public BundleState getState() {
+            return state;
+        }
+
+        public BundleType getType() {
+            return type;
+        }
+
+        public List<String> getContextPaths() {
+            return contextPaths;
+        }
+
+        public String getSymbolicName() {
+            return symbolicName;
+        }
+        
+        public String getBundleName() {
+            return bundleName;
+        }
+                
+    }
+}

Propchange: geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/bundlemanager/BundleManagerPortlet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/bundlemanager/BundleManagerPortlet.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/bundlemanager/BundleManagerPortlet.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java?rev=1074042&r1=1074041&r2=1074042&view=diff
==============================================================================
--- geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java
(original)
+++ geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/configmanager/ConfigManagerPortlet.java
Thu Feb 24 04:31:32 2011
@@ -31,7 +31,6 @@ import javax.portlet.ActionRequest;
 import javax.portlet.ActionResponse;
 import javax.portlet.PortletConfig;
 import javax.portlet.PortletException;
-import javax.portlet.PortletRequest;
 import javax.portlet.PortletRequestDispatcher;
 import javax.portlet.RenderRequest;
 import javax.portlet.RenderResponse;
@@ -58,10 +57,7 @@ import org.apache.geronimo.kernel.config
 import org.apache.geronimo.kernel.management.State;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.MissingDependencyException;
-import org.apache.geronimo.kernel.util.BundleUtil;
 import org.apache.geronimo.management.geronimo.WebModule;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -154,65 +150,35 @@ public class ConfigManagerPortlet extend
             String config = getConfigID(actionRequest);
             Artifact configId = Artifact.create(config);
             
-            boolean isWAB = configId.getType().equalsIgnoreCase(ConfigurationModuleType.WAB.getName());
-            
-            Bundle wabBundle=null;
-            
-            if (isWAB){
-                
-                wabBundle= this.getWABbundle(actionRequest,configId);
-            }
-
             if (START_ACTION.equals(action)) {
 
-                if (isWAB && wabBundle!=null) {
-                    wabBundle.start();
-                } else {
-                    
-                    if (!configurationManager.isLoaded(configId)) {
-                        configurationManager.loadConfiguration(configId);
-                    }
-                    if (!configurationManager.isRunning(configId)) {
-                        org.apache.geronimo.kernel.config.LifecycleResults lcresult = configurationManager
-                                .startConfiguration(configId);
-                        addInfoMessage(actionRequest, getLocalizedString(actionRequest, "consolebase.infoMsg01")
-                                + printResults(lcresult.getStarted()));
-                    }
+                if (!configurationManager.isLoaded(configId)) {
+                    configurationManager.loadConfiguration(configId);
+                }
+                if (!configurationManager.isRunning(configId)) {
+                    org.apache.geronimo.kernel.config.LifecycleResults lcresult = configurationManager
+                    .startConfiguration(configId);
+                    addInfoMessage(actionRequest, getLocalizedString(actionRequest, "consolebase.infoMsg01")
+                            + printResults(lcresult.getStarted()));
                 }
 
             } else if (STOP_ACTION.equals(action)) {
                 
-                if (isWAB && wabBundle!=null) {
-                    wabBundle.stop();
-                    addInfoMessage(actionRequest, getLocalizedString(actionRequest, "consolebase.infoMsg02"));
-                } else {
-                
-                    if(configurationManager.isLoaded(configId)) {
-                        LifecycleResults lcresult = configurationManager.unloadConfiguration(configId);
-                        addInfoMessage(actionRequest, getLocalizedString(actionRequest, "consolebase.infoMsg02")
+ printResults(lcresult.getStopped()));
-                    }
+                if(configurationManager.isLoaded(configId)) {
+                    LifecycleResults lcresult = configurationManager.unloadConfiguration(configId);
+                    addInfoMessage(actionRequest, getLocalizedString(actionRequest, "consolebase.infoMsg02")
+ printResults(lcresult.getStopped()));
                 }
-                
+
             } else if (UNINSTALL_ACTION.equals(action)) {
                 
-                if (isWAB && wabBundle!=null) {
-                    wabBundle.uninstall();
-                } else {
-                    configurationManager.uninstallConfiguration(configId);
-                }
+                configurationManager.uninstallConfiguration(configId);
                 
                 addInfoMessage(actionRequest, getLocalizedString(actionRequest, "consolebase.infoMsg04")
+ "<br />" + configId);
                 
             } else if (RESTART_ACTION.equals(action)) {
                 
-                if (isWAB && wabBundle!=null) {
-                    wabBundle.stop();
-                    wabBundle.start();
-                    addInfoMessage(actionRequest, getLocalizedString(actionRequest, "consolebase.infoMsg03"));
-                } else {
-                    LifecycleResults lcresult = configurationManager.restartConfiguration(configId);
-                    addInfoMessage(actionRequest, getLocalizedString(actionRequest, "consolebase.infoMsg03")
+ printResults(lcresult.getStarted()));
-                }
+                LifecycleResults lcresult = configurationManager.restartConfiguration(configId);
+                addInfoMessage(actionRequest, getLocalizedString(actionRequest, "consolebase.infoMsg03")
+ printResults(lcresult.getStarted()));
                 
             } else {
                 addWarningMessage(actionRequest, getLocalizedString(actionRequest, "consolebase.warnMsg01")
+ action + "<br />");
@@ -233,36 +199,6 @@ public class ConfigManagerPortlet extend
         }
     }
     
-    
-    private BundleContext getBundleContext(PortletRequest request) {
-        return (BundleContext) request.getPortletSession().getPortletContext().getAttribute("osgi-bundlecontext");
-    }
-    
-    private Bundle getWABbundle(PortletRequest request, Artifact configId) {
-
-        Bundle[] bundles = getBundleContext(request).getBundles();
-
-        String symboleName = configId.getArtifactId();
-
-        String version = configId.getVersion().toString();
-
-        for (Bundle bundle : bundles) {
-            String contextPath = (String) bundle.getHeaders().get(BundleUtil.WEB_CONTEXT_PATH_HEADER);
-            // a WAB MUST have the Web-ContextPath header
-            if (contextPath != null && bundle.getSymbolicName().equals(symboleName)
-                    && BundleUtil.getVersion(bundle.getVersion()).equals(version))
{
-
-                return bundle;
-            }
-
-        }
-
-        return null;
-
-    }
-    
-
-
     /**
      * Check if a configuration should be listed here. This method depends on the "config-type"
portlet parameter
      * which is set in portle.xml.
@@ -387,28 +323,6 @@ public class ConfigManagerPortlet extend
             }  
             
         }            
-            
-            // hack to display WAB because WAB can't be get from configManager.listConfigurations();
-            
-        if (ConfigurationModuleType.WAB.getName().equalsIgnoreCase(moduleType)) {
-
-            Bundle[] bundles = getBundleContext(renderRequest).getBundles();
-
-            for (Bundle bundle : bundles) {
-                String contextPath = (String) bundle.getHeaders().get(BundleUtil.WEB_CONTEXT_PATH_HEADER);
-                // a WAB MUST have the Web-ContextPath header
-                if (contextPath != null) {
-                    Artifact wabArtifact=new Artifact("",bundle.getSymbolicName(),BundleUtil.getVersion(bundle.getVersion()),ConfigurationModuleType.WAB.getName().toLowerCase());
-                    ModuleDetails details = new ModuleDetails(wabArtifact, ConfigurationModuleType.WAB,
getWABStateFromBundleState(bundle));
-                    details.getContextPaths().add(contextPath);
-                    details.setDisplayName(bundle.getSymbolicName());
-                    moduleDetails.add(details);
-                }
-        
-            }
-            
-        }
-
         
         Collections.sort(moduleDetails);
         renderRequest.setAttribute("configurations", moduleDetails);
@@ -449,27 +363,6 @@ public class ConfigManagerPortlet extend
         return configurationState;
     }
     
-    private State getWABStateFromBundleState(Bundle bundle) {
-
-        int state = bundle.getState();
-
-        switch (state) {
-
-        case Bundle.ACTIVE:
-            return State.RUNNING;
-
-        case Bundle.STARTING:
-            return State.STARTING;
-
-        case Bundle.STOPPING:
-            return State.STOPPING;
-
-        default:
-            return State.STOPPED;
-        }
-
-    }
-
     private WebModule getWebModule(Configuration config, Configuration child) {
         try {
             Map<String, String> query1 = new HashMap<String, String>();
@@ -537,7 +430,6 @@ public class ConfigManagerPortlet extend
 
     private boolean showWebInfo() {
         return ConfigurationModuleType.WAR.getName().equalsIgnoreCase(moduleType) ||
-               ConfigurationModuleType.WAB.getName().equalsIgnoreCase(moduleType) ||
                ConfigurationModuleType.EAR.getName().equalsIgnoreCase(moduleType);
     }
 

Modified: geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/portlet.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/portlet.xml?rev=1074042&r1=1074041&r2=1074042&view=diff
==============================================================================
--- geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/portlet.xml
(original)
+++ geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/portlet.xml
Thu Feb 24 04:31:32 2011
@@ -403,7 +403,7 @@ limitations under the License.
         <description>Portlet for displaying WAB modules</description>
         <portlet-name>WABModules</portlet-name>
         <display-name>WAB Modules Portlet</display-name>
-        <portlet-class>org.apache.geronimo.console.configmanager.ConfigManagerPortlet</portlet-class>
+        <portlet-class>org.apache.geronimo.console.bundlemanager.BundleManagerPortlet</portlet-class>
         <expiration-cache>-1</expiration-cache>
         <supports>
             <mime-type>text/html</mime-type>
@@ -421,7 +421,7 @@ limitations under the License.
         <init-param>
             <name>config-type</name>
             <value>WAB</value>
-        </init-param>
+        </init-param> 
     </portlet>    
     <portlet>
         <description>Portlet for displaying System modules</description>

Added: geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/bundlemanager/help.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/bundlemanager/help.jsp?rev=1074042&view=auto
==============================================================================
--- geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/bundlemanager/help.jsp
(added)
+++ geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/bundlemanager/help.jsp
Thu Feb 24 04:31:32 2011
@@ -0,0 +1,19 @@
+<%--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+--%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
+<fmt:setBundle basename="consolebase"/>
+<p><fmt:message key="configmanager.help.title"/></p>

Propchange: geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/bundlemanager/help.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/bundlemanager/help.jsp
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/bundlemanager/help.jsp
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/bundlemanager/maximized.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/bundlemanager/maximized.jsp?rev=1074042&view=auto
==============================================================================
--- geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/bundlemanager/maximized.jsp
(added)
+++ geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/bundlemanager/maximized.jsp
Thu Feb 24 04:31:32 2011
@@ -0,0 +1,17 @@
+<%--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+--%>
+<%@ include file="normal.jsp" %>

Propchange: geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/bundlemanager/maximized.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/bundlemanager/maximized.jsp
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/bundlemanager/maximized.jsp
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/bundlemanager/normal.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/bundlemanager/normal.jsp?rev=1074042&view=auto
==============================================================================
--- geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/bundlemanager/normal.jsp
(added)
+++ geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/bundlemanager/normal.jsp
Thu Feb 24 04:31:32 2011
@@ -0,0 +1,153 @@
+<%--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+--%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
+<%@ taglib uri="/WEB-INF/CommonMsg.tld" prefix="CommonMsg"%>
+<fmt:setBundle basename="consolebase"/>
+<portlet:defineObjects/>
+
+<CommonMsg:confirmMsg/>
+
+<script>
+
+// Check to see if a component is "safe" to stop within a running server.
+// Service components with names that begin with "org.apache.geronimo.configs/", for example,
+// may not be safe to stop because doing so might prevent other components
+// that depend on them (like the console itself) from functioning properly.
+// If the component is not safe to stop then prompt to make sure that
+// the user really intends to stop the component prior to any action.
+function promptIfUnsafeToStop(target, bundleId, bundleName, type) {
+    // otherwise don't challenge the stop operation
+    return true;
+}
+
+
+// Check to see if a component is "safe" to stop within a running server.
+// Service components with names that begin with "org.apache.geronimo.configs/", for example,
+// may not be safe to stop because doing so might prevent other components
+// that depend on them (like the console itself) from functioning properly.
+// If the component is not safe to stop then prompt to make sure that
+// the user really intends to stop the component prior to any action.
+function promptIfUnsafeToRestart(target, bundleId, bundleName, type) {
+    // otherwise don't challenge the restart operation
+    return true;
+}
+
+
+// Uninstall is always a potentially dangerous action, so we should prompt the
+// the user to ensure that they really indent to do this.  Uninistalling
+// some modules is more destructive than others (such as modules which are
+// dependencies of the web console or dependencies of other core server 
+// modules.  In such cases. it may leave the server in a state where it 
+// cannot be restarted.  These situations require more stringent warnings.
+function uninstallPrompt(target, bundleId, bundleName, type) {
+    // if the component is none of the above provide a standard warning
+    return showConfirmMessage(target, '<fmt:message key="configmanager.normal.confirmMsg10"/>
' + bundleName + '?', '<fmt:message key="configmanager.normal.ok"/>', '<fmt:message
key="configmanager.normal.cancel"/>');
+}
+
+function updatePrompt(target, bundleId, bundleName, type) {
+    return true;
+}
+</script>
+
+<CommonMsg:commonMsg/>
+
+<table width="100%" class="TableLine" summary="Config Manager">
+    <tr class="DarkBackground">
+        <th scope="col" align="left">&nbsp;<fmt:message key="bundlemanager.normal.bundleId"
/></th>   
+        <th scope="col"><fmt:message key="bundlemanager.normal.symbolicName" /></th>

+        <c:if test="${showWebInfo}">          
+          <th scope="col">URL</th>
+        </c:if>
+        <th scope="col">&nbsp;<fmt:message key="consolebase.common.state"/></th>
+        <th scope="col" align="center" colspan="4"><fmt:message key="consolebase.common.commands"/></th>
+    </tr>
+  <c:set var="backgroundClass" value='MediumBackground'/>
+  <c:forEach var="moduleDetails" items="${configurations}">
+      <c:choose>
+          <c:when test="${backgroundClass == 'MediumBackground'}" >
+              <c:set var="backgroundClass" value='LightBackground'/>
+          </c:when>
+          <c:otherwise>
+              <c:set var="backgroundClass" value='MediumBackground'/>
+          </c:otherwise>
+      </c:choose>
+      <tr>
+        <!-- bundle id -->
+        <td class="${backgroundClass}">&nbsp;${moduleDetails.bundleId}&nbsp;</td>
+        
+        <!-- bundle name -->
+        <td class="${backgroundClass}">&nbsp;${moduleDetails.symbolicName}&nbsp;</td>
+                
+        <!-- context path -->
+        <c:if test="${showWebInfo}">
+            <td class="${backgroundClass}">
+            <c:if test="${moduleDetails.state.running}">
+            	<c:forEach var="contextPath" items="${moduleDetails.contextPaths}">
+            		&nbsp;<a href="${contextPath}">${contextPath}</a>&nbsp;<br/>
+            	</c:forEach>
+            </c:if>
+            </td>
+        </c:if>
+
+        <!-- state -->
+        <td width="100" class="${backgroundClass}">&nbsp;${moduleDetails.state}&nbsp;</td>
+
+        <!-- Start/Stop actions -->
+        <td width="75" class="${backgroundClass}">
+            <c:if test="${moduleDetails.state.running}">
+                <span> 
+                    &nbsp;<a href="<portlet:actionURL><portlet:param name='bundleId'
value='${moduleDetails.bundleId}'/><portlet:param name='action' value='stop'/></portlet:actionURL>"
onClick="return promptIfUnsafeToStop(this, '${moduleDetails.bundleId}','${moduleDetails.symbolicName}','${moduleDetails.type.name}');"><fmt:message
key="consolebase.common.stop"/></a>&nbsp;
+                </span>
+            </c:if>
+            <c:if test="${moduleDetails.state.stopped}">
+                &nbsp;<a href="<portlet:actionURL><portlet:param name='bundleId'
value='${moduleDetails.bundleId}'/><portlet:param name='action' value='start'/></portlet:actionURL>"><fmt:message
key="consolebase.common.start"/></a>&nbsp;
+            </c:if>
+        </td>
+
+        <!-- Restart action -->
+        <td width="75" class="${backgroundClass}">
+            <c:if test="${moduleDetails.state.running}">
+                <span> 
+                    &nbsp;<a href="<portlet:actionURL><portlet:param name='bundleId'
value='${moduleDetails.bundleId}'/><portlet:param name='action' value='restart'/></portlet:actionURL>"
onClick="return promptIfUnsafeToRestart(this, '${moduleDetails.bundleId}','${moduleDetails.symbolicName}','${moduleDetails.type.name}');"><fmt:message
key="consolebase.common.restart"/></a>&nbsp;
+                </span>
+            </c:if>
+        </td>
+
+        <!-- Update action -->
+        <td width="75" class="${backgroundClass}">
+            <span> 
+                &nbsp;<a href="<portlet:actionURL><portlet:param name='bundleId'
value='${moduleDetails.bundleId}'/><portlet:param name='action' value='update'/></portlet:actionURL>"
onClick="return updatePrompt(this, '${moduleDetails.bundleId}','${moduleDetails.symbolicName}','${moduleDetails.type.name}');"><fmt:message
key="consolebase.common.update"/></a>&nbsp;
+            </span>
+        </td>
+        
+        <!-- Uninstall action -->
+        <td width="75" class="${backgroundClass}">
+            <span> 
+                &nbsp;<a href="<portlet:actionURL><portlet:param name='bundleId'
value='${moduleDetails.bundleId}'/><portlet:param name='action' value='uninstall'/></portlet:actionURL>"
onClick="return uninstallPrompt(this, '${moduleDetails.bundleId}','${moduleDetails.symbolicName}','${moduleDetails.type.name}');"><fmt:message
key="consolebase.common.uninstall"/></a>&nbsp;
+            </span>
+        </td>
+
+      </tr>
+  </c:forEach>
+</table>
+
+<script>
+// Call to set initial expert mode actions correctly 
+init();
+</script>

Propchange: geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/bundlemanager/normal.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/bundlemanager/normal.jsp
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/branches/3.0-M2/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/bundlemanager/normal.jsp
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message