* @throws PlatformException If some error occurred
*/
public void createCreationScript() throws PlatformException
{
Project project = new Project();
TorqueDataModelTask modelTask = new TorqueDataModelTask();
File tmpDir = null;
File scriptFile = null;
_creationScript = null;
try
{
tmpDir = new File(getWorkDir(), "schemas");
tmpDir.mkdir();
String includes = writeSchemata(tmpDir);
scriptFile = new File(tmpDir, CREATION_SCRIPT_NAME);
project.setBasedir(tmpDir.getAbsolutePath());
// populating with defaults
modelTask.setProject(project);
modelTask.setUseClasspath(true);
modelTask.setControlTemplate("sql/db-init/Control.vm");
modelTask.setOutputDirectory(tmpDir);
modelTask.setOutputFile(CREATION_SCRIPT_NAME);
modelTask.setTargetDatabase(_targetDatabase);
FileSet files = new FileSet();
files.setDir(tmpDir);
files.setIncludes(includes);
modelTask.addFileset(files);
modelTask.execute();
_creationScript = readTextCompressed(scriptFile);
deleteDir(tmpDir);
}