aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject svn commit: r1239078 - in /aries/trunk/jndi: jndi-core/ jndi-core/src/main/java/org/apache/aries/jndi/ jndi-core/src/main/java/org/apache/aries/jndi/startup/ jndi-rmi/ jndi-rmi/src/main/java/org/apache/aries/jndi/rmi/ jndi-url-itest/ jndi-url-itest/src...
Date Wed, 01 Feb 2012 11:23:24 GMT
Author: davidb
Date: Wed Feb  1 11:23:24 2012
New Revision: 1239078

URL: http://svn.apache.org/viewvc?rev=1239078&view=rev
Log:
Reverting log system back to SLF4J as requested.

Modified:
    aries/trunk/jndi/jndi-core/pom.xml
    aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/   (props changed)
    aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/startup/Activator.java
    aries/trunk/jndi/jndi-rmi/pom.xml
    aries/trunk/jndi/jndi-rmi/src/main/java/org/apache/aries/jndi/rmi/Activator.java
    aries/trunk/jndi/jndi-url-itest/pom.xml
    aries/trunk/jndi/jndi-url-itest/src/test/java/org/apache/aries/jndi/itests/JndiUrlIntegrationTest.java
    aries/trunk/jndi/jndi-url/pom.xml
    aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/   (props changed)
    aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/Activator.java
    aries/trunk/jndi/jndi-url/src/test/java/org/apache/aries/jndi/   (props changed)

Modified: aries/trunk/jndi/jndi-core/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/jndi/jndi-core/pom.xml?rev=1239078&r1=1239077&r2=1239078&view=diff
==============================================================================
--- aries/trunk/jndi/jndi-core/pom.xml (original)
+++ aries/trunk/jndi/jndi-core/pom.xml Wed Feb  1 11:23:24 2012
@@ -79,12 +79,22 @@
             <scope>provided</scope>
         </dependency>
         <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
             <groupId>org.apache.aries.testsupport</groupId>
             <artifactId>org.apache.aries.testsupport.unit</artifactId>
             <scope>test</scope>
             <version>0.3</version>
         </dependency>
         <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-simple</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
             <scope>test</scope>

Propchange: aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/
            ('svn:mergeinfo' removed)

Modified: aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/startup/Activator.java
URL: http://svn.apache.org/viewvc/aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/startup/Activator.java?rev=1239078&r1=1239077&r2=1239078&view=diff
==============================================================================
--- aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/startup/Activator.java
(original)
+++ aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/startup/Activator.java
Wed Feb  1 11:23:24 2012
@@ -37,22 +37,23 @@ import org.apache.aries.jndi.Utils;
 import org.apache.aries.jndi.spi.EnvironmentAugmentation;
 import org.apache.aries.jndi.tracker.ServiceTrackerCustomizers;
 import org.apache.aries.jndi.urls.URLObjectFactoryFinder;
-import org.apache.aries.util.log.Logger;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
 import org.osgi.service.jndi.JNDIContextManager;
 import org.osgi.service.jndi.JNDIProviderAdmin;
-import org.osgi.service.log.LogService;
 import org.osgi.util.tracker.ServiceTracker;
 import org.osgi.util.tracker.ServiceTrackerCustomizer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * The activator for this bundle makes sure the static classes in it are
  * driven so they can do their magic stuff properly.
  */
 public class Activator implements BundleActivator {
-    private static Logger logger;
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(Activator.class.getName());
 
     private OSGiInitialContextFactoryBuilder icfBuilder;
     private OSGiObjectFactoryBuilder ofBuilder;
@@ -63,8 +64,6 @@ public class Activator implements Bundle
     private static ServiceTracker environmentAugmentors;
 
     public void start(BundleContext context) {
-        logger = new Logger(context);
-        logger.open();
 
         initialContextFactories = initServiceTracker(context, InitialContextFactory.class,
ServiceTrackerCustomizers.ICF_CACHE);
         objectFactories = initServiceTracker(context, ObjectFactory.class, ServiceTrackerCustomizers.URL_FACTORY_CACHE);
@@ -77,9 +76,9 @@ public class Activator implements Bundle
             NamingManager.setInitialContextFactoryBuilder(builder);
             icfBuilder = builder;
         } catch (NamingException e) {
-            logger.log(LogService.LOG_INFO, Utils.MESSAGES.getMessage("unable.to.set.static.ICFB"),
e);
+            LOGGER.info(Utils.MESSAGES.getMessage("unable.to.set.static.ICFB"), e);
         } catch (IllegalStateException e) {
-            logger.log(LogService.LOG_INFO, Utils.MESSAGES.getMessage("unable.to.set.static.ICFB.already.exists",
getClassName(InitialContextFactoryBuilder.class)), e);
+            LOGGER.info(Utils.MESSAGES.getMessage("unable.to.set.static.ICFB.already.exists",
getClassName(InitialContextFactoryBuilder.class)), e);
         }
 
         try {
@@ -87,9 +86,9 @@ public class Activator implements Bundle
             NamingManager.setObjectFactoryBuilder(builder);
             ofBuilder = builder;
         } catch (NamingException e) {
-            logger.log(LogService.LOG_INFO, Utils.MESSAGES.getMessage("unable.to.set.static.OFB"),
e);
+            LOGGER.info(Utils.MESSAGES.getMessage("unable.to.set.static.OFB"), e);
         } catch (IllegalStateException e) {
-            logger.log(LogService.LOG_INFO, Utils.MESSAGES.getMessage("unable.to.set.static.OFB.already.exists",
getClassName(InitialContextFactoryBuilder.class)), e);
+            LOGGER.info(Utils.MESSAGES.getMessage("unable.to.set.static.OFB.already.exists",
getClassName(InitialContextFactoryBuilder.class)), e);
         }
 
         context.registerService(JNDIProviderAdmin.class.getName(),
@@ -146,9 +145,6 @@ public class Activator implements Bundle
         objectFactories.close();
         initialContextFactories.close();
         environmentAugmentors.close();
-
-        if (logger != null)
-            logger.close();
     }
 
     /*
@@ -164,8 +160,8 @@ public class Activator implements Bundle
                 }
             }
         } catch (Throwable t) {
-            if (logger != null)
-                logger.log(LogService.LOG_DEBUG, "Error setting field.", t);
+            // Ignore
+            LOGGER.debug("Error setting field.", t);
         }
     }
 

Modified: aries/trunk/jndi/jndi-rmi/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/jndi/jndi-rmi/pom.xml?rev=1239078&r1=1239077&r2=1239078&view=diff
==============================================================================
--- aries/trunk/jndi/jndi-rmi/pom.xml (original)
+++ aries/trunk/jndi/jndi-rmi/pom.xml Wed Feb  1 11:23:24 2012
@@ -77,8 +77,8 @@
             <scope>provided</scope>
         </dependency>
         <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.compendium</artifactId>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
             <scope>provided</scope>
         </dependency>
     </dependencies>

Modified: aries/trunk/jndi/jndi-rmi/src/main/java/org/apache/aries/jndi/rmi/Activator.java
URL: http://svn.apache.org/viewvc/aries/trunk/jndi/jndi-rmi/src/main/java/org/apache/aries/jndi/rmi/Activator.java?rev=1239078&r1=1239077&r2=1239078&view=diff
==============================================================================
--- aries/trunk/jndi/jndi-rmi/src/main/java/org/apache/aries/jndi/rmi/Activator.java (original)
+++ aries/trunk/jndi/jndi-rmi/src/main/java/org/apache/aries/jndi/rmi/Activator.java Wed Feb
 1 11:23:24 2012
@@ -23,21 +23,23 @@ import java.util.Hashtable;
 import javax.naming.spi.ObjectFactory;
 
 import org.apache.aries.util.AriesFrameworkUtil;
-import org.apache.aries.util.log.Logger;
 import org.apache.aries.util.nls.MessageUtil;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceRegistration;
 import org.osgi.service.jndi.JNDIConstants;
-import org.osgi.service.log.LogService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class Activator implements BundleActivator {
-    private Logger logger;
+
     private ServiceRegistration reg;
 
+    private static final Logger LOGGER = LoggerFactory.getLogger(Activator.class.getName());
+
     public void start(BundleContext context) {
-        logger = new Logger(context);
-        logger.open();
+
+        LOGGER.debug("Registering RMI url handler");
 
         try {
             Hashtable<Object, Object> props = new Hashtable<Object, Object>();
@@ -46,20 +48,16 @@ public class Activator implements Bundle
                         ObjectFactory.class.getName(),
                         ClassLoader.getSystemClassLoader().loadClass("com.sun.jndi.url.rmi.rmiURLContextFactory").newInstance(),
                         props);
-
-            logger.log(LogService.LOG_DEBUG, "Registered RMI url handler");
         }
         catch (Exception e)
         {
             MessageUtil msg = MessageUtil.createMessageUtil(Activator.class, "org.apache.aries.jndi.nls.jndiRmiMessages");
-            logger.log(LogService.LOG_INFO, msg.getMessage("rmi.factory.creation.failed"),
e);
+            LOGGER.info(msg.getMessage("rmi.factory.creation.failed"), e);
         }
     }
 
     public void stop(BundleContext context) {
         AriesFrameworkUtil.safeUnregisterService(reg);
-
-        if (logger != null)
-            logger.close();
     }
+
 }

Modified: aries/trunk/jndi/jndi-url-itest/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/jndi/jndi-url-itest/pom.xml?rev=1239078&r1=1239077&r2=1239078&view=diff
==============================================================================
--- aries/trunk/jndi/jndi-url-itest/pom.xml (original)
+++ aries/trunk/jndi/jndi-url-itest/pom.xml Wed Feb  1 11:23:24 2012
@@ -171,17 +171,17 @@
             <version>4.0</version>
         </dependency>
 
-        <dependency>
-            <groupId>org.eclipse.equinox</groupId>
-            <artifactId>cm</artifactId>
+		<dependency>
+			<groupId>org.eclipse.equinox</groupId>
+			<artifactId>cm</artifactId>
             <scope>test</scope>
-        </dependency>
+		</dependency>
 
-        <dependency>
-            <groupId>org.eclipse.osgi</groupId>
-            <artifactId>services</artifactId>
+		<dependency>
+			<groupId>org.eclipse.osgi</groupId>
+			<artifactId>services</artifactId>
             <scope>test</scope>
-        </dependency>
+		</dependency>
 
         <dependency>
             <groupId>org.apache.geronimo.specs</groupId>
@@ -190,32 +190,32 @@
             <version>1.2</version>
         </dependency>
             
-        <dependency>
-            <groupId>org.ops4j.pax.web</groupId>
-            <artifactId>pax-web-extender-war</artifactId>
+		<dependency>
+			<groupId>org.ops4j.pax.web</groupId>
+			<artifactId>pax-web-extender-war</artifactId>
             <scope>test</scope>
             <version>0.8.1</version>
-        </dependency>
-        <dependency>
-            <groupId>org.ops4j.pax.web</groupId>
-            <artifactId>pax-web-jetty-bundle</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.ops4j.pax.web</groupId>
+			<artifactId>pax-web-jetty-bundle</artifactId>
             <scope>test</scope>
             <version>0.8.1</version>
-        </dependency>
+		</dependency>
 
-        <dependency>
-            <groupId>org.apache.felix</groupId>
-            <artifactId>org.apache.felix.fileinstall</artifactId>
+		<dependency>
+			<groupId>org.apache.felix</groupId>
+			<artifactId>org.apache.felix.fileinstall</artifactId>
             <scope>test</scope>
             <version>2.0.8</version>
-        </dependency>
+		</dependency>
         
-        <dependency>
-            <groupId>org.apache.aries.jndi</groupId>
-            <artifactId>org.apache.aries.jndi</artifactId>
+		<dependency>
+			<groupId>org.apache.aries.jndi</groupId>
+			<artifactId>org.apache.aries.jndi</artifactId>
             <scope>test</scope>
             <version>0.3.2-SNAPSHOT</version>
-        </dependency>
+		</dependency>
 
         <dependency>
             <groupId>org.apache.aries.jndi</groupId>
@@ -230,6 +230,7 @@
           <version>0.4</version>
           <scope>test</scope>
         </dependency>
+
     </dependencies>
 
      <build>

Modified: aries/trunk/jndi/jndi-url-itest/src/test/java/org/apache/aries/jndi/itests/JndiUrlIntegrationTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/jndi/jndi-url-itest/src/test/java/org/apache/aries/jndi/itests/JndiUrlIntegrationTest.java?rev=1239078&r1=1239077&r2=1239078&view=diff
==============================================================================
--- aries/trunk/jndi/jndi-url-itest/src/test/java/org/apache/aries/jndi/itests/JndiUrlIntegrationTest.java
(original)
+++ aries/trunk/jndi/jndi-url-itest/src/test/java/org/apache/aries/jndi/itests/JndiUrlIntegrationTest.java
Wed Feb  1 11:23:24 2012
@@ -19,13 +19,10 @@
 
 package org.apache.aries.jndi.itests;
 
-import static org.apache.aries.itest.ExtraOptions.mavenBundle;
-import static org.apache.aries.itest.ExtraOptions.paxLogging;
-import static org.apache.aries.itest.ExtraOptions.testOptions;
-import static org.apache.aries.itest.ExtraOptions.transactionBootDelegation;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.ops4j.pax.exam.CoreOptions.equinox;
+import static org.apache.aries.itest.ExtraOptions.*;
 
 import java.io.BufferedReader;
 import java.io.IOException;
@@ -44,64 +41,64 @@ import org.osgi.framework.Bundle;
 public class JndiUrlIntegrationTest extends AbstractIntegrationTest {
 
   private static final int CONNECTION_TIMEOUT = 10000;
-
+    
   /**
    * This test exercises the blueprint:comp/ jndi namespace by driving
    * a Servlet which then looks up some blueprint components from its own
-   * bundle, including a reference which it uses to call a service from a
-   * second bundle.
+   * bundle, including a reference which it uses to call a service from a 
+   * second bundle.  
    * @throws Exception
    */
   @Test
-  public void testBlueprintCompNamespaceWorks() throws Exception {
+  public void testBlueprintCompNamespaceWorks() throws Exception { 
 
     Bundle bBiz = context().getBundleByName("org.apache.aries.jndi.url.itest.biz");
     assertNotNull(bBiz);
-
+    
     Bundle bweb = context().getBundleByName("org.apache.aries.jndi.url.itest.web");
     assertNotNull(bweb);
-
+    
     printBundleStatus ("Before making web request");
-    try {
+    try { 
       Thread.sleep(5000);
     } catch (InterruptedException ix) {}
-
+    
     System.out.println("In test and trying to get connection....");
     String response = getTestServletResponse();
     System.out.println("Got response `" + response + "`");
     assertEquals("ITest servlet response wrong", "Mark.2.0.three", response);
   }
-
-  private void printBundleStatus (String msg) {
+  
+  private void printBundleStatus (String msg) { 
     System.out.println("-----\nprintBundleStatus: " + msg + "\n-----");
-    for (Bundle b : bundleContext.getBundles()) {
+    for (Bundle b : bundleContext.getBundles()) { 
       System.out.println (b.getSymbolicName() + " " + "state=" + formatState(b.getState()));
     }
     System.out.println();
   }
-
+  
   private String formatState (int state) {
     String result = Integer.toString(state);
-    switch (state) {
-    case Bundle.ACTIVE:
+    switch (state) { 
+    case Bundle.ACTIVE: 
       result = "Active";
       break;
-    case Bundle.INSTALLED:
+    case Bundle.INSTALLED: 
       result = "Installed";
       break;
-    case Bundle.RESOLVED:
+    case Bundle.RESOLVED: 
       result = "Resolved";
       break;
     }
     return result;
   }
-
-  private String getTestServletResponse() throws IOException {
+  
+  private String getTestServletResponse() throws IOException { 
     HttpURLConnection conn = makeConnection("http://localhost:8080/jndiUrlItest/ITestServlet");
     String response = getHTTPResponse(conn).trim();
     return response;
   }
-
+  
   private static HttpURLConnection makeConnection(String contextPath) throws IOException
   {
     URL url = new URL(contextPath);
@@ -112,7 +109,7 @@ public class JndiUrlIntegrationTest exte
 
     return conn;
   }
-
+  
   private static String getHTTPResponse(HttpURLConnection conn) throws IOException
   {
     StringBuilder response = new StringBuilder();
@@ -127,14 +124,14 @@ public class JndiUrlIntegrationTest exte
 
     return response.toString();
   }
-
+  
   @org.ops4j.pax.exam.junit.Configuration
   public static Option[] configuration()
   {
     return testOptions(
         paxLogging("DEBUG"),
-        transactionBootDelegation(),
-
+        transactionBootDelegation(), 
+        
         // Bundles
         mavenBundle("org.eclipse.equinox", "cm"),
         mavenBundle("org.eclipse.osgi", "services"),
@@ -142,13 +139,13 @@ public class JndiUrlIntegrationTest exte
 
         mavenBundle("org.ops4j.pax.web", "pax-web-extender-war"),
         mavenBundle("org.ops4j.pax.web", "pax-web-jetty-bundle"),
-
+        
         mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.api"),
         mavenBundle("org.apache.aries.blueprint", "org.apache.aries.blueprint.core"),
         mavenBundle("org.apache.aries.proxy", "org.apache.aries.proxy"),
         mavenBundle("org.apache.aries", "org.apache.aries.util"),
         mavenBundle("org.apache.aries.jndi", "org.apache.aries.jndi"),
-
+      
         mavenBundle("org.apache.aries.jndi", "org.apache.aries.jndi.url.itest.web"),
         mavenBundle("org.apache.aries.jndi", "org.apache.aries.jndi.url.itest.biz"),
         mavenBundle("org.ow2.asm", "asm-all"),

Modified: aries/trunk/jndi/jndi-url/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/jndi/jndi-url/pom.xml?rev=1239078&r1=1239077&r2=1239078&view=diff
==============================================================================
--- aries/trunk/jndi/jndi-url/pom.xml (original)
+++ aries/trunk/jndi/jndi-url/pom.xml Wed Feb  1 11:23:24 2012
@@ -103,6 +103,11 @@
             <version>0.4</version>
         </dependency>
         <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-simple</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
             <scope>test</scope>

Propchange: aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/
            ('svn:mergeinfo' removed)

Modified: aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/Activator.java
URL: http://svn.apache.org/viewvc/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/Activator.java?rev=1239078&r1=1239077&r2=1239078&view=diff
==============================================================================
--- aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/Activator.java (original)
+++ aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/Activator.java Wed Feb
 1 11:23:24 2012
@@ -24,30 +24,24 @@ import javax.naming.spi.ObjectFactory;
 
 import org.apache.aries.proxy.ProxyManager;
 import org.apache.aries.util.AriesFrameworkUtil;
-import org.apache.aries.util.log.Logger;
 import org.apache.aries.util.tracker.SingleServiceTracker;
 import org.apache.aries.util.tracker.SingleServiceTracker.SingleServiceListener;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceRegistration;
 import org.osgi.service.jndi.JNDIConstants;
-import org.osgi.service.log.LogService;
 
-public class Activator implements BundleActivator, SingleServiceListener
+public class Activator implements BundleActivator, SingleServiceListener 
 {
     private BundleContext ctx;
-    private Logger logger;
     private volatile ServiceRegistration osgiUrlReg = null;
     private volatile ServiceRegistration blueprintUrlReg = null;
     private static SingleServiceTracker<ProxyManager> proxyManager;
 
     @Override
-    public void start(BundleContext context)
+    public void start(BundleContext context) 
     {
         ctx = context;
-        logger = new Logger(context);
-        logger.open();
-
         proxyManager = new SingleServiceTracker<ProxyManager>(context, ProxyManager.class,
this);
         proxyManager.open();
         // Blueprint URL scheme requires access to the BlueprintContainer service.
@@ -62,7 +56,7 @@ public class Activator implements Bundle
               new BlueprintURLContextServiceFactory(), blueprintURlSchemeProps);
         } catch (ClassNotFoundException cnfe) {
           // The blueprint packages aren't available, so do nothing. That's fine.
-          logger.log(LogService.LOG_INFO, "Blueprint is not available, therefore the blueprint
URL scheme is not registered.", cnfe);
+          cnfe.printStackTrace();
         }
     }
 
@@ -71,14 +65,11 @@ public class Activator implements Bundle
       proxyManager.close();
       AriesFrameworkUtil.safeUnregisterService(osgiUrlReg);
       AriesFrameworkUtil.safeUnregisterService(blueprintUrlReg);
-
-      if (logger != null)
-          logger.close();
     }
-
+  
 
   @Override
-  public void serviceFound()
+  public void serviceFound() 
   {
     Hashtable<Object, Object> osgiUrlprops = new Hashtable<Object, Object>();
     osgiUrlprops.put(JNDIConstants.JNDI_URLSCHEME, new String[] { "osgi", "aries" });
@@ -87,18 +78,18 @@ public class Activator implements Bundle
   }
 
   @Override
-  public void serviceLost()
+  public void serviceLost() 
   {
     AriesFrameworkUtil.safeUnregisterService(osgiUrlReg);
     osgiUrlReg = null;
   }
 
   @Override
-  public void serviceReplaced()
+  public void serviceReplaced() 
   {
-
+    
   }
-
+    
   public static ProxyManager getProxyManager()
   {
     return proxyManager == null ? null : proxyManager.getService();

Propchange: aries/trunk/jndi/jndi-url/src/test/java/org/apache/aries/jndi/
            ('svn:mergeinfo' removed)



Mime
View raw message