empire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From franci...@apache.org
Subject svn commit: r905416 - /incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/CodeGenConfig.java
Date Mon, 01 Feb 2010 21:25:10 GMT
Author: francisdb
Date: Mon Feb  1 21:25:08 2010
New Revision: 905416

URL: http://svn.apache.org/viewvc?rev=905416&view=rev
Log:
EMPIREDB-64
Fall back to [packageName].xxx instead of com.foo.bar.xxx

Modified:
    incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/CodeGenConfig.java

Modified: incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/CodeGenConfig.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/CodeGenConfig.java?rev=905416&r1=905415&r2=905416&view=diff
==============================================================================
--- incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/CodeGenConfig.java
(original)
+++ incubator/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/CodeGenConfig.java
Mon Feb  1 21:25:08 2010
@@ -21,13 +21,13 @@
 import org.apache.empire.xml.XMLConfiguration;
 
 public class CodeGenConfig extends XMLConfiguration {
-	private String jdbcClass = "org.hsqldb.jdbcDriver";
+	private String jdbcClass;
 
-	private String jdbcURL = "jdbc:hsqldb:file:hsqldb/sample;shutdown=true";
+	private String jdbcURL;
 
-	private String jdbcUser = "sa";
+	private String jdbcUser;
 
-	private String jdbcPwd = "";
+	private String jdbcPwd;
 
 	// generation options
 	/**
@@ -46,8 +46,9 @@
 	private String dbTablePattern = null;
 	/**
 	 * Name of the timestamp column used for optimistic locking (may be null)
+	 * e.g. "UPDATE_TIMESTAMP";
 	 */
-	private String timestampColumn = null; // e.g. "UPDATE_TIMESTAMP";
+	private String timestampColumn = null;
 
 	/**
 	 * name of the target folder
@@ -67,33 +68,36 @@
 	/**
 	 * name of the table target package
 	 */
-	private String tablePackageName = "org.foo.db.tables";
+	private String tablePackageName;
 	
 	/**
 	 * name of the record target package
 	 */
-	private String recordPackageName = "org.foo.db.records";
+	private String recordPackageName;
 	
 	/**
 	 * name of the view target package
 	 */
-	private String viewPackageName = "org.foo.db.views";
+	private String viewPackageName;
 
 	/**
 	 * Target name of the generated database class. This class extends
 	 * DBDatabase.
 	 */
 	private String dbClassName = "MyDB";
+	
 	/**
 	 * Target name of the generated table class. This class extends DBTable and
 	 * is the base class for all generated individual table classes.
 	 */
 	private String tableBaseName = "MyTable";
+	
 	/**
 	 * Target name of the generated view class. This class extends DBView and is
 	 * the base class for all generated individual view classes.
 	 */
 	private String viewBaseName = "MyView";
+	
 	/**
 	 * Target name of the generated record class. This is a template class that
 	 * extends DBRecord as follows:<br/>
@@ -105,6 +109,7 @@
 	 * <br/>
 	 */
 	private String recordBaseName = "MyRecord";
+	
 	/**
 	 * Prefix used for generating table class names.<br/>
 	 * The Table name is appended after the prefix starting with captial letter
@@ -134,6 +139,7 @@
 	 * Where "Table" is the suffix.
 	 */
 	private String tableClassSuffix = "Table";
+	
 	/**
 	 * Prefix used for generating view class names.<br/>
 	 * The Table name is appended after the prefix starting with captial letter
@@ -164,11 +170,13 @@
 	 * if FALSE table classes should be declared as top level classes.
 	 */
 	private boolean nestTables;
+	
 	/**
 	 * if TRUE view classes should be declared as inner classes of DBDatabase.<br/>
 	 * if FALSE view classes should be declared as top level classes.
 	 */
 	private boolean nestViews;
+	
 	/**
 	 * if TRUE record classes should have a getter and setter for each field.<br/>
 	 * Otherwiese getters / setters are omitted.
@@ -285,21 +293,21 @@
 	}
 	
 	public String getTablePackageName() {
-		return tablePackageName;
+		return fallback(tablePackageName, "tables");
 	}
 
 	public void setTablePackageName(String tablePackageName) {
 		this.tablePackageName = tablePackageName;
 	}
 	public String getRecordPackageName() {
-		return recordPackageName;
+		return fallback(recordPackageName, "records");
 	}
 
 	public void setRecordPackageName(String recordPackageName) {
 		this.recordPackageName = recordPackageName;
 	}
 	public String getViewPackageName() {
-		return viewPackageName;
+		return fallback(viewPackageName, "views");
 	}
 
 	public void setViewPackageName(String viewPackageName) {
@@ -394,4 +402,11 @@
 		this.createRecordProperties = createRecordProperties;
 	}
 
+	private String fallback(String packageName, String defaultSubpackage){
+		String pkg = packageName;
+		if( packageName == null && this.packageName != null){
+			pkg = this.packageName + "." + defaultSubpackage;
+		}
+		return pkg;
+	}
 }



Mime
View raw message