use of org.pentaho.di.repository.ObjectId in project pentaho-kettle by pentaho.
the class KettleDatabaseRepository method getSlaveServers.
/**
* @return a list of all the slave servers in the repository.
* @throws KettleException
*/
public List<SlaveServer> getSlaveServers() throws KettleException {
List<SlaveServer> list = new ArrayList<>();
ObjectId[] slaveIDs = getSlaveIDs(false);
for (int i = 0; i < slaveIDs.length; i++) {
// Load last
SlaveServer slaveServer = loadSlaveServer(slaveIDs[i], null);
// version
list.add(slaveServer);
}
return list;
}
use of org.pentaho.di.repository.ObjectId in project pentaho-kettle by pentaho.
the class KettleDatabaseRepository method delStepConditions.
public synchronized void delStepConditions(ObjectId id_transformation) throws KettleException {
ObjectId[] ids = getTransformationConditionIDs(id_transformation);
for (int i = 0; i < ids.length; i++) {
deleteCondition(ids[i]);
}
connectionDelegate.performDelete("DELETE FROM " + quoteTable(KettleDatabaseRepository.TABLE_R_TRANS_STEP_CONDITION) + " WHERE " + quote(KettleDatabaseRepository.FIELD_TRANS_STEP_CONDITION_ID_TRANSFORMATION) + " = ? ", id_transformation);
}
use of org.pentaho.di.repository.ObjectId in project pentaho-kettle by pentaho.
the class KettleDatabaseRepositoryCreationHelper method updateJobEntryTypes.
/**
* Update the list in R_JOBENTRY_TYPE
*
* @param create
*
* @exception KettleException
* if something went wrong during the update.
*/
public void updateJobEntryTypes(List<String> statements, boolean dryrun, boolean create) throws KettleException {
synchronized (repository) {
// We should only do an update if something has changed...
PluginRegistry registry = PluginRegistry.getInstance();
List<PluginInterface> jobPlugins = registry.getPlugins(JobEntryPluginType.class);
for (int i = 0; i < jobPlugins.size(); i++) {
PluginInterface jobPlugin = jobPlugins.get(i);
String type_desc = jobPlugin.getIds()[0];
String type_desc_long = jobPlugin.getName();
ObjectId id = null;
if (!create) {
id = repository.jobEntryDelegate.getJobEntryTypeID(type_desc);
}
if (id == null) {
// Not found, we need to add this one...
// We need to add this one ...
id = new LongObjectId(i + 1);
if (!create) {
id = repository.connectionDelegate.getNextJobEntryTypeID();
}
RowMetaAndData table = new RowMetaAndData();
table.addValue(new ValueMetaInteger(KettleDatabaseRepository.FIELD_JOBENTRY_TYPE_ID_JOBENTRY_TYPE), id);
table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_JOBENTRY_TYPE_CODE), type_desc);
table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_JOBENTRY_TYPE_DESCRIPTION), type_desc_long);
if (dryrun) {
String sql = database.getSQLOutput(null, KettleDatabaseRepository.TABLE_R_JOBENTRY_TYPE, table.getRowMeta(), table.getData(), null);
statements.add(sql);
} else {
database.prepareInsert(table.getRowMeta(), null, KettleDatabaseRepository.TABLE_R_JOBENTRY_TYPE);
database.setValuesInsert(table);
database.insertRow();
database.closeInsert();
}
}
}
}
}
use of org.pentaho.di.repository.ObjectId in project pentaho-kettle by pentaho.
the class KettleDatabaseRepositoryCreationHelper method updateDatabaseTypes.
/**
* Update the list in R_DATABASE_TYPE using the database plugin entries
*
* @throws KettleException
* if the update didn't go as planned.
*/
public List<String> updateDatabaseTypes(List<String> statements, boolean dryrun, boolean create) throws KettleException {
synchronized (repository) {
// We should only do an update if something has changed...
//
List<PluginInterface> plugins = pluginRegistry.getPlugins(DatabasePluginType.class);
for (int i = 0; i < plugins.size(); i++) {
PluginInterface plugin = plugins.get(i);
ObjectId id = null;
if (!create) {
id = repository.databaseDelegate.getDatabaseTypeID(plugin.getIds()[0]);
}
if (id == null) {
// Not found, we need to add this one...
// We need to add this one ...
id = new LongObjectId(i + 1);
if (!create) {
id = repository.connectionDelegate.getNextDatabaseTypeID();
}
RowMetaAndData table = new RowMetaAndData();
table.addValue(new ValueMetaInteger(KettleDatabaseRepository.FIELD_DATABASE_TYPE_ID_DATABASE_TYPE), id);
table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_DATABASE_TYPE_CODE), plugin.getIds()[0]);
table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_DATABASE_TYPE_DESCRIPTION), plugin.getName());
if (dryrun) {
String sql = database.getSQLOutput(null, KettleDatabaseRepository.TABLE_R_DATABASE_TYPE, table.getRowMeta(), table.getData(), null);
statements.add(sql);
} else {
database.prepareInsert(table.getRowMeta(), null, KettleDatabaseRepository.TABLE_R_DATABASE_TYPE);
database.setValuesInsert(table);
database.insertRow();
database.closeInsert();
}
}
}
}
return statements;
}
use of org.pentaho.di.repository.ObjectId in project pentaho-kettle by pentaho.
the class XMLOutputMetaTest method testReadRepException.
@Test
public void testReadRepException() throws Exception {
XMLOutputMeta xmlOutputMeta = new XMLOutputMeta();
Repository rep = mock(Repository.class);
IMetaStore metastore = mock(IMetaStore.class);
DatabaseMeta dbMeta = mock(DatabaseMeta.class);
ObjectId oid = new StringObjectId("oid");
when(rep.getStepAttributeString(oid, "encoding")).thenThrow(new RuntimeException("encoding exception"));
try {
xmlOutputMeta.readRep(rep, metastore, oid, Collections.singletonList(dbMeta));
} catch (KettleException e) {
assertEquals("encoding exception", e.getCause().getMessage());
}
}
Aggregations