cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntimof...@apache.org
Subject [03/19] cayenne git commit: + slf4j logger to cgen module, small code refactoring
Date Wed, 26 Apr 2017 10:09:17 GMT
+ slf4j logger to cgen module, small code refactoring


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

Branch: refs/heads/master
Commit: c2110ef3d6678226b4cc87af2cd0cf595b367d14
Parents: 0312b96
Author: Maxim Petrusevich <maks1464@gmail.com>
Authored: Wed Apr 12 10:08:44 2017 +0300
Committer: Maxim Petrusevich <maks1464@gmail.com>
Committed: Wed Apr 12 10:08:44 2017 +0300

----------------------------------------------------------------------
 cayenne-cgen/pom.xml                               |  4 ++--
 .../apache/cayenne/gen/ClassGenerationAction.java  |  6 +++---
 cayenne-server/pom.xml                             |  7 +------
 .../XMLDataChannelDescriptorLoader.java            | 10 +++++-----
 .../generic/GenericPlatformInitializer.java        |  6 +++---
 .../src/main/resources/commons-logging.properties  | 17 -----------------
 6 files changed, 14 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/c2110ef3/cayenne-cgen/pom.xml
----------------------------------------------------------------------
diff --git a/cayenne-cgen/pom.xml b/cayenne-cgen/pom.xml
index 801a4b6..20bef58 100644
--- a/cayenne-cgen/pom.xml
+++ b/cayenne-cgen/pom.xml
@@ -43,8 +43,8 @@
         </dependency>
 
         <dependency>
-            <groupId>commons-logging</groupId>
-            <artifactId>commons-logging</artifactId>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
             <scope>compile</scope>
         </dependency>
 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/c2110ef3/cayenne-cgen/src/main/java/org/apache/cayenne/gen/ClassGenerationAction.java
----------------------------------------------------------------------
diff --git a/cayenne-cgen/src/main/java/org/apache/cayenne/gen/ClassGenerationAction.java
b/cayenne-cgen/src/main/java/org/apache/cayenne/gen/ClassGenerationAction.java
index 387cabb..8d08c52 100644
--- a/cayenne-cgen/src/main/java/org/apache/cayenne/gen/ClassGenerationAction.java
+++ b/cayenne-cgen/src/main/java/org/apache/cayenne/gen/ClassGenerationAction.java
@@ -25,7 +25,7 @@ import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.map.Embeddable;
 import org.apache.cayenne.map.ObjEntity;
 import org.apache.cayenne.map.QueryDescriptor;
-import org.apache.commons.logging.Log;
+import org.slf4j.Logger;
 import org.apache.velocity.Template;
 import org.apache.velocity.VelocityContext;
 import org.apache.velocity.app.VelocityEngine;
@@ -68,7 +68,7 @@ public class ClassGenerationAction {
 	protected ArtifactsGenerationMode artifactsGenerationMode;
 	protected boolean makePairs;
 
-	protected Log logger;
+	protected Logger logger;
 	protected File destDir;
 	protected boolean overwrite;
 	protected boolean usePkgPath;
@@ -569,7 +569,7 @@ public class ClassGenerationAction {
 	 * Injects an optional logger that will be used to trace generated files at
 	 * the info level.
 	 */
-	public void setLogger(Log logger) {
+	public void setLogger(Logger logger) {
 		this.logger = logger;
 	}
 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/c2110ef3/cayenne-server/pom.xml
----------------------------------------------------------------------
diff --git a/cayenne-server/pom.xml b/cayenne-server/pom.xml
index ddc4cfa..684e857 100644
--- a/cayenne-server/pom.xml
+++ b/cayenne-server/pom.xml
@@ -36,13 +36,8 @@
 		<dependency>
 			<groupId>org.slf4j</groupId>
 			<artifactId>slf4j-api</artifactId>
+			<scope>compile</scope>
 		</dependency>
-
-		<dependency>
-			<groupId>org.slf4j</groupId>
-			<artifactId>slf4j-simple</artifactId>
-		</dependency>
-
 		<dependency>
 			<groupId>org.apache.cayenne</groupId>
 			<artifactId>cayenne-di</artifactId>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/c2110ef3/cayenne-server/src/main/java/org/apache/cayenne/configuration/XMLDataChannelDescriptorLoader.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/configuration/XMLDataChannelDescriptorLoader.java
b/cayenne-server/src/main/java/org/apache/cayenne/configuration/XMLDataChannelDescriptorLoader.java
index 00bbee2..ad9341a 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/configuration/XMLDataChannelDescriptorLoader.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/configuration/XMLDataChannelDescriptorLoader.java
@@ -69,7 +69,7 @@ public class XMLDataChannelDescriptorLoader implements DataChannelDescriptorLoad
 		} catch (IOException exception) {
 			// Log the error while trying to open the stream. A null
 			// password will be returned as a result.
-			logger.warn(exception.getMessage());
+			logger.warn(exception.getMessage(), exception);
 		}
 
 		return password;
@@ -88,7 +88,7 @@ public class XMLDataChannelDescriptorLoader implements DataChannelDescriptorLoad
 
 			password = bufferedReader.readLine();
 		} catch (IOException exception) {
-			logger.warn(exception.getMessage());
+			logger.warn(exception.getMessage(), exception);
 		} finally {
 
 			try {
@@ -339,7 +339,7 @@ public class XMLDataChannelDescriptorLoader implements DataChannelDescriptorLoad
 						try {
 							password = passwordFromURL(new URL(passwordSource));
 						} catch (MalformedURLException exception) {
-							logger.warn(exception.getMessage());
+							logger.warn(exception.getMessage(), exception);
 						}
 					} else if (passwordLocation.equals(DataSourceInfo.PASSWORD_LOCATION_EXECUTABLE)) {
 						if (passwordSource != null) {
@@ -348,9 +348,9 @@ public class XMLDataChannelDescriptorLoader implements DataChannelDescriptorLoad
 								password = passwordFromInputStream(process.getInputStream());
 								process.waitFor();
 							} catch (IOException exception) {
-								logger.warn(exception.getMessage());
+								logger.warn(exception.getMessage(), exception);
 							} catch (InterruptedException exception) {
-								logger.warn(exception.getMessage());
+								logger.warn(exception.getMessage(), exception);
 							}
 						}
 					}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/c2110ef3/modeler/cayenne-modeler-generic-ext/src/main/java/org/apache/cayenne/modeler/generic/GenericPlatformInitializer.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler-generic-ext/src/main/java/org/apache/cayenne/modeler/generic/GenericPlatformInitializer.java
b/modeler/cayenne-modeler-generic-ext/src/main/java/org/apache/cayenne/modeler/generic/GenericPlatformInitializer.java
index 39ee16b..5a5c426 100644
--- a/modeler/cayenne-modeler-generic-ext/src/main/java/org/apache/cayenne/modeler/generic/GenericPlatformInitializer.java
+++ b/modeler/cayenne-modeler-generic-ext/src/main/java/org/apache/cayenne/modeler/generic/GenericPlatformInitializer.java
@@ -22,8 +22,8 @@ import javax.swing.JFrame;
 import javax.swing.UIManager;
 
 import org.apache.cayenne.modeler.init.platform.PlatformInitializer;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import com.jgoodies.looks.plastic.PlasticLookAndFeel;
 import com.jgoodies.looks.plastic.PlasticTheme;
@@ -31,7 +31,7 @@ import com.jgoodies.looks.plastic.PlasticXPLookAndFeel;
 
 public class GenericPlatformInitializer implements PlatformInitializer {
 
-    private static Log logger = LogFactory.getLog(GenericPlatformInitializer.class);
+    private static Logger logger = LoggerFactory.getLogger(GenericPlatformInitializer.class);
 
     static final String DEFAULT_LAF_NAME = PlasticXPLookAndFeel.class.getName();
 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/c2110ef3/modeler/cayenne-modeler/src/main/resources/commons-logging.properties
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/resources/commons-logging.properties b/modeler/cayenne-modeler/src/main/resources/commons-logging.properties
deleted file mode 100644
index d459acf..0000000
--- a/modeler/cayenne-modeler/src/main/resources/commons-logging.properties
+++ /dev/null
@@ -1,17 +0,0 @@
-#   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.
-


Mime
View raw message