/** * {@inheritDoc} * * @see at.aschauer.commons.pentaho.plugin.PluginProperty#evaluate() */ public boolean evaluate() { return StringUtils.isNotBlank( this.getValue() ); }
/** * @param databaseList * A list of available DatabaseMeta in this transformation. */ private void initDbMeta( final List<DatabaseMeta> databaseList ) { if ( !StringUtils.isEmpty( this.connectionName.getValue() ) ) { this.dbMeta = DatabaseMeta.findDatabase( databaseList, this.connectionName.getValue() ); } }
/** * {@inheritDoc} * * @see at.aschauer.commons.pentaho.plugin.PluginProperty#saveToPreferences(java.util.prefs.Preferences) */ public void saveToPreferences( final Preferences node ) { node.put( this.getKey(), this.getValue() ); }
/** * {@inheritDoc} * * @see at.aschauer.commons.pentaho.plugin.PluginProperty#readFromPreferences(java.util.prefs.Preferences) */ public void readFromPreferences( final Preferences node ) { this.setValue( node.get( this.getKey(), this.getValue() ) ); }
/** * {@inheritDoc} * * @see at.aschauer.commons.pentaho.plugin.PluginProperty#appendXml(java.lang.StringBuilder) */ public void appendXml( final StringBuilder builder ) { builder.append( XMLHandler.addTagValue( this.getKey(), this.getValue() ) ); }
/** * {@inheritDoc} * * @see at.aschauer.commons.pentaho.plugin.PluginProperty#saveToRepositoryStep(org.pentaho.di.repository.Repository, * long, long) */ public void saveToRepositoryStep( final Repository repository, final IMetaStore metaStore, final ObjectId transformationId, final ObjectId stepId ) throws KettleException { repository.saveStepAttribute( transformationId, stepId, this.getKey(), this.getValue() ); }
/** * Invoke loading with control file. * * @throws KettleException * ... */ private void invokeLoadingControlFile() throws KettleException { File controlFile = null; final InputStream control; final String controlContent; try { controlFile = new File( resolveFileName( this.meta.getControlFile().getValue() ) ); control = FileUtils.openInputStream( controlFile ); controlContent = environmentSubstitute( FileUtils.readFileToString( controlFile ) ); } catch ( IOException e ) { throw new KettleException( "Cannot open control file [path=" + controlFile + "]", e ); } try { IOUtils.write( controlContent, this.fastload ); this.fastload.flush(); } catch ( IOException e ) { throw new KettleException( "Cannot pipe content of control file to fastload [path=" + controlFile + "]", e ); } finally { IOUtils.closeQuietly( control ); IOUtils.closeQuietly( this.fastload ); } }
if ( StringUtils.isBlank( this.meta.getFastloadPath().getValue() ) ) { throw new KettleException( "Fastload path not set" ); try { final FileObject fileObject = KettleVFS.getFileObject( environmentSubstitute( this.meta.getFastloadPath().getValue() ) ); final String fastloadExec = KettleVFS.getFilename( fileObject ); builder.append( fastloadExec ); if ( StringUtils.isNotBlank( this.meta.getLogFile().getValue() ) ) { try { FileObject fileObject = KettleVFS.getFileObject( environmentSubstitute( this.meta.getLogFile().getValue() ) ); builder.append( " -e " ); builder.append( "\"" + KettleVFS.getFilename( fileObject ) + "\"" );
/** * {@inheritDoc} * * @see org.pentaho.di.trans.step.BaseStepMeta#getRequiredFields(org.pentaho.di.core.variables.VariableSpace) */ @Override public RowMetaInterface getRequiredFields( final VariableSpace space ) throws KettleException { if ( !this.useControlFile.getValue() ) { final Database database = connectToDatabase(); database.shareVariablesWith( space ); RowMetaInterface fields = database.getTableFieldsMeta( StringUtils.EMPTY, space.environmentSubstitute( this.targetTable.getValue() ) ); database.disconnect(); if ( fields == null ) { throw new KettleException( MESSAGES.getString( "TeraFastMeta.Exception.TableNotFound" ) ); } return fields; } return null; }
this.first = false; try { final File tempDataFile = new File( resolveFileName( this.meta.getDataFile().getValue() ) ); this.dataFile = FileUtils.openOutputStream( tempDataFile ); this.dataFilePrintStream = new PrintStream( dataFile );
this.wConnection.setText( this.meta.getConnectionName().getValue() ); } else { if ( this.transMeta.nrDatabases() == 1 ) {
builder.define( this.meta.getRequiredFields( this.getTransMeta() ), meta.getTableFieldList(), resolveFileName( this.meta .getDataFile().getValue() ) ); } catch ( Exception ex ) { throw new KettleException( "Error defining data file!", ex ); builder.beginLoading( this.meta.getDbMeta().getPreferredSchemaName(), this.meta.getTargetTable().getValue() ); .getTargetTable().getValue() ); builder.endLoading(); builder.logoff();
/** * Execute fastload. * * @throws KettleException * ... */ public void execute() throws KettleException { if ( this.meta.getTruncateTable().getValue() ) { Database db = new Database( this, this.meta.getDbMeta() ); db.connect(); db.truncateTable( this.meta.getTargetTable().getValue() ); db.commit(); db.disconnect(); } startFastLoad(); if ( this.meta.getUseControlFile().getValue() ) { this.invokeLoadingControlFile(); } else { this.invokeLoadingCommand(); } }