Permalink
Browse files

Closes GH-0550 remove dependency on JPA persistency from oozie-client

From: Alejandro Abdelnur <tucu00@gmail.com>

git-svn-id: https://svn.apache.org/repos/asf/incubator/oozie/trunk@1168770 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
Mohammad Islam
Mohammad Islam committed Sep 2, 2011
1 parent ab783d6 commit dbf7f561442bdd374f26a90a3d75a648a4470a3c
Showing with 976 additions and 877 deletions.
  1. +0 −5 client/pom.xml
  2. +5 −8 client/src/main/java/org/apache/oozie/cli/OozieCLI.java
  3. +7 −2 client/src/main/java/org/apache/oozie/client/BundleJob.java
  4. +14 −4 client/src/main/java/org/apache/oozie/client/Job.java
  5. +19 −23 client/src/main/java/org/apache/oozie/client/OozieClient.java
  6. +359 −0 client/src/main/java/org/apache/oozie/client/rest/JsonToBean.java
  7. +0 −32 client/src/main/java/org/apache/oozie/client/rest/JsonUtils.java
  8. +0 −133 client/src/test/java/org/apache/oozie/client/rest/TestJsonCoordinatorAction.java
  9. +0 −150 client/src/test/java/org/apache/oozie/client/rest/TestJsonCoordinatorJob.java
  10. +293 −0 client/src/test/java/org/apache/oozie/client/rest/TestJsonToBean.java
  11. +0 −32 client/src/test/java/org/apache/oozie/client/rest/TestJsonUtils.java
  12. +0 −109 client/src/test/java/org/apache/oozie/client/rest/TestJsonWorkflowAction.java
  13. +0 −127 client/src/test/java/org/apache/oozie/client/rest/TestJsonWorkflowJob.java
  14. +7 −60 core/pom.xml
  15. +4 −4 core/src/main/java/org/apache/oozie/LocalOozieClientCoord.java
  16. 0 {client → core}/src/main/java/org/apache/oozie/client/rest/JsonBean.java
  17. +1 −15 {client → core}/src/main/java/org/apache/oozie/client/rest/JsonBundleJob.java
  18. +2 −59 {client → core}/src/main/java/org/apache/oozie/client/rest/JsonCoordinatorAction.java
  19. +1 −42 {client → core}/src/main/java/org/apache/oozie/client/rest/JsonCoordinatorJob.java
  20. 0 {client → core}/src/main/java/org/apache/oozie/client/rest/JsonSLAEvent.java
  21. +0 −37 {client → core}/src/main/java/org/apache/oozie/client/rest/JsonWorkflowAction.java
  22. +0 −35 {client → core}/src/main/java/org/apache/oozie/client/rest/JsonWorkflowJob.java
  23. +59 −0 core/src/test/java/org/apache/oozie/client/rest/TestJsonCoordinatorAction.java
  24. +75 −0 core/src/test/java/org/apache/oozie/client/rest/TestJsonCoordinatorJob.java
  25. +65 −0 core/src/test/java/org/apache/oozie/client/rest/TestJsonWorkflowAction.java
  26. +64 −0 core/src/test/java/org/apache/oozie/client/rest/TestJsonWorkflowJob.java
  27. +1 −0 release-log.txt
View
@@ -53,11 +53,6 @@
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>javax.persistence</groupId>
- <artifactId>persistence-api</artifactId>
- <scope>provided</scope>
- </dependency>
</dependencies>
<build>
@@ -53,9 +53,6 @@
import org.apache.oozie.client.WorkflowJob;
import org.apache.oozie.client.XOozieClient;
import org.apache.oozie.client.OozieClient.SYSTEM_MODE;
-import org.apache.oozie.client.rest.JsonBundleJob;
-import org.apache.oozie.client.rest.JsonCoordinatorAction;
-import org.apache.oozie.client.rest.JsonCoordinatorJob;
import org.apache.oozie.client.rest.RestConstants;
import org.w3c.dom.DOMException;
import org.w3c.dom.Document;
@@ -800,7 +797,7 @@ private void printCoordAction(CoordinatorAction coordAction, boolean contains) {
System.out.println(RULER);
}
- private void printRerunCoordActions(List<JsonCoordinatorAction> actions) {
+ private void printRerunCoordActions(List<CoordinatorAction> actions) {
if (actions != null && actions.size() > 0) {
System.out.println("Action ID" + VERBOSE_DELIMITER + "Nominal Time");
System.out.println(RULER);
@@ -942,7 +939,7 @@ else if (jobtype.toLowerCase().startsWith("bundle")) {
}
}
- private void printCoordJobs(List<JsonCoordinatorJob> jobs, boolean localtime, boolean verbose) throws IOException {
+ private void printCoordJobs(List<CoordinatorJob> jobs, boolean localtime, boolean verbose) throws IOException {
if (jobs != null && jobs.size() > 0) {
if (verbose) {
System.out.println("Job ID" + VERBOSE_DELIMITER + "App Name" + VERBOSE_DELIMITER + "App Path"
@@ -987,7 +984,7 @@ private void printCoordJobs(List<JsonCoordinatorJob> jobs, boolean localtime, bo
}
}
- private void printBundleJobs(List<JsonBundleJob> jobs, boolean localtime, boolean verbose) throws IOException {
+ private void printBundleJobs(List<BundleJob> jobs, boolean localtime, boolean verbose) throws IOException {
if (jobs != null && jobs.size() > 0) {
if (verbose) {
System.out.println("Job ID" + VERBOSE_DELIMITER + "Bundle Name" + VERBOSE_DELIMITER + "Bundle Path"
@@ -998,7 +995,7 @@ private void printBundleJobs(List<JsonBundleJob> jobs, boolean localtime, boolea
+ VERBOSE_DELIMITER + "Timeout");
System.out.println(RULER);
- for (JsonBundleJob job : jobs) {
+ for (BundleJob job : jobs) {
System.out.println(maskIfNull(job.getId()) + VERBOSE_DELIMITER + maskIfNull(job.getAppName())
+ VERBOSE_DELIMITER + maskIfNull(job.getAppPath()) + VERBOSE_DELIMITER
+ maskIfNull(job.getUser()) + VERBOSE_DELIMITER + maskIfNull(job.getGroup())
@@ -1015,7 +1012,7 @@ private void printBundleJobs(List<JsonBundleJob> jobs, boolean localtime, boolea
"Created", "User", "Group"));
System.out.println(RULER);
- for (JsonBundleJob job : jobs) {
+ for (BundleJob job : jobs) {
System.out.println(String.format(BUNDLE_JOBS_FORMATTER, maskIfNull(job.getId()), maskIfNull(job
.getAppName()), job.getStatus(), maskDate(job.getKickoffTime(), localtime),
maskDate(job.getCreatedTime(), localtime), maskIfNull(job.getUser()), maskIfNull(job.getGroup())));
@@ -18,8 +18,6 @@
import java.util.Date;
import java.util.List;
-import org.apache.oozie.client.rest.JsonCoordinatorJob;
-
/**
* Bean that represents an Oozie bundle.
*/
@@ -60,4 +58,11 @@
*/
Date getKickoffTime();
+ /**
+ * Get createdTime
+ *
+ * @return createdTime
+ */
+ public Date getCreatedTime();
+
}
@@ -106,16 +106,26 @@
/**
* Set pending to true
- *
- * @param pending set pending to true
*/
void setPending();
/**
* Set pending to
- *
- * @param pending set pending to false
*/
void resetPending();
+ /**
+ * Get pauseTime
+ *
+ * @return pauseTime
+ */
+ public Date getPauseTime();
+
+ /**
+ * Return externalId
+ *
+ * @return externalId
+ */
+ public String getExternalId();
+
}
@@ -39,12 +39,8 @@
import javax.xml.transform.stream.StreamResult;
import org.apache.oozie.BuildInfo;
-import org.apache.oozie.client.rest.JsonBundleJob;
-import org.apache.oozie.client.rest.JsonCoordinatorAction;
-import org.apache.oozie.client.rest.JsonCoordinatorJob;
import org.apache.oozie.client.rest.JsonTags;
-import org.apache.oozie.client.rest.JsonWorkflowAction;
-import org.apache.oozie.client.rest.JsonWorkflowJob;
+import org.apache.oozie.client.rest.JsonToBean;
import org.apache.oozie.client.rest.RestConstants;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
@@ -592,7 +588,7 @@ protected WorkflowJob call(HttpURLConnection conn) throws IOException, OozieClie
if ((conn.getResponseCode() == HttpURLConnection.HTTP_OK)) {
Reader reader = new InputStreamReader(conn.getInputStream());
JSONObject json = (JSONObject) JSONValue.parse(reader);
- return new JsonWorkflowJob(json);
+ return JsonToBean.createWorkflowJob(json);
}
else {
handleError(conn);
@@ -612,7 +608,7 @@ protected WorkflowAction call(HttpURLConnection conn) throws IOException, OozieC
if ((conn.getResponseCode() == HttpURLConnection.HTTP_OK)) {
Reader reader = new InputStreamReader(conn.getInputStream());
JSONObject json = (JSONObject) JSONValue.parse(reader);
- return new JsonWorkflowAction(json);
+ return JsonToBean.createWorkflowAction(json);
}
else {
handleError(conn);
@@ -757,7 +753,7 @@ protected CoordinatorJob call(HttpURLConnection conn) throws IOException, OozieC
if ((conn.getResponseCode() == HttpURLConnection.HTTP_OK)) {
Reader reader = new InputStreamReader(conn.getInputStream());
JSONObject json = (JSONObject) JSONValue.parse(reader);
- return new JsonCoordinatorJob(json);
+ return JsonToBean.createCoordinatorJob(json);
}
else {
handleError(conn);
@@ -778,7 +774,7 @@ protected BundleJob call(HttpURLConnection conn) throws IOException, OozieClient
if ((conn.getResponseCode() == HttpURLConnection.HTTP_OK)) {
Reader reader = new InputStreamReader(conn.getInputStream());
JSONObject json = (JSONObject) JSONValue.parse(reader);
- return new JsonBundleJob(json);
+ return JsonToBean.createBundleJob(json);
}
else {
handleError(conn);
@@ -798,7 +794,7 @@ protected CoordinatorAction call(HttpURLConnection conn) throws IOException, Ooz
if ((conn.getResponseCode() == HttpURLConnection.HTTP_OK)) {
Reader reader = new InputStreamReader(conn.getInputStream());
JSONObject json = (JSONObject) JSONValue.parse(reader);
- return new JsonCoordinatorAction(json);
+ return JsonToBean.createCoordinatorAction(json);
}
else {
handleError(conn);
@@ -872,7 +868,7 @@ public CoordinatorAction getCoordActionInfo(String actionId) throws OozieClientE
if (workflows == null) {
workflows = new JSONArray();
}
- return JsonWorkflowJob.fromJSONArray(workflows);
+ return JsonToBean.createWorkflowJobList(workflows);
}
else {
handleError(conn);
@@ -881,7 +877,7 @@ public CoordinatorAction getCoordActionInfo(String actionId) throws OozieClientE
}
}
- private class CoordJobsStatus extends ClientCallable<List<JsonCoordinatorJob>> {
+ private class CoordJobsStatus extends ClientCallable<List<CoordinatorJob>> {
CoordJobsStatus(String filter, int start, int len) {
super("GET", RestConstants.JOBS, "", prepareParams(RestConstants.JOBS_FILTER_PARAM, filter,
@@ -890,7 +886,7 @@ public CoordinatorAction getCoordActionInfo(String actionId) throws OozieClientE
}
@Override
- protected List<JsonCoordinatorJob> call(HttpURLConnection conn) throws IOException, OozieClientException {
+ protected List<CoordinatorJob> call(HttpURLConnection conn) throws IOException, OozieClientException {
conn.setRequestProperty("content-type", RestConstants.XML_CONTENT_TYPE);
if ((conn.getResponseCode() == HttpURLConnection.HTTP_OK)) {
Reader reader = new InputStreamReader(conn.getInputStream());
@@ -899,7 +895,7 @@ public CoordinatorAction getCoordActionInfo(String actionId) throws OozieClientE
if (jobs == null) {
jobs = new JSONArray();
}
- return JsonCoordinatorJob.fromJSONArray(jobs);
+ return JsonToBean.createCoordinatorJobList(jobs);
}
else {
handleError(conn);
@@ -908,7 +904,7 @@ public CoordinatorAction getCoordActionInfo(String actionId) throws OozieClientE
}
}
- private class BundleJobsStatus extends ClientCallable<List<JsonBundleJob>> {
+ private class BundleJobsStatus extends ClientCallable<List<BundleJob>> {
BundleJobsStatus(String filter, int start, int len) {
super("GET", RestConstants.JOBS, "", prepareParams(RestConstants.JOBS_FILTER_PARAM, filter,
@@ -917,7 +913,7 @@ public CoordinatorAction getCoordActionInfo(String actionId) throws OozieClientE
}
@Override
- protected List<JsonBundleJob> call(HttpURLConnection conn) throws IOException, OozieClientException {
+ protected List<BundleJob> call(HttpURLConnection conn) throws IOException, OozieClientException {
conn.setRequestProperty("content-type", RestConstants.XML_CONTENT_TYPE);
if ((conn.getResponseCode() == HttpURLConnection.HTTP_OK)) {
Reader reader = new InputStreamReader(conn.getInputStream());
@@ -926,7 +922,7 @@ public CoordinatorAction getCoordActionInfo(String actionId) throws OozieClientE
if (jobs == null) {
jobs = new JSONArray();
}
- return JsonBundleJob.fromJSONArray(jobs);
+ return JsonToBean.createBundleJobList(jobs);
}
else {
handleError(conn);
@@ -935,7 +931,7 @@ public CoordinatorAction getCoordActionInfo(String actionId) throws OozieClientE
}
}
- private class CoordRerun extends ClientCallable<List<JsonCoordinatorAction>> {
+ private class CoordRerun extends ClientCallable<List<CoordinatorAction>> {
CoordRerun(String jobId, String rerunType, String scope, boolean refresh, boolean noCleanup) {
super("PUT", RestConstants.JOB, notEmpty(jobId, "jobId"), prepareParams(RestConstants.ACTION_PARAM,
@@ -946,13 +942,13 @@ public CoordinatorAction getCoordActionInfo(String actionId) throws OozieClientE
}
@Override
- protected List<JsonCoordinatorAction> call(HttpURLConnection conn) throws IOException, OozieClientException {
+ protected List<CoordinatorAction> call(HttpURLConnection conn) throws IOException, OozieClientException {
conn.setRequestProperty("content-type", RestConstants.XML_CONTENT_TYPE);
if ((conn.getResponseCode() == HttpURLConnection.HTTP_OK)) {
Reader reader = new InputStreamReader(conn.getInputStream());
JSONObject json = (JSONObject) JSONValue.parse(reader);
JSONArray coordActions = (JSONArray) json.get(JsonTags.COORDINATOR_ACTIONS);
- return JsonCoordinatorAction.fromJSONArray(coordActions);
+ return JsonToBean.createCoordinatorActionList(coordActions);
}
else {
handleError(conn);
@@ -994,7 +990,7 @@ protected Void call(HttpURLConnection conn) throws IOException, OozieClientExcep
* @param noCleanup true if -nocleanup is given in command option
* @throws OozieClientException
*/
- public List<JsonCoordinatorAction> reRunCoord(String jobId, String rerunType, String scope, boolean refresh,
+ public List<CoordinatorAction> reRunCoord(String jobId, String rerunType, String scope, boolean refresh,
boolean noCleanup) throws OozieClientException {
return new CoordRerun(jobId, rerunType, scope, refresh, noCleanup).call();
}
@@ -1221,7 +1217,7 @@ public String getClientBuildVersion() {
* @return a list with the coordinator jobs info
* @throws OozieClientException thrown if the jobs info could not be retrieved.
*/
- public List<JsonCoordinatorJob> getCoordJobsInfo(String filter, int start, int len) throws OozieClientException {
+ public List<CoordinatorJob> getCoordJobsInfo(String filter, int start, int len) throws OozieClientException {
return new CoordJobsStatus(filter, start, len).call();
}
@@ -1234,7 +1230,7 @@ public String getClientBuildVersion() {
* @return a list with the bundle jobs info
* @throws OozieClientException thrown if the jobs info could not be retrieved.
*/
- public List<JsonBundleJob> getBundleJobsInfo(String filter, int start, int len) throws OozieClientException {
+ public List<BundleJob> getBundleJobsInfo(String filter, int start, int len) throws OozieClientException {
return new BundleJobsStatus(filter, start, len).call();
}
Oops, something went wrong.

0 comments on commit dbf7f56

Please sign in to comment.