cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntimof...@apache.org
Subject [05/19] cayenne git commit: + slfj4 to cayenne-ant
Date Wed, 26 Apr 2017 10:09:19 GMT
+ slfj4 to cayenne-ant


Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/58e67ec8
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/58e67ec8
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/58e67ec8

Branch: refs/heads/master
Commit: 58e67ec8f684f03c0ed5a10fd435625a984792b4
Parents: 0aa789b
Author: Maxim Petrusevich <maks1464@gmail.com>
Authored: Wed Apr 12 12:00:28 2017 +0300
Committer: Maxim Petrusevich <maks1464@gmail.com>
Committed: Wed Apr 12 12:00:28 2017 +0300

----------------------------------------------------------------------
 cayenne-ant/pom.xml                             |   9 +-
 .../org/apache/cayenne/tools/AntLogger.java     | 296 +++++++++++++++++--
 .../apache/cayenne/tools/DbGeneratorTask.java   |   4 +-
 .../apache/cayenne/tools/DbImporterTask.java    |   4 +-
 .../cayenne/tools/DbGeneratorTaskTest.java      |   4 +-
 5 files changed, 275 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/58e67ec8/cayenne-ant/pom.xml
----------------------------------------------------------------------
diff --git a/cayenne-ant/pom.xml b/cayenne-ant/pom.xml
index 20c06fc..b6788d1 100644
--- a/cayenne-ant/pom.xml
+++ b/cayenne-ant/pom.xml
@@ -33,6 +33,10 @@
 	<dependencies>
         <!-- Compile Dependencies -->
         <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+        <dependency>
             <groupId>org.apache.ant</groupId>
             <artifactId>ant</artifactId>
             <scope>compile</scope>
@@ -101,11 +105,6 @@
         </dependency>
         <dependency>
             <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
             <artifactId>slf4j-simple</artifactId>
             <scope>test</scope>
         </dependency>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/58e67ec8/cayenne-ant/src/main/java/org/apache/cayenne/tools/AntLogger.java
----------------------------------------------------------------------
diff --git a/cayenne-ant/src/main/java/org/apache/cayenne/tools/AntLogger.java b/cayenne-ant/src/main/java/org/apache/cayenne/tools/AntLogger.java
index 4e8e8b5..95d98df 100644
--- a/cayenne-ant/src/main/java/org/apache/cayenne/tools/AntLogger.java
+++ b/cayenne-ant/src/main/java/org/apache/cayenne/tools/AntLogger.java
@@ -19,14 +19,15 @@
 
 package org.apache.cayenne.tools;
 
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.Task;
+import org.slf4j.Marker;
 
 /**
  * @since 3.0
  */
-class AntLogger implements Log {
+class AntLogger implements Logger {
 
     private Task parentTask;
 
@@ -34,75 +35,308 @@ class AntLogger implements Log {
         this.parentTask = parentTask;
     }
 
-    public void debug(Object message, Throwable th) {
-        parentTask.log(String.valueOf(message), Project.MSG_DEBUG);
+    @Override
+    public void debug(String message) {
+        parentTask.log(message, Project.MSG_DEBUG);
     }
 
-    public void debug(Object message) {
-        parentTask.log(String.valueOf(message), Project.MSG_DEBUG);
+    @Override
+    public void debug(String message, Object object) {
+        parentTask.log(message, Project.MSG_DEBUG);
     }
 
-    public void error(Object message, Throwable th) {
-        parentTask.log(String.valueOf(message), Project.MSG_ERR);
+    @Override
+    public void debug(String message, Object object, Object secondObject) {
+        parentTask.log(message, Project.MSG_DEBUG);
     }
 
-    public void error(Object message) {
-        parentTask.log(String.valueOf(message), Project.MSG_ERR);
+    @Override
+    public void debug(String message, Object... objects) {
+        parentTask.log(message, Project.MSG_DEBUG);
     }
 
-    public void fatal(Object message, Throwable th) {
-        parentTask.log(String.valueOf(message), Project.MSG_ERR);
+    @Override
+    public void debug(String message, Throwable throwable) {
+        parentTask.log(message, throwable, Project.MSG_DEBUG);
     }
 
-    public void fatal(Object message) {
-        parentTask.log(String.valueOf(message), Project.MSG_ERR);
+    @Override
+    public boolean isDebugEnabled(Marker marker) {
+        return true;
+    }
+
+    @Override
+    public void debug(Marker marker, String message) {
+        parentTask.log(message, Project.MSG_DEBUG);
+    }
+
+    @Override
+    public void debug(Marker marker, String message, Object object) {
+        parentTask.log(message, Project.MSG_DEBUG);
+    }
+
+    @Override
+    public void debug(Marker marker, String message, Object object, Object secondObject)
{
+        parentTask.log(message, Project.MSG_DEBUG);
+    }
+
+    @Override
+    public void debug(Marker marker, String message, Object... objects) {
+        parentTask.log(message, Project.MSG_DEBUG);
+    }
+
+    @Override
+    public void debug(Marker marker, String message, Throwable throwable) {
+        parentTask.log(message, throwable, Project.MSG_DEBUG);
+    }
+
+    @Override
+    public boolean isInfoEnabled() {
+        return true;
+    }
+
+    @Override
+    public void error(String message) {
+        parentTask.log(message, Project.MSG_ERR);
+    }
+
+    @Override
+    public void error(String message, Object object) {
+        parentTask.log(message, Project.MSG_ERR);
+    }
+
+    @Override
+    public void error(String message, Object object, Object secondObject) {
+        parentTask.log(message, Project.MSG_ERR);
+    }
+
+    @Override
+    public void error(String message, Object... objects) {
+        parentTask.log(message, Project.MSG_ERR);
+    }
+
+    @Override
+    public void error(String message, Throwable throwable) {
+        parentTask.log(message, throwable, Project.MSG_ERR);
     }
 
-    public void info(Object message, Throwable th) {
-        parentTask.log(String.valueOf(message), Project.MSG_INFO);
+    @Override
+    public boolean isErrorEnabled(Marker marker) {
+        return true;
+    }
+
+    @Override
+    public void error(Marker marker, String message) {
+        parentTask.log(message, Project.MSG_ERR);
+    }
+
+    @Override
+    public void error(Marker marker, String message, Object object) {
+        parentTask.log(message, Project.MSG_ERR);
+    }
+
+    @Override
+    public void error(Marker marker, String message, Object object, Object secondObject)
{
+        parentTask.log(message, Project.MSG_ERR);
+    }
+
+    @Override
+    public void error(Marker marker, String message, Object... objects) {
+        parentTask.log(message, Project.MSG_ERR);
+    }
+
+    @Override
+    public void error(Marker marker, String message, Throwable throwable) {
+        parentTask.log(message, throwable, Project.MSG_ERR);
+    }
+
+    @Override
+    public void info(String message) {
+        parentTask.log(message, Project.MSG_INFO);
+    }
+
+    @Override
+    public void info(String message, Object object) {
+        parentTask.log(message, Project.MSG_INFO);
+    }
+
+    @Override
+    public void info(String message, Object object, Object secondObject) {
+        parentTask.log(message, Project.MSG_INFO);
+    }
+
+    @Override
+    public void info(String message, Object... objects) {
+        parentTask.log(message, Project.MSG_INFO);
+    }
+
+    @Override
+    public void info(String message, Throwable throwable) {
+        parentTask.log(message, throwable, Project.MSG_INFO);
+    }
+
+    @Override
+    public boolean isInfoEnabled(Marker marker) {
+        return true;
     }
 
-    public void info(Object message) {
-        parentTask.log(String.valueOf(message), Project.MSG_INFO);
+    @Override
+    public void info(Marker marker, String message) {
+        parentTask.log(message, Project.MSG_INFO);
     }
 
-    public void trace(Object message, Throwable th) {
-        parentTask.log(String.valueOf(message), Project.MSG_VERBOSE);
+    @Override
+    public void info(Marker marker, String message, Object object) {
+        parentTask.log(message, Project.MSG_INFO);
     }
 
-    public void trace(Object message) {
-        parentTask.log(String.valueOf(message), Project.MSG_VERBOSE);
+    @Override
+    public void info(Marker marker, String message, Object object, Object secondObject) {
+        parentTask.log(message, Project.MSG_INFO);
     }
 
-    public void warn(Object message, Throwable th) {
-        parentTask.log(String.valueOf(message), Project.MSG_WARN);
+    @Override
+    public void info(Marker marker, String message, Object... objects) {
+        parentTask.log(message, Project.MSG_INFO);
     }
 
-    public void warn(Object message) {
-        parentTask.log(String.valueOf(message), Project.MSG_WARN);
+    @Override
+    public void info(Marker marker, String message, Throwable throwable) {
+        parentTask.log(message, throwable, Project.MSG_INFO);
     }
 
+    @Override
     public boolean isWarnEnabled() {
         return true;
     }
 
-    public boolean isDebugEnabled() {
+    @Override
+    public String getName() {
+        return parentTask.getTaskName();
+    }
+
+    @Override
+    public boolean isTraceEnabled() {
         return true;
     }
 
-    public boolean isErrorEnabled() {
+    @Override
+    public void trace(String message) {
+        parentTask.log(message, Project.MSG_VERBOSE);
+    }
+
+    @Override
+    public void trace(String message, Object object) {
+        parentTask.log(message, Project.MSG_VERBOSE);
+    }
+
+    @Override
+    public void trace(String message, Object object, Object secondObject) {
+        parentTask.log(message, Project.MSG_VERBOSE);
+    }
+
+    @Override
+    public void trace(String message, Object... objects) {
+        parentTask.log(message, Project.MSG_VERBOSE);
+    }
+
+    @Override
+    public void trace(String message, Throwable throwable) {
+        parentTask.log(message, throwable, Project.MSG_VERBOSE);
+    }
+
+    @Override
+    public boolean isTraceEnabled(Marker marker) {
         return true;
     }
 
-    public boolean isFatalEnabled() {
+    @Override
+    public void trace(Marker marker, String message) {
+        parentTask.log(message, Project.MSG_VERBOSE);
+    }
+
+    @Override
+    public void trace(Marker marker, String message, Object object) {
+        parentTask.log(message, Project.MSG_VERBOSE);
+    }
+
+    @Override
+    public void trace(Marker marker, String message, Object object, Object secondObject)
{
+        parentTask.log(message, Project.MSG_VERBOSE);
+    }
+
+    @Override
+    public void trace(Marker marker, String message, Object... objects) {
+        parentTask.log(message, Project.MSG_VERBOSE);
+    }
+
+    @Override
+    public void trace(Marker marker, String message, Throwable throwable) {
+        parentTask.log(message, throwable, Project.MSG_VERBOSE);
+    }
+
+    @Override
+    public boolean isDebugEnabled() {
         return true;
     }
 
-    public boolean isInfoEnabled() {
+    @Override
+    public void warn(String message) {
+        parentTask.log(message, Project.MSG_WARN);
+    }
+
+    @Override
+    public void warn(String message, Object object) {
+        parentTask.log(message, Project.MSG_WARN);
+    }
+
+    @Override
+    public void warn(String message, Object... objects) {
+        parentTask.log(message, Project.MSG_WARN);
+    }
+
+    @Override
+    public void warn(String message, Object object, Object secondObject) {
+        parentTask.log(message, Project.MSG_WARN);
+    }
+
+    @Override
+    public void warn(String message, Throwable throwable) {
+        parentTask.log(message, throwable, Project.MSG_WARN);
+    }
+
+    @Override
+    public boolean isWarnEnabled(Marker marker) {
         return true;
     }
 
-    public boolean isTraceEnabled() {
+    @Override
+    public void warn(Marker marker, String message) {
+        parentTask.log(message, Project.MSG_WARN);
+    }
+
+    @Override
+    public void warn(Marker marker, String message, Object object) {
+        parentTask.log(message, Project.MSG_WARN);
+    }
+
+    @Override
+    public void warn(Marker marker, String message, Object object, Object secondObject) {
+        parentTask.log(message, Project.MSG_WARN);
+    }
+
+    @Override
+    public void warn(Marker marker, String message, Object... objects) {
+        parentTask.log(message, Project.MSG_WARN);
+    }
+
+    @Override
+    public void warn(Marker marker, String message, Throwable throwable) {
+        parentTask.log(message, throwable, Project.MSG_WARN);
+    }
+
+    @Override
+    public boolean isErrorEnabled() {
         return true;
     }
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/58e67ec8/cayenne-ant/src/main/java/org/apache/cayenne/tools/DbGeneratorTask.java
----------------------------------------------------------------------
diff --git a/cayenne-ant/src/main/java/org/apache/cayenne/tools/DbGeneratorTask.java b/cayenne-ant/src/main/java/org/apache/cayenne/tools/DbGeneratorTask.java
index ce2e574..0e537f7 100644
--- a/cayenne-ant/src/main/java/org/apache/cayenne/tools/DbGeneratorTask.java
+++ b/cayenne-ant/src/main/java/org/apache/cayenne/tools/DbGeneratorTask.java
@@ -30,7 +30,7 @@ import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.map.DbEntity;
 import org.apache.cayenne.dbsync.reverse.configuration.ToolsModule;
 import org.apache.cayenne.util.Util;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Project;
 
@@ -57,7 +57,7 @@ public class DbGeneratorTask extends CayenneTask {
 	@Override
 	public void execute() {
 
-		Log logger = new AntLogger(this);
+		Logger logger = new AntLogger(this);
 
 		log(String.format("connection settings - [driver: %s, url: %s, username: %s]", driver,
url, userName),
 				Project.MSG_VERBOSE);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/58e67ec8/cayenne-ant/src/main/java/org/apache/cayenne/tools/DbImporterTask.java
----------------------------------------------------------------------
diff --git a/cayenne-ant/src/main/java/org/apache/cayenne/tools/DbImporterTask.java b/cayenne-ant/src/main/java/org/apache/cayenne/tools/DbImporterTask.java
index 9a42ede..8ab949f 100644
--- a/cayenne-ant/src/main/java/org/apache/cayenne/tools/DbImporterTask.java
+++ b/cayenne-ant/src/main/java/org/apache/cayenne/tools/DbImporterTask.java
@@ -39,9 +39,9 @@ import org.apache.cayenne.dbsync.reverse.filters.FiltersConfigBuilder;
 import org.apache.cayenne.di.DIBootstrap;
 import org.apache.cayenne.di.Injector;
 import org.apache.cayenne.util.Util;
-import org.apache.commons.logging.Log;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Project;
+import org.slf4j.Logger;
 import org.apache.tools.ant.Task;
 
 import java.io.File;
@@ -110,7 +110,7 @@ public class DbImporterTask extends Task {
         config.setFiltersConfig(new FiltersConfigBuilder(reverseEngineering).build());
         validateAttributes();
 
-        Log logger = new AntLogger(this);
+        Logger logger = new AntLogger(this);
         config.setLogger(logger);
         config.setSkipRelationshipsLoading(reverseEngineering.getSkipRelationshipsLoading());
         config.setSkipPrimaryKeyLoading(reverseEngineering.getSkipPrimaryKeyLoading());

http://git-wip-us.apache.org/repos/asf/cayenne/blob/58e67ec8/cayenne-ant/src/test/java/org/apache/cayenne/tools/DbGeneratorTaskTest.java
----------------------------------------------------------------------
diff --git a/cayenne-ant/src/test/java/org/apache/cayenne/tools/DbGeneratorTaskTest.java b/cayenne-ant/src/test/java/org/apache/cayenne/tools/DbGeneratorTaskTest.java
index bd02e12..1ba2584 100644
--- a/cayenne-ant/src/test/java/org/apache/cayenne/tools/DbGeneratorTaskTest.java
+++ b/cayenne-ant/src/test/java/org/apache/cayenne/tools/DbGeneratorTaskTest.java
@@ -25,7 +25,7 @@ import org.apache.cayenne.dba.sqlserver.SQLServerAdapter;
 import org.apache.cayenne.dbsync.reverse.configuration.ToolsModule;
 import org.apache.cayenne.di.DIBootstrap;
 import org.apache.cayenne.di.Injector;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
 import org.junit.Test;
 
 import javax.sql.DataSource;
@@ -53,7 +53,7 @@ public class DbGeneratorTaskTest {
     @Test
     public void testSetAdapter() throws Exception {
         DataSource ds = mock(DataSource.class);
-        Injector injector = DIBootstrap.createInjector(new ToolsModule(mock(Log.class)));
+        Injector injector = DIBootstrap.createInjector(new ToolsModule(mock(Logger.class)));
 
         DbGeneratorTask task = new DbGeneratorTask();
 


Mime
View raw message