You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by gn...@apache.org on 2010/02/16 22:44:34 UTC

svn commit: r910707 - in /incubator/aries/trunk/jmx: jmx-blueprint-bundle/pom.xml jmx-blueprint-core/pom.xml jmx-blueprint-core/src/main/java/org/apache/aries/jmx/blueprint/impl/Activator.java pom.xml

Author: gnodet
Date: Tue Feb 16 21:44:34 2010
New Revision: 910707

URL: http://svn.apache.org/viewvc?rev=910707&view=rev
Log:
ARIES-171: replace System.out.println() with proper logging

Modified:
    incubator/aries/trunk/jmx/jmx-blueprint-bundle/pom.xml
    incubator/aries/trunk/jmx/jmx-blueprint-core/pom.xml
    incubator/aries/trunk/jmx/jmx-blueprint-core/src/main/java/org/apache/aries/jmx/blueprint/impl/Activator.java
    incubator/aries/trunk/jmx/pom.xml

Modified: incubator/aries/trunk/jmx/jmx-blueprint-bundle/pom.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jmx/jmx-blueprint-bundle/pom.xml?rev=910707&r1=910706&r2=910707&view=diff
==============================================================================
--- incubator/aries/trunk/jmx/jmx-blueprint-bundle/pom.xml (original)
+++ incubator/aries/trunk/jmx/jmx-blueprint-bundle/pom.xml Tue Feb 16 21:44:34 2010
@@ -74,6 +74,9 @@
                         <Export-Package>
                             org.apache.aries.jmx.blueprint
                         </Export-Package>
+                        <Private-Package>
+                            org.apache.aries.jmx.blueprint.impl*
+                        </Private-Package>
                         <Bundle-Activator>org.apache.aries.jmx.blueprint.impl.Activator</Bundle-Activator>
                         <_versionpolicy>[$(version;==;$(@)),$(version;+;$(@)))</_versionpolicy>
                         <_removeheaders>Ignore-Package,Include-Resource,Private-Package,Bundle-DocURL</_removeheaders>

Modified: incubator/aries/trunk/jmx/jmx-blueprint-core/pom.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jmx/jmx-blueprint-core/pom.xml?rev=910707&r1=910706&r2=910707&view=diff
==============================================================================
--- incubator/aries/trunk/jmx/jmx-blueprint-core/pom.xml (original)
+++ incubator/aries/trunk/jmx/jmx-blueprint-core/pom.xml Tue Feb 16 21:44:34 2010
@@ -46,6 +46,15 @@
             <scope>provided</scope>
         </dependency>
         <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-simple</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
             <version>4.7</version>

Modified: incubator/aries/trunk/jmx/jmx-blueprint-core/src/main/java/org/apache/aries/jmx/blueprint/impl/Activator.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jmx/jmx-blueprint-core/src/main/java/org/apache/aries/jmx/blueprint/impl/Activator.java?rev=910707&r1=910706&r2=910707&view=diff
==============================================================================
--- incubator/aries/trunk/jmx/jmx-blueprint-core/src/main/java/org/apache/aries/jmx/blueprint/impl/Activator.java (original)
+++ incubator/aries/trunk/jmx/jmx-blueprint-core/src/main/java/org/apache/aries/jmx/blueprint/impl/Activator.java Tue Feb 16 21:44:34 2010
@@ -37,9 +37,13 @@
 import org.osgi.framework.ServiceReference;
 import org.osgi.util.tracker.ServiceTracker;
 import org.osgi.util.tracker.ServiceTrackerCustomizer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class Activator implements BundleActivator {
 
+    private static final Logger LOGGER = LoggerFactory.getLogger("org.apache.aries.jmx.blueprint");
+
     protected BundleContext bundleContext;
 
     protected StandardMBean blueprintState;
@@ -62,7 +66,7 @@
         // if there has been already a MBeanServer Service in place, this MBeanServerServiceTracker won't miss it
         mbeanServiceTracker = new ServiceTracker(bundleContext, MBeanServer.class.getCanonicalName(),
                 new MBeanServerServiceTracker());
-        System.out.println("Awaiting MBeanServer service registration"); // Fine
+        LOGGER.debug("Awaiting MBeanServer service registration");
         mbeanServiceTracker.open();
     }
 
@@ -78,25 +82,25 @@
 
         public Object addingService(ServiceReference servicereference) {
             try {
-                System.out.println("Adding MBeanServer: " + servicereference); // Fine
+                LOGGER.debug("Adding MBeanServer: {}", servicereference);
                 final MBeanServer mbeanServer = (MBeanServer) bundleContext.getService(servicereference);
                 Activator.this.mbeanServers.add(mbeanServer);
                 Activator.this.processRegister(mbeanServer);
                 return mbeanServer;
             } catch (RuntimeException e) {
-                System.out.println("uncaught exception in addingService" + e); // Severe
+                LOGGER.error("uncaught exception in addingService", e);
                 throw e;
             }
         }
 
         public void removedService(ServiceReference servicereference, Object obj) {
             try {
-                System.out.println("Removing MBeanServer: " + servicereference); // Fine
+                LOGGER.debug("Removing MBeanServer: {}", servicereference);
                 final MBeanServer mbeanServer = (MBeanServer) bundleContext.getService(servicereference);
                 Activator.this.mbeanServers.remove(mbeanServer);
                 Activator.this.processDeregister(mbeanServer);
             } catch (Throwable e) {
-                System.out.println("uncaught exception in removedService"); // Fine
+                LOGGER.debug("uncaught exception in removedService", e);
             }
         }
 
@@ -136,41 +140,41 @@
         try {
             blueprintState = new RegistrationStandardMBean(new BlueprintState(bundleContext), BlueprintStateMBean.class);
         } catch (NotCompliantMBeanException e) {
-            System.out.println("Unable to create StandardMBean for BlueprintState" + e); // Severe
+            LOGGER.error("Unable to create StandardMBean for BlueprintState", e);
             return;
         }
 
         // register BlueprintStateMBean to MBean server
-        System.out.println("Registering bundle state monitor with MBeanServer: " + mbeanServer + " with name: "
-                + blueprintStateName); // Fine
+        LOGGER.debug("Registering bundle state monitor with MBeanServer: {} with name: {}",
+                        mbeanServer, blueprintStateName);
         try {
             mbeanServer.registerMBean(blueprintState, blueprintStateName);
         } catch (InstanceAlreadyExistsException e) {
-            System.out.println("Cannot register BlueprintStateMBean"); // Fine
+            LOGGER.debug("Cannot register BlueprintStateMBean");
         } catch (MBeanRegistrationException e) {
-            System.out.println("Cannot register BlueprintStateMBean" + e); // Severe
+            LOGGER.error("Cannot register BlueprintStateMBean", e);
         } catch (NotCompliantMBeanException e) {
-            System.out.println("Cannot register BlueprintStateMBean" + e); // Severe
+            LOGGER.error("Cannot register BlueprintStateMBean", e);
         }
 
         // create BlueprintMetadataMBean
         try {
             blueprintMetadata = new StandardMBean(new BlueprintMetadata(bundleContext), BlueprintMetadataMBean.class);
         } catch (NotCompliantMBeanException e) {
-            System.out.println("Unable to create StandardMBean for BlueprintMetadata" + e); // Severe
+            LOGGER.error("Unable to create StandardMBean for BlueprintMetadata", e);
             return;
         }
         // register BlueprintMetadataMBean to MBean server
-        System.out.println("Registering bundle metadata monitor with MBeanServer: " + mbeanServer + " with name: "
-                + blueprintMetadataName); // Fine
+        LOGGER.debug("Registering bundle metadata monitor with MBeanServer: {} with name: {}",
+                    mbeanServer, blueprintMetadataName);
         try {
             mbeanServer.registerMBean(blueprintMetadata, blueprintMetadataName);
         } catch (InstanceAlreadyExistsException e) {
-            System.out.println("Cannot register BlueprintMetadataMBean"); // Fine
+            LOGGER.debug("Cannot register BlueprintMetadataMBean");
         } catch (MBeanRegistrationException e) {
-            System.out.println("Cannot register BlueprintMetadataMBean" + e); // Severe
+            LOGGER.error("Cannot register BlueprintMetadataMBean", e);
         } catch (NotCompliantMBeanException e) {
-            System.out.println("Cannot register BlueprintMetadataMBean" + e); // Severe
+            LOGGER.error("Cannot register BlueprintMetadataMBean", e);
         }
 
         servicesRegistered.set(true);
@@ -184,9 +188,9 @@
         try {
             mbeanServer.unregisterMBean(blueprintStateName);
         } catch (InstanceNotFoundException e) {
-            System.out.println("BlueprintStateMBean not found on deregistration"); // Finest
+            LOGGER.debug("BlueprintStateMBean not found on deregistration");
         } catch (MBeanRegistrationException e) {
-            System.out.println("BlueprintStateMBean deregistration problem"); // Fine
+            LOGGER.error("BlueprintStateMBean deregistration problem");
         }
         blueprintState = null;
 
@@ -194,9 +198,9 @@
         try {
             mbeanServer.unregisterMBean(blueprintMetadataName);
         } catch (InstanceNotFoundException e) {
-            System.out.println("BlueprintMetadataMBean not found on deregistration"); // Finest
+            LOGGER.debug("BlueprintMetadataMBean not found on deregistration");
         } catch (MBeanRegistrationException e) {
-            System.out.println("BlueprintMetadataMBean deregistration problem"); // Fine
+            LOGGER.error("BlueprintMetadataMBean deregistration problem");
         }
         blueprintMetadata = null;
 

Modified: incubator/aries/trunk/jmx/pom.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jmx/pom.xml?rev=910707&r1=910706&r2=910707&view=diff
==============================================================================
--- incubator/aries/trunk/jmx/pom.xml (original)
+++ incubator/aries/trunk/jmx/pom.xml Tue Feb 16 21:44:34 2010
@@ -135,6 +135,16 @@
                 <artifactId>pax-url-mvn</artifactId>
                 <version>1.0.0</version>
             </dependency>
+            <dependency>
+                <groupId>org.slf4j</groupId>
+                <artifactId>slf4j-api</artifactId>
+                <version>1.5.6</version>
+            </dependency>
+            <dependency>
+                <groupId>org.slf4j</groupId>
+                <artifactId>slf4j-simple</artifactId>
+                <version>1.5.6</version>
+            </dependency>
         </dependencies>
     </dependencyManagement>