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;
}
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;
}
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);
}
}
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;
}
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;
}
Aggregations