logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nickwilli...@apache.org
Subject svn commit: r1481666 - in /logging/log4j/log4j2/trunk/core/src: main/java/org/apache/logging/log4j/core/appender/db/jpa/ test/java/org/apache/logging/log4j/core/appender/db/jpa/
Date Sun, 12 May 2013 22:54:35 GMT
Author: nickwilliams
Date: Sun May 12 22:54:34 2013
New Revision: 1481666

URL: http://svn.apache.org/r1481666
Log:
Renaming LogEventWrapperEntity to AbstractLogEventWrapperEntity.

Added:
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/AbstractLogEventWrapperEntity.java
      - copied, changed from r1481664, logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/LogEventWrapperEntity.java
Removed:
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/LogEventWrapperEntity.java
Modified:
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/JPAAppender.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/JPADatabaseManager.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/LogEventEntity.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/TestEntity.java

Copied: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/AbstractLogEventWrapperEntity.java
(from r1481664, logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/LogEventWrapperEntity.java)
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/AbstractLogEventWrapperEntity.java?p2=logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/AbstractLogEventWrapperEntity.java&p1=logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/LogEventWrapperEntity.java&r1=1481664&r2=1481666&rev=1481666&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/LogEventWrapperEntity.java
(original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/AbstractLogEventWrapperEntity.java
Sun May 12 22:54:34 2013
@@ -35,7 +35,7 @@ import java.util.Map;
  * <br>
  * The concrete class must have two constructors: a public no-arg constructor to convince
the JPA provider that it's a
  * valid entity, and a public constructor that takes a single {@link LogEvent event} and
passes it to the parent class
- * with {@link #LogEventWrapperEntity(LogEvent) super(event)}. Furthermore, the concrete
class must be annotated
+ * with {@link #AbstractLogEventWrapperEntity(LogEvent) super(event)}. Furthermore, the concrete
class must be annotated
  * {@link javax.persistence.Entity @Entity} and {@link javax.persistence.Table @Table} and
must implement a fully
  * mutable ID property annotated with {@link javax.persistence.Id @Id} and
  * {@link javax.persistence.GeneratedValue @GeneratedValue} to tell the JPA provider how
to calculate an ID for new
@@ -55,7 +55,7 @@ import java.util.Map;
  * @see LogEventEntity
  */
 @MappedSuperclass
-public abstract class LogEventWrapperEntity implements LogEvent {
+public abstract class AbstractLogEventWrapperEntity implements LogEvent {
     /**
      * Generated serial version ID.
      */
@@ -63,7 +63,7 @@ public abstract class LogEventWrapperEnt
     private final LogEvent wrappedEvent;
 
     @SuppressWarnings("unused") // JPA requires this
-    protected LogEventWrapperEntity() {
+    protected AbstractLogEventWrapperEntity() {
         this(null);
     }
 
@@ -74,7 +74,7 @@ public abstract class LogEventWrapperEnt
      * @param wrappedEvent
      *            The underlying event from which information is obtained.
      */
-    protected LogEventWrapperEntity(final LogEvent wrappedEvent) {
+    protected AbstractLogEventWrapperEntity(final LogEvent wrappedEvent) {
         this.wrappedEvent = wrappedEvent;
     }
 

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/JPAAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/JPAAppender.java?rev=1481666&r1=1481665&r2=1481666&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/JPAAppender.java
(original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/JPAAppender.java
Sun May 12 22:54:34 2013
@@ -16,8 +16,6 @@
  */
 package org.apache.logging.log4j.core.appender.db.jpa;
 
-import java.lang.reflect.Constructor;
-
 import org.apache.logging.log4j.core.Filter;
 import org.apache.logging.log4j.core.LogEvent;
 import org.apache.logging.log4j.core.appender.db.AbstractDatabaseAppender;
@@ -26,12 +24,14 @@ import org.apache.logging.log4j.core.con
 import org.apache.logging.log4j.core.config.plugins.PluginElement;
 import org.apache.logging.log4j.core.config.plugins.PluginFactory;
 
+import java.lang.reflect.Constructor;
+
 /**
  * This Appender writes logging events to a relational database using the Java Persistence
API. It requires a
- * pre-configured JPA persistence unit and a concrete implementation of the abstract {@link
LogEventWrapperEntity} class
+ * pre-configured JPA persistence unit and a concrete implementation of the abstract {@link
AbstractLogEventWrapperEntity} class
  * decorated with JPA annotations.
  * 
- * @see LogEventWrapperEntity
+ * @see AbstractLogEventWrapperEntity
  */
 @Plugin(name = "Jpa", category = "Core", elementType = "appender", printObject = true)
 public final class JPAAppender extends AbstractDatabaseAppender<JPADatabaseManager>
{
@@ -48,7 +48,7 @@ public final class JPAAppender extends A
      *            If an integer greater than 0, this causes the appender to buffer log events
and flush whenever the
      *            buffer reaches this size.
      * @param entityClassName
-     *            The fully qualified name of the concrete {@link LogEventWrapperEntity}
implementation that has JPA
+     *            The fully qualified name of the concrete {@link AbstractLogEventWrapperEntity}
implementation that has JPA
      *            annotations mapping it to a database table.
      * @param persistenceUnitName
      *            The name of the JPA persistence unit that should be used for persisting
log events.
@@ -78,11 +78,11 @@ public final class JPAAppender extends A
 
         try {
             @SuppressWarnings("unchecked")
-            final Class<? extends LogEventWrapperEntity> entityClass = (Class<?
extends LogEventWrapperEntity>) Class
+            final Class<? extends AbstractLogEventWrapperEntity> entityClass = (Class<?
extends AbstractLogEventWrapperEntity>) Class
                     .forName(entityClassName);
 
-            if (!LogEventWrapperEntity.class.isAssignableFrom(entityClass)) {
-                LOGGER.error("Entity class [{}] does not extend LogEventWrapperEntity.",
entityClassName);
+            if (!AbstractLogEventWrapperEntity.class.isAssignableFrom(entityClass)) {
+                LOGGER.error("Entity class [{}] does not extend AbstractLogEventWrapperEntity.",
entityClassName);
                 return null;
             }
 
@@ -94,7 +94,7 @@ public final class JPAAppender extends A
                 return null;
             }
 
-            final Constructor<? extends LogEventWrapperEntity> entityConstructor =
entityClass
+            final Constructor<? extends AbstractLogEventWrapperEntity> entityConstructor
= entityClass
                     .getConstructor(LogEvent.class);
 
             final String managerName = "jpaManager{ description=" + name + ", bufferSize="
+ bufferSizeInt

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/JPADatabaseManager.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/JPADatabaseManager.java?rev=1481666&r1=1481665&r2=1481666&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/JPADatabaseManager.java
(original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/JPADatabaseManager.java
Sun May 12 22:54:34 2013
@@ -16,28 +16,27 @@
  */
 package org.apache.logging.log4j.core.appender.db.jpa;
 
-import java.lang.reflect.Constructor;
+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 javax.persistence.EntityManager;
 import javax.persistence.EntityManagerFactory;
 import javax.persistence.EntityTransaction;
 import javax.persistence.Persistence;
-
-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.lang.reflect.Constructor;
 
 /**
  * An {@link AbstractDatabaseManager} implementation for relational databases accessed via
JPA.
  */
 public final class JPADatabaseManager extends AbstractDatabaseManager {
     private static final class FactoryData extends AbstractDatabaseManager.AbstractFactoryData
{
-        private final Class<? extends LogEventWrapperEntity> entityClass;
-        private final Constructor<? extends LogEventWrapperEntity> entityConstructor;
+        private final Class<? extends AbstractLogEventWrapperEntity> entityClass;
+        private final Constructor<? extends AbstractLogEventWrapperEntity> entityConstructor;
         private final String persistenceUnitName;
 
-        protected FactoryData(final int bufferSize, final Class<? extends LogEventWrapperEntity>
entityClass,
-                final Constructor<? extends LogEventWrapperEntity> entityConstructor,
final String persistenceUnitName) {
+        protected FactoryData(final int bufferSize, final Class<? extends AbstractLogEventWrapperEntity>
entityClass,
+                final Constructor<? extends AbstractLogEventWrapperEntity> entityConstructor,
final String persistenceUnitName) {
             super(bufferSize);
 
             this.entityClass = entityClass;
@@ -64,7 +63,7 @@ public final class JPADatabaseManager ex
      * @param bufferSize
      *            The size of the log event buffer.
      * @param entityClass
-     *            The fully-qualified class name of the {@link LogEventWrapperEntity} concrete
implementation.
+     *            The fully-qualified class name of the {@link AbstractLogEventWrapperEntity}
concrete implementation.
      * @param entityConstructor
      *            The one-arg {@link LogEvent} constructor for the concrete entity class.
      * @param persistenceUnitName
@@ -72,15 +71,15 @@ public final class JPADatabaseManager ex
      * @return a new or existing JPA manager as applicable.
      */
     public static JPADatabaseManager getJPADatabaseManager(final String name, final int bufferSize,
-            final Class<? extends LogEventWrapperEntity> entityClass,
-            final Constructor<? extends LogEventWrapperEntity> entityConstructor, final
String persistenceUnitName) {
+            final Class<? extends AbstractLogEventWrapperEntity> entityClass,
+            final Constructor<? extends AbstractLogEventWrapperEntity> entityConstructor,
final String persistenceUnitName) {
 
         return AbstractDatabaseManager.getManager(name, new FactoryData(bufferSize, entityClass,
entityConstructor,
                 persistenceUnitName), FACTORY);
     }
 
     private final String entityClassName;
-    private final Constructor<? extends LogEventWrapperEntity> entityConstructor;
+    private final Constructor<? extends AbstractLogEventWrapperEntity> entityConstructor;
     private EntityManager entityManager;
 
     private EntityManagerFactory entityManagerFactory;
@@ -90,8 +89,8 @@ public final class JPADatabaseManager ex
     private EntityTransaction transaction;
 
     private JPADatabaseManager(final String name, final int bufferSize,
-            final Class<? extends LogEventWrapperEntity> entityClass,
-            final Constructor<? extends LogEventWrapperEntity> entityConstructor, final
String persistenceUnitName) {
+            final Class<? extends AbstractLogEventWrapperEntity> entityClass,
+            final Constructor<? extends AbstractLogEventWrapperEntity> entityConstructor,
final String persistenceUnitName) {
         super(name, bufferSize);
         this.entityClassName = entityClass.getName();
         this.entityConstructor = entityConstructor;
@@ -126,7 +125,7 @@ public final class JPADatabaseManager ex
             return;
         }
 
-        LogEventWrapperEntity entity;
+        AbstractLogEventWrapperEntity entity;
         try {
             entity = this.entityConstructor.newInstance(event);
         } catch (final Exception e) {

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/LogEventEntity.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/LogEventEntity.java?rev=1481666&r1=1481665&r2=1481666&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/LogEventEntity.java
(original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/db/jpa/LogEventEntity.java
Sun May 12 22:54:34 2013
@@ -20,7 +20,7 @@ import javax.persistence.MappedSuperclas
 import java.util.Map;
 
 /**
- * Users of the JPA appender may want to extend this class instead of {@link LogEventWrapperEntity}.
This class
+ * Users of the JPA appender may want to extend this class instead of {@link AbstractLogEventWrapperEntity}.
This class
  * implements all of the required mutator methods but does not implement a mutable entity
ID property. In order to
  * create an entity based on this class, you need only create two constructors matching this
class's
  * constructors, annotate the class {@link javax.persistence.Entity @Entity} and {@link javax.persistence.Table
@Table},
@@ -44,10 +44,10 @@ import java.util.Map;
  * there are any attributes you do not want persistent, you should override their accessor
methods and annotate with
  * {@link javax.persistence.Transient @Transient}.
  *
- * @see LogEventWrapperEntity
+ * @see AbstractLogEventWrapperEntity
  */
 @MappedSuperclass
-public abstract class LogEventEntity extends LogEventWrapperEntity {
+public abstract class LogEventEntity extends AbstractLogEventWrapperEntity {
     @SuppressWarnings("unused") // JPA requires this
     public LogEventEntity() {
         super();

Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/TestEntity.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/TestEntity.java?rev=1481666&r1=1481665&r2=1481666&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/TestEntity.java
(original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/TestEntity.java
Sun May 12 22:54:34 2013
@@ -43,7 +43,7 @@ import java.util.Map;
 @Entity
 @Table(name = "jpaBaseLogEntry")
 @SuppressWarnings("unused")
-public class TestEntity extends LogEventWrapperEntity {
+public class TestEntity extends AbstractLogEventWrapperEntity {
     private static final long serialVersionUID = 1L;
 
     private long id = 0L;



Mime
View raw message