You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oozie.apache.org by vi...@apache.org on 2013/09/10 17:27:41 UTC
svn commit: r1521527 [2/3] - in /oozie/trunk: ./
core/src/main/java/org/apache/oozie/
core/src/main/java/org/apache/oozie/compression/
core/src/main/java/org/apache/oozie/executor/jpa/
core/src/main/java/org/apache/oozie/service/ core/src/main/java/org...
Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionGetForStartJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionGetForStartJPAExecutor.java?rev=1521527&r1=1521526&r2=1521527&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionGetForStartJPAExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionGetForStartJPAExecutor.java Tue Sep 10 15:27:39 2013
@@ -24,6 +24,7 @@ import javax.persistence.Query;
import org.apache.oozie.CoordinatorActionBean;
import org.apache.oozie.ErrorCode;
+import org.apache.oozie.StringBlob;
import org.apache.oozie.client.CoordinatorAction;
import org.apache.oozie.util.DateUtils;
import org.apache.oozie.util.ParamChecker;
@@ -81,13 +82,13 @@ public class CoordActionGetForStartJPAEx
bean.setPending((Integer) arr[3]);
}
if (arr[4] != null) {
- bean.setCreatedConf((String) arr[4]);
+ bean.setCreatedConfBlob((StringBlob) arr[4]);
}
if (arr[5] != null) {
- bean.setSlaXml((String) arr[5]);
+ bean.setSlaXmlBlob((StringBlob) arr[5]);
}
if (arr[6] != null) {
- bean.setActionXml((String) arr[6]);
+ bean.setActionXmlBlob((StringBlob) arr[6]);
}
if (arr[7] != null) {
bean.setExternalId((String) arr[7]);
Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionGetForTimeoutJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionGetForTimeoutJPAExecutor.java?rev=1521527&r1=1521526&r2=1521527&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionGetForTimeoutJPAExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionGetForTimeoutJPAExecutor.java Tue Sep 10 15:27:39 2013
@@ -24,6 +24,7 @@ import javax.persistence.Query;
import org.apache.oozie.CoordinatorActionBean;
import org.apache.oozie.ErrorCode;
+import org.apache.oozie.StringBlob;
import org.apache.oozie.client.CoordinatorAction;
import org.apache.oozie.util.DateUtils;
import org.apache.oozie.util.ParamChecker;
@@ -78,7 +79,7 @@ public class CoordActionGetForTimeoutJPA
bean.setStatus(CoordinatorAction.Status.valueOf((String) arr[2]));
}
if (arr[3] != null) {
- bean.setRunConf((String) arr[3]);
+ bean.setRunConfBlob((StringBlob) arr[3]);
}
if (arr[4] != null) {
bean.setPending((Integer) arr[4]);
Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionGetJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionGetJPAExecutor.java?rev=1521527&r1=1521526&r2=1521527&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionGetJPAExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionGetJPAExecutor.java Tue Sep 10 15:27:39 2013
@@ -64,40 +64,11 @@ public class CoordActionGetJPAExecutor i
CoordinatorActionBean bean = null;
if (caBeans != null && caBeans.size() > 0) {
bean = caBeans.get(0);
- bean = getBeanForRunningCoordAction(bean);
return bean;
+
}
else {
throw new JPAExecutorException(ErrorCode.E0605, coordActionId);
}
}
-
- private CoordinatorActionBean getBeanForRunningCoordAction(CoordinatorActionBean a) {
- if (a != null) {
- CoordinatorActionBean action = new CoordinatorActionBean();
- action.setId(a.getId());
- action.setActionNumber(a.getActionNumber());
- action.setActionXml(a.getActionXml());
- action.setConsoleUrl(a.getConsoleUrl());
- action.setCreatedConf(a.getCreatedConf());
- action.setExternalStatus(a.getExternalStatus());
- action.setMissingDependencies(a.getMissingDependencies());
- action.setPushMissingDependencies(a.getPushMissingDependencies());
- action.setRunConf(a.getRunConf());
- action.setTimeOut(a.getTimeOut());
- action.setTrackerUri(a.getTrackerUri());
- action.setType(a.getType());
- action.setCreatedTime(a.getCreatedTime());
- action.setExternalId(a.getExternalId());
- action.setJobId(a.getJobId());
- action.setLastModifiedTime(a.getLastModifiedTime());
- action.setNominalTime(a.getNominalTime());
- action.setSlaXml(a.getSlaXml());
- action.setStatus(a.getStatus());
- action.setPending(a.getPending());
- action.setRerunTime(a.getRerunTime());
- return action;
- }
- return null;
- }
}
Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionQueryExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionQueryExecutor.java?rev=1521527&r1=1521526&r2=1521527&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionQueryExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionQueryExecutor.java Tue Sep 10 15:27:39 2013
@@ -73,14 +73,14 @@ public class CoordActionQueryExecutor ex
switch (namedQuery) {
case UPDATE_COORD_ACTION:
query.setParameter("actionNumber", actionBean.getActionNumber());
- query.setParameter("actionXml", actionBean.getActionXml());
+ query.setParameter("actionXml", actionBean.getActionXmlBlob());
query.setParameter("consoleUrl", actionBean.getConsoleUrl());
- query.setParameter("createdConf", actionBean.getCreatedConf());
+ query.setParameter("createdConf", actionBean.getCreatedConfBlob());
query.setParameter("errorCode", actionBean.getErrorCode());
query.setParameter("errorMessage", actionBean.getErrorMessage());
query.setParameter("externalStatus", actionBean.getExternalStatus());
- query.setParameter("missingDependencies", actionBean.getMissingDependencies());
- query.setParameter("runConf", actionBean.getRunConf());
+ query.setParameter("missingDependencies", actionBean.getMissingDependenciesBlob());
+ query.setParameter("runConf", actionBean.getRunConfBlob());
query.setParameter("timeOut", actionBean.getTimeOut());
query.setParameter("trackerUri", actionBean.getTrackerUri());
query.setParameter("type", actionBean.getType());
@@ -89,7 +89,7 @@ public class CoordActionQueryExecutor ex
query.setParameter("jobId", actionBean.getJobId());
query.setParameter("lastModifiedTime", new Date());
query.setParameter("nominalTime", actionBean.getNominalTimestamp());
- query.setParameter("slaXml", actionBean.getSlaXml());
+ query.setParameter("slaXml", actionBean.getSlaXmlBlob());
query.setParameter("status", actionBean.getStatus().toString());
query.setParameter("id", actionBean.getId());
break;
@@ -104,29 +104,29 @@ public class CoordActionQueryExecutor ex
case UPDATE_COORD_ACTION_FOR_INPUTCHECK:
query.setParameter("status", actionBean.getStatus().toString());
query.setParameter("lastModifiedTime", new Date());
- query.setParameter("actionXml", actionBean.getActionXml());
- query.setParameter("missingDependencies", actionBean.getMissingDependencies());
+ query.setParameter("actionXml", actionBean.getActionXmlBlob());
+ query.setParameter("missingDependencies", actionBean.getMissingDependenciesBlob());
query.setParameter("id", actionBean.getId());
break;
case UPDATE_COORD_ACTION_FOR_PUSH_INPUTCHECK:
query.setParameter("status", actionBean.getStatus().toString());
query.setParameter("lastModifiedTime", new Date());
- query.setParameter("actionXml", actionBean.getActionXml());
- query.setParameter("pushMissingDependencies", actionBean.getPushMissingDependencies());
+ query.setParameter("actionXml", actionBean.getActionXmlBlob());
+ query.setParameter("pushMissingDependencies", actionBean.getPushMissingDependenciesBlob());
query.setParameter("id", actionBean.getId());
break;
case UPDATE_COORD_ACTION_DEPENDENCIES:
- query.setParameter("missingDependencies", actionBean.getMissingDependencies());
- query.setParameter("pushMissingDependencies", actionBean.getPushMissingDependencies());
+ query.setParameter("missingDependencies", actionBean.getMissingDependenciesBlob());
+ query.setParameter("pushMissingDependencies", actionBean.getPushMissingDependenciesBlob());
query.setParameter("id", actionBean.getId());
break;
case UPDATE_COORD_ACTION_FOR_START:
query.setParameter("status", actionBean.getStatus().toString());
query.setParameter("lastModifiedTime", new Date());
- query.setParameter("runConf", actionBean.getRunConf());
+ query.setParameter("runConf", actionBean.getRunConfBlob());
query.setParameter("externalId", actionBean.getExternalId());
query.setParameter("pending", actionBean.getPending());
query.setParameter("errorCode", actionBean.getErrorCode());
@@ -140,7 +140,7 @@ public class CoordActionQueryExecutor ex
break;
case UPDATE_COORD_ACTION_RERUN:
- query.setParameter("actionXml", actionBean.getActionXml());
+ query.setParameter("actionXml", actionBean.getActionXmlBlob());
query.setParameter("status", actionBean.getStatusStr());
query.setParameter("externalId", actionBean.getExternalId());
query.setParameter("externalStatus", actionBean.getExternalStatus());
@@ -161,13 +161,14 @@ public class CoordActionQueryExecutor ex
public Query getSelectQuery(CoordActionQuery namedQuery, EntityManager em, Object... parameters)
throws JPAExecutorException {
Query query = em.createNamedQuery(namedQuery.name());
- switch (namedQuery) {
+ CoordActionQuery caQuery = (CoordActionQuery) namedQuery;
+ switch (caQuery) {
case GET_COORD_ACTION:
query.setParameter("id", parameters[0]);
break;
default:
throw new JPAExecutorException(ErrorCode.E0603, "QueryExecutor cannot set parameters for "
- + namedQuery.name());
+ + caQuery.name());
}
return query;
}
Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionsGetForRecoveryJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionsGetForRecoveryJPAExecutor.java?rev=1521527&r1=1521526&r2=1521527&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionsGetForRecoveryJPAExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionsGetForRecoveryJPAExecutor.java Tue Sep 10 15:27:39 2013
@@ -26,6 +26,7 @@ import javax.persistence.Query;
import org.apache.oozie.CoordinatorActionBean;
import org.apache.oozie.ErrorCode;
+import org.apache.oozie.StringBlob;
import org.apache.oozie.client.CoordinatorAction;
import org.apache.oozie.util.ParamChecker;
@@ -112,7 +113,7 @@ public class CoordActionsGetForRecoveryJ
bean.setExternalId((String) arr[3]);
}
if (arr[4] != null) {
- bean.setPushMissingDependencies((String) arr[4]);
+ bean.setPushMissingDependenciesBlob((StringBlob) arr[4]);
}
return bean;
}
Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionForNominalTimeJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionForNominalTimeJPAExecutor.java?rev=1521527&r1=1521526&r2=1521527&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionForNominalTimeJPAExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionForNominalTimeJPAExecutor.java Tue Sep 10 15:27:39 2013
@@ -6,9 +6,9 @@
* 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.
@@ -64,32 +64,7 @@ public class CoordJobGetActionForNominal
else {
throw new JPAExecutorException(ErrorCode.E0605, DateUtils.formatDateOozieTZ(nominalTime));
}
- return getBeanForRunningCoordAction(action);
+ return action;
}
- private CoordinatorActionBean getBeanForRunningCoordAction(CoordinatorActionBean a) {
- if (a != null) {
- CoordinatorActionBean action = new CoordinatorActionBean();
- action.setId(a.getId());
- action.setActionNumber(a.getActionNumber());
- action.setActionXml(a.getActionXml());
- action.setConsoleUrl(a.getConsoleUrl());
- action.setCreatedConf(a.getCreatedConf());
- action.setExternalStatus(a.getExternalStatus());
- action.setMissingDependencies(a.getMissingDependencies());
- action.setRunConf(a.getRunConf());
- action.setTimeOut(a.getTimeOut());
- action.setTrackerUri(a.getTrackerUri());
- action.setType(a.getType());
- action.setCreatedTime(a.getCreatedTime());
- action.setExternalId(a.getExternalId());
- action.setJobId(a.getJobId());
- action.setLastModifiedTime(a.getLastModifiedTime());
- action.setNominalTime(a.getNominalTime());
- action.setSlaXml(a.getSlaXml());
- action.setStatus(a.getStatus());
- return action;
- }
- return null;
- }
}
Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionsForDatesJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionsForDatesJPAExecutor.java?rev=1521527&r1=1521526&r2=1521527&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionsForDatesJPAExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionsForDatesJPAExecutor.java Tue Sep 10 15:27:39 2013
@@ -6,9 +6,9 @@
* 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.
@@ -59,44 +59,11 @@ public class CoordJobGetActionsForDatesJ
q.setParameter("startTime", new Timestamp(startDate.getTime()));
q.setParameter("endTime", new Timestamp(endDate.getTime()));
actions = q.getResultList();
-
- List<CoordinatorActionBean> actionList = new ArrayList<CoordinatorActionBean>();
- for (CoordinatorActionBean a : actions) {
- CoordinatorActionBean aa = getBeanForRunningCoordAction(a);
- actionList.add(aa);
- }
- return actionList;
+ return actions;
}
catch (Exception e) {
throw new JPAExecutorException(ErrorCode.E0603, e.getMessage(), e);
- }
- }
-
- private CoordinatorActionBean getBeanForRunningCoordAction(CoordinatorActionBean a) {
- if (a != null) {
- CoordinatorActionBean action = new CoordinatorActionBean();
- action.setId(a.getId());
- action.setActionNumber(a.getActionNumber());
- action.setActionXml(a.getActionXml());
- action.setConsoleUrl(a.getConsoleUrl());
- action.setCreatedConf(a.getCreatedConf());
- //action.setErrorCode(a.getErrorCode());
- //action.setErrorMessage(a.getErrorMessage());
- action.setExternalStatus(a.getExternalStatus());
- action.setMissingDependencies(a.getMissingDependencies());
- action.setRunConf(a.getRunConf());
- action.setTimeOut(a.getTimeOut());
- action.setTrackerUri(a.getTrackerUri());
- action.setType(a.getType());
- action.setCreatedTime(a.getCreatedTime());
- action.setExternalId(a.getExternalId());
- action.setJobId(a.getJobId());
- action.setLastModifiedTime(a.getLastModifiedTime());
- action.setNominalTime(a.getNominalTime());
- action.setSlaXml(a.getSlaXml());
- action.setStatus(a.getStatus());
- return action;
}
- return null;
}
+
}
Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionsNotCompletedJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionsNotCompletedJPAExecutor.java?rev=1521527&r1=1521526&r2=1521527&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionsNotCompletedJPAExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionsNotCompletedJPAExecutor.java Tue Sep 10 15:27:39 2013
@@ -26,6 +26,7 @@ import javax.persistence.Query;
import org.apache.oozie.CoordinatorActionBean;
import org.apache.oozie.ErrorCode;
+import org.apache.oozie.StringBlob;
import org.apache.oozie.client.CoordinatorAction;
import org.apache.oozie.util.DateUtils;
import org.apache.oozie.util.ParamChecker;
@@ -93,7 +94,7 @@ public class CoordJobGetActionsNotComple
bean.setExternalId((String) arr[3]);
}
if (arr[4] != null) {
- bean.setPushMissingDependencies((String) arr[4]);
+ bean.setPushMissingDependenciesBlob((StringBlob) arr[4]);
}
if (arr[5] != null){
bean.setNominalTime(DateUtils.toDate((Timestamp) arr[5]));
Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionsSubsetJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionsSubsetJPAExecutor.java?rev=1521527&r1=1521526&r2=1521527&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionsSubsetJPAExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionsSubsetJPAExecutor.java Tue Sep 10 15:27:39 2013
@@ -26,6 +26,7 @@ import javax.persistence.Query;
import org.apache.oozie.CoordinatorActionBean;
import org.apache.oozie.ErrorCode;
+import org.apache.oozie.StringBlob;
import org.apache.oozie.client.CoordinatorAction;
import org.apache.oozie.service.Services;
import org.apache.oozie.util.DateUtils;
@@ -79,12 +80,7 @@ public class CoordJobGetActionsSubsetJPA
} else {
Query q = em.createNamedQuery("GET_ALL_COLS_FOR_ACTIONS_FOR_COORD_JOB_ORDER_BY_NOMINAL_TIME");
q = setQueryParameters(q, em);
- List<CoordinatorActionBean> caActions = q.getResultList();
-
- for (CoordinatorActionBean a : caActions) {
- CoordinatorActionBean aa = getBeanForCoordAction(a);
- actionList.add(aa);
- }
+ actionList = q.getResultList();
}
}
catch (Exception e) {
@@ -131,33 +127,6 @@ public class CoordJobGetActionsSubsetJPA
return sb;
}
- private CoordinatorActionBean getBeanForCoordAction(CoordinatorActionBean a){
- if (a != null) {
- CoordinatorActionBean action = new CoordinatorActionBean();
- action.setId(a.getId());
- action.setActionNumber(a.getActionNumber());
- action.setActionXml(a.getActionXml());
- action.setConsoleUrl(a.getConsoleUrl());
- action.setCreatedConf(a.getCreatedConf());
- action.setExternalStatus(a.getExternalStatus());
- action.setMissingDependencies(a.getMissingDependencies());
- action.setPushMissingDependencies(a.getPushMissingDependencies());
- action.setRunConf(a.getRunConf());
- action.setTimeOut(a.getTimeOut());
- action.setTrackerUri(a.getTrackerUri());
- action.setType(a.getType());
- action.setCreatedTime(a.getCreatedTime());
- action.setExternalId(a.getExternalId());
- action.setJobId(a.getJobId());
- action.setLastModifiedTime(a.getLastModifiedTime());
- action.setNominalTime(a.getNominalTime());
- action.setSlaXml(a.getSlaXml());
- action.setStatus(a.getStatus());
- return action;
- }
- return null;
- }
-
private CoordinatorActionBean getBeanForRunningCoordAction(Object arr[]) {
CoordinatorActionBean bean = new CoordinatorActionBean();
if (arr[0] != null) {
@@ -200,10 +169,10 @@ public class CoordJobGetActionsSubsetJPA
bean.setLastModifiedTime(DateUtils.toDate((Timestamp) arr[12]));
}
if (arr[13] != null) {
- bean.setMissingDependencies((String) arr[13]);
+ bean.setMissingDependenciesBlob((StringBlob) arr[13]);
}
if (arr[14] != null) {
- bean.setPushMissingDependencies((String) arr[14]);
+ bean.setPushMissingDependenciesBlob((StringBlob) arr[14]);
}
if (arr[15] != null) {
bean.setTimeOut((Integer) arr[15]);
Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobQueryExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobQueryExecutor.java?rev=1521527&r1=1521526&r2=1521527&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobQueryExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobQueryExecutor.java Tue Sep 10 15:27:39 2013
@@ -78,7 +78,7 @@ public class CoordJobQueryExecutor exten
query.setParameter("appName", cjBean.getAppName());
query.setParameter("appPath", cjBean.getAppPath());
query.setParameter("concurrency", cjBean.getConcurrency());
- query.setParameter("conf", cjBean.getConf());
+ query.setParameter("conf", cjBean.getConfBlob());
query.setParameter("externalId", cjBean.getExternalId());
query.setParameter("frequency", cjBean.getFrequency());
query.setParameter("lastActionNumber", cjBean.getLastActionNumber());
@@ -87,12 +87,12 @@ public class CoordJobQueryExecutor exten
query.setParameter("createdTime", cjBean.getCreatedTimestamp());
query.setParameter("endTime", cjBean.getEndTimestamp());
query.setParameter("execution", cjBean.getExecution());
- query.setParameter("jobXml", cjBean.getJobXml());
+ query.setParameter("jobXml", cjBean.getJobXmlBlob());
query.setParameter("lastAction", cjBean.getLastActionTimestamp());
query.setParameter("lastModifiedTime", cjBean.getLastModifiedTimestamp());
query.setParameter("nextMaterializedTime", cjBean.getNextMaterializedTimestamp());
- query.setParameter("origJobXml", cjBean.getOrigJobXml());
- query.setParameter("slaXml", cjBean.getSlaXml());
+ query.setParameter("origJobXml", cjBean.getOrigJobXmlBlob());
+ query.setParameter("slaXml", cjBean.getSlaXmlBlob());
query.setParameter("startTime", cjBean.getStartTimestamp());
query.setParameter("status", cjBean.getStatus().toString());
query.setParameter("timeUnit", cjBean.getTimeUnitStr());
Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobsGetPausedJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobsGetPausedJPAExecutor.java?rev=1521527&r1=1521526&r2=1521527&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobsGetPausedJPAExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobsGetPausedJPAExecutor.java Tue Sep 10 15:27:39 2013
@@ -6,9 +6,9 @@
* 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.
@@ -45,20 +45,16 @@ public class CoordJobsGetPausedJPAExecut
@SuppressWarnings("unchecked")
public List<CoordinatorJobBean> execute(EntityManager em) throws JPAExecutorException {
List<CoordinatorJobBean> cjBeans;
- List<CoordinatorJobBean> jobList = new ArrayList<CoordinatorJobBean>();
try {
Query q = em.createNamedQuery("GET_COORD_JOBS_PAUSED");
if (limit > 0) {
q.setMaxResults(limit);
}
cjBeans = q.getResultList();
- for (CoordinatorJobBean j : cjBeans) {
- jobList.add(j);
- }
}
catch (Exception e) {
throw new JPAExecutorException(ErrorCode.E0603, e.getMessage(), e);
}
- return jobList;
+ return cjBeans;
}
}
Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobsGetPendingJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobsGetPendingJPAExecutor.java?rev=1521527&r1=1521526&r2=1521527&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobsGetPendingJPAExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobsGetPendingJPAExecutor.java Tue Sep 10 15:27:39 2013
@@ -6,9 +6,9 @@
* 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.
@@ -51,20 +51,16 @@ public class CoordJobsGetPendingJPAExecu
@SuppressWarnings("unchecked")
public List<CoordinatorJobBean> execute(EntityManager em) throws JPAExecutorException {
List<CoordinatorJobBean> coordBeans;
- List<CoordinatorJobBean> jobList = new ArrayList<CoordinatorJobBean>();
try {
Query q = em.createNamedQuery("GET_COORD_JOBS_PENDING");
if (limit > 0) {
q.setMaxResults(limit);
}
coordBeans = q.getResultList();
- for (CoordinatorJobBean j : coordBeans) {
- jobList.add(j);
- }
}
catch (Exception e) {
throw new JPAExecutorException(ErrorCode.E0603, e.getMessage(), e);
}
- return jobList;
+ return coordBeans;
}
}
Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobsGetUnpausedJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobsGetUnpausedJPAExecutor.java?rev=1521527&r1=1521526&r2=1521527&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobsGetUnpausedJPAExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobsGetUnpausedJPAExecutor.java Tue Sep 10 15:27:39 2013
@@ -6,9 +6,9 @@
* 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.
@@ -45,20 +45,16 @@ public class CoordJobsGetUnpausedJPAExec
@SuppressWarnings("unchecked")
public List<CoordinatorJobBean> execute(EntityManager em) throws JPAExecutorException {
List<CoordinatorJobBean> cjBeans;
- List<CoordinatorJobBean> jobList = new ArrayList<CoordinatorJobBean>();
try {
Query q = em.createNamedQuery("GET_COORD_JOBS_UNPAUSED");
if (limit > 0) {
q.setMaxResults(limit);
}
cjBeans = q.getResultList();
- for (CoordinatorJobBean j : cjBeans) {
- jobList.add(j);
- }
}
catch (Exception e) {
throw new JPAExecutorException(ErrorCode.E0603, e.getMessage(), e);
}
- return jobList;
+ return cjBeans;
}
}
Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobsToBeMaterializedJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobsToBeMaterializedJPAExecutor.java?rev=1521527&r1=1521526&r2=1521527&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobsToBeMaterializedJPAExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobsToBeMaterializedJPAExecutor.java Tue Sep 10 15:27:39 2013
@@ -6,9 +6,9 @@
* 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.
@@ -36,7 +36,6 @@ public class CoordJobsToBeMaterializedJP
private Date dateInput;
private int limit;
- private List<CoordinatorJobBean> jobList;
/**
* @param date
@@ -46,7 +45,6 @@ public class CoordJobsToBeMaterializedJP
ParamChecker.notNull(date, "Coord Job Materialization Date");
this.dateInput = date;
this.limit = limit;
- jobList = new ArrayList<CoordinatorJobBean>();
}
/* (non-Javadoc)
@@ -55,6 +53,7 @@ public class CoordJobsToBeMaterializedJP
@SuppressWarnings("unchecked")
@Override
public List<CoordinatorJobBean> execute(EntityManager em) throws JPAExecutorException {
+ List<CoordinatorJobBean> cjBeans;
try {
Query q = em.createNamedQuery("GET_COORD_JOBS_OLDER_THAN");
q.setParameter("matTime", new Timestamp(this.dateInput.getTime()));
@@ -62,16 +61,12 @@ public class CoordJobsToBeMaterializedJP
q.setMaxResults(limit);
}
- List<CoordinatorJobBean> cjBeans = q.getResultList();
- // copy results to a new object
- for (CoordinatorJobBean j : cjBeans) {
- jobList.add(j);
- }
+ cjBeans = q.getResultList();
}
catch (IllegalStateException e) {
throw new JPAExecutorException(ErrorCode.E0601, e.getMessage(), e);
}
- return jobList;
+ return cjBeans;
}
@Override
Added: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/StringBlobValueHandler.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/StringBlobValueHandler.java?rev=1521527&view=auto
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/StringBlobValueHandler.java (added)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/StringBlobValueHandler.java Tue Sep 10 15:27:39 2013
@@ -0,0 +1,49 @@
+/**
+ * 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.executor.jpa;
+
+import org.apache.oozie.StringBlob;
+import org.apache.openjpa.jdbc.kernel.JDBCStore;
+import org.apache.openjpa.jdbc.meta.ValueMapping;
+
+@SuppressWarnings("serial")
+public class StringBlobValueHandler extends org.apache.openjpa.jdbc.meta.strats.ByteArrayValueHandler {
+
+ private static final StringBlobValueHandler _instance = new StringBlobValueHandler();
+
+ /**
+ * Singleton instance.
+ */
+ public static StringBlobValueHandler getInstance() {
+ return _instance;
+ }
+
+ public Object toDataStoreValue(ValueMapping vm, Object val, JDBCStore store) {
+ if (val == null) {
+ return null;
+ }
+ return ((StringBlob) val).getRawBlob();
+ }
+
+ public Object toObjectValue(ValueMapping vm, Object val) {
+ if (val == null) {
+ return null;
+ }
+ return new StringBlob((byte[]) val);
+ }
+}
Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionGetJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionGetJPAExecutor.java?rev=1521527&r1=1521526&r2=1521527&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionGetJPAExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionGetJPAExecutor.java Tue Sep 10 15:27:39 2013
@@ -6,9 +6,9 @@
* 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.
@@ -25,6 +25,7 @@ import javax.persistence.Query;
import org.apache.oozie.ErrorCode;
import org.apache.oozie.WorkflowActionBean;
import org.apache.oozie.util.ParamChecker;
+import org.apache.oozie.util.XLog;
/**
* Load the WorkflowAction into a Bean and return it.
@@ -64,51 +65,10 @@ public class WorkflowActionGetJPAExecuto
WorkflowActionBean bean = null;
if (waBeans != null && waBeans.size() > 0) {
bean = waBeans.get(0);
- bean = getBeanForRunningAction(bean);
return bean;
}
else {
throw new JPAExecutorException(ErrorCode.E0605, wfActionId);
}
}
-
- private WorkflowActionBean getBeanForRunningAction(WorkflowActionBean a) {
- if (a != null) {
- WorkflowActionBean action = new WorkflowActionBean();
- action.setId(a.getId());
- action.setConf(a.getConf());
- action.setConsoleUrl(a.getConsoleUrl());
- action.setData(a.getData());
- action.setStats(a.getStats());
- action.setExternalChildIDs(a.getExternalChildIDs());
- action.setErrorInfo(a.getErrorCode(), a.getErrorMessage());
- action.setExternalId(a.getExternalId());
- action.setExternalStatus(a.getExternalStatus());
- action.setName(a.getName());
- action.setCred(a.getCred());
- action.setRetries(a.getRetries());
- action.setTrackerUri(a.getTrackerUri());
- action.setTransition(a.getTransition());
- action.setType(a.getType());
- action.setEndTime(a.getEndTime());
- action.setExecutionPath(a.getExecutionPath());
- action.setLastCheckTime(a.getLastCheckTime());
- action.setLogToken(a.getLogToken());
- if (a.isPending() == true) {
- action.setPending();
- }
- action.setPendingAge(a.getPendingAge());
- action.setSignalValue(a.getSignalValue());
- action.setSlaXml(a.getSlaXml());
- action.setStartTime(a.getStartTime());
- action.setStatus(a.getStatus());
- action.setJobId(a.getWfId());
- action.setUserRetryCount(a.getUserRetryCount());
- action.setUserRetryInterval(a.getUserRetryInterval());
- action.setUserRetryMax(a.getUserRetryMax());
- return action;
- }
- return null;
- }
-
}
Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionQueryExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionQueryExecutor.java?rev=1521527&r1=1521526&r2=1521527&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionQueryExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionQueryExecutor.java Tue Sep 10 15:27:39 2013
@@ -72,11 +72,11 @@ public class WorkflowActionQueryExecutor
Query query = em.createNamedQuery(namedQuery.name());
switch (namedQuery) {
case UPDATE_ACTION:
- query.setParameter("conf", actionBean.getConf());
+ query.setParameter("conf", actionBean.getConfBlob());
query.setParameter("consoleUrl", actionBean.getConsoleUrl());
- query.setParameter("data", actionBean.getData());
- query.setParameter("stats", actionBean.getStats());
- query.setParameter("externalChildIDs", actionBean.getExternalChildIDs());
+ query.setParameter("data", actionBean.getDataBlob());
+ query.setParameter("stats", actionBean.getStatsBlob());
+ query.setParameter("externalChildIDs", actionBean.getExternalChildIDsBlob());
query.setParameter("errorCode", actionBean.getErrorCode());
query.setParameter("errorMessage", actionBean.getErrorMessage());
query.setParameter("externalId", actionBean.getExternalId());
@@ -94,7 +94,7 @@ public class WorkflowActionQueryExecutor
query.setParameter("pending", actionBean.getPending());
query.setParameter("pendingAge", actionBean.getPendingAgeTimestamp());
query.setParameter("signalValue", actionBean.getSignalValue());
- query.setParameter("slaXml", actionBean.getSlaXml());
+ query.setParameter("slaXml", actionBean.getSlaXmlBlob());
query.setParameter("startTime", actionBean.getStartTimestamp());
query.setParameter("status", actionBean.getStatusStr());
query.setParameter("wfId", actionBean.getWfId());
@@ -127,8 +127,8 @@ public class WorkflowActionQueryExecutor
break;
case UPDATE_ACTION_START:
query.setParameter("startTime", actionBean.getStartTimestamp());
- query.setParameter("externalChildIDs", actionBean.getExternalChildIDs());
- query.setParameter("conf", actionBean.getConf());
+ query.setParameter("externalChildIDs", actionBean.getExternalChildIDsBlob());
+ query.setParameter("conf", actionBean.getConfBlob());
query.setParameter("errorCode", actionBean.getErrorCode());
query.setParameter("errorMessage", actionBean.getErrorMessage());
query.setParameter("externalId", actionBean.getExternalId());
@@ -137,7 +137,7 @@ public class WorkflowActionQueryExecutor
query.setParameter("lastCheckTime", actionBean.getLastCheckTimestamp());
query.setParameter("status", actionBean.getStatus().toString());
query.setParameter("externalStatus", actionBean.getExternalStatus());
- query.setParameter("data", actionBean.getData());
+ query.setParameter("data", actionBean.getDataBlob());
query.setParameter("retries", actionBean.getRetries());
query.setParameter("pending", actionBean.getPending());
query.setParameter("pendingAge", actionBean.getPendingAgeTimestamp());
@@ -145,10 +145,10 @@ public class WorkflowActionQueryExecutor
query.setParameter("id", actionBean.getId());
break;
case UPDATE_ACTION_CHECK:
- query.setParameter("externalChildIDs", actionBean.getExternalChildIDs());
+ query.setParameter("externalChildIDs", actionBean.getExternalChildIDsBlob());
query.setParameter("externalStatus", actionBean.getExternalStatus());
query.setParameter("status", actionBean.getStatus().toString());
- query.setParameter("data", actionBean.getData());
+ query.setParameter("data", actionBean.getDataBlob());
query.setParameter("pending", actionBean.getPending());
query.setParameter("errorCode", actionBean.getErrorCode());
query.setParameter("errorMessage", actionBean.getErrorMessage());
@@ -182,13 +182,14 @@ public class WorkflowActionQueryExecutor
public Query getSelectQuery(WorkflowActionQuery namedQuery, EntityManager em, Object... parameters)
throws JPAExecutorException {
Query query = em.createNamedQuery(namedQuery.name());
- switch (namedQuery) {
+ WorkflowActionQuery waQuery = (WorkflowActionQuery) namedQuery;
+ switch (waQuery) {
case GET_ACTION:
query.setParameter("id", parameters[0]);
break;
default:
throw new JPAExecutorException(ErrorCode.E0603, "QueryExecutor cannot set parameters for "
- + namedQuery.name());
+ + waQuery.name());
}
return query;
}
Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionSubsetGetJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionSubsetGetJPAExecutor.java?rev=1521527&r1=1521526&r2=1521527&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionSubsetGetJPAExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionSubsetGetJPAExecutor.java Tue Sep 10 15:27:39 2013
@@ -6,9 +6,9 @@
* 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.
@@ -68,15 +68,11 @@ public class WorkflowActionSubsetGetJPAE
q.setFirstResult(start - 1);
q.setMaxResults(length);
actions = q.getResultList();
- for (WorkflowActionBean a : actions) {
- WorkflowActionBean aa = getBeanForRunningAction(a);
- actionList.add(aa);
- }
}
catch (Exception e) {
throw new JPAExecutorException(ErrorCode.E0605, "null", e);
}
- return actionList;
+ return actions;
}
/* (non-Javadoc)
@@ -86,40 +82,4 @@ public class WorkflowActionSubsetGetJPAE
public String getName() {
return "WorkflowActionSubsetGetJPAExecutor";
}
-
- private WorkflowActionBean getBeanForRunningAction(WorkflowActionBean a) throws SQLException {
- if (a != null) {
- WorkflowActionBean action = new WorkflowActionBean();
- action.setId(a.getId());
- action.setConf(a.getConf());
- action.setConsoleUrl(a.getConsoleUrl());
- action.setData(a.getData());
- action.setStats(a.getStats());
- action.setExternalChildIDs(a.getExternalChildIDs());
- action.setErrorInfo(a.getErrorCode(), a.getErrorMessage());
- action.setExternalId(a.getExternalId());
- action.setExternalStatus(a.getExternalStatus());
- action.setName(a.getName());
- action.setCred(a.getCred());
- action.setRetries(a.getRetries());
- action.setTrackerUri(a.getTrackerUri());
- action.setTransition(a.getTransition());
- action.setType(a.getType());
- action.setEndTime(a.getEndTime());
- action.setExecutionPath(a.getExecutionPath());
- action.setLastCheckTime(a.getLastCheckTime());
- action.setLogToken(a.getLogToken());
- if (a.isPending() == true) {
- action.setPending();
- }
- action.setPendingAge(a.getPendingAge());
- action.setSignalValue(a.getSignalValue());
- action.setSlaXml(a.getSlaXml());
- action.setStartTime(a.getStartTime());
- action.setStatus(a.getStatus());
- action.setJobId(a.getWfId());
- return action;
- }
- return null;
- }
}
Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionsGetForJobJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionsGetForJobJPAExecutor.java?rev=1521527&r1=1521526&r2=1521527&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionsGetForJobJPAExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionsGetForJobJPAExecutor.java Tue Sep 10 15:27:39 2013
@@ -6,9 +6,9 @@
* 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.
@@ -55,59 +55,14 @@ public class WorkflowActionsGetForJobJPA
@SuppressWarnings("unchecked")
public List<WorkflowActionBean> execute(EntityManager em) throws JPAExecutorException {
List<WorkflowActionBean> actions;
- List<WorkflowActionBean> actionList = new ArrayList<WorkflowActionBean>();
try {
Query q = em.createNamedQuery("GET_ACTIONS_FOR_WORKFLOW");
q.setParameter("wfId", wfJobId);
actions = q.getResultList();
- for (WorkflowActionBean a : actions) {
- WorkflowActionBean aa = getBeanForRunningAction(a);
- actionList.add(aa);
- }
}
- catch (SQLException e) {
+ catch (Exception e) {
throw new JPAExecutorException(ErrorCode.E0603, e.getMessage(), e);
}
- return actionList;
+ return actions;
}
-
- private WorkflowActionBean getBeanForRunningAction(WorkflowActionBean a) throws SQLException {
- if (a != null) {
- WorkflowActionBean action = new WorkflowActionBean();
- action.setId(a.getId());
- action.setConf(a.getConf());
- action.setConsoleUrl(a.getConsoleUrl());
- action.setData(a.getData());
- action.setStats(a.getStats());
- action.setExternalChildIDs(a.getExternalChildIDs());
- action.setErrorInfo(a.getErrorCode(), a.getErrorMessage());
- action.setExternalId(a.getExternalId());
- action.setExternalStatus(a.getExternalStatus());
- action.setName(a.getName());
- action.setCred(a.getCred());
- action.setRetries(a.getRetries());
- action.setTrackerUri(a.getTrackerUri());
- action.setTransition(a.getTransition());
- action.setType(a.getType());
- action.setEndTime(a.getEndTime());
- action.setExecutionPath(a.getExecutionPath());
- action.setLastCheckTime(a.getLastCheckTime());
- action.setLogToken(a.getLogToken());
- if (a.isPending() == true) {
- action.setPending();
- }
- action.setPendingAge(a.getPendingAge());
- action.setSignalValue(a.getSignalValue());
- action.setSlaXml(a.getSlaXml());
- action.setStartTime(a.getStartTime());
- action.setStatus(a.getStatus());
- action.setJobId(a.getWfId());
- action.setUserRetryCount(a.getUserRetryCount());
- action.setUserRetryInterval(a.getUserRetryInterval());
- action.setUserRetryMax(a.getUserRetryMax());
- return action;
- }
- return null;
- }
-
}
Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionsRunningGetJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionsRunningGetJPAExecutor.java?rev=1521527&r1=1521526&r2=1521527&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionsRunningGetJPAExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionsRunningGetJPAExecutor.java Tue Sep 10 15:27:39 2013
@@ -6,9 +6,9 @@
* 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.
@@ -45,21 +45,16 @@ public class WorkflowActionsRunningGetJP
@SuppressWarnings("unchecked")
public List<WorkflowActionBean> execute(EntityManager em) throws JPAExecutorException {
List<WorkflowActionBean> actions;
- List<WorkflowActionBean> actionList = new ArrayList<WorkflowActionBean>();
try {
Timestamp ts = new Timestamp(System.currentTimeMillis() - checkAgeSecs * 1000);
Query q = em.createNamedQuery("GET_RUNNING_ACTIONS");
q.setParameter("lastCheckTime", ts);
actions = q.getResultList();
- for (WorkflowActionBean a : actions) {
- WorkflowActionBean aa = getBeanForRunningAction(a);
- actionList.add(aa);
- }
- }
+ }
catch (Exception e) {
throw new JPAExecutorException(ErrorCode.E0605, "null", e);
}
- return actionList;
+ return actions;
}
/* (non-Javadoc)
@@ -70,48 +65,4 @@ public class WorkflowActionsRunningGetJP
return "WorkflowActionsRunningGetJPAExecutor";
}
- /**
- * Re-create workflow action bean
- *
- * @param bean
- * @return workflow action bean
- */
- private WorkflowActionBean getBeanForRunningAction(WorkflowActionBean bean){
- if (bean != null) {
- WorkflowActionBean action = new WorkflowActionBean();
- action.setId(bean.getId());
- action.setConf(bean.getConf());
- action.setConsoleUrl(bean.getConsoleUrl());
- action.setData(bean.getData());
- action.setStats(bean.getStats());
- action.setExternalChildIDs(bean.getExternalChildIDs());
- action.setErrorInfo(bean.getErrorCode(), bean.getErrorMessage());
- action.setExternalId(bean.getExternalId());
- action.setExternalStatus(bean.getExternalStatus());
- action.setName(bean.getName());
- action.setCred(bean.getCred());
- action.setRetries(bean.getRetries());
- action.setTrackerUri(bean.getTrackerUri());
- action.setTransition(bean.getTransition());
- action.setType(bean.getType());
- action.setEndTime(bean.getEndTime());
- action.setExecutionPath(bean.getExecutionPath());
- action.setLastCheckTime(bean.getLastCheckTime());
- action.setLogToken(bean.getLogToken());
- if (bean.isPending() == true) {
- action.setPending();
- }
- action.setPendingAge(bean.getPendingAge());
- action.setSignalValue(bean.getSignalValue());
- action.setSlaXml(bean.getSlaXml());
- action.setStartTime(bean.getStartTime());
- action.setStatus(bean.getStatus());
- action.setJobId(bean.getWfId());
- action.setUserRetryCount(bean.getUserRetryCount());
- action.setUserRetryInterval(bean.getUserRetryInterval());
- action.setUserRetryMax(bean.getUserRetryMax());
- return action;
- }
- return null;
- }
}
Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowJobGetActionsJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowJobGetActionsJPAExecutor.java?rev=1521527&r1=1521526&r2=1521527&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowJobGetActionsJPAExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowJobGetActionsJPAExecutor.java Tue Sep 10 15:27:39 2013
@@ -6,9 +6,9 @@
* 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.
@@ -17,8 +17,6 @@
*/
package org.apache.oozie.executor.jpa;
-import java.sql.SQLException;
-import java.util.ArrayList;
import java.util.List;
import javax.persistence.EntityManager;
@@ -49,59 +47,15 @@ public class WorkflowJobGetActionsJPAExe
@SuppressWarnings("unchecked")
public List<WorkflowActionBean> execute(EntityManager em) throws JPAExecutorException {
List<WorkflowActionBean> actions;
- List<WorkflowActionBean> actionList = new ArrayList<WorkflowActionBean>();
try {
Query q = em.createNamedQuery("GET_ACTIONS_FOR_WORKFLOW");
q.setParameter("wfId", wfJobId);
actions = q.getResultList();
- for (WorkflowActionBean a : actions) {
- WorkflowActionBean aa = getBeanForRunningAction(a);
- actionList.add(aa);
- }
+
}
- catch (SQLException e) {
+ catch (Exception e) {
throw new JPAExecutorException(ErrorCode.E0603, e.getMessage(), e);
}
- return actionList;
+ return actions;
}
-
- private WorkflowActionBean getBeanForRunningAction(WorkflowActionBean a) throws SQLException {
- if (a != null) {
- WorkflowActionBean action = new WorkflowActionBean();
- action.setId(a.getId());
- action.setConf(a.getConf());
- action.setConsoleUrl(a.getConsoleUrl());
- action.setData(a.getData());
- action.setStats(a.getStats());
- action.setExternalChildIDs(a.getExternalChildIDs());
- action.setErrorInfo(a.getErrorCode(), a.getErrorMessage());
- action.setExternalId(a.getExternalId());
- action.setExternalStatus(a.getExternalStatus());
- action.setName(a.getName());
- action.setCred(a.getCred());
- action.setRetries(a.getRetries());
- action.setTrackerUri(a.getTrackerUri());
- action.setTransition(a.getTransition());
- action.setType(a.getType());
- action.setEndTime(a.getEndTime());
- action.setExecutionPath(a.getExecutionPath());
- action.setLastCheckTime(a.getLastCheckTime());
- action.setLogToken(a.getLogToken());
- if (a.isPending() == true) {
- action.setPending();
- }
- action.setPendingAge(a.getPendingAge());
- action.setSignalValue(a.getSignalValue());
- action.setSlaXml(a.getSlaXml());
- action.setStartTime(a.getStartTime());
- action.setStatus(a.getStatus());
- action.setJobId(a.getWfId());
- action.setUserRetryCount(a.getUserRetryCount());
- action.setUserRetryInterval(a.getUserRetryInterval());
- action.setUserRetryMax(a.getUserRetryMax());
- return action;
- }
- return null;
- }
-
}
Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowJobQueryExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowJobQueryExecutor.java?rev=1521527&r1=1521526&r2=1521527&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowJobQueryExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowJobQueryExecutor.java Tue Sep 10 15:27:39 2013
@@ -74,7 +74,7 @@ public class WorkflowJobQueryExecutor ex
case UPDATE_WORKFLOW:
query.setParameter("appName", wfBean.getAppName());
query.setParameter("appPath", wfBean.getAppPath());
- query.setParameter("conf", wfBean.getConf());
+ query.setParameter("conf", wfBean.getConfBlob());
query.setParameter("groupName", wfBean.getGroup());
query.setParameter("run", wfBean.getRun());
query.setParameter("user", wfBean.getUser());
@@ -83,11 +83,11 @@ public class WorkflowJobQueryExecutor ex
query.setParameter("externalId", wfBean.getExternalId());
query.setParameter("lastModTime", wfBean.getLastModifiedTimestamp());
query.setParameter("logToken", wfBean.getLogToken());
- query.setParameter("protoActionConf", wfBean.getProtoActionConf());
- query.setParameter("slaXml", wfBean.getSlaXml());
+ query.setParameter("protoActionConf", wfBean.getProtoActionConfBlob());
+ query.setParameter("slaXml", wfBean.getSlaXmlBlob());
query.setParameter("startTime", wfBean.getStartTimestamp());
query.setParameter("status", wfBean.getStatusStr());
- query.setParameter("wfInstance", wfBean.getWfInstance());
+ query.setParameter("wfInstance", wfBean.getWfInstanceBlob());
query.setParameter("id", wfBean.getId());
break;
case UPDATE_WORKFLOW_MODTIME:
@@ -106,20 +106,20 @@ public class WorkflowJobQueryExecutor ex
break;
case UPDATE_WORKFLOW_STATUS_INSTANCE_MODIFIED:
query.setParameter("status", wfBean.getStatus().toString());
- query.setParameter("wfInstance", wfBean.getWfInstance());
+ query.setParameter("wfInstance", wfBean.getWfInstanceBlob());
query.setParameter("lastModTime", wfBean.getLastModifiedTimestamp());
query.setParameter("id", wfBean.getId());
break;
case UPDATE_WORKFLOW_STATUS_INSTANCE_MOD_END:
query.setParameter("status", wfBean.getStatus().toString());
- query.setParameter("wfInstance", wfBean.getWfInstance());
+ query.setParameter("wfInstance", wfBean.getWfInstanceBlob());
query.setParameter("lastModTime", wfBean.getLastModifiedTimestamp());
query.setParameter("endTime", wfBean.getEndTimestamp());
query.setParameter("id", wfBean.getId());
break;
case UPDATE_WORKFLOW_STATUS_INSTANCE_MOD_START_END:
query.setParameter("status", wfBean.getStatus().toString());
- query.setParameter("wfInstance", wfBean.getWfInstance());
+ query.setParameter("wfInstance", wfBean.getWfInstanceBlob());
query.setParameter("lastModTime", wfBean.getLastModifiedTimestamp());
query.setParameter("startTime", wfBean.getStartTimestamp());
query.setParameter("endTime", wfBean.getEndTimestamp());
@@ -127,9 +127,9 @@ public class WorkflowJobQueryExecutor ex
break;
case UPDATE_WORKFLOW_RERUN:
query.setParameter("appName", wfBean.getAppName());
- query.setParameter("protoActionConf", wfBean.getProtoActionConf());
+ query.setParameter("protoActionConf", wfBean.getProtoActionConfBlob());
query.setParameter("appPath", wfBean.getAppPath());
- query.setParameter("conf", wfBean.getConf());
+ query.setParameter("conf", wfBean.getConfBlob());
query.setParameter("logToken", wfBean.getLogToken());
query.setParameter("user", wfBean.getUser());
query.setParameter("group", wfBean.getGroup());
@@ -137,7 +137,7 @@ public class WorkflowJobQueryExecutor ex
query.setParameter("endTime", wfBean.getEndTimestamp());
query.setParameter("run", wfBean.getRun());
query.setParameter("status", wfBean.getStatus().toString());
- query.setParameter("wfInstance", wfBean.getWfInstance());
+ query.setParameter("wfInstance", wfBean.getWfInstanceBlob());
query.setParameter("lastModTime", wfBean.getLastModifiedTimestamp());
query.setParameter("id", wfBean.getId());
break;
Modified: oozie/trunk/core/src/main/java/org/apache/oozie/service/JPAService.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/service/JPAService.java?rev=1521527&r1=1521526&r2=1521527&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/service/JPAService.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/service/JPAService.java Tue Sep 10 15:27:39 2013
@@ -42,6 +42,7 @@ import org.apache.oozie.WorkflowActionBe
import org.apache.oozie.WorkflowJobBean;
import org.apache.oozie.client.rest.JsonBean;
import org.apache.oozie.client.rest.JsonSLAEvent;
+import org.apache.oozie.compression.CodecFactory;
import org.apache.oozie.executor.jpa.JPAExecutor;
import org.apache.oozie.executor.jpa.JPAExecutorException;
import org.apache.oozie.sla.SLARegistrationBean;
@@ -181,6 +182,12 @@ public class JPAService implements Servi
LOG.info("JPA configuration: {0}", logMsg);
entityManager.getTransaction().commit();
entityManager.close();
+ try {
+ CodecFactory.initialize(conf);
+ }
+ catch (Exception ex) {
+ throw new ServiceException(ErrorCode.E1700, ex);
+ }
}
/**
Modified: oozie/trunk/core/src/main/java/org/apache/oozie/store/CoordinatorStore.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/store/CoordinatorStore.java?rev=1521527&r1=1521526&r2=1521527&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/store/CoordinatorStore.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/store/CoordinatorStore.java Tue Sep 10 15:27:39 2013
@@ -434,53 +434,6 @@ public class CoordinatorStore extends St
}
}
- private void setJobQueryParameters(CoordinatorJobBean jBean, Query q) {
- q.setParameter("appName", jBean.getAppName());
- q.setParameter("appPath", jBean.getAppPath());
- q.setParameter("concurrency", jBean.getConcurrency());
- q.setParameter("conf", jBean.getConf());
- q.setParameter("externalId", jBean.getExternalId());
- q.setParameter("frequency", jBean.getFrequency());
- q.setParameter("lastActionNumber", jBean.getLastActionNumber());
- q.setParameter("timeOut", jBean.getTimeout());
- q.setParameter("timeZone", jBean.getTimeZone());
- q.setParameter("createdTime", jBean.getCreatedTimestamp());
- q.setParameter("endTime", jBean.getEndTimestamp());
- q.setParameter("execution", jBean.getExecution());
- q.setParameter("jobXml", jBean.getJobXml());
- q.setParameter("lastAction", jBean.getLastActionTimestamp());
- q.setParameter("lastModifiedTime", new Date());
- q.setParameter("nextMaterializedTime", jBean.getNextMaterializedTimestamp());
- q.setParameter("origJobXml", jBean.getOrigJobXml());
- q.setParameter("slaXml", jBean.getSlaXml());
- q.setParameter("startTime", jBean.getStartTimestamp());
- q.setParameter("status", jBean.getStatus().toString());
- q.setParameter("timeUnit", jBean.getTimeUnitStr());
- }
-
- private void setActionQueryParameters(CoordinatorActionBean aBean, Query q) {
- q.setParameter("actionNumber", aBean.getActionNumber());
- q.setParameter("actionXml", aBean.getActionXml());
- q.setParameter("consoleUrl", aBean.getConsoleUrl());
- q.setParameter("createdConf", aBean.getCreatedConf());
- q.setParameter("errorCode", aBean.getErrorCode());
- q.setParameter("errorMessage", aBean.getErrorMessage());
- q.setParameter("externalStatus", aBean.getExternalStatus());
- q.setParameter("missingDependencies", aBean.getMissingDependencies());
- q.setParameter("runConf", aBean.getRunConf());
- q.setParameter("timeOut", aBean.getTimeOut());
- q.setParameter("trackerUri", aBean.getTrackerUri());
- q.setParameter("type", aBean.getType());
- q.setParameter("createdTime", aBean.getCreatedTimestamp());
- q.setParameter("externalId", aBean.getExternalId());
- q.setParameter("jobId", aBean.getJobId());
- q.setParameter("lastModifiedTime", new Date());
- q.setParameter("nominalTime", aBean.getNominalTimestamp());
- q.setParameter("slaXml", aBean.getSlaXml());
- q.setParameter("status", aBean.getStatus().toString());
- }
-
-
/**
* Purge the coordinators completed older than given days.
*
@@ -695,31 +648,31 @@ public class CoordinatorStore extends St
* @throws StoreException
*/
public List<CoordinatorActionBean> getActionsSubsetForCoordinatorJob(final String jobId, final int start,
- final int len) throws StoreException {
+ final int len) throws StoreException {
ParamChecker.notEmpty(jobId, "CoordinatorJobID");
List<CoordinatorActionBean> actions = doOperation("getActionsForCoordinatorJob",
- new Callable<List<CoordinatorActionBean>>() {
- @SuppressWarnings("unchecked")
- public List<CoordinatorActionBean> call() throws StoreException {
- List<CoordinatorActionBean> actions;
- List<CoordinatorActionBean> actionList = new ArrayList<CoordinatorActionBean>();
- try {
- Query q = entityManager.createNamedQuery("GET_ACTIONS_FOR_COORD_JOB");
- q.setParameter("jobId", jobId);
- q.setFirstResult(start - 1);
- q.setMaxResults(len);
- actions = q.getResultList();
- for (CoordinatorActionBean a : actions) {
- CoordinatorActionBean aa = getBeanForRunningCoordAction(a);
- actionList.add(aa);
- }
- }
- catch (IllegalStateException e) {
- throw new StoreException(ErrorCode.E0601, e.getMessage(), e);
- }
- return actionList;
- }
- });
+ new Callable<List<CoordinatorActionBean>>() {
+ @SuppressWarnings("unchecked")
+ public List<CoordinatorActionBean> call() throws StoreException {
+ List<CoordinatorActionBean> actions;
+ List<CoordinatorActionBean> actionList = new ArrayList<CoordinatorActionBean>();
+ try {
+ Query q = entityManager.createNamedQuery("GET_ACTIONS_FOR_COORD_JOB");
+ q.setParameter("jobId", jobId);
+ q.setFirstResult(start - 1);
+ q.setMaxResults(len);
+ actions = q.getResultList();
+ for (CoordinatorActionBean a : actions) {
+ CoordinatorActionBean aa = getBeanForRunningCoordAction(a);
+ actionList.add(aa);
+ }
+ }
+ catch (IllegalStateException e) {
+ throw new StoreException(ErrorCode.E0601, e.getMessage(), e);
+ }
+ return actionList;
+ }
+ });
return actions;
}
@@ -728,14 +681,14 @@ public class CoordinatorStore extends St
CoordinatorActionBean action = new CoordinatorActionBean();
action.setId(a.getId());
action.setActionNumber(a.getActionNumber());
- action.setActionXml(a.getActionXml());
+ action.setActionXmlBlob(a.getActionXmlBlob());
action.setConsoleUrl(a.getConsoleUrl());
- action.setCreatedConf(a.getCreatedConf());
- //action.setErrorCode(a.getErrorCode());
- //action.setErrorMessage(a.getErrorMessage());
+ action.setCreatedConfBlob(a.getCreatedConfBlob());
+ // action.setErrorCode(a.getErrorCode());
+ // action.setErrorMessage(a.getErrorMessage());
action.setExternalStatus(a.getExternalStatus());
- action.setMissingDependencies(a.getMissingDependencies());
- action.setRunConf(a.getRunConf());
+ action.setMissingDependenciesBlob(a.getMissingDependenciesBlob());
+ action.setRunConfBlob(a.getRunConfBlob());
action.setTimeOut(a.getTimeOut());
action.setTrackerUri(a.getTrackerUri());
action.setType(a.getType());
@@ -744,7 +697,7 @@ public class CoordinatorStore extends St
action.setJobId(a.getJobId());
action.setLastModifiedTime(a.getLastModifiedTime());
action.setNominalTime(a.getNominalTime());
- action.setSlaXml(a.getSlaXml());
+ action.setSlaXmlBlob(a.getSlaXmlBlob());
action.setStatus(a.getStatus());
return action;
}
@@ -854,8 +807,7 @@ public class CoordinatorStore extends St
* @throws StoreException
*/
public List<CoordinatorActionBean> getCoordActionsForDates(final String jobId, final Date startDate,
- final Date endDate)
- throws StoreException {
+ final Date endDate) throws StoreException {
List<CoordinatorActionBean> actions = doOperation("getCoordActionsForDates",
new Callable<List<CoordinatorActionBean>>() {
@SuppressWarnings("unchecked")
@@ -867,7 +819,6 @@ public class CoordinatorStore extends St
q.setParameter("startTime", new Timestamp(startDate.getTime()));
q.setParameter("endTime", new Timestamp(endDate.getTime()));
actions = q.getResultList();
-
List<CoordinatorActionBean> actionList = new ArrayList<CoordinatorActionBean>();
for (CoordinatorActionBean a : actions) {
CoordinatorActionBean aa = getBeanForRunningCoordAction(a);
Modified: oozie/trunk/core/src/main/java/org/apache/oozie/store/WorkflowStore.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/store/WorkflowStore.java?rev=1521527&r1=1521526&r2=1521527&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/store/WorkflowStore.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/store/WorkflowStore.java Tue Sep 10 15:27:39 2013
@@ -861,7 +861,7 @@ public class WorkflowStore extends Store
wfBean.setId(w.getId());
wfBean.setAppName(w.getAppName());
wfBean.setAppPath(w.getAppPath());
- wfBean.setConf(w.getConf());
+ wfBean.setConfBlob(w.getConfBlob());
wfBean.setGroup(w.getGroup());
wfBean.setRun(w.getRun());
wfBean.setUser(w.getUser());
@@ -870,11 +870,11 @@ public class WorkflowStore extends Store
wfBean.setExternalId(w.getExternalId());
wfBean.setLastModifiedTime(w.getLastModifiedTime());
wfBean.setLogToken(w.getLogToken());
- wfBean.setProtoActionConf(w.getProtoActionConf());
- wfBean.setSlaXml(w.getSlaXml());
+ wfBean.setProtoActionConfBlob(w.getProtoActionConfBlob());
+ wfBean.setSlaXmlBlob(w.getSlaXmlBlob());
wfBean.setStartTime(w.getStartTime());
wfBean.setStatus(w.getStatus());
- wfBean.setWfInstance(w.getWfInstance());
+ wfBean.setWfInstanceBlob(w.getWfInstanceBlob());
return wfBean;
}
@@ -916,11 +916,11 @@ public class WorkflowStore extends Store
if (a != null) {
WorkflowActionBean action = new WorkflowActionBean();
action.setId(a.getId());
- action.setConf(a.getConf());
+ action.setConfBlob(a.getConfBlob());
action.setConsoleUrl(a.getConsoleUrl());
- action.setData(a.getData());
- action.setStats(a.getStats());
- action.setExternalChildIDs(a.getExternalChildIDs());
+ action.setDataBlob(a.getDataBlob());
+ action.setStatsBlob(a.getStatsBlob());
+ action.setExternalChildIDsBlob(a.getExternalChildIDsBlob());
action.setErrorInfo(a.getErrorCode(), a.getErrorMessage());
action.setExternalId(a.getExternalId());
action.setExternalStatus(a.getExternalStatus());
@@ -939,7 +939,7 @@ public class WorkflowStore extends Store
}
action.setPendingAge(a.getPendingAge());
action.setSignalValue(a.getSignalValue());
- action.setSlaXml(a.getSlaXml());
+ action.setSlaXmlBlob(a.getSlaXmlBlob());
action.setStartTime(a.getStartTime());
action.setStatus(a.getStatus());
action.setJobId(a.getWfId());
@@ -950,52 +950,4 @@ public class WorkflowStore extends Store
}
return null;
}
-
- private void setWFQueryParameters(WorkflowJobBean wfBean, Query q) {
- q.setParameter("appName", wfBean.getAppName());
- q.setParameter("appPath", wfBean.getAppPath());
- q.setParameter("conf", wfBean.getConf());
- q.setParameter("groupName", wfBean.getGroup());
- q.setParameter("run", wfBean.getRun());
- q.setParameter("user", wfBean.getUser());
- q.setParameter("createdTime", wfBean.getCreatedTimestamp());
- q.setParameter("endTime", wfBean.getEndTimestamp());
- q.setParameter("externalId", wfBean.getExternalId());
- q.setParameter("lastModTime", new Date());
- q.setParameter("logToken", wfBean.getLogToken());
- q.setParameter("protoActionConf", wfBean.getProtoActionConf());
- q.setParameter("slaXml", wfBean.getSlaXml());
- q.setParameter("startTime", wfBean.getStartTimestamp());
- q.setParameter("status", wfBean.getStatusStr());
- q.setParameter("wfInstance", wfBean.getWfInstance());
- }
-
- private void setActionQueryParameters(WorkflowActionBean aBean, Query q) {
- q.setParameter("conf", aBean.getConf());
- q.setParameter("consoleUrl", aBean.getConsoleUrl());
- q.setParameter("data", aBean.getData());
- q.setParameter("stats", aBean.getStats());
- q.setParameter("externalChildIDs", aBean.getExternalChildIDs());
- q.setParameter("errorCode", aBean.getErrorCode());
- q.setParameter("errorMessage", aBean.getErrorMessage());
- q.setParameter("externalId", aBean.getExternalId());
- q.setParameter("externalStatus", aBean.getExternalStatus());
- q.setParameter("name", aBean.getName());
- q.setParameter("cred", aBean.getCred());
- q.setParameter("retries", aBean.getRetries());
- q.setParameter("trackerUri", aBean.getTrackerUri());
- q.setParameter("transition", aBean.getTransition());
- q.setParameter("type", aBean.getType());
- q.setParameter("endTime", aBean.getEndTimestamp());
- q.setParameter("executionPath", aBean.getExecutionPath());
- q.setParameter("lastCheckTime", aBean.getLastCheckTimestamp());
- q.setParameter("logToken", aBean.getLogToken());
- q.setParameter("pending", aBean.isPending() ? 1 : 0);
- q.setParameter("pendingAge", aBean.getPendingAgeTimestamp());
- q.setParameter("signalValue", aBean.getSignalValue());
- q.setParameter("slaXml", aBean.getSlaXml());
- q.setParameter("startTime", aBean.getStartTimestamp());
- q.setParameter("status", aBean.getStatusStr());
- q.setParameter("wfId", aBean.getWfId());
- }
}
Modified: oozie/trunk/core/src/main/resources/oozie-default.xml
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/resources/oozie-default.xml?rev=1521527&r1=1521526&r2=1521527&view=diff
==============================================================================
--- oozie/trunk/core/src/main/resources/oozie-default.xml (original)
+++ oozie/trunk/core/src/main/resources/oozie-default.xml Tue Sep 10 15:27:39 2013
@@ -25,6 +25,18 @@
<!-- ************************** VERY IMPORTANT ************************** -->
<property>
+ <name>oozie.output.compression.codec</name>
+ <value>gz</value>
+ <description>
+ The name of the compression codec to use.
+ The implementation class for the codec needs to be specified through another property oozie.compression.codecs.
+ You can specify a comma separated list of 'Codec_name'='Codec_class' for oozie.compression.codecs
+ where codec class implements the interface org.apache.oozie.compression.CompressionCodec.
+ If oozie.compression.codecs is not specified, gz codec implementation is used by default.
+ </description>
+ </property>
+
+ <property>
<name>oozie.action.mapreduce.uber.jar.enable</name>
<value>false</value>
<description>
Added: oozie/trunk/core/src/test/java/org/apache/oozie/compression/TestCodecFactory.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/compression/TestCodecFactory.java?rev=1521527&view=auto
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/compression/TestCodecFactory.java (added)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/compression/TestCodecFactory.java Tue Sep 10 15:27:39 2013
@@ -0,0 +1,107 @@
+/**
+ * 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.compression;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.util.Arrays;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.oozie.BinaryBlob;
+import org.apache.oozie.StringBlob;
+import org.apache.oozie.service.Services;
+import org.apache.oozie.test.XTestCase;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class TestCodecFactory extends XTestCase {
+
+ private Services services;
+
+ @Override
+ @Before
+ protected void setUp() throws Exception {
+ super.setUp();
+ services = new Services();
+ services.getConf().set(CodecFactory.COMPRESSION_OUTPUT_CODEC, GzipCompressionCodec.CODEC_NAME);
+ services.init();
+ }
+
+ @Override
+ @After
+ protected void tearDown() throws Exception {
+ services.destroy();
+ super.tearDown();
+ }
+
+ @Test
+ public void testCompressionCodecs() throws IOException {
+ assertTrue(CodecFactory.isCompressionEnabled());
+ assertEquals(GzipCompressionCodec.class, CodecFactory.getCompressionCodec().getClass());
+ byte[] bytes = CodecFactory.getHeaderBytes();
+ DataInputStream dais = new DataInputStream(new ByteArrayInputStream(bytes));
+ assertEquals(GzipCompressionCodec.class, CodecFactory.getDeCompressionCodec(dais).getClass());
+ dais.close();
+ }
+
+ @Test
+ public void testCompression() throws IOException {
+ byte[] headerBytes = CodecFactory.getHeaderBytes();
+ byte[] compressedBytes = CodecFactory.getCompressionCodec().compressString(headerBytes, "dummmmyyyy");
+ DataInputStream dais = new DataInputStream(new ByteArrayInputStream(compressedBytes));
+ String uncompressed = CodecFactory.getDeCompressionCodec(dais).decompressToString(dais);
+ assertEquals("dummmmyyyy", uncompressed);
+ dais.close();
+ }
+
+ @Test
+ public void testCodecFactoryConf() throws Exception {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ DataOutputStream daos = new DataOutputStream(baos);
+ // magic data
+ daos.write(CodecFactory.COMPRESSION_MAGIC_DATA.getBytes(CodecFactory.UTF_8_ENCODING));
+ // version
+ daos.writeInt(1);
+ // no of key value pairs
+ daos.writeInt(1);
+ daos.writeUTF(CodecFactory.COMPRESSION_KEY_HEADER);
+ daos.writeUTF(GzipCompressionCodec.CODEC_NAME);
+ daos.close();
+ assertEquals(new String(baos.toByteArray()), new String(CodecFactory.getHeaderBytes()));
+ Configuration conf = services.getConf();
+ conf.set(CodecFactory.COMPRESSION_OUTPUT_CODEC, "none");
+ CodecFactory.initialize(conf);
+ assertTrue(!CodecFactory.isCompressionEnabled());
+ conf.set(CodecFactory.COMPRESSION_OUTPUT_CODEC, "");
+ CodecFactory.initialize(conf);
+ assertTrue(!CodecFactory.isCompressionEnabled());
+ conf.set(CodecFactory.COMPRESSION_CODECS, "gz=" + GzipCompressionCodec.class.getName());
+ CodecFactory.initialize(conf);
+ conf.set(CodecFactory.COMPRESSION_OUTPUT_CODEC, "abcd");
+ try {
+ CodecFactory.initialize(conf);
+ }
+ catch (Exception e) {
+ // expected
+ }
+ }
+}