// do nothing
}
protected void processImpl( Template pTemplate ) {
Template template = pTemplate;
PropertySet tmps = template.getMergedPropertySet();
boolean successful = false;
PrintStream sysOut = null;
PrintStream sysErr = null;
RecordingUserMessageHandler rumh = new RecordingUserMessageHandler();
PrintStream outps = null;
PrintStream errps = null;
try {
String cw = tmps.get( Property.main_CodeWriter );
String cwo = makeCodeWriterOptions( tmps, template );
String[] args = ArgUtil.splitQuoted( cwo );
String cwp = getCodeWriterPath( tmps );
ClassLoader parent = getClass().getClassLoader();
GroovyClassLoader loader = new GroovyClassLoader(parent);
Class groovyClass = loader.parseClass( new File( cwp ) );
GroovyObject gtm = (GroovyObject) groovyClass.newInstance();
// DO NOT use CommandLineUserMessageHandler here - causes infinite recursion
MessageHandlerOutputStream out = new MessageHandlerOutputStream( UserMessageHandler.INFO, rumh );
MessageHandlerOutputStream err = new MessageHandlerOutputStream( UserMessageHandler.ERROR, rumh );
// space out dots to avoid accidental replace on System DOT out search
sysOut = System . out;
sysErr = System . err;
// set context if not null
Object context = template.getContext();
if( null != context ) {
gtm.invokeMethod("setContext", new Object[]{context});
}
outps = new PrintStream( out );
errps = new PrintStream( err );
System.setOut( outps );
System.setErr( errps );
Object result = gtm.invokeMethod("_generate", new Object[]{args,true});
WayPointRecorder.add( BasicWayPoint.ExecutingCodeWriter.make( template.getCodeWriterPath().getAbsolutePath() ) );
if( result instanceof Integer ) {
successful = ( 0 == ((Integer)result).intValue() );
}
else {
successful = true;
}
template.setResult( result );
}
// FIX: need a util to handle general exceptions and just rethrow StandardExceptions
catch( StandardException se ) {
throw se;