PDA

View Full Version : Job Entry plugin.



kettle_wconroy
04-04-2006, 08:23 AM
I am trying to create a job entry plugin and it is not working. I can see it show up in the tree, but when i try to drop it onto the the editor, it just wont let me. is there an example of this somewhere?


I am checking out hte code and it seems that this may not be fully supported, though i might just be confused.

MattCasters
04-04-2006, 09:02 AM
Well, a lot of bugs HAVE been fixed with regards to Chef.
Can you try the latest dev code and see if the bug is still there?

Thanks a lot,
Matt

kettle_anonymous
04-20-2006, 10:40 AM
I tried this w/ the latest source, but have the same problem. On line 1855 of Chef.java, there is this code:

int type = JobEntryBase.getType(type_desc);
if (type!=JobEntryInterface.TYPE_JOBENTRY_NONE) {
....do stuff
}
else {
....do nothing
}

The JobEntryBase.getType(type_desc) call will always return JobEntryInterface.TYPE_JOBENTRY_NONE unless it's a predefined job entry.

Does this mean custom job entry plugins won't work?

Thanks!

MattCasters
04-20-2006, 11:04 PM
Like I said before on this forum, the basics are there, but it was never tested.
Up until now nobody seemed to have any use for it. I guess you're the first.

So I guess, propose a code change and send it to me ;-)

Thanks in advance for your understanding,

Kind regards,
Matt

kettle_anonymous
04-25-2006, 06:46 AM
To fix the ability to drag the plugin onto the space, I made the newChefGraphEntry(String type_desc) function in Chef.java work more like it's counterpart in Spoon.java, by using the JobEntryLoader to find the job, instead of using the type integer:

JobEntryLoader jobLoader = JobEntryLoader.getInstance();
JobPlugin jobPlugin = null;

try
{
jobPlugin = jobLoader.findJobEntriesWithDescription(type_desc);

if (jobPlugin!=null)
{
// System.out.println("new job entry of type: "+type+" ["+type_desc+"]");

// Determine name & number for this entry.
String basename = type_desc;
int nr = jobMeta.generateJobEntryNameNr(basename);
String entry_name = basename+" "+nr;

// Generate the appropriate class...
JobEntryInterface jei = jobLoader.getJobEntryClass(jobPlugin);
jei.setName(entry_name);



This leaves the problem of all the places where the code finds the dialog for the job entry....this is less straightforward, since the JobEntryInterface doesn't have a method for getting the dialog, like the spoon plugin interface does. Adding that method would fix it, but require changing all the native job entry types by adding that method, which I'd rather avoid...

MattCasters
04-25-2006, 07:01 AM
This leaves the problem of all the places where the code finds the dialog for the job entry....this is less straightforward, since the JobEntryInterface doesn't have a method for getting the dialog, like the spoon plugin interface does. Adding that method would fix it, but require changing all the native job entry types by adding that method, which I'd rather avoid...




Actually, there are not that many job entries at the moment (11) so that work is not that big. If it has to be done, it has to be done.

The alternative would be to change the way of doing things and specify the classname of the dialog in plugin.xml as well.



Thoughts?




Matt

kettle_anonymous
04-25-2006, 07:40 AM
I think adding that method to the interface would be cleanest, since it would be consistent w/ how the Spoon plugins work.

To get things working, I created a new interface for plugin job entries:

public interface JobEntryInterfacePlugin extends JobEntryInterface {
public JobEntryDialogInterface getDialog(Shell shell,JobEntryInterface jei,JobMeta jobMeta,String jobName);
}

Then, added this to the newJobEntryDialog method of JobEntryBase.java :

if (jei instanceof JobEntryInterfacePlugin)
return ((JobEntryInterfacePlugin)jei).getDialog(parent,jei,jobinfo,"");

This works w/out changing the native plugins, but definitely isn't as clean.

MattCasters
04-25-2006, 07:46 AM
I wonder whether or not we could get rid of the dialog specification at all by using reflection...
Mmmm.

Hey, do you need write access to the SVN repository? Send me some info on yourself (IM id's, time zone, e-mail, etc) and I'll add you to the team. Maybe that works a bit easier ;-)

Cheers,

Matt

ronnyroeller
05-27-2008, 06:45 AM
I stumbled over the same issue. It's very easy to write your own steps, annotate them, and use them. But creating your own job is basically not possible via annotation (PDI-511).

Are there any news on that?

Is it recommended to write own jobs (or better just create transformation)? What's today best practice to create custom jobs?

MattCasters
05-27-2008, 07:02 AM
This was a 2-year old thread. I'm not so sure it was still relevant Ronny.

MattCasters
05-27-2008, 07:03 AM
Job entry plugins with annotations "should" work in 3.1.0.

ronnyroeller
05-27-2008, 07:26 AM
Matt, I still don't understand how I can add a new JobEntry without extending the enum JobEntryType, i.e. without changing the Kettle source code.

If I just re-use an existing JobEntryType value (e.g. JobEntryType.EVAL) I can see and use my new JobEntry. But when loading my job from XML I get this error:
"No valid step/plugin specified (jobPlugin=null) for null"

So I guess I've to define somehow a unique type for my JobEntry.

Any idea how to do that?


I tested it on Trunk, rev. 7990.

ronnyroeller
05-29-2008, 03:48 PM
I just saw that ticket PDI-511 (which mentioned the enum extension issue) was closed as a duplicate of PDI-302 (which mentioned the problem at least not explicit). PDI-302 is now closed as well as fixed.
I may oversee something but in my opinion PDI-511 should be reopened since it's key point was not fixed as part of PDI-302.

MattCasters
05-29-2008, 04:00 PM
You're from Amsterdam for crying out loud, you can do as you please!

;-)

Matt

ronnyroeller
05-30-2008, 07:04 AM
I'd like to but I'm not allow to re-open Jira tickets.

I see, still some lessons to learn to become Dutch ;)

MattCasters
05-30-2008, 07:16 AM
Mmm, thanks for letting me know this.
It used to be possible for people to re-open JIRA cases.


I see, still some lessons to learn to become Dutch ;)


I read that over 60% of the people in The Netherlands are for Flanders (re-) joining the country.
As such, who know, it might be a reality someday. :-)

I'll re-open the JIRA case for the time being

Matt