Return-Path: X-Original-To: apmail-geronimo-scm-archive@www.apache.org Delivered-To: apmail-geronimo-scm-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 28AA79DAE for ; Tue, 5 Jun 2012 15:45:57 +0000 (UTC) Received: (qmail 91198 invoked by uid 500); 5 Jun 2012 15:45:57 -0000 Delivered-To: apmail-geronimo-scm-archive@geronimo.apache.org Received: (qmail 91163 invoked by uid 500); 5 Jun 2012 15:45:57 -0000 Mailing-List: contact scm-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@geronimo.apache.org List-Id: Delivered-To: mailing list scm@geronimo.apache.org Received: (qmail 91156 invoked by uid 99); 5 Jun 2012 15:45:57 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Jun 2012 15:45:57 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Jun 2012 15:45:54 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 3238723889BF; Tue, 5 Jun 2012 15:45:34 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r1346435 - in /geronimo/server/branches/3.0-beta/plugins/console: console-base-portlets/src/main/i18n-resources/ console-base-portlets/src/main/java/org/apache/geronimo/console/obrmanager/ console-base-portlets/src/main/webapp/WEB-INF/view/... Date: Tue, 05 Jun 2012 15:45:33 -0000 To: scm@geronimo.apache.org From: gawor@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120605154534.3238723889BF@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: gawor Date: Tue Jun 5 15:45:32 2012 New Revision: 1346435 URL: http://svn.apache.org/viewvc?rev=1346435&view=rev Log: GERONIMO-6360: Implement OBR portlet a bit more. Patches from Gary with some minor additional changes. Modified: geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/src/main/i18n-resources/portletinfo_en.properties geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/src/main/i18n-resources/portletinfo_ja.properties geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/src/main/i18n-resources/portletinfo_zh.properties geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/obrmanager/OBRManagerPortlet.java geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/obrmanager/OBRManager.jsp geronimo/server/branches/3.0-beta/plugins/console/console-jetty/src/main/plan/plan.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/src/main/i18n-resources/portletinfo_en.properties URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/src/main/i18n-resources/portletinfo_en.properties?rev=1346435&r1=1346434&r2=1346435&view=diff ============================================================================== --- geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/src/main/i18n-resources/portletinfo_en.properties (original) +++ geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/src/main/i18n-resources/portletinfo_en.properties Tue Jun 5 15:45:32 2012 @@ -165,15 +165,20 @@ consolebase.warnMsg07 = A shutdown of t consolebase.warnMsg08 = There are no Web Containers defined. consolebase.warnMsg09 = Cannot update the serving connector {0}. You can update it via modifying var/catalina/server.xml when server is stopped. -consolebase.bundlemanager.info.start = Bundle: {0} (id={1}) is successfully started. -consolebase.bundlemanager.info.stop = Bundle: {0} (id={1}) is successfully stopped. -consolebase.bundlemanager.info.update = Bundle: {0} (id={1}) is successfully updated. -consolebase.bundlemanager.info.refresh = Bundle: {0} (id={1}) is successfully refreshed. -consolebase.bundlemanager.info.uninstall = Bundle: {0} (id={1}) is successfully uninstalled. -consolebase.bundlemanager.info.install = Bundle: {0} is successfully installed, its Id is {1}. +consolebase.bundlemanager.info.start = Bundle: {0} (id={1}) was successfully started. +consolebase.bundlemanager.info.stop = Bundle: {0} (id={1}) was successfully stopped. +consolebase.bundlemanager.info.update = Bundle: {0} (id={1}) was successfully updated. +consolebase.bundlemanager.info.refresh = Bundle: {0} (id={1}) was successfully refreshed. +consolebase.bundlemanager.info.uninstall = Bundle: {0} (id={1}) was successfully uninstalled. +consolebase.bundlemanager.info.install = Bundle: {0} (id={1}) was successfully installed. consolebase.bundlemanager.warn.invalidAction = Invalid action: consolebase.bundlemanager.warn.nobundlesfound = No bundles found of this type. -consolebase.bundlemanager.err.actionError = Encountered an unhandled exception while process action: -consolebase.bundlemanager.err.file.uploadError = File upload failed, encounter a FileUploadException. -consolebase.bundlemanager.err.file.writeError = Write file failed, encounter an unhandled exception. +consolebase.bundlemanager.err.actionError = Encountered an unhandled exception while processing action: +consolebase.bundlemanager.err.file.uploadError = File upload failed, encountered a FileUploadException. +consolebase.bundlemanager.err.file.writeError = Write file failed, encountered an unhandled exception. consolebase.bundlemanager.err.file.nullError = The uploaded file is null. + +consolebase.obrmanager.err.actionError = Encountered an unhandled exception while processing action: +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. Modified: geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/src/main/i18n-resources/portletinfo_ja.properties URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/src/main/i18n-resources/portletinfo_ja.properties?rev=1346435&r1=1346434&r2=1346435&view=diff ============================================================================== --- geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/src/main/i18n-resources/portletinfo_ja.properties (original) +++ geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/src/main/i18n-resources/portletinfo_ja.properties Tue Jun 5 15:45:32 2012 @@ -165,15 +165,20 @@ consolebase.warnMsg07 = サーã� consolebase.warnMsg08 = Web コンテナーを定義していません。 consolebase.warnMsg09 = Cannot update the serving connector {0}. You can update it via modifying var/catalina/server.xml when server is stopped. -consolebase.bundlemanager.info.start = Bundle: {0} (id={1}) is successfully started. -consolebase.bundlemanager.info.stop = Bundle: {0} (id={1}) is successfully stopped. -consolebase.bundlemanager.info.update = Bundle: {0} (id={1}) is successfully updated. -consolebase.bundlemanager.info.refresh = Bundle: {0} (id={1}) is successfully refreshed. -consolebase.bundlemanager.info.uninstall = Bundle: {0} (id={1}) is successfully uninstalled. -consolebase.bundlemanager.info.install = Bundle: {0} is successfully installed, its Id is {1}. +consolebase.bundlemanager.info.start = Bundle: {0} (id={1}) was successfully started. +consolebase.bundlemanager.info.stop = Bundle: {0} (id={1}) was successfully stopped. +consolebase.bundlemanager.info.update = Bundle: {0} (id={1}) was successfully updated. +consolebase.bundlemanager.info.refresh = Bundle: {0} (id={1}) was successfully refreshed. +consolebase.bundlemanager.info.uninstall = Bundle: {0} (id={1}) was successfully uninstalled. +consolebase.bundlemanager.info.install = Bundle: {0} (id={1}) was successfully installed. consolebase.bundlemanager.warn.invalidAction = Invalid action: consolebase.bundlemanager.warn.nobundlesfound = No bundles found of this type. -consolebase.bundlemanager.err.actionError = Encountered an unhandled exception while process action: -consolebase.bundlemanager.err.file.uploadError = File upload failed, encounter a FileUploadException. -consolebase.bundlemanager.err.file.writeError = Write file failed, encounter an unhandled exception. +consolebase.bundlemanager.err.actionError = Encountered an unhandled exception while processing action: +consolebase.bundlemanager.err.file.uploadError = File upload failed, encountered a FileUploadException. +consolebase.bundlemanager.err.file.writeError = Write file failed, encountered an unhandled exception. consolebase.bundlemanager.err.file.nullError = The uploaded file is null. + +consolebase.obrmanager.err.actionError = Encountered an unhandled exception while processing action: +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. Modified: geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/src/main/i18n-resources/portletinfo_zh.properties URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/src/main/i18n-resources/portletinfo_zh.properties?rev=1346435&r1=1346434&r2=1346435&view=diff ============================================================================== --- geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/src/main/i18n-resources/portletinfo_zh.properties (original) +++ geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/src/main/i18n-resources/portletinfo_zh.properties Tue Jun 5 15:45:32 2012 @@ -165,15 +165,21 @@ consolebase.warnMsg07 = 关闭æ� consolebase.warnMsg08 = 未定义任何Web容器。 consolebase.warnMsg09 = Cannot update the serving connector {0}. You can update it via modifying var/catalina/server.xml when server is stopped. -consolebase.bundlemanager.info.start = Bundle: {0} (id={1}) is successfully started. -consolebase.bundlemanager.info.stop = Bundle: {0} (id={1}) is successfully stopped. -consolebase.bundlemanager.info.update = Bundle: {0} (id={1}) is successfully updated. -consolebase.bundlemanager.info.refresh = Bundle: {0} (id={1}) is successfully refreshed. -consolebase.bundlemanager.info.uninstall = Bundle: {0} (id={1}) is successfully uninstalled. -consolebase.bundlemanager.info.install = Bundle: {0} is successfully installed, its Id is {1}. +consolebase.bundlemanager.info.start = Bundle: {0} (id={1}) was successfully started. +consolebase.bundlemanager.info.stop = Bundle: {0} (id={1}) was successfully stopped. +consolebase.bundlemanager.info.update = Bundle: {0} (id={1}) was successfully updated. +consolebase.bundlemanager.info.refresh = Bundle: {0} (id={1}) was successfully refreshed. +consolebase.bundlemanager.info.uninstall = Bundle: {0} (id={1}) was successfully uninstalled. +consolebase.bundlemanager.info.install = Bundle: {0} (id={1}) was successfully installed. consolebase.bundlemanager.warn.invalidAction = Invalid action: consolebase.bundlemanager.warn.nobundlesfound = No bundles found of this type. -consolebase.bundlemanager.err.actionError = Encountered an unhandled exception while process action: -consolebase.bundlemanager.err.file.uploadError = File upload failed, encounter a FileUploadException. -consolebase.bundlemanager.err.file.writeError = Write file failed, encounter an unhandled exception. +consolebase.bundlemanager.err.actionError = Encountered an unhandled exception while processing action: +consolebase.bundlemanager.err.file.uploadError = File upload failed, encountered a FileUploadException. +consolebase.bundlemanager.err.file.writeError = Write file failed, encountered an unhandled exception. consolebase.bundlemanager.err.file.nullError = The uploaded file is null. + +consolebase.obrmanager.err.actionError = Encountered an unhandled exception while processing action: +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. + Modified: 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=1346435&r1=1346434&r2=1346435&view=diff ============================================================================== --- geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/obrmanager/OBRManagerPortlet.java (original) +++ geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/obrmanager/OBRManagerPortlet.java Tue Jun 5 15:45:32 2012 @@ -19,7 +19,6 @@ package org.apache.geronimo.console.obrm import java.io.IOException; import java.net.URI; -import java.net.URISyntaxException; import java.util.ArrayList; import java.util.List; @@ -35,6 +34,7 @@ import javax.portlet.WindowState; import org.apache.felix.bundlerepository.Repository; import org.apache.felix.bundlerepository.RepositoryAdmin; +import org.apache.felix.bundlerepository.Resource; import org.apache.geronimo.console.BasePortlet; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; @@ -49,6 +49,20 @@ public class OBRManagerPortlet extends B private PortletRequestDispatcher obrManagerView; + private static final String SERACH_ACTION = "search"; + + private static final String LIST_ACTION = "listAll"; + + private static final String REMOVE_URL_ACTION = "removeurl"; + + private static final String REFRESH_URL_ACTION = "refreshurl"; + + private static final String ADD_URL_ACTION = "add_url"; + + private static final String SEARCH_TYPE_ALL = "ALL"; + + private static final String SEARCH_TYPE_SEARCH = "SEARCH"; + public void init(PortletConfig portletConfig) throws PortletException { super.init(portletConfig); helpView = portletConfig.getPortletContext().getRequestDispatcher("/WEB-INF/view/obrmanager/OBRManager.jsp"); @@ -63,28 +77,54 @@ public class OBRManagerPortlet extends B public void processAction(ActionRequest actionRequest, ActionResponse actionResponse) throws PortletException, IOException { - + actionResponse.setRenderParameter("message", ""); // set to blank first + + BundleContext bundleContext = getBundleContext(actionRequest); + ServiceReference reference = bundleContext.getServiceReference(RepositoryAdmin.class.getName()); + RepositoryAdmin repositoryAdmin = (RepositoryAdmin) bundleContext.getService(reference); + 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); + if (ADD_URL_ACTION.equals(action)) { + String obrUrl = actionRequest.getParameter("obrUrl"); try { repositoryAdmin.addRepository(new URI(obrUrl).toURL()); - } catch (URISyntaxException e) { - e.printStackTrace(); + addInfoMessage(actionRequest, getLocalizedString(actionRequest, "consolebase.obrmanager.info.add", obrUrl)); } catch (Exception e) { - e.printStackTrace(); - } finally { - bundleContext.ungetService(reference); + addErrorMessage(actionRequest, getLocalizedString(actionRequest, "consolebase.obrmanager.err.actionError") + action, e.getMessage()); + logger.error("Exception", e); } - } + else if (REFRESH_URL_ACTION.equals(action)) { + String uri = actionRequest.getParameter("uri"); + try { + repositoryAdmin.removeRepository(uri); + repositoryAdmin.addRepository(uri); + addInfoMessage(actionRequest, getLocalizedString(actionRequest, "consolebase.obrmanager.info.refreshurl", uri)); + } catch (Exception e) { + addErrorMessage(actionRequest, getLocalizedString(actionRequest, "consolebase.obrmanager.err.actionError") + action, e.getMessage()); + logger.error("Exception", e); + } + } + else if (REMOVE_URL_ACTION.equals(action)) { + String uri = actionRequest.getParameter("uri"); + repositoryAdmin.removeRepository(uri); + addInfoMessage(actionRequest, getLocalizedString(actionRequest, "consolebase.obrmanager.info.removeurl", uri)); + } + else if (LIST_ACTION.equals(action)) { + String searchType = SEARCH_TYPE_ALL; + actionResponse.setRenderParameter("searchType", searchType); + } + else if (SERACH_ACTION.equals(action)) { + String searchType = SEARCH_TYPE_SEARCH; + String searchString = actionRequest.getParameter("searchString"); + actionResponse.setRenderParameter("searchType", searchType); + actionResponse.setRenderParameter("searchString", searchString); + } + } protected void doView(RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, @@ -98,14 +138,51 @@ public class OBRManagerPortlet extends B ServiceReference reference = bundleContext.getServiceReference(RepositoryAdmin.class.getName()); RepositoryAdmin repositoryAdmin = (RepositoryAdmin) bundleContext.getService(reference); + //get All OBR Repository[] repos = repositoryAdmin.listRepositories(); - List repoURIs = new ArrayList(); - for (Repository repo : repos) { - repoURIs.add(repo.getURI()); - } - - renderRequest.setAttribute("repoURIs", repoURIs); + renderRequest.setAttribute("repos", repos); + String searchType = renderRequest.getParameter("searchType"); + if (searchType != null && !"".equals(searchType)) { + if (SEARCH_TYPE_ALL.equals(searchType)) { + Repository[] repoAll = repositoryAdmin.listRepositories(); + List resourcesResult = new ArrayList(); + + for (Repository repo : repoAll) { + Resource[] resources = repo.getResources(); + for (Resource reso : resources) { + resourcesResult.add(reso); + } + } + renderRequest.setAttribute("resources", resourcesResult); + + } + else if (SEARCH_TYPE_SEARCH.equals(searchType)) { + try { + String searchString = renderRequest.getParameter("searchString"); + StringBuffer sb = new StringBuffer(); + + if (searchString==null||"".equals(searchString)) { + sb.append("(|(presentationname=*)(symbolicname=*))"); + } + else { + sb.append("(|(presentationname=*"); + sb.append(searchString); + sb.append("*)(symbolicname=*"); + sb.append(searchString); + sb.append("*))"); + } + + Resource[] resources = repositoryAdmin.discoverResources(sb.toString()); + renderRequest.setAttribute("resources", resources); + } catch (Exception e) { + addErrorMessage(renderRequest, getLocalizedString(renderRequest, "consolebase.obrmanager.err.actionError"), e.getMessage()); + logger.error("Exception", e); + } finally { + bundleContext.ungetService(reference); + } + } + } obrManagerView.include(renderRequest, renderResponse); } Modified: 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=1346435&r1=1346434&r2=1346435&view=diff ============================================================================== --- geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/obrmanager/OBRManager.jsp (original) +++ geronimo/server/branches/3.0-beta/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/obrmanager/OBRManager.jsp Tue Jun 5 15:45:32 2012 @@ -36,15 +36,15 @@ - + - - + + - + @@ -56,16 +56,115 @@ - - + + + + + + + + + - - - + +
OSGi Bundle Repository URLsActionsOSGi Bundle Repository NameActions
 ${uri}  ${repo.URI}  ${repo.name}     + + + Refresh  + + + + Remove  + +
+ + + + + + +
+
+ +
+
+
+ Search by Symbolic Name: +   + + +
+ +
+ + + + + + + - - + + + + + + + + + + + + + + +
Symbolic Name
+
${resourceInfo.symbolicName}
+ +
+
Modified: geronimo/server/branches/3.0-beta/plugins/console/console-jetty/src/main/plan/plan.xml URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-beta/plugins/console/console-jetty/src/main/plan/plan.xml?rev=1346435&r1=1346434&r2=1346435&view=diff ============================================================================== --- geronimo/server/branches/3.0-beta/plugins/console/console-jetty/src/main/plan/plan.xml (original) +++ geronimo/server/branches/3.0-beta/plugins/console/console-jetty/src/main/plan/plan.xml Tue Jun 5 15:45:32 2012 @@ -219,6 +219,16 @@ PlutoPortalServices + + + 3-9/Resources/Bundle Repositories + /console-base + [OBRManagerPortlet] + /images/ico_obr_16x16.gif + + PlutoPortalServices + + 4-1/Security/Users and Groups /console-base 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=1346435&r1=1346434&r2=1346435&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 Tue Jun 5 15:45:32 2012 @@ -223,10 +223,10 @@ - 3-9/Resources/OBR Manager + 3-9/Resources/Bundle Repositories /console-base [OBRManagerPortlet] - /images/ico_obar_16x16.gif + /images/ico_obr_16x16.gif PlutoPortalServices