[exo-jcr-commits] exo-jcr SVN: r2418 - kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/naming.

do-not-reply at jboss.org do-not-reply at jboss.org
Fri May 21 04:19:48 EDT 2010


Author: pnedonosko
Date: 2010-05-21 04:19:48 -0400 (Fri, 21 May 2010)
New Revision: 2418

Modified:
   kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/naming/InitialContextInitializer.java
Log:
EXOJCR-573: log.debug in bind method

Modified: kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/naming/InitialContextInitializer.java
===================================================================
--- kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/naming/InitialContextInitializer.java	2010-05-21 08:17:56 UTC (rev 2417)
+++ kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/naming/InitialContextInitializer.java	2010-05-21 08:19:48 UTC (rev 2418)
@@ -54,7 +54,7 @@
 
    final public static String PROPERTIES_MANDATORY = "mandatory-properties";
 
-   private static Log log = ExoLogger.getLogger("exo.kernel.component.common.InitialContextInitializer");
+   private static Log LOG = ExoLogger.getLogger("exo.kernel.component.common.InitialContextInitializer");
 
    private List<BindReferencePlugin> bindReferencesPlugins;
 
@@ -98,7 +98,7 @@
                }
                else
                {
-                  log.info("Using default system property: " + propName + " = " + existedProp);
+                  LOG.info("Using default system property: " + propName + " = " + existedProp);
                }
             }
          }
@@ -117,11 +117,12 @@
       {
          defaultContextFactory = propValue;
       }
-      log.info("Using mandatory system property: " + propName + " = " + System.getProperty(propName));
+      LOG.info("Using mandatory system property: " + propName + " = " + System.getProperty(propName));
    }
 
    // for out-of-container testing
-   private InitialContextInitializer(String name, Reference reference) throws NamingException, FileNotFoundException, XMLStreamException
+   private InitialContextInitializer(String name, Reference reference) throws NamingException, FileNotFoundException,
+      XMLStreamException
    {
       if (System.getProperty(Context.INITIAL_CONTEXT_FACTORY) == null)
       {
@@ -147,15 +148,15 @@
          {
             InitialContext ic = new InitialContext();
             ic.bind(plugin.getBindName(), plugin.getReference());
-            log.info("Reference bound (by recall()): " + plugin.getBindName());
+            LOG.info("Reference bound (by recall()): " + plugin.getBindName());
          }
          catch (NameAlreadyBoundException e)
          {
-            log.debug("Name already bound: " + plugin.getBindName());
+            LOG.debug("Name already bound: " + plugin.getBindName());
          }
          catch (NamingException e)
          {
-            log.error("Could not bind: " + plugin.getBindName(), e);
+            LOG.error("Could not bind: " + plugin.getBindName(), e);
          }
       }
    }
@@ -169,12 +170,12 @@
          {
             // initialContext = new InitialContext();
             initialContext.rebind(brplugin.getBindName(), brplugin.getReference());
-            log.info("Reference bound: " + brplugin.getBindName());
+            LOG.info("Reference bound: " + brplugin.getBindName());
             bindReferencesPlugins.add((BindReferencePlugin)plugin);
          }
          catch (NamingException e)
          {
-            log.error("Could not bind: " + brplugin.getBindName(), e);
+            LOG.error("Could not bind: " + brplugin.getBindName(), e);
          }
       }
    }
@@ -206,7 +207,8 @@
    }
 
    // for out-of-container testing
-   public static void initialize(String name, Reference reference) throws NamingException, FileNotFoundException, XMLStreamException
+   public static void initialize(String name, Reference reference) throws NamingException, FileNotFoundException,
+      XMLStreamException
    {
       new InitialContextInitializer(name, reference);
    }
@@ -234,6 +236,19 @@
    public void bind(String bindName, String className, String factory, String factoryLocation,
       Map<String, String> refAddr) throws NamingException, FileNotFoundException, XMLStreamException
    {
+      if (LOG.isDebugEnabled())
+      {
+         StringBuilder refAddrString = new StringBuilder();
+         for (Map.Entry<String, String> ent: refAddr.entrySet()) {
+            refAddrString.append(ent.getKey());
+            refAddrString.append('=');
+            refAddrString.append(ent.getValue());
+            refAddrString.append(';');
+         }
+         LOG.debug("Bind: " + bindName + " class-name:" + className + " factory:" + factory + " factoryLocation:" + factoryLocation + 
+            " refAddr:" + refAddrString);
+      }
+      
       binder.bind(bindName, className, factory, factoryLocation, refAddr);
    }
 }



More information about the exo-jcr-commits mailing list