本文整理汇总了Java中org.pentaho.di.core.ProvidesDatabaseConnectionInformation类的典型用法代码示例。如果您正苦于以下问题:Java ProvidesDatabaseConnectionInformation类的具体用法?Java ProvidesDatabaseConnectionInformation怎么用?Java ProvidesDatabaseConnectionInformation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProvidesDatabaseConnectionInformation类属于org.pentaho.di.core包,在下文中一共展示了ProvidesDatabaseConnectionInformation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: updateMetadata
import org.pentaho.di.core.ProvidesDatabaseConnectionInformation; //导入依赖的package包/类
public void updateMetadata( ProvidesDatabaseConnectionInformation dpci, long rowCount ) {
// try to update the metadata registry
RegistryFactory factory = RegistryFactory.getInstance();
IMetadataRegistry registry = factory.getMetadataRegistry();
RegistryUtil util = new RegistryUtil();
String databaseName = dpci.getDatabaseMeta().getName();
String schemaName = dpci.getSchemaName();
String tableName = dpci.getTableName();
Entity entity = util.getTableEntity(databaseName.toLowerCase(), (schemaName==null) ? null : schemaName.toLowerCase(), tableName.toLowerCase(), false);
if( entity != null ) {
System.out.println("Util.updateMetadata writing "+util.generateTableId(dpci.getDatabaseMeta().getName(), dpci.getSchemaName(), dpci.getTableName())+" rowCount="+rowCount);
if( rowCount == -1 ) {
// the table has been emptied
util.setAttribute(entity, "rowcount", 0);
} else {
// add an offset
util.updateAttribute(entity, "rowcount", rowCount);
}
DateFormat fmt = new SimpleDateFormat();
Date now = new Date();
util.setAttribute(entity, "lastupdate", fmt.format(now));
util.setAttribute(entity, "lastupdatetick", now.getTime());
} else {
System.out.println("Util.updateMetadata failed writing "+util.generateTableId(dpci.getDatabaseMeta().getName(), dpci.getSchemaName(), dpci.getTableName()));
}
try {
registry.commit();
} catch (Exception e) {
// no biggie
}
}
开发者ID:bsspirit,项目名称:kettle-4.4.0-stable,代码行数:34,代码来源:AgileMartUtil.java
示例2: getDatabaseConnectionInformationForCurrentActiveEntry
import org.pentaho.di.core.ProvidesDatabaseConnectionInformation; //导入依赖的package包/类
/**
* Attempt to resolve the database connection information from the currently selected transformation or job.
*
* @return A {@link ProvidesDatabaseConnectionInformation} instance populated database connection information.
*/
private static ProvidesDatabaseConnectionInformation getDatabaseConnectionInformationForCurrentActiveEntry() {
Spoon spoon= (Spoon) SpoonFactory.getInstance();
EngineMetaInterface metaInterface = spoon.getActiveMeta();
ProvidesDatabaseConnectionInformation connectionInfo = null;
if (metaInterface != null) {
if (metaInterface instanceof TransMeta) {
connectionInfo = getDatabaseConnectionInformationForCurrentTransStep(spoon);
} else if (metaInterface instanceof JobMeta) {
connectionInfo = getDatabaseConnectionInformationForJobEntry(spoon);
}
}
return connectionInfo;
}
开发者ID:pentaho,项目名称:pdi-agile-bi-plugin,代码行数:20,代码来源:ModelerHelper.java
示例3: createSourceForActiveSelection
import org.pentaho.di.core.ProvidesDatabaseConnectionInformation; //导入依赖的package包/类
/**
* Creates a modeler source that can build a model for the currently selected transformation step or job entry.
*
* @param connectionInfo Database Connection information
* @param spoon Spoon instance to look up active step or entry from
* @return A valid modeler source for the currently selected transformation step or job entry, or {@code null} if no valid active item could be found.
*/
protected static KettleModelerSource createSourceForActiveSelection(ProvidesDatabaseConnectionInformation connectionInfo, Spoon spoon) {
EngineMetaInterface metaInterface = spoon.getActiveMeta();
KettleModelerSource source = null;
if (metaInterface != null) {
if (metaInterface instanceof TransMeta) {
source = getModelerSourceForCurrentTransStep(connectionInfo, spoon);
} else if (metaInterface instanceof JobMeta) {
source = getModelerSourceForCurrentJobEntry(connectionInfo, spoon);
}
}
return source;
}
开发者ID:pentaho,项目名称:pdi-agile-bi-plugin,代码行数:20,代码来源:ModelerHelper.java
示例4: getModelerSourceForCurrentTransStep
import org.pentaho.di.core.ProvidesDatabaseConnectionInformation; //导入依赖的package包/类
/**
* Create a modeler source for the current transformation step.
*
* @param connectionInfo Connection information
* @param spoon Spoon instance to look for the currently active transformation step
* @return A modeler source for the current transformation step so we can build a model for it
*/
protected static KettleModelerSource getModelerSourceForCurrentTransStep(ProvidesDatabaseConnectionInformation connectionInfo, Spoon spoon) {
StepMeta stepMeta = getCurrentStepMeta(spoon);
if (stepMeta == null) {
return null;
}
return getModelerSourceForStepMeta(connectionInfo, spoon.getActiveTransformation(), stepMeta);
}
开发者ID:pentaho,项目名称:pdi-agile-bi-plugin,代码行数:15,代码来源:ModelerHelper.java
示例5: getModelerSourceForCurrentJobEntry
import org.pentaho.di.core.ProvidesDatabaseConnectionInformation; //导入依赖的package包/类
/**
* Create a modeler source for the current job entry.
*
* @param connectionInfo Connection information
* @param spoon Spoon instance to look for the currently active job entry
* @return A modeler source for the current job entry so we can build a model for it
*/
protected static KettleModelerSource getModelerSourceForCurrentJobEntry(ProvidesDatabaseConnectionInformation connectionInfo, Spoon spoon) {
JobEntryCopy entry = getCurrentJobEntry(spoon);
if (entry == null) {
return null;
}
return getModelerSourceForJobEntry(connectionInfo, spoon.getActiveJob(), entry);
}
开发者ID:pentaho,项目名称:pdi-agile-bi-plugin,代码行数:15,代码来源:ModelerHelper.java
示例6: getDatabaseConnectionInformation
import org.pentaho.di.core.ProvidesDatabaseConnectionInformation; //导入依赖的package包/类
/**
* Get the database connection information from an object that implements {@link ProvidesDatabaseConnectionInformation}.
*
* @param o Object that implements {@link ProvidesDatabaseConnectionInformation} and has database connection information.
* @return Database connection information from {@code o}.
*/
protected static ProvidesDatabaseConnectionInformation getDatabaseConnectionInformation(Object o) {
if( o != null && ProvidesDatabaseConnectionInformation.class.isAssignableFrom(o.getClass()) ) {
return ProvidesDatabaseConnectionInformation.class.cast(o);
}
return null;
}
开发者ID:pentaho,项目名称:pdi-agile-bi-plugin,代码行数:13,代码来源:ModelerHelper.java
示例7: populateModel
import org.pentaho.di.core.ProvidesDatabaseConnectionInformation; //导入依赖的package包/类
public static ModelerWorkspace populateModel(ModelerWorkspace model) throws ModelerException {
if (!isValidEntrySelected()) {
throw new ModelerException(BaseMessages.getString(ModelerHelper.class, "InvalidEntrySelected"));
}
ProvidesDatabaseConnectionInformation connectionInfo = getDatabaseConnectionInformationForCurrentActiveEntry();
// we must have a database meta and a table name to continue, schema is optional
if( !isValidConnectionInformation(connectionInfo.getDatabaseMeta(), connectionInfo.getTableName()) ) {
String errorMsg = Const.NVL(connectionInfo.getMissingDatabaseConnectionInformationMessage(), BaseMessages.getString(ModelerHelper.class, "DatabaseConnectionInformationRequired"));
throw new ModelerException(errorMsg);
}
KettleModelerSource source = createSourceForActiveSelection(connectionInfo, (Spoon) SpoonFactory.getInstance());
if (source == null) {
throw new ModelerException(BaseMessages.getString(ModelerHelper.class, "Error.NoModelerSource", connectionInfo.getDatabaseMeta().getName(), connectionInfo.getTableName()));
}
Domain d = source.generateDomain();
model.setModelSource(source);
model.setModelName(connectionInfo.getTableName());
model.setDomain(d);
RegistryFactory factory = RegistryFactory.getInstance();
IMetadataRegistry registry = factory.getMetadataRegistry();
source.registerLineageMetadata(registry);
try {
registry.commit();
} catch (Exception e) {
logger.error("Could not commit metadata registry", e);
}
return model;
}
开发者ID:pentaho,项目名称:pdi-agile-bi-plugin,代码行数:39,代码来源:ModelerHelper.java
示例8: getDatabaseConnectionInformation
import org.pentaho.di.core.ProvidesDatabaseConnectionInformation; //导入依赖的package包/类
@Test
public void getDatabaseConnectionInformation() {
DatabaseMeta databaseMeta = new DatabaseMeta("test", "MYSQL", null, null, null, null, null, null);
String table = "table";
String schema = "schema";
String missingInfoMsg = "Missing info!";
ProvidesDatabaseConnectionInformation connectionInfo = new MockProvidesDatabaseConnectionInformation(databaseMeta, table, schema, missingInfoMsg);
ProvidesDatabaseConnectionInformation discovered = ModelerHelper.getDatabaseConnectionInformation(connectionInfo);
assertEquals(connectionInfo, discovered);
}
开发者ID:pentaho,项目名称:pdi-agile-bi-plugin,代码行数:12,代码来源:ModelerHelperTest.java
示例9: getDatabaseConnectionInformation_generic_object
import org.pentaho.di.core.ProvidesDatabaseConnectionInformation; //导入依赖的package包/类
@Test
public void getDatabaseConnectionInformation_generic_object() throws NoSuchMethodException {
DatabaseMeta databaseMeta = new DatabaseMeta("test", "MYSQL", null, null, null, null, null, null);
MockUndecoratedClass object = new MockUndecoratedClass(databaseMeta, "table", "schema");
ProvidesDatabaseConnectionInformation discovered = ModelerHelper.getDatabaseConnectionInformation(object);
assertNull(discovered);
}
开发者ID:pentaho,项目名称:pdi-agile-bi-plugin,代码行数:9,代码来源:ModelerHelperTest.java
示例10: getModelerSourceForJobEntry
import org.pentaho.di.core.ProvidesDatabaseConnectionInformation; //导入依赖的package包/类
@Test
public void getModelerSourceForJobEntry() {
String dbName = "test";
String table = "table";
String schema = "schema";
String missingInfoMsg = "Missing info!";
DatabaseMeta databaseMeta = new DatabaseMeta(dbName, "MYSQL", null, null, null, null, null, null);
ProvidesDatabaseConnectionInformation connectionInfo = new MockProvidesDatabaseConnectionInformation(databaseMeta, table, schema, missingInfoMsg);
String jobName = "Job 1";
String filename = "job.kjb";
String pluginId = "TestPlugin";
JobMeta jobMeta = new JobMeta();
jobMeta.setName(jobName);
jobMeta.setFilename(filename);
JobEntryInterface jobEntry = new MockJobEntry();
jobEntry.setPluginId(pluginId);
JobEntryCopy jobEntryCopy = new JobEntryCopy();
jobEntryCopy.setEntry(jobEntry);
KettleModelerSource source = ModelerHelper.getModelerSourceForJobEntry(connectionInfo, jobMeta, jobEntryCopy);
assertEquals(table, source.getTableName());
assertEquals(schema, source.getSchemaName());
assertEquals(dbName, source.getDatabaseName());
assertEquals(Type.TYPE_JOB, source.getMetaType());
assertEquals(jobName, source.getMetaName());
assertEquals(pluginId, source.getMetaId());
}
开发者ID:pentaho,项目名称:pdi-agile-bi-plugin,代码行数:31,代码来源:ModelerHelperTest.java
示例11: getModelerSourceForTransformation
import org.pentaho.di.core.ProvidesDatabaseConnectionInformation; //导入依赖的package包/类
@Test
public void getModelerSourceForTransformation() {
String dbName = "test";
String table = "table";
String schema = "schema";
String missingInfoMsg = "Missing info!";
DatabaseMeta databaseMeta = new DatabaseMeta(dbName, "MYSQL", null, null, null, null, null, null);
ProvidesDatabaseConnectionInformation connectionInfo = new MockProvidesDatabaseConnectionInformation(databaseMeta, table, schema, missingInfoMsg);
String transName = "Transformation 1";
String filename = "trans.ktr";
String stepId = "StepTypeName";
TransMeta transMeta = new TransMeta();
transMeta.setName(transName);
transMeta.setFilename(filename);
StepMeta stepMeta = new StepMeta();
stepMeta.setStepID(stepId);
KettleModelerSource source = ModelerHelper.getModelerSourceForStepMeta(connectionInfo, transMeta, stepMeta);
assertEquals(table, source.getTableName());
assertEquals(schema, source.getSchemaName());
assertEquals(dbName, source.getDatabaseName());
assertEquals(Type.TYPE_TRANSFORMATION, source.getMetaType());
assertEquals(transName, source.getMetaName());
assertEquals(stepId, source.getMetaId());
}
开发者ID:pentaho,项目名称:pdi-agile-bi-plugin,代码行数:29,代码来源:ModelerHelperTest.java
示例12: getDatabaseConnectionInformationForCurrentTransStep
import org.pentaho.di.core.ProvidesDatabaseConnectionInformation; //导入依赖的package包/类
/**
* Get the database connection information for the active transformation.
*
* @param spoon Current instance of Spoon.
* @return A valid {@link ProvidesDatabaseConnectionInformation} with database connection information from the currently selected
* transformation step
*/
protected static ProvidesDatabaseConnectionInformation getDatabaseConnectionInformationForCurrentTransStep(Spoon spoon) {
StepMeta stepMeta = getCurrentStepMeta(spoon);
// see if we can get the objects we need
return stepMeta == null ? null : getDatabaseConnectionInformation(stepMeta.getStepMetaInterface());
}
开发者ID:pentaho,项目名称:pdi-agile-bi-plugin,代码行数:13,代码来源:ModelerHelper.java
示例13: getDatabaseConnectionInformationForJobEntry
import org.pentaho.di.core.ProvidesDatabaseConnectionInformation; //导入依赖的package包/类
/**
* Get the database connection information for the active job.
*
* @param spoon Current instance of Spoon.
* @return A valid {@link ProvidesDatabaseConnectionInformation} with database connection information for the currently selected
* job entry
*/
protected static ProvidesDatabaseConnectionInformation getDatabaseConnectionInformationForJobEntry(Spoon spoon) {
JobEntryCopy entry = getCurrentJobEntry(spoon);
// see if we can get the objects we need
return entry == null ? null : getDatabaseConnectionInformation(entry.getEntry());
}
开发者ID:pentaho,项目名称:pdi-agile-bi-plugin,代码行数:13,代码来源:ModelerHelper.java
示例14: getModelerSourceForStepMeta
import org.pentaho.di.core.ProvidesDatabaseConnectionInformation; //导入依赖的package包/类
/**
* Create a modeler source for the current transformation step.
*
* @param connectionInfo Connection information
* @param transMeta Tranformation the step belongs to
* @param stepMeta Step to create modeler source for
* @return A modeler source for the current transformation step so we can build a model for it
*/
protected static KettleModelerSource getModelerSourceForStepMeta(ProvidesDatabaseConnectionInformation connectionInfo, TransMeta transMeta, StepMeta stepMeta) {
Repository repository = transMeta.getRepository();
String repositoryName = repository == null ? null : repository.getName();
return new OutputStepModelerSource(connectionInfo.getDatabaseMeta(), connectionInfo.getTableName(), connectionInfo.getSchemaName(), transMeta.getName(), transMeta.getFilename(), repositoryName, stepMeta.getStepID());
}
开发者ID:pentaho,项目名称:pdi-agile-bi-plugin,代码行数:14,代码来源:ModelerHelper.java
示例15: getModelerSourceForJobEntry
import org.pentaho.di.core.ProvidesDatabaseConnectionInformation; //导入依赖的package包/类
/**
* Create a modeler source for the job entry.
*
* @param connectionInfo Connection information
* @param jobMeta Job the job entry belongs to
* @param entry Job Entry to create modeler source for
* @return A modeler source for the current job entry so we can build a model for it
*/
protected static KettleModelerSource getModelerSourceForJobEntry(ProvidesDatabaseConnectionInformation connectionInfo, JobMeta jobMeta, JobEntryCopy entry) {
Repository repository = jobMeta.getRepository();
String repositoryName = repository == null ? null : repository.getName();
return new KettleModelerSource(connectionInfo.getDatabaseMeta(), connectionInfo.getTableName(), connectionInfo.getSchemaName(), Type.TYPE_JOB, jobMeta.getName(), jobMeta.getFilename(), repositoryName, entry.getEntry().getPluginId());
}
开发者ID:pentaho,项目名称:pdi-agile-bi-plugin,代码行数:14,代码来源:ModelerHelper.java
注:本文中的org.pentaho.di.core.ProvidesDatabaseConnectionInformation类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论