Commits

Justin Koke committed dff0327

Move to SLF4j and also further pom clean up.

The dependencies in the test pom are now being managed by dependencyManagement in the parent POM, also
I have moved the framework to SLF4j and removed the dependency on commons-logging.

  • Participants
  • Parent commits a73cc73

Comments (0)

Files changed (24)

 			<groupId>commons-lang</groupId>
 			<artifactId>commons-lang</artifactId>
 		</dependency>
-		<dependency>
-			<groupId>commons-logging</groupId>
-			<artifactId>commons-logging</artifactId>
-		</dependency>
-		<dependency>
-			<groupId>log4j</groupId>
-			<artifactId>log4j</artifactId>
-			<scope>runtime</scope>
-		</dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>

api/src/main/java/com/opensymphony/module/propertyset/PropertySet.aegis.xml

-<mappings>
-  <mapping>
-    <method name="getKeys">
-      <return-type componentType="java.lang.String" />
-    </method>
-    <property name="schema" ignore="true" />
-  </mapping>
-</mappings>

api/src/main/java/com/opensymphony/module/propertyset/config/PropertySetConfig.java

 package com.opensymphony.module.propertyset.config;
 
 import org.apache.commons.lang.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.w3c.dom.*;
-
+import org.slf4j.LoggerFactory;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
 import org.xml.sax.SAXException;
 
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
 import java.io.IOException;
 import java.io.InputStream;
-
 import java.net.URL;
-
 import java.util.HashMap;
 import java.util.Map;
 
-import javax.xml.parsers.*;
-
 
 /**
  * DOCUMENT ME!
  * @author $author$
  * @version $Revision$
  */
-public class PropertySetConfig {
+public class PropertySetConfig
+{
     //~ Static fields/initializers /////////////////////////////////////////////
 
-    private static final Log logger = LogFactory.getLog(PropertySetConfig.class);
+    private static final org.slf4j.Logger logger = LoggerFactory.getLogger(PropertySetConfig.class);
+
     private static PropertySetConfig config;
     private static final Object lock = new Object();
-    private static final String[] CONFIG_LOCATIONS = new String[] {
-        "propertyset.xml", "/propertyset.xml", "META-INF/propertyset.xml",
-        "/META-INF/propertyset.xml", "META-INF/propertyset-default.xml",
-        "/META-INF/propertyset-default.xml"
+    private static final String[] CONFIG_LOCATIONS = new String[]{
+            "propertyset.xml", "/propertyset.xml", "META-INF/propertyset.xml",
+            "/META-INF/propertyset.xml", "META-INF/propertyset-default.xml",
+            "/META-INF/propertyset-default.xml"
     };
 
     //~ Instance fields ////////////////////////////////////////////////////////
 
     //~ Constructors ///////////////////////////////////////////////////////////
 
-    private PropertySetConfig() {
+    private PropertySetConfig()
+    {
         InputStream is = load();
 
         DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
 
         DocumentBuilder db = null;
 
-        try {
+        try
+        {
             db = dbf.newDocumentBuilder();
-        } catch (ParserConfigurationException e) {
+        }
+        catch (ParserConfigurationException e)
+        {
             e.printStackTrace();
         }
 
         Document doc = null;
 
-        try {
+        try
+        {
             doc = db.parse(is);
-        } catch (SAXException e) {
+        }
+        catch (SAXException e)
+        {
             e.printStackTrace();
-        } catch (IOException e) {
+        }
+        catch (IOException e)
+        {
             e.printStackTrace();
-        } finally {
+        }
+        finally
+        {
             //close the input stream
-            if (is != null) {
-                try {
+            if (is != null)
+            {
+                try
+                {
                     is.close();
-                } catch (IOException e) { /* ignore */
+                }
+                catch (IOException e)
+                { /* ignore */
                 }
             }
         }
         Element root = (Element) doc.getElementsByTagName("propertysets").item(0);
         NodeList propertySets = root.getElementsByTagName("propertyset");
 
-        for (int i = 0; i < propertySets.getLength(); i++) {
+        for (int i = 0; i < propertySets.getLength(); i++)
+        {
             Element propertySet = (Element) propertySets.item(i);
             String name = propertySet.getAttribute("name");
             String clazz = propertySet.getAttribute("class");
             NodeList args = propertySet.getElementsByTagName("arg");
             HashMap argsMap = new HashMap();
 
-            for (int j = 0; j < args.getLength(); j++) {
+            for (int j = 0; j < args.getLength(); j++)
+            {
                 Element arg = (Element) args.item(j);
                 String argName = arg.getAttribute("name");
                 String argValue = arg.getAttribute("value");
 
     //~ Methods ////////////////////////////////////////////////////////////////
 
-    public static PropertySetConfig getConfig() {
+    public static PropertySetConfig getConfig()
+    {
         // check one more time, another thread may have finished
-        synchronized (lock) {
-            if (config == null) {
+        synchronized (lock)
+        {
+            if (config == null)
+            {
                 config = new PropertySetConfig();
             }
 
         }
     }
 
-    public Map getArgs(String name) {
+    public Map getArgs(String name)
+    {
         return (Map) propertySetArgs.get(name);
     }
 
-    public String getClassName(String name) {
+    public String getClassName(String name)
+    {
         return (String) propertySets.get(name);
     }
 
     /**
-    * Load a given resource.
-    *
-    * This method will try to load the resource using the following methods (in order):
-    * <ul>
-    *  <li>From Thread.currentThread().getContextClassLoader()
-    *  <li>From ClassLoaderUtil.class.getClassLoader()
-    *  <li>callingClass.getClassLoader()
-    * </ul>
-    *
-    * @param resourceName The name of the resource to load
-    * @param callingClass The Class object of the calling object
-    */
-    public static URL getResource(String resourceName, Class callingClass) {
+     * Load a given resource.
+     * <p/>
+     * This method will try to load the resource using the following methods (in order):
+     * <ul>
+     * <li>From Thread.currentThread().getContextClassLoader()
+     * <li>From ClassLoaderUtil.class.getClassLoader()
+     * <li>callingClass.getClassLoader()
+     * </ul>
+     *
+     * @param resourceName The name of the resource to load
+     * @param callingClass The Class object of the calling object
+     */
+    public static URL getResource(String resourceName, Class callingClass)
+    {
         URL url = Thread.currentThread().getContextClassLoader().getResource(resourceName);
 
-        if (url == null) {
+        if (url == null)
+        {
             url = PropertySetConfig.class.getClassLoader().getResource(resourceName);
         }
 
-        if (url == null) {
+        if (url == null)
+        {
             ClassLoader cl = callingClass.getClassLoader();
 
-            if (cl != null) {
+            if (cl != null)
+            {
                 url = cl.getResource(resourceName);
             }
         }
 
-        if ((url == null) && (resourceName != null) && (resourceName.charAt(0) != '/')) {
+        if ((url == null) && (resourceName != null) && (resourceName.charAt(0) != '/'))
+        {
             return getResource('/' + resourceName, callingClass);
         }
 
     /**
      * Load the config from locations found in {@link #CONFIG_LOCATIONS}
      *
-     * @return  An inputstream to load from
-     * @throws IllegalArgumentException     If none of the config files could be found.
+     * @return An inputstream to load from
+     * @throws IllegalArgumentException If none of the config files could be found.
      */
-    private InputStream load() throws IllegalArgumentException {
-        if (logger.isDebugEnabled()) {
+    private InputStream load() throws IllegalArgumentException
+    {
+        if (logger.isDebugEnabled())
+        {
             logger.debug("Loading configuration from specified locations...");
         }
         InputStream is = null;
 
-        for (int i = 0; i < CONFIG_LOCATIONS.length; i++) {
+        for (int i = 0; i < CONFIG_LOCATIONS.length; i++)
+        {
             String location = CONFIG_LOCATIONS[i];
-            if (logger.isDebugEnabled()) {
+            if (logger.isDebugEnabled())
+            {
                 logger.debug("Attempting to load configuration from '" + location + "'");
             }
 
-            try {
+            try
+            {
                 URL resource = getResource(location, this.getClass());
 
-                if (resource != null) {
+                if (resource != null)
+                {
                     is = resource.openStream();
                 }
 
                 //if we have found something then stop looking
-                if (is != null) {
+                if (is != null)
+                {
                     return is;
                 }
-            } catch (Exception e) {
-                if (logger.isDebugEnabled()) {
+            }
+            catch (Exception e)
+            {
+                if (logger.isDebugEnabled())
+                {
                     logger.error("Failed to load configuration from location '" + location + "'", e);
                 }
             }
         }
 
-        if (is == null) {
+        if (is == null)
+        {
             String exceptionMessage = "Could not load PropertySet configuration from the specified locations: '" + StringUtils.join(CONFIG_LOCATIONS, ',') + "'.  Please verify that the configuration file is in your classpath.";
             throw new IllegalArgumentException(exceptionMessage);
         }

api/src/main/resources/PropertySet.aegis.xml

+<mappings>
+  <mapping>
+    <method name="getKeys">
+      <return-type componentType="java.lang.String" />
+    </method>
+    <property name="schema" ignore="true" />
+  </mapping>
+</mappings>
 			<classifier>tests</classifier>
 		</dependency>
         <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+        <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
             <scope>test</scope>

core/src/main/java/com/opensymphony/module/propertyset/aggregate/AggregatePropertySet.java

  */
 package com.opensymphony.module.propertyset.aggregate;
 
-import com.opensymphony.module.propertyset.*;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
+import com.opensymphony.module.propertyset.AbstractPropertySet;
+import com.opensymphony.module.propertyset.PropertyException;
+import com.opensymphony.module.propertyset.PropertySet;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.w3c.dom.Document;
 
 import java.io.Serializable;
-
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
 
 
 /**
  * Tried each of the propertysets to find a value, tries to be
  * as fault tolerant as possible, in that when any error occurs,
  * it simply tries the operation on the next set.
- * <p>
- *
+ * <p/>
+ * <p/>
  * <b>Optional Args</b>
  * <ul>
- *  <li><b>PropertySets</b> - a List of PropertySet</li>
+ * <li><b>PropertySets</b> - a List of PropertySet</li>
  * </ul>
- *
+ * <p/>
  * Date: Dec 16, 2001
  * Time: 11:28:06 PM
+ *
  * @author Hani Suleiman
  */
-public class AggregatePropertySet extends AbstractPropertySet implements Serializable {
+public class AggregatePropertySet extends AbstractPropertySet implements Serializable
+{
     //~ Static fields/initializers /////////////////////////////////////////////
 
-    private static final Log log = LogFactory.getLog(AggregatePropertySet.class);
+    private static final Logger log = LoggerFactory.getLogger(AggregatePropertySet.class);
 
     //~ Instance fields ////////////////////////////////////////////////////////
 
 
     //~ Methods ////////////////////////////////////////////////////////////////
 
-    public Collection getKeys(String prefix, int type) throws PropertyException {
+    public Collection getKeys(String prefix, int type) throws PropertyException
+    {
         Iterator i = propertySets.iterator();
         Collection keys = new ArrayList();
 
-        while (i.hasNext()) {
+        while (i.hasNext())
+        {
             PropertySet set = (PropertySet) i.next();
 
-            try {
+            try
+            {
                 keys.addAll(set.getKeys(prefix, type));
-            } catch (PropertyException ex) {
+            }
+            catch (PropertyException ex)
+            {
                 //we don't really care about these here
             }
         }
         return keys;
     }
 
-    public boolean isSettable(String property) {
+    public boolean isSettable(String property)
+    {
         Iterator i = propertySets.iterator();
 
-        while (i.hasNext()) {
+        while (i.hasNext())
+        {
             PropertySet set = (PropertySet) i.next();
 
-            if (set.isSettable(property)) {
+            if (set.isSettable(property))
+            {
                 return true;
             }
         }
      * other propertysets might also define this key, but
      * they would not be checked.
      */
-    public int getType(String key) throws PropertyException {
+    public int getType(String key) throws PropertyException
+    {
         Iterator i = propertySets.iterator();
 
-        while (i.hasNext()) {
+        while (i.hasNext())
+        {
             PropertySet set = (PropertySet) i.next();
 
-            try {
+            try
+            {
                 return set.getType(key);
-            } catch (PropertyException ex) {
+            }
+            catch (PropertyException ex)
+            {
                 if (
                     //we don't really care about these
-                    log.isDebugEnabled()) {
+                        log.isDebugEnabled())
+                {
                     //we don't really care about these
                     log.debug("Error checking type of " + key + ":" + ex);
                 }
         throw new PropertyException("No key " + key + " found");
     }
 
-    public void addPropertySet(PropertySet propertySet) {
+    public void addPropertySet(PropertySet propertySet)
+    {
         propertySets.add(propertySet);
     }
 
-    public boolean exists(String key) throws PropertyException {
+    public boolean exists(String key) throws PropertyException
+    {
         Iterator i = propertySets.iterator();
 
-        while (i.hasNext()) {
+        while (i.hasNext())
+        {
             PropertySet set = (PropertySet) i.next();
 
-            try {
-                if (set.exists(key)) {
+            try
+            {
+                if (set.exists(key))
+                {
                     return true;
                 }
-            } catch (PropertyException ex) {
+            }
+            catch (PropertyException ex)
+            {
                 log.warn("Error " + ex + " exists(" + key + ") on " + set);
             }
         }
         return false;
     }
 
-    public void init(Map config, Map args) {
+    public void init(Map config, Map args)
+    {
         // TODO document configuration
         propertySets = (List) args.get("PropertySets");
 
-        if (propertySets == null) {
+        if (propertySets == null)
+        {
             propertySets = new ArrayList();
         }
     }
 
-    public void remove() throws PropertyException {
-        if (propertySets != null) {
+    public void remove() throws PropertyException
+    {
+        if (propertySets != null)
+        {
             Iterator iter = propertySets.iterator();
 
-            while (iter.hasNext()) {
+            while (iter.hasNext())
+            {
                 PropertySet ps = (PropertySet) iter.next();
                 ps.remove();
             }
         }
     }
 
-    public void remove(String key) throws PropertyException {
+    public void remove(String key) throws PropertyException
+    {
         Iterator i = propertySets.iterator();
 
-        while (i.hasNext()) {
+        while (i.hasNext())
+        {
             PropertySet set = (PropertySet) i.next();
 
-            try {
+            try
+            {
                 set.remove(key);
-            } catch (PropertyException ex) {
+            }
+            catch (PropertyException ex)
+            {
                 if (
                     //we don't really care about these
-                    log.isDebugEnabled()) {
+                        log.isDebugEnabled())
+                {
                     //we don't really care about these
                     log.debug("Error removing property " + key + ":" + ex);
                 }
      * Note that this method returns at the FIRST successful set call,
      * rather than setting the same property on all the propertysets.
      */
-    protected void setImpl(int type, String key, Object value) throws PropertyException {
+    protected void setImpl(int type, String key, Object value) throws PropertyException
+    {
         Iterator i = propertySets.iterator();
 
-        while (i.hasNext()) {
+        while (i.hasNext())
+        {
             PropertySet set = (PropertySet) i.next();
 
-            try {
-                if (set.isSettable(key)) {
-                    switch (type) {
-                    case BOOLEAN:
-                        set.setBoolean(key, ((Boolean) value).booleanValue());
+            try
+            {
+                if (set.isSettable(key))
+                {
+                    switch (type)
+                    {
+                        case BOOLEAN:
+                            set.setBoolean(key, ((Boolean) value).booleanValue());
 
-                        return;
+                            return;
 
-                    case INT:
-                        set.setInt(key, ((Number) value).intValue());
+                        case INT:
+                            set.setInt(key, ((Number) value).intValue());
 
-                        return;
+                            return;
 
-                    case LONG:
-                        set.setLong(key, ((Number) value).longValue());
+                        case LONG:
+                            set.setLong(key, ((Number) value).longValue());
 
-                        return;
+                            return;
 
-                    case DOUBLE:
-                        set.setDouble(key, ((Number) value).doubleValue());
+                        case DOUBLE:
+                            set.setDouble(key, ((Number) value).doubleValue());
 
-                        return;
+                            return;
 
-                    case STRING:
-                        set.setString(key, (String) value);
+                        case STRING:
+                            set.setString(key, (String) value);
 
-                        return;
+                            return;
 
-                    case TEXT:
-                        set.setText(key, (String) value);
+                        case TEXT:
+                            set.setText(key, (String) value);
 
-                        return;
+                            return;
 
-                    case DATE:
-                        set.setDate(key, (Date) value);
+                        case DATE:
+                            set.setDate(key, (Date) value);
 
-                        return;
+                            return;
 
-                    case OBJECT:
-                        set.setObject(key, value);
+                        case OBJECT:
+                            set.setObject(key, value);
 
-                        return;
+                            return;
 
-                    case XML:
-                        set.setXML(key, (Document) value);
+                        case XML:
+                            set.setXML(key, (Document) value);
 
-                        return;
+                            return;
 
-                    case DATA:
-                        set.setData(key, (byte[]) value);
+                        case DATA:
+                            set.setData(key, (byte[]) value);
 
-                        return;
+                            return;
                     }
                 }
-            } catch (PropertyException ex) {
+            }
+            catch (PropertyException ex)
+            {
                 //we don't care about these here, sadly
             }
         }
     }
 
-    protected Object get(int type, String key) throws PropertyException {
+    protected Object get(int type, String key) throws PropertyException
+    {
         Iterator i = propertySets.iterator();
 
-        while (i.hasNext()) {
+        while (i.hasNext())
+        {
             PropertySet set = (PropertySet) i.next();
 
-            try {
+            try
+            {
                 //poo, since set.get() is protected, we have to double back
                 //on ourselves and call getXXX(), which in turn will call get
-                switch (type) {
-                case BOOLEAN:
+                switch (type)
+                {
+                    case BOOLEAN:
 
-                    boolean bool = set.getBoolean(key);
+                        boolean bool = set.getBoolean(key);
 
-                    if (bool) {
-                        return Boolean.TRUE;
-                    }
+                        if (bool)
+                        {
+                            return Boolean.TRUE;
+                        }
 
-                    //If we have false, we need to check if it's missing
-                    //property or if it's actually false
-                    if (set.exists(key)) {
-                        return Boolean.FALSE;
-                    }
+                        //If we have false, we need to check if it's missing
+                        //property or if it's actually false
+                        if (set.exists(key))
+                        {
+                            return Boolean.FALSE;
+                        }
 
-                    break;
+                        break;
 
-                case INT:
+                    case INT:
 
-                    int maybeInt = set.getInt(key);
+                        int maybeInt = set.getInt(key);
 
-                    if (maybeInt != 0) {
-                        return new Integer(maybeInt);
-                    }
+                        if (maybeInt != 0)
+                        {
+                            return new Integer(maybeInt);
+                        }
 
-                    break;
+                        break;
 
-                case LONG:
+                    case LONG:
 
-                    long maybeLong = set.getLong(key);
+                        long maybeLong = set.getLong(key);
 
-                    if (maybeLong != 0) {
-                        return new Long(maybeLong);
-                    }
+                        if (maybeLong != 0)
+                        {
+                            return new Long(maybeLong);
+                        }
 
-                    break;
+                        break;
 
-                case DOUBLE:
+                    case DOUBLE:
 
-                    double maybeDouble = set.getDouble(key);
+                        double maybeDouble = set.getDouble(key);
 
-                    if (maybeDouble != 0) {
-                        return new Double(maybeDouble);
-                    }
+                        if (maybeDouble != 0)
+                        {
+                            return new Double(maybeDouble);
+                        }
 
-                    break;
+                        break;
 
-                case STRING:
+                    case STRING:
 
-                    String string = set.getString(key);
+                        String string = set.getString(key);
 
-                    if (string != null) {
-                        return string;
-                    }
+                        if (string != null)
+                        {
+                            return string;
+                        }
 
-                    break;
+                        break;
 
-                case TEXT:
+                    case TEXT:
 
-                    String text = set.getText(key);
+                        String text = set.getText(key);
 
-                    if (text != null) {
-                        return text;
-                    }
+                        if (text != null)
+                        {
+                            return text;
+                        }
 
-                    break;
+                        break;
 
-                case DATE:
+                    case DATE:
 
-                    Date date = set.getDate(key);
+                        Date date = set.getDate(key);
 
-                    if (date != null) {
-                        return date;
-                    }
+                        if (date != null)
+                        {
+                            return date;
+                        }
 
-                    break;
+                        break;
 
-                case OBJECT:
+                    case OBJECT:
 
-                    Object obj = set.getObject(key);
+                        Object obj = set.getObject(key);
 
-                    if (obj != null) {
-                        return obj;
-                    }
+                        if (obj != null)
+                        {
+                            return obj;
+                        }
 
-                    break;
+                        break;
 
-                case XML:
+                    case XML:
 
-                    Document doc = set.getXML(key);
+                        Document doc = set.getXML(key);
 
-                    if (doc != null) {
-                        return doc;
-                    }
+                        if (doc != null)
+                        {
+                            return doc;
+                        }
 
-                    break;
+                        break;
 
-                case DATA:
+                    case DATA:
 
-                    byte[] data = set.getData(key);
+                        byte[] data = set.getData(key);
 
-                    if (data != null) {
-                        return data;
-                    }
+                        if (data != null)
+                        {
+                            return data;
+                        }
 
-                    break;
+                        break;
 
-                case PROPERTIES:
+                    case PROPERTIES:
 
-                    Properties p = set.getProperties(key);
+                        Properties p = set.getProperties(key);
 
-                    if (p != null) {
-                        return p;
-                    }
+                        if (p != null)
+                        {
+                            return p;
+                        }
 
-                    break;
+                        break;
                 }
-            } catch (PropertyException ex) {
+            }
+            catch (PropertyException ex)
+            {
                 //we don't really care about these here
             }
         }

core/src/main/java/com/opensymphony/module/propertyset/file/PropertiesFilePropertySet.java

 package com.opensymphony.module.propertyset.file;
 
 import com.opensymphony.module.propertyset.memory.MemoryPropertySet;
-
 import com.opensymphony.util.Data;
 import com.opensymphony.util.XMLUtils;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.w3c.dom.Document;
 
-import java.io.*;
-
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.text.DateFormat;
 import java.text.ParseException;
-
-import java.util.*;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
 
 
 /**
  *
  * @author hani
  */
-public class PropertiesFilePropertySet extends MemoryPropertySet {
+public class PropertiesFilePropertySet extends MemoryPropertySet
+{
     //~ Static fields/initializers /////////////////////////////////////////////
 
-    protected static Log log = LogFactory.getLog(PropertiesFilePropertySet.class);
+    private static final Logger log = LoggerFactory.getLogger(PropertiesFilePropertySet.class);
 
     //~ Instance fields ////////////////////////////////////////////////////////
 
 
     //~ Methods ////////////////////////////////////////////////////////////////
 
-    public void flush() throws IOException {
+    public void flush() throws IOException
+    {
         Iterator iter = getMap().entrySet().iterator();
         Properties p = new Properties();
 
-        while (iter.hasNext()) {
+        while (iter.hasNext())
+        {
             Map.Entry entry = (Map.Entry) iter.next();
             String name = (String) entry.getKey();
             ValueEntry valueEntry = (ValueEntry) entry.getValue();
             String value;
 
-            switch (valueEntry.getType()) {
-            case XML:
-                value = XMLUtils.print((Document) valueEntry.getValue());
+            switch (valueEntry.getType())
+            {
+                case XML:
+                    value = XMLUtils.print((Document) valueEntry.getValue());
 
-                break;
+                    break;
 
-            case PROPERTIES:
-            case OBJECT:
+                case PROPERTIES:
+                case OBJECT:
 
-                ByteArrayOutputStream bos = new ByteArrayOutputStream();
-                ObjectOutputStream os = new ObjectOutputStream(bos);
-                os.writeObject(valueEntry.getValue());
+                    ByteArrayOutputStream bos = new ByteArrayOutputStream();
+                    ObjectOutputStream os = new ObjectOutputStream(bos);
+                    os.writeObject(valueEntry.getValue());
 
-                byte[] data = bos.toByteArray();
-                value = new sun.misc.BASE64Encoder().encode(data);
+                    byte[] data = bos.toByteArray();
+                    value = new sun.misc.BASE64Encoder().encode(data);
 
-                break;
+                    break;
 
-            case DATE:
-                value = DateFormat.getDateTimeInstance().format((Date) valueEntry.getValue());
+                case DATE:
+                    value = DateFormat.getDateTimeInstance().format((Date) valueEntry.getValue());
 
-                break;
+                    break;
 
-            case DATA:
+                case DATA:
 
-                if (valueEntry.getValue() instanceof byte[]) {
-                    value = new sun.misc.BASE64Encoder().encode((byte[]) valueEntry.getValue());
-                } else {
-                    value = new sun.misc.BASE64Encoder().encode(((Data) valueEntry.getValue()).getBytes());
-                }
+                    if (valueEntry.getValue() instanceof byte[])
+                    {
+                        value = new sun.misc.BASE64Encoder().encode((byte[]) valueEntry.getValue());
+                    }
+                    else
+                    {
+                        value = new sun.misc.BASE64Encoder().encode(((Data) valueEntry.getValue()).getBytes());
+                    }
 
-                break;
+                    break;
 
-            default:
-                value = valueEntry.getValue().toString();
+                default:
+                    value = valueEntry.getValue().toString();
             }
 
             p.put(name + "." + valueEntry.getType(), value);
         p.store(new FileOutputStream(file), null);
     }
 
-    public void init(Map config, Map args) {
+    public void init(Map config, Map args)
+    {
         super.init(config, args);
         file = new File((String) args.get("file"));
 
-        if (file.exists()) {
-            try {
+        if (file.exists())
+        {
+            try
+            {
                 load();
-            } catch (Exception e) {
+            }
+            catch (Exception e)
+            {
                 e.printStackTrace();
             }
         }
     }
 
-    public void load() throws IOException, ClassNotFoundException {
+    public void load() throws IOException, ClassNotFoundException
+    {
         Properties p = new Properties();
         p.load(new FileInputStream(file));
 
         Iterator iter = p.entrySet().iterator();
 
-        while (iter.hasNext()) {
+        while (iter.hasNext())
+        {
             Map.Entry entry = (Map.Entry) iter.next();
             String key = (String) entry.getKey();
             int dot = key.lastIndexOf('.');
             int type = Integer.parseInt(key.substring(dot + 1));
             String name = key.substring(0, dot);
 
-            if (log.isDebugEnabled()) {
+            if (log.isDebugEnabled())
+            {
                 log.debug("key=" + key + " type=" + type + " name=" + name);
             }
 
             String data = (String) entry.getValue();
             Object value = null;
 
-            switch (type) {
-            case STRING:
-            case TEXT:
-                value = data;
+            switch (type)
+            {
+                case STRING:
+                case TEXT:
+                    value = data;
 
-                break;
+                    break;
 
-            case INT:
-                value = new Integer(data);
+                case INT:
+                    value = new Integer(data);
 
-                break;
+                    break;
 
-            case LONG:
-                value = new Long(data);
+                case LONG:
+                    value = new Long(data);
 
-                break;
+                    break;
 
-            case DOUBLE:
-                value = new Double(data);
+                case DOUBLE:
+                    value = new Double(data);
 
-                break;
+                    break;
 
-            case BOOLEAN:
-                value = new Boolean(data);
+                case BOOLEAN:
+                    value = new Boolean(data);
 
-                break;
+                    break;
 
-            case DATA:
-                value = new sun.misc.BASE64Decoder().decodeBuffer(data);
+                case DATA:
+                    value = new sun.misc.BASE64Decoder().decodeBuffer(data);
 
-                break;
+                    break;
 
-            case DATE:
+                case DATE:
 
-                try {
-                    value = DateFormat.getDateTimeInstance().parse(data);
-                } catch (ParseException e) {
-                    e.printStackTrace();
-                }
+                    try
+                    {
+                        value = DateFormat.getDateTimeInstance().parse(data);
+                    }
+                    catch (ParseException e)
+                    {
+                        e.printStackTrace();
+                    }
 
-                break;
+                    break;
 
-            case PROPERTIES:
-            case OBJECT:
+                case PROPERTIES:
+                case OBJECT:
 
-                byte[] bytes = new sun.misc.BASE64Decoder().decodeBuffer(data);
-                ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
-                ObjectInputStream is = new ObjectInputStream(bis);
-                value = is.readObject();
+                    byte[] bytes = new sun.misc.BASE64Decoder().decodeBuffer(data);
+                    ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
+                    ObjectInputStream is = new ObjectInputStream(bis);
+                    value = is.readObject();
 
-                break;
+                    break;
 
-            case XML:
+                case XML:
 
-                try {
-                    value = XMLUtils.parse(data);
-                } catch (Exception e) {
-                    e.printStackTrace();
-                }
+                    try
+                    {
+                        value = XMLUtils.parse(data);
+                    }
+                    catch (Exception e)
+                    {
+                        e.printStackTrace();
+                    }
 
-                break;
+                    break;
 
-            default:
-                throw new IOException("Unsupported type " + type);
+                default:
+                    throw new IOException("Unsupported type " + type);
             }
 
             getMap().put(name, new ValueEntry(type, value));
 
             <!-- Generic Dependencies -->
             <dependency>
+                <groupId>org.slf4j</groupId>
+                <artifactId>slf4j-api</artifactId>
+                <version>1.6.4</version>
+            </dependency>
+            <dependency>
                 <groupId>opensymphony</groupId>
                 <artifactId>oscore</artifactId>
                 <version>2.2.7</version>
                 <groupId>junit</groupId>
                 <artifactId>junit</artifactId>
                 <version>4.8.2</version>
+                <scope>test</scope>
+            </dependency>
+            <dependency>
+                <groupId>org.slf4j</groupId>
+                <artifactId>slf4j-jdk14</artifactId>
+                <version>1.6.4</version>
+                <scope>test</scope>
+            </dependency>
+            <dependency>
+                <groupId>commons-dbcp</groupId>
+                <artifactId>commons-dbcp</artifactId>
+                <version>1.2.2</version>
+                <scope>test</scope>
+            </dependency>
+            <dependency>
+                <groupId>net.sf.ehcache</groupId>
+                <artifactId>ehcache</artifactId>
+                <version>1.2.3</version>
+                <scope>test</scope>
             </dependency>
             <dependency>
                 <groupId>clover</groupId>
                 <artifactId>clover</artifactId>
                 <version>1.3.9</version>
+                <scope>test</scope>
+            </dependency>
+
+            <dependency>
+                <groupId>javax.transaction</groupId>
+                <artifactId>jta</artifactId>
+                <version>1.0.1B</version>
+                <scope>test</scope>
+            </dependency>
+
+            <dependency>
+                <groupId>mckoi</groupId>
+                <artifactId>mckoi</artifactId>
+                <version>1.0.2</version>
+                <scope>test</scope>
+            </dependency>
+
+            <dependency>
+                <groupId>dom4j</groupId>
+                <artifactId>dom4j</artifactId>
+                <version>1.4</version>
+                <scope>test</scope>
+            </dependency>
+
+            <dependency>
+                <groupId>commons-collections</groupId>
+                <artifactId>commons-collections</artifactId>
+                <version>3.2.1</version>
+                <scope>test</scope>
+            </dependency>
+
+            <dependency>
+                <groupId>cglib</groupId>
+                <artifactId>cglib</artifactId>
+                <version>2.1_3</version>
+                <scope>test</scope>
+            </dependency>
+
+            <dependency>
+                <groupId>org.apache.tomcat</groupId>
+                <artifactId>tomcat-catalina</artifactId>
+                <version>7.0.5</version>
+                <scope>test</scope>
+            </dependency>
+
+            <dependency>
+                <groupId>hsqldb</groupId>
+                <artifactId>hsqldb</artifactId>
+                <version>1.8.0.10</version>
+                <scope>test</scope>
             </dependency>
 
 
         </pluginManagement>
     </build>
 
-    <repositories>
-        <repository>
-            <id>maven-repository.dev.java.net</id>
-            <name>Java.net Maven 1 Repository</name>
-            <url>http://download.java.net/maven/1/</url>
-            <layout>legacy</layout>
-            <snapshots>
-                <enabled>false</enabled>
-            </snapshots>
-        </repository>
-        <repository>
-            <id>maven2-repository.dev.java.net</id>
-            <name>Java.net Maven 2 Repository</name>
-            <layout>default</layout>
-            <url>http://download.java.net/maven/2/</url>
-            <snapshots>
-                <enabled>false</enabled>
-            </snapshots>
-        </repository>
-    </repositories>
-
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <jdk.version>1.5</jdk.version>

providers/ejb2/pom.xml

 			<artifactId>api</artifactId>
 			<version>${project.version}</version>
 		</dependency>
-		<dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+        <dependency>
 			<groupId>javax.ejb</groupId>
 			<artifactId>ejb</artifactId>
 			<scope>provided</scope>

providers/ejb2/src/main/java/com/opensymphony/module/propertyset/ejb/PropertyStoreEJB.java

  */
 package com.opensymphony.module.propertyset.ejb;
 
-import com.opensymphony.module.propertyset.*;
+import com.opensymphony.module.propertyset.DuplicatePropertyKeyException;
+import com.opensymphony.module.propertyset.InvalidPropertyTypeException;
+import com.opensymphony.module.propertyset.PropertyException;
+import com.opensymphony.module.propertyset.PropertyImplementationException;
 import com.opensymphony.module.propertyset.ejb.types.PropertyEntryHomeFactory;
 import com.opensymphony.module.propertyset.ejb.types.PropertyEntryLocal;
 import com.opensymphony.module.propertyset.ejb.types.PropertyEntryLocalHome;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.io.Serializable;
-
-import java.util.*;
-
-import javax.ejb.*;
-
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.ejb.CreateException;
+import javax.ejb.EJBException;
+import javax.ejb.FinderException;
+import javax.ejb.ObjectNotFoundException;
+import javax.ejb.SessionBean;
+import javax.ejb.SessionContext;
 import javax.naming.NamingException;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
 
 
 /**
  * Session bean implementation of PropertyStore.
- *
+ * <p/>
  * <p>Makes use of ValueEntityDelegator to determine which entity beans to use for
  * appropriate types.</p>
  *
- * @ejb.bean
- *  type="Stateless"
- *  name="PropertyStore"
- *  view-type="remote"
- *  transaction-type="Container"
- *
- * @ejb.ejb-ref
- *  ejb-name="PropertyEntry"
- *  view-type="local"
- *
- * @ejb.permission unchecked="true"
- * @ejb.transaction type="Supports"
- *
  * @author <a href="mailto:joe@truemesh.com">Joe Walnes</a>
  * @author <a href="mailto:hani@formicary.net">Hani Suleiman</a>
  * @version $Revision$
- *
+ * @ejb.bean type="Stateless"
+ * name="PropertyStore"
+ * view-type="remote"
+ * transaction-type="Container"
+ * @ejb.ejb-ref ejb-name="PropertyEntry"
+ * view-type="local"
+ * @ejb.permission unchecked="true"
+ * @ejb.transaction type="Supports"
  * @see com.opensymphony.module.propertyset.ejb.PropertyStore
  * @see com.opensymphony.module.propertyset.ejb.PropertyStoreHome
  */
-public class PropertyStoreEJB implements SessionBean {
+public class PropertyStoreEJB implements SessionBean
+{
     //~ Static fields/initializers /////////////////////////////////////////////
 
-    private static final Log logger = LogFactory.getLog(PropertyStoreEJB.class);
+    private static final Logger logger = LoggerFactory.getLogger(PropertyStoreEJB.class);
 
     //~ Instance fields ////////////////////////////////////////////////////////
 
     /**
      * @ejb.interface-method
      */
-    public Collection getKeys(String entityName, long entityId, String prefix, int type) {
-        try {
-            if (logger.isDebugEnabled()) {
+    public Collection getKeys(String entityName, long entityId, String prefix, int type)
+    {
+        try
+        {
+            if (logger.isDebugEnabled())
+            {
                 logger.debug("getKeys(" + entityName + "," + entityId + ")");
             }
 
             List results = new ArrayList();
             Iterator entries = entryHome.findByNameAndId(entityName, entityId).iterator();
 
-            while (entries.hasNext()) {
+            while (entries.hasNext())
+            {
                 PropertyEntryLocal entry = (PropertyEntryLocal) entries.next();
                 String key = entry.getKey();
 
-                if (((prefix == null) || key.startsWith(prefix)) && ((type == 0) || (type == entry.getType()))) {
+                if (((prefix == null) || key.startsWith(prefix)) && ((type == 0) || (type == entry.getType())))
+                {
                     results.add(key);
                 }
             }
             Collections.sort(results);
 
             return results;
-        } catch (FinderException e) {
+        }
+        catch (FinderException e)
+        {
             logger.error("Could not find keys.", e);
             throw new PropertyImplementationException(e);
         }
     }
 
-    public void setSessionContext(SessionContext ctx) {
-        try {
+    public void setSessionContext(SessionContext ctx)
+    {
+        try
+        {
             entryHome = PropertyEntryHomeFactory.getLocalHome();
-        } catch (NamingException e) {
-            logger.fatal("Could not lookup PropertyEntryHome.", e);
+        }
+        catch (NamingException e)
+        {
+            logger.error("Could not lookup PropertyEntryHome.", e);
             throw new EJBException(e);
         }
 
     /**
      * @ejb.interface-method
      */
-    public int getType(String entityName, long entityId, String key) {
-        if (logger.isDebugEnabled()) {
+    public int getType(String entityName, long entityId, String key)
+    {
+        if (logger.isDebugEnabled())
+        {
             logger.debug("getType(" + entityName + "," + entityId + ",\"" + key + "\")");
         }
 
-        try {
+        try
+        {
             return entryHome.findByEntity(entityName, entityId, key).getType();
-        } catch (ObjectNotFoundException e) {
+        }
+        catch (ObjectNotFoundException e)
+        {
             return 0;
-        } catch (FinderException e) {
+        }
+        catch (FinderException e)
+        {
             logger.error("Could not find type.", e);
             throw new PropertyImplementationException(e);
         }
     }
 
-    public void ejbActivate() {
+    public void ejbActivate()
+    {
     }
 
     /**
      * @ejb.create-method
      */
-    public void ejbCreate() throws CreateException {
+    public void ejbCreate() throws CreateException
+    {
     }
 
-    public void ejbPassivate() {
+    public void ejbPassivate()
+    {
     }
 
-    public void ejbRemove() {
+    public void ejbRemove()
+    {
     }
 
     /**
      * @ejb.interface-method
      */
-    public boolean exists(String entityName, long entityId, String key) {
-        if (logger.isDebugEnabled()) {
+    public boolean exists(String entityName, long entityId, String key)
+    {
+        if (logger.isDebugEnabled())
+        {
             logger.debug("exists(" + entityName + "," + entityId + ",\"" + key + "\")");
         }
 
     /**
      * @ejb.interface-method
      */
-    public Serializable get(String entityName, long entityId, int type, String key) {
-        if (logger.isDebugEnabled()) {
+    public Serializable get(String entityName, long entityId, int type, String key)
+    {
+        if (logger.isDebugEnabled())
+        {
             logger.debug("get(" + entityName + "," + entityId + "," + type + ",\"" + key + "\")");
         }
 
-        try {
+        try
+        {
             PropertyEntryLocal entry = entryHome.findByEntity(entityName, entityId, key);
 
-            if (type != entry.getType()) {
+            if (type != entry.getType())
+            {
                 // type does not match
-                if (logger.isDebugEnabled()) {
+                if (logger.isDebugEnabled())
+                {
                     logger.debug("wrong property type");
                 }
 
             }
 
             return entry.getValue(); // found it
-        } catch (ObjectNotFoundException e) {
+        }
+        catch (ObjectNotFoundException e)
+        {
             // Property does not exist.
-            if (logger.isDebugEnabled()) {
+            if (logger.isDebugEnabled())
+            {
                 logger.debug("no property found");
             }
 
             return null;
-        } catch (PropertyException e) {
+        }
+        catch (PropertyException e)
+        {
             throw e;
-        } catch (Exception e) {
+        }
+        catch (Exception e)
+        {
             logger.error("Could not retrieve value.", e);
             throw new PropertyImplementationException(e);
         }
      * @ejb.interface-method
      * @ejb.transaction type="Required"
      */
-    public void removeEntry(String entityName, long entityId) {
-        try {
+    public void removeEntry(String entityName, long entityId)
+    {
+        try
+        {
             Collection items = entryHome.findByNameAndId(entityName, entityId);
             Iterator iter = items.iterator();
 
-            while (iter.hasNext()) {
+            while (iter.hasNext())
+            {
                 PropertyEntryLocal entry = (PropertyEntryLocal) iter.next();
                 entry.remove();
             }
-        } catch (FinderException e) {
-            if (logger.isDebugEnabled()) {
+        }
+        catch (FinderException e)
+        {
+            if (logger.isDebugEnabled())
+            {
                 logger.debug("Value did not exist anyway.");
             }
-        } catch (PropertyException e) {
+        }
+        catch (PropertyException e)
+        {
             throw e;
-        } catch (Exception e) {
+        }
+        catch (Exception e)
+        {
             logger.error("Could not remove value.", e);
             throw new PropertyImplementationException("Could not remove value.", e);
         }
     /**
      * @ejb.interface-method
      */
-    public void removeEntry(String entityName, long entityId, String key) {
-        if (logger.isDebugEnabled()) {
+    public void removeEntry(String entityName, long entityId, String key)
+    {
+        if (logger.isDebugEnabled())
+        {
             logger.debug("remove(" + entityName + "," + entityId + ",\"" + key + "\")");
         }
 
-        try {
+        try
+        {
             entryHome.findByEntity(entityName, entityId, key).remove();
-        } catch (ObjectNotFoundException e) {
-            if (logger.isDebugEnabled()) {
+        }