org.apache.oozie
Class LocalOozieClientCoord

java.lang.Object
  extended by org.apache.oozie.client.OozieClient
      extended by org.apache.oozie.LocalOozieClientCoord

public class LocalOozieClientCoord
extends org.apache.oozie.client.OozieClient

Client API to submit and manage Oozie coordinator jobs against an Oozie intance.

This class is thread safe.

Syntax for filter for the getJobsInfo(String) getJobsInfo(String, int, int) methods: [NAME=VALUE][;NAME=VALUE]*.

Valid filter names are:

The query will do an AND among all the filter names. The query will do an OR among all the filter values for the same name. Multiple values must be specified as different name value pairs.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.oozie.client.OozieClient
org.apache.oozie.client.OozieClient.ClientCallable<T>, org.apache.oozie.client.OozieClient.SYSTEM_MODE
 
Field Summary
 
Fields inherited from class org.apache.oozie.client.OozieClient
ACTION_MAX_RETRIES, ACTION_NOTIFICATION_URL, ACTION_RETRY_INTERVAL, APP_PATH, BUNDLE_APP_PATH, BUNDLE_ID, CHANGE_VALUE_CONCURRENCY, CHANGE_VALUE_ENDTIME, CHANGE_VALUE_PAUSETIME, COORD_ACTION_NOTIFICATION_URL, COORDINATOR_APP_PATH, debugMode, EXTERNAL_ID, FILTER_APPNAME, FILTER_FREQUENCY, FILTER_GROUP, FILTER_ID, FILTER_JOBID, FILTER_NAME, FILTER_STATUS, FILTER_UNIT, FILTER_USER, GROUP_NAME, JOB_ACL, LIBPATH, LOG_TOKEN, RERUN_FAIL_NODES, RERUN_SKIP_NODES, USE_SYSTEM_LIBPATH, USER_NAME, WORKFLOW_NOTIFICATION_URL, WS_PROTOCOL_VERSION, WS_PROTOCOL_VERSION_0
 
Constructor Summary
LocalOozieClientCoord(CoordinatorEngine coordEngine)
          Create a coordinator client for Oozie local use.
 
Method Summary
 Properties createConfiguration()
          Create an empty configuration with just the OozieClient.USER_NAME set to the JVM user name and the OozieClient.GROUP_NAME set to 'other'.
 org.apache.oozie.client.CoordinatorAction getCoordActionInfo(String actionId)
          Get the info of a coordinator action.
 org.apache.oozie.client.CoordinatorJob getCoordJobInfo(String jobId)
          Get the info of a coordinator job.
 List<org.apache.oozie.client.CoordinatorJob> getCoordJobsInfo(String filter, int start, int len)
          Return the info of the coordinator jobs that match the filter.
 String getHeader(String name)
          Get the value of a set HTTP header from the coordinator instance.
 Iterator<String> getHeaderNames()
          Return an iterator with all the header names set in the coordinator instance.
 org.apache.oozie.client.WorkflowJob getJobInfo(String jobId)
          Deprecated. 
 List<org.apache.oozie.client.WorkflowJob> getJobsInfo(String filter)
          Deprecated. 
 List<org.apache.oozie.client.WorkflowJob> getJobsInfo(String filter, int start, int len)
          Deprecated. 
 String getOozieUrl()
          Return the Oozie URL of the coordinator client instance.
 String getProtocolUrl()
          Return the Oozie URL used by the client and server for WS communications.
 void kill(String jobId)
          Kill a coordinator job.
 void removeHeader(String name)
          Remove a HTTP header from the coordinator client instance.
 void reRun(String jobId, Properties conf)
          Deprecated. 
 List<org.apache.oozie.client.CoordinatorAction> reRunCoord(String jobId, String rerunType, String scope, boolean refresh, boolean noCleanup)
          Rerun coordinator actions.
 void resume(String jobId)
          Resume a coordinator job.
 String run(Properties conf)
          Submit and start a coordinator job.
 void setHeader(String name, String value)
          Set a HTTP header to be used in the WS requests by the coordinator instance.
 void start(String jobId)
          Deprecated. 
 String submit(Properties conf)
          Submit a coordinator job.
 void suspend(String jobId)
          Suspend a coordinator job.
 void validateWSVersion()
          Validate that the Oozie client and server instances are protocol compatible.
 
Methods inherited from class org.apache.oozie.client.OozieClient
change, createConnection, doAs, dryrun, getBulkInfo, getBundleJobInfo, getBundleJobsInfo, getClientBuildVersion, getCoordJobInfo, getDebugMode, getHeaders, getJobDefinition, getJobId, getJobInfo, getJobLog, getJobLog, getQueueDump, getServerBuildVersion, getSlaInfo, getSystemMode, getWorkflowActionInfo, notEmpty, notNull, reRunBundle, setDebugMode, setSystemMode, writeToXml
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalOozieClientCoord

public LocalOozieClientCoord(CoordinatorEngine coordEngine)
Create a coordinator client for Oozie local use.

Parameters:
coordEngine - the engine instance to use.
Method Detail

getOozieUrl

public String getOozieUrl()
Return the Oozie URL of the coordinator client instance.

This URL is the base URL fo the Oozie system, with not protocol versioning.

Overrides:
getOozieUrl in class org.apache.oozie.client.OozieClient
Returns:
the Oozie URL of the coordinator client instance.

getProtocolUrl

public String getProtocolUrl()
                      throws org.apache.oozie.client.OozieClientException
Return the Oozie URL used by the client and server for WS communications.

This URL is the original URL plus the versioning element path.

Overrides:
getProtocolUrl in class org.apache.oozie.client.OozieClient
Returns:
the Oozie URL used by the client and server for communication.
Throws:
org.apache.oozie.client.OozieClientException - thrown in the client and the server are not protocol compatible.

validateWSVersion

public void validateWSVersion()
                       throws org.apache.oozie.client.OozieClientException
Validate that the Oozie client and server instances are protocol compatible.

Overrides:
validateWSVersion in class org.apache.oozie.client.OozieClient
Throws:
org.apache.oozie.client.OozieClientException - thrown in the client and the server are not protocol compatible.

createConfiguration

public Properties createConfiguration()
Create an empty configuration with just the OozieClient.USER_NAME set to the JVM user name and the OozieClient.GROUP_NAME set to 'other'.

Overrides:
createConfiguration in class org.apache.oozie.client.OozieClient
Returns:
an empty configuration.

setHeader

public void setHeader(String name,
                      String value)
Set a HTTP header to be used in the WS requests by the coordinator instance.

Overrides:
setHeader in class org.apache.oozie.client.OozieClient
Parameters:
name - header name.
value - header value.

getHeader

public String getHeader(String name)
Get the value of a set HTTP header from the coordinator instance.

Overrides:
getHeader in class org.apache.oozie.client.OozieClient
Parameters:
name - header name.
Returns:
header value, null if not set.

removeHeader

public void removeHeader(String name)
Remove a HTTP header from the coordinator client instance.

Overrides:
removeHeader in class org.apache.oozie.client.OozieClient
Parameters:
name - header name.

getHeaderNames

public Iterator<String> getHeaderNames()
Return an iterator with all the header names set in the coordinator instance.

Overrides:
getHeaderNames in class org.apache.oozie.client.OozieClient
Returns:
header names.

submit

public String submit(Properties conf)
              throws org.apache.oozie.client.OozieClientException
Submit a coordinator job.

Overrides:
submit in class org.apache.oozie.client.OozieClient
Parameters:
conf - job configuration.
Returns:
the job Id.
Throws:
org.apache.oozie.client.OozieClientException - thrown if the job could not be submitted.

start

@Deprecated
public void start(String jobId)
           throws org.apache.oozie.client.OozieClientException
Deprecated. 

Start a coordinator job.

Overrides:
start in class org.apache.oozie.client.OozieClient
Parameters:
jobId - job Id.
Throws:
org.apache.oozie.client.OozieClientException - thrown if the job could not be started.

run

public String run(Properties conf)
           throws org.apache.oozie.client.OozieClientException
Submit and start a coordinator job.

Overrides:
run in class org.apache.oozie.client.OozieClient
Parameters:
conf - job configuration.
Returns:
the job Id.
Throws:
org.apache.oozie.client.OozieClientException - thrown if the job could not be submitted.

reRun

@Deprecated
public void reRun(String jobId,
                             Properties conf)
           throws org.apache.oozie.client.OozieClientException
Deprecated. 

Rerun a workflow job.

Overrides:
reRun in class org.apache.oozie.client.OozieClient
Parameters:
jobId - job Id to rerun.
conf - configuration information for the rerun.
Throws:
org.apache.oozie.client.OozieClientException - thrown if the job could not be started.

reRunCoord

public List<org.apache.oozie.client.CoordinatorAction> reRunCoord(String jobId,
                                                                  String rerunType,
                                                                  String scope,
                                                                  boolean refresh,
                                                                  boolean noCleanup)
                                                           throws org.apache.oozie.client.OozieClientException
Rerun coordinator actions.

Overrides:
reRunCoord in class org.apache.oozie.client.OozieClient
Parameters:
jobId - coordinator jobId
rerunType - rerun type 'date' if -date is used, 'action-id' if -action is used
scope - rerun scope for date or actionIds
refresh - true if -refresh is given in command option
noCleanup - true if -nocleanup is given in command option
Throws:
org.apache.oozie.client.OozieClientException

suspend

public void suspend(String jobId)
             throws org.apache.oozie.client.OozieClientException
Suspend a coordinator job.

Overrides:
suspend in class org.apache.oozie.client.OozieClient
Parameters:
jobId - job Id.
Throws:
org.apache.oozie.client.OozieClientException - thrown if the job could not be suspended.

resume

public void resume(String jobId)
            throws org.apache.oozie.client.OozieClientException
Resume a coordinator job.

Overrides:
resume in class org.apache.oozie.client.OozieClient
Parameters:
jobId - job Id.
Throws:
org.apache.oozie.client.OozieClientException - thrown if the job could not be resume.

kill

public void kill(String jobId)
          throws org.apache.oozie.client.OozieClientException
Kill a coordinator job.

Overrides:
kill in class org.apache.oozie.client.OozieClient
Parameters:
jobId - job Id.
Throws:
org.apache.oozie.client.OozieClientException - thrown if the job could not be killed.

getJobInfo

@Deprecated
public org.apache.oozie.client.WorkflowJob getJobInfo(String jobId)
                                               throws org.apache.oozie.client.OozieClientException
Deprecated. 

Get the info of a workflow job.

Overrides:
getJobInfo in class org.apache.oozie.client.OozieClient
Parameters:
jobId - job Id.
Returns:
the job info.
Throws:
org.apache.oozie.client.OozieClientException - thrown if the job info could not be retrieved.

getCoordJobInfo

public org.apache.oozie.client.CoordinatorJob getCoordJobInfo(String jobId)
                                                       throws org.apache.oozie.client.OozieClientException
Get the info of a coordinator job.

Overrides:
getCoordJobInfo in class org.apache.oozie.client.OozieClient
Parameters:
jobId - job Id.
Returns:
the job info.
Throws:
org.apache.oozie.client.OozieClientException - thrown if the job info could not be retrieved.

getCoordActionInfo

public org.apache.oozie.client.CoordinatorAction getCoordActionInfo(String actionId)
                                                             throws org.apache.oozie.client.OozieClientException
Get the info of a coordinator action.

Overrides:
getCoordActionInfo in class org.apache.oozie.client.OozieClient
Parameters:
actionId - Id.
Returns:
the coordinator action info.
Throws:
org.apache.oozie.client.OozieClientException - thrown if the job info could not be retrieved.

getJobsInfo

@Deprecated
public List<org.apache.oozie.client.WorkflowJob> getJobsInfo(String filter,
                                                                        int start,
                                                                        int len)
                                                      throws org.apache.oozie.client.OozieClientException
Deprecated. 

Return the info of the workflow jobs that match the filter.

Overrides:
getJobsInfo in class org.apache.oozie.client.OozieClient
Parameters:
filter - job filter. Refer to the OozieClient for the filter syntax.
start - jobs offset, base 1.
len - number of jobs to return.
Returns:
a list with the workflow jobs info, without node details.
Throws:
org.apache.oozie.client.OozieClientException - thrown if the jobs info could not be retrieved.

getCoordJobsInfo

public List<org.apache.oozie.client.CoordinatorJob> getCoordJobsInfo(String filter,
                                                                     int start,
                                                                     int len)
                                                              throws org.apache.oozie.client.OozieClientException
Return the info of the coordinator jobs that match the filter.

Overrides:
getCoordJobsInfo in class org.apache.oozie.client.OozieClient
Parameters:
filter - job filter. Refer to the OozieClient for the filter syntax.
start - jobs offset, base 1.
len - number of jobs to return.
Returns:
a list with the coordinator jobs info
Throws:
org.apache.oozie.client.OozieClientException - thrown if the jobs info could not be retrieved.

getJobsInfo

@Deprecated
public List<org.apache.oozie.client.WorkflowJob> getJobsInfo(String filter)
                                                      throws org.apache.oozie.client.OozieClientException
Deprecated. 

Return the info of the workflow jobs that match the filter.

It returns the first 100 jobs that match the filter.

Overrides:
getJobsInfo in class org.apache.oozie.client.OozieClient
Parameters:
filter - job filter. Refer to the LocalOozieClient for the filter syntax.
Returns:
a list with the workflow jobs info, without node details.
Throws:
org.apache.oozie.client.OozieClientException - thrown if the jobs info could not be retrieved.


Copyright © 2013 Apache Software Foundation. All Rights Reserved.