incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r578741 - in /incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/internal: AjaxBundleDetailsAction.java BundleListRender.java BundleRepositoryRender.java ConfigurationRender.java InstallAction.java UpdateAction.java
Date Mon, 24 Sep 2007 10:12:31 GMT
Author: fmeschbe
Date: Mon Sep 24 03:12:26 2007
New Revision: 578741

URL: http://svn.apache.org/viewvc?rev=578741&view=rev
Log:
SLING-21 bundle with no symbolic name causes the sling console to display incomlpete list
of bundles

Modified:
    incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/internal/AjaxBundleDetailsAction.java
    incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/internal/BundleListRender.java
    incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/internal/BundleRepositoryRender.java
    incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/internal/ConfigurationRender.java
    incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/internal/InstallAction.java
    incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/internal/UpdateAction.java

Modified: incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/internal/AjaxBundleDetailsAction.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/internal/AjaxBundleDetailsAction.java?rev=578741&r1=578740&r2=578741&view=diff
==============================================================================
--- incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/internal/AjaxBundleDetailsAction.java
(original)
+++ incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/internal/AjaxBundleDetailsAction.java
Mon Sep 24 03:12:26 2007
@@ -144,10 +144,25 @@
                         val.append(ep.getName());
                         val.append(",version=").append(ep.getVersion());
                         val.append(" from ");
-                        val.append(ep.getExportingBundle().getSymbolicName());
-                        val.append(" (").append(
-                            ep.getExportingBundle().getBundleId());
-                        val.append(")");
+                        
+                        if (ep.getExportingBundle().getSymbolicName() != null) {
+                            // list the bundle name if not null
+                            val.append(ep.getExportingBundle().getSymbolicName());
+                            val.append(" (").append(
+                                ep.getExportingBundle().getBundleId());
+                            val.append(")");
+                        } else if (ep.getExportingBundle().getLocation() != null) {
+                            // otherwise try the location
+                            val.append(ep.getExportingBundle().getLocation());
+                            val.append(" (").append(
+                                ep.getExportingBundle().getBundleId());
+                            val.append(")");
+                        } else {
+                            // fallback to just the bundle id
+                            // only append the bundle
+                            val.append(ep.getExportingBundle().getBundleId());
+                        }
+
                         val.append("<br />");
 
                         break;

Modified: incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/internal/BundleListRender.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/internal/BundleListRender.java?rev=578741&r1=578740&r2=578741&view=diff
==============================================================================
--- incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/internal/BundleListRender.java
(original)
+++ incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/internal/BundleListRender.java
Mon Sep 24 03:12:26 2007
@@ -187,6 +187,12 @@
         String name = (String) bundle.getHeaders().get(Constants.BUNDLE_NAME);
         if (name == null || name.length() == 0) {
             name = bundle.getSymbolicName();
+            if (name == null) {
+                name = bundle.getLocation();
+                if (name == null) {
+                    name = String.valueOf(bundle.getBundleId());
+                }
+            }
         }
 
         pw.println("<tr>");
@@ -259,6 +265,11 @@
 
     private boolean hasUpdates(Bundle bundle) {
 
+        // don't care for bundles with no symbolic name
+        if (bundle.getSymbolicName() == null) {
+            return false;
+        }
+        
         Version bundleVersion = Version.parseVersion((String) bundle.getHeaders().get(Constants.BUNDLE_VERSION));
 
         for (Iterator ri=this.repoAdmin.getResources(); ri.hasNext(); ) {

Modified: incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/internal/BundleRepositoryRender.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/internal/BundleRepositoryRender.java?rev=578741&r1=578740&r2=578741&view=diff
==============================================================================
--- incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/internal/BundleRepositoryRender.java
(original)
+++ incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/internal/BundleRepositoryRender.java
Mon Sep 24 03:12:26 2007
@@ -269,7 +269,10 @@
             Version bundleVersion = Version.parseVersion(ver);
 
             // assume one bundle instance per symbolic name !!
-            bundles.put(installed[i].getSymbolicName(), bundleVersion);
+            // only add if there is a symbolic name !
+            if (installed[i].getSymbolicName() != null) {
+                bundles.put(installed[i].getSymbolicName(), bundleVersion);
+            }
         }
 
         return bundles;

Modified: incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/internal/ConfigurationRender.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/internal/ConfigurationRender.java?rev=578741&r1=578740&r2=578741&view=diff
==============================================================================
--- incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/internal/ConfigurationRender.java
(original)
+++ incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/internal/ConfigurationRender.java
Mon Sep 24 03:12:26 2007
@@ -393,7 +393,13 @@
     private String getBundleString(Bundle bundle, boolean withState) {
         StringBuffer buf = new StringBuffer();
 
-        buf.append(bundle.getSymbolicName());
+        if (bundle.getSymbolicName() != null) {
+            buf.append(bundle.getSymbolicName());
+        } else if (bundle.getLocation() != null) {
+            buf.append(bundle.getLocation());
+        } else {
+            buf.append(bundle.getBundleId());
+        }
 
         Dictionary headers = bundle.getHeaders();
         if (headers.get(Constants.BUNDLE_VERSION) != null) {

Modified: incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/internal/InstallAction.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/internal/InstallAction.java?rev=578741&r1=578740&r2=578741&view=diff
==============================================================================
--- incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/internal/InstallAction.java
(original)
+++ incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/internal/InstallAction.java
Mon Sep 24 03:12:26 2007
@@ -152,8 +152,10 @@
             Bundle newBundle = null;
             Bundle[] bundles = this.getBundleContext().getBundles();
             for (int i = 0; i < bundles.length; i++) {
-                if (bundles[i].getLocation().equals(location)
-                    || bundles[i].getSymbolicName().equals(symbolicName)) {
+                if ((bundles[i].getLocation() != null && bundles[i].getLocation().equals(
+                    location))
+                    || (bundles[i].getSymbolicName() != null && bundles[i].getSymbolicName().equals(
+                        symbolicName))) {
                     newBundle = bundles[i];
                     break;
                 }

Modified: incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/internal/UpdateAction.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/internal/UpdateAction.java?rev=578741&r1=578740&r2=578741&view=diff
==============================================================================
--- incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/internal/UpdateAction.java
(original)
+++ incubator/sling/trunk/webmanager/src/main/java/org/apache/sling/console/web/internal/UpdateAction.java
Mon Sep 24 03:12:26 2007
@@ -80,6 +80,11 @@
         final String version = (String) bundle.getHeaders().get(
             Constants.BUNDLE_VERSION);
 
+        // the name is required, otherwise we can do nothing
+        if (name == null) {
+            return;
+        }
+        
         // TODO: Should be restrict to same major.micro ??
 
         Thread t = new Thread("Background Update") {



Mime
View raw message