Search in sources :

Example 16 with RowMetaAndData

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;
}
Also used : ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) RowMetaAndData(org.pentaho.di.core.RowMetaAndData) ObjectId(org.pentaho.di.repository.ObjectId) ValueMetaInteger(org.pentaho.di.core.row.value.ValueMetaInteger)

Example 17 with RowMetaAndData

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;
}
Also used : ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) RowMetaAndData(org.pentaho.di.core.RowMetaAndData) ObjectId(org.pentaho.di.repository.ObjectId) KettleObjectExistsException(org.pentaho.di.core.exception.KettleObjectExistsException) ValueMetaInteger(org.pentaho.di.core.row.value.ValueMetaInteger) ValueMetaBoolean(org.pentaho.di.core.row.value.ValueMetaBoolean)

Example 18 with RowMetaAndData

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;
}
Also used : RowMetaAndData(org.pentaho.di.core.RowMetaAndData) PartitionSchema(org.pentaho.di.partition.PartitionSchema) ObjectId(org.pentaho.di.repository.ObjectId)

Example 19 with RowMetaAndData

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());
}
Also used : ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) RowMetaAndData(org.pentaho.di.core.RowMetaAndData) ValueMetaBoolean(org.pentaho.di.core.row.value.ValueMetaBoolean)

Example 20 with RowMetaAndData

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;
}
Also used : ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) RowMetaAndData(org.pentaho.di.core.RowMetaAndData) ObjectId(org.pentaho.di.repository.ObjectId) KettleObjectExistsException(org.pentaho.di.core.exception.KettleObjectExistsException) ValueMetaInteger(org.pentaho.di.core.row.value.ValueMetaInteger) ValueMetaBoolean(org.pentaho.di.core.row.value.ValueMetaBoolean)

Aggregations

RowMetaAndData (org.pentaho.di.core.RowMetaAndData)563 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)225 ArrayList (java.util.ArrayList)172 RowMetaInterface (org.pentaho.di.core.row.RowMetaInterface)145 TransMeta (org.pentaho.di.trans.TransMeta)116 Test (org.junit.Test)108 ValueMetaInteger (org.pentaho.di.core.row.value.ValueMetaInteger)94 KettleException (org.pentaho.di.core.exception.KettleException)89 StepMeta (org.pentaho.di.trans.step.StepMeta)80 LongObjectId (org.pentaho.di.repository.LongObjectId)75 StepInterface (org.pentaho.di.trans.step.StepInterface)75 RowStepCollector (org.pentaho.di.trans.RowStepCollector)73 Trans (org.pentaho.di.trans.Trans)73 PluginRegistry (org.pentaho.di.core.plugins.PluginRegistry)71 TransHopMeta (org.pentaho.di.trans.TransHopMeta)71 KettleValueException (org.pentaho.di.core.exception.KettleValueException)58 RowProducer (org.pentaho.di.trans.RowProducer)56 DummyTransMeta (org.pentaho.di.trans.steps.dummytrans.DummyTransMeta)54 KettleDatabaseException (org.pentaho.di.core.exception.KettleDatabaseException)53 RowMeta (org.pentaho.di.core.row.RowMeta)51