geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwo...@apache.org
Subject 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/
Date Tue, 22 Mar 2011 06:51:37 GMT
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>&nbsp;${bundleInfo.symbolicName}&nbsp;</td>
-                
-        <!-- WAB context path -->
-        <c:if test="${listTypeValue == 'wab'}" >  
-                <td>
-                    <c:if test="${bundleInfo.state.running}">
-                        <c:forEach var="contextPath" items="${bundleInfo.contextPaths}">
-                            &nbsp;<a href="${contextPath}">${contextPath}</a>&nbsp;<br/>
-                        </c:forEach>
-                    </c:if>
-                </td>
-        </c:if>
-        
+
         <!-- version -->
         <td>&nbsp;${bundleInfo.bundleVersion}&nbsp;</td>
 
-        <!--  bundle type -->
+        <!-- bundle type -->
         <td>
             <c:forEach var="type" items="${bundleInfo.types}">
                 ${type}&nbsp;
@@ -208,10 +200,23 @@ function uninstallPrompt(target, bundleI
         <!-- state -->
         <td>&nbsp;${bundleInfo.state}&nbsp;</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}">
+                        &nbsp;<a href="${contextPath}">${contextPath}</a>&nbsp;<br/>
+                    </c:forEach>
+                </c:if>
+            </td>
+        </c:if>
+        
+        <!-- Blueprint State -->
         <c:if test="${listTypeValue == 'blueprint'}" >
-            <td class="${backgroundClass}">
-                &nbsp;
+            <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>&nbsp;
+                        <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>&nbsp;
                     </span>
                 
                     <!-- Uninstall action -->



Mime
View raw message