本文整理匯總了Java中org.pentaho.di.core.database.DatabaseMeta.setDBPort方法的典型用法代碼示例。如果您正苦於以下問題:Java DatabaseMeta.setDBPort方法的具體用法?Java DatabaseMeta.setDBPort怎麽用?Java DatabaseMeta.setDBPort使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.pentaho.di.core.database.DatabaseMeta
的用法示例。
在下文中一共展示了DatabaseMeta.setDBPort方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initRepository
import org.pentaho.di.core.database.DatabaseMeta; //導入方法依賴的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);
}
}
}
示例2: initRepository
import org.pentaho.di.core.database.DatabaseMeta; //導入方法依賴的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);
}
}
}
示例3: executeTransformation
import org.pentaho.di.core.database.DatabaseMeta; //導入方法依賴的package包/類
public Map<String, Object> executeTransformation(String ktrPath) {
Map<String, Object> executionResult = new HashMap<String, Object>();
try {
KettleEnvironment.init();
EnvUtil.environmentInit();
TransMeta transMeta = new TransMeta(ktrPath);
List<DatabaseMeta> dbMetaList = transMeta.getDatabases();
for (DatabaseMeta dbMeta : dbMetaList) {
if (dbMeta.getName().equals(this.connectionName)) {
dbMeta.setHostname(this.dbHostName);
dbMeta.setUsername(this.dbUerName);
dbMeta.setPassword(this.dbPassword);
dbMeta.setDBPort(this.dbPort);
dbMeta.setDBName(this.dbName);
}
}
Trans transformation = new Trans(transMeta);
if (this.parameters != null) {
for (Map.Entry<String, String> entry : this.parameters.entrySet()) {
transformation.setParameterValue((String) entry.getKey(), (String) entry.getValue());
}
}
transformation.execute(null);
transformation.waitUntilFinished();
for (StepMetaDataCombi combi : transformation.getSteps()) {
StepDTO stepDTO = new StepDTO();
stepDTO.setStepName(combi.step.getStepname());
stepDTO.setLinesInput(Long.valueOf(combi.step.getLinesInput()));
stepDTO.setLinesOutput(Long.valueOf(combi.step.getLinesOutput()));
stepDTO.setLinesRead(Long.valueOf(combi.step.getLinesRead()));
stepDTO.setLinesRejected(Long.valueOf(combi.step.getLinesRejected()));
stepDTO.setLinesUpdated(Long.valueOf(combi.step.getLinesUpdated()));
stepDTO.setStepDestinationNameList(new ArrayList<String>());
for (RowSet rowSet : combi.step.getOutputRowSets()) {
stepDTO.getStepDestinationNameList().add(rowSet.getDestinationStepName());
}
this.getStepDTOList().add(stepDTO);
}
if (transformation.getErrors() > 0) {
System.out.println("Erroruting Transformation");
executionResult.put("transformationExecuted", false);
return executionResult;
} else {
executionResult.put("transformationExecuted", true);
return executionResult;
}
} catch (Exception e) {
e.printStackTrace();
executionResult.put("transformationExecuted", false);
return executionResult;
}
}
示例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