Also if you feel your custom implementation can benefit others, feel free to contribute to Oozie via creating a patch and uploading to a JIRA - https://issues.apache.org/jira/browse/OOZIE
On 7/12/13 11:12 AM, "Robert Kanter" <[email protected]> wrote: >Hi Serega, > >I'm actually working on a tutorial blog post for the Cloudera website on >how to make an EL function. It's not quite done yet, but here's the basic >steps you need to do: > >1) Write the function in a new Java class. There's no interface or class >to inherit from, you just make a new class in whatever package you want >(e.g. my.package.AwesomeELFunctions). For what you want, its signature >would be: > public static int functionName(String stringWithDatetime, String >pattern) >If you want to create more than one function, they can all go in the same >class as well. > >2) Compile your class. You only need Oozie dependencies if you're >function >requires something from Oozie. You can use javac, maven, Eclipse, etc to >compile it. Make sure to create a jar. > >3) (Shut down Oozie and) copy the jar file to >/where/you/deployed/oozie/libext/ and re-run bin/oozie-setup.sh >prepare-war > >4) In oozie-site.xml, set (or add if it doesn't exist) a property like >this: ><property> > <name>oozie.service.ELService.ext.functions.workflow</name> > <value> > functionName=my.package.AwesomeELFunctions#functionName > </value> ></property> >If you have more functions, that property takes a comma separated list of >them. The value on the left side of the equals is the name that you'd use >in a workflow and the value on the right side is the name of your function >in your Java code. For the value on the left side, you can optionally put >a prefix (you may have seen many built-in functions that start with "wf:" >for example). > >5) Start up Oozie. You should now be able to use the functionName custom >EL Function you created! > >I believe this may only make the function available in workflows, but I'm >not sure; if not, there should be a similar property in oozie-site you can >set for coordinators if you need that. > >Once my proper tutorial blog post is posted, I'll add a link to this >thread, but it may be a while. > >- Robert > > > > >On Fri, Jul 12, 2013 at 7:26 AM, Serega Sheypak ><[email protected]>wrote: > >> Hi, I need to create custom EL function. >> It accepts: >> String StringWithDatetime >> String Pattern (to parse Date) >> It returns: >> time in seconds. >> >> Please tell me: >> 1. Where can I find example? >> 2. Where do I have to put implementation of this function? >>
