Friday, November 23, 2012

Scheduler with ATG StartSQLRepository

I was struggling to identify that how can I reuse the components that used by startSQLRepository batch file to import data to a repository using an ATG scheduler. After doing so much of research I found that it is very simple.

ATG internally uses TemplateParser component to load the repository. This class file has several static methods, here our interest would be on runParser() method which accepts a String[] and PrintWriter object. The String[] should pass the exactly same arguments as StartSQLRepository command without -m. Instead of -m, we need to pass -configPath (you can get the configPath using this.getNucleus.getConfigPath(String serverName)).

Example

String[] args = new String[5];
args[0]="-repository";
args[1]=getRepository();
args[2]="-outputSQL";
args[3]="-configPath";
args[4]=configPath;

int temp = TemplateParser.runParser(args, new PrintWriter(System.out, true));

This works!

Reference - http://www.oracle.com/technetwork/indexes/documentation/atgwebcommerce-393465.html

1 comment:

  1. good post,see also how to generate ddl using
    startsql repository.

    http://atgtipsandtweaks.blogspot.com/2012/02/generate-ddlsql-using-atg.html

    ReplyDelete