You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cz...@apache.org on 2016/07/18 09:54:00 UTC

svn commit: r1753190 - in /felix/sandbox/configurator: ./ src/main/java/org/apache/felix/configurator/impl/ src/main/java/org/apache/felix/configurator/impl/logger/

Author: cziegeler
Date: Mon Jul 18 09:54:00 2016
New Revision: 1753190

URL: http://svn.apache.org/viewvc?rev=1753190&view=rev
Log:
Add activator, fix services listener, output debug msgs as info for now

Modified:
    felix/sandbox/configurator/pom.xml
    felix/sandbox/configurator/src/main/java/org/apache/felix/configurator/impl/Configurator.java
    felix/sandbox/configurator/src/main/java/org/apache/felix/configurator/impl/ServicesListener.java
    felix/sandbox/configurator/src/main/java/org/apache/felix/configurator/impl/logger/SystemLogger.java

Modified: felix/sandbox/configurator/pom.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/configurator/pom.xml?rev=1753190&r1=1753189&r2=1753190&view=diff
==============================================================================
--- felix/sandbox/configurator/pom.xml (original)
+++ felix/sandbox/configurator/pom.xml Mon Jul 18 09:54:00 2016
@@ -54,6 +54,7 @@
                 <extensions>true</extensions>
                 <configuration>
                     <instructions>
+                        <Bundle-Activator>org.apache.felix.configurator.impl.Activator</Bundle-Activator>
                         <Bundle-Category>osgi</Bundle-Category>
                         <Bundle-SymbolicName>
                             ${project.artifactId}

Modified: felix/sandbox/configurator/src/main/java/org/apache/felix/configurator/impl/Configurator.java
URL: http://svn.apache.org/viewvc/felix/sandbox/configurator/src/main/java/org/apache/felix/configurator/impl/Configurator.java?rev=1753190&r1=1753189&r2=1753190&view=diff
==============================================================================
--- felix/sandbox/configurator/src/main/java/org/apache/felix/configurator/impl/Configurator.java (original)
+++ felix/sandbox/configurator/src/main/java/org/apache/felix/configurator/impl/Configurator.java Mon Jul 18 09:54:00 2016
@@ -117,7 +117,6 @@ public class Configurator {
                     }
 
         });
-        this.start();
     }
 
     /**
@@ -131,7 +130,7 @@ public class Configurator {
     /**
      * Start the configurator.
      */
-    private void start() {
+    public void start() {
         // get the directory for storing binaries
         String dirPath = this.bundleContext.getProperty(PROP_DIRECTORY);
         if ( dirPath != null ) {

Modified: felix/sandbox/configurator/src/main/java/org/apache/felix/configurator/impl/ServicesListener.java
URL: http://svn.apache.org/viewvc/felix/sandbox/configurator/src/main/java/org/apache/felix/configurator/impl/ServicesListener.java?rev=1753190&r1=1753189&r2=1753190&view=diff
==============================================================================
--- felix/sandbox/configurator/src/main/java/org/apache/felix/configurator/impl/ServicesListener.java (original)
+++ felix/sandbox/configurator/src/main/java/org/apache/felix/configurator/impl/ServicesListener.java Mon Jul 18 09:54:00 2016
@@ -18,6 +18,7 @@
  */
 package org.apache.felix.configurator.impl;
 
+import org.apache.felix.configurator.impl.logger.SystemLogger;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
 import org.osgi.framework.InvalidSyntaxException;
@@ -55,11 +56,12 @@ public class ServicesListener {
     public ServicesListener(final BundleContext bundleContext) {
         this.bundleContext = bundleContext;
         this.caListener = new Listener(ConfigurationAdmin.class.getName());
-        this.caListener.start();
         this.converterListener = new Listener(Converter.class.getName());
-        this.converterListener.start();
         this.coordinatorListener = new Listener("org.osgi.service.coordinator.Coordinator");
+        this.caListener.start();
+        this.converterListener.start();
         this.coordinatorListener.start();
+        SystemLogger.debug("Started services listener for configurator.");
     }
 
     /**
@@ -71,14 +73,23 @@ public class ServicesListener {
         final ConfigurationAdmin ca = (ConfigurationAdmin)this.caListener.getService();
         final Converter converter = (Converter)this.converterListener.getService();
         final Object coordinator = this.coordinatorListener.getService();
+        SystemLogger.debug("Services updated for configurator: " + ca + " - " + converter + " - " + coordinator);
+
         if ( ca != null && converter != null ) {
-            if ( configurator == null ) {
+            boolean isNew = configurator == null;
+            if ( isNew ) {
+                TypeConverter.setConverter(converter);
+
+                SystemLogger.debug("Starting new configurator");
                 configurator = new Configurator(this.bundleContext, ca);
             }
-            TypeConverter.setConverter(converter);
             configurator.setCoordinator(coordinator);
+            if ( isNew ) {
+                configurator.start();
+            }
         } else {
             if ( configurator != null ) {
+                SystemLogger.debug("Stopping configurator");
                 configurator.shutdown();
                 configurator = null;
             }

Modified: felix/sandbox/configurator/src/main/java/org/apache/felix/configurator/impl/logger/SystemLogger.java
URL: http://svn.apache.org/viewvc/felix/sandbox/configurator/src/main/java/org/apache/felix/configurator/impl/logger/SystemLogger.java?rev=1753190&r1=1753189&r2=1753190&view=diff
==============================================================================
--- felix/sandbox/configurator/src/main/java/org/apache/felix/configurator/impl/logger/SystemLogger.java (original)
+++ felix/sandbox/configurator/src/main/java/org/apache/felix/configurator/impl/logger/SystemLogger.java Mon Jul 18 09:54:00 2016
@@ -29,7 +29,8 @@ public final class SystemLogger {
     }
 
     public static void debug(final String message) {
-        LOGGER.log(LogService.LOG_DEBUG, message);
+        LOGGER.log(LogService.LOG_INFO, message);
+// TODO        LOGGER.log(LogService.LOG_DEBUG, message);
     }
 
     public static void debug(final String message, final Throwable cause) {