本文整理汇总了Java中org.pentaho.di.core.database.DatabaseMeta.setName方法的典型用法代码示例。如果您正苦于以下问题:Java DatabaseMeta.setName方法的具体用法?Java DatabaseMeta.setName怎么用?Java DatabaseMeta.setName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.pentaho.di.core.database.DatabaseMeta
的用法示例。
在下文中一共展示了DatabaseMeta.setName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dupeConnection
import org.pentaho.di.core.database.DatabaseMeta; //导入方法依赖的package包/类
public void dupeConnection(HasDatabasesInterface hasDatabasesInterface, DatabaseMeta databaseMeta)
{
String name = databaseMeta.getName();
int pos = hasDatabasesInterface.indexOfDatabase(databaseMeta);
if (databaseMeta != null)
{
DatabaseMeta databaseMetaCopy = (DatabaseMeta) databaseMeta.clone();
String dupename = BaseMessages.getString(PKG, "Spoon.Various.DupeName") + name;
databaseMetaCopy.setName(dupename);
getDatabaseDialog().setDatabaseMeta(databaseMetaCopy);
String newname = getDatabaseDialog().open();
if (newname != null) // null: CANCEL
{
databaseMetaCopy.verifyAndModifyDatabaseName(hasDatabasesInterface.getDatabases(), name);
hasDatabasesInterface.addDatabase(pos + 1, databaseMetaCopy);
spoon
.addUndoNew((UndoInterface) hasDatabasesInterface,
new DatabaseMeta[] { (DatabaseMeta) databaseMetaCopy.clone() },
new int[] { pos + 1 });
saveConnection(databaseMetaCopy, Const.VERSION_COMMENT_EDIT_VERSION);
spoon.refreshTree();
}
}
}
示例2: dupeConnection
import org.pentaho.di.core.database.DatabaseMeta; //导入方法依赖的package包/类
public void dupeConnection(HasDatabasesInterface hasDatabasesInterface, DatabaseMeta databaseMeta)
{
String name = databaseMeta.getName();
int pos = hasDatabasesInterface.indexOfDatabase(databaseMeta);
if (databaseMeta != null)
{
DatabaseMeta databaseMetaCopy = (DatabaseMeta) databaseMeta.clone();
String dupename = Messages.getString("Spoon.Various.DupeName") + name; // "(copy
// of)
// "
databaseMetaCopy.setName(dupename);
DatabaseDialog con = new DatabaseDialog(spoon.getShell(), databaseMetaCopy);
String newname = con.open();
if (newname != null) // null: CANCEL
{
databaseMetaCopy.verifyAndModifyDatabaseName(hasDatabasesInterface.getDatabases(), name);
hasDatabasesInterface.addDatabase(pos + 1, databaseMetaCopy);
spoon
.addUndoNew((UndoInterface) hasDatabasesInterface,
new DatabaseMeta[] { (DatabaseMeta) databaseMetaCopy.clone() },
new int[] { pos + 1 });
saveConnection(databaseMetaCopy);
spoon.refreshTree();
}
}
}
示例3: renameDatabase
import org.pentaho.di.core.database.DatabaseMeta; //导入方法依赖的package包/类
public boolean renameDatabase(String name, String newname)
{
boolean retval=false;
try
{
if (Const.isEmpty(newname))
{
throw new KettleException(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Exception.NameCanNotBeEmpty"));
}
if (!name.equals(newname))
{
ObjectId id = rep.getDatabaseID(name);
if (id!=null)
{
DatabaseMeta databaseMeta = rep.loadDatabaseMeta(id, null); // reads last version
databaseMeta.setName(newname);
rep.insertLogEntry("Renaming database connection '"+getDatabaseDialog().getDatabaseMeta().getName()+"'");
rep.save(databaseMeta, Const.VERSION_COMMENT_EDIT_VERSION, null);
retval=true;
}
else
{
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
mb.setMessage(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Connection.Rename.ErrorFinding.Message1")+name+"]"+Const.CR+BaseMessages.getString(PKG, "RepositoryExplorerDialog.Connection.Rename.ErrorFinding.Message2")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
mb.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Connection.Rename.ErrorFinding.Title")); //$NON-NLS-1$
mb.open();
}
}
}
catch(KettleException e)
{
new ErrorDialog(shell, BaseMessages.getString(PKG, "RepositoryExplorerDialog.Connection.Rename.UnexpectedError.Title"), BaseMessages.getString(PKG, "RepositoryExplorerDialog.Connection.Rename.UnexpectedError.Message"), e); //$NON-NLS-1$ //$NON-NLS-2$
}
return retval;
}
示例4: loadDatabaseMeta
import org.pentaho.di.core.database.DatabaseMeta; //导入方法依赖的package包/类
/**
*
* Load the Database Info
*/
public static DatabaseMeta loadDatabaseMeta(Repository rep, long id_database) throws KettleException
{
DatabaseMeta databaseMeta = new DatabaseMeta();
try
{
RowMetaAndData r = rep.getDatabase(id_database);
if (r!=null)
{
long id_database_type = r.getInteger("ID_DATABASE_TYPE", 0); // con_type
String dbTypeDesc = rep.getDatabaseTypeCode(id_database_type);
if (dbTypeDesc!=null)
{
databaseMeta.setDatabaseInterface(DatabaseMeta.getDatabaseInterface(dbTypeDesc));
databaseMeta.setAttributes(new Properties()); // new attributes
}
else
{
// throw new KettleException("No database type was specified [id_database_type="+id_database_type+"]");
}
databaseMeta.setID(id_database);
databaseMeta.setName( r.getString("NAME", "") );
long id_database_contype = r.getInteger("ID_DATABASE_CONTYPE", 0); // con_access
databaseMeta.setAccessType( DatabaseMeta.getAccessType( rep.getDatabaseConTypeCode( id_database_contype)) );
databaseMeta.setHostname( r.getString("HOST_NAME", "") );
databaseMeta.setDBName( r.getString("DATABASE_NAME", "") );
databaseMeta.setDBPort( r.getString("PORT", "") );
databaseMeta.setUsername( r.getString("USERNAME", "") );
databaseMeta.setPassword( Encr.decryptPasswordOptionallyEncrypted( r.getString("PASSWORD", "") ) );
databaseMeta.setServername( r.getString("SERVERNAME", "") );
databaseMeta.setDataTablespace( r.getString("DATA_TBS", "") );
databaseMeta.setIndexTablespace( r.getString("INDEX_TBS", "") );
// Also, load all the properties we can find...
final Collection<RowMetaAndData> attrs = rep.getDatabaseAttributes(id_database);
for (RowMetaAndData row : attrs)
{
String code = row.getString("CODE", "");
String attribute = row.getString("VALUE_STR", "");
// System.out.println("Attributes: "+(getAttributes()!=null)+", code: "+(code!=null)+", attribute: "+(attribute!=null));
databaseMeta.getAttributes().put(code, Const.NVL(attribute, ""));
}
}
return databaseMeta;
}
catch(KettleDatabaseException dbe)
{
throw new KettleException("Error loading database connection from repository (id_database="+id_database+")", dbe);
}
}
示例5: loadDatabaseMeta
import org.pentaho.di.core.database.DatabaseMeta; //导入方法依赖的package包/类
/**
*
* Load the Database Info
*/
public DatabaseMeta loadDatabaseMeta(ObjectId id_database) throws KettleException
{
DatabaseMeta databaseMeta = new DatabaseMeta();
try
{
RowMetaAndData r = getDatabase(id_database);
if (r!=null)
{
ObjectId id_database_type = new LongObjectId( r.getInteger( KettleDatabaseRepository.FIELD_DATABASE_ID_DATABASE_TYPE, 0) ); // con_type
String dbTypeDesc = getDatabaseTypeCode( id_database_type );
if (dbTypeDesc!=null)
{
databaseMeta.setDatabaseInterface(DatabaseMeta.getDatabaseInterface(dbTypeDesc));
databaseMeta.setAttributes(new Properties()); // new attributes
}
else
{
// throw new KettleException("No database type was specified [id_database_type="+id_database_type+"]");
}
databaseMeta.setObjectId(id_database);
databaseMeta.setName( r.getString(KettleDatabaseRepository.FIELD_DATABASE_NAME, "") );
ObjectId id_database_contype = new LongObjectId( r.getInteger(KettleDatabaseRepository.FIELD_DATABASE_ID_DATABASE_CONTYPE, 0) ); // con_access
databaseMeta.setAccessType( DatabaseMeta.getAccessType( getDatabaseConTypeCode( id_database_contype)) );
databaseMeta.setHostname( r.getString(KettleDatabaseRepository.FIELD_DATABASE_HOST_NAME, "") );
databaseMeta.setDBName( r.getString(KettleDatabaseRepository.FIELD_DATABASE_DATABASE_NAME, "") );
databaseMeta.setDBPort( r.getString(KettleDatabaseRepository.FIELD_DATABASE_PORT, "") );
databaseMeta.setUsername( r.getString(KettleDatabaseRepository.FIELD_DATABASE_USERNAME, "") );
databaseMeta.setPassword( Encr.decryptPasswordOptionallyEncrypted( r.getString(KettleDatabaseRepository.FIELD_DATABASE_PASSWORD, "") ) );
databaseMeta.setServername( r.getString(KettleDatabaseRepository.FIELD_DATABASE_SERVERNAME, "") );
databaseMeta.setDataTablespace( r.getString(KettleDatabaseRepository.FIELD_DATABASE_DATA_TBS, "") );
databaseMeta.setIndexTablespace( r.getString(KettleDatabaseRepository.FIELD_DATABASE_INDEX_TBS, "") );
// Also, load all the properties we can find...
final Collection<RowMetaAndData> attrs = repository.connectionDelegate.getDatabaseAttributes(id_database);
for (RowMetaAndData row : attrs)
{
String code = row.getString(KettleDatabaseRepository.FIELD_DATABASE_ATTRIBUTE_CODE, "");
String attribute = row.getString(KettleDatabaseRepository.FIELD_DATABASE_ATTRIBUTE_VALUE_STR, "");
// System.out.println("Attributes: "+(getAttributes()!=null)+", code: "+(code!=null)+", attribute: "+(attribute!=null));
databaseMeta.getAttributes().put(code, Const.NVL(attribute, ""));
}
}
return databaseMeta;
}
catch(KettleDatabaseException dbe)
{
throw new KettleException("Error loading database connection from repository (id_database="+id_database+")", dbe);
}
}
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:59,代码来源:KettleDatabaseRepositoryDatabaseDelegate.java