Skip to content

Commit

Permalink
[BACKLOG-1159] Hadoop File Output execution updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
e-cuellar committed Apr 21, 2015
1 parent d5ccbbc commit 2399580
Showing 1 changed file with 21 additions and 4 deletions.
Expand Up @@ -683,7 +683,7 @@ public void readData( Node stepnode ) throws KettleXMLException {
endedLine = ""; endedLine = "";
} }


fileName = XMLHandler.getTagValue( stepnode, "file", "name" ); fileName = loadSource( stepnode );
fileAsCommand = "Y".equalsIgnoreCase( XMLHandler.getTagValue( stepnode, "file", "is_command" ) ); fileAsCommand = "Y".equalsIgnoreCase( XMLHandler.getTagValue( stepnode, "file", "is_command" ) );
servletOutput = "Y".equalsIgnoreCase( XMLHandler.getTagValue( stepnode, "file", "servlet_output" ) ); servletOutput = "Y".equalsIgnoreCase( XMLHandler.getTagValue( stepnode, "file", "servlet_output" ) );
doNotOpenNewFileInit = doNotOpenNewFileInit =
Expand Down Expand Up @@ -960,7 +960,7 @@ public String getXML() {
retval.append( " " + XMLHandler.addTagValue( "fileNameField", fileNameField ) ); retval.append( " " + XMLHandler.addTagValue( "fileNameField", fileNameField ) );
retval.append( " " + XMLHandler.addTagValue( "create_parent_folder", createparentfolder ) ); retval.append( " " + XMLHandler.addTagValue( "create_parent_folder", createparentfolder ) );
retval.append( " <file>" ).append( Const.CR ); retval.append( " <file>" ).append( Const.CR );
retval.append( " " ).append( XMLHandler.addTagValue( "name", fileName ) ); saveSource( retval, fileName );
retval.append( " " ).append( XMLHandler.addTagValue( "is_command", fileAsCommand ) ); retval.append( " " ).append( XMLHandler.addTagValue( "is_command", fileAsCommand ) );
retval.append( " " ).append( XMLHandler.addTagValue( "servlet_output", servletOutput ) ); retval.append( " " ).append( XMLHandler.addTagValue( "servlet_output", servletOutput ) );
retval.append( " " ).append( XMLHandler.addTagValue( "do_not_open_new_file_init", doNotOpenNewFileInit ) ); retval.append( " " ).append( XMLHandler.addTagValue( "do_not_open_new_file_init", doNotOpenNewFileInit ) );
Expand Down Expand Up @@ -1025,7 +1025,7 @@ public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, Lis
} }
encoding = rep.getStepAttributeString( id_step, "encoding" ); encoding = rep.getStepAttributeString( id_step, "encoding" );


fileName = rep.getStepAttributeString( id_step, "file_name" ); fileName = loadSourceRep( rep, id_step );
fileAsCommand = rep.getStepAttributeBoolean( id_step, "file_is_command" ); fileAsCommand = rep.getStepAttributeBoolean( id_step, "file_is_command" );
servletOutput = rep.getStepAttributeBoolean( id_step, "file_servlet_output" ); servletOutput = rep.getStepAttributeBoolean( id_step, "file_servlet_output" );
doNotOpenNewFileInit = rep.getStepAttributeBoolean( id_step, "do_not_open_new_file_init" ); doNotOpenNewFileInit = rep.getStepAttributeBoolean( id_step, "do_not_open_new_file_init" );
Expand Down Expand Up @@ -1088,7 +1088,7 @@ public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transform
rep.saveStepAttribute( id_transformation, id_step, "format", fileFormat ); rep.saveStepAttribute( id_transformation, id_step, "format", fileFormat );
rep.saveStepAttribute( id_transformation, id_step, "compression", fileCompression ); rep.saveStepAttribute( id_transformation, id_step, "compression", fileCompression );
rep.saveStepAttribute( id_transformation, id_step, "encoding", encoding ); rep.saveStepAttribute( id_transformation, id_step, "encoding", encoding );
rep.saveStepAttribute( id_transformation, id_step, "file_name", fileName ); saveSourceRep( rep, id_transformation, id_step, fileName );
rep.saveStepAttribute( id_transformation, id_step, "file_is_command", fileAsCommand ); rep.saveStepAttribute( id_transformation, id_step, "file_is_command", fileAsCommand );
rep.saveStepAttribute( id_transformation, id_step, "file_servlet_output", servletOutput ); rep.saveStepAttribute( id_transformation, id_step, "file_servlet_output", servletOutput );
rep.saveStepAttribute( id_transformation, id_step, "do_not_open_new_file_init", doNotOpenNewFileInit ); rep.saveStepAttribute( id_transformation, id_step, "do_not_open_new_file_init", doNotOpenNewFileInit );
Expand Down Expand Up @@ -1240,4 +1240,21 @@ public StepMetaInjectionInterface getStepMetaInjectionInterface() {
public List<StepInjectionMetaEntry> extractStepMetadataEntries() throws KettleException { public List<StepInjectionMetaEntry> extractStepMetadataEntries() throws KettleException {
return getStepMetaInjectionInterface().extractStepMetadataEntries(); return getStepMetaInjectionInterface().extractStepMetadataEntries();
} }

protected String loadSource( Node stepnode ) {
return XMLHandler.getTagValue( stepnode, "file", "name" );
}

protected void saveSource( StringBuffer retVal, String value ) {
retVal.append( " " ).append( XMLHandler.addTagValue( "name", fileName ) );
}

protected String loadSourceRep( Repository rep, ObjectId id_step ) throws KettleException {
return rep.getStepAttributeString( id_step, "file_name" );
}

protected void saveSourceRep( Repository rep, ObjectId id_transformation, ObjectId id_step, String value )
throws KettleException {
rep.saveStepAttribute( id_transformation, id_step, "file_name", fileName );
}
} }

0 comments on commit 2399580

Please sign in to comment.