本文整理汇总了Java中org.pentaho.metadata.registry.RegistryFactory类的典型用法代码示例。如果您正苦于以下问题:Java RegistryFactory类的具体用法?Java RegistryFactory怎么用?Java RegistryFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RegistryFactory类属于org.pentaho.metadata.registry包,在下文中一共展示了RegistryFactory类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: updateMetadata
点赞 2
import org.pentaho.metadata.registry.RegistryFactory; //导入依赖的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: populateModel
点赞 2
import org.pentaho.metadata.registry.RegistryFactory; //导入依赖的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
示例3: save
点赞 2
import org.pentaho.metadata.registry.RegistryFactory; //导入依赖的package包/类
public boolean save(EngineMetaInterface meta, String fname, boolean isExport) {
AnalyzerVisualizationMeta wvmeta = (AnalyzerVisualizationMeta)meta;
wvmeta.save(fname);
File f = new File(fname);
reportName = f.getName();
reportName = reportName.substring(0, reportName.indexOf(".xanalyzer")); //$NON-NLS-1$
String fullPath = f.getAbsolutePath();
Spoon spoon = ((Spoon)SpoonFactory.getInstance());
spoon.getProperties().addLastFile("Model", fullPath, null, false, null);
spoon.addMenuLast();
wvmeta.setFilename(f.getAbsolutePath());
String name = getPathAndFilename(fname)[1].replace("."+this.getExtension(), "");
AgileBiVisualizationPerspective.getInstance().setNameForTab(wvmeta.getTab(), name);
// register this in the metadata registry
RegistryFactory factory = RegistryFactory.getInstance();
IMetadataRegistry registry = factory.getMetadataRegistry();
Entity vizEntity = new Entity(fname, name, Type.TYPE_ANALYZER_VIEW.getId());
registry.addEntity(vizEntity);
String modelId = wvmeta.browser.getModel().getFileName();
Entity modelEntity = registry.getEntity(modelId, Type.TYPE_OLAP_MODEL.getId());
if( modelEntity != null ) {
Link link = new Link( vizEntity, Verb.VERB_USES, modelEntity );
registry.addLink(link);
}
try {
registry.commit();
} catch (Exception e) {
logger.error("Could not commit metadata registry", e);
}
// TODO - JD - enable this in Spoon
/*
String callee = this.toString();
String caller = Spoon.getInstance().getCaller(callee);
if( caller != null ) {
Spoon.getInstance().removeCaller(callee);
// Spoon.getInstance().addCaller(caller, newCallee);
}
*/
return true;
}
开发者ID:pentaho,
项目名称:pdi-agile-bi-plugin,
代码行数:45,
代码来源:AnalyzerVisualization.java