Package org.cdlib.mrt.zk
Class Job
- java.lang.Object
-
- org.cdlib.mrt.zk.QueueItem
-
- org.cdlib.mrt.zk.Job
-
public class Job extends QueueItem
Class to manage a Merritt Ingest Job in the Job Queue.- See Also:
- State Transition Design
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.cdlib.mrt.zk.QueueItem
QueueItem.BatchJobStates, QueueItem.ZkPaths, QueueItem.ZkPrefixes
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static JobacquireJob(org.apache.zookeeper.ZooKeeper client, IngestState state)StringbatchStatePath()StringbatchStateSubpath()Stringbid()static JobcreateJob(org.apache.zookeeper.ZooKeeper client, String bid, int priority, org.json.JSONObject configuration)static JobcreateJob(org.apache.zookeeper.ZooKeeper client, String bid, int priority, org.json.JSONObject configuration, org.json.JSONObject identifiers)static JobcreateJob(org.apache.zookeeper.ZooKeeper client, String bid, int priority, org.json.JSONObject configuration, org.json.JSONObject identifiers, org.json.JSONObject metadata)static JobcreateJob(org.apache.zookeeper.ZooKeeper client, String bid, org.json.JSONObject configuration)static org.json.JSONObjectcreateJobConfiguration(String profile, String submitter, String payloadUrl, String payloadType, String responseType)static org.json.JSONObjectcreateJobIdentifiers(String primary, String local)static org.json.JSONObjectcreateJobMetadata(String who, String what, String when, String where)voiddelete(org.apache.zookeeper.ZooKeeper client)Stringdir()StringercWhat()StringercWhen()StringercWhere()StringercWho()static voidinitNodes(org.apache.zookeeper.ZooKeeper client)static IngestStateinitStatus()StringinventoryManifestUrl()StringinventoryMode()Stringjid()StringjobStatePath()static List<Job>listJobs(org.apache.zookeeper.ZooKeeper client, IngestState state)voidloadProperties(org.apache.zookeeper.ZooKeeper client)voidloadStatus(org.apache.zookeeper.ZooKeeper client, org.json.JSONObject js)StringlocalId()StringpayloadType()StringpayloadUrl()Stringprefix()static StringprefixPath()StringprimaryId()intpriority()StringprofileName()IngestStateresolveStatus(String s)StringresponseType()intretryCount()voidsetBatchStatePath(org.apache.zookeeper.ZooKeeper client)voidsetIdentifiers(org.apache.zookeeper.ZooKeeper client, org.json.JSONObject identifiers)voidsetInventory(org.apache.zookeeper.ZooKeeper client, String manifest_url, String mode)voidsetJobStatePath(org.apache.zookeeper.ZooKeeper client)voidsetMetadata(org.apache.zookeeper.ZooKeeper client, org.json.JSONObject metadata)voidsetSpaceNeeded(org.apache.zookeeper.ZooKeeper client, long spaceNeeded)voidsetStatusTrigger(org.apache.zookeeper.ZooKeeper client)voidsetStatusWithPriority(org.apache.zookeeper.ZooKeeper client, IngestState status, int priority)voidsetStatusWithRetry(org.apache.zookeeper.ZooKeeper client, IngestState status)longspaceNeeded()IngestState[]states()org.json.JSONObjectstatusObject(IngestState status)Stringsubmitter()-
Methods inherited from class org.cdlib.mrt.zk.QueueItem
createData, createOrSetData, data, id, intProperty, jsonDataProperty, jsonIntProperty, jsonLongProperty, jsonProperty, jsonStringProperty, load, lock, longProperty, makePath, optJsonProperty, optStringProperty, path, setData, setStatus, setStatus, status, stringProperty, unlock
-
-
-
-
Method Detail
-
bid
public String bid()
-
jobStatePath
public String jobStatePath()
-
batchStatePath
public String batchStatePath()
-
retryCount
public int retryCount()
-
priority
public int priority()
-
spaceNeeded
public long spaceNeeded()
-
prefixPath
public static String prefixPath()
-
initStatus
public static IngestState initStatus()
-
resolveStatus
public IngestState resolveStatus(String s)
- Specified by:
resolveStatusin classQueueItem
-
loadProperties
public void loadProperties(org.apache.zookeeper.ZooKeeper client) throws MerrittZKNodeInvalid, org.apache.zookeeper.KeeperException, InterruptedException- Overrides:
loadPropertiesin classQueueItem- Throws:
MerrittZKNodeInvalidorg.apache.zookeeper.KeeperExceptionInterruptedException
-
states
public IngestState[] states()
-
createJobMetadata
public static org.json.JSONObject createJobMetadata(String who, String what, String when, String where)
-
ercWho
public String ercWho()
-
ercWhat
public String ercWhat()
-
ercWhen
public String ercWhen()
-
ercWhere
public String ercWhere()
-
createJobIdentifiers
public static org.json.JSONObject createJobIdentifiers(String primary, String local)
-
primaryId
public String primaryId()
-
localId
public String localId()
-
createJobConfiguration
public static org.json.JSONObject createJobConfiguration(String profile, String submitter, String payloadUrl, String payloadType, String responseType)
-
profileName
public String profileName()
-
submitter
public String submitter()
-
payloadUrl
public String payloadUrl()
-
payloadType
public String payloadType()
-
responseType
public String responseType()
-
jid
public String jid()
-
createJob
public static Job createJob(org.apache.zookeeper.ZooKeeper client, String bid, org.json.JSONObject configuration) throws MerrittZKNodeInvalid, org.apache.zookeeper.KeeperException, InterruptedException, MerrittStateError
- Throws:
MerrittZKNodeInvalidorg.apache.zookeeper.KeeperExceptionInterruptedExceptionMerrittStateError
-
createJob
public static Job createJob(org.apache.zookeeper.ZooKeeper client, String bid, int priority, org.json.JSONObject configuration) throws MerrittZKNodeInvalid, org.apache.zookeeper.KeeperException, InterruptedException, MerrittStateError
- Throws:
MerrittZKNodeInvalidorg.apache.zookeeper.KeeperExceptionInterruptedExceptionMerrittStateError
-
createJob
public static Job createJob(org.apache.zookeeper.ZooKeeper client, String bid, int priority, org.json.JSONObject configuration, org.json.JSONObject identifiers) throws MerrittZKNodeInvalid, org.apache.zookeeper.KeeperException, InterruptedException, MerrittStateError
- Throws:
MerrittZKNodeInvalidorg.apache.zookeeper.KeeperExceptionInterruptedExceptionMerrittStateError
-
createJob
public static Job createJob(org.apache.zookeeper.ZooKeeper client, String bid, int priority, org.json.JSONObject configuration, org.json.JSONObject identifiers, org.json.JSONObject metadata) throws MerrittZKNodeInvalid, org.apache.zookeeper.KeeperException, InterruptedException, MerrittStateError
- Throws:
MerrittZKNodeInvalidorg.apache.zookeeper.KeeperExceptionInterruptedExceptionMerrittStateError
-
statusObject
public org.json.JSONObject statusObject(IngestState status)
- Overrides:
statusObjectin classQueueItem
-
loadStatus
public void loadStatus(org.apache.zookeeper.ZooKeeper client, org.json.JSONObject js) throws MerrittZKNodeInvalid- Overrides:
loadStatusin classQueueItem- Throws:
MerrittZKNodeInvalid
-
setSpaceNeeded
public void setSpaceNeeded(org.apache.zookeeper.ZooKeeper client, long spaceNeeded) throws MerrittZKNodeInvalid, org.apache.zookeeper.KeeperException, InterruptedException- Throws:
MerrittZKNodeInvalidorg.apache.zookeeper.KeeperExceptionInterruptedException
-
setIdentifiers
public void setIdentifiers(org.apache.zookeeper.ZooKeeper client, org.json.JSONObject identifiers) throws MerrittZKNodeInvalid, org.apache.zookeeper.KeeperException, InterruptedException- Throws:
MerrittZKNodeInvalidorg.apache.zookeeper.KeeperExceptionInterruptedException
-
setMetadata
public void setMetadata(org.apache.zookeeper.ZooKeeper client, org.json.JSONObject metadata) throws MerrittZKNodeInvalid, org.apache.zookeeper.KeeperException, InterruptedException- Throws:
MerrittZKNodeInvalidorg.apache.zookeeper.KeeperExceptionInterruptedException
-
setInventory
public void setInventory(org.apache.zookeeper.ZooKeeper client, String manifest_url, String mode) throws MerrittZKNodeInvalid, org.apache.zookeeper.KeeperException, InterruptedException- Throws:
MerrittZKNodeInvalidorg.apache.zookeeper.KeeperExceptionInterruptedException
-
inventoryManifestUrl
public String inventoryManifestUrl()
-
inventoryMode
public String inventoryMode()
-
setStatusWithRetry
public void setStatusWithRetry(org.apache.zookeeper.ZooKeeper client, IngestState status) throws MerrittZKNodeInvalid, org.apache.zookeeper.KeeperException, InterruptedException, MerrittStateError- Throws:
MerrittZKNodeInvalidorg.apache.zookeeper.KeeperExceptionInterruptedExceptionMerrittStateError
-
setStatusWithPriority
public void setStatusWithPriority(org.apache.zookeeper.ZooKeeper client, IngestState status, int priority) throws MerrittZKNodeInvalid, org.apache.zookeeper.KeeperException, InterruptedException, MerrittStateError- Throws:
MerrittZKNodeInvalidorg.apache.zookeeper.KeeperExceptionInterruptedExceptionMerrittStateError
-
setStatusTrigger
public void setStatusTrigger(org.apache.zookeeper.ZooKeeper client) throws MerrittZKNodeInvalid, org.apache.zookeeper.KeeperException, InterruptedException- Overrides:
setStatusTriggerin classQueueItem- Throws:
MerrittZKNodeInvalidorg.apache.zookeeper.KeeperExceptionInterruptedException
-
batchStateSubpath
public String batchStateSubpath()
-
setBatchStatePath
public void setBatchStatePath(org.apache.zookeeper.ZooKeeper client) throws MerrittZKNodeInvalid, org.apache.zookeeper.KeeperException, InterruptedException- Throws:
MerrittZKNodeInvalidorg.apache.zookeeper.KeeperExceptionInterruptedException
-
setJobStatePath
public void setJobStatePath(org.apache.zookeeper.ZooKeeper client) throws MerrittZKNodeInvalid, InterruptedException, org.apache.zookeeper.KeeperException- Throws:
MerrittZKNodeInvalidInterruptedExceptionorg.apache.zookeeper.KeeperException
-
delete
public void delete(org.apache.zookeeper.ZooKeeper client) throws MerrittStateError, MerrittZKNodeInvalid, InterruptedException, org.apache.zookeeper.KeeperException- Specified by:
deletein classQueueItem- Throws:
MerrittStateErrorMerrittZKNodeInvalidInterruptedExceptionorg.apache.zookeeper.KeeperException
-
acquireJob
public static Job acquireJob(org.apache.zookeeper.ZooKeeper client, IngestState state) throws MerrittZKNodeInvalid, org.apache.zookeeper.KeeperException, InterruptedException
- Throws:
MerrittZKNodeInvalidorg.apache.zookeeper.KeeperExceptionInterruptedException
-
initNodes
public static void initNodes(org.apache.zookeeper.ZooKeeper client) throws org.apache.zookeeper.KeeperException, InterruptedException- Throws:
org.apache.zookeeper.KeeperExceptionInterruptedException
-
listJobs
public static List<Job> listJobs(org.apache.zookeeper.ZooKeeper client, IngestState state) throws org.apache.zookeeper.KeeperException, InterruptedException, MerrittZKNodeInvalid
- Throws:
org.apache.zookeeper.KeeperExceptionInterruptedExceptionMerrittZKNodeInvalid
-
-