cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmen...@apache.org
Subject svn commit: r470872 - /incubator/cayenne/main/trunk/other/maven-plugin/src/main/java/org/apache/cayenne/tools/CayenneGeneratorMojo.java
Date Fri, 03 Nov 2006 16:35:02 GMT
Author: kmenard
Date: Fri Nov  3 08:35:01 2006
New Revision: 470872

URL: http://svn.apache.org/viewvc?view=rev&rev=470872
Log:
Wrapping up the ILog stuff for the class generator so that there is no dependency on ant for
logging (CAY-591).

Modified:
    incubator/cayenne/main/trunk/other/maven-plugin/src/main/java/org/apache/cayenne/tools/CayenneGeneratorMojo.java

Modified: incubator/cayenne/main/trunk/other/maven-plugin/src/main/java/org/apache/cayenne/tools/CayenneGeneratorMojo.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/other/maven-plugin/src/main/java/org/apache/cayenne/tools/CayenneGeneratorMojo.java?view=diff&rev=470872&r1=470871&r2=470872
==============================================================================
--- incubator/cayenne/main/trunk/other/maven-plugin/src/main/java/org/apache/cayenne/tools/CayenneGeneratorMojo.java
(original)
+++ incubator/cayenne/main/trunk/other/maven-plugin/src/main/java/org/apache/cayenne/tools/CayenneGeneratorMojo.java
Fri Nov  3 08:35:01 2006
@@ -22,17 +22,11 @@
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugin.logging.Log;
 import org.apache.maven.project.MavenProject;
-import org.apache.cayenne.map.DataMap;
-import org.apache.cayenne.map.ObjEntity;
-import org.apache.cayenne.map.EntityResolver;
-import org.apache.cayenne.map.MapLoader;
 import org.apache.cayenne.gen.DefaultClassGenerator;
-import org.apache.cayenne.util.Util;
-import org.xml.sax.InputSource;
 
 import java.io.File;
-import java.util.*;
 
 /**
  * Maven mojo to perform class generation from data map. This class is an Maven adapter to
@@ -265,17 +259,41 @@
 
 class MavenLogger implements ILog {
 	
-	private AbstractMojo parent;
+	private Log logger;
 	
 	public MavenLogger(AbstractMojo parent) {
-		this.parent = parent;
+		this.logger = parent.getLog();
 	}
 	
 	public void log(String msg) {
-		parent.getLog().info(msg);
+		logger.debug(msg);
 	}
 
 	public void log(String msg, int msgLevel) {
-		// TODO: (KJM 11/2/06) This should log at the appropriate level.
+		
+		switch (msgLevel) {
+			case ILog.MSG_DEBUG:
+				logger.debug(msg);
+				break;
+				
+			case ILog.MSG_ERR:
+				logger.error(msg);
+				break;
+				
+			case ILog.MSG_INFO:
+				logger.info(msg);
+				break;
+				
+			case ILog.MSG_VERBOSE:
+				logger.info(msg);
+				break;
+				
+			case ILog.MSG_WARN:
+				logger.warn(msg);
+				break;
+				
+			default:
+				logger.debug(msg);
+		}
 	}
 }



Mime
View raw message