geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r1352194 - in /geronimo/server/branches/3.0/plugins/console/console-base-portlets/src/main: i18n-resources/ java/org/apache/geronimo/console/obrmanager/ webapp/WEB-INF/view/obrmanager/
Date Wed, 20 Jun 2012 16:07:09 GMT
Author: gawor
Date: Wed Jun 20 16:07:09 2012
New Revision: 1352194

URL: http://svn.apache.org/viewvc?rev=1352194&view=rev
Log:
GERONIMO-6360: Support for 'obr:deploy' operation and localization improvements

Modified:
    geronimo/server/branches/3.0/plugins/console/console-base-portlets/src/main/i18n-resources/consolebase_en.properties
    geronimo/server/branches/3.0/plugins/console/console-base-portlets/src/main/i18n-resources/portletinfo_en.properties
    geronimo/server/branches/3.0/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/obrmanager/OBRManagerPortlet.java
    geronimo/server/branches/3.0/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/obrmanager/OBRManager.jsp
    geronimo/server/branches/3.0/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/obrmanager/resolve.jsp

Modified: geronimo/server/branches/3.0/plugins/console/console-base-portlets/src/main/i18n-resources/consolebase_en.properties
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0/plugins/console/console-base-portlets/src/main/i18n-resources/consolebase_en.properties?rev=1352194&r1=1352193&r2=1352194&view=diff
==============================================================================
--- geronimo/server/branches/3.0/plugins/console/console-base-portlets/src/main/i18n-resources/consolebase_en.properties
(original)
+++ geronimo/server/branches/3.0/plugins/console/console-base-portlets/src/main/i18n-resources/consolebase_en.properties
Wed Jun 20 16:07:09 2012
@@ -181,6 +181,7 @@ bundlemanager.normal.symbolicName       
 consolebase.common.JVMVersions     = JVM Versions
 consolebase.common.actions         = Actions
 consolebase.common.alias           = Alias
+consolebase.common.add             = Add
 consolebase.common.back            = Back
 consolebase.common.cancel          = Cancel
 consolebase.common.commands        = Commands
@@ -228,6 +229,9 @@ consolebase.common.users           = Use
 consolebase.common.value           = Value
 consolebase.common.version         = Version
 consolebase.common.view            = View
+consolebase.common.yes             = Yes
+consolebase.common.no              = No
+consolebase.common.search          = Search
 
 infomanager.javaSysHelp.body                   = This page displays the values of the system
properties available to the server process.
 infomanager.javaSysNormal.etc                  = Etc
@@ -808,3 +812,27 @@ artifact.actions.edit		     = Edit
 artifact.actions.save                = Save
 artifact.actions.remove              = Remove
 artifact.msg.emptyText               = Empty Text
+
+obrmanager.versionHeader                = Version
+obrmanager.symbolicNameHeader           = Symbolic Name
+obrmanager.requiredHeader               = Required
+obrmanager.unsatisfiedRequirementHeader = Unsatisfied Requirement
+obrmanager.resolveSuccess               = All resources resolved successfully
+obrmanager.resolvedResources            = Resolved resources
+obrmanager.dependentResources           = Additional dependent resources
+obrmanager.resolveFail                  = One or more resources cannot be resolved
+obrmanager.unsatisfiedRequirements      = Unsatisfied requirements
+obrmanager.resolve                      = Resolve
+obrmanager.selectedHeader               = Selected
+obrmanager.symbolicNameAndVersionHeader = Symbolic Name and Version
+obrmanager.resourceDescription          = Description:
+obrmanager.resourceCapabilities         = Capabilities:
+obrmanager.resourceRequirements         = Requirements:
+obrmanager.searchBy                     = Search by:
+obrmanager.search.symbolicName          = Symbolic name
+obrmanager.search.resourceName          = Resource name
+obrmanager.search.packageCapability     = Package capability
+obrmanager.search.packageRequirement    = Package requirement
+obrmanager.addRepository                = Bundle repository URL: 
+obrmanager.listAll                      = List All
+obrmanager.bundleRepositoryNameHeader   = Bundle Repository Name

Modified: geronimo/server/branches/3.0/plugins/console/console-base-portlets/src/main/i18n-resources/portletinfo_en.properties
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0/plugins/console/console-base-portlets/src/main/i18n-resources/portletinfo_en.properties?rev=1352194&r1=1352193&r2=1352194&view=diff
==============================================================================
--- geronimo/server/branches/3.0/plugins/console/console-base-portlets/src/main/i18n-resources/portletinfo_en.properties
(original)
+++ geronimo/server/branches/3.0/plugins/console/console-base-portlets/src/main/i18n-resources/portletinfo_en.properties
Wed Jun 20 16:07:09 2012
@@ -182,3 +182,6 @@ consolebase.obrmanager.err.actionError  
 consolebase.obrmanager.info.add                 = OBR repository {0} was successfully added.
 consolebase.obrmanager.info.removeurl           = OBR repository {0} was successfully removed.
 consolebase.obrmanager.info.refreshurl          = OBR repository {0} was successfully refreshed.
+
+consolebase.obrmanager.info.deploy              = Resources were successfully deployed.
+consolebase.obrmanager.err.deploy               = Error deploying resources.

Modified: geronimo/server/branches/3.0/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/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/obrmanager/OBRManagerPortlet.java?rev=1352194&r1=1352193&r2=1352194&view=diff
==============================================================================
--- geronimo/server/branches/3.0/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/obrmanager/OBRManagerPortlet.java
(original)
+++ geronimo/server/branches/3.0/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/obrmanager/OBRManagerPortlet.java
Wed Jun 20 16:07:09 2012
@@ -82,8 +82,12 @@ public class OBRManagerPortlet extends B
     private static final String ADD_URL_ACTION = "add_url";
     
     private static final String RESOLVE_ACTION = "resolve";
+    
+    private static final String DEPLOY_ACTION = "deploy";
 
     private static final String SEARCH_TYPE_ALL = "ALL";
+    
+    private Map<String, Resolver> resolverMap = Collections.synchronizedMap(new HashMap<String,
Resolver>());
 
     public void init(PortletConfig portletConfig) throws PortletException {
         super.init(portletConfig);
@@ -141,8 +145,12 @@ public class OBRManagerPortlet extends B
             actionResponse.setRenderParameter("mode", RESOLVE_ACTION);
             String[] selectedResources = actionRequest.getParameterValues("selected-resources");
             actionResponse.setRenderParameter("selected-resources", selectedResources);
-
-        }        
+        }  
+        else if (DEPLOY_ACTION.equals(action)) {
+            actionResponse.setRenderParameter("mode", DEPLOY_ACTION);
+            String resolverId = actionRequest.getParameter("resolverId");
+            actionResponse.setRenderParameter("resolverId", resolverId);
+        }
     }
         
     private void refreshRepository(ActionRequest actionRequest) throws Exception {
@@ -240,14 +248,18 @@ public class OBRManagerPortlet extends B
         if (WindowState.MINIMIZED.equals(renderRequest.getWindowState())) { // minimal view
             return;
         } else { // normal and maximal view
-            if (RESOLVE_ACTION.equals(renderRequest.getParameter("mode"))) {
-                try {
+            String mode = renderRequest.getParameter("mode");
+            try {
+                if (RESOLVE_ACTION.equals(mode)) {
                     resolveResources(renderRequest, renderResponse);
-                } catch (Exception e) {
-                    addErrorMessage(renderRequest, getLocalizedString(renderRequest, "consolebase.obrmanager.err.actionError"),
e.getMessage());
-                    logger.error("Exception", e);
+                    return;
+                } else if (DEPLOY_ACTION.equals(mode)) {
+                    deployResources(renderRequest, renderResponse);
+                    return;
                 }
-                return;
+            } catch (Exception e) {
+                addErrorMessage(renderRequest, getLocalizedString(renderRequest, "consolebase.obrmanager.err.actionError"),
e.getMessage());
+                logger.error("Exception", e);
             }
             
             BundleContext bundleContext = getBundleContext(renderRequest);
@@ -318,8 +330,8 @@ public class OBRManagerPortlet extends B
     private ResourceMatcher getResourceMatcher(String searchType, String searchString) {
         if (searchType.equalsIgnoreCase("symbolic-name")) {
             return new SymbolicNameMatcher(searchString);
-        } else if (searchType.equalsIgnoreCase("bundle-name")) {
-            return new BundleNameMatcher(searchString);
+        } else if (searchType.equalsIgnoreCase("resource-name")) {
+            return new ResourceNameMatcher(searchString);
         } else if (searchType.equalsIgnoreCase("package-capability")) {
             return new PackageCapabilityMatcher(searchString);
         } else if (searchType.equalsIgnoreCase("package-requirement")) {
@@ -360,9 +372,9 @@ public class OBRManagerPortlet extends B
         
     }
     
-    private static class BundleNameMatcher extends ResourceMatcher {
+    private static class ResourceNameMatcher extends ResourceMatcher {
 
-        public BundleNameMatcher(String query) {
+        public ResourceNameMatcher(String query) {
             super(query);
         }
 
@@ -596,6 +608,9 @@ public class OBRManagerPortlet extends B
             
             request.setAttribute("resolved", resolver.resolve());
             request.setAttribute("resolver", resolver);
+            String resolverId = String.valueOf(resolver.hashCode());
+            request.setAttribute("resolverId", resolverId);
+            resolverMap.put(resolverId, resolver);
             resolveView.include(request, response);
         } finally {
             if (reference != null) {
@@ -604,6 +619,24 @@ public class OBRManagerPortlet extends B
         }
     }        
 
+    private void deployResources(RenderRequest request, RenderResponse response) throws Exception
{
+        String resolverId = request.getParameter("resolverId");
+
+        Resolver resolver = resolverMap.get(resolverId);
+        
+        try {
+            resolver.deploy(Resolver.START);
+            addInfoMessage(request, getLocalizedString(request, "consolebase.obrmanager.info.deploy"));
+        } catch (Exception e) {
+            addErrorMessage(request, getLocalizedString(request, "consolebase.obrmanager.err.deploy"),
e.getMessage());
+            logger.error("Exception", e);
+        }
+        
+        request.setAttribute("resolved", true);
+        request.setAttribute("resolver", resolver);
+        resolveView.include(request, response);
+    }
+    
     private BundleContext getBundleContext(PortletRequest request) {
         return (BundleContext) request.getPortletSession().getPortletContext().getAttribute("osgi-bundlecontext");
     }

Modified: geronimo/server/branches/3.0/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/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/obrmanager/OBRManager.jsp?rev=1352194&r1=1352193&r2=1352194&view=diff
==============================================================================
--- geronimo/server/branches/3.0/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/obrmanager/OBRManager.jsp
(original)
+++ geronimo/server/branches/3.0/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/obrmanager/OBRManager.jsp
Wed Jun 20 16:07:09 2012
@@ -28,9 +28,9 @@
     <tr>
         <td>
             <form id="addForm" method="POST" action="<portlet:actionURL><portlet:param
name='action' value='add_url'/></portlet:actionURL>">
-                Add an OBR URL:
+                <fmt:message key="obrmanager.addRepository"/>
                 <input type="text" id="obrUrl" name="obrUrl" size="80" value=""/>&nbsp;
-                <input type="submit" value="Add" />
+                <input type="submit" value="<fmt:message key="consolebase.common.add"/>"
/>
             </form>
         </td>
     </tr>
@@ -39,8 +39,8 @@
 <!-- show OBR list -->
 <table width="100%" class="TableLine" summary="OBR Repositories">
     <tr class="DarkBackground">
-        <th scope="col" width="80%">OSGi Bundle Repository Name</th>   
-        <th scope="col" width="20%">Actions</th>
+        <th scope="col" width="80%"><fmt:message key="obrmanager.bundleRepositoryNameHeader"/></th>
  
+        <th scope="col" width="20%"><fmt:message key="consolebase.common.actions"/></th>
     </tr>
 
     <c:set var="backgroundClass" value='MediumBackground'/>
@@ -69,11 +69,11 @@
         <td>
             <!-- obr:refreshurl -->
             <span>
-                <a href="<portlet:actionURL><portlet:param name='repo.uri' value='${repo.URI}'/><portlet:param
name='repo.name' value='${repo.name}'/><portlet:param name='action' value='refreshurl'/></portlet:actionURL>">Refresh</a>&nbsp;
+                <a href="<portlet:actionURL><portlet:param name='repo.uri' value='${repo.URI}'/><portlet:param
name='repo.name' value='${repo.name}'/><portlet:param name='action' value='refreshurl'/></portlet:actionURL>"><fmt:message
key="consolebase.common.refresh"/></a>&nbsp;
             </span>
             <!-- obr:removeurl -->
             <span>
-                <a href="<portlet:actionURL><portlet:param name='repo.uri' value='${repo.URI}'/><portlet:param
name='repo.name' value='${repo.name}'/><portlet:param name='action' value='removeurl'/></portlet:actionURL>">Remove</a>&nbsp;
+                <a href="<portlet:actionURL><portlet:param name='repo.uri' value='${repo.URI}'/><portlet:param
name='repo.name' value='${repo.name}'/><portlet:param name='action' value='removeurl'/></portlet:actionURL>"><fmt:message
key="consolebase.common.remove"/></a>&nbsp;
             </span>
         </td>
       </tr>
@@ -85,23 +85,23 @@
     <tr>
         <td>
             <form id="listForm" method="POST" action="<portlet:actionURL><portlet:param
name='action' value='listAll'/></portlet:actionURL>">
-                <input type="submit" name="listAll" value="List All"/>
+                <input type="submit" name="listAll" value="<fmt:message key="obrmanager.listAll"/>"/>
             </form>
         </td>
         <td align="right">
             <form id="searchForm" method="POST" action="<portlet:actionURL><portlet:param
name='action' value='search'/></portlet:actionURL>">
-                Search type:
+                <fmt:message key="obrmanager.searchBy"/>&nbsp;
                 
                 <select name="searchType">
-                    <option id="symbolic-name" value="symbolic-name">Symbolic name</option>
-                    <option id="bundle-name" value="bundle-name">Bundle name</option>
-                    <option id="package-capability" value="package-capability">Package
capability</option>
-                    <option id="package-requirement" value="package-requirement">Package
requirement</option>
+                    <option id="symbolic-name" value="symbolic-name"><fmt:message
key="obrmanager.search.symbolicName"/></option>
+                    <option id="resource-name" value="resource-name"><fmt:message
key="obrmanager.search.resourceName"/></option>
+                    <option id="package-capability" value="package-capability"><fmt:message
key="obrmanager.search.packageCapability"/></option>
+                    <option id="package-requirement" value="package-requirement"><fmt:message
key="obrmanager.search.packageRequirement"/></option>
                 </select>
                 
                 <input type="text" id="searchString" name="searchString" value="${searchString}"/>&nbsp;
-                <input type="submit" value="Go" />
-                <input type="button" value="Reset" onclick="resetSearchForm()" />
+                <input type="submit" value="<fmt:message key="consolebase.common.search"/>"
/>
+                <input type="button" value="<fmt:message key="consolebase.common.reset"/>"
onclick="resetSearchForm()" />
             </form>
             <script language="javascript">
                 function resetSearchForm(){
@@ -124,8 +124,8 @@
 
 <table width="100%" class="TableLine" summary="Bundle List" border="0">
     <tr class="DarkBackground">
-        <th>Selected</th>
-        <th>Symbolic Name and Version</th>
+        <th><fmt:message key="obrmanager.selectedHeader"/></th>
+        <th><fmt:message key="obrmanager.symbolicNameAndVersionHeader"/></th>
     </tr>
     <c:set var="backgroundClass" value='MediumBackground'/>
 
@@ -149,7 +149,7 @@
                 <table width="100%" class="TableLine" cellpadding="3">
                     <!-- bundle id -->
                     <tr valign="top" width="100px">
-                        <td>Description:</td>
+                        <td><fmt:message key="obrmanager.resourceDescription"/></td>
                         <td>
                             id: ${resourceInfo.id}</br>
                             presentation name: ${resourceInfo.presentationName}</br>
@@ -160,7 +160,7 @@
                     </tr>
                     <tr><td colspan="2"></td></tr>
                     <tr valign="top" width="100px">
-                        <td>Requirements:</td>
+                        <td><fmt:message key="obrmanager.resourceRequirements"/></td>
                         <td>
                             <c:if test="${resourceInfo.requirements!=null}">
                             <c:forEach var="requireinfo" items="${resourceInfo.requirements}">
@@ -171,7 +171,7 @@
                     </tr>
                     <tr><td colspan="2"></td></tr>
                     <tr valign="top" width="100px">
-                        <td>Capabilities:</td>
+                        <td><fmt:message key="obrmanager.resourceCapabilities"/></td>
                         <td>
                             <c:if test="${resourceInfo.capabilities!=null}">
                             <c:forEach var="capabilityinfo" items="${resourceInfo.capabilities}">
@@ -187,6 +187,6 @@
     </c:forEach>
 </table>
     </p>
-    <input type="submit" value="Resolve"/> 
+    <input type="submit" value="<fmt:message key="obrmanager.resolve"/>"/> 
 </form>
 </c:if>

Modified: geronimo/server/branches/3.0/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/obrmanager/resolve.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/obrmanager/resolve.jsp?rev=1352194&r1=1352193&r2=1352194&view=diff
==============================================================================
--- geronimo/server/branches/3.0/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/obrmanager/resolve.jsp
(original)
+++ geronimo/server/branches/3.0/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/obrmanager/resolve.jsp
Wed Jun 20 16:07:09 2012
@@ -16,20 +16,24 @@
 --%>
 
 <%@ 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="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
+<%@ taglib uri="/WEB-INF/CommonMsg.tld" prefix="CommonMsg"%>
 
 <fmt:setBundle basename="consolebase"/>
 
+<CommonMsg:commonMsg/>
+
 <c:choose>
     <c:when test="${resolved == true}">
-        <h2>All resources resolved successfully</h2>
+        <h2><fmt:message key="obrmanager.resolveSuccess"/></h2>
 
-        <b>Resolved resources:</b>
-        <table width="100%" class="TableLine" summary="Resolved Resources">
+        <b><fmt:message key="obrmanager.resolvedResources"/></b>
+        <table width="100%" class="TableLine" summary="<fmt:message key="obrmanager.resolvedResources"/>"
>
             <tr class="DarkBackground">
-                <th scope="col" width="80%">Symbolic Name</th>
-                <th scope="col" width="20%">Version</th>
+                <th scope="col" width="80%"><fmt:message key="obrmanager.symbolicNameHeader"/></th>
+                <th scope="col" width="20%"><fmt:message key="obrmanager.versionHeader"/></th>
             </tr>
 
             <c:set var="backgroundClass" value='MediumBackground' />
@@ -60,12 +64,12 @@
             </c:when>
             <c:otherwise>
                 <br />
-                <b>Additional dependent resources:</b>
-                <table width="100%" class="TableLine" summary="Required Resources">
+                <b><fmt:message key="obrmanager.dependentResources"/></b>
+                <table width="100%" class="TableLine" summary="<fmt:message key="obrmanager.dependentResources"/>">
                     <tr class="DarkBackground">
-                        <th scope="col" width="70%">Symbolic Name</th>
-                        <th scope="col" width="20%">Version</th>
-                        <th scope="col" width="10%">Required</th>
+                        <th scope="col" width="70%"><fmt:message key="obrmanager.symbolicNameHeader"/></th>
+                        <th scope="col" width="20%"><fmt:message key="obrmanager.versionHeader"/></th>
+                        <th scope="col" width="10%"><fmt:message key="obrmanager.requiredHeader"/></th>
                     </tr>
 
                     <c:set var="backgroundClass" value='MediumBackground' />
@@ -89,7 +93,7 @@
                                 <!-- resource version -->
                                 <td>${resource.version}</td>
 
-                                <td>Yes</td>
+                                <td><fmt:message key="consolebase.common.yes"/></td>
                             </tr>
                         </c:forEach>
                     </c:if>
@@ -113,7 +117,7 @@
                                 <!-- resource version -->
                                 <td>${resource.version}</td>
 
-                                <td>No</td>
+                                <td><fmt:message key="consolebase.common.no"/></td>
                             </tr>
                         </c:forEach>
                     </c:if>
@@ -124,20 +128,31 @@
         
         <p/>
         
-        <form name="resolve-form" action="<portlet:actionURL/>">
-            <input type="submit" value='<fmt:message key="consolebase.common.return"/>'
onclick="history.go(-1); return false;" />
-        </form>
+        <c:choose>
+            <c:when test="${!empty(resolverId)}">
+                <form name="resolve-form-1" method="POST" action="<portlet:actionURL><portlet:param
name='action' value='deploy'/></portlet:actionURL>">
+                    <input type="hidden" name="resolverId" value="${resolverId}" />
+                    <input type="submit" value="Deploy" />
+                    <input type="submit" value='<fmt:message key="consolebase.common.return"/>'
onclick="history.go(-1); return false;" />
+                </form>
+            </c:when>
+            <c:otherwise>
+                <form name="resolve-form-2" method="POST" action="<portlet:actionURL></portlet:actionURL>">
+                    <input type="submit" value='<fmt:message key="consolebase.common.return"/>'
onclick="history.go(-3); return false;" />
+                </form>
+            </c:otherwise>
+        </c:choose>
 
     </c:when>
 
     <c:otherwise>
-       <h2>One or more resources cannot be resolved</h2>
+       <h2><fmt:message key="obrmanager.resolveFail"/></h2>
        
-       <b>Unsatisfied requirements:</b>
-       <table width="100%" class="TableLine" summary="Unsatisfied Requirements">
+       <b><fmt:message key="obrmanager.unsatisfiedRequirements"/></b>
+       <table width="100%" class="TableLine" summary="<fmt:message key="obrmanager.unsatisfiedRequirements"/>">
             <tr class="DarkBackground">
-                <th scope="col" width="20%">Symbolic Name</th>
-                <th scope="col" width="80%">Unsatisfied Requirement</th>
+                <th scope="col" width="20%"><fmt:message key="obrmanager.symbolicNameHeader"/></th>
+                <th scope="col" width="80%"><fmt:message key="obrmanager.unsatisfiedRequirementHeader"/></th>
             </tr>
 
             <c:set var="backgroundClass" value='MediumBackground' />
@@ -164,7 +179,7 @@
         
         <p/>
         
-        <form name="resolve-form" action="<portlet:actionURL/>">
+        <form name="resolve-form-3" method="POST" action="<portlet:actionURL/>">
             <input type="submit" value='<fmt:message key="consolebase.common.return"/>'
onclick="history.go(-1); return false;" />
         </form>
     </c:otherwise>



Mime
View raw message