logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nickwilli...@apache.org
Subject svn commit: r1481932 [2/2] - in /logging/log4j/log4j2/trunk/core/src: main/java/org/apache/logging/log4j/core/appender/db/ main/java/org/apache/logging/log4j/core/appender/db/jdbc/ main/java/org/apache/logging/log4j/core/appender/db/jpa/ main/java/org/...
Date Mon, 13 May 2013 15:37:29 GMT
Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverter.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverter.java?rev=1481932&r1=1481931&r2=1481932&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverter.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverter.java Mon May 13 15:37:27 2013
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
 package org.apache.logging.log4j.core.appender.db.jpa.converter;
 
 import org.apache.logging.log4j.ThreadContext;
@@ -33,7 +49,7 @@ public class ContextStackJsonAttributeCo
 
         List<String> list;
         try {
-            list = ContextMapJsonAttributeConverter.OBJECT_MAPPER.readValue(s, new TypeReference<List<String>>(){ });
+            list = ContextMapJsonAttributeConverter.OBJECT_MAPPER.readValue(s, new TypeReference<List<String>>() { });
         } catch (IOException e) {
             throw new PersistenceException("Failed to convert JSON string to list for stack.", e);
         }

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverter.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverter.java?rev=1481932&r1=1481931&r2=1481932&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverter.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverter.java Mon May 13 15:37:27 2013
@@ -23,6 +23,10 @@ import javax.persistence.AttributeConver
  * converter is capable of converting both to and from {@link String}s.
  */
 public class StackTraceElementAttributeConverter implements AttributeConverter<StackTraceElement, String> {
+    private static final int UNKNOWN_SOURCE = -1;
+
+    private static final int NATIVE_METHOD = -2;
+
     @Override
     public String convertToDatabaseColumn(final StackTraceElement element) {
         return element.toString();
@@ -43,12 +47,12 @@ public class StackTraceElementAttributeC
         String parenthesisContents = s.substring(open + 1, s.indexOf(")"));
 
         String fileName = null;
-        int lineNumber = -1;
+        int lineNumber = UNKNOWN_SOURCE;
         if ("Native Method".equals(parenthesisContents)) {
-            lineNumber = -2;
+            lineNumber = NATIVE_METHOD;
         } else if (!"Unknown Source".equals(parenthesisContents)) {
             int colon = parenthesisContents.indexOf(":");
-            if (colon > -1) {
+            if (colon > UNKNOWN_SOURCE) {
                 fileName = parenthesisContents.substring(0, colon);
                 try {
                     lineNumber = Integer.parseInt(parenthesisContents.substring(colon + 1));

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverter.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverter.java?rev=1481932&r1=1481931&r2=1481932&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverter.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverter.java Mon May 13 15:37:27 2013
@@ -31,6 +31,8 @@ import java.util.ListIterator;
  */
 @Converter(autoApply = false)
 public class ThrowableAttributeConverter implements AttributeConverter<Throwable, String> {
+    private static final int CAUSED_BY_STRING_LENGTH = 10;
+
     private static final Field THROWABLE_CAUSE;
 
     private static final Field THROWABLE_MESSAGE;
@@ -77,7 +79,7 @@ public class ThrowableAttributeConverter
     private Throwable convertString(final ListIterator<String> lines, boolean removeCausedBy) {
         String firstLine = lines.next();
         if (removeCausedBy) {
-            firstLine = firstLine.substring(10);
+            firstLine = firstLine.substring(CAUSED_BY_STRING_LENGTH);
         }
         int colon = firstLine.indexOf(":");
         String throwableClassName;
@@ -115,7 +117,7 @@ public class ThrowableAttributeConverter
                                    final StackTraceElement[] stackTrace) {
         try {
             @SuppressWarnings("unchecked")
-            Class<Throwable> throwableClass = (Class<Throwable>)Class.forName(throwableClassName);
+            Class<Throwable> throwableClass = (Class<Throwable>) Class.forName(throwableClassName);
 
             if (!Throwable.class.isAssignableFrom(throwableClass)) {
                 return null;
@@ -175,7 +177,7 @@ public class ThrowableAttributeConverter
     private Throwable getThrowable(final Class<Throwable> throwableClass, final String message, final Throwable cause) {
         try {
             @SuppressWarnings("unchecked")
-            Constructor<Throwable>[] constructors = (Constructor<Throwable>[])throwableClass.getConstructors();
+            Constructor<Throwable>[] constructors = (Constructor<Throwable>[]) throwableClass.getConstructors();
             for (Constructor<Throwable> constructor : constructors) {
                 Class<?>[] parameterTypes = constructor.getParameterTypes();
                 if (parameterTypes.length == 2) {
@@ -196,7 +198,7 @@ public class ThrowableAttributeConverter
     private Throwable getThrowable(final Class<Throwable> throwableClass, final Throwable cause) {
         try {
             @SuppressWarnings("unchecked")
-            Constructor<Throwable>[] constructors = (Constructor<Throwable>[])throwableClass.getConstructors();
+            Constructor<Throwable>[] constructors = (Constructor<Throwable>[]) throwableClass.getConstructors();
             for (Constructor<Throwable> constructor : constructors) {
                 Class<?>[] parameterTypes = constructor.getParameterTypes();
                 if (parameterTypes.length == 1 && Throwable.class.isAssignableFrom(parameterTypes[0])) {

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/NoSQLAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/NoSQLAppender.java?rev=1481932&r1=1481931&r2=1481932&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/NoSQLAppender.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/NoSQLAppender.java Mon May 13 15:37:27 2013
@@ -37,27 +37,37 @@ import org.apache.logging.log4j.core.con
  */
 @Plugin(name = "NoSql", category = "Core", elementType = "appender", printObject = true)
 public final class NoSQLAppender extends AbstractDatabaseAppender<NoSQLDatabaseManager<?>> {
+    private final String description;
+
+    private NoSQLAppender(final String name, final Filter filter, final boolean handleException,
+                          final NoSQLDatabaseManager<?> manager) {
+        super(name, filter, handleException, manager);
+        this.description = this.getName() + "{ manager=" + this.getManager() + " }";
+    }
+
+    @Override
+    public String toString() {
+        return this.description;
+    }
+
     /**
      * Factory method for creating a NoSQL appender within the plugin manager.
-     * 
-     * @param name
-     *            The name of the appender.
-     * @param suppressExceptions
-     *            {@code "true"} (default) if logging exceptions should be hidden from the application, false otherwise.
-     * @param filter
-     *            The filter, if any, to use.
-     * @param bufferSize
-     *            If an integer greater than 0, this causes the appender to buffer log events and flush whenever the
-     *            buffer reaches this size.
-     * @param provider
-     *            The NoSQL provider that provides connections to the chosen NoSQL database.
+     *
+     * @param name The name of the appender.
+     * @param suppressExceptions {@code "true"} (default) if logging exceptions should be hidden from the application,
+     *                           {@code "false"} otherwise.
+     * @param filter The filter, if any, to use.
+     * @param bufferSize If an integer greater than 0, this causes the appender to buffer log events and flush whenever
+     *                   the buffer reaches this size.
+     * @param provider The NoSQL provider that provides connections to the chosen NoSQL database.
      * @return a new NoSQL appender.
      */
     @PluginFactory
     public static NoSQLAppender createAppender(@PluginAttr("name") final String name,
-            @PluginAttr("suppressExceptions") final String suppressExceptions,
-            @PluginElement("filter") final Filter filter, @PluginAttr("bufferSize") final String bufferSize,
-            @PluginElement("noSqlProvider") final NoSQLProvider<?> provider) {
+                                               @PluginAttr("suppressExceptions") final String suppressExceptions,
+                                               @PluginElement("filter") final Filter filter,
+                                               @PluginAttr("bufferSize") final String bufferSize,
+                                               @PluginElement("noSqlProvider") final NoSQLProvider<?> provider) {
         if (provider == null) {
             LOGGER.error("NoSQL provider not specified for appender [{}].", name);
             return null;
@@ -76,25 +86,13 @@ public final class NoSQLAppender extends
         final String managerName = "noSqlManager{ description=" + name + ", bufferSize=" + bufferSizeInt
                 + ", provider=" + provider + " }";
 
-        final NoSQLDatabaseManager<?> manager = NoSQLDatabaseManager.getNoSQLDatabaseManager(managerName,
-                bufferSizeInt, provider);
+        final NoSQLDatabaseManager<?> manager = NoSQLDatabaseManager.getNoSQLDatabaseManager(
+                managerName, bufferSizeInt, provider
+        );
         if (manager == null) {
             return null;
         }
 
         return new NoSQLAppender(name, filter, handleExceptions, manager);
     }
-
-    private final String description;
-
-    private NoSQLAppender(final String name, final Filter filter, final boolean handleException,
-            final NoSQLDatabaseManager<?> manager) {
-        super(name, filter, handleException, manager);
-        this.description = this.getName() + "{ manager=" + this.getManager() + " }";
-    }
-
-    @Override
-    public String toString() {
-        return this.description;
-    }
 }

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/NoSQLConnection.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/NoSQLConnection.java?rev=1481932&r1=1481931&r2=1481932&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/NoSQLConnection.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/NoSQLConnection.java Mon May 13 15:37:27 2013
@@ -16,23 +16,56 @@
  */
 package org.apache.logging.log4j.core.appender.db.nosql;
 
+import java.io.Closeable;
+
 /**
  * Represents a connection to the NoSQL database. Serves as a factory for new (empty) objects and an endpoint for
  * inserted objects.
  * 
- * @param <T>
- *            Specifies which implementation of {@link NoSQLObject} this connection provides.
- * @param <W>
- *            Specifies which type of database object is wrapped by the {@link NoSQLObject} implementation provided.
+ * @param <T> Specifies which implementation of {@link NoSQLObject} this connection provides.
+ * @param <W> Specifies which type of database object is wrapped by the {@link NoSQLObject} implementation provided.
  */
-public interface NoSQLConnection<W, T extends NoSQLObject<W>> {
-    void close();
+public interface NoSQLConnection<W, T extends NoSQLObject<W>> extends Closeable {
+    /**
+     * Instantiates and returns a {@link NoSQLObject} instance whose properties can be configured before ultimate
+     * insertion via {@link #insertObject(NoSQLObject)}.
+     *
+     * @return a new object.
+     * @see NoSQLObject
+     */
+    T createObject();
 
+    /**
+     * Creates an array of the specified length typed to match the {@link NoSQLObject} implementation appropriate for
+     * this provider.
+     *
+     * @param length the length of the array to create.
+     * @return a new array.
+     * @see NoSQLObject
+     */
     T[] createList(int length);
 
-    T createObject();
-
+    /**
+     * Inserts the given object into the underlying NoSQL database.
+     *
+     * @param object The object to insert.
+     */
     void insertObject(NoSQLObject<W> object);
 
+    /**
+     * Closes the underlying connection. This method call should be idempotent. Only the first call should have any
+     * effect; all further calls should be ignored. It's possible the underlying connection is stateless (such as an
+     * HTTP web service), in which case this method would be a no-op.
+     */
+    @Override
+    void close();
+
+    /**
+     * Indicates whether the underlying connection is closed. If the underlying connection is stateless (such as an
+     * HTTP web service), this method would likely always return true. Essentially, this method should only return
+     * {@code true} if a call to {@link #insertObject(NoSQLObject)} <b>will</b> fail due to the state of this object.
+     *
+     * @return {@link true} if this object is considered closed.
+     */
     boolean isClosed();
 }

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/NoSQLDatabaseManager.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/NoSQLDatabaseManager.java?rev=1481932&r1=1481931&r2=1481932&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/NoSQLDatabaseManager.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/NoSQLDatabaseManager.java Mon May 13 15:37:27 2013
@@ -16,61 +16,26 @@
  */
 package org.apache.logging.log4j.core.appender.db.nosql;
 
-import java.util.Map;
-
 import org.apache.logging.log4j.Marker;
 import org.apache.logging.log4j.ThreadContext;
 import org.apache.logging.log4j.core.LogEvent;
 import org.apache.logging.log4j.core.appender.ManagerFactory;
 import org.apache.logging.log4j.core.appender.db.AbstractDatabaseManager;
 
+import java.util.Map;
+
 /**
  * An {@link AbstractDatabaseManager} implementation for all NoSQL databases.
  * 
- * @param <W>
- *            A type parameter for reassuring the compiler that all operations are using the same {@link NoSQLObject}.
+ * @param <W> A type parameter for reassuring the compiler that all operations are using the same {@link NoSQLObject}.
  */
 public final class NoSQLDatabaseManager<W> extends AbstractDatabaseManager {
-    private static final class FactoryData extends AbstractDatabaseManager.AbstractFactoryData {
-        private final NoSQLProvider<?> provider;
-
-        protected FactoryData(final int bufferSize, final NoSQLProvider<?> provider) {
-            super(bufferSize);
-            this.provider = provider;
-        }
-    }
-
-    private static final class NoSQLDatabaseManagerFactory implements
-            ManagerFactory<NoSQLDatabaseManager<?>, FactoryData> {
-        @Override
-        @SuppressWarnings("unchecked")
-        public NoSQLDatabaseManager<?> createManager(final String name, final FactoryData data) {
-            return new NoSQLDatabaseManager(name, data.bufferSize, data.provider);
-        }
-    }
-
     private static final NoSQLDatabaseManagerFactory FACTORY = new NoSQLDatabaseManagerFactory();
 
-    /**
-     * Creates a NoSQL manager for use within the {@link NoSQLAppender}, or returns a suitable one if it already exists.
-     * 
-     * @param name
-     *            The name of the manager, which should include connection details and hashed passwords where possible.
-     * @param bufferSize
-     *            The size of the log event buffer.
-     * @param provider
-     *            A provider instance which will be used to obtain connections to the chosen NoSQL database.
-     * @return a new or existing NoSQL manager as applicable.
-     */
-    public static NoSQLDatabaseManager<?> getNoSQLDatabaseManager(final String name, final int bufferSize,
-            final NoSQLProvider<?> provider) {
-        return AbstractDatabaseManager.getManager(name, new FactoryData(bufferSize, provider), FACTORY);
-    }
+    private final NoSQLProvider<NoSQLConnection<W, ? extends NoSQLObject<W>>> provider;
 
     private NoSQLConnection<W, ? extends NoSQLObject<W>> connection;
 
-    private final NoSQLProvider<NoSQLConnection<W, ? extends NoSQLObject<W>>> provider;
-
     private NoSQLDatabaseManager(final String name, final int bufferSize,
             final NoSQLProvider<NoSQLConnection<W, ? extends NoSQLObject<W>>> provider) {
         super(name, bufferSize);
@@ -86,23 +51,6 @@ public final class NoSQLDatabaseManager<
         }
     }
 
-    private NoSQLObject<W>[] convertStackTrace(final StackTraceElement[] stackTrace) {
-        final NoSQLObject<W>[] stackTraceEntities = this.connection.createList(stackTrace.length);
-        for (int i = 0; i < stackTrace.length; i++) {
-            stackTraceEntities[i] = this.convertStackTraceElement(stackTrace[i]);
-        }
-        return stackTraceEntities;
-    }
-
-    private NoSQLObject<W> convertStackTraceElement(final StackTraceElement element) {
-        final NoSQLObject<W> elementEntity = this.connection.createObject();
-        elementEntity.set("className", element.getClassName());
-        elementEntity.set("methodName", element.getMethodName());
-        elementEntity.set("fileName", element.getFileName());
-        elementEntity.set("lineNumber", element.getLineNumber());
-        return elementEntity;
-    }
-
     @Override
     protected void disconnectInternal() {
         try {
@@ -197,4 +145,58 @@ public final class NoSQLDatabaseManager<
 
         this.connection.insertObject(entity);
     }
+
+    private NoSQLObject<W>[] convertStackTrace(final StackTraceElement[] stackTrace) {
+        final NoSQLObject<W>[] stackTraceEntities = this.connection.createList(stackTrace.length);
+        for (int i = 0; i < stackTrace.length; i++) {
+            stackTraceEntities[i] = this.convertStackTraceElement(stackTrace[i]);
+        }
+        return stackTraceEntities;
+    }
+
+    private NoSQLObject<W> convertStackTraceElement(final StackTraceElement element) {
+        final NoSQLObject<W> elementEntity = this.connection.createObject();
+        elementEntity.set("className", element.getClassName());
+        elementEntity.set("methodName", element.getMethodName());
+        elementEntity.set("fileName", element.getFileName());
+        elementEntity.set("lineNumber", element.getLineNumber());
+        return elementEntity;
+    }
+
+    /**
+     * Creates a NoSQL manager for use within the {@link NoSQLAppender}, or returns a suitable one if it already exists.
+     *
+     * @param name The name of the manager, which should include connection details and hashed passwords where possible.
+     * @param bufferSize The size of the log event buffer.
+     * @param provider A provider instance which will be used to obtain connections to the chosen NoSQL database.
+     * @return a new or existing NoSQL manager as applicable.
+     */
+    public static NoSQLDatabaseManager<?> getNoSQLDatabaseManager(final String name, final int bufferSize,
+                                                                  final NoSQLProvider<?> provider) {
+        return AbstractDatabaseManager.getManager(name, new FactoryData(bufferSize, provider), FACTORY);
+    }
+
+    /**
+     * Encapsulates data that {@link NoSQLDatabaseManagerFactory} uses to create managers.
+     */
+    private static final class FactoryData extends AbstractDatabaseManager.AbstractFactoryData {
+        private final NoSQLProvider<?> provider;
+
+        protected FactoryData(final int bufferSize, final NoSQLProvider<?> provider) {
+            super(bufferSize);
+            this.provider = provider;
+        }
+    }
+
+    /**
+     * Creates managers.
+     */
+    private static final class NoSQLDatabaseManagerFactory implements
+            ManagerFactory<NoSQLDatabaseManager<?>, FactoryData> {
+        @Override
+        @SuppressWarnings("unchecked")
+        public NoSQLDatabaseManager<?> createManager(final String name, final FactoryData data) {
+            return new NoSQLDatabaseManager(name, data.getBufferSize(), data.provider);
+        }
+    }
 }

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/NoSQLObject.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/NoSQLObject.java?rev=1481932&r1=1481931&r2=1481932&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/NoSQLObject.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/NoSQLObject.java Mon May 13 15:37:27 2013
@@ -19,17 +19,45 @@ package org.apache.logging.log4j.core.ap
 /**
  * Represents a simple POJO object inserted into a NoSQL object.
  * 
- * @param <W>
- *            Specifies what type of underlying object (such as a MongoDB BasicDBObject) this NoSQLObject wraps.
+ * @param <W> Specifies what type of underlying object (such as a MongoDB BasicDBObject) this NoSQLObject wraps.
  */
 public interface NoSQLObject<W> {
-    void set(String field, NoSQLObject<W> value);
-
-    void set(String field, NoSQLObject<W>[] values);
-
+    /**
+     * Sets the value of a property on this object to a String or primitive.
+     *
+     * @param field The name of the property
+     * @param value The value of the property
+     */
     void set(String field, Object value);
 
+    /**
+     * Sets the value of a property on this object to a nested complex object.
+     *
+     * @param field The name of the property
+     * @param value The value of the property
+     */
+    void set(String field, NoSQLObject<W> value);
+
+    /**
+     * Sets the value of a property on this object to an array of Strings or primitives.
+     *
+     * @param field The name of the property
+     * @param values The values for the property
+     */
     void set(String field, Object[] values);
 
+    /**
+     * Sets the value of a property on this object to an array of nested complex objects.
+     *
+     * @param field The name of the property
+     * @param values The values for the property
+     */
+    void set(String field, NoSQLObject<W>[] values);
+
+    /**
+     * Obtains the underlying NoSQL library-specific object that this object wraps.
+     *
+     * @return the wrapped object.
+     */
     W unwrap();
 }

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/NoSQLProvider.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/NoSQLProvider.java?rev=1481932&r1=1481931&r2=1481932&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/NoSQLProvider.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/NoSQLProvider.java Mon May 13 15:37:27 2013
@@ -20,9 +20,25 @@ package org.apache.logging.log4j.core.ap
  * Implementations of this class are plugins for configuring the {@link NoSQLAppender} with the proper provider
  * (MongoDB, etc.).
  * 
- * @param <C>
- *            Specifies which implementation of {@link NoSQLConnection} this provider provides.
+ * @param <C> Specifies which implementation of {@link NoSQLConnection} this provider provides.
  */
 public interface NoSQLProvider<C extends NoSQLConnection<?, ? extends NoSQLObject<?>>> {
+    /**
+     * Obtains a connection from this provider. The concept of a connection in this case is not strictly an active
+     * duplex UDP or TCP connection to the underlying database. It can be thought of more as a gateway, a path for
+     * inserting objects that may use a persistent connection or may use HTTP web service calls, etc.
+     *
+     * @return a connection that can be used to create and persist objects to this database.
+     * @see NoSQLConnection
+     */
     C getConnection();
+
+    /**
+     * All implementations must override {@link Object#toString()} to provide information about the provider
+     * configuration (obscuring passwords with one-way hashes).
+     *
+     * @return the string representation of this NoSQL provider.
+     */
+    @Override
+    String toString();
 }

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/couch/CouchDBConnection.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/couch/CouchDBConnection.java?rev=1481932&r1=1481931&r2=1481932&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/couch/CouchDBConnection.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/couch/CouchDBConnection.java Mon May 13 15:37:27 2013
@@ -16,8 +16,6 @@
  */
 package org.apache.logging.log4j.core.appender.db.nosql.couch;
 
-import java.util.Map;
-
 import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.core.appender.db.nosql.NoSQLConnection;
 import org.apache.logging.log4j.core.appender.db.nosql.NoSQLObject;
@@ -25,6 +23,8 @@ import org.apache.logging.log4j.status.S
 import org.lightcouch.CouchDbClient;
 import org.lightcouch.Response;
 
+import java.util.Map;
+
 /**
  * The Apache CouchDB implementation of {@link NoSQLConnection}.
  */
@@ -39,9 +39,8 @@ public final class CouchDBConnection imp
     }
 
     @Override
-    public synchronized void close() {
-        this.closed = true;
-        this.client.shutdown();
+    public CouchDBObject createObject() {
+        return new CouchDBObject();
     }
 
     @Override
@@ -50,11 +49,6 @@ public final class CouchDBConnection imp
     }
 
     @Override
-    public CouchDBObject createObject() {
-        return new CouchDBObject();
-    }
-
-    @Override
     public void insertObject(final NoSQLObject<Map<String, Object>> object) {
         try {
             final Response response = this.client.save(object.unwrap());
@@ -67,6 +61,12 @@ public final class CouchDBConnection imp
     }
 
     @Override
+    public synchronized void close() {
+        this.closed = true;
+        this.client.shutdown();
+    }
+
+    @Override
     public synchronized boolean isClosed() {
         return this.closed;
     }

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/couch/CouchDBObject.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/couch/CouchDBObject.java?rev=1481932&r1=1481931&r2=1481932&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/couch/CouchDBObject.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/couch/CouchDBObject.java Mon May 13 15:37:27 2013
@@ -16,13 +16,13 @@
  */
 package org.apache.logging.log4j.core.appender.db.nosql.couch;
 
+import org.apache.logging.log4j.core.appender.db.nosql.NoSQLObject;
+
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.logging.log4j.core.appender.db.nosql.NoSQLObject;
-
 /**
  * The Apache CouchDB implementation of {@link NoSQLObject}.
  */
@@ -34,11 +34,21 @@ public final class CouchDBObject impleme
     }
 
     @Override
+    public void set(final String field, final Object value) {
+        this.map.put(field, value);
+    }
+
+    @Override
     public void set(final String field, final NoSQLObject<Map<String, Object>> value) {
         this.map.put(field, value.unwrap());
     }
 
     @Override
+    public void set(final String field, final Object[] values) {
+        this.map.put(field, Arrays.asList(values));
+    }
+
+    @Override
     public void set(final String field, final NoSQLObject<Map<String, Object>>[] values) {
         final ArrayList<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
         for (final NoSQLObject<Map<String, Object>> value : values) {
@@ -48,16 +58,6 @@ public final class CouchDBObject impleme
     }
 
     @Override
-    public void set(final String field, final Object value) {
-        this.map.put(field, value);
-    }
-
-    @Override
-    public void set(final String field, final Object[] values) {
-        this.map.put(field, Arrays.asList(values));
-    }
-
-    @Override
     public Map<String, Object> unwrap() {
         return this.map;
     }

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/couch/CouchDBProvider.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/couch/CouchDBProvider.java?rev=1481932&r1=1481931&r2=1481932&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/couch/CouchDBProvider.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/couch/CouchDBProvider.java Mon May 13 15:37:27 2013
@@ -16,8 +16,6 @@
  */
 package org.apache.logging.log4j.core.appender.db.nosql.couch;
 
-import java.lang.reflect.Method;
-
 import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.core.appender.db.nosql.NoSQLProvider;
 import org.apache.logging.log4j.core.config.plugins.Plugin;
@@ -28,6 +26,8 @@ import org.apache.logging.log4j.status.S
 import org.lightcouch.CouchDbClient;
 import org.lightcouch.CouchDbProperties;
 
+import java.lang.reflect.Method;
+
 /**
  * The Apache CouchDB implementation of {@link NoSQLProvider}.
  */
@@ -37,45 +37,58 @@ public final class CouchDBProvider imple
     private static final int HTTPS = 443;
     private static final Logger LOGGER = StatusLogger.getLogger();
 
+    private final CouchDbClient client;
+    private final String description;
+
+    private CouchDBProvider(final CouchDbClient client, final String description) {
+        this.client = client;
+        this.description = "couchDb{ " + description + " }";
+    }
+
+    @Override
+    public CouchDBConnection getConnection() {
+        return new CouchDBConnection(this.client);
+    }
+
+    @Override
+    public String toString() {
+        return this.description;
+    }
+
     /**
      * Factory method for creating an Apache CouchDB provider within the plugin manager.
-     * 
-     * @param databaseName
-     *            The name of the database to which log event documents will be written.
-     * @param protocol
-     *            Either "http" or "https," defaults to "http" and mutually exclusive with
-     *            {@code factoryClassName&factoryMethodName!=null}.
-     * @param server
-     *            The host name of the CouchDB server, defaults to localhost and mutually exclusive with
-     *            {@code factoryClassName&factoryMethodName!=null}.
-     * @param port
-     *            The port that CouchDB is listening on, defaults to 80 if {@code protocol} is "http" and 443 if
-     *            {@code protocol} is "https," and mutually exclusive with
-     *            {@code factoryClassName&factoryMethodName!=null}.
-     * @param username
-     *            The username to authenticate against the MongoDB server with, mutually exclusive with
-     *            {@code factoryClassName&factoryMethodName!=null}.
-     * @param password
-     *            The password to authenticate against the MongoDB server with, mutually exclusive with
-     *            {@code factoryClassName&factoryMethodName!=null}.
-     * @param factoryClassName
-     *            A fully qualified class name containing a static factory method capable of returning a
-     *            {@link CouchDbClient} or {@link CouchDbProperties}.
-     * @param factoryMethodName
-     *            The name of the public static factory method belonging to the aforementioned factory class.
+     *
+     * @param databaseName The name of the database to which log event documents will be written.
+     * @param protocol Either "http" or "https," defaults to "http" and mutually exclusive with
+     *                 {@code factoryClassName&factoryMethodName!=null}.
+     * @param server The host name of the CouchDB server, defaults to localhost and mutually exclusive with
+     *               {@code factoryClassName&factoryMethodName!=null}.
+     * @param port The port that CouchDB is listening on, defaults to 80 if {@code protocol} is "http" and 443 if
+     *             {@code protocol} is "https," and mutually exclusive with
+     *             {@code factoryClassName&factoryMethodName!=null}.
+     * @param username The username to authenticate against the MongoDB server with, mutually exclusive with
+     *                 {@code factoryClassName&factoryMethodName!=null}.
+     * @param password The password to authenticate against the MongoDB server with, mutually exclusive with
+     *                 {@code factoryClassName&factoryMethodName!=null}.
+     * @param factoryClassName A fully qualified class name containing a static factory method capable of returning a
+     *                         {@link CouchDbClient} or {@link CouchDbProperties}.
+     * @param factoryMethodName The name of the public static factory method belonging to the aforementioned factory
+     *                          class.
      * @return a new Apache CouchDB provider.
      */
     @PluginFactory
     public static CouchDBProvider createNoSQLProvider(@PluginAttr("databaseName") final String databaseName,
-            @PluginAttr("protocol") String protocol, @PluginAttr("server") String server,
-            @PluginAttr("port") final String port, @PluginAttr("username") final String username,
-            @PluginAttr("password") final String password,
-            @PluginAttr("factoryClassName") final String factoryClassName,
-            @PluginAttr("factoryMethodName") final String factoryMethodName) {
+                                                      @PluginAttr("protocol") String protocol,
+                                                      @PluginAttr("server") String server,
+                                                      @PluginAttr("port") final String port,
+                                                      @PluginAttr("username") final String username,
+                                                      @PluginAttr("password") final String password,
+                                                      @PluginAttr("factoryClassName") final String factoryClassName,
+                                                      @PluginAttr("factoryMethodName") final String factoryMethodName) {
         CouchDbClient client;
         String description;
-        if (factoryClassName != null && factoryClassName.length() > 0 && factoryMethodName != null
-                && factoryMethodName.length() > 0) {
+        if (factoryClassName != null && factoryClassName.length() > 0 &&
+                factoryMethodName != null && factoryMethodName.length() > 0) {
             try {
                 final Class<?> factoryClass = Class.forName(factoryClassName);
                 final Method method = factoryClass.getMethod(factoryMethodName);
@@ -126,7 +139,8 @@ public final class CouchDBProvider imple
             if (port != null && port.length() > 0) {
                 try {
                     portInt = Integer.parseInt(port);
-                } catch (final NumberFormatException ignore) { /* */
+                } catch (final NumberFormatException ignore) {
+                    // we don't care
                 }
             } else {
                 LOGGER.warn("No port specified, using default port [{}] for protocol [{}].", portInt, protocol);
@@ -152,23 +166,4 @@ public final class CouchDBProvider imple
 
         return new CouchDBProvider(client, description);
     }
-
-    private final CouchDbClient client;
-
-    private final String description;
-
-    private CouchDBProvider(final CouchDbClient client, final String description) {
-        this.client = client;
-        this.description = "couchDb{ " + description + " }";
-    }
-
-    @Override
-    public CouchDBConnection getConnection() {
-        return new CouchDBConnection(this.client);
-    }
-
-    @Override
-    public String toString() {
-        return this.description;
-    }
 }

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/couch/package-info.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/couch/package-info.java?rev=1481932&r1=1481931&r2=1481932&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/couch/package-info.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/couch/package-info.java Mon May 13 15:37:27 2013
@@ -18,4 +18,3 @@
  * The classes in this package contain the Apache CouchDB provider for the NoSQL Appender.
  */
 package org.apache.logging.log4j.core.appender.db.nosql.couch;
-

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/mongo/MongoDBConnection.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/mongo/MongoDBConnection.java?rev=1481932&r1=1481931&r2=1481932&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/mongo/MongoDBConnection.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/mongo/MongoDBConnection.java Mon May 13 15:37:27 2013
@@ -46,8 +46,8 @@ public final class MongoDBConnection imp
     }
 
     @Override
-    public void close() {
-        this.mongo.close();
+    public MongoDBObject createObject() {
+        return new MongoDBObject();
     }
 
     @Override
@@ -56,11 +56,6 @@ public final class MongoDBConnection imp
     }
 
     @Override
-    public MongoDBObject createObject() {
-        return new MongoDBObject();
-    }
-
-    @Override
     public void insertObject(final NoSQLObject<BasicDBObject> object) {
         try {
             final WriteResult result = this.collection.insert(object.unwrap(), this.writeConcern);
@@ -73,6 +68,11 @@ public final class MongoDBConnection imp
     }
 
     @Override
+    public void close() {
+        this.mongo.close();
+    }
+
+    @Override
     public boolean isClosed() {
         return !this.mongo.getConnector().isOpen();
     }

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/mongo/MongoDBObject.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/mongo/MongoDBObject.java?rev=1481932&r1=1481931&r2=1481932&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/mongo/MongoDBObject.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/mongo/MongoDBObject.java Mon May 13 15:37:27 2013
@@ -16,12 +16,11 @@
  */
 package org.apache.logging.log4j.core.appender.db.nosql.mongo;
 
-import java.util.Collections;
-
-import org.apache.logging.log4j.core.appender.db.nosql.NoSQLObject;
-
 import com.mongodb.BasicDBList;
 import com.mongodb.BasicDBObject;
+import org.apache.logging.log4j.core.appender.db.nosql.NoSQLObject;
+
+import java.util.Collections;
 
 /**
  * The MongoDB implementation of {@link NoSQLObject}.
@@ -34,28 +33,28 @@ public final class MongoDBObject impleme
     }
 
     @Override
+    public void set(final String field, final Object value) {
+        this.mongoObject.append(field, value);
+    }
+
+    @Override
     public void set(final String field, final NoSQLObject<BasicDBObject> value) {
         this.mongoObject.append(field, value.unwrap());
     }
 
     @Override
-    public void set(final String field, final NoSQLObject<BasicDBObject>[] values) {
+    public void set(final String field, final Object[] values) {
         final BasicDBList list = new BasicDBList();
-        for (final NoSQLObject<BasicDBObject> value : values) {
-            list.add(value.unwrap());
-        }
+        Collections.addAll(list, values);
         this.mongoObject.append(field, list);
     }
 
     @Override
-    public void set(final String field, final Object value) {
-        this.mongoObject.append(field, value);
-    }
-
-    @Override
-    public void set(final String field, final Object[] values) {
+    public void set(final String field, final NoSQLObject<BasicDBObject>[] values) {
         final BasicDBList list = new BasicDBList();
-        Collections.addAll(list, values);
+        for (final NoSQLObject<BasicDBObject> value : values) {
+            list.add(value.unwrap());
+        }
         this.mongoObject.append(field, list);
     }
 

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/mongo/MongoDBProvider.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/mongo/MongoDBProvider.java?rev=1481932&r1=1481931&r2=1481932&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/mongo/MongoDBProvider.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/mongo/MongoDBProvider.java Mon May 13 15:37:27 2013
@@ -16,10 +16,10 @@
  */
 package org.apache.logging.log4j.core.appender.db.nosql.mongo;
 
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.util.List;
-
+import com.mongodb.DB;
+import com.mongodb.MongoClient;
+import com.mongodb.ServerAddress;
+import com.mongodb.WriteConcern;
 import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.core.appender.db.nosql.NoSQLProvider;
 import org.apache.logging.log4j.core.config.plugins.Plugin;
@@ -28,10 +28,9 @@ import org.apache.logging.log4j.core.con
 import org.apache.logging.log4j.core.helpers.NameUtil;
 import org.apache.logging.log4j.status.StatusLogger;
 
-import com.mongodb.DB;
-import com.mongodb.MongoClient;
-import com.mongodb.ServerAddress;
-import com.mongodb.WriteConcern;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.List;
 
 /**
  * The MongoDB implementation of {@link NoSQLProvider}.
@@ -40,50 +39,69 @@ import com.mongodb.WriteConcern;
 public final class MongoDBProvider implements NoSQLProvider<MongoDBConnection> {
     private static final Logger LOGGER = StatusLogger.getLogger();
 
+    private final String collectionName;
+    private final DB database;
+    private final String description;
+
+    private final WriteConcern writeConcern;
+
+    private MongoDBProvider(final DB database, final WriteConcern writeConcern, final String collectionName,
+            final String description) {
+        this.database = database;
+        this.writeConcern = writeConcern;
+        this.collectionName = collectionName;
+        this.description = "mongoDb{ " + description + " }";
+    }
+
+    @Override
+    public MongoDBConnection getConnection() {
+        return new MongoDBConnection(this.database, this.writeConcern, this.collectionName);
+    }
+
+    @Override
+    public String toString() {
+        return this.description;
+    }
+
     /**
      * Factory method for creating a MongoDB provider within the plugin manager.
-     * 
-     * @param collectionName
-     *            The name of the MongoDB collection to which log events should be written.
-     * @param writeConcernConstant
-     *            The {@link WriteConcern} constant to control writing details, defaults to
-     *            {@link WriteConcern#ACKNOWLEDGED}.
-     * @param writeConcernConstantClassName
-     *            The name of a class containing the aforementioned static WriteConcern constant. Defaults to
-     *            {@link WriteConcern}.
-     * @param databaseName
-     *            The name of the MongoDB database containing the collection to which log events should be written.
-     *            Mutually exclusive with {@code factoryClassName&factoryMethodName!=null}.
-     * @param server
-     *            The host name of the MongoDB server, defaults to localhost and mutually exclusive with
-     *            {@code factoryClassName&factoryMethodName!=null}.
-     * @param port
-     *            The port the MongoDB server is listening on, defaults to the default MongoDB port and mutually
-     *            exclusive with {@code factoryClassName&factoryMethodName!=null}.
-     * @param username
-     *            The username to authenticate against the MongoDB server with.
-     * @param password
-     *            The password to authenticate against the MongoDB server with.
-     * @param factoryClassName
-     *            A fully qualified class name containing a static factory method capable of returning a {@link DB} or a
-     *            {@link MongoClient}.
-     * @param factoryMethodName
-     *            The name of the public static factory method belonging to the aforementioned factory class.
+     *
+     * @param collectionName The name of the MongoDB collection to which log events should be written.
+     * @param writeConcernConstant The {@link WriteConcern} constant to control writing details, defaults to
+     *                             {@link WriteConcern#ACKNOWLEDGED}.
+     * @param writeConcernConstantClassName The name of a class containing the aforementioned static WriteConcern
+     *                                      constant. Defaults to {@link WriteConcern}.
+     * @param databaseName The name of the MongoDB database containing the collection to which log events should be
+     *                     written. Mutually exclusive with {@code factoryClassName&factoryMethodName!=null}.
+     * @param server The host name of the MongoDB server, defaults to localhost and mutually exclusive with
+     *               {@code factoryClassName&factoryMethodName!=null}.
+     * @param port The port the MongoDB server is listening on, defaults to the default MongoDB port and mutually
+     *             exclusive with {@code factoryClassName&factoryMethodName!=null}.
+     * @param username The username to authenticate against the MongoDB server with.
+     * @param password The password to authenticate against the MongoDB server with.
+     * @param factoryClassName A fully qualified class name containing a static factory method capable of returning a
+     *                         {@link DB} or a {@link MongoClient}.
+     * @param factoryMethodName The name of the public static factory method belonging to the aforementioned factory
+     *                          class.
      * @return a new MongoDB provider.
      */
     @PluginFactory
     public static MongoDBProvider createNoSQLProvider(@PluginAttr("collectionName") final String collectionName,
-            @PluginAttr("writeConcernConstant") final String writeConcernConstant,
-            @PluginAttr("writeConcernConstantClass") final String writeConcernConstantClassName,
-            @PluginAttr("databaseName") final String databaseName, @PluginAttr("server") final String server,
-            @PluginAttr("port") final String port, @PluginAttr("username") final String username,
-            @PluginAttr("password") final String password,
-            @PluginAttr("factoryClassName") final String factoryClassName,
-            @PluginAttr("factoryMethodName") final String factoryMethodName) {
+                                                      @PluginAttr("writeConcernConstant") final String
+                                                              writeConcernConstant,
+                                                      @PluginAttr("writeConcernConstantClass") final String
+                                                              writeConcernConstantClassName,
+                                                      @PluginAttr("databaseName") final String databaseName,
+                                                      @PluginAttr("server") final String server,
+                                                      @PluginAttr("port") final String port,
+                                                      @PluginAttr("username") final String username,
+                                                      @PluginAttr("password") final String password,
+                                                      @PluginAttr("factoryClassName") final String factoryClassName,
+                                                      @PluginAttr("factoryMethodName") final String factoryMethodName) {
         DB database;
         String description;
-        if (factoryClassName != null && factoryClassName.length() > 0 && factoryMethodName != null
-                && factoryMethodName.length() > 0) {
+        if (factoryClassName != null && factoryClassName.length() > 0 &&
+                factoryMethodName != null && factoryMethodName.length() > 0) {
             try {
                 final Class<?> factoryClass = Class.forName(factoryClassName);
                 final Method method = factoryClass.getMethod(factoryMethodName);
@@ -139,7 +157,8 @@ public final class MongoDBProvider imple
                     if (port != null && port.length() > 0) {
                         try {
                             portInt = Integer.parseInt(port);
-                        } catch (final NumberFormatException ignore) { /* */
+                        } catch (final NumberFormatException ignore) {
+                            // we don't care
                         }
                     }
 
@@ -199,28 +218,4 @@ public final class MongoDBProvider imple
 
         return new MongoDBProvider(database, writeConcern, collectionName, description);
     }
-
-    private final String collectionName;
-    private final DB database;
-    private final String description;
-
-    private final WriteConcern writeConcern;
-
-    private MongoDBProvider(final DB database, final WriteConcern writeConcern, final String collectionName,
-            final String description) {
-        this.database = database;
-        this.writeConcern = writeConcern;
-        this.collectionName = collectionName;
-        this.description = "mongoDb{ " + description + " }";
-    }
-
-    @Override
-    public MongoDBConnection getConnection() {
-        return new MongoDBConnection(this.database, this.writeConcern, this.collectionName);
-    }
-
-    @Override
-    public String toString() {
-        return this.description;
-    }
 }

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/mongo/package-info.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/mongo/package-info.java?rev=1481932&r1=1481931&r2=1481932&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/mongo/package-info.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/mongo/package-info.java Mon May 13 15:37:27 2013
@@ -18,4 +18,3 @@
  * The classes in this package contain the MongoDB provider for the NoSQL Appender.
  */
 package org.apache.logging.log4j.core.appender.db.nosql.mongo;
-

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/package-info.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/package-info.java?rev=1481932&r1=1481931&r2=1481932&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/package-info.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/nosql/package-info.java Mon May 13 15:37:27 2013
@@ -29,4 +29,3 @@
  * </ul>
  */
 package org.apache.logging.log4j.core.appender.db.nosql;
-

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/package-info.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/package-info.java?rev=1481932&r1=1481931&r2=1481932&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/package-info.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/package-info.java Mon May 13 15:37:27 2013
@@ -19,4 +19,3 @@
  * accessing databases.
  */
 package org.apache.logging.log4j.core.appender.db;
-

Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/TestBasicEntity.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/TestBasicEntity.java?rev=1481932&r1=1481931&r2=1481932&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/TestBasicEntity.java (original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/TestBasicEntity.java Mon May 13 15:37:27 2013
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
 package org.apache.logging.log4j.core.appender.db.jpa;
 
 import org.apache.logging.log4j.Marker;

Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextMapAttributeConverterTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextMapAttributeConverterTest.java?rev=1481932&r1=1481931&r2=1481932&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextMapAttributeConverterTest.java (original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextMapAttributeConverterTest.java Mon May 13 15:37:27 2013
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
 package org.apache.logging.log4j.core.appender.db.jpa.converter;
 
 import org.junit.After;

Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextMapJsonAttributeConverterTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextMapJsonAttributeConverterTest.java?rev=1481932&r1=1481931&r2=1481932&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextMapJsonAttributeConverterTest.java (original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextMapJsonAttributeConverterTest.java Mon May 13 15:37:27 2013
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
 package org.apache.logging.log4j.core.appender.db.jpa.converter;
 
 import org.junit.After;

Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackAttributeConverterTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackAttributeConverterTest.java?rev=1481932&r1=1481931&r2=1481932&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackAttributeConverterTest.java (original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackAttributeConverterTest.java Mon May 13 15:37:27 2013
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
 package org.apache.logging.log4j.core.appender.db.jpa.converter;
 
 import org.apache.logging.log4j.ThreadContext;

Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverterTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverterTest.java?rev=1481932&r1=1481931&r2=1481932&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverterTest.java (original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverterTest.java Mon May 13 15:37:27 2013
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
 package org.apache.logging.log4j.core.appender.db.jpa.converter;
 
 import org.apache.logging.log4j.ThreadContext;

Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MarkerAttributeConverterTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MarkerAttributeConverterTest.java?rev=1481932&r1=1481931&r2=1481932&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MarkerAttributeConverterTest.java (original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MarkerAttributeConverterTest.java Mon May 13 15:37:27 2013
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
 package org.apache.logging.log4j.core.appender.db.jpa.converter;
 
 import org.apache.logging.log4j.Marker;

Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MessageAttributeConverterTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MessageAttributeConverterTest.java?rev=1481932&r1=1481931&r2=1481932&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MessageAttributeConverterTest.java (original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MessageAttributeConverterTest.java Mon May 13 15:37:27 2013
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
 package org.apache.logging.log4j.core.appender.db.jpa.converter;
 
 import org.apache.logging.log4j.message.Message;

Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverterTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverterTest.java?rev=1481932&r1=1481931&r2=1481932&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverterTest.java (original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverterTest.java Mon May 13 15:37:27 2013
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
 package org.apache.logging.log4j.core.appender.db.jpa.converter;
 
 import org.junit.After;

Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverterTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverterTest.java?rev=1481932&r1=1481931&r2=1481932&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverterTest.java (original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverterTest.java Mon May 13 15:37:27 2013
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
 package org.apache.logging.log4j.core.appender.db.jpa.converter;
 
 import org.junit.After;



Mime
View raw message