felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r984322 - in /felix/trunk/webconsole/src/main: java/org/apache/felix/webconsole/ java/org/apache/felix/webconsole/internal/compendium/ java/org/apache/felix/webconsole/internal/misc/ java/org/apache/felix/webconsole/internal/obr/ native2asc...
Date Wed, 11 Aug 2010 08:09:08 GMT
Author: fmeschbe
Date: Wed Aug 11 08:09:07 2010
New Revision: 984322

URL: http://svn.apache.org/viewvc?rev=984322&view=rev
Log:
FELIX-2287 Improved Handling of queries on the OBR page:
  - accept empty query to select all resources
  - print error message if filter string is invalid
  - fix WebConsoleUtil.urlDecode to return an empty string if
      the value is an empty string (to be inline with the
      URLDecode.decode methods).
  - add resource symbolic name in parens after presentation
      name to differentiate resources with the same presentation
      name but different symbolic names

Modified:
    felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/WebConsoleUtil.java
    felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigManager.java
    felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ShellServlet.java
    felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/BundleRepositoryRender.java
    felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/FelixBundleRepositoryRenderHelper.java
    felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/OsgiBundleRepositoryRenderHelper.java
    felix/trunk/webconsole/src/main/native2ascii/OSGI-INF/l10n/bundle_de.properties
    felix/trunk/webconsole/src/main/resources/OSGI-INF/l10n/bundle.properties
    felix/trunk/webconsole/src/main/resources/res/ui/obr.js
    felix/trunk/webconsole/src/main/resources/templates/obr.html

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/WebConsoleUtil.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/WebConsoleUtil.java?rev=984322&r1=984321&r2=984322&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/WebConsoleUtil.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/WebConsoleUtil.java Wed
Aug 11 08:09:07 2010
@@ -354,7 +354,7 @@ public final class WebConsoleUtil
         // shortcut for empty or missing values
         if ( value == null || value.length() == 0 )
         {
-            return null;
+            return value;
         }
 
         try
@@ -375,7 +375,7 @@ public final class WebConsoleUtil
      * is array and will property display it.
      *
      * If the value is byte[] the elements are shown as Hex
-     * 
+     *
      * @param value the value to convert
      * @return the string representation of the value
      */

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigManager.java?rev=984322&r1=984321&r2=984322&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigManager.java
(original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigManager.java
Wed Aug 11 08:09:07 2010
@@ -106,7 +106,7 @@ public class ConfigManager extends Confi
         final ConfigurationAdmin ca = this.getConfigurationAdmin();
 
         // ignore this request if the pid and/or configuration admin is missing
-        if ( pid == null || ca == null )
+        if ( pid == null || pid.length() == 0 || ca == null )
         {
             // should log this here !!
             return;

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ShellServlet.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ShellServlet.java?rev=984322&r1=984321&r2=984322&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ShellServlet.java
(original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ShellServlet.java
Wed Aug 11 08:09:07 2010
@@ -82,7 +82,7 @@ public class ShellServlet extends Simple
             pw.print( command == null ? "" : WebConsoleUtil.escapeHtml( command ) );
             pw.println( "</span><br />" );
 
-            if ( command != null && !"".equals( command ) )
+            if ( command != null && command.length() > 0 )
             {
                 ShellService shellService = getShellService();
                 if ( shellService != null )

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/BundleRepositoryRender.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/BundleRepositoryRender.java?rev=984322&r1=984321&r2=984322&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/BundleRepositoryRender.java
(original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/BundleRepositoryRender.java
Wed Aug 11 08:09:07 2010
@@ -221,7 +221,7 @@ public class BundleRepositoryRender exte
                     }
                 }
                 sb.append( ")" );
-                filter = sb.toString();
+                filter = (sb.length() > 3) ? sb.toString() : null;
             }
         }
 

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/FelixBundleRepositoryRenderHelper.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/FelixBundleRepositoryRenderHelper.java?rev=984322&r1=984321&r2=984322&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/FelixBundleRepositoryRenderHelper.java
(original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/FelixBundleRepositoryRenderHelper.java
Wed Aug 11 08:09:07 2010
@@ -56,9 +56,9 @@ public class FelixBundleRepositoryRender
         RepositoryAdmin admin = ( RepositoryAdmin ) getRepositoryAdmin();
         if ( admin != null )
         {
+            JSONObject json = new JSONObject();
             try
             {
-                JSONObject json = new JSONObject();
                 json.put( "status", admin != null );
                 json.put( "details", details );
 
@@ -76,16 +76,29 @@ public class FelixBundleRepositoryRender
                     json.append( "resources", toJSON( resources[i], bundles, details ) );
                 }
 
-                return json.toString();
-            }
-            catch ( InvalidSyntaxException e )
-            {
-                logger.log( "Failed to parse filter.", e );
             }
             catch ( JSONException e )
             {
                 logger.log( "Failed to serialize repository to JSON object.", e );
             }
+            catch ( Exception e )
+            {
+                logger.log( "Failed to parse filter '" + filter + "'", e );
+                try
+                {
+                    String reason = "filter=" + filter;
+                    if ( e.getMessage() != null )
+                    {
+                        reason = e.getMessage() + "(" + reason + ")";
+                    }
+                    json.put( "error", reason );
+                }
+                catch ( JSONException je )
+                {
+                    // ignore
+                }
+            }
+            return json.toString();
         }
 
         // fall back to no data

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/OsgiBundleRepositoryRenderHelper.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/OsgiBundleRepositoryRenderHelper.java?rev=984322&r1=984321&r2=984322&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/OsgiBundleRepositoryRenderHelper.java
(original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/obr/OsgiBundleRepositoryRenderHelper.java
Wed Aug 11 08:09:07 2010
@@ -53,9 +53,9 @@ public class OsgiBundleRepositoryRenderH
         RepositoryAdmin admin = ( RepositoryAdmin ) getRepositoryAdmin();
         if ( admin != null )
         {
+            JSONObject json = new JSONObject();
             try
             {
-                JSONObject json = new JSONObject();
                 json.put( "status", admin != null );
                 json.put( "details", details );
 
@@ -72,13 +72,30 @@ public class OsgiBundleRepositoryRenderH
                 {
                     json.append( "resources", toJSON( resources[i], bundles, details ) );
                 }
-
-                return json.toString();
             }
             catch ( JSONException e )
             {
                 logger.log( "Failed to serialize repository to JSON object.", e );
             }
+            catch ( Exception e )
+            {
+                logger.log( "Failed to parse filter '" + filter + "'", e );
+                try
+                {
+                    String reason = "filter=" + filter;
+                    if ( e.getMessage() != null )
+                    {
+                        reason = e.getMessage() + "(" + reason + ")";
+                    }
+                    json.put( "error", reason );
+                }
+                catch ( JSONException je )
+                {
+                    // ignore
+                }
+            }
+
+            return json.toString();
         }
 
         // fall back to no data

Modified: felix/trunk/webconsole/src/main/native2ascii/OSGI-INF/l10n/bundle_de.properties
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/native2ascii/OSGI-INF/l10n/bundle_de.properties?rev=984322&r1=984321&r2=984322&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/native2ascii/OSGI-INF/l10n/bundle_de.properties [UTF-8]
(original)
+++ felix/trunk/webconsole/src/main/native2ascii/OSGI-INF/l10n/bundle_de.properties [UTF-8]
Wed Aug 11 08:09:07 2010
@@ -222,6 +222,9 @@ obr.version.select=Wähle Version...
 obr.repo.title=Bundle Repositories
 obr.action.add=Hinzufügen
 obr.action.search=Suchen
+obr.action.search.description=Geben Sie einen Teil des Präsentations- oder \
+ symoblischen Namens der gesuchten Bundles oder einen gültigen OSGi \
+ Filter Ausdruck
 obr.action.deploy=Ausgewählte Installieren
 obr.action.deploystart=Ausgewählte Installieren und Starten
 obr.repo.name=Name
@@ -231,6 +234,7 @@ obr.repo.actions=Aktionen
 obr.res.title=Verfügbare Resourcen
 obr.res.name=Resource Name
 obr.res.installedVer=Installierte Version
+obr.error=Fehler bei der Auswahl der Resourcen
 
 # Configuration Status plugin
 configStatus.pluginTitle=Configuration Status

Modified: felix/trunk/webconsole/src/main/resources/OSGI-INF/l10n/bundle.properties
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/resources/OSGI-INF/l10n/bundle.properties?rev=984322&r1=984321&r2=984322&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/resources/OSGI-INF/l10n/bundle.properties (original)
+++ felix/trunk/webconsole/src/main/resources/OSGI-INF/l10n/bundle.properties Wed Aug 11 08:09:07
2010
@@ -225,6 +225,8 @@ obr.version.select=Select Version...
 obr.repo.title=Bundle Repositories
 obr.action.add=Add
 obr.action.search=Search
+obr.action.search.description=Enter word contained in bundle presentation \
+ and/or symbolic name or a valid OSGi Filter Expression
 obr.action.deploy=Deploy Selected
 obr.action.deploystart=Deploy and Start Selected
 obr.repo.name=Name
@@ -234,6 +236,7 @@ obr.repo.actions=Actions
 obr.res.title=Available Resources
 obr.res.name=Resource Name
 obr.res.installedVer=Installed Version
+obr.error=Error Filtering Resources
 
 # Configuration Status plugin
 configStatus.pluginTitle=Configuration Status

Modified: felix/trunk/webconsole/src/main/resources/res/ui/obr.js
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/resources/res/ui/obr.js?rev=984322&r1=984321&r2=984322&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/resources/res/ui/obr.js (original)
+++ felix/trunk/webconsole/src/main/resources/res/ui/obr.js Wed Aug 11 08:09:07 2010
@@ -137,7 +137,14 @@ function renderResource(res) {
         blockElement.appendChild(titleElement);
         titleElement.appendChild(inputElement);
         titleElement.appendChild(text(" "));
-        titleElement.appendChild(text(res.presentationname ? res.presentationname : res.symbolicname));
+        if (res.presentationname) {
+	    titleElement.appendChild(text(res.presentationname));
+	    titleElement.appendChild(text(" ("));
+	    titleElement.appendChild(text(res.symbolicname));
+	    titleElement.appendChild(text(")"));
+	} else {
+	    titleElement.appendChild(text(res.symbolicname));
+	}
         $(titleElement).click(function() {showVersions(res.symbolicname)});
 
         _tr = tr( null, { 'id' : 'row' + _id } , [
@@ -426,11 +433,17 @@ function renderData() {
             $('#detailsTable').removeClass('ui-helper-hidden');
             for (var i in obrData.resources ) {
                 renderDetailedResource( obrData.resources[i] );
-                    }
-        } else {
+            }
+        } else if (obrData.resources) {
             for (var i in obrData.resources ) {
                 renderResource( obrData.resources[i] );
-                    }
+            }
+        } else if (obrData.error) {
+            _tr = tr( "ui-state-error", null , [
+                      td( "ui-state-error-text", { 'colspan': '2' }, 
+                	  [ text(i18n.error + ": " + obrData.error) ] )
+                  ]);
+            resTable.append( _tr );
         }
     } else {
         $('.statline').html(i18n.status_no);

Modified: felix/trunk/webconsole/src/main/resources/templates/obr.html
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/resources/templates/obr.html?rev=984322&r1=984321&r2=984322&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/resources/templates/obr.html [UTF-8] (original)
+++ felix/trunk/webconsole/src/main/resources/templates/obr.html [UTF-8] Wed Aug 11 08:09:07
2010
@@ -3,7 +3,8 @@
 var i18n = {
 	status_ok : '${obr.status.ok}',
 	status_no : '${obr.status.no}',
-	selectVersion : '${obr.version.select}'
+	selectVersion : '${obr.version.select}',
+	error : '${obr.error}'
 }
 var obrData = ${__data__};
 </script>
@@ -75,7 +76,7 @@ var obrData = ${__data__};
         <a href="${pluginRoot}?list=z">Z</a>
         <a href="${pluginRoot}?list=-">?</a>
     </span>
-    <input type="text" id="searchField"/>
+    <input type="text" id="searchField" title="${obr.action.search.description}"/>
     <button id="searchBtn">${obr.action.search}</button>
 </div>
 



Mime
View raw message