You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oozie.apache.org by ka...@apache.org on 2012/03/23 08:01:07 UTC

svn commit: r1304210 - in /incubator/oozie/trunk: ./ core/src/main/java/org/apache/oozie/coord/ core/src/main/resources/ core/src/test/java/org/apache/oozie/coord/ core/src/test/resources/

Author: kamrul
Date: Fri Mar 23 07:01:07 2012
New Revision: 1304210

URL: http://svn.apache.org/viewvc?rev=1304210&view=rev
Log:
OOZIE-774 Implement a coord:conf EL function to access configuration properties from Oozie coordinator XML files (Maxime via Mohammad)

Modified:
    incubator/oozie/trunk/core/src/main/java/org/apache/oozie/coord/CoordELFunctions.java
    incubator/oozie/trunk/core/src/main/resources/oozie-default.xml
    incubator/oozie/trunk/core/src/test/java/org/apache/oozie/coord/TestCoordELFunctions.java
    incubator/oozie/trunk/core/src/test/resources/coord-action-get.xml
    incubator/oozie/trunk/release-log.txt

Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/coord/CoordELFunctions.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/coord/CoordELFunctions.java?rev=1304210&r1=1304209&r2=1304210&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/coord/CoordELFunctions.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/coord/CoordELFunctions.java Fri Mar 23 07:01:07 2012
@@ -1049,6 +1049,17 @@ public class CoordELFunctions {
     }
 
     /**
+     * Return a job configuration property for the coordinator.
+     *
+     * @param property property name.
+     * @return the value of the property, <code>null</code> if the property is undefined.
+     */
+    public static String coord_conf(String property) {
+        ELEvaluator eval = ELEvaluator.getCurrent();
+        return (String) eval.getVariable(property);
+    }
+
+    /**
      * Return the user that submitted the coordinator job.
      *
      * @return the user that submitted the coordinator job.

Modified: incubator/oozie/trunk/core/src/main/resources/oozie-default.xml
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/resources/oozie-default.xml?rev=1304210&r1=1304209&r2=1304210&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/resources/oozie-default.xml (original)
+++ incubator/oozie/trunk/core/src/main/resources/oozie-default.xml Fri Mar 23 07:01:07 2012
@@ -548,6 +548,7 @@
             coord:minutes=org.apache.oozie.coord.CoordELFunctions#ph1_coord_minutes,
             coord:endOfDays=org.apache.oozie.coord.CoordELFunctions#ph1_coord_endOfDays,
             coord:endOfMonths=org.apache.oozie.coord.CoordELFunctions#ph1_coord_endOfMonths,
+            coord:conf=org.apache.oozie.coord.CoordELFunctions#coord_conf,
             coord:user=org.apache.oozie.coord.CoordELFunctions#coord_user
         </value>
         <description>
@@ -593,7 +594,10 @@
 
     <property>
         <name>oozie.service.ELService.functions.coord-job-submit-nofuncs</name>
-        <value>coord:user=org.apache.oozie.coord.CoordELFunctions#coord_user</value>
+        <value>
+            coord:conf=org.apache.oozie.coord.CoordELFunctions#coord_conf,
+            coord:user=org.apache.oozie.coord.CoordELFunctions#coord_user
+        </value>
         <description>
             EL functions declarations, separated by commas, format is [PREFIX:]NAME=CLASS#METHOD.
         </description>
@@ -639,6 +643,7 @@
             coord:latest=org.apache.oozie.coord.CoordELFunctions#ph1_coord_latest_echo,
             coord:future=org.apache.oozie.coord.CoordELFunctions#ph1_coord_future_echo,
             coord:formatTime=org.apache.oozie.coord.CoordELFunctions#ph1_coord_formatTime_echo,
+            coord:conf=org.apache.oozie.coord.CoordELFunctions#coord_conf,
             coord:user=org.apache.oozie.coord.CoordELFunctions#coord_user
         </value>
         <description>
@@ -689,6 +694,7 @@
             coord:formatTime=org.apache.oozie.coord.CoordELFunctions#ph1_coord_formatTime_echo,
             coord:actionId=org.apache.oozie.coord.CoordELFunctions#ph1_coord_actionId_echo,
             coord:name=org.apache.oozie.coord.CoordELFunctions#ph1_coord_name_echo,
+            coord:conf=org.apache.oozie.coord.CoordELFunctions#coord_conf,
             coord:user=org.apache.oozie.coord.CoordELFunctions#coord_user
         </value>
         <description>
@@ -734,6 +740,7 @@
         <name>oozie.service.ELService.functions.coord-sla-submit</name>
         <value>
             coord:nominalTime=org.apache.oozie.coord.CoordELFunctions#ph1_coord_nominalTime_echo_fixed,
+            coord:conf=org.apache.oozie.coord.CoordELFunctions#coord_conf,
             coord:user=org.apache.oozie.coord.CoordELFunctions#coord_user
         </value>
         <description>
@@ -783,6 +790,7 @@
             coord:actionId=org.apache.oozie.coord.CoordELFunctions#ph2_coord_actionId,
             coord:name=org.apache.oozie.coord.CoordELFunctions#ph2_coord_name,
             coord:formatTime=org.apache.oozie.coord.CoordELFunctions#ph2_coord_formatTime,
+            coord:conf=org.apache.oozie.coord.CoordELFunctions#coord_conf,
             coord:user=org.apache.oozie.coord.CoordELFunctions#coord_user
         </value>
         <description>
@@ -832,6 +840,7 @@
             coord:latest=org.apache.oozie.coord.CoordELFunctions#ph2_coord_latest_echo,
             coord:future=org.apache.oozie.coord.CoordELFunctions#ph2_coord_future_echo,
             coord:formatTime=org.apache.oozie.coord.CoordELFunctions#ph2_coord_formatTime,
+            coord:conf=org.apache.oozie.coord.CoordELFunctions#coord_conf,
             coord:user=org.apache.oozie.coord.CoordELFunctions#coord_user
         </value>
         <description>
@@ -876,6 +885,7 @@
         <name>oozie.service.ELService.functions.coord-sla-create</name>
         <value>
             coord:nominalTime=org.apache.oozie.coord.CoordELFunctions#ph2_coord_nominalTime,
+            coord:conf=org.apache.oozie.coord.CoordELFunctions#coord_conf,
             coord:user=org.apache.oozie.coord.CoordELFunctions#coord_user
         </value>
         <description>
@@ -929,6 +939,7 @@
             coord:formatTime=org.apache.oozie.coord.CoordELFunctions#ph3_coord_formatTime,
             coord:actionId=org.apache.oozie.coord.CoordELFunctions#ph3_coord_actionId,
             coord:name=org.apache.oozie.coord.CoordELFunctions#ph3_coord_name,
+            coord:conf=org.apache.oozie.coord.CoordELFunctions#coord_conf,
             coord:user=org.apache.oozie.coord.CoordELFunctions#coord_user
         </value>
         <description>

Modified: incubator/oozie/trunk/core/src/test/java/org/apache/oozie/coord/TestCoordELFunctions.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/test/java/org/apache/oozie/coord/TestCoordELFunctions.java?rev=1304210&r1=1304209&r2=1304210&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/test/java/org/apache/oozie/coord/TestCoordELFunctions.java (original)
+++ incubator/oozie/trunk/core/src/test/java/org/apache/oozie/coord/TestCoordELFunctions.java Fri Mar 23 07:01:07 2012
@@ -815,6 +815,13 @@ public class TestCoordELFunctions extend
         assertEquals("mycoordinator-app", CoordELFunctions.evalAndWrap(eval, expr));
     }
 
+    public void testConf() throws Exception {
+        init("coord-job-submit-freq");
+        eval.setVariable("my.test.variable", "test");
+        String expr = "${coord:conf('my.test.variable')}";
+        assertEquals("test", CoordELFunctions.evalAndWrap(eval, expr));
+    }
+
     public void testUser() throws Exception {
         init("coord-job-submit-freq");
         String expr = "${coord:user()}";

Modified: incubator/oozie/trunk/core/src/test/resources/coord-action-get.xml
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/test/resources/coord-action-get.xml?rev=1304210&r1=1304209&r2=1304210&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/test/resources/coord-action-get.xml (original)
+++ incubator/oozie/trunk/core/src/test/resources/coord-action-get.xml Fri Mar 23 07:01:07 2012
@@ -39,7 +39,7 @@
   </output-events>
   <action>
     <workflow>
-      <app-path>${wfAppPath}</app-path>
+      <app-path>${coord:conf('wfAppPath')}</app-path>
       <configuration>
         <property>
           <name>jobTracker</name>

Modified: incubator/oozie/trunk/release-log.txt
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/release-log.txt?rev=1304210&r1=1304209&r2=1304210&view=diff
==============================================================================
--- incubator/oozie/trunk/release-log.txt (original)
+++ incubator/oozie/trunk/release-log.txt Fri Mar 23 07:01:07 2012
@@ -1,5 +1,6 @@
 -- Oozie 3.2.0 release
 
+OOZIE-774 Implement a coord:conf EL function to access configuration properties from Oozie coordinator XML files (Maxime via Mohammad)
 OOZIE-777 Hadoop 0.23 removed org.apache.hadoop.mapred.Task$Counter group name breaking EL counters() (tucu)
 OOZIE-776 custom-main example job.properties is missing the activation of sharelib (tucu)
 OOZIE-775 sharelibs assembly does not include deps with compile scope (tucu)