use of org.pentaho.di.core.RowMetaAndData in project pentaho-kettle by pentaho.
the class KettleDatabaseRepositoryPartitionSchemaDelegate method insertPartition.
public synchronized ObjectId insertPartition(ObjectId id_partition_schema, String partition_id) throws KettleException {
ObjectId id = repository.connectionDelegate.getNextPartitionID();
RowMetaAndData table = new RowMetaAndData();
table.addValue(new ValueMetaInteger(KettleDatabaseRepository.FIELD_PARTITION_ID_PARTITION), id);
table.addValue(new ValueMetaInteger(KettleDatabaseRepository.FIELD_PARTITION_ID_PARTITION_SCHEMA), id_partition_schema);
table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_PARTITION_PARTITION_ID), partition_id);
repository.connectionDelegate.getDatabase().prepareInsert(table.getRowMeta(), KettleDatabaseRepository.TABLE_R_PARTITION);
repository.connectionDelegate.getDatabase().setValuesInsert(table);
repository.connectionDelegate.getDatabase().insertRow();
repository.connectionDelegate.getDatabase().closeInsert();
return id;
}
use of org.pentaho.di.core.RowMetaAndData in project pentaho-kettle by pentaho.
the class KettleDatabaseRepositoryPartitionSchemaDelegate method insertPartitionSchema.
public synchronized ObjectId insertPartitionSchema(PartitionSchema partitionSchema) throws KettleException {
if (getPartitionSchemaID(partitionSchema.getName()) != null) {
// This partition schema name is already in use. Throw an exception.
throw new KettleObjectExistsException("Failed to create object in repository. Object [" + partitionSchema.getName() + "] already exists.");
}
ObjectId id = repository.connectionDelegate.getNextPartitionSchemaID();
RowMetaAndData table = new RowMetaAndData();
table.addValue(new ValueMetaInteger(KettleDatabaseRepository.FIELD_PARTITION_SCHEMA_ID_PARTITION_SCHEMA), id);
table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_PARTITION_SCHEMA_NAME), partitionSchema.getName());
table.addValue(new ValueMetaBoolean(KettleDatabaseRepository.FIELD_PARTITION_SCHEMA_DYNAMIC_DEFINITION), partitionSchema.isDynamicallyDefined());
table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_PARTITION_SCHEMA_PARTITIONS_PER_SLAVE), partitionSchema.getNumberOfPartitionsPerSlave());
repository.connectionDelegate.getDatabase().prepareInsert(table.getRowMeta(), KettleDatabaseRepository.TABLE_R_PARTITION_SCHEMA);
repository.connectionDelegate.getDatabase().setValuesInsert(table);
repository.connectionDelegate.getDatabase().insertRow();
repository.connectionDelegate.getDatabase().closeInsert();
return id;
}
use of org.pentaho.di.core.RowMetaAndData in project pentaho-kettle by pentaho.
the class KettleDatabaseRepositoryPartitionSchemaDelegate method loadPartitionSchema.
public PartitionSchema loadPartitionSchema(ObjectId id_partition_schema) throws KettleException {
PartitionSchema partitionSchema = new PartitionSchema();
partitionSchema.setObjectId(id_partition_schema);
RowMetaAndData row = getPartitionSchema(id_partition_schema);
partitionSchema.setName(row.getString("NAME", null));
ObjectId[] pids = repository.getPartitionIDs(id_partition_schema);
for (int i = 0; i < pids.length; i++) {
partitionSchema.getPartitionIDs().add(getPartition(pids[i]).getString("PARTITION_ID", null));
}
partitionSchema.setDynamicallyDefined(row.getBoolean("DYNAMIC_DEFINITION", false));
partitionSchema.setNumberOfPartitionsPerSlave(row.getString("PARTITIONS_PER_SLAVE", null));
return partitionSchema;
}
use of org.pentaho.di.core.RowMetaAndData in project pentaho-kettle by pentaho.
the class KettleDatabaseRepositoryPartitionSchemaDelegate method updatePartitionSchema.
public synchronized void updatePartitionSchema(PartitionSchema partitionSchema) throws KettleException {
RowMetaAndData table = new RowMetaAndData();
table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_PARTITION_SCHEMA_NAME), partitionSchema.getName());
table.addValue(new ValueMetaBoolean(KettleDatabaseRepository.FIELD_PARTITION_SCHEMA_DYNAMIC_DEFINITION), partitionSchema.isDynamicallyDefined());
table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_PARTITION_SCHEMA_PARTITIONS_PER_SLAVE), partitionSchema.getNumberOfPartitionsPerSlave());
repository.connectionDelegate.updateTableRow(KettleDatabaseRepository.TABLE_R_PARTITION_SCHEMA, KettleDatabaseRepository.FIELD_PARTITION_SCHEMA_ID_PARTITION_SCHEMA, table, partitionSchema.getObjectId());
}
use of org.pentaho.di.core.RowMetaAndData in project pentaho-kettle by pentaho.
the class KettleDatabaseRepositorySlaveServerDelegate method insertSlave.
public synchronized ObjectId insertSlave(SlaveServer slaveServer) throws KettleException {
if (getSlaveID(slaveServer.getName()) != null) {
// This slave server name is already in use. Throw an exception.
throw new KettleObjectExistsException("Failed to create object in repository. Object [" + slaveServer.getName() + "] already exists.");
}
ObjectId id = repository.connectionDelegate.getNextSlaveServerID();
RowMetaAndData table = new RowMetaAndData();
table.addValue(new ValueMetaInteger(KettleDatabaseRepository.FIELD_SLAVE_ID_SLAVE), id);
table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_SLAVE_NAME), slaveServer.getName());
table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_SLAVE_HOST_NAME), slaveServer.getHostname());
table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_SLAVE_PORT), slaveServer.getPort());
table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_SLAVE_WEB_APP_NAME), slaveServer.getWebAppName());
table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_SLAVE_USERNAME), slaveServer.getUsername());
table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_SLAVE_PASSWORD), Encr.encryptPasswordIfNotUsingVariables(slaveServer.getPassword()));
table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_SLAVE_PROXY_HOST_NAME), slaveServer.getProxyHostname());
table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_SLAVE_PROXY_PORT), slaveServer.getProxyPort());
table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_SLAVE_NON_PROXY_HOSTS), slaveServer.getNonProxyHosts());
table.addValue(new ValueMetaBoolean(KettleDatabaseRepository.FIELD_SLAVE_MASTER), Boolean.valueOf(slaveServer.isMaster()));
repository.connectionDelegate.getDatabase().prepareInsert(table.getRowMeta(), KettleDatabaseRepository.TABLE_R_SLAVE);
repository.connectionDelegate.getDatabase().setValuesInsert(table);
repository.connectionDelegate.getDatabase().insertRow();
repository.connectionDelegate.getDatabase().closeInsert();
return id;
}
Aggregations