Index: common/classes/com/arjuna/common/internal/util/logging/jboss/JBossLogger.java
===================================================================
--- common/classes/com/arjuna/common/internal/util/logging/jboss/JBossLogger.java	(revision 0)
+++ common/classes/com/arjuna/common/internal/util/logging/jboss/JBossLogger.java	(revision 0)
@@ -0,0 +1,424 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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 com.arjuna.common.internal.util.logging.jboss;
+
+import com.arjuna.common.util.logging.Logi18n;
+import com.arjuna.common.util.logging.DebugLevel;
+import com.arjuna.common.util.logging.VisibilityLevel;
+import com.arjuna.common.util.logging.FacilityCode;
+import org.jboss.logmanager.Logger;
+import org.jboss.logmanager.Level;
+import org.jboss.logmanager.ExtLogRecord;
+
+import java.util.concurrent.atomic.AtomicLong;
+
+public final class JBossLogger implements Logi18n
+{
+   private final Logger logger;
+   private static final String FQCN = JBossLogger.class.getName();
+   private final AtomicLong dl = new AtomicLong();
+   private final AtomicLong vl = new AtomicLong();
+   private final AtomicLong fl = new AtomicLong();
+
+   public JBossLogger(final String categoryName)
+   {
+      logger = Logger.getLogger(categoryName);
+   }
+
+   public JBossLogger(final String categoryName, final String bundleName)
+   {
+      logger = (Logger) Logger.getLogger(categoryName, bundleName);
+   }
+
+   public void addResourceBundle(String bundleName)
+   {
+      // xxx - only the first added bundle will have effect
+      setResourceBundleName(bundleName);
+   }
+
+   public boolean isDebugEnabled()
+   {
+      return logger.isLoggable(Level.DEBUG);
+   }
+
+   public boolean isInfoEnabled()
+   {
+      return logger.isLoggable(Level.INFO);
+   }
+
+   public boolean isWarnEnabled()
+   {
+      return logger.isLoggable(Level.WARN);
+   }
+
+   public boolean isErrorEnabled()
+   {
+      return logger.isLoggable(Level.ERROR);
+   }
+
+   public boolean isFatalEnabled()
+   {
+      return logger.isLoggable(Level.FATAL);
+   }
+
+   public void debug(String key)
+   {
+      logger.log(FQCN, Level.DEBUG, key, null);
+   }
+
+   public void debug(String key, Throwable throwable)
+   {
+      logger.log(FQCN, Level.DEBUG, key, throwable);
+   }
+
+   public void debug(String key, Object[] params)
+   {
+      logger.log(FQCN, Level.DEBUG, key, ExtLogRecord.FormatStyle.MESSAGE_FORMAT, params, null);
+   }
+
+   public void debug(String key, Object[] params, Throwable throwable)
+   {
+      logger.log(FQCN, Level.DEBUG, key, ExtLogRecord.FormatStyle.MESSAGE_FORMAT, params, throwable);
+   }
+
+   public void info(String key)
+   {
+      logger.log(FQCN, Level.INFO, key, null);
+   }
+
+   public void info(String key, Throwable throwable)
+   {
+      logger.log(FQCN, Level.INFO, key, throwable);
+   }
+
+   public void info(String key, Object[] params)
+   {
+      logger.log(FQCN, Level.INFO, key, ExtLogRecord.FormatStyle.MESSAGE_FORMAT, params, null);
+   }
+
+   public void info(String key, Object[] params, Throwable throwable)
+   {
+      logger.log(FQCN, Level.INFO, key, ExtLogRecord.FormatStyle.MESSAGE_FORMAT, params, throwable);
+   }
+
+   public void warn(String key)
+   {
+      logger.log(FQCN, Level.WARN, key, null);
+   }
+
+   public void warn(String key, Throwable throwable)
+   {
+      logger.log(FQCN, Level.WARN, key, throwable);
+   }
+
+   public void warn(String key, Object[] params)
+   {
+      logger.log(FQCN, Level.WARN, key, ExtLogRecord.FormatStyle.MESSAGE_FORMAT, params, null);
+   }
+
+   public void warn(String key, Object[] params, Throwable throwable)
+   {
+      logger.log(FQCN, Level.WARN, key, ExtLogRecord.FormatStyle.MESSAGE_FORMAT, params, throwable);
+   }
+
+   public void error(String key)
+   {
+      logger.log(FQCN, Level.ERROR, key, null);
+   }
+
+   public void error(String key, Throwable throwable)
+   {
+      logger.log(FQCN, Level.ERROR, key, throwable);
+   }
+
+   public void error(String key, Object[] params)
+   {
+      logger.log(FQCN, Level.ERROR, key, ExtLogRecord.FormatStyle.MESSAGE_FORMAT, params, null);
+   }
+
+   public void error(String key, Object[] params, Throwable throwable)
+   {
+      logger.log(FQCN, Level.ERROR, key, ExtLogRecord.FormatStyle.MESSAGE_FORMAT, params, throwable);
+   }
+
+   public void fatal(String key)
+   {
+      logger.log(FQCN, Level.FATAL, key, null);
+   }
+
+   public void fatal(String key, Throwable throwable)
+   {
+      logger.log(FQCN, Level.FATAL, key, throwable);
+   }
+
+   public void fatal(String key, Object[] params)
+   {
+      logger.log(FQCN, Level.FATAL, key, ExtLogRecord.FormatStyle.MESSAGE_FORMAT, params, null);
+   }
+
+   public void fatal(String key, Object[] params, Throwable throwable)
+   {
+      logger.log(FQCN, Level.FATAL, key, ExtLogRecord.FormatStyle.MESSAGE_FORMAT, params, throwable);
+   }
+
+   public void setLevels(long dl, long vl, long fl)
+   {
+      this.dl.set(dl);
+      this.vl.set(vl);
+      this.fl.set(fl);
+   }
+
+   public long getDebugLevel()
+   {
+      return dl.get();
+   }
+
+   public void setDebugLevel(long value)
+   {
+      dl.set(value);
+   }
+
+   public void mergeDebugLevel(long value)
+   {
+      final AtomicLong dl = this.dl;
+      long old;
+      do {
+         old = dl.get();
+      } while (! dl.compareAndSet(old, old | value));
+   }
+
+   public long getVisibilityLevel()
+   {
+      return vl.get();
+   }
+
+   public void setVisibilityLevel(long value)
+   {
+      vl.set(value);
+   }
+
+   public void mergeVisibilityLevel(long value)
+   {
+      final AtomicLong vl = this.vl;
+      long old;
+      do {
+         old = vl.get();
+      } while (! vl.compareAndSet(old, old | value));
+   }
+
+   public long getFacilityCode()
+   {
+      return fl.get();
+   }
+
+   public void setFacilityCode(long value)
+   {
+      fl.set(value);
+   }
+
+   public void mergeFacilityCode(long value)
+   {
+      final AtomicLong fl = this.fl;
+      long old;
+      do {
+         old = fl.get();
+      } while (! fl.compareAndSet(old, old | value));
+   }
+
+   public boolean debugAllowed()
+   {
+      return debugAllowed(DebugLevel.FULL_DEBUGGING, VisibilityLevel.VIS_ALL, FacilityCode.FAC_ALL);
+   }
+
+   public boolean debugAllowed(long dLevel)
+   {
+      return debugAllowed(dLevel, VisibilityLevel.VIS_ALL, FacilityCode.FAC_ALL);
+   }
+
+   public boolean debugAllowed(long dLevel, long vLevel)
+   {
+      return debugAllowed(dLevel, vLevel, FacilityCode.FAC_ALL);
+   }
+
+   public boolean debugAllowed(long dLevel, long vLevel, long fLevel)
+   {
+      return isDebugEnabled()
+            && (dl.get() & dLevel) == dLevel
+            && (vl.get() & vLevel) == vLevel
+            && (fl.get() & fLevel) == fLevel;
+   }
+
+   public void setResourceBundleName(String bundleName)
+   {
+      // todo - make sure the right context is used
+      Logger.getLogger(logger.getName(), bundleName);
+   }
+
+   public void debugb(String baseName, String key)
+   {
+      logger.log(FQCN, Level.DEBUG, key, baseName, ExtLogRecord.FormatStyle.MESSAGE_FORMAT, null, null);
+   }
+
+   public void debugb(String baseName, String key, Throwable throwable)
+   {
+      logger.log(FQCN, Level.DEBUG, key, baseName, ExtLogRecord.FormatStyle.MESSAGE_FORMAT, null, throwable);
+   }
+
+   public void debugb(String baseName, String key, Object[] params)
+   {
+      logger.log(FQCN, Level.DEBUG, key, baseName, ExtLogRecord.FormatStyle.MESSAGE_FORMAT, params, null);
+   }
+
+   public void debugb(String baseName, String key, Object[] params, Throwable throwable)
+   {
+      logger.log(FQCN, Level.DEBUG, key, baseName, ExtLogRecord.FormatStyle.MESSAGE_FORMAT, params, throwable);
+   }
+
+   public void infob(String baseName, String key)
+   {
+      logger.log(FQCN, Level.INFO, key, baseName, ExtLogRecord.FormatStyle.MESSAGE_FORMAT, null, null);
+   }
+
+   public void infob(String baseName, String key, Throwable throwable)
+   {
+      logger.log(FQCN, Level.INFO, key, baseName, ExtLogRecord.FormatStyle.MESSAGE_FORMAT, null, throwable);
+   }
+
+   public void infob(String baseName, String key, Object[] params)
+   {
+      logger.log(FQCN, Level.INFO, key, baseName, ExtLogRecord.FormatStyle.MESSAGE_FORMAT, params, null);
+   }
+
+   public void infob(String baseName, String key, Object[] params, Throwable throwable)
+   {
+      logger.log(FQCN, Level.INFO, key, baseName, ExtLogRecord.FormatStyle.MESSAGE_FORMAT, params, throwable);
+   }
+
+   public void warnb(String baseName, String key)
+   {
+      logger.log(FQCN, Level.WARN, key, baseName, ExtLogRecord.FormatStyle.MESSAGE_FORMAT, null, null);
+   }
+
+   public void warnb(String baseName, String key, Throwable throwable)
+   {
+      logger.log(FQCN, Level.WARN, key, baseName, ExtLogRecord.FormatStyle.MESSAGE_FORMAT, null, throwable);
+   }
+
+   public void warnb(String baseName, String key, Object[] params)
+   {
+      logger.log(FQCN, Level.WARN, key, baseName, ExtLogRecord.FormatStyle.MESSAGE_FORMAT, params, null);
+   }
+
+   public void warnb(String baseName, String key, Object[] params, Throwable throwable)
+   {
+      logger.log(FQCN, Level.WARN, key, baseName, ExtLogRecord.FormatStyle.MESSAGE_FORMAT, params, throwable);
+   }
+
+   public void errorb(String baseName, String key)
+   {
+      logger.log(FQCN, Level.ERROR, key, baseName, ExtLogRecord.FormatStyle.MESSAGE_FORMAT, null, null);
+   }
+
+   public void errorb(String baseName, String key, Throwable throwable)
+   {
+      logger.log(FQCN, Level.ERROR, key, baseName, ExtLogRecord.FormatStyle.MESSAGE_FORMAT, null, throwable);
+   }
+
+   public void errorb(String baseName, String key, Object[] params)
+   {
+      logger.log(FQCN, Level.ERROR, key, baseName, ExtLogRecord.FormatStyle.MESSAGE_FORMAT, params, null);
+   }
+
+   public void errorb(String baseName, String key, Object[] params, Throwable throwable)
+   {
+      logger.log(FQCN, Level.ERROR, key, baseName, ExtLogRecord.FormatStyle.MESSAGE_FORMAT, params, throwable);
+   }
+
+   public void fatalb(String baseName, String key)
+   {
+      logger.log(FQCN, Level.FATAL, key, baseName, ExtLogRecord.FormatStyle.MESSAGE_FORMAT, null, null);
+   }
+
+   public void fatalb(String baseName, String key, Throwable throwable)
+   {
+      logger.log(FQCN, Level.FATAL, key, baseName, ExtLogRecord.FormatStyle.MESSAGE_FORMAT, null, throwable);
+   }
+
+   public void fatalb(String baseName, String key, Object[] params)
+   {
+      logger.log(FQCN, Level.FATAL, key, baseName, ExtLogRecord.FormatStyle.MESSAGE_FORMAT, params, null);
+   }
+
+   public void fatalb(String baseName, String key, Object[] params, Throwable throwable)
+   {
+      logger.log(FQCN, Level.FATAL, key, baseName, ExtLogRecord.FormatStyle.MESSAGE_FORMAT, params, throwable);
+   }
+
+   public void debug(long dl, long vl, long fl, String key)
+   {
+      if (debugAllowed(dl, vl, fl)) {
+         debug(key);
+      }
+   }
+
+   public void debug(long dl, long vl, long fl, String key, Throwable throwable)
+   {
+      if (debugAllowed(dl, vl, fl)) {
+         debug(key, throwable);
+      }
+   }
+
+   public void debug(long dl, long vl, long fl, String key, Object[] params)
+   {
+      if (debugAllowed(dl, vl, fl)) {
+         debug(key, params);
+      }
+   }
+
+   public void debug(long dl, long vl, long fl, String key, Object[] params, Throwable throwable)
+   {
+      if (debugAllowed(dl, vl, fl)) {
+         debug(key, params, throwable);
+      }
+   }
+
+   public String getString(String key)
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   public String getString(String key, Object[] params)
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   public String getString(String base, String key)
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   public String getString(String base, String key, Object[] params)
+   {
+      throw new UnsupportedOperationException();
+   }
+}
