Search in sources :

Example 16 with ResourceEntry

use of org.pentaho.di.resource.ResourceEntry in project pentaho-kettle by pentaho.

the class JobEntryHTTP method getResourceDependencies.

@Override
public List<ResourceReference> getResourceDependencies(JobMeta jobMeta) {
    List<ResourceReference> references = super.getResourceDependencies(jobMeta);
    String realUrl = jobMeta.environmentSubstitute(url);
    ResourceReference reference = new ResourceReference(this);
    reference.getEntries().add(new ResourceEntry(realUrl, ResourceType.URL));
    references.add(reference);
    return references;
}
Also used : ResourceEntry(org.pentaho.di.resource.ResourceEntry) ResourceReference(org.pentaho.di.resource.ResourceReference) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString)

Example 17 with ResourceEntry

use of org.pentaho.di.resource.ResourceEntry in project pentaho-kettle by pentaho.

the class JobEntryMail method getResourceDependencies.

public List<ResourceReference> getResourceDependencies(JobMeta jobMeta) {
    List<ResourceReference> references = super.getResourceDependencies(jobMeta);
    String realServername = jobMeta.environmentSubstitute(server);
    ResourceReference reference = new ResourceReference(this);
    reference.getEntries().add(new ResourceEntry(realServername, ResourceType.SERVER));
    references.add(reference);
    return references;
}
Also used : ResourceEntry(org.pentaho.di.resource.ResourceEntry) ResourceReference(org.pentaho.di.resource.ResourceReference)

Example 18 with ResourceEntry

use of org.pentaho.di.resource.ResourceEntry in project pentaho-kettle by pentaho.

the class JobEntrySSH2GET method getResourceDependencies.

@Override
public List<ResourceReference> getResourceDependencies(JobMeta jobMeta) {
    List<ResourceReference> references = super.getResourceDependencies(jobMeta);
    if (!Utils.isEmpty(serverName)) {
        String realServerName = jobMeta.environmentSubstitute(serverName);
        ResourceReference reference = new ResourceReference(this);
        reference.getEntries().add(new ResourceEntry(realServerName, ResourceType.SERVER));
        references.add(reference);
    }
    return references;
}
Also used : ResourceEntry(org.pentaho.di.resource.ResourceEntry) ResourceReference(org.pentaho.di.resource.ResourceReference)

Example 19 with ResourceEntry

use of org.pentaho.di.resource.ResourceEntry in project pentaho-kettle by pentaho.

the class TransMetaConverter method convert.

public static Transformation convert(TransMeta transMeta) {
    final org.pentaho.di.engine.model.Transformation transformation = new org.pentaho.di.engine.model.Transformation(createTransformationId(transMeta));
    try {
        TransMeta copyTransMeta = (TransMeta) transMeta.realClone(false);
        cleanupDisabledHops(copyTransMeta);
        // Turn off lazy conversion for AEL for now
        disableLazyConversion(copyTransMeta);
        resolveStepMetaResources(copyTransMeta);
        copyTransMeta.getSteps().forEach(createOperation(transformation));
        findHops(copyTransMeta, hop -> true).forEach(createHop(transformation));
        transformation.setConfig(TRANS_META_CONF_KEY, copyTransMeta.getXML());
        transformation.setConfig(TRANS_META_NAME_CONF_KEY, Optional.ofNullable(transMeta.getName()).orElse(TRANS_DEFAULT_NAME));
        Map<String, Transformation> subTransformations = copyTransMeta.getResourceDependencies().stream().flatMap(resourceReference -> resourceReference.getEntries().stream()).filter(entry -> ResourceEntry.ResourceType.ACTIONFILE.equals(entry.getResourcetype())).collect(toMap(ResourceEntry::getResource, entry -> {
            try {
                Repository repository = copyTransMeta.getRepository();
                if (repository != null) {
                    Path path = Paths.get(entry.getResource());
                    RepositoryDirectoryInterface directory = repository.findDirectory(path.getParent().toString().replace(File.separator, "/"));
                    return convert(repository.loadTransformation(path.getFileName().toString(), directory, null, true, null));
                }
                return convert(new TransMeta(entry.getResource(), copyTransMeta.getParentVariableSpace()));
            } catch (KettleException e) {
                throw new RuntimeException(e);
            }
        }));
        transformation.setConfig(SUB_TRANSFORMATIONS_KEY, (Serializable) subTransformations);
    } catch (KettleException e) {
        Throwables.propagate(e);
    }
    return transformation;
}
Also used : IntStream(java.util.stream.IntStream) Transformation(org.pentaho.di.engine.api.model.Transformation) Hop(org.pentaho.di.engine.api.model.Hop) KettleException(org.pentaho.di.core.exception.KettleException) Operation(org.pentaho.di.engine.api.model.Operation) TransMeta(org.pentaho.di.trans.TransMeta) Collectors.toMap(java.util.stream.Collectors.toMap) Map(java.util.Map) CsvInputMeta(org.pentaho.di.trans.steps.csvinput.CsvInputMeta) Path(java.nio.file.Path) RepositoryDirectoryInterface(org.pentaho.di.repository.RepositoryDirectoryInterface) StepMeta(org.pentaho.di.trans.step.StepMeta) StepMetaInterface(org.pentaho.di.trans.step.StepMetaInterface) Predicate(java.util.function.Predicate) Repository(org.pentaho.di.repository.Repository) ResourceEntry(org.pentaho.di.resource.ResourceEntry) Throwables(com.google.common.base.Throwables) Utils(org.pentaho.di.core.util.Utils) Collectors(java.util.stream.Collectors) File(java.io.File) Serializable(java.io.Serializable) Consumer(java.util.function.Consumer) ResolvableResource(org.pentaho.di.workarounds.ResolvableResource) List(java.util.List) TransHopMeta(org.pentaho.di.trans.TransHopMeta) Paths(java.nio.file.Paths) Optional(java.util.Optional) TableInputMeta(org.pentaho.di.trans.steps.tableinput.TableInputMeta) Path(java.nio.file.Path) RepositoryDirectoryInterface(org.pentaho.di.repository.RepositoryDirectoryInterface) KettleException(org.pentaho.di.core.exception.KettleException) Transformation(org.pentaho.di.engine.api.model.Transformation) TransMeta(org.pentaho.di.trans.TransMeta) Repository(org.pentaho.di.repository.Repository)

Example 20 with ResourceEntry

use of org.pentaho.di.resource.ResourceEntry in project pentaho-kettle by pentaho.

the class MappingMeta method getResourceDependencies.

@Override
public List<ResourceReference> getResourceDependencies(TransMeta transMeta, StepMeta stepInfo) {
    List<ResourceReference> references = new ArrayList<ResourceReference>(5);
    String realFilename = transMeta.environmentSubstitute(fileName);
    String realTransname = transMeta.environmentSubstitute(transName);
    ResourceReference reference = new ResourceReference(stepInfo);
    references.add(reference);
    if (!Utils.isEmpty(realFilename)) {
        // Add the filename to the references, including a reference to this step
        // meta data.
        // 
        reference.getEntries().add(new ResourceEntry(realFilename, ResourceType.ACTIONFILE));
    } else if (!Utils.isEmpty(realTransname)) {
        // Add the filename to the references, including a reference to this step
        // meta data.
        // 
        reference.getEntries().add(new ResourceEntry(realTransname, ResourceType.ACTIONFILE));
        references.add(reference);
    }
    return references;
}
Also used : ResourceEntry(org.pentaho.di.resource.ResourceEntry) ArrayList(java.util.ArrayList) ResourceReference(org.pentaho.di.resource.ResourceReference)

Aggregations

ResourceEntry (org.pentaho.di.resource.ResourceEntry)63 ResourceReference (org.pentaho.di.resource.ResourceReference)61 ArrayList (java.util.ArrayList)17 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)4 JobMeta (org.pentaho.di.job.JobMeta)4 Test (org.junit.Test)3 ResultFile (org.pentaho.di.core.ResultFile)2 Job (org.pentaho.di.job.Job)2 IExecutionData (org.pentaho.metaverse.api.model.IExecutionData)2 IExecutionProfile (org.pentaho.metaverse.api.model.IExecutionProfile)2 Throwables (com.google.common.base.Throwables)1 File (java.io.File)1 Serializable (java.io.Serializable)1 Path (java.nio.file.Path)1 Paths (java.nio.file.Paths)1 List (java.util.List)1 Map (java.util.Map)1 Optional (java.util.Optional)1 Consumer (java.util.function.Consumer)1 Predicate (java.util.function.Predicate)1