use of org.pentaho.di.cluster.SlaveServer in project pentaho-kettle by pentaho.
the class PurRepository method deepCopy.
private Map<RepositoryObjectType, List<? extends SharedObjectInterface>> deepCopy(Map<RepositoryObjectType, List<? extends SharedObjectInterface>> orig) throws KettleException {
Map<RepositoryObjectType, List<? extends SharedObjectInterface>> copy = new EnumMap<RepositoryObjectType, List<? extends SharedObjectInterface>>(RepositoryObjectType.class);
sharedObjectsLock.writeLock().lock();
try {
for (Entry<RepositoryObjectType, List<? extends SharedObjectInterface>> entry : orig.entrySet()) {
RepositoryObjectType type = entry.getKey();
List<? extends SharedObjectInterface> value = entry.getValue();
List<SharedObjectInterface> newValue = new ArrayList<SharedObjectInterface>(value.size());
for (SharedObjectInterface obj : value) {
SharedObjectInterface newValueItem;
if (obj instanceof DatabaseMeta) {
DatabaseMeta databaseMeta = (DatabaseMeta) ((DatabaseMeta) obj).clone();
databaseMeta.setObjectId(((DatabaseMeta) obj).getObjectId());
databaseMeta.setChangedDate(obj.getChangedDate());
databaseMeta.clearChanged();
newValueItem = databaseMeta;
} else if (obj instanceof SlaveServer) {
SlaveServer slaveServer = (SlaveServer) ((SlaveServer) obj).clone();
slaveServer.setObjectId(((SlaveServer) obj).getObjectId());
slaveServer.clearChanged();
newValueItem = slaveServer;
} else if (obj instanceof PartitionSchema) {
PartitionSchema partitionSchema = (PartitionSchema) ((PartitionSchema) obj).clone();
partitionSchema.setObjectId(((PartitionSchema) obj).getObjectId());
partitionSchema.clearChanged();
newValueItem = partitionSchema;
} else if (obj instanceof ClusterSchema) {
ClusterSchema clusterSchema = ((ClusterSchema) obj).clone();
clusterSchema.setObjectId(((ClusterSchema) obj).getObjectId());
clusterSchema.clearChanged();
newValueItem = clusterSchema;
} else {
throw new KettleException("unknown shared object class");
}
newValue.add(newValueItem);
}
copy.put(type, newValue);
}
} finally {
sharedObjectsLock.writeLock().unlock();
}
return copy;
}
use of org.pentaho.di.cluster.SlaveServer in project pentaho-kettle by pentaho.
the class TransDelegate method readSlaves.
/**
* Add the slave servers in the repository to this transformation if they are not yet present.
*
* @param TransMeta
* The transformation to load into.
* @param overWriteShared
* if an object with the same name exists, overwrite
*/
protected void readSlaves(TransMeta transMeta, boolean overWriteShared, List<SlaveServer> slaveServers) {
for (SlaveServer slaveServer : slaveServers) {
if (overWriteShared || transMeta.findSlaveServer(slaveServer.getName()) == null) {
if (!Utils.isEmpty(slaveServer.getName())) {
slaveServer.shareVariablesWith(transMeta);
transMeta.addOrReplaceSlaveServer(slaveServer);
if (!overWriteShared) {
slaveServer.setChanged(false);
}
}
}
}
}
use of org.pentaho.di.cluster.SlaveServer in project pentaho-kettle by pentaho.
the class SlaveDelegate method dataNodeToElement.
public void dataNodeToElement(DataNode rootNode, RepositoryElementInterface element) throws KettleException {
SlaveServer slaveServer = (SlaveServer) element;
slaveServer.setHostname(getString(rootNode, PROP_HOST_NAME));
slaveServer.setPort(getString(rootNode, PROP_PORT));
slaveServer.setUsername(getString(rootNode, PROP_USERNAME));
slaveServer.setPassword(Encr.decryptPasswordOptionallyEncrypted(getString(rootNode, PROP_PASSWORD)));
slaveServer.setProxyHostname(getString(rootNode, PROP_PROXY_HOST_NAME));
slaveServer.setProxyPort(getString(rootNode, PROP_PROXY_PORT));
slaveServer.setWebAppName(getString(rootNode, PROP_WEBAPP_NAME));
slaveServer.setNonProxyHosts(getString(rootNode, PROP_NON_PROXY_HOSTS));
slaveServer.setMaster(getBoolean(rootNode, PROP_MASTER));
slaveServer.setSslMode(getBoolean(rootNode, PROP_USE_HTTPS_PROTOCOL));
}
use of org.pentaho.di.cluster.SlaveServer in project pentaho-kettle by pentaho.
the class SlaveDelegate method assemble.
public SlaveServer assemble(RepositoryFile file, NodeRepositoryFileData data, VersionSummary version) throws KettleException {
SlaveServer slaveServer = (SlaveServer) dataNodeToElement(data.getNode());
slaveServer.setName(file.getTitle());
slaveServer.setObjectId(new StringObjectId(file.getId().toString()));
slaveServer.setObjectRevision(repo.createObjectRevision(version));
slaveServer.clearChanged();
return slaveServer;
}
use of org.pentaho.di.cluster.SlaveServer in project pentaho-kettle by pentaho.
the class SlavesFolderProvider method refresh.
@Override
public void refresh(AbstractMeta meta, TreeNode treeNode, String filter) {
List<SlaveServer> servers = meta.getSlaveServers();
servers.sort((s1, s2) -> String.CASE_INSENSITIVE_ORDER.compare(s1.getName(), s2.getName()));
for (SlaveServer slaveServer : servers) {
if (!filterMatch(slaveServer.getName(), filter)) {
continue;
}
TreeNode childTreeNode = createTreeNode(treeNode, slaveServer.getName(), guiResource.getImageSlaveTree());
if (slaveServer.isShared()) {
childTreeNode.setFont(guiResource.getFontBold());
}
}
}
Aggregations