Search in sources :

Example 26 with ResourceEntry

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

the class SingleThreaderMeta 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)

Example 27 with ResourceEntry

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

the class TextFileInputMeta method getResourceDependencies.

@Override
public List<ResourceReference> getResourceDependencies(TransMeta transMeta, StepMeta stepInfo) {
    List<ResourceReference> references = new ArrayList<ResourceReference>(5);
    ResourceReference reference = new ResourceReference(stepInfo);
    references.add(reference);
    String[] textFiles = getFilePaths(transMeta);
    if (textFiles != null) {
        for (int i = 0; i < textFiles.length; i++) {
            reference.getEntries().add(new ResourceEntry(textFiles[i], ResourceType.FILE));
        }
    }
    return references;
}
Also used : ResourceEntry(org.pentaho.di.resource.ResourceEntry) ArrayList(java.util.ArrayList) ResourceReference(org.pentaho.di.resource.ResourceReference) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString)

Example 28 with ResourceEntry

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

the class TransExecutorMeta 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);
    String realDirectoryPath = transMeta.environmentSubstitute(directoryPath);
    ResourceReference reference = new ResourceReference(stepInfo);
    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.
        // 
        String realTransformation = realDirectoryPath + "/" + transName;
        reference.getEntries().add(new ResourceEntry(realTransformation, 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)

Example 29 with ResourceEntry

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

the class BaseStreamStepMeta method getResourceDependencies.

@Override
public List<ResourceReference> getResourceDependencies(TransMeta transMeta, StepMeta stepInfo) {
    List<ResourceReference> references = new ArrayList<>(5);
    String realFilename = transMeta.environmentSubstitute(transformationPath);
    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, ResourceEntry.ResourceType.ACTIONFILE));
    }
    return references;
}
Also used : ResourceEntry(org.pentaho.di.resource.ResourceEntry) ArrayList(java.util.ArrayList) ResourceReference(org.pentaho.di.resource.ResourceReference)

Example 30 with ResourceEntry

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

the class JobEntryExternalResourceListener method afterExecution.

@Override
public void afterExecution(Job job, JobEntryCopy jobEntryCopy, JobEntryInterface jobEntryInterface, Result result) {
    IExecutionProfile executionProfile = JobLineageHolderMap.getInstance().getLineageHolder(job).getExecutionProfile();
    IExecutionData executionData = executionProfile.getExecutionData();
    // Get input files (aka Resource Dependencies)
    JobMeta jobMeta = job.getJobMeta();
    if (jobMeta != null) {
        List<ResourceReference> dependencies = jobEntryInterface.getResourceDependencies(jobMeta);
        if (dependencies != null) {
            for (ResourceReference ref : dependencies) {
                List<ResourceEntry> resourceEntries = ref.getEntries();
                if (resourceEntries != null) {
                    for (ResourceEntry entry : resourceEntries) {
                        executionData.addExternalResource(jobEntryInterface.getName(), ExternalResourceInfoFactory.createResource(entry, true));
                    }
                }
            }
        }
    }
    // Get output files (aka result files)
    if (result != null) {
        List<ResultFile> resultFiles = result.getResultFilesList();
        if (resultFiles != null) {
            for (ResultFile resultFile : resultFiles) {
                executionData.addExternalResource(jobEntryInterface.getName(), ExternalResourceInfoFactory.createFileResource(resultFile.getFile(), false));
            }
        }
    }
}
Also used : IExecutionData(org.pentaho.metaverse.api.model.IExecutionData) JobMeta(org.pentaho.di.job.JobMeta) ResourceEntry(org.pentaho.di.resource.ResourceEntry) IExecutionProfile(org.pentaho.metaverse.api.model.IExecutionProfile) ResourceReference(org.pentaho.di.resource.ResourceReference) ResultFile(org.pentaho.di.core.ResultFile)

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