empire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From doeb...@apache.org
Subject svn commit: r1621098 - in /empire-db/trunk/empire-db-codegen: pom.xml src/main/java/org/apache/empire/db/codegen/CodeGenWriter.java src/main/resources/templates/Database.vm
Date Thu, 28 Aug 2014 09:10:14 GMT
Author: doebele
Date: Thu Aug 28 09:10:14 2014
New Revision: 1621098

URL: http://svn.apache.org/r1621098
Log:
EMPIREDB-125

Modified:
    empire-db/trunk/empire-db-codegen/pom.xml
    empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/CodeGenWriter.java
    empire-db/trunk/empire-db-codegen/src/main/resources/templates/Database.vm

Modified: empire-db/trunk/empire-db-codegen/pom.xml
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db-codegen/pom.xml?rev=1621098&r1=1621097&r2=1621098&view=diff
==============================================================================
--- empire-db/trunk/empire-db-codegen/pom.xml (original)
+++ empire-db/trunk/empire-db-codegen/pom.xml Thu Aug 28 09:10:14 2014
@@ -77,4 +77,13 @@
 		--> 
 		
 	</dependencies>
+	
+	<build>
+	<resources>
+		<resource>
+			<directory>src/main/resources/templates</directory>
+			<filtering>true</filtering>
+		</resource>
+		</resources>
+	</build>
 </project>
\ No newline at end of file

Modified: empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/CodeGenWriter.java
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/CodeGenWriter.java?rev=1621098&r1=1621097&r2=1621098&view=diff
==============================================================================
--- empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/CodeGenWriter.java
(original)
+++ empire-db/trunk/empire-db-codegen/src/main/java/org/apache/empire/db/codegen/CodeGenWriter.java
Thu Aug 28 09:10:14 2014
@@ -100,7 +100,6 @@ public class CodeGenWriter {
 		if(config.getTemplateFolder() == null){
 			engine.setProperty(RuntimeConstants.RESOURCE_LOADER, "classpath");
 			engine.setProperty("classpath." + RuntimeConstants.RESOURCE_LOADER + ".class", ClasspathResourceLoader.class.getName());
-			config.setTemplateFolder("templates");
 		}else{
 			File templateFolder = new File(config.getTemplateFolder());
 			if(!templateFolder.canRead()){
@@ -288,7 +287,15 @@ public class CodeGenWriter {
 
 	private void writeFile(File file, String template,
 			VelocityContext context) {
-		String templatePath = config.getTemplateFolder()+ System.getProperty("file.separator")
+template;
+	    
+	    String templatePath;
+	    
+	    if(config.getTemplateFolder() == null) {
+	        templatePath = template;
+	    } else {
+	        templatePath = config.getTemplateFolder()+ System.getProperty("file.separator")
+ template;
+	    }
+	    
 		Writer writer = null;
 		try {
 			log.info("Writing " + file);

Modified: empire-db/trunk/empire-db-codegen/src/main/resources/templates/Database.vm
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db-codegen/src/main/resources/templates/Database.vm?rev=1621098&r1=1621097&r2=1621098&view=diff
==============================================================================
--- empire-db/trunk/empire-db-codegen/src/main/resources/templates/Database.vm (original)
+++ empire-db/trunk/empire-db-codegen/src/main/resources/templates/Database.vm Thu Aug 28
09:10:14 2014
@@ -115,13 +115,21 @@ public class $dbClassName extends DBData
 	
 	#if($nestTables == true)
 		#foreach ($table in $database.tables)
-			#parse( "$templateFolder/Table.vm" )
+			#if ($templateFolder)
+				#parse( "$templateFolder/Table.vm" )
+			#else
+				#parse( "Table.vm" )
+			#end
 		#end
 	#end
 
 	#if($nestViews == true)
 		#foreach ($view in $database.views)
-			#parse( "$templateFolder/View.vm" )
+			#if ($templateFolder)
+				#parse( "$templateFolder/View.vm" )
+			#else
+				#parse( "View.vm" )
+			#end
 		#end
 	#end
 	



Mime
View raw message