Search in sources :

Example 1 with AbstractMeta

use of org.pentaho.di.base.AbstractMeta in project pentaho-kettle by pentaho.

the class ConnectionEndpoints method createConnection.

@PUT
@Path("/connection")
@Consumes({ APPLICATION_JSON })
public Response createConnection(ConnectionDetails connectionDetails, @QueryParam("name") String name) {
    boolean saved = connectionManager.save(connectionDetails);
    if (saved) {
        if (!connectionDetails.getName().equals(name)) {
            connectionManager.delete(name);
        }
        getSpoon().getShell().getDisplay().asyncExec(() -> getSpoon().refreshTree(ConnectionFolderProvider.STRING_VFS_CONNECTIONS));
        EngineMetaInterface engineMetaInterface = getSpoon().getActiveMeta();
        if (engineMetaInterface instanceof AbstractMeta) {
            ((AbstractMeta) engineMetaInterface).setChanged();
        }
        return Response.ok().build();
    } else {
        return Response.serverError().build();
    }
}
Also used : AbstractMeta(org.pentaho.di.base.AbstractMeta) EngineMetaInterface(org.pentaho.di.core.EngineMetaInterface) Path(javax.ws.rs.Path) Consumes(javax.ws.rs.Consumes) PUT(javax.ws.rs.PUT)

Example 2 with AbstractMeta

use of org.pentaho.di.base.AbstractMeta in project pentaho-kettle by pentaho.

the class DefaultRunConfigurationExecutor method setSlaveServer.

private void setSlaveServer(ExecutionConfiguration executionConfiguration, AbstractMeta meta, DefaultRunConfiguration defaultRunConfiguration, VariableSpace variableSpace) throws KettleException {
    SlaveServer slaveServer = meta.findSlaveServer(defaultRunConfiguration.getServer());
    executionConfiguration.setRemoteServer(slaveServer);
    if (slaveServer == null) {
        String filename = "";
        if (variableSpace instanceof AbstractMeta) {
            filename = ((AbstractMeta) variableSpace).getFilename();
        }
        throw new KettleException(BaseMessages.getString(PKG, "DefaultRunConfigurationExecutor.RemoteNotFound.Error", filename, defaultRunConfiguration.getName(), "{0}", defaultRunConfiguration.getServer()));
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) AbstractMeta(org.pentaho.di.base.AbstractMeta) SlaveServer(org.pentaho.di.cluster.SlaveServer)

Example 3 with AbstractMeta

use of org.pentaho.di.base.AbstractMeta in project pentaho-kettle by pentaho.

the class RunConfigurationImportExtensionPoint method createSlaveServerRunConfigurations.

private List<RunConfiguration> createSlaveServerRunConfigurations(List<String> existingConfigurationNames, AbstractMeta abstractMeta) {
    List<RunConfiguration> runConfigurations = new ArrayList<>();
    if (abstractMeta instanceof JobMeta) {
        JobMeta jobMeta = (JobMeta) abstractMeta;
        Map<String, List<JobEntryTrans>> slaveServerGroups = jobMeta.getJobCopies().stream().map(JobEntryCopy::getEntry).filter(entry -> entry instanceof JobEntryTrans).map(entry -> (JobEntryTrans) entry).filter(entry -> Utils.isEmpty(entry.getRunConfiguration())).filter(entry -> !Utils.isEmpty(entry.getRemoteSlaveServerName())).collect(Collectors.groupingBy(JobEntryTrans::getRemoteSlaveServerName));
        slaveServerGroups.forEach((remoteServerName, entries) -> {
            String runConfigurationName = createRunConfigurationName(existingConfigurationNames, remoteServerName);
            DefaultRunConfiguration runConfiguration = createRunConfiguration(runConfigurationName, remoteServerName);
            runConfigurations.add(runConfiguration);
            entries.forEach(e -> e.setRunConfiguration(runConfiguration.getName()));
        });
    }
    return runConfigurations;
}
Also used : RunConfiguration(org.pentaho.di.engine.configuration.api.RunConfiguration) DefaultRunConfiguration(org.pentaho.di.engine.configuration.impl.pentaho.DefaultRunConfiguration) EmbeddedMetaStore(org.pentaho.di.core.attributes.metastore.EmbeddedMetaStore) KettleException(org.pentaho.di.core.exception.KettleException) JobMeta(org.pentaho.di.job.JobMeta) LogChannelInterface(org.pentaho.di.core.logging.LogChannelInterface) Utils(org.pentaho.di.core.util.Utils) AbstractMeta(org.pentaho.di.base.AbstractMeta) Collectors(java.util.stream.Collectors) ArrayList(java.util.ArrayList) RunConfigurationManager(org.pentaho.di.engine.configuration.impl.RunConfigurationManager) List(java.util.List) EmbeddedRunConfigurationManager(org.pentaho.di.engine.configuration.impl.EmbeddedRunConfigurationManager) DefaultRunConfigurationProvider(org.pentaho.di.engine.configuration.impl.pentaho.DefaultRunConfigurationProvider) Map(java.util.Map) Optional(java.util.Optional) VisibleForTesting(com.google.common.annotations.VisibleForTesting) ExtensionPointInterface(org.pentaho.di.core.extension.ExtensionPointInterface) JobEntryTrans(org.pentaho.di.job.entries.trans.JobEntryTrans) JobEntryCopy(org.pentaho.di.job.entry.JobEntryCopy) Comparator(java.util.Comparator) ExtensionPoint(org.pentaho.di.core.extension.ExtensionPoint) JobMeta(org.pentaho.di.job.JobMeta) RunConfiguration(org.pentaho.di.engine.configuration.api.RunConfiguration) DefaultRunConfiguration(org.pentaho.di.engine.configuration.impl.pentaho.DefaultRunConfiguration) JobEntryTrans(org.pentaho.di.job.entries.trans.JobEntryTrans) ArrayList(java.util.ArrayList) DefaultRunConfiguration(org.pentaho.di.engine.configuration.impl.pentaho.DefaultRunConfiguration) ArrayList(java.util.ArrayList) List(java.util.List)

Example 4 with AbstractMeta

use of org.pentaho.di.base.AbstractMeta in project pentaho-kettle by pentaho.

the class PurRepository_MoveAndRename_IT method rename_FailsIfANameConflictOccurs.

private void rename_FailsIfANameConflictOccurs(Assistant assistant) throws Exception {
    final String name = "rename_FailsIfANameConflictOccurs";
    AbstractMeta meta = assistant.createNew();
    assistant.save(meta, name, getPublicDir());
    assistant.rename(meta, name);
}
Also used : AbstractMeta(org.pentaho.di.base.AbstractMeta)

Example 5 with AbstractMeta

use of org.pentaho.di.base.AbstractMeta in project pentaho-kettle by pentaho.

the class PurRepository_MoveAndRename_IT method moveAndRename_Successfully.

private void moveAndRename_Successfully(Assistant assistant) throws Exception {
    final String fileName = "moveAndRename_Successfully";
    final String renamed = fileName + "_renamed";
    AbstractMeta meta = assistant.createNew();
    assistant.save(meta, fileName, getPublicDir());
    RepositoryDirectoryInterface destFolder = getDirInsidePublic(fileName);
    assertNotNull(destFolder);
    assistant.rename(meta, destFolder, renamed);
}
Also used : RepositoryDirectoryInterface(org.pentaho.di.repository.RepositoryDirectoryInterface) AbstractMeta(org.pentaho.di.base.AbstractMeta)

Aggregations

AbstractMeta (org.pentaho.di.base.AbstractMeta)50 Test (org.junit.Test)18 KettleException (org.pentaho.di.core.exception.KettleException)10 RepositoryDirectoryInterface (org.pentaho.di.repository.RepositoryDirectoryInterface)7 LogChannelInterface (org.pentaho.di.core.logging.LogChannelInterface)6 JobMeta (org.pentaho.di.job.JobMeta)6 TransMeta (org.pentaho.di.trans.TransMeta)6 FileObject (org.apache.commons.vfs2.FileObject)5 ExtensionPointWrapper (org.pentaho.di.ui.core.events.dialog.extension.ExtensionPointWrapper)5 SlaveServer (org.pentaho.di.cluster.SlaveServer)4 EngineMetaInterface (org.pentaho.di.core.EngineMetaInterface)4 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)4 RunConfiguration (org.pentaho.di.engine.configuration.api.RunConfiguration)4 SelectionEvent (org.eclipse.swt.events.SelectionEvent)3 EmbeddedMetaStore (org.pentaho.di.core.attributes.metastore.EmbeddedMetaStore)3 ExtensionPoint (org.pentaho.di.core.extension.ExtensionPoint)3 SimpleLoggingObject (org.pentaho.di.core.logging.SimpleLoggingObject)3 EmbeddedRunConfigurationManager (org.pentaho.di.engine.configuration.impl.EmbeddedRunConfigurationManager)3 RunConfigurationManager (org.pentaho.di.engine.configuration.impl.RunConfigurationManager)3 RepositoryObject (org.pentaho.di.repository.RepositoryObject)3