Search in sources :

Example 21 with RowMetaAndData

use of org.pentaho.di.core.RowMetaAndData in project pentaho-kettle by pentaho.

the class KettleDatabaseRepositorySlaveServerDelegate method loadSlaveServer.

public SlaveServer loadSlaveServer(ObjectId id_slave_server) throws KettleException {
    SlaveServer slaveServer = new SlaveServer();
    slaveServer.setObjectId(id_slave_server);
    RowMetaAndData row = getSlaveServer(id_slave_server);
    if (row == null) {
        throw new KettleDatabaseException(BaseMessages.getString(PKG, "SlaveServer.SlaveCouldNotBeFound", id_slave_server.toString()));
    }
    slaveServer.setName(row.getString(KettleDatabaseRepository.FIELD_SLAVE_NAME, null));
    slaveServer.setHostname(row.getString(KettleDatabaseRepository.FIELD_SLAVE_HOST_NAME, null));
    slaveServer.setPort(row.getString(KettleDatabaseRepository.FIELD_SLAVE_PORT, null));
    slaveServer.setWebAppName(row.getString(KettleDatabaseRepository.FIELD_SLAVE_WEB_APP_NAME, null));
    slaveServer.setUsername(row.getString(KettleDatabaseRepository.FIELD_SLAVE_USERNAME, null));
    slaveServer.setPassword(Encr.decryptPasswordOptionallyEncrypted(row.getString(KettleDatabaseRepository.FIELD_SLAVE_PASSWORD, null)));
    slaveServer.setProxyHostname(row.getString(KettleDatabaseRepository.FIELD_SLAVE_PROXY_HOST_NAME, null));
    slaveServer.setProxyPort(row.getString(KettleDatabaseRepository.FIELD_SLAVE_PROXY_PORT, null));
    slaveServer.setNonProxyHosts(row.getString(KettleDatabaseRepository.FIELD_SLAVE_NON_PROXY_HOSTS, null));
    slaveServer.setMaster(row.getBoolean(KettleDatabaseRepository.FIELD_SLAVE_MASTER, false));
    return slaveServer;
}
Also used : RowMetaAndData(org.pentaho.di.core.RowMetaAndData) KettleDatabaseException(org.pentaho.di.core.exception.KettleDatabaseException) SlaveServer(org.pentaho.di.cluster.SlaveServer)

Example 22 with RowMetaAndData

use of org.pentaho.di.core.RowMetaAndData in project pentaho-kettle by pentaho.

the class KettleDatabaseRepositoryStepDelegate method loadStepMeta.

/**
 * Create a new step by loading the metadata from the specified repository.
 *
 * @param rep
 * @param stepId
 * @param databases
 * @param counters
 * @param partitionSchemas
 * @throws KettleException
 */
public StepMeta loadStepMeta(ObjectId stepId, List<DatabaseMeta> databases, List<PartitionSchema> partitionSchemas) throws KettleException {
    StepMeta stepMeta = new StepMeta();
    PluginRegistry registry = PluginRegistry.getInstance();
    try {
        RowMetaAndData r = getStep(stepId);
        if (r != null) {
            stepMeta.setObjectId(stepId);
            stepMeta.setName(r.getString(KettleDatabaseRepository.FIELD_STEP_NAME, null));
            stepMeta.setDescription(r.getString(KettleDatabaseRepository.FIELD_STEP_DESCRIPTION, null));
            long id_step_type = r.getInteger(KettleDatabaseRepository.FIELD_STEP_ID_STEP_TYPE, -1L);
            RowMetaAndData steptyperow = getStepType(new LongObjectId(id_step_type));
            stepMeta.setStepID(steptyperow.getString(KettleDatabaseRepository.FIELD_STEP_TYPE_CODE, null));
            stepMeta.setDistributes(r.getBoolean(KettleDatabaseRepository.FIELD_STEP_DISTRIBUTE, true));
            int copies = (int) r.getInteger(KettleDatabaseRepository.FIELD_STEP_COPIES, 1);
            String copiesString = r.getString(KettleDatabaseRepository.FIELD_STEP_COPIES_STRING, null);
            if (!Utils.isEmpty(copiesString)) {
                stepMeta.setCopiesString(copiesString);
            } else {
                stepMeta.setCopies(copies);
            }
            int x = (int) r.getInteger(KettleDatabaseRepository.FIELD_STEP_GUI_LOCATION_X, 0);
            int y = (int) r.getInteger(KettleDatabaseRepository.FIELD_STEP_GUI_LOCATION_Y, 0);
            stepMeta.setLocation(new Point(x, y));
            stepMeta.setDraw(r.getBoolean(KettleDatabaseRepository.FIELD_STEP_GUI_DRAW, false));
            // Generate the appropriate class...
            PluginInterface sp = registry.findPluginWithId(StepPluginType.class, stepMeta.getStepID());
            if (sp == null) {
                stepMeta.setStepMetaInterface(new MissingTrans(stepMeta.getName(), stepMeta.getStepID()));
            } else {
                stepMeta.setStepMetaInterface((StepMetaInterface) registry.loadClass(sp));
            }
            if (stepMeta.getStepMetaInterface() != null) {
                // Read the step info from the repository!
                readRepCompatibleStepMeta(stepMeta.getStepMetaInterface(), repository, stepMeta.getObjectId(), databases);
                stepMeta.getStepMetaInterface().readRep(repository, repository.metaStore, stepMeta.getObjectId(), databases);
            }
            // Get the partitioning as well...
            // 
            stepMeta.setStepPartitioningMeta(loadStepPartitioningMeta(stepMeta.getObjectId()));
            stepMeta.getStepPartitioningMeta().setPartitionSchemaAfterLoading(partitionSchemas);
            // Get the cluster schema name
            // 
            stepMeta.setClusterSchemaName(repository.getStepAttributeString(stepId, "cluster_schema"));
            // Are we using a custom row distribution plugin?
            // 
            String rowDistributionCode = repository.getStepAttributeString(stepId, 0, "row_distribution_code");
            RowDistributionInterface rowDistribution = PluginRegistry.getInstance().loadClass(RowDistributionPluginType.class, rowDistributionCode, RowDistributionInterface.class);
            stepMeta.setRowDistribution(rowDistribution);
            // Load the attribute groups map
            // 
            stepMeta.setAttributesMap(loadStepAttributesMap(stepId));
            // 
            return stepMeta;
        } else {
            throw new KettleException(BaseMessages.getString(PKG, "StepMeta.Exception.StepInfoCouldNotBeFound", String.valueOf(stepId)));
        }
    } catch (KettleDatabaseException dbe) {
        throw new KettleException(BaseMessages.getString(PKG, "StepMeta.Exception.StepCouldNotBeLoaded", String.valueOf(stepMeta.getObjectId())), dbe);
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) KettleDatabaseException(org.pentaho.di.core.exception.KettleDatabaseException) PluginInterface(org.pentaho.di.core.plugins.PluginInterface) LongObjectId(org.pentaho.di.repository.LongObjectId) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) Point(org.pentaho.di.core.gui.Point) StepMeta(org.pentaho.di.trans.step.StepMeta) Point(org.pentaho.di.core.gui.Point) RowMetaAndData(org.pentaho.di.core.RowMetaAndData) PluginRegistry(org.pentaho.di.core.plugins.PluginRegistry) MissingTrans(org.pentaho.di.trans.steps.missing.MissingTrans) RowDistributionInterface(org.pentaho.di.trans.step.RowDistributionInterface)

Example 23 with RowMetaAndData

use of org.pentaho.di.core.RowMetaAndData in project pentaho-kettle by pentaho.

the class KettleDatabaseRepositoryTransDelegate method getNrTransformations.

public synchronized int getNrTransformations(ObjectId id_directory) throws KettleException {
    int retval = 0;
    RowMetaAndData par = repository.connectionDelegate.getParameterMetaData(id_directory);
    String sql = "SELECT COUNT(*) FROM " + quoteTable(KettleDatabaseRepository.TABLE_R_TRANSFORMATION) + " WHERE " + quote(KettleDatabaseRepository.FIELD_TRANSFORMATION_ID_DIRECTORY) + " = ? ";
    RowMetaAndData r = repository.connectionDelegate.getOneRow(sql, par.getRowMeta(), par.getData());
    if (r != null) {
        retval = (int) r.getInteger(0, 0L);
    }
    return retval;
}
Also used : RowMetaAndData(org.pentaho.di.core.RowMetaAndData) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString)

Example 24 with RowMetaAndData

use of org.pentaho.di.core.RowMetaAndData in project pentaho-kettle by pentaho.

the class KettleDatabaseRepositoryTransDelegate method getNrTransHops.

public synchronized int getNrTransHops(ObjectId id_transformation) throws KettleException {
    int retval = 0;
    RowMetaAndData par = repository.connectionDelegate.getParameterMetaData(id_transformation);
    String sql = "SELECT COUNT(*) FROM " + quoteTable(KettleDatabaseRepository.TABLE_R_TRANS_HOP) + " WHERE " + quote(KettleDatabaseRepository.FIELD_TRANS_HOP_ID_TRANSFORMATION) + " = ? ";
    RowMetaAndData r = repository.connectionDelegate.getOneRow(sql, par.getRowMeta(), par.getData());
    if (r != null) {
        retval = (int) r.getInteger(0, 0L);
    }
    return retval;
}
Also used : RowMetaAndData(org.pentaho.di.core.RowMetaAndData) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString)

Example 25 with RowMetaAndData

use of org.pentaho.di.core.RowMetaAndData in project pentaho-kettle by pentaho.

the class KettleDatabaseRepositoryTransDelegate method getNrTransDependencies.

public synchronized int getNrTransDependencies(ObjectId id_transformation) throws KettleException {
    int retval = 0;
    RowMetaAndData par = repository.connectionDelegate.getParameterMetaData(id_transformation);
    String sql = "SELECT COUNT(*) FROM " + quoteTable(KettleDatabaseRepository.TABLE_R_DEPENDENCY) + " WHERE " + quote(KettleDatabaseRepository.FIELD_DEPENDENCY_ID_TRANSFORMATION) + " = ? ";
    RowMetaAndData r = repository.connectionDelegate.getOneRow(sql, par.getRowMeta(), par.getData());
    if (r != null) {
        retval = (int) r.getInteger(0, 0L);
    }
    return retval;
}
Also used : RowMetaAndData(org.pentaho.di.core.RowMetaAndData) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString)

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