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

svn commit: r1372663 [1/3] - in /incubator/oozie/trunk: ./ core/src/main/java/org/apache/oozie/ core/src/main/java/org/apache/oozie/command/bundle/ core/src/main/java/org/apache/oozie/command/coord/ core/src/main/java/org/apache/oozie/coord/ core/src/m...

Author: tucu
Date: Mon Aug 13 23:21:15 2012
New Revision: 1372663

URL: http://svn.apache.org/viewvc?rev=1372663&view=rev
Log:
OOZIE-948 Add support for Oozie coordinator to work in an UTC offset (tucu)

Added:
    incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionInputCheckXCommandNonUTC.java
    incubator/oozie/trunk/core/src/test/java/org/apache/oozie/util/TestDateUtils.java
Modified:
    incubator/oozie/trunk/core/src/main/java/org/apache/oozie/ErrorCode.java
    incubator/oozie/trunk/core/src/main/java/org/apache/oozie/SLAEventBean.java
    incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleJobChangeXCommand.java
    incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleRerunXCommand.java
    incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleSubmitXCommand.java
    incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionInputCheckXCommand.java
    incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordChangeXCommand.java
    incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordCommandUtils.java
    incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordSubmitXCommand.java
    incubator/oozie/trunk/core/src/main/java/org/apache/oozie/coord/CoordELEvaluator.java
    incubator/oozie/trunk/core/src/main/java/org/apache/oozie/coord/CoordELFunctions.java
    incubator/oozie/trunk/core/src/main/java/org/apache/oozie/coord/CoordUtils.java
    incubator/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionForNominalTimeJPAExecutor.java
    incubator/oozie/trunk/core/src/main/java/org/apache/oozie/service/Services.java
    incubator/oozie/trunk/core/src/main/java/org/apache/oozie/service/StatusTransitService.java
    incubator/oozie/trunk/core/src/main/java/org/apache/oozie/store/CoordinatorStore.java
    incubator/oozie/trunk/core/src/main/java/org/apache/oozie/util/CoordActionsInDateRange.java
    incubator/oozie/trunk/core/src/main/java/org/apache/oozie/util/DateUtils.java
    incubator/oozie/trunk/core/src/main/java/org/apache/oozie/util/ELConstantsFunctions.java
    incubator/oozie/trunk/core/src/main/java/org/apache/oozie/util/ParamChecker.java
    incubator/oozie/trunk/core/src/main/java/org/apache/oozie/util/db/SLADbOperations.java
    incubator/oozie/trunk/core/src/main/java/org/apache/oozie/util/db/SLADbXOperations.java
    incubator/oozie/trunk/core/src/main/resources/oozie-default.xml
    incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/bundle/TestBundleChangeXCommand.java
    incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/bundle/TestBundlePurgeXCommand.java
    incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionInputCheckXCommand.java
    incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionMaterializeCommand.java
    incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionStartXCommand.java
    incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordChangeXCommand.java
    incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordMaterializeTransitionXCommand.java
    incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordPurgeXCommand.java
    incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordRerunXCommand.java
    incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/wf/TestPurgeXCommand.java
    incubator/oozie/trunk/core/src/test/java/org/apache/oozie/coord/TestCoordELEvaluator.java
    incubator/oozie/trunk/core/src/test/java/org/apache/oozie/coord/TestCoordELFunctions.java
    incubator/oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestBundleActionsDeleteForPurgeJPAExecutor.java
    incubator/oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestBundleJobDeleteJPAExecutor.java
    incubator/oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestBundleJobsGetForPurgeJPAExecutor.java
    incubator/oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordActionGetForInfoJPAExecutor.java
    incubator/oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordActionGetForInputCheckJPAExecutor.java
    incubator/oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobGetActionForNominalTimeJPAExecutor.java
    incubator/oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobGetActionIdsForDatesJPAExecutor.java
    incubator/oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobGetActionsForDatesJPAExecutor.java
    incubator/oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobGetActionsSubsetJPAExecutor.java
    incubator/oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobsGetForPurgeJPAExecutor.java
    incubator/oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobsToBeMaterializedJPAExecutor.java
    incubator/oozie/trunk/core/src/test/java/org/apache/oozie/service/TestCoordMaterializeTriggerService.java
    incubator/oozie/trunk/core/src/test/java/org/apache/oozie/service/TestPurgeService.java
    incubator/oozie/trunk/core/src/test/java/org/apache/oozie/service/TestRecoveryService.java
    incubator/oozie/trunk/core/src/test/java/org/apache/oozie/service/TestStatusTransitService.java
    incubator/oozie/trunk/core/src/test/java/org/apache/oozie/servlet/MockCoordinatorEngineService.java
    incubator/oozie/trunk/core/src/test/java/org/apache/oozie/test/XDataTestCase.java
    incubator/oozie/trunk/core/src/test/java/org/apache/oozie/util/TestCoordActionsInDateRange.java
    incubator/oozie/trunk/core/src/test/java/org/apache/oozie/util/TestParamChecker.java
    incubator/oozie/trunk/core/src/test/resources/coord-action-for-action-input-check.xml
    incubator/oozie/trunk/docs/src/site/twiki/AG_Install.twiki
    incubator/oozie/trunk/docs/src/site/twiki/CoordinatorFunctionalSpec.twiki
    incubator/oozie/trunk/release-log.txt

Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/ErrorCode.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/ErrorCode.java?rev=1372663&r1=1372662&r2=1372663&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/ErrorCode.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/ErrorCode.java Mon Aug 13 23:21:15 2012
@@ -175,7 +175,7 @@ public enum ErrorCode {
 
     E1001(XLog.STD, "Could not read the coordinator job definition, {0}"),
     E1002(XLog.STD, "Invalid coordinator application URI [{0}], {1}"),
-    E1003(XLog.STD, "Invalid coordinator application attributes [{0}], {1}"),
+    E1003(XLog.STD, "Invalid coordinator application attributes, {0}"),
     E1004(XLog.STD, "Expression language evaluation error [{0}], {1}"),
     E1005(XLog.STD, "Could not read the coordinator job configuration read from DB, {0}"),
     E1006(XLog.STD, "Invalid coordinator application [{0}], {1}"),

Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/SLAEventBean.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/SLAEventBean.java?rev=1372663&r1=1372662&r2=1372663&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/SLAEventBean.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/SLAEventBean.java Mon Aug 13 23:21:15 2012
@@ -293,7 +293,7 @@ public class SLAEventBean extends JsonSL
 
     private String getDateString(Date d) {
         try {
-            return DateUtils.formatDateUTC(d);
+            return DateUtils.formatDateOozieTZ(d);
         }
         catch (Exception e) {
             e.printStackTrace();

Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleJobChangeXCommand.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleJobChangeXCommand.java?rev=1372663&r1=1372662&r2=1372663&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleJobChangeXCommand.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleJobChangeXCommand.java Mon Aug 13 23:21:15 2012
@@ -27,7 +27,6 @@ import org.apache.oozie.BundleActionBean
 import org.apache.oozie.BundleJobBean;
 import org.apache.oozie.ErrorCode;
 import org.apache.oozie.XException;
-import org.apache.oozie.client.CoordinatorJob;
 import org.apache.oozie.client.Job;
 import org.apache.oozie.client.OozieClient;
 import org.apache.oozie.command.CommandException;
@@ -130,7 +129,7 @@ public class BundleJobChangeXCommand ext
             String value = map.get(OozieClient.CHANGE_VALUE_PAUSETIME);
             if (!value.equals(""))   {
                 try {
-                    newPauseTime = DateUtils.parseDateUTC(value);
+                    newPauseTime = DateUtils.parseDateOozieTZ(value);
                 }
                 catch (Exception ex) {
                     throw new CommandException(ErrorCode.E1317, value, "is not a valid date");
@@ -143,7 +142,7 @@ public class BundleJobChangeXCommand ext
             String value = map.get(OozieClient.CHANGE_VALUE_ENDTIME);
             if (!value.equals(""))   {
                 try {
-                    newEndTime = DateUtils.parseDateUTC(value);
+                    newEndTime = DateUtils.parseDateOozieTZ(value);
                 }
                 catch (Exception ex) {
                     throw new CommandException(ErrorCode.E1317, value, "is not a valid date");

Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleRerunXCommand.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleRerunXCommand.java?rev=1372663&r1=1372662&r2=1372663&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleRerunXCommand.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleRerunXCommand.java Mon Aug 13 23:21:15 2012
@@ -139,8 +139,8 @@ public class BundleRerunXCommand extends
                         rerunDateScope = dateScope;
                     }
                     else {
-                        String coordStart = DateUtils.convertDateToString(coordJob.getStartTime());
-                        String coordEnd = DateUtils.convertDateToString(coordJob.getEndTime());
+                        String coordStart = DateUtils.formatDateOozieTZ(coordJob.getStartTime());
+                        String coordEnd = DateUtils.formatDateOozieTZ(coordJob.getEndTime());
                         rerunDateScope = coordStart + "::" + coordEnd;
                     }
                     LOG.debug("Queuing rerun range [" + rerunDateScope + "] for coord id " + coordId + " of bundle "

Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleSubmitXCommand.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleSubmitXCommand.java?rev=1372663&r1=1372662&r2=1372663&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleSubmitXCommand.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleSubmitXCommand.java Mon Aug 13 23:21:15 2012
@@ -50,7 +50,6 @@ import org.apache.oozie.service.JPAServi
 import org.apache.oozie.service.SchemaService;
 import org.apache.oozie.service.Services;
 import org.apache.oozie.service.UUIDService;
-import org.apache.oozie.service.WorkflowAppService;
 import org.apache.oozie.service.SchemaService.SchemaName;
 import org.apache.oozie.service.UUIDService.ApplicationType;
 import org.apache.oozie.util.ConfigUtils;
@@ -419,7 +418,7 @@ public class BundleSubmitXCommand extend
             if (controlsElement != null) {
                 Element kickoffTimeElement = controlsElement.getChild("kick-off-time", jobElement.getNamespace());
                 if (kickoffTimeElement != null && !kickoffTimeElement.getValue().isEmpty()) {
-                    Date kickoffTime = DateUtils.parseDateUTC(kickoffTimeElement.getValue());
+                    Date kickoffTime = DateUtils.parseDateOozieTZ(kickoffTimeElement.getValue());
                     bundleJob.setKickoffTime(kickoffTime);
                 }
             }

Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionInputCheckXCommand.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionInputCheckXCommand.java?rev=1372663&r1=1372662&r2=1372663&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionInputCheckXCommand.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionInputCheckXCommand.java Mon Aug 13 23:21:15 2012
@@ -257,7 +257,7 @@ public class CoordActionInputCheckXComma
     @SuppressWarnings("unchecked")
     private boolean checkUnresolvedInstances(Element eAction, Configuration actionConf) throws Exception {
         String strAction = XmlUtils.prettyPrint(eAction).toString();
-        Date nominalTime = DateUtils.parseDateUTC(eAction.getAttributeValue("action-nominal-time"));
+        Date nominalTime = DateUtils.parseDateOozieTZ(eAction.getAttributeValue("action-nominal-time"));
         String actualTimeStr = eAction.getAttributeValue("action-actual-time");
         Date actualTime = null;
         if (actualTimeStr == null) {
@@ -265,7 +265,7 @@ public class CoordActionInputCheckXComma
             "from previous version. Assign current date to actual time, action = " + actionId);
             actualTime = new Date();
         } else {
-            actualTime = DateUtils.parseDateUTC(actualTimeStr);
+            actualTime = DateUtils.parseDateOozieTZ(actualTimeStr);
         }
 
         StringBuffer resultedXml = new StringBuffer();

Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordChangeXCommand.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordChangeXCommand.java?rev=1372663&r1=1372662&r2=1372663&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordChangeXCommand.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordChangeXCommand.java Mon Aug 13 23:21:15 2012
@@ -110,7 +110,7 @@ public class CoordChangeXCommand extends
         if (map.containsKey(OozieClient.CHANGE_VALUE_ENDTIME)) {
             String value = map.get(OozieClient.CHANGE_VALUE_ENDTIME);
             try {
-                newEndTime = DateUtils.parseDateUTC(value);
+                newEndTime = DateUtils.parseDateOozieTZ(value);
             }
             catch (Exception ex) {
                 throw new CommandException(ErrorCode.E1015, value, "must be a valid date");
@@ -134,7 +134,7 @@ public class CoordChangeXCommand extends
             }
             else {
                 try {
-                    newPauseTime = DateUtils.parseDateUTC(value);
+                    newPauseTime = DateUtils.parseDateOozieTZ(value);
                 }
                 catch (Exception ex) {
                     throw new CommandException(ErrorCode.E1015, value, "must be a valid date");

Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordCommandUtils.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordCommandUtils.java?rev=1372663&r1=1372662&r2=1372663&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordCommandUtils.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordCommandUtils.java Mon Aug 13 23:21:15 2012
@@ -404,8 +404,8 @@ public class CoordCommandUtils {
         eAction.removeAttribute("start");
         eAction.removeAttribute("end");
         eAction.setAttribute("instance-number", Integer.toString(instanceCount));
-        eAction.setAttribute("action-nominal-time", DateUtils.formatDateUTC(nominalTime));
-        eAction.setAttribute("action-actual-time", DateUtils.formatDateUTC(actualTime));
+        eAction.setAttribute("action-nominal-time", DateUtils.formatDateOozieTZ(nominalTime));
+        eAction.setAttribute("action-actual-time", DateUtils.formatDateOozieTZ(actualTime));
 
         boolean isSla = CoordCommandUtils.materializeSLA(eAction.getChild("action", eAction.getNamespace()).getChild(
                 "info", eAction.getNamespace("sla")), nominalTime, conf);

Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordSubmitXCommand.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordSubmitXCommand.java?rev=1372663&r1=1372662&r2=1372663&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordSubmitXCommand.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordSubmitXCommand.java Mon Aug 13 23:21:15 2012
@@ -24,8 +24,6 @@ import java.io.StringReader;
 import java.io.StringWriter;
 import java.net.URI;
 import java.net.URISyntaxException;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
@@ -34,7 +32,6 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.TimeZone;
 import java.util.TreeSet;
 
 import javax.xml.transform.stream.StreamSource;
@@ -66,7 +63,6 @@ import org.apache.oozie.service.SchemaSe
 import org.apache.oozie.service.Service;
 import org.apache.oozie.service.Services;
 import org.apache.oozie.service.UUIDService;
-import org.apache.oozie.service.WorkflowAppService;
 import org.apache.oozie.service.SchemaService.SchemaName;
 import org.apache.oozie.service.UUIDService.ApplicationType;
 import org.apache.oozie.util.ConfigUtils;
@@ -661,12 +657,12 @@ public class CoordSubmitXCommand extends
 
         // start time
         val = resolveAttribute("start", eAppXml, evalNofuncs);
-        ParamChecker.checkUTC(val, "start");
-        coordJob.setStartTime(DateUtils.parseDateUTC(val));
+        ParamChecker.checkDateOozieTZ(val, "start");
+        coordJob.setStartTime(DateUtils.parseDateOozieTZ(val));
         // end time
         val = resolveAttribute("end", eAppXml, evalNofuncs);
-        ParamChecker.checkUTC(val, "end");
-        coordJob.setEndTime(DateUtils.parseDateUTC(val));
+        ParamChecker.checkDateOozieTZ(val, "end");
+        coordJob.setEndTime(DateUtils.parseDateOozieTZ(val));
         // Time zone
         val = resolveAttribute("timezone", eAppXml, evalNofuncs);
         ParamChecker.checkTimeZone(val, "timezone");
@@ -867,7 +863,7 @@ public class CoordSubmitXCommand extends
             addAnAttribute("end_of_duration", dsElem, evalFreq.getVariable("endOfDuration") == null ? TimeUnit.NONE
                     .toString() : ((TimeUnit) evalFreq.getVariable("endOfDuration")).toString());
             val = resolveAttribute("initial-instance", dsElem, evalNofuncs);
-            ParamChecker.checkUTC(val, "initial-instance");
+            ParamChecker.checkDateOozieTZ(val, "initial-instance");
             checkInitialInstance(val);
             val = resolveAttribute("timezone", dsElem, evalNofuncs);
             ParamChecker.checkTimeZone(val, "timezone");
@@ -1119,17 +1115,17 @@ public class CoordSubmitXCommand extends
      */
     private void checkInitialInstance(String val) throws CoordinatorJobException, IllegalArgumentException {
         Date initialInstance, givenInstance;
-        DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'");
-        df.setTimeZone(TimeZone.getTimeZone("UTC"));
         try {
             initialInstance = DateUtils.parseDateUTC("1970-01-01T00:00Z");
-            givenInstance = DateUtils.parseDateUTC(val);
+            givenInstance = DateUtils.parseDateOozieTZ(val);
         }
         catch (Exception e) {
-            throw new IllegalArgumentException("Unable to parse dataset initial-instance string '" + val + "' to Date object. ",e);
+            throw new IllegalArgumentException("Unable to parse dataset initial-instance string '" + val +
+                                               "' to Date object. ",e);
         }
         if(givenInstance.compareTo(initialInstance) < 0) {
-            throw new CoordinatorJobException(ErrorCode.E1021, "Dataset initial-instance " + df.format(givenInstance) + " is earlier than the default initial instance " + df.format(initialInstance));
+            throw new CoordinatorJobException(ErrorCode.E1021, "Dataset initial-instance " + val +
+                    " is earlier than the default initial instance " + DateUtils.formatDateOozieTZ(initialInstance));
         }
     }
 

Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/coord/CoordELEvaluator.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/coord/CoordELEvaluator.java?rev=1372663&r1=1372662&r2=1372663&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/coord/CoordELEvaluator.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/coord/CoordELEvaluator.java Mon Aug 13 23:21:15 2012
@@ -23,7 +23,6 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.TimeZone;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.oozie.service.ELService;
@@ -142,7 +141,7 @@ public class CoordELEvaluator {
         SyncCoordAction appInst = new SyncCoordAction();
         String strNominalTime = eJob.getAttributeValue("action-nominal-time");
         if (strNominalTime != null) {
-            appInst.setNominalTime(DateUtils.parseDateUTC(strNominalTime));
+            appInst.setNominalTime(DateUtils.parseDateOozieTZ(strNominalTime));
             appInst.setTimeZone(DateUtils.getTimeZone(eJob.getAttributeValue("timezone")));
             appInst.setFrequency(Integer.parseInt(eJob.getAttributeValue("frequency")));
             appInst.setTimeUnit(TimeUnit.valueOf(eJob.getAttributeValue("freq_timeunit")));
@@ -151,7 +150,7 @@ public class CoordELEvaluator {
         }
         String strActualTime = eJob.getAttributeValue("action-actual-time");
         if (strActualTime != null) {
-            appInst.setActualTime(DateUtils.parseDateUTC(strActualTime));
+            appInst.setActualTime(DateUtils.parseDateOozieTZ(strActualTime));
         }
         CoordELFunctions.configureEvaluator(e, null, appInst);
         Element events = eJob.getChild("input-events", eJob.getNamespace());
@@ -200,9 +199,9 @@ public class CoordELEvaluator {
      */
     public static ELEvaluator createURIELEvaluator(String strDate) throws Exception {
         ELEvaluator eval = new ELEvaluator();
-        Calendar date = Calendar.getInstance(TimeZone.getTimeZone("UTC")); // TODO:UTC
+        Calendar date = Calendar.getInstance(DateUtils.getOozieProcessingTimeZone());
         // always???
-        date.setTime(DateUtils.parseDateUTC(strDate));
+        date.setTime(DateUtils.parseDateOozieTZ(strDate));
         eval.setVariable("YEAR", date.get(Calendar.YEAR));
         eval.setVariable("MONTH", make2Digits(date.get(Calendar.MONTH) + 1));
         eval.setVariable("DAY", make2Digits(date.get(Calendar.DAY_OF_MONTH)));
@@ -222,7 +221,7 @@ public class CoordELEvaluator {
         SyncCoordDataset ds = new SyncCoordDataset();
         Element eDataset = eData.getChild("dataset", eData.getNamespace());
         // System.out.println("eDATA :"+ XmlUtils.prettyPrint(eData));
-        Date initInstance = DateUtils.parseDateUTC(eDataset.getAttributeValue("initial-instance"));
+        Date initInstance = DateUtils.parseDateOozieTZ(eDataset.getAttributeValue("initial-instance"));
         ds.setInitInstance(initInstance);
         if (eDataset.getAttributeValue("frequency") != null) {
             int frequency = Integer.parseInt(eDataset.getAttributeValue("frequency"));

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=1372663&r1=1372662&r2=1372663&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 Mon Aug 13 23:21:15 2012
@@ -171,7 +171,7 @@ public class CoordELFunctions {
         Calendar baseCalDate = DateUtils.getCalendar(strBaseDate);
         StringBuilder buffer = new StringBuilder();
         baseCalDate.add(TimeUnit.valueOf(unit).getCalendarUnit(), offset);
-        buffer.append(DateUtils.formatDateUTC(baseCalDate));
+        buffer.append(DateUtils.formatDateOozieTZ(baseCalDate));
         return buffer.toString();
     }
 
@@ -180,7 +180,7 @@ public class CoordELFunctions {
     }
 
     /**
-     * Determine the date-time in UTC of n-th future available dataset instance
+     * Determine the date-time in Oozie processing timezone of n-th future available dataset instance
      * from nominal Time but not beyond the instance specified as 'instance.
      * <p/>
      * It depends on:
@@ -204,7 +204,7 @@ public class CoordELFunctions {
      *        domain: n >= 0, n is integer
      * @param instance: How many future instance it should check? value should
      *        be >=0
-     * @return date-time in UTC of the n-th instance
+     * @return date-time in Oozie processing timezone of the n-th instance
      *         <p/>
      * @throws Exception
      */
@@ -257,7 +257,7 @@ public class CoordELFunctions {
                     if (available == n) {
                         XLog.getLog(CoordELFunctions.class).debug("Found future File: " + pathWithDoneFlag);
                         resolved = true;
-                        retVal = DateUtils.formatDateUTC(nominalInstanceCal);
+                        retVal = DateUtils.formatDateOozieTZ(nominalInstanceCal);
                         eval.setVariable("resolved_path", uriPath);
                         break;
                     }
@@ -299,7 +299,7 @@ public class CoordELFunctions {
         ELEvaluator eval = ELEvaluator.getCurrent();
         SyncCoordAction action = ParamChecker.notNull((SyncCoordAction) eval.getVariable(COORD_ACTION),
                 "Coordinator Action");
-        return DateUtils.formatDateUTC(action.getNominalTime());
+        return DateUtils.formatDateOozieTZ(action.getNominalTime());
     }
 
     public static String ph3_coord_nominalTime() throws Exception {
@@ -316,7 +316,7 @@ public class CoordELFunctions {
      */
     public static String ph2_coord_formatTime(String dateTimeStr, String format)
         throws Exception {
-        Date dateTime = DateUtils.parseDateUTC(dateTimeStr);
+        Date dateTime = DateUtils.parseDateOozieTZ(dateTimeStr);
         return DateUtils.formatDateCustom(dateTime, format);
     }
 
@@ -369,7 +369,7 @@ public class CoordELFunctions {
         if (coordAction == null) {
             throw new RuntimeException("Associated Application instance should be defined with key " + COORD_ACTION);
         }
-        return DateUtils.formatDateUTC(coordAction.getActualTime());
+        return DateUtils.formatDateOozieTZ(coordAction.getActualTime());
     }
 
     public static String ph3_coord_actualTime() throws Exception {
@@ -412,13 +412,14 @@ public class CoordELFunctions {
     }
 
     /**
-     * Determine the date-time in UTC of n-th dataset instance. <p/> It depends on: <p/> 1. Data set frequency <p/> 2.
+     * Determine the date-time in Oozie processing timezone of n-th dataset instance. <p/> It depends on: <p/> 1.
+     * Data set frequency <p/> 2.
      * Data set Time unit (day, month, minute) <p/> 3. Data set Time zone/DST <p/> 4. End Day/Month flag <p/> 5. Data
      * set initial instance <p/> 6. Action Creation Time
      *
      * @param n instance count domain: n is integer
-     * @return date-time in UTC of the n-th instance returns 'null' means n-th instance is earlier than Initial-Instance
-     *         of DS
+     * @return date-time in Oozie processing timezone of the n-th instance returns 'null' means n-th instance is
+     * earlier than Initial-Instance of DS
      * @throws Exception
      */
     public static String ph2_coord_current(int n) throws Exception {
@@ -493,13 +494,14 @@ public class CoordELFunctions {
     }
 
     /**
-     * Determine the date-time in UTC of n-th latest available dataset instance. <p/> It depends on: <p/> 1. Data set
-     * frequency <p/> 2. Data set Time unit (day, month, minute) <p/> 3. Data set Time zone/DST <p/> 4. End Day/Month
-     * flag <p/> 5. Data set initial instance <p/> 6. Action Creation Time <p/> 7. Existence of dataset's directory
+     * Determine the date-time in Oozie processing timezone of n-th latest available dataset instance. <p/> It depends
+     * on: <p/> 1. Data set frequency <p/> 2. Data set Time unit (day, month, minute) <p/> 3. Data set Time zone/DST
+     * <p/> 4. End Day/Month flag <p/> 5. Data set initial instance <p/> 6. Action Creation Time <p/> 7. Existence of
+     * dataset's directory
      *
      * @param n :instance count <p/> domain: n > 0, n is integer
-     * @return date-time in UTC of the n-th instance <p/> returns 'null' means n-th instance is earlier than
-     *         Initial-Instance of DS
+     * @return date-time in Oozie processing timezone of the n-th instance <p/> returns 'null' means n-th instance is
+     * earlier than Initial-Instance of DS
      * @throws Exception
      */
     public static String ph3_coord_latest(int n) throws Exception {
@@ -721,7 +723,7 @@ public class CoordELFunctions {
                     .warn("If the initial instance of the dataset is later than the current-instance specified, such as coord:current({0}) in this case, an empty string is returned. This means that no data is available at the current-instance specified by the user and the user could try modifying his initial-instance to an earlier time.", n);
             return "";
         }
-        String str = DateUtils.formatDateUTC(nominalInstanceCal);
+        String str = DateUtils.formatDateOozieTZ(nominalInstanceCal);
         return str;
     }
 
@@ -769,7 +771,7 @@ public class CoordELFunctions {
                     if (available == offset) {
                         XLog.getLog(CoordELFunctions.class).debug("Found Latest File: " + pathWithDoneFlag);
                         resolved = true;
-                        retVal = DateUtils.formatDateUTC(nominalInstanceCal);
+                        retVal = DateUtils.formatDateOozieTZ(nominalInstanceCal);
                         eval.setVariable("resolved_path", uriPath);
                         break;
                     }

Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/coord/CoordUtils.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/coord/CoordUtils.java?rev=1372663&r1=1372662&r2=1372663&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/coord/CoordUtils.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/coord/CoordUtils.java Mon Aug 13 23:21:15 2012
@@ -92,7 +92,7 @@ public class CoordUtils {
             else {
                 try {
                     // Get action for the nominal time
-                    Date date = DateUtils.parseDateUTC(s.trim());
+                    Date date = DateUtils.parseDateOozieTZ(s.trim());
                     CoordinatorActionBean coordAction = jpaService
                             .execute(new CoordJobGetActionForNominalTimeJPAExecutor(jobId, date));
 

Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionForNominalTimeJPAExecutor.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionForNominalTimeJPAExecutor.java?rev=1372663&r1=1372662&r2=1372663&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionForNominalTimeJPAExecutor.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionForNominalTimeJPAExecutor.java Mon Aug 13 23:21:15 2012
@@ -62,7 +62,7 @@ public class CoordJobGetActionForNominal
             action = actions.get(0);
         }
         else {
-            throw new JPAExecutorException(ErrorCode.E0605, DateUtils.convertDateToString(nominalTime));
+            throw new JPAExecutorException(ErrorCode.E0605, DateUtils.formatDateOozieTZ(nominalTime));
         }
         return getBeanForRunningCoordAction(action);
     }

Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/service/Services.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/service/Services.java?rev=1372663&r1=1372662&r2=1372663&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/service/Services.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/service/Services.java Mon Aug 13 23:21:15 2012
@@ -22,6 +22,7 @@ import org.apache.hadoop.conf.Configurat
 import org.apache.hadoop.util.ReflectionUtils;
 import org.apache.hadoop.util.VersionInfo;
 import org.apache.oozie.client.OozieClient.SYSTEM_MODE;
+import org.apache.oozie.util.DateUtils;
 import org.apache.oozie.util.XLog;
 import org.apache.oozie.util.Instrumentable;
 import org.apache.oozie.util.IOUtils;
@@ -107,6 +108,11 @@ public class Services {
         setServiceInternal(XLogService.class, false);
         setServiceInternal(ConfigurationService.class, true);
         conf = get(ConfigurationService.class).getConf();
+        DateUtils.setConf(conf);
+        if (!DateUtils.getOozieProcessingTimeZone().equals(DateUtils.UTC)) {
+            XLog.getLog(getClass()).warn("Oozie configured to work in a timezone other than UTC: {0}",
+                                         DateUtils.getOozieProcessingTimeZone().getID());
+        }
         systemId = conf.get(CONF_SYSTEM_ID, ("oozie-" + System.getProperty("user.name")));
         if (systemId.length() > MAX_SYSTEM_ID_LEN) {
             systemId = systemId.substring(0, MAX_SYSTEM_ID_LEN);

Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/service/StatusTransitService.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/service/StatusTransitService.java?rev=1372663&r1=1372662&r2=1372663&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/service/StatusTransitService.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/service/StatusTransitService.java Mon Aug 13 23:21:15 2012
@@ -155,7 +155,7 @@ public class StatusTransitService implem
             }
             else {
                 LOG.info("Running bundle status service from last instance time =  "
-                        + DateUtils.convertDateToString(lastInstanceStartTime));
+                        + DateUtils.formatDateOozieTZ(lastInstanceStartTime));
                 // this is not the first instance, we should only check jobs that have actions been
                 // updated >= start time of last service run;
                 List<BundleActionBean> actionList = jpaService
@@ -703,7 +703,7 @@ public class StatusTransitService implem
             }
             else {
                 LOG.info("Running coordinator status service from last instance time =  "
-                        + DateUtils.convertDateToString(lastInstanceStartTime));
+                        + DateUtils.formatDateOozieTZ(lastInstanceStartTime));
                 // this is not the first instance, we should only check jobs
                 // that have actions been
                 // updated >= start time of last service run;

Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/store/CoordinatorStore.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/store/CoordinatorStore.java?rev=1372663&r1=1372662&r2=1372663&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/store/CoordinatorStore.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/store/CoordinatorStore.java Mon Aug 13 23:21:15 2012
@@ -918,7 +918,7 @@ public class CoordinatorStore extends St
                     action = actions.get(0);
                 }
                 else {
-                    throw new StoreException(ErrorCode.E0605, DateUtils.convertDateToString(nominalTime));
+                    throw new StoreException(ErrorCode.E0605, DateUtils.formatDateOozieTZ(nominalTime));
                 }
                 return getBeanForRunningCoordAction(action);
             }

Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/util/CoordActionsInDateRange.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/util/CoordActionsInDateRange.java?rev=1372663&r1=1372662&r2=1372663&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/util/CoordActionsInDateRange.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/util/CoordActionsInDateRange.java Mon Aug 13 23:21:15 2012
@@ -26,17 +26,13 @@ import java.util.List;
 import java.util.Set;
 
 import org.apache.oozie.CoordinatorActionBean;
-import org.apache.oozie.CoordinatorActionInfo;
 import org.apache.oozie.ErrorCode;
 import org.apache.oozie.XException;
-import org.apache.oozie.command.PreconditionException;
 import org.apache.oozie.executor.jpa.CoordJobGetActionIdsForDateRangeJPAExecutor;
 import org.apache.oozie.executor.jpa.CoordJobGetActionsForDatesJPAExecutor;
-import org.apache.oozie.executor.jpa.JPAExecutorException;
 import org.apache.oozie.service.JPAService;
 import org.apache.oozie.service.Services;
-import org.apache.oozie.util.DateUtils;
-import org.apache.oozie.util.ParamChecker;
+
 /**
  * This class provides the utility of listing
  * coordinator actions that were executed between a certain
@@ -89,8 +85,8 @@ public class CoordActionsInDateRange {
             Date end;
             try {
             // Get the start and end dates for the range
-                start = DateUtils.parseDateUTC(dateRange[0].trim());
-                end = DateUtils.parseDateUTC(dateRange[1].trim());
+                start = DateUtils.parseDateOozieTZ(dateRange[0].trim());
+                end = DateUtils.parseDateOozieTZ(dateRange[1].trim());
             }
             catch (ParseException dx) {
                 throw new XException(ErrorCode.E0308, "Error in parsing start or end date. " + dx);
@@ -119,8 +115,8 @@ public class CoordActionsInDateRange {
             Date end;
             try {
             // Get the start and end dates for the range
-                start = DateUtils.parseDateUTC(dateRange[0].trim());
-                end = DateUtils.parseDateUTC(dateRange[1].trim());
+                start = DateUtils.parseDateOozieTZ(dateRange[0].trim());
+                end = DateUtils.parseDateOozieTZ(dateRange[1].trim());
             }
             catch (ParseException dx) {
                 throw new XException(ErrorCode.E0308, "Error in parsing start or end date. " + dx);

Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/util/DateUtils.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/util/DateUtils.java?rev=1372663&r1=1372662&r2=1372663&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/util/DateUtils.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/util/DateUtils.java Mon Aug 13 23:21:15 2012
@@ -25,92 +25,93 @@ import java.text.SimpleDateFormat;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.GregorianCalendar;
-import java.util.Locale;
 import java.util.TimeZone;
+import java.util.regex.Pattern;
 
+import org.apache.hadoop.conf.Configuration;
 import org.apache.oozie.coord.TimeUnit;
 
+/**
+ * Date utility classes to parse and format datetimes in Oozie expected datetime formats.
+ */
 public class DateUtils {
 
-    private static final String[] W3CDATETIME_MASKS = {"yyyy-MM-dd'T'HH:mmz"};
+    public static final TimeZone UTC = getTimeZone("UTC");
+
+    private static final String ISO8601_UTC_MASK = "yyyy-MM-dd'T'HH:mm'Z'";
+    private static final String ISO8601_TZ_MASK_WITHOUT_OFFSET = "yyyy-MM-dd'T'HH:mm";
+
+    private static String ACTIVE_MASK = ISO8601_UTC_MASK;
+    private static TimeZone ACTIVE_TIMEZONE = UTC;
+
+    public static final String OOZIE_PROCESSING_TIMEZONE_KEY = "oozie.processing.timezone";
+
+    public static final String OOZIE_PROCESSING_TIMEZONE_DEFAULT = "UTC";
+
+    private static boolean OOZIE_IN_UTC = true;
+
+    private static final String VALID_TIMEZONE_MASK = "^UTC$|^GMT(\\+|\\-)\\d{4}$";
 
     /**
-     * Parses a Date out of a String with a date in W3C date-time format.
-     * <p/>
-     * It parsers the following formats:
-     * <ul>
-     * <li>"yyyy-MM-dd'T'HH:mm:ssz"</li>
-     * <li>"yyyy-MM-dd'T'HH:mmz"</li>
-     * <li>"yyyy-MM-dd"</li>
-     * <li>"yyyy-MM"</li>
-     * <li>"yyyy"</li>
-     * </ul>
-     * <p/>
-     * Refer to the java.text.SimpleDateFormat javadocs for details on the
-     * format of each element.
+     * Configures the Datetime parsing with Oozie processing timezone.
      * <p/>
+     * The {@link #OOZIE_PROCESSING_TIMEZONE_KEY} property is read and set as the Oozie processing timezone.
+     * Valid values for this property are <code>UTC</code> and <code>GMT(+/-)####</code>
      *
-     * @param sDate string to parse for a date.
-     * @return the Date represented by the given W3C date-time string. It
-     * returns <b>null</b> if it was not possible to parse the given
-     * string into a Date.
-     */
-    /*
-     * public static Date parseW3CDateTime(String sDate) { // if sDate has time
-     * on it, it injects 'GTM' before de TZ displacement to // allow the
-     * SimpleDateFormat parser to parse it properly int tIndex =
-     * sDate.indexOf("T"); if (tIndex > -1) { if (sDate.endsWith("Z")) { sDate =
-     * sDate.substring(0, sDate.length() - 1) + "+00:00"; } int tzdIndex =
-     * sDate.indexOf("+", tIndex); if (tzdIndex == -1) { tzdIndex =
-     * sDate.indexOf("-", tIndex); } if (tzdIndex > -1) { String pre =
-     * sDate.substring(0, tzdIndex); int secFraction = pre.indexOf(","); if
-     * (secFraction > -1) { pre = pre.substring(0, secFraction); } String post =
-     * sDate.substring(tzdIndex); sDate = pre + "GMT" + post; } } else { sDate
-     * += "T00:00GMT"; } return parseUsingMask(W3CDATETIME_MASKS, sDate); }
-     */
-    /**
-     * Parses a Date out of a string using an array of masks. <p/> It uses the masks in order until one of them succedes
-     * or all fail. <p/>
-     *
-     * @param masks array of masks to use for parsing the string
-     * @param sDate string to parse for a date.
-     * @return the Date represented by the given string using one of the given masks. It returns <b>null</b> if it was
-     *         not possible to parse the the string with any of the masks.
-     */
-    private static Date parseUsingMask(String[] masks, String sDate) {
-        sDate = (sDate != null) ? sDate.trim() : null;
-        ParsePosition pp;
-        Date d = null;
-        if (sDate != null) {
-            for (int i = 0; d == null && i < masks.length; i++) {
-                DateFormat df = new SimpleDateFormat(masks[i], Locale.US);
-                df.setLenient(true);
-                pp = new ParsePosition(0);
-                d = df.parse(sDate, pp);
-                if (pp.getIndex() != sDate.length()) {
-                    d = null;
-                }
-            }
+     * @param conf Oozie server configuration.
+     */
+    public static void setConf(Configuration conf) {
+        String tz = conf.get(OOZIE_PROCESSING_TIMEZONE_KEY, OOZIE_PROCESSING_TIMEZONE_DEFAULT);
+        Pattern pattern = Pattern.compile(VALID_TIMEZONE_MASK);
+        if (!pattern.matcher(tz).find()) {
+            throw new RuntimeException("Invalid Oozie timezone, it must be 'UTC' or 'GMT(+/-)####");
         }
-        return d;
+        ACTIVE_TIMEZONE = TimeZone.getTimeZone(tz);
+        OOZIE_IN_UTC = ACTIVE_TIMEZONE.equals(UTC);
+        ACTIVE_MASK = (OOZIE_IN_UTC) ? ISO8601_UTC_MASK : ISO8601_TZ_MASK_WITHOUT_OFFSET + tz.substring(3);
     }
 
-    private static final TimeZone UTC = getTimeZone("UTC");
+    /**
+     * Returns Oozie processing timezone.
+     *
+     * @return Oozie processing timezone. The returned timezone is <code>UTC</code> or a <code>GMT(+/-)####</code>
+     * timezone.
+     */
+    public static TimeZone getOozieProcessingTimeZone() {
+        return ACTIVE_TIMEZONE;
+    }
+
+    /**
+     * Returns Oozie processing datetime mask.
+     * <p/>
+     * This mask is an ISO8601 datetime mask for the Oozie processing timezone.
+     *
+     * @return  Oozie processing datetime mask.
+     */
+    public static String getOozieTimeMask() {
+        return ACTIVE_MASK;
+    }
 
-    private static DateFormat getISO8601DateFormat() {
-        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'");
+    private static DateFormat getISO8601DateFormat(TimeZone tz, String mask) {
+        DateFormat dateFormat = new SimpleDateFormat(mask);
         // Stricter parsing to prevent dates such as 2011-12-50T01:00Z (December 50th) from matching
         dateFormat.setLenient(false);
-        dateFormat.setTimeZone(UTC);
+        dateFormat.setTimeZone(tz);
         return dateFormat;
     }
 
     private static DateFormat getSpecificDateFormat(String format) {
         DateFormat dateFormat = new SimpleDateFormat(format);
-        dateFormat.setTimeZone(UTC);
+        dateFormat.setTimeZone(ACTIVE_TIMEZONE);
         return dateFormat;
     }
 
+    /**
+     * Returns the {@link TimeZone} for the given timezone ID.
+     *
+     * @param tzId timezone ID.
+     * @return  the {@link TimeZone} for the given timezone ID.
+     */
     public static TimeZone getTimeZone(String tzId) {
         if (tzId == null) {
             throw new IllegalArgumentException("Invalid TimeZone: " + tzId);
@@ -122,20 +123,70 @@ public class DateUtils {
         return tz;
     }
 
+    /**
+     * Parses a datetime in ISO8601 format in UTC timezone
+     *
+     * @param s string with the datetime to parse.
+     * @return the corresponding {@link Date} instance for the parsed date.
+     * @throws ParseException thrown if the given string was not an ISO8601 UTC value.
+     */
     public static Date parseDateUTC(String s) throws ParseException {
-        return getISO8601DateFormat().parse(s);
+        return getISO8601DateFormat(UTC, ISO8601_UTC_MASK).parse(s);
     }
 
-    public static String formatDateUTC(Date d) throws Exception {
-        return (d != null) ? getISO8601DateFormat().format(d) : "NULL";
+    /**
+     * Parses a datetime in ISO8601 format in the Oozie processing timezone.
+     *
+     * @param s string with the datetime to parse.
+     * @return the corresponding {@link Date} instance for the parsed date.
+     * @throws ParseException thrown if the given string was not an ISO8601 value for the Oozie processing timezon.
+     */
+    public static Date parseDateOozieTZ(String s) throws ParseException {
+        ParsePosition pos = new ParsePosition(0);
+        Date d = getISO8601DateFormat(ACTIVE_TIMEZONE, ACTIVE_MASK).parse(s, pos);
+        if (d == null) {
+            throw new ParseException("Could not parse [" + s + "] using [" + ACTIVE_MASK + "] mask",
+                                     pos.getErrorIndex());
+        }
+        if (d != null && s.length() > pos.getIndex()) {
+            throw new ParseException("Correct datetime string is followed by invalid characters: " + s, pos.getIndex());
+        }
+        return d;
+    }
+
+    /**
+     * Formats a {@link Date} as a string in ISO8601 format using Oozie processing timezone.
+     *
+     * @param d {@link Date} to format.
+     * @return the ISO8601 string for the given date, <code>NULL</code> if the {@link Date} instance was
+     * <code>NULL</code>
+     */
+    public static String formatDateOozieTZ(Date d) {
+        return (d != null) ? getISO8601DateFormat(ACTIVE_TIMEZONE, ACTIVE_MASK).format(d) : "NULL";
     }
 
-    public static String formatDateCustom(Date d, String format) throws Exception {
+    /**
+     * Formats a {@link Date} as a string using the specified format mask.
+     * <p/>
+     * The format mask must be a {@link SimpleDateFormat} valid format mask.
+     *
+     * @param d {@link Date} to format.
+     * @return the string for the given date using the specified format mask,
+     * <code>NULL</code> if the {@link Date} instance was <code>NULL</code>
+     */
+    public static String formatDateCustom(Date d, String format) {
         return (d != null) ? getSpecificDateFormat(format).format(d) : "NULL";
     }
 
-    public static String formatDateUTC(Calendar c) throws Exception {
-        return (c != null) ? formatDateUTC(c.getTime()) : "NULL";
+    /**
+     * Formats a {@link Calendar} as a string in ISO8601 format using Oozie processing timezone.
+     *
+     * @param c {@link Calendar} to format.
+     * @return the ISO8601 string for the given date, <code>NULL</code> if the {@link Calendar} instance was
+     * <code>NULL</code>
+     */
+    public static String formatDateOozieTZ(Calendar c) {
+        return (c != null) ? formatDateOozieTZ(c.getTime()) : "NULL";
     }
 
     /**
@@ -207,7 +258,7 @@ public class DateUtils {
      * @throws Exception
      */
     public static Calendar getCalendar(String dateString, TimeZone tz) throws Exception {
-        Date date = DateUtils.parseDateUTC(dateString);
+        Date date = DateUtils.parseDateOozieTZ(dateString);
         Calendar calDate = Calendar.getInstance();
         calDate.setTime(date);
         calDate.setTimeZone(tz);
@@ -221,7 +272,7 @@ public class DateUtils {
      * @throws Exception
      */
     public static Calendar getCalendar(String dateString) throws Exception {
-        return getCalendar(dateString, DateUtils.getTimeZone("UTC"));
+        return getCalendar(dateString, ACTIVE_TIMEZONE);
     }
 
     /**
@@ -251,29 +302,4 @@ public class DateUtils {
         return null;
     }
 
-    /**
-     * Return the UTC date and time in W3C format down to second
-     * (yyyy-MM-ddTHH:mmZ). i.e.: 1997-07-16T19:20:30Z
-     *
-     * @return the formatted time string.
-     */
-    public static String convertDateToString(Date date) {
-        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'");
-        sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
-        return sdf.format(date);
-    }
-
-    /**
-     * Return the UTC date and time in W3C format down to second
-     * (yyyy-MM-ddTHH:mmZ). i.e.: 1997-07-16T19:20Z The input date is a
-     * long (Unix Time Stamp)
-     *
-     * @return the formatted time string.
-     */
-    public static String convertDateToString(long timeStamp) {
-        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'");
-        sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
-        return sdf.format(new Date(timeStamp));
-    }
-
 }

Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/util/ELConstantsFunctions.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/util/ELConstantsFunctions.java?rev=1372663&r1=1372662&r2=1372663&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/util/ELConstantsFunctions.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/util/ELConstantsFunctions.java Mon Aug 13 23:21:15 2012
@@ -105,15 +105,13 @@ public class ELConstantsFunctions {
     }
 
     /**
-     * Return the UTC current date and time in W3C format down to second (yyyy-MM-ddTHH:mm:ssZ). i.e.:
+     * Return the current datetime in ISO8601 using Oozie processing timezone, yyyy-MM-ddTHH:mm:ssZ. i.e.:
      * 1997-07-16T19:20:30Z
      *
      * @return the formatted time string.
      */
     public static String timestamp() {
-        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
-        sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
-        return sdf.format(new Date());
+        return DateUtils.formatDateOozieTZ(new Date());
     }
 
     /**

Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/util/ParamChecker.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/util/ParamChecker.java?rev=1372663&r1=1372662&r2=1372663&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/util/ParamChecker.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/util/ParamChecker.java Mon Aug 13 23:21:15 2012
@@ -188,21 +188,23 @@ public class ParamChecker {
     }
 
     /**
-     * Check whether the value is UTC data format.
+     * Check whether the value is Oozie processing timezone data format.
      *
      * @param value : value to test
      * @param name : Name of the parameter
-     * @return If the value is in UTC date format, return the value. Otherwise throw IllegalArgumentException
+     * @return If the value is in Oozie processing timezone date format, return the value.
+     * Otherwise throw IllegalArgumentException
      */
-    public static Date checkUTC(String date, String name) {
+    public static Date checkDateOozieTZ(String date, String name) {
         Date ret;
         try {
-            ret = DateUtils.parseDateUTC(date);
+            ret = DateUtils.parseDateOozieTZ(date);
         }
         catch (Exception ex) {
             throw new IllegalArgumentException(XLog.format(
-                    "parameter [{0}] = [{1}] must be Date in UTC format (yyyy-MM-dd'T'HH:mm'Z')."
-                            + " Parsing error {2}", name, date, ex));
+                    "parameter [{0}] = [{1}] must be Date in {2} format ({3})."
+                            + " Parsing error {4}", name, date, DateUtils.getOozieProcessingTimeZone().getID(),
+                    DateUtils.getOozieTimeMask(), ex));
         }
         return ret;
     }

Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/util/db/SLADbOperations.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/util/db/SLADbOperations.java?rev=1372663&r1=1372662&r2=1372663&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/util/db/SLADbOperations.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/util/db/SLADbOperations.java Mon Aug 13 23:21:15 2012
@@ -57,7 +57,7 @@ public class SLADbOperations {
             // change to
             // CommandException
         }
-        Date nominalTime = DateUtils.parseDateUTC(strNominalTime);
+        Date nominalTime = DateUtils.parseDateOozieTZ(strNominalTime);
         // Setting expected start time
         String strRelExpectedStart = getTagElement(eSla, "should-start");
         if (strRelExpectedStart == null || strRelExpectedStart.length() == 0) {
@@ -131,7 +131,7 @@ public class SLADbOperations {
             // change to
             // CommandException
         }
-        Date nominalTime = DateUtils.parseDateUTC(strNominalTime);
+        Date nominalTime = DateUtils.parseDateOozieTZ(strNominalTime);
         // Setting expected start time
         String strRelExpectedStart = getTagElement(eSla, "should-start");
         if (strRelExpectedStart == null || strRelExpectedStart.length() == 0) {

Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/util/db/SLADbXOperations.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/util/db/SLADbXOperations.java?rev=1372663&r1=1372662&r2=1372663&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/util/db/SLADbXOperations.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/util/db/SLADbXOperations.java Mon Aug 13 23:21:15 2012
@@ -59,7 +59,7 @@ public class SLADbXOperations {
         if (strNominalTime == null || strNominalTime.length() == 0) {
             throw new CommandException(ErrorCode.E1101);
         }
-        Date nominalTime = DateUtils.parseDateUTC(strNominalTime);
+        Date nominalTime = DateUtils.parseDateOozieTZ(strNominalTime);
         // Setting expected start time
         String strRelExpectedStart = getTagElement(eSla, "should-start");
         if (strRelExpectedStart == null || strRelExpectedStart.length() == 0) {

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=1372663&r1=1372662&r2=1372663&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/resources/oozie-default.xml (original)
+++ incubator/oozie/trunk/core/src/main/resources/oozie-default.xml Mon Aug 13 23:21:15 2012
@@ -1,4 +1,5 @@
 <?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
 <!--
   Licensed to the Apache Software Foundation (ASF) under one
   or more contributor license agreements.  See the NOTICE file
@@ -16,7 +17,6 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
 <configuration>
 
     <!-- ************************** VERY IMPORTANT  ************************** -->
@@ -24,6 +24,17 @@
     <!-- It is not loaded by Oozie, Oozie uses its own privatecopy.            -->
     <!-- ************************** VERY IMPORTANT  ************************** -->
 
+    <property>
+        <name>oozie.processing.timezone</name>
+        <value>UTC</value>
+        <description>
+            Oozie server timezone. Valid values are UTC and GMT(+/-)####, for example 'GMT+0530' would be India
+            timezone. All dates parsed and genered dates by Oozie Coordinator/Bundle will be done in the specified
+            timezone. The default value of 'UTC' should not be changed under normal circumtances. If for any reason
+            is changed, note that GMT(+/-)#### timezones do not observe DST changes.
+        </description>
+    </property>
+
     <!-- Base Oozie URL: <SCHEME>://<HOST>:<PORT>/<CONTEXT> -->
 
     <property>

Modified: incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/bundle/TestBundleChangeXCommand.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/bundle/TestBundleChangeXCommand.java?rev=1372663&r1=1372662&r2=1372663&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/bundle/TestBundleChangeXCommand.java (original)
+++ incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/bundle/TestBundleChangeXCommand.java Mon Aug 13 23:21:15 2012
@@ -68,7 +68,7 @@ public class TestBundleChangeXCommand ex
         new BundleJobChangeXCommand(job.getId(), "pausetime=" + dateStr).call();
 
         job = jpaService.execute(bundleJobGetCmd);
-        assertEquals(job.getPauseTime(), DateUtils.parseDateUTC(dateStr));
+        assertEquals(job.getPauseTime(), DateUtils.parseDateOozieTZ(dateStr));
     }
 
     /**
@@ -100,7 +100,7 @@ public class TestBundleChangeXCommand ex
 
         new BundleJobChangeXCommand(bundleJob.getId(), "pausetime=" + dateStr).call();
         bundleJob = jpaService.execute(bundleJobGetCmd);
-        assertEquals(DateUtils.parseDateUTC(dateStr), bundleJob.getPauseTime());
+        assertEquals(DateUtils.parseDateOozieTZ(dateStr), bundleJob.getPauseTime());
 
         final String coordJobId = coordJob.getId();
         waitFor(60000, new Predicate() {
@@ -111,7 +111,7 @@ public class TestBundleChangeXCommand ex
         });
 
         coordJob = jpaService.execute(new CoordJobGetJPAExecutor(coordJob.getId()));
-        assertEquals(DateUtils.parseDateUTC(dateStr), coordJob.getPauseTime());
+        assertEquals(DateUtils.parseDateOozieTZ(dateStr), coordJob.getPauseTime());
     }
 
     /**
@@ -180,6 +180,6 @@ public class TestBundleChangeXCommand ex
         new BundleJobChangeXCommand(job.getId(), "endtime=" + dateStr).call();
 
         job = jpaService.execute(bundleJobGetCmd);
-        assertEquals(job.getEndTime(), DateUtils.parseDateUTC(dateStr));
+        assertEquals(job.getEndTime(), DateUtils.parseDateOozieTZ(dateStr));
     }
 }

Modified: incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/bundle/TestBundlePurgeXCommand.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/bundle/TestBundlePurgeXCommand.java?rev=1372663&r1=1372662&r2=1372663&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/bundle/TestBundlePurgeXCommand.java (original)
+++ incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/bundle/TestBundlePurgeXCommand.java Mon Aug 13 23:21:15 2012
@@ -54,7 +54,8 @@ public class TestBundlePurgeXCommand ext
      * @throws Exception
      */
     public void testSucBundlePurgeXCommand() throws Exception {
-        BundleJobBean job = this.addRecordToBundleJobTable(Job.Status.SUCCEEDED, DateUtils.parseDateUTC("2011-01-01T01:00Z"));
+        BundleJobBean job = this.addRecordToBundleJobTable(Job.Status.SUCCEEDED, DateUtils.parseDateOozieTZ(
+            "2011-01-01T01:00Z"));
         this.addRecordToBundleActionTable(job.getId(), "action1", 0, Job.Status.SUCCEEDED);
         this.addRecordToBundleActionTable(job.getId(), "action2", 0, Job.Status.SUCCEEDED);
 
@@ -106,7 +107,8 @@ public class TestBundlePurgeXCommand ext
      * @throws Exception
      */
     public void testFailBundlePurgeXCommand() throws Exception {
-        BundleJobBean job = this.addRecordToBundleJobTable(Job.Status.DONEWITHERROR, DateUtils.parseDateUTC("2011-01-01T01:00Z"));
+        BundleJobBean job = this.addRecordToBundleJobTable(Job.Status.DONEWITHERROR, DateUtils.parseDateOozieTZ(
+            "2011-01-01T01:00Z"));
         this.addRecordToBundleActionTable(job.getId(), "action1", 0, Job.Status.FAILED);
         this.addRecordToBundleActionTable(job.getId(), "action2", 0, Job.Status.SUCCEEDED);
 
@@ -158,7 +160,8 @@ public class TestBundlePurgeXCommand ext
      * @throws Exception
      */
     public void testKillBundlePurgeXCommand() throws Exception {
-        BundleJobBean job = this.addRecordToBundleJobTable(Job.Status.KILLED, DateUtils.parseDateUTC("2011-01-01T01:00Z"));
+        BundleJobBean job = this.addRecordToBundleJobTable(Job.Status.KILLED, DateUtils.parseDateOozieTZ(
+            "2011-01-01T01:00Z"));
         this.addRecordToBundleActionTable(job.getId(), "action1", 0, Job.Status.KILLED);
         this.addRecordToBundleActionTable(job.getId(), "action2", 0, Job.Status.KILLED);
 
@@ -210,7 +213,8 @@ public class TestBundlePurgeXCommand ext
      * @throws Exception
      */
     public void testBundlePurgeXCommandFailed() throws Exception {
-        BundleJobBean job = this.addRecordToBundleJobTable(Job.Status.RUNNING, DateUtils.parseDateUTC("2011-01-01T01:00Z"));
+        BundleJobBean job = this.addRecordToBundleJobTable(Job.Status.RUNNING, DateUtils.parseDateOozieTZ(
+            "2011-01-01T01:00Z"));
         this.addRecordToBundleActionTable(job.getId(), "action1", 0, Job.Status.RUNNING);
         this.addRecordToBundleActionTable(job.getId(), "action2", 0, Job.Status.SUCCEEDED);
 

Modified: incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionInputCheckXCommand.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionInputCheckXCommand.java?rev=1372663&r1=1372662&r2=1372663&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionInputCheckXCommand.java (original)
+++ incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionInputCheckXCommand.java Mon Aug 13 23:21:15 2012
@@ -47,13 +47,22 @@ import org.apache.oozie.util.XLog;
 public class TestCoordActionInputCheckXCommand extends XDataTestCase {
     protected Services services;
 
+    protected String getProcessingTZ() {
+        return DateUtils.OOZIE_PROCESSING_TIMEZONE_DEFAULT;
+    }
+
+    private String TZ;
+
     @Override
     protected void setUp() throws Exception {
         super.setUp();
         setSystemProperty(XLogService.LOG4J_FILE, "oozie-log4j.properties");
+        setSystemProperty(DateUtils.OOZIE_PROCESSING_TIMEZONE_KEY, getProcessingTZ());
         services = new Services();
         services.init();
         cleanUpDBTables();
+        TZ = (getProcessingTZ().equals(DateUtils.OOZIE_PROCESSING_TIMEZONE_DEFAULT)) 
+             ? "Z" : getProcessingTZ().substring(3);
     }
 
     @Override
@@ -93,8 +102,8 @@ public class TestCoordActionInputCheckXC
     }
 
     public void testCoordActionInputCheckXCommandUniqueness() throws Exception {
-        Date startTime = DateUtils.parseDateUTC("2009-02-01T23:59Z");
-        Date endTime = DateUtils.parseDateUTC("2009-02-02T23:59Z");
+        Date startTime = DateUtils.parseDateOozieTZ("2009-02-01T23:59" + TZ);
+        Date endTime = DateUtils.parseDateOozieTZ("2009-02-02T23:59" + TZ);
         CoordinatorJobBean job = addRecordToCoordJobTableForWaiting("coord-job-for-action-input-check.xml",
                 CoordinatorJob.Status.RUNNING, startTime, endTime, false, true, 3);
 
@@ -131,8 +140,8 @@ public class TestCoordActionInputCheckXC
 
     public void testActionInputCheck() throws Exception {
         String jobId = "0000000-" + new Date().getTime() + "-TestCoordActionInputCheckXCommand-C";
-        Date startTime = DateUtils.parseDateUTC("2009-02-01T23:59Z");
-        Date endTime = DateUtils.parseDateUTC("2009-02-02T23:59Z");
+        Date startTime = DateUtils.parseDateOozieTZ("2009-02-01T23:59" + TZ);
+        Date endTime = DateUtils.parseDateOozieTZ("2009-02-02T23:59" + TZ);
         CoordinatorJobBean job = addRecordToCoordJobTable(jobId, startTime, endTime);
         new CoordMaterializeTransitionXCommand(job.getId(), 3600).call();
         createDir(getTestCaseDir() + "/2009/29/");
@@ -147,8 +156,8 @@ public class TestCoordActionInputCheckXC
      */
     public void testActionInputMissingDependencies() throws Exception {
         String jobId = "0000000-" + new Date().getTime() + "-TestCoordActionInputCheckXCommand-C";
-        Date startTime = DateUtils.parseDateUTC("2009-02-15T23:59Z");
-        Date endTime = DateUtils.parseDateUTC("2009-02-16T23:59Z");
+        Date startTime = DateUtils.parseDateOozieTZ("2009-02-15T23:59" + TZ);
+        Date endTime = DateUtils.parseDateOozieTZ("2009-02-16T23:59" + TZ);
         CoordinatorJobBean job = addRecordToCoordJobTable(jobId, startTime, endTime);
         new CoordMaterializeTransitionXCommand(job.getId(), 3600).call();
 
@@ -198,8 +207,8 @@ public class TestCoordActionInputCheckXC
          * CoordActionInputCheckXCommand constructor.
          */
         String jobId = "0000000-" + new Date().getTime() + "-TestCoordActionInputCheckXCommand-C";
-        Date startTime = DateUtils.parseDateUTC("2009-02-01T23:59Z");
-        Date endTime = DateUtils.parseDateUTC("2009-02-02T23:59Z");
+        Date startTime = DateUtils.parseDateOozieTZ("2009-02-01T23:59" + TZ);
+        Date endTime = DateUtils.parseDateOozieTZ("2009-02-02T23:59" + TZ);
         CoordinatorJobBean job = addRecordToCoordJobTable(jobId, startTime, endTime);
         /* Override the property value for testing purpose only. */
         long testedValue = 12000;
@@ -250,7 +259,7 @@ public class TestCoordActionInputCheckXC
 
     protected CoordinatorActionBean addRecordToCoordActionTableForWaiting(String jobId, int actionNum,
             CoordinatorAction.Status status, String resourceXmlName) throws Exception {
-        CoordinatorActionBean action = createCoordAction(jobId, actionNum, status, resourceXmlName, 0);
+        CoordinatorActionBean action = createCoordAction(jobId, actionNum, status, resourceXmlName, 0, TZ);
         String testDir = getTestCaseDir();
         String missDeps = "file://#testDir/2009/29/_SUCCESS#file://#testDir/2009/22/_SUCCESS#file://#testDir/2009/15/_SUCCESS#file://#testDir/2009/08/_SUCCESS";
         missDeps = missDeps.replaceAll("#testDir", testDir);
@@ -300,7 +309,7 @@ public class TestCoordActionInputCheckXC
 
         String confStr = jobConf.toXmlString(false);
         coordJob.setConf(confStr);
-        String appXml = "<coordinator-app xmlns='uri:oozie:coordinator:0.2' name='NAME' frequency=\"1\" start='2009-02-01T01:00Z' end='2009-02-03T23:59Z' timezone='UTC' freq_timeunit='DAY' end_of_duration='NONE'>";
+        String appXml = "<coordinator-app xmlns='uri:oozie:coordinator:0.2' name='NAME' frequency=\"1\" start='2009-02-01T01:00" + TZ + "' end='2009-02-03T23:59" + TZ + "' timezone='UTC' freq_timeunit='DAY' end_of_duration='NONE'>";
         appXml += "<controls>";
         appXml += "<timeout>10</timeout>";
         appXml += "<concurrency>2</concurrency>";
@@ -308,7 +317,7 @@ public class TestCoordActionInputCheckXC
         appXml += "</controls>";
         appXml += "<input-events>";
         appXml += "<data-in name='A' dataset='a'>";
-        appXml += "<dataset name='a' frequency='7' initial-instance='2009-01-01T01:00Z' timezone='UTC' freq_timeunit='DAY' end_of_duration='NONE'>";
+        appXml += "<dataset name='a' frequency='7' initial-instance='2009-01-01T01:00" + TZ + "' timezone='UTC' freq_timeunit='DAY' end_of_duration='NONE'>";
         appXml += "<uri-template>file://" + testDir + "/${YEAR}/${DAY}</uri-template>";
         appXml += "</dataset>";
         appXml += "<start-instance>${coord:current(-3)}</start-instance>";
@@ -317,7 +326,7 @@ public class TestCoordActionInputCheckXC
         appXml += "</input-events>";
         appXml += "<output-events>";
         appXml += "<data-out name='LOCAL_A' dataset='local_a'>";
-        appXml += "<dataset name='local_a' frequency='7' initial-instance='2009-01-01T01:00Z' timezone='UTC' freq_timeunit='DAY' end_of_duration='NONE'>";
+        appXml += "<dataset name='local_a' frequency='7' initial-instance='2009-01-01T01:00" + TZ + "' timezone='UTC' freq_timeunit='DAY' end_of_duration='NONE'>";
         appXml += "<uri-template>file://" + testDir + "/${YEAR}/${DAY}</uri-template>";
         appXml += "</dataset>";
         appXml += "<start-instance>${coord:current(-3)}</start-instance>";

Added: incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionInputCheckXCommandNonUTC.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionInputCheckXCommandNonUTC.java?rev=1372663&view=auto
==============================================================================
--- incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionInputCheckXCommandNonUTC.java (added)
+++ incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionInputCheckXCommandNonUTC.java Mon Aug 13 23:21:15 2012
@@ -0,0 +1,26 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.oozie.command.coord;
+
+public class TestCoordActionInputCheckXCommandNonUTC extends TestCoordActionInputCheckXCommand {
+
+    protected String getProcessingTZ() {
+        return "GMT+0530";
+    }
+
+}

Modified: incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionMaterializeCommand.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionMaterializeCommand.java?rev=1372663&r1=1372662&r2=1372663&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionMaterializeCommand.java (original)
+++ incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionMaterializeCommand.java Mon Aug 13 23:21:15 2012
@@ -52,8 +52,8 @@ public class TestCoordActionMaterializeC
     public void testActionMater() throws Exception {
         String jobId = "0000000-" + new Date().getTime() + "-testActionMater-C";
 
-        Date startTime = DateUtils.parseDateUTC("2009-03-06T010:00Z");
-        Date endTime = DateUtils.parseDateUTC("2009-03-11T10:00Z");
+        Date startTime = DateUtils.parseDateOozieTZ("2009-03-06T010:00Z");
+        Date endTime = DateUtils.parseDateOozieTZ("2009-03-11T10:00Z");
         addRecordToJobTable(jobId, startTime, endTime);
         new CoordActionMaterializeCommand(jobId, startTime, endTime).call();
         CoordinatorActionBean action = checkCoordAction(jobId + "@1");
@@ -62,9 +62,9 @@ public class TestCoordActionMaterializeC
     public void testActionMaterWithPauseTime1() throws Exception {
         String jobId = "0000000-" + new Date().getTime() + "-testActionMater-C";
 
-        Date startTime = DateUtils.parseDateUTC("2009-03-06T10:00Z");
-        Date endTime = DateUtils.parseDateUTC("2009-03-06T10:14Z");
-        Date pauseTime = DateUtils.parseDateUTC("2009-03-06T10:04Z");
+        Date startTime = DateUtils.parseDateOozieTZ("2009-03-06T10:00Z");
+        Date endTime = DateUtils.parseDateOozieTZ("2009-03-06T10:14Z");
+        Date pauseTime = DateUtils.parseDateOozieTZ("2009-03-06T10:04Z");
         addRecordToJobTable(jobId, startTime, endTime, pauseTime);
         new CoordActionMaterializeCommand(jobId, startTime, endTime).call();
         checkCoordActions(jobId, 1, null);
@@ -73,9 +73,9 @@ public class TestCoordActionMaterializeC
     public void testActionMaterWithPauseTime2() throws Exception {
         String jobId = "0000000-" + new Date().getTime() + "-testActionMater-C";
 
-        Date startTime = DateUtils.parseDateUTC("2009-03-06T10:00Z");
-        Date endTime = DateUtils.parseDateUTC("2009-03-06T10:14Z");
-        Date pauseTime = DateUtils.parseDateUTC("2009-03-06T10:08Z");
+        Date startTime = DateUtils.parseDateOozieTZ("2009-03-06T10:00Z");
+        Date endTime = DateUtils.parseDateOozieTZ("2009-03-06T10:14Z");
+        Date pauseTime = DateUtils.parseDateOozieTZ("2009-03-06T10:08Z");
         addRecordToJobTable(jobId, startTime, endTime, pauseTime);
         new CoordActionMaterializeCommand(jobId, startTime, endTime).call();
         checkCoordActions(jobId, 2, null);
@@ -84,9 +84,9 @@ public class TestCoordActionMaterializeC
     public void testActionMaterWithPauseTime3() throws Exception {
         String jobId = "0000000-" + new Date().getTime() + "-testActionMater-C";
 
-        Date startTime = DateUtils.parseDateUTC("2009-03-06T10:00Z");
-        Date endTime = DateUtils.parseDateUTC("2009-03-06T10:14Z");
-        Date pauseTime = DateUtils.parseDateUTC("2009-03-06T09:58Z");
+        Date startTime = DateUtils.parseDateOozieTZ("2009-03-06T10:00Z");
+        Date endTime = DateUtils.parseDateOozieTZ("2009-03-06T10:14Z");
+        Date pauseTime = DateUtils.parseDateOozieTZ("2009-03-06T09:58Z");
         addRecordToJobTable(jobId, startTime, endTime, pauseTime);
         new CoordActionMaterializeCommand(jobId, startTime, endTime).call();
         checkCoordActions(jobId, 0, CoordinatorJob.Status.RUNNING);
@@ -173,7 +173,7 @@ public class TestCoordActionMaterializeC
         coordJob.setLastActionNumber(0);
         coordJob.setFrequency(1);
         try {
-            coordJob.setEndTime(DateUtils.parseDateUTC("2009-03-11T10:00Z"));
+            coordJob.setEndTime(DateUtils.parseDateOozieTZ("2009-03-11T10:00Z"));
         }
         catch (Exception e) {
             // TODO Auto-generated catch block

Modified: incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionStartXCommand.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionStartXCommand.java?rev=1372663&r1=1372662&r2=1372663&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionStartXCommand.java (original)
+++ incubator/oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionStartXCommand.java Mon Aug 13 23:21:15 2012
@@ -88,8 +88,8 @@ public class TestCoordActionStartXComman
      * @throws Exception
      */
     public void testActionStartWithEscapeStrings() throws Exception {
-        Date start = DateUtils.parseDateUTC("2009-12-15T01:00Z");
-        Date end = DateUtils.parseDateUTC("2009-12-16T01:00Z");
+        Date start = DateUtils.parseDateOozieTZ("2009-12-15T01:00Z");
+        Date end = DateUtils.parseDateOozieTZ("2009-12-16T01:00Z");
         CoordinatorJobBean coordJob = addRecordToCoordJobTable(CoordinatorJob.Status.RUNNING, start, end, false,
                 false, 1);