Search in sources :

Example 91 with SlaveServer

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;
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) PartitionSchema(org.pentaho.di.partition.PartitionSchema) ArrayList(java.util.ArrayList) SlaveServer(org.pentaho.di.cluster.SlaveServer) DatabaseMeta(org.pentaho.di.core.database.DatabaseMeta) RepositoryObjectType(org.pentaho.di.repository.RepositoryObjectType) ArrayList(java.util.ArrayList) List(java.util.List) SharedObjectInterface(org.pentaho.di.shared.SharedObjectInterface) EnumMap(java.util.EnumMap) ClusterSchema(org.pentaho.di.cluster.ClusterSchema)

Example 92 with SlaveServer

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);
                }
            }
        }
    }
}
Also used : SlaveServer(org.pentaho.di.cluster.SlaveServer)

Example 93 with SlaveServer

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));
}
Also used : SlaveServer(org.pentaho.di.cluster.SlaveServer)

Example 94 with SlaveServer

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;
}
Also used : SlaveServer(org.pentaho.di.cluster.SlaveServer) StringObjectId(org.pentaho.di.repository.StringObjectId)

Example 95 with 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());
        }
    }
}
Also used : TreeNode(org.pentaho.di.ui.core.widget.tree.TreeNode) SlaveServer(org.pentaho.di.cluster.SlaveServer)

Aggregations

SlaveServer (org.pentaho.di.cluster.SlaveServer)110 KettleException (org.pentaho.di.core.exception.KettleException)35 DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)32 Test (org.junit.Test)22 ClusterSchema (org.pentaho.di.cluster.ClusterSchema)22 KettleDatabaseException (org.pentaho.di.core.exception.KettleDatabaseException)18 PartitionSchema (org.pentaho.di.partition.PartitionSchema)18 KettleExtensionPoint (org.pentaho.di.core.extension.KettleExtensionPoint)17 JobMeta (org.pentaho.di.job.JobMeta)16 ObjectId (org.pentaho.di.repository.ObjectId)16 StepMeta (org.pentaho.di.trans.step.StepMeta)14 ArrayList (java.util.ArrayList)13 TransMeta (org.pentaho.di.trans.TransMeta)11 Result (org.pentaho.di.core.Result)10 KettleFileException (org.pentaho.di.core.exception.KettleFileException)10 UnknownParamException (org.pentaho.di.core.parameters.UnknownParamException)10 NotePadMeta (org.pentaho.di.core.NotePadMeta)9 Point (org.pentaho.di.core.gui.Point)8 List (java.util.List)7 KettleXMLException (org.pentaho.di.core.exception.KettleXMLException)7