geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmcma...@apache.org
Subject svn commit: r565415 - in /geronimo/sandbox/portals/plugins/pluto/trunk/geronimo-pluto/src/main/java/org/apache/geronimo/pluto: ACEGBean.java AdminConsoleExtension.java AdminConsoleExtensionGBean.java PortalContainerServicesGBean.java
Date Mon, 13 Aug 2007 16:55:25 GMT
Author: pmcmahan
Date: Mon Aug 13 09:55:24 2007
New Revision: 565415

URL: http://svn.apache.org/viewvc?view=rev&rev=565415
Log:
GERONIMO-3345 cleaning up and filling out functionality for portal container GBeans

Added:
    geronimo/sandbox/portals/plugins/pluto/trunk/geronimo-pluto/src/main/java/org/apache/geronimo/pluto/AdminConsoleExtension.java
  (with props)
    geronimo/sandbox/portals/plugins/pluto/trunk/geronimo-pluto/src/main/java/org/apache/geronimo/pluto/AdminConsoleExtensionGBean.java
      - copied, changed from r564771, geronimo/sandbox/portals/plugins/pluto/trunk/geronimo-pluto/src/main/java/org/apache/geronimo/pluto/ACEGBean.java
Removed:
    geronimo/sandbox/portals/plugins/pluto/trunk/geronimo-pluto/src/main/java/org/apache/geronimo/pluto/ACEGBean.java
Modified:
    geronimo/sandbox/portals/plugins/pluto/trunk/geronimo-pluto/src/main/java/org/apache/geronimo/pluto/PortalContainerServicesGBean.java

Added: geronimo/sandbox/portals/plugins/pluto/trunk/geronimo-pluto/src/main/java/org/apache/geronimo/pluto/AdminConsoleExtension.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/portals/plugins/pluto/trunk/geronimo-pluto/src/main/java/org/apache/geronimo/pluto/AdminConsoleExtension.java?view=auto&rev=565415
==============================================================================
--- geronimo/sandbox/portals/plugins/pluto/trunk/geronimo-pluto/src/main/java/org/apache/geronimo/pluto/AdminConsoleExtension.java
(added)
+++ geronimo/sandbox/portals/plugins/pluto/trunk/geronimo-pluto/src/main/java/org/apache/geronimo/pluto/AdminConsoleExtension.java
Mon Aug 13 09:55:24 2007
@@ -0,0 +1,49 @@
+/**
+ *  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.pluto;
+
+import java.util.ArrayList;
+
+import org.apache.pluto.driver.services.portal.PageConfig;
+
+public interface AdminConsoleExtension {
+
+    /*
+     * Add the PageConfig to pluto.  This will overwrite any existing pages with the same
page name
+     * @see org.apache.geronimo.pluto.PlutoAccessInterface#addPage(org.apache.pluto.driver.services.portal.PageConfig)
+     */
+    public void addPage(PageConfig pageConfig);
+    
+    /*
+     * This will add the portlets to the PageConfig in Pluto.
+     * @see org.apache.geronimo.pluto.PlutoAccessInterface#addPortlets(java.lang.String,
java.lang.String, java.util.ArrayList)
+     */
+    public void addPortlets(String pageTitle, String portletContext, ArrayList<String>
portletList);
+    
+    /*
+     * Removes a PageConfig object in Pluto with the pageTitle
+     * @see org.apache.geronimo.pluto.PlutoAccessInterface#removePage(java.lang.String)
+     */
+    public void removePage(String pageTitle);
+    
+    /*
+     * Removes the portletList from the PageConfig in Pluto
+     * @see org.apache.geronimo.pluto.PlutoAccessInterface#removePortlets(java.lang.String,
java.util.ArrayList)
+     */
+    public void removePortlets(String pageTitle, ArrayList<String> portletList);
+    
+}

Propchange: geronimo/sandbox/portals/plugins/pluto/trunk/geronimo-pluto/src/main/java/org/apache/geronimo/pluto/AdminConsoleExtension.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/portals/plugins/pluto/trunk/geronimo-pluto/src/main/java/org/apache/geronimo/pluto/AdminConsoleExtension.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/portals/plugins/pluto/trunk/geronimo-pluto/src/main/java/org/apache/geronimo/pluto/AdminConsoleExtension.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Copied: geronimo/sandbox/portals/plugins/pluto/trunk/geronimo-pluto/src/main/java/org/apache/geronimo/pluto/AdminConsoleExtensionGBean.java
(from r564771, geronimo/sandbox/portals/plugins/pluto/trunk/geronimo-pluto/src/main/java/org/apache/geronimo/pluto/ACEGBean.java)
URL: http://svn.apache.org/viewvc/geronimo/sandbox/portals/plugins/pluto/trunk/geronimo-pluto/src/main/java/org/apache/geronimo/pluto/AdminConsoleExtensionGBean.java?view=diff&rev=565415&p1=geronimo/sandbox/portals/plugins/pluto/trunk/geronimo-pluto/src/main/java/org/apache/geronimo/pluto/ACEGBean.java&r1=564771&p2=geronimo/sandbox/portals/plugins/pluto/trunk/geronimo-pluto/src/main/java/org/apache/geronimo/pluto/AdminConsoleExtensionGBean.java&r2=565415
==============================================================================
--- geronimo/sandbox/portals/plugins/pluto/trunk/geronimo-pluto/src/main/java/org/apache/geronimo/pluto/ACEGBean.java
(original)
+++ geronimo/sandbox/portals/plugins/pluto/trunk/geronimo-pluto/src/main/java/org/apache/geronimo/pluto/AdminConsoleExtensionGBean.java
Mon Aug 13 09:55:24 2007
@@ -19,8 +19,9 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
-import java.util.List;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanLifecycle;
@@ -31,78 +32,32 @@
 import org.apache.pluto.driver.services.portal.RenderConfigService;
 import org.apache.pluto.driver.services.portal.admin.RenderConfigAdminService;
 
-public class ACEGBean implements GBeanLifecycle, PlutoAccessInterface{
-
-    
+/* GBean for adding an item to the Administration Console's Navigator.  Web apps
+ * that contain portlets can add those portlets to the navigator by including
+ * a GBean in their deployment plans like this:
+ * 
+ *  <gbean name="MyAdminConsoleExtension" class="org.apache.geronimo.pluto.AdminConsoleExtensionGBean">
+ *    <attribute name="pageTitle">Hello</attribute>
+ *    <attribute name="portletContext">/HelloWorldPortlet</attribute>
+ *    <attribute name="portletList">[portlet_id_1, portlet_id_2]</attribute>
+ *  </gbean>
+ */
+public class AdminConsoleExtensionGBean implements GBeanLifecycle, PlutoAccessInterface,
AdminConsoleExtension {
+    private static final Log log = LogFactory.getLog(AdminConsoleExtensionGBean.class);
     public static final GBeanInfo GBEAN_INFO;
     private String pageTitle;
     private String portletContext;
-    private List<String> portletList = new ArrayList<String>();
-    
-    public String getPageTitle() {
-        return pageTitle;
-    }
-    public void setPageTitle(String pageTitle) {
+    private ArrayList<String> portletList;
+
+    /* Constructor for GBean */
+    public AdminConsoleExtensionGBean(String pageTitle, String portletContext, ArrayList<String>
portletList) {
+        super();
         this.pageTitle = pageTitle;
-    }
-    public String getPortletContext() {
-        return portletContext;
-    }
-    public void setPortletContext(String portletContext) {
         this.portletContext = portletContext;
-    }
-    public ArrayList<String> getPortletList() {
-        return (ArrayList<String>)portletList;
-    }
-    public void setPortletList(ArrayList<String> portletList) {
         this.portletList = portletList;
     }
-    
-    /*
-     * Called when the GBean is started
-     *   This adds/updates a Page in Pluto according to this GBean's specifications (ACE)
-     * @see org.apache.geronimo.gbean.GBeanLifecycle#doStart()
-     */
-    public synchronized void doStart() throws Exception{
-        String pageTitle = getPageTitle();
-        
-        //add the page if it doesn't exist yet
-        if(!pageExists(pageTitle)){
-            //create a PageConfig
-            PageConfig newPageConfig = createPageConfig();
-            addPage(newPageConfig);
-        }
-        
-        //add portlets to this newly created page
-        addPortlets(pageTitle, getPortletContext(), getPortletList());
-    }
 
     /*
-     * Called when the GBean is stopped
-     *   This removes/updates a Page in Pluto according to this GBean's specifications
-     * @see org.apache.geronimo.gbean.GBeanLifecycle#doStop()
-     */
-    public synchronized void doStop() throws Exception{
-        String pageTitle = getPageTitle();
-        
-        //remove portlets from the page
-        removePortlets(pageTitle, getPortletList());
-        
-        //if the page has 0 portlets on it, then go ahead and remove it
-        if(pageIsEmpty(pageTitle)){
-            removePage(pageTitle);
-        }
-    }
-    
-    /*
-     * Called when the GBean fails
-     * @see org.apache.geronimo.gbean.GBeanLifecycle#doFail()
-     */
-    public synchronized void doFail() {
-
-    }
-    
-    /*
      * Add the PageConfig to pluto.  This will overwrite any existing pages with the same
page name
      * @see org.apache.geronimo.pluto.PlutoAccessInterface#addPage(org.apache.pluto.driver.services.portal.PageConfig)
      */
@@ -161,7 +116,6 @@
         
         if(pageExists(pageTitle)){
             int portletCount = portletList.size();
-            String portletContext = getPortletContext();
             Collection list = pageConfig.getPortletIds();
             
             //run through the list of portlets to remove
@@ -208,7 +162,7 @@
     private PageConfig createPageConfig(){
         //Create a new PageConfig
         PageConfig pageConfig = new PageConfig();
-        pageConfig.setName(getPageTitle());
+        pageConfig.setName(pageTitle);
         pageConfig.setUri("/WEB-INF/themes/default-theme.jsp");
         return pageConfig;
     }
@@ -229,7 +183,7 @@
     /*
      * return true if Pluto contains a PageConfig with that name, else false
      */
-    public boolean pageExists(String pageTitle){
+    private boolean pageExists(String pageTitle){
 
         PageConfig pageConfig = getPageConfigFromPluto(pageTitle);
 
@@ -257,14 +211,60 @@
     }
     
     /*
+     * Called when the GBean is started
+     *   This adds/updates a Page in Pluto according to this GBean's specifications (ACE)
+     * @see org.apache.geronimo.gbean.GBeanLifecycle#doStart()
+     */
+    public synchronized void doStart() throws Exception{
+        //add the page if it doesn't exist yet
+        if(!pageExists(pageTitle)){
+            //create a PageConfig
+            PageConfig newPageConfig = createPageConfig();
+            addPage(newPageConfig);
+        }
+        
+        //add portlets to this newly created page
+        addPortlets(pageTitle, portletContext, portletList);
+        log.debug("Started AdminConsoleExtensionGBean for " + pageTitle);
+    }
+
+    /*
+     * Called when the GBean is stopped
+     *   This removes/updates a Page in Pluto according to this GBean's specifications
+     * @see org.apache.geronimo.gbean.GBeanLifecycle#doStop()
+     */
+    public synchronized void doStop() throws Exception{
+        //remove portlets from the page
+        removePortlets(pageTitle, portletList);
+        
+        //if the page has 0 portlets on it, then go ahead and remove it
+        if(pageIsEmpty(pageTitle)){
+            removePage(pageTitle);
+        }
+        log.debug("Stopped AdminConsoleExtensionGBean for " + pageTitle);
+    }
+    
+    /*
+     * Called when the GBean fails
+     * @see org.apache.geronimo.gbean.GBeanLifecycle#doFail()
+     */
+    public synchronized void doFail() {
+        log.warn("AdminConsoleExtensionGBean for " + pageTitle + " failed.");
+    }
+    
+    /*
      * Standard GBean information
      */
     static {
-        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("ACEGBean", ACEGBean.class);
+        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("AdminConsoleExtensionGBean",
AdminConsoleExtensionGBean.class);
+        infoFactory.addInterface(AdminConsoleExtension.class);
         infoFactory.addAttribute("pageTitle", String.class, true, true);
         infoFactory.addAttribute("portletContext", String.class, true, true);
         infoFactory.addAttribute("portletList", ArrayList.class, true, true);
-        
+        infoFactory.setConstructor(new String[] { 
+                "pageTitle", 
+                "portletContext", 
+                "portletList"});
         GBEAN_INFO = infoFactory.getBeanInfo();
     }
     public static GBeanInfo getGBeanInfo() {

Modified: geronimo/sandbox/portals/plugins/pluto/trunk/geronimo-pluto/src/main/java/org/apache/geronimo/pluto/PortalContainerServicesGBean.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/portals/plugins/pluto/trunk/geronimo-pluto/src/main/java/org/apache/geronimo/pluto/PortalContainerServicesGBean.java?view=diff&rev=565415&r1=565414&r2=565415
==============================================================================
--- geronimo/sandbox/portals/plugins/pluto/trunk/geronimo-pluto/src/main/java/org/apache/geronimo/pluto/PortalContainerServicesGBean.java
(original)
+++ geronimo/sandbox/portals/plugins/pluto/trunk/geronimo-pluto/src/main/java/org/apache/geronimo/pluto/PortalContainerServicesGBean.java
Mon Aug 13 09:55:24 2007
@@ -18,6 +18,8 @@
 
 package org.apache.geronimo.pluto;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanLifecycle;
@@ -30,9 +32,14 @@
 import org.apache.pluto.spi.PortalCallbackService;
 
 /*
- * a gbean that provides access to pluto's container services.
+ * A GBean that provides access to pluto's container services.  The pluto
+ * services are typically configured by spring.  The spring config should
+ * create this GBean using the getSingleton() method provided here and
+ * then provide it with references to the pluto services.
  */
 public class PortalContainerServicesGBean implements PortalContainerServices, GBeanLifecycle
{
+    private static final Log log = LogFactory.getLog(PortalContainerServicesGBean.class);
+    
     private RenderConfigService renderConfigService;
     private PortalCallbackService portalCallbackService;
     private PropertyConfigService propertyConfigService;
@@ -41,15 +48,15 @@
 
 
     public void doStart() throws Exception {
-        
+        log.debug("Started PortalContainerServicesGBean");
     }
     
     public void doStop() throws Exception {
-        
+        log.debug("Stopped PortalContainerServicesGBean");
     }
     
     public void doFail() {
-        
+        log.warn("PortalContainerServicesGBean Failed");
     }
     
     public AdminConfiguration getAdminConfiguration() {
@@ -94,14 +101,13 @@
         this.propertyConfigService = propertyConfigService;
     }
 
-    public static PortalContainerServices getInstance() {
+    public static PortalContainerServices getSingleton() {
         Kernel kernel = KernelRegistry.getSingleKernel();
         PortalContainerServices portalServices = null;
         try {
             portalServices = (PortalContainerServices) kernel.getGBean(PortalContainerServices.class);
         } catch (Exception e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
+            log.error("Failed to get PortalContainerServices GBean from kernel", e);
         }
         return portalServices;
     }
@@ -109,8 +115,7 @@
     public static final GBeanInfo GBEAN_INFO;
 
     static {
-        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(
-                "Pluto Container Services", PortalContainerServicesGBean.class);
+        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("PortalContainerServicesGBean",
PortalContainerServicesGBean.class);
         infoFactory.addInterface(PortalContainerServices.class);
         infoFactory.setConstructor(new String[0]);
         GBEAN_INFO = infoFactory.getBeanInfo();



Mime
View raw message