public void dispose(StepMetaInterface smi, StepDataInterface sdi) { meta = (GPLoadMeta) smi; data = (GPLoadData) sdi; super.dispose(smi, sdi); if (!preview && meta.isEraseFiles()) { // Erase the created cfg/dat files if requested. We don't erase // the rest of the files because it would be "stupid" to erase them // right after creation. If you don't want them, don't fill them in. FileObject fileObject = null; String method = meta.getLoadMethod(); if ( // GPLoadMeta.METHOD_AUTO_CONCURRENT.equals(method) || GPLoadMeta.METHOD_AUTO_END.equals(method)) { /* if ( meta.getControlFile() != null ) { try { fileObject = KettleVFS.getFileObject(environmentSubstitute(meta.getControlFile()), getTransMeta()); fileObject.delete(); fileObject.close(); } catch ( Exception ex ) { logError("Error deleting control file \'" + KettleVFS.getFilename(fileObject) + "\': " + ex.getMessage()); } }*/ } if (GPLoadMeta.METHOD_AUTO_END.equals(method)) { // In concurrent mode the data is written to the control file. if (meta.getDataFile() != null) { try { fileObject = KettleVFS.getFileObject(environmentSubstitute(meta.getDataFile()), getTransMeta()); fileObject.delete(); fileObject.close(); } catch (Exception ex) { logError( "Error deleting data file \'" + KettleVFS.getFilename(fileObject) + "\': " + ex.getMessage(), ex); } } } if (GPLoadMeta.METHOD_MANUAL.equals(method)) { logBasic("Deletion of files is not compatible with \'manual load method\'"); } } }
public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleException { meta = (GPLoadMeta) smi; data = (GPLoadData) sdi; try { Object[] r = getRow(); // Get row from input rowset & set row busy! if (r == null) // no more input to be expected... { setOutputDone(); if (!preview) { if (output != null) { // Close the output try { output.close(); } catch (IOException e) { throw new KettleException("Error while closing output", e); } output = null; } String loadMethod = meta.getLoadMethod(); if (GPLoadMeta.METHOD_AUTO_END.equals(loadMethod)) { execute(meta, true); } // else if ( GPLoadMeta.METHOD_AUTO_CONCURRENT.equals(meta.getLoadMethod()) ) // { // try // { // if ( psqlProcess != null ) // { // int exitVal = psqlProcess.waitFor(); // logBasic(BaseMessages.getString(PKG, "GPLoad.Log.ExitValueSqlldr", "" + exitVal)); // //$NON-NLS-1$ // } // else // { // throw new KettleException("Internal error: no sqlldr process running"); // } // } // catch ( Exception ex ) // { // throw new KettleException("Error while executing sqlldr", ex); // } // } } return false; } if (!preview) { if (first) { first = false; createControlFile(environmentSubstitute(meta.getControlFile()), r, meta); output = new GPLoadDataOutput(meta, log.getLogLevel()); // if ( GPLoadMeta.METHOD_AUTO_CONCURRENT.equals(meta.getLoadMethod()) ) // { // execute(meta, false); // } output.open(this, gploadProcess); } output.writeLine(getInputRowMeta(), r); } putRow(getInputRowMeta(), r); incrementLinesOutput(); } catch (KettleException e) { logError( BaseMessages.getString(PKG, "GPLoad.Log.ErrorInStep") + e.getMessage()); // $NON-NLS-1$ setErrors(1); stopAll(); setOutputDone(); // signal end to receiver(s) return false; } return true; }