[jboss-cvs] JBossAS SVN: r111512 - in projects/jboss-jca/trunk: core and 5 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jun 2 15:31:47 EDT 2011


Author: jesper.pedersen
Date: 2011-06-02 15:31:45 -0400 (Thu, 02 Jun 2011)
New Revision: 111512

Added:
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/CoreLogger.java
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/package.html
   projects/jboss-jca/trunk/doc/userguide/en-US/modules/logging.xml
Modified:
   projects/jboss-jca/trunk/build.xml
   projects/jboss-jca/trunk/core/build.xml
   projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/ccm/CachedConnectionManagerImpl.java
   projects/jboss-jca/trunk/deployers/build.xml
   projects/jboss-jca/trunk/doc/userguide/en-US/userguide.xml
Log:
[JBJCA-592] i18n/l10n logging (Part 2)

Modified: projects/jboss-jca/trunk/build.xml
===================================================================
--- projects/jboss-jca/trunk/build.xml	2011-06-02 15:03:13 UTC (rev 111511)
+++ projects/jboss-jca/trunk/build.xml	2011-06-02 19:31:45 UTC (rev 111512)
@@ -497,9 +497,10 @@
     <checkstyle config="${tools.dir}/checkstyle/checkstyle.xml"
                 failOnViolation="false"
                 classpathref="checkstyle.lib.path.id">
-      <fileset dir="${basedir}"
-               includes="**/*.java"
-	       excludes="${build.dir}/**/*.java"/>
+      <fileset dir="${basedir}">
+        <include name="**/*.java"/>
+        <exclude name="build/**/*.java"/>
+      </fileset>
       <formatter type="plain"/>
       <formatter type="xml" toFile="${reports.dir}/checkstyle/checkstyle-result.xml"/>
     </checkstyle>

Modified: projects/jboss-jca/trunk/core/build.xml
===================================================================
--- projects/jboss-jca/trunk/core/build.xml	2011-06-02 15:03:13 UTC (rev 111511)
+++ projects/jboss-jca/trunk/core/build.xml	2011-06-02 19:31:45 UTC (rev 111512)
@@ -43,6 +43,7 @@
            optimize="${javac.optimize}"
            includeAntRuntime="false">
       <compilerarg value="-Xlint"/>
+      <compilerarg value="-AgeneratedTranslationFilesPath=${build.core.dir}/impl"/>
     </javac> 
 
     <copy file="src/main/java/org/jboss/jca/Version.java.in"

Added: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/CoreLogger.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/CoreLogger.java	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/CoreLogger.java	2011-06-02 19:31:45 UTC (rev 111512)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jca.core;
+
+import org.jboss.logging.BasicLogger;
+import org.jboss.logging.Cause;
+import org.jboss.logging.LogMessage;
+import org.jboss.logging.Message;
+import org.jboss.logging.MessageLogger;
+
+import static org.jboss.logging.Logger.Level.ERROR;
+import static org.jboss.logging.Logger.Level.INFO;
+import static org.jboss.logging.Logger.Level.WARN;
+
+/**
+ * The core logger.
+ *
+ * Message ids ranging from 00001 to 05000 inclusively.
+ */
+ at MessageLogger(projectCode = "IJ")
+public interface CoreLogger extends BasicLogger
+{
+
+   // CACHED CONNECTION MANAGER (100)
+
+   /**
+    * Closing connection
+    * @param handle The hande
+    */
+   @LogMessage(level = INFO)
+   @Message(id = 100, value = "Closing a connection for you.  Please close them yourself: %s")
+   public void closingConnection(Object handle);
+
+   /**
+    * Closing connection
+    * @param handle The hande
+    * @param t The exception
+    */
+   @LogMessage(level = INFO)
+   public void closingConnection(Object handle, @Cause Throwable t);
+
+   /**
+    * Closing connection results in throwable
+    * @param t The exception
+    */
+   @LogMessage(level = INFO)
+   @Message(id = 102, value = "Throwable trying to close a connection for you, please close it yourself")
+   public void closingConnectionThrowable(@Cause Throwable t);
+
+   /**
+    * No close method for closing connection
+    * @param clz The class name
+    */
+   @LogMessage(level = INFO)
+   @Message(id = 103, value = "Could not find a close method on alleged connection object (%s). " +
+            "Please close your own connections.")
+   public void closingConnectionNoClose(String clz);
+}

Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/ccm/CachedConnectionManagerImpl.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/ccm/CachedConnectionManagerImpl.java	2011-06-02 15:03:13 UTC (rev 111511)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/ccm/CachedConnectionManagerImpl.java	2011-06-02 19:31:45 UTC (rev 111512)
@@ -21,6 +21,7 @@
  */
 package org.jboss.jca.core.connectionmanager.ccm;
 
+import org.jboss.jca.core.CoreLogger;
 import org.jboss.jca.core.api.connectionmanager.ccm.CachedConnectionManager;
 import org.jboss.jca.core.connectionmanager.ConnectionRecord;
 import org.jboss.jca.core.connectionmanager.listener.ConnectionCacheListener;
@@ -59,7 +60,11 @@
 public class CachedConnectionManagerImpl implements CachedConnectionManager
 {
    /** Log instance */
-   private static Logger log = Logger.getLogger(CachedConnectionManagerImpl.class);
+   private static CoreLogger log = Logger.getMessageLogger(CoreLogger.class, 
+                                                           CachedConnectionManager.class.getName());
+   
+   /** Trace */
+   private static boolean trace = log.isTraceEnabled();
 
    /** Debugging flag */
    private boolean debug = false;
@@ -137,7 +142,8 @@
    {
       KeyConnectionAssociation key = peekMetaAwareObject();
 
-      log.tracef("user tx started, key: %s", key);
+      if (trace)
+         log.tracef("user tx started, key: %s", key);
 
       if (key != null)
       {
@@ -186,7 +192,8 @@
       LinkedList<Object> stack = currentObjects.get();
       KeyConnectionAssociation oldKey = (KeyConnectionAssociation) stack.removeLast();
 
-      log.tracef("popped object: %s", Strings.defaultToString(oldKey));
+      if (trace)
+         log.tracef("popped object: %s", Strings.defaultToString(oldKey));
 
       if (!stack.contains(oldKey))
       {
@@ -223,7 +230,9 @@
 
       KeyConnectionAssociation key = peekMetaAwareObject();
 
-      log.tracef("registering connection from connection manager: %s, connection : %s, key: %s", cm, connection, key);
+      if (trace)
+         log.tracef("registering connection from connection manager: %s, connection : %s, key: %s",
+                    cm, connection, key);
 
       if (key != null)
       {
@@ -266,7 +275,9 @@
 
       KeyConnectionAssociation key = peekMetaAwareObject();
 
-      log.tracef("unregistering connection from connection manager: %s, connection: %s, key: %s", cm, connection, key);
+      if (trace)
+         log.tracef("unregistering connection from connection manager: %s, connection: %s, key: %s",
+                    cm, connection, key);
 
       if (key == null)
          return;
@@ -303,14 +314,16 @@
       LinkedList<Object> stack = currentObjects.get();
       if (stack == null)
       {
-         log.tracef("new stack for key: %s", Strings.defaultToString(rawKey));
+         if (trace)
+            log.tracef("new stack for key: %s", Strings.defaultToString(rawKey));
 
          stack = new LinkedList<Object>();
          currentObjects.set(stack);
       }
       else
       {
-         log.tracef("old stack for key: %s", Strings.defaultToString(rawKey));
+         if (trace)
+            log.tracef("old stack for key: %s", Strings.defaultToString(rawKey));
       }
 
       KeyConnectionAssociation key = new KeyConnectionAssociation(rawKey);
@@ -399,7 +412,8 @@
     */
    public void unregisterConnectionCacheListener(ConnectionCacheListener cm)
    {
-      log.tracef("unregisterConnectionCacheListener: %s", cm);
+      if (trace)
+         log.tracef("unregisterConnectionCacheListener: %s", cm);
 
       Iterator<ConcurrentMap<ConnectionCacheListener, CopyOnWriteArrayList<ConnectionRecord>>> it =
          objectToConnectionManagerMap.values().iterator();
@@ -517,23 +531,23 @@
          {
             if (exception != null)
             {
-               log.info("Closing a connection for you.  Please close them yourself: " + connectionHandle, exception);
+               log.closingConnection(connectionHandle, exception);
             }
             else
             {
-               log.info("Closing a connection for you.  Please close them yourself: " + connectionHandle);
+               log.closingConnection(connectionHandle);
             }
 
             m.invoke(connectionHandle, new Object[]{});
          }
          catch (Throwable t)
          {
-            log.info("Throwable trying to close a connection for you, please close it yourself", t);
+            log.closingConnectionThrowable(t);
          }
       }
       catch (NoSuchMethodException nsme)
       {
-         log.info("Could not find a close method on alleged connection objects.  Please close your own connections.");
+         log.closingConnectionNoClose(connectionHandle.getClass().getName());
       }
    }
 

Added: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/package.html
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/package.html	                        (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/package.html	2011-06-02 19:31:45 UTC (rev 111512)
@@ -0,0 +1,3 @@
+<body>
+Top level classes for the core module.
+</body>

Modified: projects/jboss-jca/trunk/deployers/build.xml
===================================================================
--- projects/jboss-jca/trunk/deployers/build.xml	2011-06-02 15:03:13 UTC (rev 111511)
+++ projects/jboss-jca/trunk/deployers/build.xml	2011-06-02 19:31:45 UTC (rev 111512)
@@ -59,7 +59,7 @@
          indexMetaInf="true"
          update="true"
          level="9"
-         includes="**/common/**">
+         excludes="**/fungal/**">
       <manifest>
         <attribute name="Implementation-Title" value="IronJacamar Deployers - Common"/>
         <attribute name="Implementation-Version" value="${major}.${minor}.${patch}.${type}"/>

Added: projects/jboss-jca/trunk/doc/userguide/en-US/modules/logging.xml
===================================================================
--- projects/jboss-jca/trunk/doc/userguide/en-US/modules/logging.xml	                        (rev 0)
+++ projects/jboss-jca/trunk/doc/userguide/en-US/modules/logging.xml	2011-06-02 19:31:45 UTC (rev 111512)
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<appendix id="logging_codes">
+  <title>Logging codes</title>
+
+  <section id="logging_codes_core">
+    <title>Core: 00001 - 05000</title>
+
+    <table frame="all">
+      <title>Logging codes for core</title>
+      <tgroup cols="3" align="left" colsep="1" rowsep="1">
+        <colspec colname="c1" colwidth="*"/>
+        <colspec colname="c2" colwidth="*"/>
+        <colspec colname="c3" colwidth="6*"/>
+        <thead>
+          <row>
+            <entry align="left">Code</entry>
+            <entry align="left">Level</entry>
+            <entry align="left">Description</entry>
+          </row>
+        </thead>
+        <tbody>
+          <row>
+            <entry>00100</entry>
+            <entry><code>INFO</code></entry>
+            <entry></entry>
+          </row>
+          <row>
+            <entry>00101</entry>
+            <entry><code>INFO</code></entry>
+            <entry></entry>
+          </row>
+          <row>
+            <entry>00102</entry>
+            <entry><code>INFO</code></entry>
+            <entry></entry>
+          </row>
+          <row>
+            <entry>00103</entry>
+            <entry><code>INFO</code></entry>
+            <entry></entry>
+          </row>
+        </tbody>
+      </tgroup>
+    </table>
+  </section>
+
+  <section id="logging_codes_common">
+    <title>Common: 05001 - 10000</title>
+
+    <table frame="all">
+      <title>Logging codes for common</title>
+      <tgroup cols="3" align="left" colsep="1" rowsep="1">
+        <colspec colname="c1" colwidth="*"/>
+        <colspec colname="c2" colwidth="*"/>
+        <colspec colname="c3" colwidth="6*"/>
+        <thead>
+          <row>
+            <entry align="left">Code</entry>
+            <entry align="left">Level</entry>
+            <entry align="left">Description</entry>
+          </row>
+        </thead>
+        <tbody>
+          <row>
+            <entry>05001</entry>
+            <entry></entry>
+            <entry></entry>
+          </row>
+        </tbody>
+      </tgroup>
+    </table>
+  </section>
+
+  <section id="logging_codes_deployers">
+    <title>Deployers: 10001 - 15000</title>
+
+    <table frame="all">
+      <title>Logging codes for common</title>
+      <tgroup cols="3" align="left" colsep="1" rowsep="1">
+        <colspec colname="c1" colwidth="*"/>
+        <colspec colname="c2" colwidth="*"/>
+        <colspec colname="c3" colwidth="6*"/>
+        <thead>
+          <row>
+            <entry align="left">Code</entry>
+            <entry align="left">Level</entry>
+            <entry align="left">Description</entry>
+          </row>
+        </thead>
+        <tbody>
+          <row>
+            <entry>10001</entry>
+            <entry></entry>
+            <entry></entry>
+          </row>
+        </tbody>
+      </tgroup>
+    </table>
+  </section>
+
+  <section id="logging_codes_adapters">
+    <title>Adapters: 90001 - 99999</title>
+
+    <table frame="all">
+      <title>Logging codes for common</title>
+      <tgroup cols="3" align="left" colsep="1" rowsep="1">
+        <colspec colname="c1" colwidth="*"/>
+        <colspec colname="c2" colwidth="*"/>
+        <colspec colname="c2" colwidth="6*"/>
+        <thead>
+          <row>
+            <entry align="left">Code</entry>
+            <entry align="left">Level</entry>
+            <entry align="left">Description</entry>
+          </row>
+        </thead>
+        <tbody>
+          <row>
+            <entry>90001</entry>
+            <entry></entry>
+            <entry></entry>
+          </row>
+        </tbody>
+      </tgroup>
+    </table>
+  </section>
+
+</appendix>

Modified: projects/jboss-jca/trunk/doc/userguide/en-US/userguide.xml
===================================================================
--- projects/jboss-jca/trunk/doc/userguide/en-US/userguide.xml	2011-06-02 15:03:13 UTC (rev 111511)
+++ projects/jboss-jca/trunk/doc/userguide/en-US/userguide.xml	2011-06-02 19:31:45 UTC (rev 111512)
@@ -17,6 +17,7 @@
         <!ENTITY schemas SYSTEM "modules/schemas.xml">
         <!ENTITY sample SYSTEM "modules/sample.xml">
         <!ENTITY datasources SYSTEM "modules/datasources.xml">
+        <!ENTITY logging SYSTEM "modules/logging.xml">
         ]>
 <book lang="en">
    <bookinfo>
@@ -66,4 +67,6 @@
 
    &datasources;
 
+   &logging;
+
 </book>



More information about the jboss-cvs-commits mailing list