Search in sources :

Example 16 with SharedObjects

use of org.pentaho.di.shared.SharedObjects in project pentaho-kettle by pentaho.

the class KettleFileRepository method readJobMetaSharedObjects.

@Override
public SharedObjects readJobMetaSharedObjects(JobMeta jobMeta) throws KettleException {
    // First the normal shared objects...
    // 
    SharedObjects sharedObjects = jobMeta.readSharedObjects();
    // 
    for (ObjectId id : getDatabaseIDs(false)) {
        // Load last version
        DatabaseMeta databaseMeta = loadDatabaseMeta(id, null);
        databaseMeta.shareVariablesWith(jobMeta);
        jobMeta.addOrReplaceDatabase(databaseMeta);
    }
    for (ObjectId id : getSlaveIDs(false)) {
        // Load last version
        SlaveServer slaveServer = loadSlaveServer(id, null);
        slaveServer.shareVariablesWith(jobMeta);
        jobMeta.addOrReplaceSlaveServer(slaveServer);
    }
    return sharedObjects;
}
Also used : StringObjectId(org.pentaho.di.repository.StringObjectId) ObjectId(org.pentaho.di.repository.ObjectId) SharedObjects(org.pentaho.di.shared.SharedObjects) SlaveServer(org.pentaho.di.cluster.SlaveServer) DatabaseMeta(org.pentaho.di.core.database.DatabaseMeta)

Example 17 with SharedObjects

use of org.pentaho.di.shared.SharedObjects in project pentaho-kettle by pentaho.

the class KettleFileRepository method readTransSharedObjects.

@Override
public SharedObjects readTransSharedObjects(TransMeta transMeta) throws KettleException {
    // First the normal shared objects...
    // 
    SharedObjects sharedObjects = transMeta.readSharedObjects();
    // 
    for (ObjectId id : getDatabaseIDs(false)) {
        // Load last version
        DatabaseMeta databaseMeta = loadDatabaseMeta(id, null);
        databaseMeta.shareVariablesWith(transMeta);
        transMeta.addOrReplaceDatabase(databaseMeta);
    }
    for (ObjectId id : getSlaveIDs(false)) {
        // Load last version
        SlaveServer slaveServer = loadSlaveServer(id, null);
        slaveServer.shareVariablesWith(transMeta);
        transMeta.addOrReplaceSlaveServer(slaveServer);
    }
    for (ObjectId id : getClusterIDs(false)) {
        // Load last version
        ClusterSchema clusterSchema = loadClusterSchema(id, transMeta.getSlaveServers(), null);
        clusterSchema.shareVariablesWith(transMeta);
        transMeta.addOrReplaceClusterSchema(clusterSchema);
    }
    for (ObjectId id : getPartitionSchemaIDs(false)) {
        // Load last version
        PartitionSchema partitionSchema = loadPartitionSchema(id, null);
        transMeta.addOrReplacePartitionSchema(partitionSchema);
    }
    return sharedObjects;
}
Also used : StringObjectId(org.pentaho.di.repository.StringObjectId) ObjectId(org.pentaho.di.repository.ObjectId) PartitionSchema(org.pentaho.di.partition.PartitionSchema) SharedObjects(org.pentaho.di.shared.SharedObjects) SlaveServer(org.pentaho.di.cluster.SlaveServer) DatabaseMeta(org.pentaho.di.core.database.DatabaseMeta) ClusterSchema(org.pentaho.di.cluster.ClusterSchema)

Example 18 with SharedObjects

use of org.pentaho.di.shared.SharedObjects in project pentaho-kettle by pentaho.

the class AbstractMeta method saveSharedObjects.

public void saveSharedObjects() throws KettleException {
    try {
        // Load all the shared objects...
        String soFile = environmentSubstitute(sharedObjectsFile);
        SharedObjects sharedObjects = new SharedObjects(soFile);
        // in-memory shared objects are supposed to be in sync, discard those on file to allow edit/delete
        sharedObjects.setObjectsMap(new Hashtable<>());
        for (SharedObjectInterface sharedObject : getAllSharedObjects()) {
            if (sharedObject.isShared()) {
                sharedObjects.storeObject(sharedObject);
            }
        }
        sharedObjects.saveToFile();
    } catch (Exception e) {
        throw new KettleException("Unable to save shared ojects", e);
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) SharedObjectInterface(org.pentaho.di.shared.SharedObjectInterface) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) SharedObjects(org.pentaho.di.shared.SharedObjects) DuplicateParamException(org.pentaho.di.core.parameters.DuplicateParamException) UnknownParamException(org.pentaho.di.core.parameters.UnknownParamException) MetaStoreException(org.pentaho.metastore.api.exceptions.MetaStoreException) KettleValueException(org.pentaho.di.core.exception.KettleValueException) KettleException(org.pentaho.di.core.exception.KettleException) KettlePluginException(org.pentaho.di.core.exception.KettlePluginException)

Example 19 with SharedObjects

use of org.pentaho.di.shared.SharedObjects in project pentaho-kettle by pentaho.

the class AbstractMeta method getSharedObjects.

/**
 * Gets the shared objects.
 *
 * @return the sharedObjects
 */
public SharedObjects getSharedObjects() {
    if (sharedObjects == null) {
        try {
            String soFile = environmentSubstitute(sharedObjectsFile);
            sharedObjects = new SharedObjects(soFile);
        } catch (KettleException e) {
            LogChannel.GENERAL.logDebug(e.getMessage(), e);
        }
    }
    return sharedObjects;
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) SharedObjects(org.pentaho.di.shared.SharedObjects)

Example 20 with SharedObjects

use of org.pentaho.di.shared.SharedObjects in project pentaho-kettle by pentaho.

the class AbstractMeta method readSharedObjects.

/**
 * Read shared objects.
 *
 * @return the shared objects
 * @throws KettleException the kettle exception
 */
public SharedObjects readSharedObjects() throws KettleException {
    // Extract the shared steps, connections, etc. using the SharedObjects
    // class
    // 
    String soFile = environmentSubstitute(sharedObjectsFile);
    SharedObjects sharedObjects = new SharedObjects(soFile);
    Map<?, SharedObjectInterface> objectsMap = sharedObjects.getObjectsMap();
    // 
    for (SharedObjectInterface object : objectsMap.values()) {
        loadSharedObject(object);
    }
    return sharedObjects;
}
Also used : SharedObjectInterface(org.pentaho.di.shared.SharedObjectInterface) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) SharedObjects(org.pentaho.di.shared.SharedObjects)

Aggregations

SharedObjects (org.pentaho.di.shared.SharedObjects)25 KettleException (org.pentaho.di.core.exception.KettleException)13 DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)10 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)8 KettleFileException (org.pentaho.di.core.exception.KettleFileException)6 KettleValueException (org.pentaho.di.core.exception.KettleValueException)6 KettleRepositoryLostException (org.pentaho.di.repository.KettleRepositoryLostException)6 MetaStoreException (org.pentaho.metastore.api.exceptions.MetaStoreException)6 MalformedURLException (java.net.MalformedURLException)5 FileSystemException (org.apache.commons.vfs2.FileSystemException)5 SWTException (org.eclipse.swt.SWTException)5 KettleAuthException (org.pentaho.di.core.exception.KettleAuthException)5 KettleMissingPluginsException (org.pentaho.di.core.exception.KettleMissingPluginsException)5 KettleRowException (org.pentaho.di.core.exception.KettleRowException)5 KettleXMLException (org.pentaho.di.core.exception.KettleXMLException)5 LifecycleException (org.pentaho.di.core.lifecycle.LifecycleException)5 JobMeta (org.pentaho.di.job.JobMeta)5 TransMeta (org.pentaho.di.trans.TransMeta)5 SlaveServer (org.pentaho.di.cluster.SlaveServer)4 KettleExtensionPoint (org.pentaho.di.core.extension.KettleExtensionPoint)4