Callable<Boolean> actionBeanRunner = new Callable<Boolean>() {
public Boolean call() throws Exception {
LocaleHelper.setLocaleOverride( (Locale) params.get( LocaleHelper.USER_LOCALE_PARAM ) );
// sync job params to the action bean
ActionHarness actionHarness = new ActionHarness( actionBean );
boolean updateJob = false;
final Map<String, Object> actionParams = new HashMap<String, Object>();
actionParams.putAll( params );
if ( streamProvider != null ) {
actionParams.put( "inputStream", streamProvider.getInputStream() );
}
actionHarness.setValues( actionParams, new ActionSequenceCompatibilityFormatter() );
if ( actionBean instanceof IVarArgsAction ) {
actionParams.remove( "inputStream" );
actionParams.remove( "outputStream" );
( (IVarArgsAction) actionBean ).setVarArgs( actionParams );
}
boolean waitForFileCreated = false;
OutputStream stream = null;
if ( streamProvider != null ) {
actionParams.remove( "inputStream" );
if ( actionBean instanceof IStreamingAction ) {
streamProvider.setStreamingAction( (IStreamingAction) actionBean );
}
// BISERVER-9414 - validate that output path still exist
SchedulerOutputPathResolver resolver =
new SchedulerOutputPathResolver( streamProvider.getOutputPath(), actionUser );
String outputPath = resolver.resolveOutputFilePath();
actionParams.put( "useJcr", Boolean.TRUE );
actionParams.put( "jcrOutputPath", outputPath.substring( 0, outputPath.lastIndexOf( "/" ) ) );
if ( !outputPath.equals( streamProvider.getOutputPath() ) ) {
streamProvider.setOutputFilePath( outputPath ); // set fallback path
updateJob = true; // job needs to be deleted and recreated with the new output path
}
stream = streamProvider.getOutputStream();
if ( stream instanceof ISourcesStreamEvents ) {
( (ISourcesStreamEvents) stream ).addListener( new IStreamListener() {
public void fileCreated( final String filePath ) {
synchronized ( lock ) {
outputFilePath = filePath;
lock.notifyAll();
}
}
} );
waitForFileCreated = true;
}
actionParams.put( "outputStream", stream );
// The lineage_id is only useful for the metadata and not needed at this level see PDI-10171
actionParams.remove( QuartzScheduler.RESERVEDMAPKEY_LINEAGE_ID );
actionHarness.setValues( actionParams );
}
actionBean.execute();
if (stream != null) {