You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by vv...@apache.org on 2010/03/22 10:30:38 UTC

svn commit: r926009 - in /felix/trunk/webconsole/src/main: java/org/apache/felix/webconsole/internal/compendium/ native2ascii/OSGI-INF/l10n/ resources/OSGI-INF/l10n/ resources/res/ui/ resources/templates/

Author: vvalchev
Date: Mon Mar 22 09:30:38 2010
New Revision: 926009

URL: http://svn.apache.org/viewvc?rev=926009&view=rev
Log:
Resolved FELIX-1996 /Console should warn when config is bound to a different bundle/
https://issues.apache.org/jira/browse/FELIX-1996

Modified:
    felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigManager.java
    felix/trunk/webconsole/src/main/native2ascii/OSGI-INF/l10n/bundle_bg.properties
    felix/trunk/webconsole/src/main/resources/OSGI-INF/l10n/bundle.properties
    felix/trunk/webconsole/src/main/resources/res/ui/config.js
    felix/trunk/webconsole/src/main/resources/templates/config.html

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=926009&r1=926008&r2=926009&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 Mon Mar 22 09:30:38 2010
@@ -790,6 +790,28 @@ public class ConfigManager extends Confi
         }
         json.key( "bundleLocation" );
         json.value( location );
+        // raw bundle location and service locations
+        final String pid = config.getPid();
+        String serviceLocation = "";
+        try
+        {
+            final ServiceReference[] refs = getBundleContext().getServiceReferences(
+                null,
+                "(&(" + Constants.OBJECTCLASS + '=' + ManagedService.class.getName()
+                    + ")(" + Constants.SERVICE_PID + '=' + pid + "))");
+            if ( refs != null && refs.length > 0 )
+            {
+                serviceLocation = refs[0].getBundle().getLocation();
+            }
+        }
+        catch (Throwable t)
+        {
+            log( "Error getting service associated with configuration " + pid, t );
+        }
+        json.key( "bundle_location" );
+        json.value ( config.getBundleLocation() );
+        json.key( "service_location" );
+        json.value ( serviceLocation );
     }
 
 

Modified: felix/trunk/webconsole/src/main/native2ascii/OSGI-INF/l10n/bundle_bg.properties
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/native2ascii/OSGI-INF/l10n/bundle_bg.properties?rev=926009&r1=926008&r2=926009&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/native2ascii/OSGI-INF/l10n/bundle_bg.properties [UTF-8] (original)
+++ felix/trunk/webconsole/src/main/native2ascii/OSGI-INF/l10n/bundle_bg.properties [UTF-8] Mon Mar 22 09:30:38 2010
@@ -201,6 +201,7 @@ config.edit.tip=Редактиране � config.title.actions=Действия
 config.title.bundle=Бъндъл
 config.title.name=Име
+config.bind.error=Грешка: PID "{0}" е асоцииран с "{1}" но улугата е регистриране от бъндъл "{2}"
 
 # License plugin
 license.pluginTitle=Лицензи

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=926009&r1=926008&r2=926009&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 Mon Mar 22 09:30:38 2010
@@ -201,6 +201,7 @@ config.edit.tip=Edit the configuration v
 config.title.actions=Actions
 config.title.bundle=Bundle
 config.title.name=Name
+config.bind.error=Error: the PID "{0}" is bound to "{1}" but the actual managed service is registered from "{2}" bundle
 
 # License plugin
 license.pluginTitle=Licenses

Modified: felix/trunk/webconsole/src/main/resources/res/ui/config.js
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/resources/res/ui/config.js?rev=926009&r1=926008&r2=926009&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/resources/res/ui/config.js (original)
+++ felix/trunk/webconsole/src/main/resources/res/ui/config.js Mon Mar 22 09:30:38 2010
@@ -29,6 +29,7 @@ var factoryRow = false;
 
 // editor dialog
 var editor = false;
+var editorMessage = false;
 
 function configure(pid, create) {
 	var uri = pluginRoot + '/' + pid;
@@ -116,6 +117,9 @@ function displayConfigForm(obj) {
     }
 
     printConfigurationInfo(parent, obj);
+	if ( obj.service_location && obj.bundle_location && obj.service_location != obj.bundle_location) {
+		editorMessage.removeClass('ui-helper-hidden').text(i18n.err_bind.msgFormat(obj.pid, obj.bundle_location, obj.service_location));
+	} else editorMessage.addClass('ui-helper-hidden');
 	initStaticWidgets(editor.attr('__pid', obj.pid).dialog('option', 'title', obj.title).dialog('open'));
 }
 
@@ -521,6 +525,7 @@ $(document).ready(function() {
 		closeText: i18n.abort,
 		buttons  : _buttons
 	});
+	editorMessage = editor.find('p');
 
 	// display the configuration data
 	$(".statline").html(configData.status ? i18n.stat_ok : i18n.stat_missing);

Modified: felix/trunk/webconsole/src/main/resources/templates/config.html
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/resources/templates/config.html?rev=926009&r1=926008&r2=926009&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/resources/templates/config.html [UTF-8] (original)
+++ felix/trunk/webconsole/src/main/resources/templates/config.html [UTF-8] Mon Mar 22 09:30:38 2010
@@ -23,7 +23,8 @@ var i18n = { // i18n
 	del_ask      : '${config.del.ask}', // "Are you sure to delete this configuration ?";
 	del_config   : '${config.del.config}', // "Configuration: ";
 	del_bundle   : '${config.del.bundle}', // "Bundle: ";
-	unbind_ask   : '${config.unbind.ask}' // "Are you sure to unbind this configuration ?"
+	unbind_ask   : '${config.unbind.ask}', // "Are you sure to unbind this configuration ?"
+	err_bind     : '${config.bind.error}' // Error: the PID'{0}' is bound to '{1}' but the actual managed service is registered from '{2}' bundle
 }
 // ]]>
 </script>
@@ -72,6 +73,7 @@ var i18n = { // i18n
 
 <!-- placeholder for property editor -->
 <div id="editor" class="ui-helper-hidden">
+	<p class="ui-state-error ui-helper-hidden">&nbsp;</p>
 	<table id="editorTable" class="nicetable">
 		<tr><td>&nbsp;</td></tr>
 	</table>