geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwo...@apache.org
Subject svn commit: r1076136 - in /geronimo/server/trunk/plugins/console/osgi-portlets/src/main: java/org/apache/geronimo/console/portlet/BundlesPortlet.java webapp/WEB-INF/view/BundlesView.jsp
Date Wed, 02 Mar 2011 08:26:56 GMT
Author: rwonly
Date: Wed Mar  2 08:26:56 2011
New Revision: 1076136

URL: http://svn.apache.org/viewvc?rev=1076136&view=rev
Log:
GERONIMO-5843 User should not operate any Java ee artifacts on the OSGi portlets in admin
console.

Modified:
    geronimo/server/trunk/plugins/console/osgi-portlets/src/main/java/org/apache/geronimo/console/portlet/BundlesPortlet.java
    geronimo/server/trunk/plugins/console/osgi-portlets/src/main/webapp/WEB-INF/view/BundlesView.jsp

Modified: geronimo/server/trunk/plugins/console/osgi-portlets/src/main/java/org/apache/geronimo/console/portlet/BundlesPortlet.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/osgi-portlets/src/main/java/org/apache/geronimo/console/portlet/BundlesPortlet.java?rev=1076136&r1=1076135&r2=1076136&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/osgi-portlets/src/main/java/org/apache/geronimo/console/portlet/BundlesPortlet.java
(original)
+++ geronimo/server/trunk/plugins/console/osgi-portlets/src/main/java/org/apache/geronimo/console/portlet/BundlesPortlet.java
Wed Mar  2 08:26:56 2011
@@ -51,6 +51,10 @@ import org.apache.geronimo.console.json.
 import org.apache.geronimo.console.json.PackageBundlePairGridJSONObject;
 import org.apache.geronimo.console.json.PackageBundlePairJSONObject;
 import org.apache.geronimo.console.json.WiredBundlesJSONObject;
+import org.apache.geronimo.console.util.PortletManager;
+import org.apache.geronimo.kernel.config.ConfigurationInfo;
+import org.apache.geronimo.kernel.config.ConfigurationManager;
+import org.apache.geronimo.kernel.config.ConfigurationModuleType;
 import org.apache.xbean.osgi.bundle.util.BundleDescription;
 import org.apache.xbean.osgi.bundle.util.BundleUtils;
 import org.apache.xbean.osgi.bundle.util.BundleDescription.ExportPackage;
@@ -64,9 +68,13 @@ import org.osgi.framework.ServiceReferen
 import org.osgi.service.packageadmin.ExportedPackage;
 import org.osgi.service.packageadmin.PackageAdmin;
 import org.osgi.service.startlevel.StartLevel;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class BundlesPortlet extends GenericPortlet {
 
+    private static final Logger logger = LoggerFactory.getLogger(BundlesPortlet.class);
+    
     private static final String NORMALVIEW_JSP = "/WEB-INF/view/BundlesView.jsp";
     private static final String MAXIMIZEDVIEW_JSP = "/WEB-INF/view/BundlesView.jsp";
     private static final String HELPVIEW_JSP = "/WEB-INF/view/BundlesView.jsp";
@@ -127,14 +135,15 @@ public class BundlesPortlet extends Gene
         // list contains bundles converted from Bundle objects
         ArrayList<OSGiBundle> OSGiBundleList = new ArrayList<OSGiBundle>();
 
+        Set<Long> configedBundleIds = getConfigedBundleIds();
         
         // convert Bundle to OSGiBundle
         for (Bundle bundle : bundles) {
-            if (!checkSysBundle(bundle, startLevelService)){
+            if (!checkSysBundle(bundle, startLevelService, configedBundleIds)){
                 OSGiBundle osgiBundle = new OSGiBundle(bundle);
                 OSGiBundleList.add(osgiBundle);
             }
-        }
+        }        
         
         try {
             JSONObject grid = new BundleGridJSONObject(OSGiBundleList);
@@ -147,13 +156,36 @@ public class BundlesPortlet extends Gene
 
     }
     
-    private boolean checkSysBundle(Bundle bundle, StartLevel startLevelService){
+    private Set<Long> getConfigedBundleIds(){
+        Set<Long> configedBundleIds = new HashSet<Long> ();
+        
+        ConfigurationManager configManager = PortletManager.getConfigurationManager();
+        List<ConfigurationInfo> infos = configManager.listConfigurations();
+        
+        for (ConfigurationInfo info : infos) {
+            Bundle configedBundle = configManager.getBundle(info.getConfigID());
+            if (configedBundle!=null){
+                configedBundleIds.add(configedBundle.getBundleId());
+            }else{
+                logger.info("Can not find the bundle for configuration: " +info.getConfigID()+
" in configuration manager");
+            }
+        }
+        
+        return configedBundleIds;
+    }
+    
+    private boolean checkSysBundle(Bundle bundle, StartLevel startLevelService, Set<Long>
configedBundleIds){
         
         // check start level
         if (startLevelService!=null && startLevelService.getBundleStartLevel(bundle)
<= 50){ //config.properties set karaf.systemBundlesStartLevel=50
             return true;
         }
         
+        // check configuration bundle
+        if (configedBundleIds.contains(bundle.getBundleId())){
+            return true;
+        }
+        
         // check symbolic name
         String symbolicName = bundle.getSymbolicName();
         if (symbolicName!=null){
@@ -181,10 +213,13 @@ public class BundlesPortlet extends Gene
                 || symbolicName.indexOf("org.apache.openjpa") != -1
                 || symbolicName.indexOf("org.apache.bval") != -1
                 || symbolicName.indexOf("org.apache.myfaces") != -1
+                || symbolicName.indexOf("org.apache.wink") != -1
+                || symbolicName.indexOf("org.apache.ws") != -1
                 || symbolicName.indexOf("openwebbeans") != -1
                 || symbolicName.indexOf("org.apache.aries") != -1
                 || symbolicName.indexOf("org.tranql") != -1
                 || symbolicName.indexOf("org.apache.commons") != -1
+
                 ){
                 return true;
             }
@@ -385,10 +420,11 @@ public class BundlesPortlet extends Gene
             // list contains bundles converted from Bundle objects
             ArrayList<OSGiBundle> OSGiBundleList = new ArrayList<OSGiBundle>();
 
+            Set<Long> configedBundleIds = getConfigedBundleIds();
             
             // convert Bundle to OSGiBundle
             for (Bundle bundle : bundles) {
-                if (checkSysBundle(bundle, startLevelService)){
+                if (checkSysBundle(bundle, startLevelService, configedBundleIds)){
                     OSGiBundle osgiBundle = new OSGiBundle(bundle);
                     OSGiBundleList.add(osgiBundle);
                 }

Modified: geronimo/server/trunk/plugins/console/osgi-portlets/src/main/webapp/WEB-INF/view/BundlesView.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/osgi-portlets/src/main/webapp/WEB-INF/view/BundlesView.jsp?rev=1076136&r1=1076135&r2=1076136&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/osgi-portlets/src/main/webapp/WEB-INF/view/BundlesView.jsp
(original)
+++ geronimo/server/trunk/plugins/console/osgi-portlets/src/main/webapp/WEB-INF/view/BundlesView.jsp
Wed Mar  2 08:26:56 2011
@@ -242,12 +242,13 @@ function hideLoadingDIV(){
 	}
 
 	function showSysBundles(){
-		showLoadingDIV();
-
+		
 		if (dijit.byId("sysBundlesPane")!=null){
 			var sysBndCP = dijit.byId("sysBundlesPane");
 			dijit.byId("bundlesTab").selectChild(sysBndCP);
 		} else {
+			showLoadingDIV();
+			
 			// add new ContentPane to TabContainer
 		    var bndTC = dijit.byId("bundlesTab");
 			var sysBndCP = new dijit.layout.ContentPane({
@@ -376,12 +377,12 @@ This portlet shows the general user bund
 	        <td>
 	        	<form id="installForm" enctype="multipart/form-data" method="POST">
 	            Install New:
-	            <input type="file" style="width:200px" name="bundleFile" />
-				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+	            <input type="file" name="bundleFile" />
+				&nbsp;
 		        
 		        <fmt:message key="osgi.bundle.install.startAfterInstalled" />:
-		        <input type="checkbox" dojoType="dijit.form.CheckBox" name="startAfterInstalled"
value="yes" align="middle" />
-		        
+		        <input type="checkbox" dojoType="dijit.form.CheckBox" name="startAfterInstalled"
value="yes" />
+		        &nbsp;
 		        
 		        <!-- Don't allow user set start level for now
 		        <fmt:message key="osgi.bundle.startLevel" />:
@@ -409,6 +410,7 @@ This portlet shows the general user bund
         			dijit.byId("usrBundlesGrid").filter({
             			symbolicName: "*" + fitlerStr + "*"     
         			});
+					dojo.stopEvent(evt);
 				</script>
 				</div>
 			</td>



Mime
View raw message