use of org.pentaho.di.cluster.SlaveServer in project pdi-platform-plugin by pentaho.
the class KettleSystemListener method startup.
public boolean startup(final IPentahoSession session) {
if (usePlatformLogFile) {
initLogging();
}
hookInDataSourceProvider();
try {
KettleSystemListener.environmentInit(session);
} catch (Throwable t) {
t.printStackTrace();
Logger.error(KettleSystemListener.class.getName(), Messages.getInstance().getErrorString(// $NON-NLS-1$
"KettleSystemListener.ERROR_0001_PLUGIN_LOAD_FAILED"));
}
try {
String slaveServerConfigFilename = "system" + File.separator + "kettle" + File.separator + // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
"slave-server-config.xml";
File slaveServerConfigFile = new File(PentahoSystem.getApplicationContext().getSolutionPath(slaveServerConfigFilename));
if (slaveServerConfigFile.exists()) {
InputStream is = new FileInputStream(slaveServerConfigFile);
DocumentBuilderFactory factory = XMLParserFactoryProducer.createSecureDocBuilderFactory();
Document document = factory.newDocumentBuilder().parse(is);
Node configNode = XMLHandler.getSubNode(document, SlaveServerConfig.XML_TAG);
SlaveServerConfig config = new SlaveServerConfig(new LogChannel("Slave server config"), configNode);
config.setFilename(slaveServerConfigFilename);
SlaveServer slaveServer = new SlaveServer();
config.setSlaveServer(slaveServer);
CarteSingleton.setSlaveServerConfig(config);
}
} catch (Throwable t) {
t.printStackTrace();
Logger.error(KettleSystemListener.class.getName(), t.getMessage());
}
return true;
}
use of org.pentaho.di.cluster.SlaveServer in project pentaho-kettle by pentaho.
the class AbstractMeta method loadSharedObject.
protected boolean loadSharedObject(SharedObjectInterface object) {
if (object instanceof DatabaseMeta) {
DatabaseMeta databaseMeta = (DatabaseMeta) object;
databaseMeta.shareVariablesWith(this);
addOrReplaceDatabase(databaseMeta);
} else if (object instanceof SlaveServer) {
SlaveServer slaveServer = (SlaveServer) object;
slaveServer.shareVariablesWith(this);
addOrReplaceSlaveServer(slaveServer);
} else {
return false;
}
return true;
}
use of org.pentaho.di.cluster.SlaveServer in project pentaho-kettle by pentaho.
the class RepositoryImporter method loadSharedObjects.
/**
* Load the shared objects up front, replace them in the xforms/jobs loaded from XML. We do this for performance
* reasons.
*
* @throws KettleException
*/
protected void loadSharedObjects() throws KettleException {
sharedObjects = new SharedObjects();
for (ObjectId id : rep.getDatabaseIDs(false)) {
DatabaseMeta databaseMeta = rep.loadDatabaseMeta(id, null);
validateImportedElement(importRules, databaseMeta);
sharedObjects.storeObject(databaseMeta);
}
ObjectId[] slaveIDs = rep.getSlaveIDs(false);
List<SlaveServer> slaveServers = new ArrayList<SlaveServer>(slaveIDs.length);
for (ObjectId id : slaveIDs) {
SlaveServer slaveServer = rep.loadSlaveServer(id, null);
validateImportedElement(importRules, slaveServer);
sharedObjects.storeObject(slaveServer);
slaveServers.add(slaveServer);
}
for (ObjectId id : rep.getClusterIDs(false)) {
ClusterSchema clusterSchema = rep.loadClusterSchema(id, slaveServers, null);
validateImportedElement(importRules, clusterSchema);
sharedObjects.storeObject(clusterSchema);
}
for (ObjectId id : rep.getPartitionSchemaIDs(false)) {
PartitionSchema partitionSchema = rep.loadPartitionSchema(id, null);
validateImportedElement(importRules, partitionSchema);
sharedObjects.storeObject(partitionSchema);
}
}
use of org.pentaho.di.cluster.SlaveServer in project pentaho-kettle by pentaho.
the class KettleDatabaseRepository method getSlaveServers.
/**
* @return a list of all the slave servers in the repository.
* @throws KettleException
*/
public List<SlaveServer> getSlaveServers() throws KettleException {
List<SlaveServer> list = new ArrayList<>();
ObjectId[] slaveIDs = getSlaveIDs(false);
for (int i = 0; i < slaveIDs.length; i++) {
// Load last
SlaveServer slaveServer = loadSlaveServer(slaveIDs[i], null);
// version
list.add(slaveServer);
}
return list;
}
use of org.pentaho.di.cluster.SlaveServer in project pentaho-kettle by pentaho.
the class KettleDatabaseRepositoryClusterSchemaDelegate method loadClusterSchema.
public ClusterSchema loadClusterSchema(ObjectId id_cluster_schema, List<SlaveServer> slaveServers) throws KettleException {
ClusterSchema clusterSchema = new ClusterSchema();
RowMetaAndData row = getClusterSchema(id_cluster_schema);
clusterSchema.setObjectId(id_cluster_schema);
clusterSchema.setName(row.getString(KettleDatabaseRepository.FIELD_CLUSTER_NAME, null));
clusterSchema.setBasePort(row.getString(KettleDatabaseRepository.FIELD_CLUSTER_BASE_PORT, null));
clusterSchema.setSocketsBufferSize(row.getString(KettleDatabaseRepository.FIELD_CLUSTER_SOCKETS_BUFFER_SIZE, null));
clusterSchema.setSocketsFlushInterval(row.getString(KettleDatabaseRepository.FIELD_CLUSTER_SOCKETS_FLUSH_INTERVAL, null));
clusterSchema.setSocketsCompressed(row.getBoolean(KettleDatabaseRepository.FIELD_CLUSTER_SOCKETS_COMPRESSED, true));
clusterSchema.setDynamic(row.getBoolean(KettleDatabaseRepository.FIELD_CLUSTER_DYNAMIC, true));
ObjectId[] pids = repository.getClusterSlaveIDs(id_cluster_schema);
for (int i = 0; i < pids.length; i++) {
// Load last version
SlaveServer slaveServer = repository.loadSlaveServer(pids[i], null);
SlaveServer reference = SlaveServer.findSlaveServer(slaveServers, slaveServer.getName());
if (reference != null) {
clusterSchema.getSlaveServers().add(reference);
} else {
clusterSchema.getSlaveServers().add(slaveServer);
}
}
return clusterSchema;
}
Aggregations