empire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From doeb...@apache.org
Subject svn commit: r1182431 - /incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/CodeGenerator.java
Date Wed, 12 Oct 2011 15:31:58 GMT
Author: doebele
Date: Wed Oct 12 15:31:58 2011
New Revision: 1182431

URL: http://svn.apache.org/viewvc?rev=1182431&view=rev
Log:
Just a small enhancement to the CodeGenerator main class

Added:
    incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/CodeGenerator.java
      - copied, changed from r1182241, incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/CodeGenApp.java

Copied: incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/CodeGenerator.java
(from r1182241, incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/CodeGenApp.java)
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/CodeGenerator.java?p2=incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/CodeGenerator.java&p1=incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/CodeGenApp.java&r1=1182241&r2=1182431&rev=1182431&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/CodeGenApp.java
(original)
+++ incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/CodeGenerator.java
Wed Oct 12 15:31:58 2011
@@ -26,9 +26,9 @@ import org.slf4j.LoggerFactory;
  * Console code generator application, takes the config file as first argument.
  *
  */
-public class CodeGenApp {
+public class CodeGenerator {
 	
-	private static final Logger log = LoggerFactory.getLogger(CodeGenApp.class);
+	private static final Logger log = LoggerFactory.getLogger(CodeGenerator.class);
 	
 	private static final String DEFAULT_CONFIG_FILE = "config.xml";
 	
@@ -41,17 +41,14 @@ public class CodeGenApp {
 	 */
 	public static void main(String[] args) {
 	    // Start code generator
-		CodeGenApp app = new CodeGenApp();
-		app.start((args.length > 0 ? args[0] : DEFAULT_CONFIG_FILE));
+		CodeGenerator app = new CodeGenerator();
+		app.generate((args.length > 0 ? args[0] : DEFAULT_CONFIG_FILE));
 	}	
 	
 	/**
-	 * Starts the actual generation according to the provided config file
+	 * Starts the actual generation according to the provided configuration
 	 */
-	private void start(final String file){
-		// load configuration file
-		CodeGenConfig config = loadConfig(file);
-
+	public void generate(CodeGenConfig config) {
 		// log all options
 		listOptions(config);
 		
@@ -65,13 +62,22 @@ public class CodeGenApp {
 		
 		log.info("Code generation completed successfully!");
 	}
+
+	/**
+	 * Starts the actual generation according to the provided config file
+	 */
+	public void generate(final String file) {
+		// load configuration file
+		CodeGenConfig config = loadConfig(file);
+		generate(config);
+	}	
 	
 	/**
 	 * Loads the configuration file and
 	 * @param configFile
 	 * @return
 	 */
-	private CodeGenConfig loadConfig(String configFile){
+	protected CodeGenConfig loadConfig(String configFile){
 		// Init Configuration
 		CodeGenConfig config = new CodeGenConfig();
 		config.init(configFile);
@@ -85,7 +91,7 @@ public class CodeGenApp {
 		return config;
 	}
 	
-	private void listOptions(CodeGenConfig config){
+	protected void listOptions(CodeGenConfig config){
 		// List options
 		log.info("Database connection successful. Config options are:");
 		log.info("SchemaName=" + String.valueOf(config.getDbSchema()));
@@ -102,6 +108,5 @@ public class CodeGenApp {
 		log.info("NestViews=" + config.isNestViews());
 		log.info("CreateRecordProperties=" + config.isCreateRecordProperties());
 	}
-	
 
 }



Mime
View raw message