本文整理汇总了Java中org.pentaho.di.repository.kdr.KettleDatabaseRepositoryMeta类的典型用法代码示例。如果您正苦于以下问题:Java KettleDatabaseRepositoryMeta类的具体用法?Java KettleDatabaseRepositoryMeta怎么用?Java KettleDatabaseRepositoryMeta使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
KettleDatabaseRepositoryMeta类属于org.pentaho.di.repository.kdr包,在下文中一共展示了KettleDatabaseRepositoryMeta类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: KettleDatabaseRepositoryDialog
import org.pentaho.di.repository.kdr.KettleDatabaseRepositoryMeta; //导入依赖的package包/类
public KettleDatabaseRepositoryDialog( Shell parent, int style,
RepositoryMeta repositoryMeta,
RepositoriesMeta repositoriesMeta ) {
this.display = parent.getDisplay();
this.props = PropsUI.getInstance();
this.input = (KettleDatabaseRepositoryMeta) repositoryMeta;
this.repositories = repositoriesMeta;
this.masterRepositoriesMeta = repositoriesMeta.clone();
this.masterRepositoryName = repositoryMeta.getName();
shell =
new Shell( parent, style | SWT.DIALOG_TRIM | SWT.RESIZE
| SWT.MAX | SWT.MIN | SWT.APPLICATION_MODAL | SWT.SHEET );
shell.setText( BaseMessages.getString( PKG, "RepositoryDialog.Dialog.Main.Title" ) );
}
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:17,代码来源:KettleDatabaseRepositoryDialog.java
示例2: initRepository
import org.pentaho.di.repository.kdr.KettleDatabaseRepositoryMeta; //导入依赖的package包/类
/**
* 初始化资源库
*
* @param repo
* 资源库
* @param isConnected
* (是否重新连接)
*/
private void initRepository(T entity, boolean isConnected)
throws KettleException {
if (null != entity) {
RepositoriesMeta repositoriesMeta = new RepositoriesMeta();
DatabaseMeta db = new DatabaseMeta();
db.setDatabaseType(entity.getDialect());
db.setAccessType(Integer.parseInt(entity.getAccess()));
db.setDBName(entity.getDb());
db.setHostname(entity.getServer());
db.setDBPort(entity.getPort());
db.setUsername(entity.getUsername());
db.setPassword(entity.getPassword());
KettleDatabaseRepositoryMeta rmeta = new KettleDatabaseRepositoryMeta();
rmeta.setConnection(db);
rmeta.setId(entity.getType());
rmeta.setName(entity.getName());
repositoriesMeta.addDatabase(db);
repositoriesMeta.addRepository(rmeta);
// 选择加载过的资源库
RepositoryMeta meta = repositoriesMeta.findRepository(entity
.getName());
KettleClientEnvironment.init();
// 获得资源库实例
repo = PluginRegistry.getInstance().loadClass(
RepositoryPluginType.class, meta.getId(), Repository.class);
repo.init(meta);
// 连接资源库
repo.connect(entity.getUser(), entity.getPass());
if (!isConnected) {
list.add(repo);
}
}
}
开发者ID:jiangzongyao,项目名称:kettle_support_kettle8.0,代码行数:42,代码来源:KettleReposServiceImpl.java
示例3: initRepository
import org.pentaho.di.repository.kdr.KettleDatabaseRepositoryMeta; //导入依赖的package包/类
/**
* 初始化资源库
*
* @param repo
* 资源库
* @param isConnected
* (是否重新连接)
*/
private void initRepository(T entity, boolean isConnected)
throws KettleException {
if (null != entity) {
RepositoriesMeta repositoriesMeta = new RepositoriesMeta();
DatabaseMeta db = new DatabaseMeta();
db.setDatabaseType(entity.getDialect());
db.setAccessType(Integer.parseInt(entity.getAccess()));
db.setDBName(entity.getDb());
db.setHostname(entity.getServer());
db.setDBPort(entity.getPort());
db.setUsername(entity.getUsername());
db.setPassword(entity.getPassword());
KettleDatabaseRepositoryMeta rmeta = new KettleDatabaseRepositoryMeta();
rmeta.setConnection(db);
rmeta.setId(entity.getType());
rmeta.setName(entity.getName());
repositoriesMeta.addDatabase(db);
repositoriesMeta.addRepository(rmeta);
// 选择加载过的资源库
RepositoryMeta meta = repositoriesMeta.findRepository(entity
.getName());
// 获得资源库实例
repo = PluginRegistry.getInstance().loadClass(
RepositoryPluginType.class, meta.getId(), Repository.class);
repo.init(meta);
// 连接资源库
repo.connect(entity.getUser(), entity.getPass());
if (!isConnected) {
list.add(repo);
}
}
}
开发者ID:839536,项目名称:kettle,代码行数:41,代码来源:KettleReposServiceImpl.java
示例4: KettleDatabaseRepositoryDialog
import org.pentaho.di.repository.kdr.KettleDatabaseRepositoryMeta; //导入依赖的package包/类
public KettleDatabaseRepositoryDialog(Shell parent, int style, RepositoryMeta repositoryMeta,
RepositoriesMeta repositoriesMeta) {
this.display = parent.getDisplay();
this.props = PropsUI.getInstance();
this.input = (KettleDatabaseRepositoryMeta) repositoryMeta;
this.repositories = repositoriesMeta;
this.masterRepositoriesMeta = repositoriesMeta.clone();
this.masterRepositoryName = repositoryMeta.getName();
shell = new Shell(parent, style | SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN | SWT.APPLICATION_MODAL);
shell.setText(BaseMessages.getString(PKG, "RepositoryDialog.Dialog.Main.Title")); //$NON-NLS-1$
}
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:14,代码来源:KettleDatabaseRepositoryDialog.java
示例5: getInfo
import org.pentaho.di.repository.kdr.KettleDatabaseRepositoryMeta; //导入依赖的package包/类
private void getInfo(KettleDatabaseRepositoryMeta info) {
info.setName(wId.getText());
info.setDescription(wName.getText());
int idx = wConnection.getSelectionIndex();
if (idx >= 0) {
DatabaseMeta dbinfo = repositories.getDatabase(idx);
info.setConnection(dbinfo);
} else {
info.setConnection(null);
}
}
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:13,代码来源:KettleDatabaseRepositoryDialog.java
示例6: setUpBeforeClass
import org.pentaho.di.repository.kdr.KettleDatabaseRepositoryMeta; //导入依赖的package包/类
/**
* setUpBeforeClass is a method called once before all tests are run. For this test suite,
* it is used to set up and connect to the test database repository, to increase performance
* and reduce unnecessary initialization, connects/disconnects from each test case. If repository
* initialization and/or connection/disconnection
* @throws java.lang.Exception
*/
@BeforeClass
public static void setUpBeforeClass() throws Exception {
KettleEnvironment.init();
registry = PluginRegistry.getInstance();
filename = File.createTempFile("kdrtest", "").getAbsolutePath();
System.out.println("Using file '"+filename+"' as a H2 database repository");
try {
DatabaseMeta databaseMeta = new DatabaseMeta("H2Repo", "H2", "JDBC", null, filename, null, null, null);
repositoryMeta = new KettleDatabaseRepositoryMeta("KettleDatabaseRepository", "H2Repo", "H2 Repository", databaseMeta);
repository = new KettleDatabaseRepository();
repository.init(repositoryMeta);
repository.connectionDelegate.connect(true, true);
KettleDatabaseRepositoryCreationHelper helper = new KettleDatabaseRepositoryCreationHelper(repository);
helper.createRepositorySchema(null, false, new ArrayList<String>(), false);
// Reconnect as admin
repository.disconnect();
repository.connect("admin", "admin");
} catch(Exception e) {
e.printStackTrace();
throw new KettleException("Error during database repository unit testing", e);
}
}
开发者ID:bsspirit,项目名称:kettle-4.4.0-stable,代码行数:37,代码来源:RepositoryUnitTest.java
示例7: KettleDatabaseRepositoryDialog
import org.pentaho.di.repository.kdr.KettleDatabaseRepositoryMeta; //导入依赖的package包/类
public KettleDatabaseRepositoryDialog(Shell parent, int style, RepositoryMeta repositoryMeta,
RepositoriesMeta repositoriesMeta) {
this.display = parent.getDisplay();
this.props = PropsUI.getInstance();
this.input = (KettleDatabaseRepositoryMeta) repositoryMeta;
this.repositories = repositoriesMeta;
this.masterRepositoriesMeta = repositoriesMeta.clone();
this.masterRepositoryName = repositoryMeta.getName();
shell = new Shell(parent, style | SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN | SWT.APPLICATION_MODAL| SWT.SHEET);
shell.setText(BaseMessages.getString(PKG, "RepositoryDialog.Dialog.Main.Title")); //$NON-NLS-1$
}
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:14,代码来源:KettleDatabaseRepositoryDialog.java
示例8: setUpBeforeClass
import org.pentaho.di.repository.kdr.KettleDatabaseRepositoryMeta; //导入依赖的package包/类
/**
* setUpBeforeClass is a method called once before all tests are run. For this test suite, it is
* used to set up and connect to the test database repository, to increase performance and reduce
* unnecessary initialization, connects/disconnects from each test case. If repository
* initialization and/or connection/disconnection
*
* @throws java.lang.Exception
*/
@BeforeClass
public static void setUpBeforeClass() throws Exception {
KettleEnvironment.init();
registry = PluginRegistry.getInstance();
filename = File.createTempFile( "kdrtest", "" ).getAbsolutePath();
System.out.println( "Using file '" + filename + "' as a H2 database repository" );
try {
DatabaseMeta databaseMeta = new DatabaseMeta( "H2Repo", "H2", "JDBC", null, filename, null, null, null );
repositoryMeta =
new KettleDatabaseRepositoryMeta( "KettleDatabaseRepository", "H2Repo", "H2 Repository", databaseMeta );
repository = new KettleDatabaseRepository();
repository.init( repositoryMeta );
repository.connectionDelegate.connect( true, true );
KettleDatabaseRepositoryCreationHelper helper = new KettleDatabaseRepositoryCreationHelper( repository );
helper.createRepositorySchema( null, false, new ArrayList<String>(), false );
// Reconnect as admin
repository.disconnect();
repository.connect( "admin", "admin" );
} catch ( Exception e ) {
e.printStackTrace();
throw new KettleException( "Error during database repository unit testing", e );
}
}
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:39,代码来源:RepositoryUnitIT.java
示例9: getInfo
import org.pentaho.di.repository.kdr.KettleDatabaseRepositoryMeta; //导入依赖的package包/类
private void getInfo( KettleDatabaseRepositoryMeta info ) {
info.setName( wName.getText() );
info.setDescription( wId.getText() );
int idx = wConnection.getSelectionIndex();
if ( idx >= 0 ) {
DatabaseMeta dbinfo = repositories.getDatabase( idx );
info.setConnection( dbinfo );
} else {
info.setConnection( null );
}
}
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:13,代码来源:KettleDatabaseRepositoryDialog.java
示例10: parseRepositoriesDoc
import org.pentaho.di.repository.kdr.KettleDatabaseRepositoryMeta; //导入依赖的package包/类
protected void parseRepositoriesDoc(Document doc) throws Exception {
// Get the <repositories> node:
Node repsnode = XMLHandler.getSubNode(doc, "repositories");
// Handle connections
int nrconn = XMLHandler.countNodes(repsnode, "connection");
log.logDebug(BaseMessages.getString(PKG, "RepositoryMeta.Log.ConnectionNumber", nrconn));
for (int i=0;i<nrconn;i++)
{
log.logDebug( BaseMessages.getString(PKG, "RepositoryMeta.Log.LookingConnection", i) );
Node dbnode = XMLHandler.getSubNodeByNr(repsnode, "connection", i);
DatabaseMeta dbcon = null;
try {
dbcon = new DatabaseMeta(dbnode);
addDatabase(dbcon);
log.logDebug(BaseMessages.getString(PKG, "RepositoryMeta.Log.ReadConnection", dbcon.getName() ));
}
catch (Exception kpe) {
log.logError(BaseMessages.getString(PKG, "RepositoryMeta.Error.CreatingDatabaseMeta", dbcon.getName() ));
}
}
// Handle repositories...
int nrreps = XMLHandler.countNodes(repsnode, RepositoryMeta.XML_TAG);
log.logDebug(BaseMessages.getString(PKG, "RepositoryMeta.Log.RepositoryNumber", nrreps ));
StringBuffer unableToReadIds = new StringBuffer();
KettleException kettleException = null;
for (int i=0;i<nrreps;i++)
{
Node repnode = XMLHandler.getSubNodeByNr(repsnode, RepositoryMeta.XML_TAG, i);
log.logDebug(BaseMessages.getString(PKG, "RepositoryMeta.Log.LookingRepository", i ));
String id = XMLHandler.getTagValue(repnode, "id");
if (Const.isEmpty(id)) {
// Backward compatibility : if the id is not defined, it's the database repository!
//
id=KettleDatabaseRepositoryMeta.REPOSITORY_TYPE_ID;
}
try {
RepositoryMeta repositoryMeta = PluginRegistry.getInstance().loadClass(RepositoryPluginType.class, id, RepositoryMeta.class);
if(repositoryMeta != null) {
repositoryMeta.loadXML(repnode, databases);
// Backward compatibility. Description is now required as it will be what gets displayed on the
// repositories dialog
if(repositoryMeta.getDescription() == null || repositoryMeta.getDescription().equals("")) {
repositoryMeta.setDescription(repositoryMeta.getName());
}
addRepository(repositoryMeta);
log.logDebug(BaseMessages.getString(PKG, "RepositoryMeta.Log.ReadRepository", repositoryMeta.getName() )); //$NON-NLS-1$
} else {
unableToReadIds.append(id);
unableToReadIds.append(",");
log.logDebug(BaseMessages.getString(PKG, "RepositoryMeta.Error.ReadRepositoryId", id )); //$NON-NLS-1$
}
} catch (KettleException ex) {
// Get to the root cause
Throwable cause = ex;
kettleException = ex;
while(cause.getCause() != null) {
cause = cause.getCause();
}
if(cause instanceof KettleRepositoryNotSupportedException) {
// If the root cause is a KettleRepositoryNotSupportedException, do not fail
log.logDebug(BaseMessages.getString(PKG, "RepositoryMeta.Error.UnrecognizedRepositoryType", id ));
}
}
}
if(unableToReadIds != null && unableToReadIds.length() > 0) {
errorMessage = BaseMessages.getString(PKG, "RepositoryMeta.Error.ReadRepositoryIdNotAvailable", unableToReadIds.substring(0, unableToReadIds.lastIndexOf(",")-1) );
}
if(kettleException != null) {
throw kettleException;
}
}
开发者ID:bsspirit,项目名称:kettle-4.4.0-stable,代码行数:81,代码来源:RepositoriesMeta.java
示例11: testDatabaseRepository
import org.pentaho.di.repository.kdr.KettleDatabaseRepositoryMeta; //导入依赖的package包/类
public void testDatabaseRepository() throws Exception {
KettleEnvironment.init();
String filename = File.createTempFile( "kdrtest", "" ).getAbsolutePath();
System.out.println( "Using file '" + filename + "' as a H2 database repository" );
try {
DatabaseMeta databaseMeta = new DatabaseMeta( "H2Repo", "H2", "JDBC", null, filename, null, null, null );
repositoryMeta =
new KettleDatabaseRepositoryMeta( "KettleDatabaseRepository", "H2Repo", "H2 Repository", databaseMeta );
repository = new KettleDatabaseRepository();
repository.init( repositoryMeta );
repository.connectionDelegate.connect( true, true );
KettleDatabaseRepositoryCreationHelper helper = new KettleDatabaseRepositoryCreationHelper( repository );
helper.createRepositorySchema( null, false, new ArrayList<String>(), false );
repository.disconnect();
// Test connecting...
//
repository.connect( "admin", "admin" );
assertTrue( repository.isConnected() );
// Test database save
DatabaseMeta dataBaseForSave = new DatabaseMeta("H2Test", "H2", "JDBC", null, filename, null, null, null );
repository.save( dataBaseForSave, "User creates new database" );
//load new database from repository by generated id on save step
DatabaseMeta loadedDataBase = repository.loadDatabaseMeta( dataBaseForSave.getObjectId(), "User creates new database" );
assertEquals("Database object before save and after load form database is diffenert", dataBaseForSave, loadedDataBase );
// Test loading the directory tree
tree = repository.loadRepositoryDirectoryTree();
assertNotNull( tree );
// Test directory creation
//
RepositoryDirectoryInterface fooDirectory = repository.createRepositoryDirectory( tree, "foo" );
RepositoryDirectoryInterface barDirectory = repository.createRepositoryDirectory( fooDirectory, "bar" );
RepositoryDirectoryInterface samplesDirectory =
repository.createRepositoryDirectory( fooDirectory, "samples" );
// Test directory path lookup
RepositoryDirectoryInterface checkBar = tree.findDirectory( "/foo/bar" );
assertNotNull( checkBar );
assertTrue( checkBar.equals( barDirectory ) );
// Save all the transformations samples.
//
verifyTransformationSamples( samplesDirectory );
verifyJobSamples( samplesDirectory );
// Verify metastore functionality
//
IMetaStore metaStore = repository.getMetaStore();
KettleMetaStoreTestBase testBase = new KettleMetaStoreTestBase();
testBase.testFunctionality( metaStore );
// Finally test disconnecting
repository.disconnect();
assertFalse( repository.isConnected() );
} catch ( Exception e ) {
e.printStackTrace();
throw new KettleException( "Error during database repository unit testing", e );
} finally {
// Remove the H2 database file
//
assertTrue( new File( filename + ".h2.db" ).delete() );
assertTrue( new File( filename + ".trace.db" ).delete() );
}
}
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:72,代码来源:KettleDatabaseRepositoryIT.java
示例12: createDBRep
import org.pentaho.di.repository.kdr.KettleDatabaseRepositoryMeta; //导入依赖的package包/类
/**
* createDBRep:创建数据库资源库. <br/>
* @author jingma
* @param dataMeta 数据库
* @param id 资源库id
* @param repName 资源库名称
* @param description 资源库描述
* @return 已经初始化的资源库
* @throws KettleException
* @since JDK 1.6
*/
public static Repository createDBRep(DatabaseMeta dataMeta,String id, String repName,
String description) throws KettleException{
//资源库元对象
KettleDatabaseRepositoryMeta kettleDatabaseMeta =
new KettleDatabaseRepositoryMeta(id, repName, description, dataMeta);
return createRep(kettleDatabaseMeta, id, repName, description);
}
开发者ID:majinju,项目名称:KettleEasyExpand,代码行数:19,代码来源:KettleUtils.java
注:本文中的org.pentaho.di.repository.kdr.KettleDatabaseRepositoryMeta类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论