Author: fmeschbe
Date: Fri Aug 31 00:17:38 2007
New Revision: 571388
URL: http://svn.apache.org/viewvc?rev=571388&view=rev
Log:
Dynamically import LogService and user LogService class name (and not class) to
name
the service to enable starting the ConfigurationManager without the LogService.
Modified:
felix/trunk/configadmin/pom.xml
felix/trunk/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationManager.java
Modified: felix/trunk/configadmin/pom.xml
URL:
http://svn.apache.org/viewvc/felix/trunk/configadmin/pom.xml?rev=571388&r1=571387&r2=571388&view=diff
==============================================================================
--- felix/trunk/configadmin/pom.xml (original)
+++ felix/trunk/configadmin/pom.xml Fri Aug 31 00:17:38 2007
@@ -69,6 +69,9 @@
<Bundle-Activator>
org.apache.felix.cm.impl.ConfigurationManager
</Bundle-Activator>
+ <DynamicImport-Package>
+ org.osgi.service.log
+ </DynamicImport-Package>
</instructions>
</configuration>
</plugin>
Modified:
felix/trunk/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationManager.java
URL:
http://svn.apache.org/viewvc/felix/trunk/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationManager.java?rev=571388&r1=571387&r2=571388&view=diff
==============================================================================
---
felix/trunk/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationManager.java
(original)
+++
felix/trunk/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationManager.java
Fri Aug 31 00:17:38 2007
@@ -99,6 +99,9 @@
*/
public static final String CM_CONFIG_DIR = "felix.cm.dir";
+ // The name of the LogService (not using the class, which might be missing)
+ private static final String LOG_SERVICE_NAME =
"org.osgi.service.log.LogService";
+
// random number generator to create configuration PIDs for factory
// configurations
private static SecureRandom numberGenerator;
@@ -152,7 +155,7 @@
public void start( BundleContext bundleContext )
{
// track the log service using a ServiceTracker
- logTracker = new ServiceTracker( bundleContext,
LogService.class.getName(), null );
+ logTracker = new ServiceTracker( bundleContext, LOG_SERVICE_NAME ,
null );
logTracker.open();
// set up some fields
@@ -205,6 +208,9 @@
// start handling ManagedService[Factory] services
managedServiceTracker = new ManagedServiceTracker();
managedServiceFactoryTracker = new ManagedServiceFactoryTracker();
+
+ // check logging
+ log(LogService.LOG_ERROR, "CM Started", null);
}
@@ -755,10 +761,10 @@
void log( int level, String message, Throwable t )
{
- LogService log = ( LogService ) logTracker.getService();
+ Object log = logTracker.getService();
if ( log != null )
{
- log.log( configurationAdminReference, level, message, t );
+ ( ( LogService ) log ).log( configurationAdminReference, level,
message, t );
return;
}