You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by rw...@apache.org on 2011/03/22 07:51:37 UTC
svn commit: r1084081 - in
/geronimo/server/trunk/plugins/console/console-base-portlets/src/main:
i18n-resources/ java/org/apache/geronimo/console/bundlemanager/
webapp/WEB-INF/view/bundlemanager/
Author: rwonly
Date: Tue Mar 22 06:51:36 2011
New Revision: 1084081
URL: http://svn.apache.org/viewvc?rev=1084081&view=rev
Log:
GERONIMO-5847 (GERONIMO-5871) add blueprint type support
Added:
geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/bundlemanager/BlueprintState.java (with props)
Modified:
geronimo/server/trunk/plugins/console/console-base-portlets/src/main/i18n-resources/consolebase_en.properties
geronimo/server/trunk/plugins/console/console-base-portlets/src/main/i18n-resources/consolebase_ja.properties
geronimo/server/trunk/plugins/console/console-base-portlets/src/main/i18n-resources/consolebase_zh.properties
geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/bundlemanager/BundleManagerPortlet.java
geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/bundlemanager/BundleUtil.java
geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/bundlemanager/ExtendedBundleInfo.java
geronimo/server/trunk/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/bundlemanager/BundleManager.jsp
Modified: geronimo/server/trunk/plugins/console/console-base-portlets/src/main/i18n-resources/consolebase_en.properties
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/console-base-portlets/src/main/i18n-resources/consolebase_en.properties?rev=1084081&r1=1084080&r2=1084081&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/console-base-portlets/src/main/i18n-resources/consolebase_en.properties (original)
+++ geronimo/server/trunk/plugins/console/console-base-portlets/src/main/i18n-resources/consolebase_en.properties Tue Mar 22 06:51:36 2011
@@ -167,6 +167,7 @@ configmanager.normal.confirmMsg07
configmanager.normal.confirmMsg08 = \ provides the administration console user interface that you are currently viewing. Uninstalling it will cause the interface to become unavailable and manual action will be required to restore the function. Are you certain you wish to proceed with this uninstall?
configmanager.normal.confirmMsg09 = \ is provided by Apache Geronimo and might be required by other modules (see the "Child Components" listed in the view). Are you certain you wish to proceed with this uninstall?
configmanager.normal.confirmMsg10 = Are you certain you wish to uninstall
+configmanager.normal.confirmMsg11 = Are you certain you wish to refresh
configmanager.normal.displayName = Display Name
configmanager.normal.expertMode = Expert User (enable all actions on Geronimo Provided Components)
configmanager.normal.ok = OK
Modified: geronimo/server/trunk/plugins/console/console-base-portlets/src/main/i18n-resources/consolebase_ja.properties
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/console-base-portlets/src/main/i18n-resources/consolebase_ja.properties?rev=1084081&r1=1084080&r2=1084081&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/console-base-portlets/src/main/i18n-resources/consolebase_ja.properties (original)
+++ geronimo/server/trunk/plugins/console/console-base-portlets/src/main/i18n-resources/consolebase_ja.properties Tue Mar 22 06:51:36 2011
@@ -176,6 +176,7 @@ configmanager.normal.confirmMsg07
configmanager.normal.confirmMsg08 = \ ã¯ç¾å¨è¡¨ç¤ºãã¦ãã管çã³ã³ã½ã¼ã«ã®ã¤ã³ã¿ãã§ã¼ã¹ãæä¾ãã¦ãã¾ããã¢ã³ã¤ã³ã¹ãã¼ã«ããã¨ã¤ã³ã¿ãã§ã¼ã¹ã¯ä½¿ç¨ã§ããªããªããæ©è½ã®å¾©æ§ã«æåã®æä½ãè¦æ±ããã¾ãããã®ã¢ã³ã¤ã³ã¹ãã¼ã«æä½ãç¶è¡ãã¾ãã?
configmanager.normal.confirmMsg09 = ã㯠Apache Geronimo ã«ãã£ã¦æä¾ãããä»ã®ã¢ã¸ã¥ã¼ã« (ç»é¢ä¸ã«ä¸è¦§è¡¨ç¤ºããã¦ãã "åã³ã³ãã¼ãã³ã" ãåç
§) ãå¿
è¦ã§ãããã®ã¢ã³ã¤ã³ã¹ãã¼ã«æä½ãç¶è¡ãã¾ãã?
configmanager.normal.confirmMsg10 = ã¢ã³ã¤ã³ã¹ãã¼ã«ãã¦ãããããã§ãã
+configmanager.normal.confirmMsg11 = Are you certain you wish to refresh
configmanager.normal.displayName = 表示å
configmanager.normal.expertMode = ä¸ç´è
åã (Geronimo ã³ã³ãã¼ãã³ãã¸ã®ãã¹ã¦ã®æä½ã許å¯ãã)
configmanager.normal.ok = OK
Modified: geronimo/server/trunk/plugins/console/console-base-portlets/src/main/i18n-resources/consolebase_zh.properties
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/console-base-portlets/src/main/i18n-resources/consolebase_zh.properties?rev=1084081&r1=1084080&r2=1084081&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/console-base-portlets/src/main/i18n-resources/consolebase_zh.properties (original)
+++ geronimo/server/trunk/plugins/console/console-base-portlets/src/main/i18n-resources/consolebase_zh.properties Tue Mar 22 06:51:36 2011
@@ -167,6 +167,7 @@ configmanager.normal.confirmMsg07
configmanager.normal.confirmMsg08 = æä¾äºä½ å½åæ¥ççç®¡çæ§å¶å°ççé¢ã忢å®å°å¯¼è´è¯¥çé¢ä¸å¯ç¨ä¸éè¦æå·¥æ¢å¤è¯¥åè½ãä½ ç¡®å®è¦ç»§ç»å¸è½½ä¹ï¼
configmanager.normal.confirmMsg09 = ç±Apache Geronimoæä¾å¹¶ä¸å¯è½åå¨å
¶å®éè¦å®ç模åã(åèè§å¾ç"åç»ä»¶"å表)ãä½ ç¡®å®è¦ç»§ç»å¸è½½ä¹ï¼
configmanager.normal.confirmMsg10 = ä½ ç¡®å®è¦å¸è½½
+configmanager.normal.confirmMsg11 = ä½ ç¡®å®è¦å·æ°
configmanager.normal.displayName = æ¾ç¤ºåç§°
configmanager.normal.expertMode = ä¸å®¶ç¨æ·(å¯ç¨Geronimoæä¾çç»ä»¶çææåè½)
configmanager.normal.ok = ç¡®å®
Added: geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/bundlemanager/BlueprintState.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/bundlemanager/BlueprintState.java?rev=1084081&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/bundlemanager/BlueprintState.java (added)
+++ geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/bundlemanager/BlueprintState.java Tue Mar 22 06:51:36 2011
@@ -0,0 +1,72 @@
+/**
+ * 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 org.osgi.service.blueprint.container.BlueprintEvent;
+
+public enum BlueprintState {
+
+ CREATING(BlueprintEvent.CREATING, "Creating"),
+ CREATED(BlueprintEvent.CREATED, "Created"),
+ WAITING(BlueprintEvent.WAITING, "Waiting"), //service reference is blocking because of unsatisfied mandatory dependencies
+ GRACE_PERIOD(BlueprintEvent.GRACE_PERIOD, "Grace_Period"), //can not get referenced service
+ DESTROYING(BlueprintEvent.DESTROYING, "Destroying"),
+ DESTROYED(BlueprintEvent.DESTROYED, "Destroyed"),
+ FAILURE(BlueprintEvent.FAILURE, "Failure");
+
+ private final int state;
+ private final String name;
+
+ BlueprintState(int state, String name) {
+ this.state = state;
+ this.name = name;
+ }
+
+ public int getState() {
+ return state;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public String toString() {
+ return name;
+ }
+
+ public static BlueprintState getState(int state) {
+ switch (state) {
+ case BlueprintEvent.CREATING:
+ return BlueprintState.CREATING;
+ case BlueprintEvent.CREATED:
+ return BlueprintState.CREATED;
+ case BlueprintEvent.WAITING:
+ return BlueprintState.WAITING;
+ case BlueprintEvent.GRACE_PERIOD:
+ return BlueprintState.GRACE_PERIOD;
+ case BlueprintEvent.DESTROYING:
+ return BlueprintState.DESTROYING;
+ case BlueprintEvent.DESTROYED:
+ return BlueprintState.DESTROYED;
+ case BlueprintEvent.FAILURE:
+ return BlueprintState.FAILURE;
+ }
+ throw new IllegalStateException("Unknown blueprint state: " + state);
+ }
+}
Propchange: geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/bundlemanager/BlueprintState.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/bundlemanager/BundleManagerPortlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/bundlemanager/BundleManagerPortlet.java?rev=1084081&r1=1084080&r2=1084081&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/bundlemanager/BundleManagerPortlet.java (original)
+++ geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/bundlemanager/BundleManagerPortlet.java Tue Mar 22 06:51:36 2011
@@ -19,6 +19,7 @@ package org.apache.geronimo.console.bund
import java.io.File;
import java.io.IOException;
+import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@@ -55,7 +56,9 @@ import org.apache.xbean.osgi.bundle.util
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
+import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.ServiceReference;
+import org.osgi.service.blueprint.container.BlueprintContainer;
import org.osgi.service.packageadmin.ExportedPackage;
import org.osgi.service.packageadmin.PackageAdmin;
import org.osgi.service.startlevel.StartLevel;
@@ -377,11 +380,27 @@ public class BundleManagerPortlet extend
if ("wab".equals(listType)){
if (checkWABBundle(bundle)){
ExtendedBundleInfo info = createExtendedBundleInfo(bundle, startLevelService, configedBundleIds);
+ info.addContextPath(getContextPath(bundle));
bundleInfos.add(info);
}
}else if ("blueprint".equals(listType)){
if (checkBlueprintBundle(bundle)){
ExtendedBundleInfo info = createExtendedBundleInfo(bundle, startLevelService, configedBundleIds);
+
+ // currently, we try get the the blueprintContainer service to determine if a blueprint bundle is created
+ // TODO A better way is using a BlueprintListener to track all blueprint bundle events
+ String filter = "(&(osgi.blueprint.container.symbolicname=" + bundle.getSymbolicName()
+ + ")(osgi.blueprint.container.version=" + bundle.getVersion() + "))";
+ ServiceReference[] serviceReferences = null;
+ try {
+ serviceReferences = bundleContext.getServiceReferences(BlueprintContainer.class.getName(), filter);
+ } catch (InvalidSyntaxException e) {
+ throw new RuntimeException(e);
+ }
+ if (serviceReferences != null && serviceReferences.length > 0){
+ info.setBlueprintState(BlueprintState.CREATED);
+ }
+
bundleInfos.add(info);
}
}else if ("system".equals(listType)){
@@ -419,12 +438,10 @@ public class BundleManagerPortlet extend
}
}
- private ExtendedBundleInfo createExtendedBundleInfo(Bundle bundle, StartLevel startLevelService,Set<Long> configedBundleIds){
+ private ExtendedBundleInfo createExtendedBundleInfo(Bundle bundle, StartLevel startLevelService, Set<Long> configedBundleIds){
ExtendedBundleInfo info = new ExtendedBundleInfo(bundle);
-
- String contextPath = getContextPath(bundle);
- if (contextPath != null && contextPath!="") {
- info.addContextPath(contextPath);
+
+ if (checkWABBundle(bundle)){
info.addType(BundleType.WAB);
}
@@ -472,7 +489,15 @@ public class BundleManagerPortlet extend
}
private static boolean checkBlueprintBundle(Bundle bundle){
- // TODO do nothing currently
+ // OSGi enterprise spec(r4.2) 121.3.4 (Page 206)
+ // check blueprint header
+ Object bpHeader = bundle.getHeaders().get(BundleUtil.BLUEPRINT_HEADER);
+ if (bpHeader!=null && (String)bpHeader!="") return true;
+
+ // check blueprint definitions
+ Enumeration<URL> enu = bundle.findEntries("OSGI-INF/blueprint/", "*.xml", false);
+ if (enu!=null && enu.hasMoreElements()) return true;
+
return false;
}
@@ -683,7 +708,6 @@ public class BundleManagerPortlet extend
}
}
-
//TODO the result set may contains 2 items which have the same package name but different versions.
return importingPairs;
}
Modified: geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/bundlemanager/BundleUtil.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/bundlemanager/BundleUtil.java?rev=1084081&r1=1084080&r2=1084081&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/bundlemanager/BundleUtil.java (original)
+++ geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/bundlemanager/BundleUtil.java Tue Mar 22 06:51:36 2011
@@ -23,6 +23,8 @@ public class BundleUtil {
public static final String WEB_CONTEXT_PATH_HEADER = "Web-ContextPath";
+ public static final String BLUEPRINT_HEADER = "Bundle-Blueprint";
+
public static String getBundleName(Bundle bundle) {
String name = (String) bundle.getHeaders().get(Constants.BUNDLE_NAME);
name = (name == null) ? bundle.getSymbolicName() : name;
Modified: geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/bundlemanager/ExtendedBundleInfo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/bundlemanager/ExtendedBundleInfo.java?rev=1084081&r1=1084080&r2=1084081&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/bundlemanager/ExtendedBundleInfo.java (original)
+++ geronimo/server/trunk/plugins/console/console-base-portlets/src/main/java/org/apache/geronimo/console/bundlemanager/ExtendedBundleInfo.java Tue Mar 22 06:51:36 2011
@@ -25,6 +25,7 @@ public class ExtendedBundleInfo extends
private List<BundleType> types = new ArrayList<BundleType>();
private List<String> contextPaths = new ArrayList<String>();
+ private BlueprintState blueprintState = null;
public ExtendedBundleInfo(Bundle bundle) {
super(bundle);
@@ -37,6 +38,14 @@ public class ExtendedBundleInfo extends
public void addType(BundleType type) {
types.add(type);
}
+
+ public BlueprintState getBlueprintState(){
+ return blueprintState;
+ }
+
+ public void setBlueprintState(BlueprintState state){
+ blueprintState = state;
+ }
public boolean isOperable(){
return !types.contains(BundleType.SYSTEM) && !types.contains(BundleType.CONFIGURATION);
Modified: geronimo/server/trunk/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/bundlemanager/BundleManager.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/bundlemanager/BundleManager.jsp?rev=1084081&r1=1084080&r2=1084081&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/bundlemanager/BundleManager.jsp (original)
+++ geronimo/server/trunk/plugins/console/console-base-portlets/src/main/webapp/WEB-INF/view/bundlemanager/BundleManager.jsp Tue Mar 22 06:51:36 2011
@@ -54,7 +54,10 @@ function uninstallPrompt(target, bundleI
return showConfirmMessage(target, '<fmt:message key="configmanager.normal.confirmMsg10"/> ' + bundleName + '?', '<fmt:message key="configmanager.normal.ok"/>', '<fmt:message key="configmanager.normal.cancel"/>');
}
-
+function refreshPrompt(target, bundleId, bundleName) {
+ // if the component is none of the above provide a standard warning
+ return showConfirmMessage(target, '<fmt:message key="configmanager.normal.confirmMsg11"/> ' + bundleName + '?', '<fmt:message key="configmanager.normal.ok"/>', '<fmt:message key="configmanager.normal.cancel"/>');
+}
</script>
@@ -143,12 +146,12 @@ function uninstallPrompt(target, bundleI
<tr class="DarkBackground">
<th scope="col" width="40">Id</th>
<th scope="col">Symbolic Name</th>
- <c:if test="${listTypeValue == 'wab'}" >
- <th scope="col">URL</th>
- </c:if>
<th scope="col" width="150">Version</th>
<th scope="col" width="150">Type</th>
<th scope="col" width="100">State</th>
+ <c:if test="${listTypeValue == 'wab'}" >
+ <th scope="col" width="100">URL</th>
+ </c:if>
<c:if test="${listTypeValue == 'blueprint'}" >
<th scope="col" width="100">Blueprint State</th>
</c:if>
@@ -183,22 +186,11 @@ function uninstallPrompt(target, bundleI
<!-- bundle name -->
<td> ${bundleInfo.symbolicName} </td>
-
- <!-- WAB context path -->
- <c:if test="${listTypeValue == 'wab'}" >
- <td>
- <c:if test="${bundleInfo.state.running}">
- <c:forEach var="contextPath" items="${bundleInfo.contextPaths}">
- <a href="${contextPath}">${contextPath}</a> <br/>
- </c:forEach>
- </c:if>
- </td>
- </c:if>
-
+
<!-- version -->
<td> ${bundleInfo.bundleVersion} </td>
- <!-- bundle type -->
+ <!-- bundle type -->
<td>
<c:forEach var="type" items="${bundleInfo.types}">
${type}
@@ -208,10 +200,23 @@ function uninstallPrompt(target, bundleI
<!-- state -->
<td> ${bundleInfo.state} </td>
- <!-- Blueprint info -->
+ <!-- WAB context path -->
+ <c:if test="${listTypeValue == 'wab'}" >
+ <td>
+ <c:if test="${bundleInfo.state.running}">
+ <c:forEach var="contextPath" items="${bundleInfo.contextPaths}">
+ <a href="${contextPath}">${contextPath}</a> <br/>
+ </c:forEach>
+ </c:if>
+ </td>
+ </c:if>
+
+ <!-- Blueprint State -->
<c:if test="${listTypeValue == 'blueprint'}" >
- <td class="${backgroundClass}">
-
+ <td>
+ <c:if test="${! empty bundleInfo.blueprintState}">
+ ${bundleInfo.blueprintState}
+ </c:if>
</td>
</c:if>
@@ -239,7 +244,7 @@ function uninstallPrompt(target, bundleI
<!-- Refresh action -->
<span>
- <a href="<portlet:actionURL><portlet:param name='bundleId' value='${bundleInfo.bundleId}'/><portlet:param name='action' value='bundle'/><portlet:param name='operation' value='refresh'/></portlet:actionURL>"><img border="0" src="<%=request.getContextPath()%>/images/bundle_refresh.png" title="refresh"/></a>
+ <a href="<portlet:actionURL><portlet:param name='bundleId' value='${bundleInfo.bundleId}'/><portlet:param name='action' value='bundle'/><portlet:param name='operation' value='refresh'/></portlet:actionURL>" onClick="return refreshPrompt(this, '${bundleInfo.bundleId}','${bundleInfo.symbolicName}');"><img border="0" src="<%=request.getContextPath()%>/images/bundle_refresh.png" title="refresh"/></a>
</span>
<!-- Uninstall action -->