You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@empire-db.apache.org by "rit@pm-mail.co.uk" <ri...@pm-mail.co.uk> on 2012/04/17 22:14:58 UTC

Are there any docs covering the CodeGenWriter

I'm starting from scratch when it comes to empiredb, so am not to clear on
how everything hangs together. Is there a doc covering how to use the
codegen module so that I can convert a current schema into code.

Thanks

Re: Are there any docs covering the CodeGenWriter

Posted by Francis De Brabandere <fr...@gmail.com>.
Hi Rit?

At this time there is no documentation but the codegen example (maven)
mvn empiredb:codegen

CodeGenMojo.java (in the maven plugin module) explains how to use the
codegenerator programatically:

CodeGenConfig config = new CodeGenConfig();
		if(configFile != null)
		{
			getLog().info("Loading configuration file: " + configFile);
			config.init(configFile.getAbsolutePath());
		}
		else
		{
			config.setJdbcURL(jdbcURL);
			config.setJdbcClass(jdbcClass);
			config.setJdbcUser(jdbcUser);
			config.setJdbcPwd(jdbcPwd);
			config.setTargetFolder(targetDirectory.getAbsolutePath());
			config.setTemplateFolder(templateDirectory);
			config.setPackageName(packageName);
		}
		
		//config.setExceptionsEnabled(true);
		
		getLog().info("Generating code for " + jdbcURL + " ...");
		
		CodeGenParser parser = new CodeGenParser(config);
		DBDatabase db = parser.loadDbModel();
		
		CodeGenWriter codeGen = new CodeGenWriter(config);
		codeGen.generateCodeFiles(db);


I hope this helps,
Francis

On 17 April 2012 22:14, rit@pm-mail.co.uk <ri...@pm-mail.co.uk> wrote:
> I'm starting from scratch when it comes to empiredb, so am not to clear on
> how everything hangs together. Is there a doc covering how to use the
> codegen module so that I can convert a current schema into code.
>
>
>
> Thanks