|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ClientAgent
API for client communication with server for job and datagrid operations. This includes retrieving information about available jobs, to start jobs and to manage running jobs.
Method Summary | |
---|---|
void |
addAgentListener(AgentListener listener)
Add listener for message handling. |
void |
cancelJob(String jobID)
Cancel the referenced job. |
void |
cancelJob(String jobID,
String reason)
Cancel the referenced job with a reason string. |
boolean |
cat(String path,
OutputStream out)
Write the contents of a datagrid file to a supplied OutputStream . |
void |
changePassword(Credential newCredential)
Deprecated. This method no longer works in the new session based message comms environment. The old credential is no longer stored on the local disc, and must be supplied in the request message over an encrypted message connection. Use ClientAgent.changePassword(Credential,Credential) instead. |
void |
changePassword(Credential oldCredential,
Credential newCredential)
Change the user password. |
void |
changePriority(String jobID,
int priority)
Change the priority of the referenced job. |
void |
copy(String src,
String dest,
boolean recursive)
Copies files or directories into and out of the datagrid. |
void |
dataGridCancel()
Cancel datagrid operations executing on behalf of the client. |
void |
delete(String path,
boolean recursive)
Delete files or directories in the datagrid. |
GridFile[] |
dir(String path)
List files or directories in the datagrid. |
void |
disconnect()
Logout an agent. |
void |
failJob(String jobID)
Fail the referenced job |
void |
failJob(String jobID,
String reason)
Fail the referenced job with a a reason |
void |
follow(String path,
OutputStream out,
OutputStream err,
String watchJob,
Long maxUnch,
Long offset,
Long count,
Long interval,
Long refresh,
Long timeout,
boolean offsetLines,
boolean retry,
boolean quiet,
boolean byName,
boolean countLines)
Output and/or follow the contents of a grid file in real time. |
String[] |
getAvailableJobs()
Retrieve all the available jobs to run for the user. |
Credential |
getCredential()
Get current credentials used for Server communication. |
String |
getGridName()
Get the grid name that we are currently logged into. |
GridObjectInfo |
getGridObjectInfo(String gridObjectType,
String gridObjectName)
Return the grid object for a given name and type. |
String[] |
getGridObjectNames(String objectType,
Constraint constraint)
Return a list of the names of all matching grid objects of the requested type that match the constraints. |
String[] |
getGridObjectNames(String objectType,
Constraint constraint,
String[] rankBy)
Return a list of the names of all matching grid objects of the requested type that match the constraints. |
String[] |
getGridObjectNames(String objectType,
String constraintStr)
Return a list of the names of all matching grid objects of the requested type that match the constraints. |
String[] |
getGridObjectNames(String objectType,
String constraintStr,
String[] rankBy)
Return a list of the names of all matching grid objects of the requested type that match the constraints. |
GridObjectInfo[] |
getGridObjects(String objectType,
Constraint constraint,
boolean detail)
Return a list of the names of all matching grid objects of the requested type that match the constraints. |
GridObjectInfo[] |
getGridObjects(String objectType,
Constraint constraint,
boolean detail,
String[] rankBy)
Return a list of the names of all matching grid objects of the requested type that match the constraints. |
GridObjectInfo[] |
getGridObjects(String objectType,
String constraintStr,
boolean detail)
Return a list of the names of all matching grid objects of the requested type that match the constraints. |
GridObjectInfo[] |
getGridObjects(String objectType,
String constraintStr,
boolean detail,
String[] rankBy)
Return a list of the names of all matching grid objects of the requested type that match the constraints. |
JobInfo |
getJobInfo(String jobName)
|
void |
getMessages(String jobID)
Inform server that this client is interested in receiving messages for a givenJob instance ID. |
WorkflowInfo[] |
getRunningJobs(boolean allJobs,
boolean activeOnly,
String parentWorkflowId,
long submitTime,
int maxCount,
boolean detail)
Get a array of job information for currently running jobs. |
int |
getStatus(String jobID)
Get a simple status of the job. |
WorkflowInfo |
getStatusDetail(String jobID,
boolean includeJoblets)
Get detailed status information of the started job. |
GridFile |
gridFile(String gridFileName)
Create an abstract Grid path object from a Data Grid URL string. |
void |
login()
Login using the last (cached) credentials stored on host. |
void |
login(Credential credential)
Login to a server using supplied credentials. |
void |
logout()
Logout an agent. |
void |
logoutAndDestroyCredential()
Logout an agent and removed any cached credentials from the host. |
void |
mkdir(String dir,
boolean parents)
Create directories in the datagrid. |
void |
move(String src,
String dest)
Move files or directories in the datagrid |
void |
pauseJob(String jobID)
Pause the referenced job. |
void |
removeAgentListener(AgentListener listener)
Remove listener for message handling. |
void |
resumeJob(String jobID)
Resume the referenced job. |
String |
runJob(String deployedJobName,
Map params)
Runs the named job. |
String |
runJob(String deployedJobName,
String jobInstanceName,
Map jobArgs,
int priority,
long startTime,
Map env,
String policyText,
String policyName,
TypedConstraint constraint,
boolean tracing)
Runs the named job. |
void |
sendEvent(String jobID,
String name,
Map params)
Send a custom event to a running job instance. |
void |
sendEventAsync(String jobID,
String name,
Map params)
Send a custom event to a running job instance but don't wait for ACK. |
void |
setDebug(boolean debug)
Set the debug log level of the agent |
void |
setFact(String gridObjectType,
String gridObjectName,
String factName,
int factType,
Object value)
Set the value of the fact for a given grid object name and type. |
void |
setSyncListener(boolean syncListener)
Set the mode of operation for message listeners on this agent. |
void |
setVerbose(boolean verbose)
Set the verbose log level of the agent |
void |
shutdown()
Shutdown an agent. |
void |
stopMessages(String jobID)
Cancel a previous getMessages request. |
void |
uploadEnv(Map envMap)
Update the persisted user environment on the server. |
Method Detail |
---|
void login() throws GridAuthenticationException, GridException
GridAuthenticiationException
- if login is invalid
GridException
- if any other error occurs
GridAuthenticationException
void login(Credential credential) throws GridAuthenticationException, GridException
credential
- the user's credentials
GridAuthenticiationException
- if login is invalid
GridException
- if any other error occurs
GridAuthenticationException
void disconnect() throws GridException
GridException
- if any error occursvoid logout() throws GridException
GridException
- if any error occursCredential getCredential()
void shutdown() throws GridException
GridException
- if any error occursvoid logoutAndDestroyCredential() throws GridException
GridException
- if any error occursString getGridName()
void setDebug(boolean debug)
debug
- set to true for debug logging to stderrvoid setVerbose(boolean verbose)
verbose
- set to true for verbose logging to stdout and stderr if
debugging is also enabledvoid addAgentListener(AgentListener listener)
listener
- the agent listener implementationvoid removeAgentListener(AgentListener listener)
listener
- the listener implementation to removevoid setSyncListener(boolean syncListener)
true (default) -- listener callbacks are performed synchronously on the same thread. There is a guarantee of message order however the handler must not callback into the agent or a deadlock will likely arise.
false -- listener callbacks are performed asynchronously each on a separate new thread. The threads are started in the message order but there is, of course no guarantee to processing order. These threads can call back into the agent to send new messages.
String runJob(String deployedJobName, Map params) throws GridException
deployedJobName
- the name of the job to run.params
- the set of name/value pairs used to set properties and
satisfy job arguments in JDL.
GridException
- if any error occurs.String runJob(String deployedJobName, String jobInstanceName, Map jobArgs, int priority, long startTime, Map env, String policyText, String policyName, TypedConstraint constraint, boolean tracing) throws GridException
deployedJobName
- the name of the job to run.jobInstanceName
- the name for this run of the job.jobArgs
- the set of name/value pairs used to set properties and
satisfy job arguments in JDL.priority
- the priority of the job.startTime
- the time in the future for delayed job starts or
<= 0 for immediate starts.env
- Map of user environment properties to propagate to nodespolicyText
- the string representation of a policy to be
placed on the job. Maybe null.policyName
- the Name of a deployed policy to be placed on the job.
Maybe null.constraint
- the typed constraint to add to the job instance.
GridException
- if any error occurs.void cancelJob(String jobID, String reason) throws GridException
jobID
- the job ID of the job to cancel.reason
- Reason string message for cancelling job.
GridException
- if any error occurs.void cancelJob(String jobID) throws GridException
jobID
- the job ID of the job to cancel.
GridException
- if any error occurs.void failJob(String jobID, String reason) throws GridException
jobID
- the job ID of the job to cancel.reason
- Reason string message for failing job
GridException
- if any error occurs.void failJob(String jobID) throws GridException
jobID
- the job ID of the job to cancel.
GridException
- if any error occurs.void pauseJob(String jobID) throws GridException
jobID
- the job ID of the job to pause.
GridException
- if any error occurs.void resumeJob(String jobID) throws GridException
jobID
- the job ID of the job to resume.
GridException
- if any error occurs.void changePriority(String jobID, int priority) throws GridException
jobID
- the job ID of the job to reprioritize.priority
- the new priority.
GridException
- if any error occurs.void changePassword(Credential newCredential) throws GridException
ClientAgent.changePassword(Credential,Credential)
instead.
newCredential
- the new Credential of the client.
GridException
- if any error occurs.void changePassword(Credential oldCredential, Credential newCredential) throws GridException
oldCredential
- The old Credential of the client.newCredential
- The new Credential of the client.
GridException
- if any error occurs.void uploadEnv(Map envMap) throws GridException
envMap
- Map of user environment properties to propagate to nodes
GridException
- if any error occurs.int getStatus(String jobID) throws GridException
jobID
- the job ID of the job to reprioritize.
GridException
- if any error occurs.WorkflowInfo getStatusDetail(String jobID, boolean includeJoblets) throws GridException
jobID
- the job ID of the job to reprioritize.includeJoblets
- include joblets details in request
GridException
- if any error occurs.void sendEvent(String jobID, String name, Map params) throws GridException
jobID
- JobID of running jobname
- the (method) name of event to createparams
- Parameters for the named event
GridException
- if any error occursvoid sendEventAsync(String jobID, String name, Map params)
jobID
- JobID of running jobname
- the (method) name of event to createparams
- Parameters for the named eventvoid getMessages(String jobID) throws GridException
jobID
- JobID of job to retrieve messages for
GridException
- if any error occursvoid stopMessages(String jobID) throws GridException
jobID
- JobID of job to retrieve messages for
GridException
- if any error occursString[] getAvailableJobs() throws GridException
GridException
- if any error occursWorkflowInfo[] getRunningJobs(boolean allJobs, boolean activeOnly, String parentWorkflowId, long submitTime, int maxCount, boolean detail) throws GridException
allJobs
- true to retrieve info on all running jobs. false
for user onlyactiveOnly
- true is only currently active jobs (not queued) should
be returned.parentWorkflowId
- if not null, return jobs that are children of
the specified jobid. Null will return root level jobs only.submitTime
- if not 0, jobs will be returned from the job history
that were submitted on or after this time.maxCount
- limit the number of jobs returned to this number if
submitTime is not equal to 0. I.e. jobs currently in the cache
are always returned.detail
- true to get detailed information.
GridException
- if any error occurs.GridFile gridFile(String gridFileName) throws DataGridException, IOException
Creates an abstract GridFile
object that can be
manipulated and queried in a manner similar, but not identical
to java.io.File
.
This interface also provides the ease of use Data Grid functions
copy(),cat(),delete(),dir(),follow(),mkdir(),move(),dataGridCancel()
that encapsulate GridFile
usage. For example, use copy()
Note that the specified URL does not have to refer to a
pre-existing file. However, the URL must be a correctly parseable
Data Grid path.
gridFileName
- The Data Grid file URL string to use as the path. (req)
GridFile
object representing the specified data grid path.
MalformedURLException
- Thrown if gridFileName
cannot be parsed.
DataGridException
- Thrown if a system or configuration error causes the creation
of the handle to fail.
IOException
- Thrown if an I/O or network error causes the creation
of the handle to fail.void copy(String src, String dest, boolean recursive) throws GridException
src
- Data Grid URL String or local file namedest
- Data Grid URL String or local file namerecursive
- true to copy recursively from src to dest. Defaults
to false
GridException
- if any error occurs.GridFile[] dir(String path) throws GridException
Creates an array of th eabstract GridFile
objects that can be
manipulated and queried in a manner similar, but not identical
to java.io.File
.
Note that the supplied URL must refer to an existing directory or file.
path
- on datagrid to list
GridFile
instances. Can be empty if datagrid directory is empty.
GridException
- if any error occurs.boolean cat(String path, OutputStream out) throws GridException
OutputStream
.
path
- of file on datagrid to read
GridException
- if any error occurs.void delete(String path, boolean recursive) throws GridException
path
- Data Grid URL String on the datagrid to deleterecursive
- Indicate whether to delete recursively or not
GridException
- if any error occurs.void mkdir(String dir, boolean parents) throws GridException
dir
- Datagrid URL String or local directory to createparents
- true to create all directories in path. defaults to false.
GridException
- if any error occurs.void move(String src, String dest) throws GridException
src
- Data Grid URL Stringdest
- Data Grid URL String
GridException
- if any error occurs.void follow(String path, OutputStream out, OutputStream err, String watchJob, Long maxUnch, Long offset, Long count, Long interval, Long refresh, Long timeout, boolean offsetLines, boolean retry, boolean quiet, boolean byName, boolean countLines) throws GridException
This operation performs the same function as Linux 'tail'. It can display the first or last N lines of a file, and/or actively follow bytes or lines added to the end of a file.
path
- Path to file on datagrid to listout
- The OutputStream
to which normal output will be written.err
- The OutputStream
to which error and status messages
will be written.watchJob
- Optional Job ID to watch. Return immediately when the job completes.maxUnch
- The maximum number of intervals after which the file is reopened by
name in case it has been deleted and recreated.offset
- The offset (lines or bytes, depending on lineMode
) at
which to start reading the file.count
- The maximum number of lines or bytes (depending on
lineMode
) to read and output to out
interval
- The number of milliseconds between rechecks of the file.refresh
- The request refresh period, in milliseconds. To avoid dead 'tail'
sessions on the server, the client refreshes the request according to
this interval.timeout
- The maximum number of milliseconds to wait when no bytes are received.offsetLines
- If true
, then offset
is computed as lines of
text, with either CRLF
or LF
counting as
a line separator. Otherwise, the offset is computed as 8 bit bytes.retry
- If true
, and the remote file does not yet exist, then
the remote file watcher thread will keep trying until the file
appears.quiet
- If true
, Then the remote file watcher will not send
warnings or informational messages over the "error" channel.byName
- if true
, then the remote file is "followed by name".
That is, each test of the file checks whether the file has
been deleted and/or replaced with a new file. This follows the
semantics of the 'tail --follow=name' option for the Linux
version of the 'tail' program.countLines
- If true
then count
is given in lines
instead of bytes.
GridException
void dataGridCancel() throws GridException
GridException
- if error occurs in cancellingString[] getGridObjectNames(String objectType, String constraintStr) throws GridAuthenticationException, GridException
objectType
- the Grid Object type to search forconstraintStr
- the string representation of the constraint to be
used in the search.
GridAuthenticationException
- is the supplied credentials are
invalid or do no permit the operation.
GridException
- if any error occurs such as an illegal constraintString[] getGridObjectNames(String objectType, Constraint constraint) throws GridAuthenticationException, GridException
objectType
- the Grid Object type to search forconstraint
- the constraint to be used in the search.
GridAuthenticationException
- is the supplied credentials are
invalid or do no permit the operation.
GridException
- if any error occurs such as an illegal constraintString[] getGridObjectNames(String objectType, String constraintStr, String[] rankBy) throws GridAuthenticationException, GridException
Ordering is specified as an array of strings with each element in the form "<factname>/<ascending|descending". The ascending/decending order may be shortened to 'a|d'.
objectType
- the Grid Object type to search forconstraintStr
- the string representation of the constraint to be
used in the search.rankBy
- the specification used to order the returned array or
null for don't care
GridAuthenticationException
- is the supplied credentials are
invalid or do no permit the operation.
GridException
- if any error occurs such as an illegal constraintString[] getGridObjectNames(String objectType, Constraint constraint, String[] rankBy) throws GridAuthenticationException, GridException
Ordering is specified as an array of strings with each element in the form "<factname>/<ascending|descending". The ascending/decending order may be shortened to 'a|d'.
objectType
- the Grid Object type to search forconstraint
- the constraint to be used in the search.rankBy
- the specification used to order the returned array or
null for don't care
GridAuthenticationException
- is the supplied credentials are
invalid or do no permit the operation.
GridException
- if any error occurs such as an illegal constraintGridObjectInfo[] getGridObjects(String objectType, String constraintStr, boolean detail) throws GridAuthenticationException, GridException
The constraint is expected to only contain facts that relate to the object being searched. Other supplied constraints (if otherwise valid) will always evaluate to false and thus will always result in no matches.
objectType
- the Grid Object type to search forconstraintStr
- the string representation of the constraint to be
used in the search.detail
- true if the full set of facts is required, false if only
the basic set is required.
GridAuthenticationException
- is the supplied credentials are
invalid or do no permit the operation.
GridException
- if any error occurs such as an illegal constraintGridObjectInfo[] getGridObjects(String objectType, Constraint constraint, boolean detail) throws GridAuthenticationException, GridException
The constraint is expected to only contain facts that relate to the object being searched. Other supplied constraints (if otherwise valid) will always evaluate to false and thus will always result in no matches.
objectType
- the Grid Object type to search forconstraint
- the constraint to be used in the search.detail
- true if the full set of facts is required, false if only
the basic set is required.
GridAuthenticationException
- is the supplied credentials are
invalid or do no permit the operation.
GridException
- if any error occurs such as an illegal constraintGridObjectInfo[] getGridObjects(String objectType, String constraintStr, boolean detail, String[] rankBy) throws GridAuthenticationException, GridException
The constraint is expected to only contain facts that relate to the object being searched. Other supplied constraints (if otherwise valid) will always evaluate to false and thus will always result in no matches.
Ordering is specified as an array of strings with each element in the form "<factname>/<ascending|descending". The ascending/decending order may be shortened to 'a|d'.
objectType
- the Grid Object type to search forconstraintStr
- the string representation of the constraint to be
used in the search.detail
- true if the full set of facts is required, false if only
the basic set is required.rankBy
- the specification used to order the returned array or
null for don't care
GridAuthenticationException
- is the supplied credentials are
invalid or do no permit the operation.
GridException
- if any error occurs such as an illegal constraintGridObjectInfo[] getGridObjects(String objectType, Constraint constraint, boolean detail, String[] rankBy) throws GridAuthenticationException, GridException
Ordering is specified as an array of strings with each element in the form "<factname>/<ascending|descending". The ascending/decending order may be shortened to 'a|d'.
constraint
- the constraint to be used in the search.objectType
- the Grid Object type to search fordetail
- true if the full set of facts is required, false if only
the basic set is required.rankBy
- the specification used to order the returned array or
null for don't care
GridAuthenticationException
- is the supplied credentials are
invalid or do no permit the operation.
GridException
- if any error occurs such as an illegal constraintGridObjectInfo getGridObjectInfo(String gridObjectType, String gridObjectName) throws GridAuthenticationException, GridObjectNotFoundException, GridException
gridObjectType
- the type of the grid objectgridObjectName
- the name of the grid object
GridAuthenticationException
- is the supplied credentials are
invalid or do no permit the operation.
GridObjectNotFoundException
- if the object cannot be found
GridException
- if any error occursJobInfo getJobInfo(String jobName) throws GridException
GridException
void setFact(String gridObjectType, String gridObjectName, String factName, int factType, Object value) throws GridAuthenticationException, GridObjectNotFoundException, GridException
gridObjectType
- the type of the grid objectgridObjectName
- the name of the grid objectfactName
- Name of fact to setfactType
- Fact value type to setvalue
- Fact value to set
GridAuthenticationException
- is the supplied credentials are
invalid or do no permit the operation.
GridObjectNotFoundException
- if the object cannot be found
GridException
- if any error occurs
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |