geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwo...@apache.org
Subject svn commit: r1344578 - in /geronimo/server/branches/3.0-beta/plugins/console: console-base-portlets/ console-base-portlets/src/main/java/org/apache/geronimo/console/obrmanager/ console-base-portlets/src/main/webapp/WEB-INF/ console-base-portlets/src/ma...
Date Thu, 31 May 2012 07:27:52 GMT
Author: rwonly
Date: Thu May 31 07:27:52 2012
New Revision: 1344578

URL: http://svn.apache.org/viewvc?rev=1344578&view=rev
Log:
GERONIMO-5939 Support OBR resolution during bundle install (first drop)

Added:
    geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/obrmanager/
    geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/obrmanager/OBRManagerPortlet.java
  (with props)
    geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/obrmanager/
    geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/obrmanager/OBRManager.jsp
  (with props)
Modified:
    geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/pom.xml
    geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/portlet.xml
    geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/web.xml
    geronimo/server/branches/3.0-beta/plugins/console/console-tomcat/src/main/plan/plan.xml

Modified: geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/pom.xml?rev=1344578&r1=1344577&r2=1344578&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/pom.xml (original)
+++ geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/pom.xml Thu May
31 07:27:52 2012
@@ -114,6 +114,12 @@
             <version>${project.version}</version>         
             <scope>provided</scope>
         </dependency>
+        
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.bundlerepository</artifactId>
+            <scope>provided</scope>
+        </dependency>
 
     </dependencies>
 

Added: geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/obrmanager/OBRManagerPortlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/obrmanager/OBRManagerPortlet.java?rev=1344578&view=auto
==============================================================================
--- geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/obrmanager/OBRManagerPortlet.java
(added)
+++ geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/obrmanager/OBRManagerPortlet.java
Thu May 31 07:27:52 2012
@@ -0,0 +1,117 @@
+/**
+ *  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.obrmanager;
+
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+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.felix.bundlerepository.Repository;
+import org.apache.felix.bundlerepository.RepositoryAdmin;
+import org.apache.geronimo.console.BasePortlet;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class OBRManagerPortlet extends BasePortlet {
+
+    private static final Logger logger = LoggerFactory.getLogger(OBRManagerPortlet.class);
+
+    private PortletRequestDispatcher helpView;
+
+    private PortletRequestDispatcher obrManagerView;
+
+    public void init(PortletConfig portletConfig) throws PortletException {
+        super.init(portletConfig);
+        helpView = portletConfig.getPortletContext().getRequestDispatcher("/WEB-INF/view/obrmanager/OBRManager.jsp");
+        obrManagerView = portletConfig.getPortletContext().getRequestDispatcher("/WEB-INF/view/obrmanager/OBRManager.jsp");
+
+    }
+
+    public void destroy() {
+        obrManagerView = null;
+        super.destroy();
+    }
+
+    public void processAction(ActionRequest actionRequest, ActionResponse actionResponse)
throws PortletException,
+            IOException {
+
+        String action = actionRequest.getParameter("action");
+
+        if ("add_url".equals(action)) {
+            String obrUrl = actionRequest.getParameter("obrUrl");
+
+            BundleContext bundleContext = getBundleContext(actionRequest);
+            ServiceReference reference = bundleContext.getServiceReference(RepositoryAdmin.class.getName());
+            RepositoryAdmin repositoryAdmin = (RepositoryAdmin) bundleContext.getService(reference);
+
+            try {
+                repositoryAdmin.addRepository(new URI(obrUrl).toURL());
+            } catch (URISyntaxException e) {
+                e.printStackTrace();
+            } catch (Exception e) {
+                e.printStackTrace();
+            } finally {
+                bundleContext.ungetService(reference);
+            }
+
+        }
+
+    }
+
+    protected void doView(RenderRequest renderRequest, RenderResponse renderResponse) throws
IOException,
+            PortletException {
+
+        if (WindowState.MINIMIZED.equals(renderRequest.getWindowState())) { // minimal view
+            return;
+        } else { // normal and maximal view
+
+            BundleContext bundleContext = getBundleContext(renderRequest);
+            ServiceReference reference = bundleContext.getServiceReference(RepositoryAdmin.class.getName());
+            RepositoryAdmin repositoryAdmin = (RepositoryAdmin) bundleContext.getService(reference);
+
+            Repository[] repos = repositoryAdmin.listRepositories();
+            List<String> repoURIs = new ArrayList<String>();
+            for (Repository repo : repos) {
+                repoURIs.add(repo.getURI());
+            }
+
+            renderRequest.setAttribute("repoURIs", repoURIs);
+
+            obrManagerView.include(renderRequest, renderResponse);
+        }
+
+    }
+
+    private BundleContext getBundleContext(PortletRequest request) {
+        return (BundleContext) request.getPortletSession().getPortletContext().getAttribute("osgi-bundlecontext");
+    }
+}

Propchange: geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/obrmanager/OBRManagerPortlet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/obrmanager/OBRManagerPortlet.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

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

Modified: geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/portlet.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/portlet.xml?rev=1344578&r1=1344577&r2=1344578&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/portlet.xml
(original)
+++ geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/portlet.xml
Thu May 31 07:27:52 2012
@@ -418,7 +418,27 @@ limitations under the License.
             <short-title>OSGi Bundles</short-title>
             <keywords>OSGi Bundle</keywords>
         </portlet-info>
-    </portlet>    
+    </portlet>
+    <portlet>
+        <description>Portlet for managing OSGi Bundle Repositories</description>
+        <portlet-name>OBRManagerPortlet</portlet-name>
+        <display-name>OBR Manager Portlet</display-name>
+        <portlet-class>org.apache.geronimo.console.obrmanager.OBRManagerPortlet</portlet-class>
+        <expiration-cache>-1</expiration-cache>
+        <supports>
+            <mime-type>text/html</mime-type>
+            <portlet-mode>VIEW</portlet-mode>
+        </supports>
+        <supported-locale>en</supported-locale>
+        <supported-locale>zh</supported-locale>
+        <supported-locale>ja</supported-locale>
+        <resource-bundle>portletinfo</resource-bundle>
+        <portlet-info>
+            <title>OSGi Bundle Repositories</title>
+            <short-title>OSGi Bundle Repositories</short-title>
+            <keywords>OSGi Bundle Repositories</keywords>
+        </portlet-info>
+    </portlet>
     <portlet>
         <description>Portlet for displaying System modules</description>
         <portlet-name>SystemModules</portlet-name>

Added: geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/obrmanager/OBRManager.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/obrmanager/OBRManager.jsp?rev=1344578&view=auto
==============================================================================
--- geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/obrmanager/OBRManager.jsp
(added)
+++ geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/obrmanager/OBRManager.jsp
Thu May 31 07:27:52 2012
@@ -0,0 +1,71 @@
+<%--
+   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:commonMsg/>
+
+<br/>
+<table width="100%" class="BlankTableLine" summary="Add OBR URL">
+    <tr>
+        <td>
+            <form id="addForm" method="POST" action="<portlet:actionURL><portlet:param
name='action' value='add_url'/></portlet:actionURL>">
+                Add an OBR URL:
+                <input type="text" id="obrUrl" name="obrUrl" size="80" value=""/>&nbsp;
+                <input type="submit" value="Add" />
+            </form>
+        </td>
+    </tr>
+</table>
+
+
+<table width="100%" class="TableLine" summary="OBR Repositories">
+    <tr class="DarkBackground">
+        <th scope="col" width="35">OSGi Bundle Repository URLs</th>   
+        <th scope="col" width="100">Actions</th>
+    </tr>
+
+    <c:set var="backgroundClass" value='MediumBackground'/>
+    <c:forEach var="uri" items="${repoURIs}">
+      <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 class="${backgroundClass}" onmouseover="highlightBgColor(this)" onmouseout="recoverBgColor(this)">
+        <!-- OBR URLs -->
+        <td>&nbsp;${uri}&nbsp;</td>
+
+        <!-- Actions -->
+        <td>&nbsp; &nbsp;</td>
+        
+
+      </tr>
+    </c:forEach>
+</table>
+
+
+
+

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

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

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

Modified: geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/web.xml?rev=1344578&r1=1344577&r2=1344578&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/web.xml
(original)
+++ geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/web.xml
Thu May 31 07:27:52 2012
@@ -189,7 +189,7 @@ limitations under the License.
         </init-param>
         <load-on-startup>1</load-on-startup>
     </servlet>
-     <servlet>
+    <servlet>
         <servlet-name>BundleManagerPortletServlet</servlet-name>
         <servlet-class>org.apache.pluto.container.driver.PortletServlet</servlet-class>
         <init-param>
@@ -197,7 +197,16 @@ limitations under the License.
             <param-value>BundleManagerPortlet</param-value>
         </init-param>
         <load-on-startup>1</load-on-startup>
-    </servlet>    
+    </servlet>
+    <servlet>
+        <servlet-name>OBRManagerPortletServlet</servlet-name>
+        <servlet-class>org.apache.pluto.container.driver.PortletServlet</servlet-class>
+        <init-param>
+            <param-name>portlet-name</param-name>
+            <param-value>OBRManagerPortlet</param-value>
+        </init-param>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
     <servlet>
         <servlet-name>SystemModules</servlet-name>
         <servlet-class>org.apache.pluto.container.driver.PortletServlet</servlet-class>
@@ -348,14 +357,18 @@ limitations under the License.
         <servlet-name>WARModules</servlet-name>
         <url-pattern>/PlutoInvoker/WARModules</url-pattern>
     </servlet-mapping>
-     <servlet-mapping>
+    <servlet-mapping>
         <servlet-name>EBAModules</servlet-name>
         <url-pattern>/PlutoInvoker/EBAModules</url-pattern>
     </servlet-mapping>
-     <servlet-mapping>
+    <servlet-mapping>
         <servlet-name>BundleManagerPortletServlet</servlet-name>
         <url-pattern>/PlutoInvoker/BundleManagerPortlet</url-pattern>
-    </servlet-mapping>    
+    </servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>OBRManagerPortletServlet</servlet-name>
+        <url-pattern>/PlutoInvoker/OBRManagerPortlet</url-pattern>
+    </servlet-mapping>
     <servlet-mapping>
         <servlet-name>SystemModules</servlet-name>
         <url-pattern>/PlutoInvoker/SystemModules</url-pattern>

Modified: geronimo/server/branches/3.0-beta/plugins/console/console-tomcat/src/main/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/plugins/console/console-tomcat/src/main/plan/plan.xml?rev=1344578&r1=1344577&r2=1344578&view=diff
==============================================================================
--- geronimo/server/branches/3.0-beta/plugins/console/console-tomcat/src/main/plan/plan.xml
(original)
+++ geronimo/server/branches/3.0-beta/plugins/console/console-tomcat/src/main/plan/plan.xml
Thu May 31 07:27:52 2012
@@ -221,6 +221,16 @@
                     <name>PlutoPortalServices</name>
                 </reference>
             </gbean>
+            <!-- 3-8 is plugins portlet, so here is 3-9 -->
+            <gbean name="OBRManager" class="org.apache.geronimo.pluto.AdminConsoleExtensionGBean">
+                <attribute name="pageTitle">3-9/Resources/OBR Manager</attribute>
+                <attribute name="portletContext">/console-base</attribute>
+                <attribute name="portletList">[OBRManagerPortlet]</attribute>
+                <attribute name="icon">/images/ico_car_16x16.gif</attribute>
+                <reference name="PortalContainerServices">
+                    <name>PlutoPortalServices</name>
+                </reference>
+            </gbean>
             <gbean name="UsersGroups" class="org.apache.geronimo.pluto.AdminConsoleExtensionGBean">
                 <attribute name="pageTitle">4-1/Security/Users and Groups</attribute>
                 <attribute name="portletContext">/console-base</attribute>



Mime
View raw message