Hitachi Vantara Pentaho Community Forums
Results 1 to 6 of 6

Thread: JobEntryTrans API

  1. #1
    Join Date
    Oct 2007
    Posts
    4

    Default JobEntryTrans API

    In the JobEntryTrans API, I see that you can get/set the transformation filename. But i do not see a way of getting/setting the TransMeta object. Is there a way to get access to this object?


    -Nelson

  2. #2
    Join Date
    Nov 1999
    Posts
    9,729

    Default

    Hi Nelson,

    The TransMeta object is only available during execute().
    Why do you need it?

    Matt

  3. #3
    Join Date
    Oct 2007
    Posts
    4

    Default

    I manipulate the StepMetas and DatabaseMetas within the TransMeta object before running the transformation. And so far, with the provided API, it works great!

    But now I want to run some transformations within a Job but do not have access to the TransMeta objects .....

    What I'm trying do is setup a "template" Job where I can set which transformations are to be run.



    -Nelson

  4. #4
    Join Date
    Nov 1999
    Posts
    9,729

    Default

    At which point do you want to apply these metadata changes?
    Is it right before the transformation executes or before the job executes?

    We have been doing exercises (in the background in version 3.0) where we package complete jobs into a single zip file containing all the XML that is needed to run.
    You could possibly use that API to get the XML of all the sub-jobs and transformations that are needed in a job.
    Look at the JobEntryInterface:

    Code:
        /**
         * Get a list of all the resource dependencies that the step is depending on.
         * 
         * @return a list of all the resource dependencies that the step is depending on
         */
        public List<ResourceReference> getResourceDependencies(JobMeta jobMeta);
    
        /**
         * Exports the object to a flat-file system, adding content with filename keys to a set of definitions.
         * The supplied resource naming interface allows the object to name appropriately without worrying about those parts of the implementation specific details.
         *  
         * @param space The variable space to resolve (environment) variables with.
         * @param definitions The map containing the filenames and content
         * @param resourceNamingInterface The resource naming interface allows the object to name appropriately
         * @return The filename for this object. (also contained in the definitions map)
         * @throws KettleException in case something goes wrong during the export
         */
        public String exportResources(VariableSpace space, Map<String, ResourceDefinition> definitions, ResourceNamingInterface namingInterface) throws KettleException;
    So what you can do is load all the transformations from the exported resources, change the metadata and put it back.
    Then put it all in a zip file. Make sure to use relative paths, for example using internal variables ${Internal.Transformation.Filename.Directory} and ${Internal.Job.Filename.Directory}

    HTH,
    Matt

  5. #5
    Join Date
    Oct 2007
    Posts
    4

    Default

    I would like to make changes to all the TransMeta objects, plug them into the JobEntyTrans objects, and then just run the Job.

    So it sounds like it can't be done. You suggestion involving the xml and zip file doesn't sound too nice ...

    It's no biggie. I can work around it but it definitely would be nice to have!

    Thanks!

    -Nelson

  6. #6
    Join Date
    Nov 1999
    Posts
    9,729

    Default

    Well, since you wrote that code, you'll have to figure it out I guess ;-)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.