Search in sources :

Example 1 with EmbeddedMetaStore

use of org.pentaho.di.core.attributes.metastore.EmbeddedMetaStore in project pentaho-kettle by pentaho.

the class RunConfigurationSaveExtensionPoint method callExtensionPoint.

@Override
public void callExtensionPoint(LogChannelInterface logChannelInterface, Object o) throws KettleException {
    JobMeta jobMeta = (JobMeta) ((Object[]) o)[0];
    final EmbeddedMetaStore embeddedMetaStore = jobMeta.getEmbeddedMetaStore();
    RunConfigurationManager embeddedRunConfigurationManager = EmbeddedRunConfigurationManager.build(embeddedMetaStore);
    embeddedRunConfigurationManager.deleteAll();
    List<String> runConfigurationNames = new ArrayList<>();
    boolean embedAll = false;
    for (JobEntryCopy jobEntryCopy : jobMeta.getJobCopies()) {
        if (jobEntryCopy.getEntry() instanceof JobEntryRunConfigurableInterface) {
            String usedConfiguration = ((JobEntryRunConfigurableInterface) jobEntryCopy.getEntry()).getRunConfiguration();
            embedAll = embedAll || StringUtil.isVariable(usedConfiguration);
            if (!Utils.isEmpty(usedConfiguration) && !runConfigurationNames.contains(usedConfiguration)) {
                runConfigurationNames.add(usedConfiguration);
            }
        }
    }
    if (embedAll) {
        embedAllRunConfigurations(embeddedRunConfigurationManager);
    } else {
        embedRunConfigurations(embeddedRunConfigurationManager, runConfigurationNames);
    }
}
Also used : JobMeta(org.pentaho.di.job.JobMeta) JobEntryCopy(org.pentaho.di.job.entry.JobEntryCopy) RunConfigurationManager(org.pentaho.di.engine.configuration.impl.RunConfigurationManager) EmbeddedRunConfigurationManager(org.pentaho.di.engine.configuration.impl.EmbeddedRunConfigurationManager) ArrayList(java.util.ArrayList) JobEntryRunConfigurableInterface(org.pentaho.di.job.entry.JobEntryRunConfigurableInterface) EmbeddedMetaStore(org.pentaho.di.core.attributes.metastore.EmbeddedMetaStore)

Example 2 with EmbeddedMetaStore

use of org.pentaho.di.core.attributes.metastore.EmbeddedMetaStore in project pentaho-kettle by pentaho.

the class RunConfigurationInjectExtensionPoint method callExtensionPoint.

@Override
public void callExtensionPoint(LogChannelInterface log, Object object) throws KettleException {
    if (!(object instanceof JobExecutionExtension)) {
        return;
    }
    JobExecutionExtension extension = (JobExecutionExtension) object;
    Job job = extension.job;
    JobMeta jobMeta = job.getJobMeta();
    final EmbeddedMetaStore embeddedMetaStore = jobMeta.getEmbeddedMetaStore();
    RunConfigurationManager embeddedRunConfigurationManager = EmbeddedRunConfigurationManager.build(embeddedMetaStore);
    // will load and save to meta all run configurations
    for (JobEntryTrans trans : job.getActiveJobEntryTransformations().values()) {
        RunConfiguration loadedRunConfiguration = runConfigurationManager.load(jobMeta.environmentSubstitute(trans.getRunConfiguration()));
        embeddedRunConfigurationManager.save(loadedRunConfiguration);
    }
    for (JobEntryJob subJob : job.getActiveJobEntryJobs().values()) {
        RunConfiguration loadedRunConfiguration = runConfigurationManager.load(jobMeta.environmentSubstitute(subJob.getRunConfiguration()));
        embeddedRunConfigurationManager.save(loadedRunConfiguration);
    }
}
Also used : JobExecutionExtension(org.pentaho.di.job.JobExecutionExtension) JobMeta(org.pentaho.di.job.JobMeta) RunConfiguration(org.pentaho.di.engine.configuration.api.RunConfiguration) RunConfigurationManager(org.pentaho.di.engine.configuration.impl.RunConfigurationManager) EmbeddedRunConfigurationManager(org.pentaho.di.engine.configuration.impl.EmbeddedRunConfigurationManager) JobEntryTrans(org.pentaho.di.job.entries.trans.JobEntryTrans) JobEntryJob(org.pentaho.di.job.entries.job.JobEntryJob) Job(org.pentaho.di.job.Job) EmbeddedMetaStore(org.pentaho.di.core.attributes.metastore.EmbeddedMetaStore) JobEntryJob(org.pentaho.di.job.entries.job.JobEntryJob)

Example 3 with EmbeddedMetaStore

use of org.pentaho.di.core.attributes.metastore.EmbeddedMetaStore in project pentaho-kettle by pentaho.

the class RunConfigurationImportExtensionPoint method callExtensionPoint.

@Override
public void callExtensionPoint(LogChannelInterface logChannelInterface, Object o) throws KettleException {
    AbstractMeta abstractMeta = (AbstractMeta) o;
    final EmbeddedMetaStore embeddedMetaStore = abstractMeta.getEmbeddedMetaStore();
    RunConfigurationManager embeddedRunConfigurationManager = EmbeddedRunConfigurationManager.build(embeddedMetaStore);
    List<RunConfiguration> runConfigurationList = embeddedRunConfigurationManager.load();
    List<String> runConfigurationNames = runConfigurationList.stream().map(RunConfiguration::getName).collect(Collectors.toList());
    runConfigurationNames.addAll(runConfigurationManager.getNames());
    runConfigurationList.addAll(createSlaveServerRunConfigurations(runConfigurationNames, abstractMeta));
    for (RunConfiguration runConfiguration : runConfigurationList) {
        if (!runConfiguration.getName().equals(DefaultRunConfigurationProvider.DEFAULT_CONFIG_NAME)) {
            runConfigurationManager.save(runConfiguration);
        }
    }
}
Also used : RunConfiguration(org.pentaho.di.engine.configuration.api.RunConfiguration) DefaultRunConfiguration(org.pentaho.di.engine.configuration.impl.pentaho.DefaultRunConfiguration) RunConfigurationManager(org.pentaho.di.engine.configuration.impl.RunConfigurationManager) EmbeddedRunConfigurationManager(org.pentaho.di.engine.configuration.impl.EmbeddedRunConfigurationManager) AbstractMeta(org.pentaho.di.base.AbstractMeta) EmbeddedMetaStore(org.pentaho.di.core.attributes.metastore.EmbeddedMetaStore)

Example 4 with EmbeddedMetaStore

use of org.pentaho.di.core.attributes.metastore.EmbeddedMetaStore in project pentaho-kettle by pentaho.

the class RunConfigurationRunExtensionPoint method callExtensionPoint.

@Override
public void callExtensionPoint(LogChannelInterface logChannelInterface, Object o) throws KettleException {
    ExecutionConfiguration executionConfiguration = (ExecutionConfiguration) ((Object[]) o)[0];
    AbstractMeta meta = (AbstractMeta) ((Object[]) o)[1];
    VariableSpace variableSpace = (VariableSpace) ((Object[]) o)[2];
    Repository repository = (Repository) ((Object[]) o)[3];
    EmbeddedMetaStore embeddedMetaStore = meta.getEmbeddedMetaStore();
    RunConfiguration runConfiguration = runConfigurationManager.load(executionConfiguration.getRunConfiguration());
    if (runConfiguration == null) {
        RunConfigurationManager embeddedRunConfigurationManager = EmbeddedRunConfigurationManager.build(embeddedMetaStore);
        runConfiguration = embeddedRunConfigurationManager.load(executionConfiguration.getRunConfiguration());
    }
    if (runConfiguration != null) {
        RunConfigurationExecutor runConfigurationExecutor = runConfigurationManager.getExecutor(runConfiguration.getType());
        if (runConfigurationExecutor != null) {
            runConfigurationExecutor.execute(runConfiguration, executionConfiguration, meta, variableSpace, repository);
        }
    } else {
        String name = "";
        if (variableSpace instanceof TransMeta) {
            name = ((TransMeta) variableSpace).getFilename();
        }
        throw new KettleException(BaseMessages.getString(PKG, "RunConfigurationRunExtensionPoint.ConfigNotFound.Error", name, executionConfiguration.getRunConfiguration(), "{0}"));
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) Repository(org.pentaho.di.repository.Repository) RunConfiguration(org.pentaho.di.engine.configuration.api.RunConfiguration) VariableSpace(org.pentaho.di.core.variables.VariableSpace) RunConfigurationManager(org.pentaho.di.engine.configuration.impl.RunConfigurationManager) EmbeddedRunConfigurationManager(org.pentaho.di.engine.configuration.impl.EmbeddedRunConfigurationManager) AbstractMeta(org.pentaho.di.base.AbstractMeta) TransMeta(org.pentaho.di.trans.TransMeta) ExecutionConfiguration(org.pentaho.di.ExecutionConfiguration) RunConfigurationExecutor(org.pentaho.di.engine.configuration.api.RunConfigurationExecutor) EmbeddedMetaStore(org.pentaho.di.core.attributes.metastore.EmbeddedMetaStore)

Aggregations

EmbeddedMetaStore (org.pentaho.di.core.attributes.metastore.EmbeddedMetaStore)4 EmbeddedRunConfigurationManager (org.pentaho.di.engine.configuration.impl.EmbeddedRunConfigurationManager)4 RunConfigurationManager (org.pentaho.di.engine.configuration.impl.RunConfigurationManager)4 RunConfiguration (org.pentaho.di.engine.configuration.api.RunConfiguration)3 AbstractMeta (org.pentaho.di.base.AbstractMeta)2 JobMeta (org.pentaho.di.job.JobMeta)2 ArrayList (java.util.ArrayList)1 ExecutionConfiguration (org.pentaho.di.ExecutionConfiguration)1 KettleException (org.pentaho.di.core.exception.KettleException)1 VariableSpace (org.pentaho.di.core.variables.VariableSpace)1 RunConfigurationExecutor (org.pentaho.di.engine.configuration.api.RunConfigurationExecutor)1 DefaultRunConfiguration (org.pentaho.di.engine.configuration.impl.pentaho.DefaultRunConfiguration)1 Job (org.pentaho.di.job.Job)1 JobExecutionExtension (org.pentaho.di.job.JobExecutionExtension)1 JobEntryJob (org.pentaho.di.job.entries.job.JobEntryJob)1 JobEntryTrans (org.pentaho.di.job.entries.trans.JobEntryTrans)1 JobEntryCopy (org.pentaho.di.job.entry.JobEntryCopy)1 JobEntryRunConfigurableInterface (org.pentaho.di.job.entry.JobEntryRunConfigurableInterface)1 Repository (org.pentaho.di.repository.Repository)1 TransMeta (org.pentaho.di.trans.TransMeta)1