Hi eduardo,
You have to add the similar thing in three other properties. Please search for 
"formatTime" in ooze-default.xml. Coordinator EL functions are evaluated in 
different contexts (multiple phases). Other cases, it called "*echo" method 
such as "coord_formatTime_echo". For example, during job submission value 
nominalTime is not defined.

<name>oozie.service.ELService.ext.functions.coord-action-create</name>

and

oozie.service.ELService.ext.functions.coord-action-create-inst


oozie.service.ELService.ext.functions.coord-action-start



Regards,
Mohammad

________________________________
 From: Eduardo Afonso Ferreira <[email protected]>
To: "[email protected]" <[email protected]> 
Sent: Thursday, November 15, 2012 1:10 PM
Subject: Re: Creating/implementing custom EL Functions.
 
Hey,

I'm trying to do some date manipulation via custom EL functions.
I added a function coord:formatTimeTZ() very similar to the original 
coord:formatTime() but the new one will take an offset and optionally a 
timezone.
Here's an example of usage (below).
The problem I see now is when I use only the original coord functions, all 
functions are called and processed fine, but when I use my new function 
(formatTimeTZ), the attribute coord:nominalTime() is not called, but it simply 
passes the string "coord:nominalTime()" to the function.
Did I miss anything?

<property>
    <name>START_ROW_DT</name>
    <value>${coord:dateOffset(coord:nominalTime(), -FREQUENCY-OFFSET, 
'MINUTE')}</value>
</property>
<property>
    <name>START_ROW_FORM_1</name>
    <value>${coord:formatTime(coord:dateOffset(coord:nominalTime(), 
-FREQUENCY-OFFSET, 'MINUTE'), "'min-'yyyyMMddHHmm")}</value>
</property>
<property>
    <name>START_ROW_FORM_2</name>
    <value>${coord:formatTimeTZ(coord:nominalTime(), -FREQUENCY-OFFSET, 
"'min-'yyyyMMddHHmm")}</value>
</property>


NOTE: Here's what I added to oozie-site.xml to define the new function. I also 
added my new jar to oozie.war with oozie setup.

    <property>
        <name>oozie.service.ELService.ext.functions.coord-job-submit-data</name>
        <value>
            coord:formatTimeTZ=com.turner.util.Utils#formatTimeTZ
        </value>
        <description>
            EL functions declarations, separated by commas, format is 
[PREFIX:]NAME=CLASS#METHOD.
        </description>
    </property>





________________________________
From: Harsh J <[email protected]>
To: [email protected]; Eduardo Afonso Ferreira <[email protected]> 
Sent: Wednesday, November 14, 2012 3:10 PM
Subject: Re: Creating/implementing custom EL Functions.

Hey Eduardo,

There is lack of docs in this area but you can certainly plug in
custom EL functions and give them aliases.

Look at all the configs prefixed
"oozie.service.ELService.ext.functions" in
http://oozie.apache.org/docs/3.2.0-incubating/oozie-default.xml. You
can create your own function that way by mapping a name to a class
plus method call. The class needs to be in the Oozie deployed WAR
though, so this isn't a dynamic thing. See the examples around these
config entries in the link for the inbuilt definitions we carry.

I'd also strongly recommend contributing back nifty EL extensions, so
that its not a maintenance pain in the long run for you guys - and
others can use it as well :)

On Thu, Nov 15, 2012 at 12:58 AM, Eduardo Afonso Ferreira
<[email protected]> wrote:
> Hey,
>
> Is it possible to implement custom EL Functions without having to change 
> Oozie source code?
> I did not find documentation about how to implement custom EL Functions.
> Would someone throw some links my way about where I can find information on 
> this?
>
> Thank you.
> Eduardo.



-- 
Harsh J

Reply via email to