本文整理汇总了Java中org.pentaho.di.core.ProgressMonitorListener类的典型用法代码示例。如果您正苦于以下问题:Java ProgressMonitorListener类的具体用法?Java ProgressMonitorListener怎么用?Java ProgressMonitorListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProgressMonitorListener类属于org.pentaho.di.core包,在下文中一共展示了ProgressMonitorListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFirstRows
import org.pentaho.di.core.ProgressMonitorListener; //导入依赖的package包/类
/**
* Get the first rows from a table (for preview)
* @param table_name The table name (or schema/table combination): this needs to be quoted properly
* @param limit limit <=0 means unlimited, otherwise this specifies the maximum number of rows read.
* @param monitor The progress monitor to update while getting the rows.
* @return An ArrayList of rows.
* @throws KettleDatabaseException in case something goes wrong
*/
public List<Object[]> getFirstRows(String table_name, int limit, ProgressMonitorListener monitor) throws KettleDatabaseException
{
String sql = "SELECT";
if (databaseMeta.getDatabaseType()==DatabaseMeta.TYPE_DATABASE_NEOVIEW)
{
sql+=" [FIRST " + limit +"]";
}
sql += " * FROM "+table_name;
if (limit>0)
{
sql+=databaseMeta.getLimitClause(limit);
}
return getRows(sql, limit, monitor);
}
示例2: loadJob
import org.pentaho.di.core.ProgressMonitorListener; //导入依赖的package包/类
public JobMeta loadJob(String jobname, RepositoryDirectoryInterface repdir, ProgressMonitorListener monitor, String versionName) throws KettleException {
// This is a standard load of a transformation serialized in XML...
//
String filename = calcDirectoryName(repdir)+jobname+EXT_JOB;
JobMeta jobMeta = new JobMeta(filename, this);
jobMeta.setFilename(null);
jobMeta.setName(jobname);
jobMeta.setObjectId(new StringObjectId(calcObjectId(repdir, jobname, EXT_JOB)));
readDatabases(jobMeta, true);
jobMeta.clearChanged();
return jobMeta;
}
示例3: getFirstRows
import org.pentaho.di.core.ProgressMonitorListener; //导入依赖的package包/类
/**
* Get the first rows from a table (for preview)
* @param table_name The table name (or schema/table combination): this needs to be quoted properly
* @param limit limit <=0 means unlimited, otherwise this specifies the maximum number of rows read.
* @param monitor The progress monitor to update while getting the rows.
* @return An ArrayList of rows.
* @throws KettleDatabaseException in case something goes wrong
*/
public List<Object[]> getFirstRows(String table_name, int limit, ProgressMonitorListener monitor) throws KettleDatabaseException
{
String sql = "SELECT";
if (databaseMeta.getDatabaseInterface() instanceof NeoviewDatabaseMeta)
{
sql+=" [FIRST " + limit +"]";
}
else if (databaseMeta.getDatabaseInterface() instanceof SybaseIQDatabaseMeta) // improve support Sybase IQ
{
sql+=" TOP " + limit +" ";
}
sql += " * FROM "+table_name;
if (limit>0)
{
sql+=databaseMeta.getLimitClause(limit);
}
return getRows(sql, limit, monitor);
}
示例4: testExportApi
import org.pentaho.di.core.ProgressMonitorListener; //导入依赖的package包/类
/**
* Validate the the repository export api hasn't changed from what we use in example files.
*
* @see RepositoryExporter#exportAllObjects(ProgressMonitorListener, String, RepositoryDirectoryInterface, String)
*/
public void testExportApi() throws Exception {
Class<RepositoryExporter> exporter = RepositoryExporter.class;
// Make sure we the expected constructor that takes a repository
Constructor<RepositoryExporter> c = exporter.getConstructor(Repository.class);
assertNotNull(c);
// Make sure we have the correct signature for exporting objects
// RepositoryExporter.exportAllObjects(ProgressMonitorListener, String, RepositoryDirectoryInterface, String)
Class<?> param1 = ProgressMonitorListener.class;
Class<?> param2 = String.class;
Class<?> param3 = RepositoryDirectoryInterface.class;
Class<?> param4 = String.class;
Method m = exporter.getMethod("exportAllObjects", param1, param2, param3, param4); //$NON-NLS-1$
assertNotNull(m);
}
示例5: getFirstRows
import org.pentaho.di.core.ProgressMonitorListener; //导入依赖的package包/类
/**
* Get the first rows from a table (for preview)
*
* @param table_name The table name (or schema/table combination): this needs to be quoted properly
* @param limit limit <=0 means unlimited, otherwise this specifies the maximum number of rows read.
* @param monitor The progress monitor to update while getting the rows.
* @return An ArrayList of rows.
* @throws KettleDatabaseException in case something goes wrong
*/
public List<Object[]> getFirstRows( String table_name, int limit, ProgressMonitorListener monitor )
throws KettleDatabaseException {
String sql = "SELECT";
if ( databaseMeta.getDatabaseInterface() instanceof NeoviewDatabaseMeta ) {
sql += " [FIRST " + limit + "]";
} else if ( databaseMeta.getDatabaseInterface() instanceof SybaseIQDatabaseMeta ) {
// improve support for Sybase IQ
sql += " TOP " + limit + " ";
}
sql += " * FROM " + table_name;
if ( limit > 0 ) {
sql += databaseMeta.getLimitClause( limit );
}
return getRows( sql, limit, monitor );
}
示例6: getFirstRows
import org.pentaho.di.core.ProgressMonitorListener; //导入依赖的package包/类
/**
* Get the first rows from a table (for preview)
*
* @param table_name
* The table name (or schema/table combination): this needs to be
* quoted properly
* @param limit
* limit <=0 means unlimited, otherwise this specifies the maximum
* number of rows read.
* @param monitor
* The progress monitor to update while getting the rows.
* @return An ArrayList of rows.
* @throws KettleDatabaseException
* in case something goes wrong
*/
public List<Object[]> getFirstRows(String table_name, int limit, ProgressMonitorListener monitor)
throws KettleDatabaseException {
String sql = "SELECT";
if (databaseMeta.getDatabaseInterface() instanceof NeoviewDatabaseMeta) {
sql += " [FIRST " + limit + "]";
} else if (databaseMeta.getDatabaseInterface() instanceof SybaseIQDatabaseMeta) // improve
// support
// Sybase
// IQ
{
sql += " TOP " + limit + " ";
}
sql += " * FROM " + table_name;
if (limit > 0) {
sql += databaseMeta.getLimitClause(limit);
}
return getRows(sql, limit, monitor);
}
示例7: testExportApi
import org.pentaho.di.core.ProgressMonitorListener; //导入依赖的package包/类
/**
* Validate the the repository export api hasn't changed from what we use in example files.
*
* @see RepositoryExporter#exportAllObjects(ProgressMonitorListener, String, RepositoryDirectoryInterface, String)
*/
public void testExportApi() throws Exception {
Class<RepositoryExporter> exporter = RepositoryExporter.class;
// Make sure we the expected constructor that takes a repository
Constructor<RepositoryExporter> c = exporter.getConstructor( Repository.class );
assertNotNull( c );
// Make sure we have the correct signature for exporting objects
// RepositoryExporter.exportAllObjects(ProgressMonitorListener, String, RepositoryDirectoryInterface, String)
Class<?> param1 = ProgressMonitorListener.class;
Class<?> param2 = String.class;
Class<?> param3 = RepositoryDirectoryInterface.class;
Class<?> param4 = String.class;
Method m = exporter.getMethod( "exportAllObjects", param1, param2, param3, param4 );
assertNotNull( m );
}
示例8: export
import org.pentaho.di.core.ProgressMonitorListener; //导入依赖的package包/类
public void export( ProgressMonitorListener monitor, List<RepositoryFile> files, OutputStreamWriter writer )
throws KettleException {
List<TransMeta> transformations = repository.loadTransformations( monitor, log, files, true );
Iterator<TransMeta> transMetasIter = transformations.iterator();
Iterator<RepositoryFile> filesIter = files.iterator();
while ( ( monitor == null || !monitor.isCanceled() ) && transMetasIter.hasNext() ) {
TransMeta trans = transMetasIter.next();
setGlobalVariablesOfLogTablesNull( trans.getLogTables() );
RepositoryFile file = filesIter.next();
try {
// Validate against the import rules first!
if ( toExport( trans ) ) {
writer.write( trans.getXML() + Const.CR );
}
} catch ( Exception ex ) {
// if exception while writing one item is occurred logging it and continue looping
log.logError( BaseMessages.getString( PKG, "PurRepositoryExporter.ERROR_SAVE_TRANSFORMATION",
trans.getName(), file.getPath() ), ex ); //$NON-NLS-1$
}
}
}
示例9: loadJob
import org.pentaho.di.core.ProgressMonitorListener; //导入依赖的package包/类
@Override
public JobMeta loadJob( String jobname, RepositoryDirectoryInterface repdir, ProgressMonitorListener monitor,
String versionName ) throws KettleException {
// This is a standard load of a transformation serialized in XML...
//
String filename = calcDirectoryName( repdir ) + jobname + EXT_JOB;
JobMeta jobMeta = new JobMeta( filename, this );
jobMeta.setFilename( null );
jobMeta.setName( jobname );
jobMeta.setObjectId( new StringObjectId( calcObjectId( repdir, jobname, EXT_JOB ) ) );
jobMeta.setRepository( this );
jobMeta.setMetaStore( getMetaStore() );
readDatabases( jobMeta, true );
jobMeta.clearChanged();
return jobMeta;
}
示例10: loadTransformation
import org.pentaho.di.core.ProgressMonitorListener; //导入依赖的package包/类
@Override
public TransMeta loadTransformation( String transname, RepositoryDirectoryInterface repdir,
ProgressMonitorListener monitor, boolean setInternalVariables, String versionName ) throws KettleException {
// This is a standard load of a transformation serialized in XML...
//
String filename = calcDirectoryName( repdir ) + transname + ".ktr";
TransMeta transMeta = new TransMeta( filename, this, setInternalVariables );
transMeta.setRepository( this );
transMeta.setMetaStore( getMetaStore() );
transMeta.setFilename( null );
transMeta.setName( transname );
transMeta.setObjectId( new StringObjectId( calcObjectId( repdir, transname, EXT_TRANSFORMATION ) ) );
readDatabases( transMeta, true );
transMeta.clearChanged();
return transMeta;
}
示例11: checkRowMixingStatically
import org.pentaho.di.core.ProgressMonitorListener; //导入依赖的package包/类
/**
* Check a step to see if there are no multiple steps to read from. If so, check to see if the receiving rows are all
* the same in layout. We only want to ONLY use the DBCache for this to prevent GUI stalls.
*
* @param stepMeta
* the step to check
* @param monitor
* the monitor
* @throws KettleRowException
* in case we detect a row mixing violation
*/
public void checkRowMixingStatically( StepMeta stepMeta, ProgressMonitorListener monitor ) throws KettleRowException {
List<StepMeta> prevSteps = findPreviousSteps( stepMeta );
int nrPrevious = prevSteps.size();
if ( nrPrevious > 1 ) {
RowMetaInterface referenceRow = null;
// See if all previous steps send out the same rows...
for ( int i = 0; i < nrPrevious; i++ ) {
StepMeta previousStep = prevSteps.get( i );
try {
RowMetaInterface row = getStepFields( previousStep, monitor ); // Throws KettleStepException
if ( referenceRow == null ) {
referenceRow = row;
} else if ( !stepMeta.getStepMetaInterface().excludeFromRowLayoutVerification() ) {
BaseStep.safeModeChecking( referenceRow, row );
}
} catch ( KettleStepException e ) {
// We ignore this one because we are in the process of designing the transformation, anything intermediate can
// go wrong.
}
}
}
}
示例12: testGetValueToIdMap
import org.pentaho.di.core.ProgressMonitorListener; //导入依赖的package包/类
@Test
public void testGetValueToIdMap() throws KettleException {
String tablename = "test-tablename";
String idfield = "test-idfield";
String lookupfield = "test-lookupfield";
List<Object[]> rows = new ArrayList<Object[]>();
int id = 1234;
LongObjectId longObjectId = new LongObjectId( id );
rows.add( new Object[] { lookupfield, id } );
when( database.getRows( eq( "SELECT " + lookupfield + ", " + idfield + " FROM " + tablename ), any(
RowMetaInterface.class ),
eq( new Object[] {} ), eq( ResultSet.FETCH_FORWARD ),
eq( false ), eq( -1 ), eq( (ProgressMonitorListener) null ) ) ).thenReturn( rows );
Map<String, LongObjectId> valueToIdMap =
kettleDatabaseRepositoryConnectionDelegate.getValueToIdMap( tablename, idfield, lookupfield );
assertEquals( 1, valueToIdMap.size() );
assertEquals( longObjectId, valueToIdMap.get( lookupfield ) );
}
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:19,代码来源:KettleDatabaseRepositoryConnectionDelegateUnitTest.java
示例13: getRows
import org.pentaho.di.core.ProgressMonitorListener; //导入依赖的package包/类
/** Reads the result of a ResultSet into an ArrayList
*
* @param rset the ResultSet to read out
* @param limit <=0 means unlimited, otherwise this specifies the maximum number of rows read.
* @param monitor The progress monitor to update while getting the rows.
* @return An ArrayList of rows.
* @throws KettleDatabaseException if something goes wrong.
*/
public List<Object[]> getRows(ResultSet rset, int limit, ProgressMonitorListener monitor) throws KettleDatabaseException
{
try
{
List<Object[]> result = new ArrayList<Object[]>();
boolean stop=false;
int i=0;
if (rset!=null)
{
if (monitor!=null && limit>0) monitor.beginTask("Reading rows...", limit);
while ((limit<=0 || i<limit) && !stop)
{
Object[] row = getRow(rset);
if (row!=null)
{
result.add(row);
i++;
}
else
{
stop=true;
}
if (monitor!=null && limit>0) monitor.worked(1);
}
closeQuery(rset);
if (monitor!=null) monitor.done();
}
return result;
}
catch(Exception e)
{
throw new KettleDatabaseException("Unable to get list of rows from ResultSet : ", e);
}
}
示例14: checkJobEntries
import org.pentaho.di.core.ProgressMonitorListener; //导入依赖的package包/类
/**
* Check all job entries within the job. Each Job Entry has the opportunity
* to check their own settings.
*
* @param remarks
* List of CheckResult remarks inserted into by each JobEntry
* @param only_selected
* true if you only want to check the selected jobs
* @param monitor
* Progress monitor (not presently in use)
*/
public void checkJobEntries(List<CheckResultInterface> remarks, boolean only_selected, ProgressMonitorListener monitor) {
remarks.clear(); // Empty remarks
if (monitor != null)
monitor.beginTask(Messages.getString("JobMeta.Monitor.VerifyingThisJobEntryTask.Title"), jobcopies.size() + 2); //$NON-NLS-1$
boolean stop_checking = false;
for (int i = 0; i < jobcopies.size() && !stop_checking; i++) {
JobEntryCopy copy = jobcopies.get(i); // get the job entry copy
if ((!only_selected) || (only_selected && copy.isSelected())) {
JobEntryInterface entry = copy.getEntry();
if (entry != null) {
if (monitor != null)
monitor.subTask(Messages.getString("JobMeta.Monitor.VerifyingJobEntry.Title", entry.getName())); //$NON-NLS-1$ //$NON-NLS-2$
entry.check(remarks, this);
if (monitor != null) {
monitor.worked(1); // progress bar...
if (monitor.isCanceled()) {
stop_checking = true;
}
}
}
}
if (monitor != null) {
monitor.worked(1);
}
}
if (monitor != null) {
monitor.done();
}
}
示例15: exportJobs
import org.pentaho.di.core.ProgressMonitorListener; //导入依赖的package包/类
private void exportJobs(ProgressMonitorListener monitor, RepositoryDirectory dirTree, OutputStreamWriter writer) throws KettleException
{
try {
// Loop over all the directory id's
long dirids[] = dirTree.getDirectoryIDs();
System.out.println("Going through "+dirids.length+" directories in directory ["+dirTree.getPath()+"]");
if (monitor!=null) monitor.subTask("Exporting the jobs...");
for (int d=0;d<dirids.length && (monitor==null || (monitor!=null && !monitor.isCanceled()));d++)
{
RepositoryDirectory repdir = dirTree.findDirectory(dirids[d]);
String jobs[] = getJobNames(dirids[d]);
for (int i=0;i<jobs.length && (monitor==null || (monitor!=null && !monitor.isCanceled()));i++)
{
try
{
JobMeta ji = new JobMeta(log, this, jobs[i], repdir);
System.out.println("Loading/Exporting job ["+repdir.getPath()+" : "+jobs[i]+"]");
if (monitor!=null) monitor.subTask("Exporting job ["+jobs[i]+"]");
writer.write(ji.getXML()+Const.CR);
}
catch(KettleException ke)
{
log.logError(toString(), "An error occurred reading job ["+jobs[i]+"] from directory ["+repdir+"] : "+ke.getMessage());
log.logError(toString(), "Job ["+jobs[i]+"] from directory ["+repdir+"] was not exported because of a loading error!");
}
}
}
} catch(Exception e) {
throw new KettleException("Error while exporting repository jobs", e);
}
}