|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
@ProcessingContext @WebServlet(value="/ws/level-0/internal/processing") public interface ProcessingService
Defines TM reachable services to control the processing inside the GRID.
Method Summary | |
---|---|
URL |
assignContentToProcessSource(SourceIdentifier sourceIdentifier)
Returns a public reachable transfer URL that may be used to upload (HTTP-PUT) the binary content of the source. |
void |
assignExistingContentToProcessSource(SourceIdentifier sourceIdentifier,
FileIdentifier contentIdentifier)
Allows to assign content that is known to exist already inside the GRID avoiding any new uploads. |
SourceIdentifier |
assignProcessSource(UUID jobId,
URI remoteSourceURI,
Date lastModified,
String contentTag,
com.trendmicro.grid.acl.metadata.Metadata metadata)
Adds or updates the remote source with the given Metadata, assigns it to a single processing job and returns the source identifier which may be used to upload source content if required. |
URL |
assignProcessSourceWithContent(UUID jobId,
FileIdentifier contentIdentifier,
URI remoteSourceURI,
Date lastModified,
String contentTag,
com.trendmicro.grid.acl.metadata.Metadata metadata)
Adds or updates the remote source with the given Metadata, assigns it to a single processing job and directly returns an upload URL if GRID does not yet know the content. |
void |
cancelPerparedJob(UUID jobId)
Cancells the given job if it is still in prepared state. |
UUID |
cloneAndStartJob(UUID originalJobId)
Clones the given job and starts the clone. |
void |
enforceStartJob(UUID jobId)
Starts a prepared processing job after preparation was finished. |
List<Source> |
getAssignedSources(UUID jobId)
Retrieves all sources that are currently assigned to the given job. |
Job |
getJob(UUID job)
Returns the read & writable information on a job, identified by its id. |
JobDetails |
getJobDetails(UUID job)
Returns the detailed information on a job, identified by its id. |
Collection<Job> |
getJobs(Collection<UUID> jobIds)
Returns the read & writable information on the jobs, identified by their ids. |
UUIDListPage |
getJobsInState(Job.State jobState,
int pageNumber)
Returns a paged list of jobs that are in the given state. |
UUIDListPage |
getJobsInStateAndRange(Job.State jobState,
DaysRange lastUpdatedRange,
int pageNumber)
Returns a paged list of jobs that are in the given state and were last updated within the given range. |
Collection<Job.State> |
getJobStates(Collection<UUID> jobIds)
Returns the states of the jobs, identified by their ids. |
UUIDListPage |
getRunningJobs(int pageNumber)
Returns a paged list of running jobs. |
UUID |
prepareJob()
Prepares a new processing job and returns the job's GUID. |
UUID |
prepareSubJob(UUID parentJobId)
Prepares a new processing job and returns the job's GUID. |
void |
setJobPriority(UUID jobId,
int jobPriority)
Sets the priority of a prepared job. |
void |
startJob(UUID jobId)
Starts a prepared processing job after preparation was finished. |
UUID |
startReprocessingJob(FileIdentifier contentIdentifier,
boolean assignAllExistingSources,
int jobPriority)
Initiates a reprocessing job on the given file and returns the job GUID for monitoring the progress. |
UUID |
startReprocessingJobWithSources(FileIdentifier contentIdentifier,
Collection<SourceIdentifier> selectedSourceIdentifiers,
int jobPriority)
Initiates a reprocessing job on the given file and returns the job GUID for monitoring the progress. |
void |
storeProcessingResultsAndFinalizeJobs(Collection<ProcessPackageDataSet> processingResults)
Receives a collection of final processing results, stores them inside the GRID CoreDB and performs the final update on the assigned jobs. |
void |
updateJob(Job job)
Updates the given job inside the persistent store (= the database) |
Method Detail |
---|
@RequiredRoles(value={"access.protected.services","process.content"}) UUID prepareJob() throws AuthenticationException
AuthenticationException
- In case of the current user is not
authenticated or doesn't have the right to access the service.@RequiredRoles(value={"access.protected.services","process.content"}) UUID prepareSubJob(UUID parentJobId) throws AuthenticationException
parentJobId
- the GUID of the parent job.
AuthenticationException
- In case of the current user is not
authenticated or doesn't have the right to access the service.@RequiredRoles(value={"access.protected.services","process.content"}) void cancelPerparedJob(UUID jobId) throws AuthenticationException, IllegalRequestException
jobId
- The id of the job to cancel.
AuthenticationException
- In case of the current user is not
authenticated or doesn't have the right to access the service.
IllegalRequestException
- In case of the job ID is invalid or the job is not in prepared state.@RequiredRoles(value={"access.protected.services","process.content"}) void setJobPriority(UUID jobId, int jobPriority) throws AuthenticationException, IllegalRequestException
jobId
- The id of the job to modify.jobPriority
- the priority of the job as an integer value between 1 <= x <= 7.
1 is the lowest priority, 7 the highest and 4 is the default value.
AuthenticationException
- In case of the current user is not
authenticated or doesn't have the right to access the service.
IllegalRequestException
- In case of the job is not in prepared state.@RequiredRoles(value={"access.protected.services","process.content"}) void startJob(UUID jobId) throws AuthenticationException, IllegalRequestException
jobId
- The id of the job to start.
AuthenticationException
- In case of the current user is not
authenticated or doesn't have the right to access the service.
IllegalRequestException
- In case of the job ID is invalid or the job has no assigned sources.@RequiredRoles(value={"access.protected.services","process.content"}) void enforceStartJob(UUID jobId) throws AuthenticationException, IllegalRequestException
jobId
- The id of the job to start.
AuthenticationException
- In case of the current user is not
authenticated or doesn't have the right to access the service.
IllegalRequestException
- In case of the job ID is invalid or the job has no assigned sources.@RequiredRoles(value={"access.protected.services","process.content"}) UUID startReprocessingJob(FileIdentifier contentIdentifier, boolean assignAllExistingSources, int jobPriority) throws AuthenticationException, IllegalRequestException
UUID jobId = prepareJob();
SourceIdentiferListPage sourceIds = sourceService.getReferencingSources(fileId, 0);
SourceIdentifier sid = sourceIds.getElements().get(0);
Source source = sourceService.getSource(sid);
SourceInformation info = source.getSourceInformation();
sid = assignProcessSource(jobId, source.getRemoteURI(),
info.getLastModified(), info.getContentTag(), source.getMetadata());
assignExistingContentToProcessSource(sid, fileId);
enforceStartJob(jobId);
contentIdentifier
- The identifier of a previously stored file content.assignAllExistingSources
- Whether the newly created job will get the most recent
or all stored sources assigned.jobPriority
- the priority of the job as an integer value between 1 <= x <= 7.
1 is the lowest priority, 7 the highest and 4 is the default value.
AuthenticationException
- In case of the current user is not
authenticated or doesn't have the right to access the service.
IllegalRequestException
- If the content identifier does not point to an existing file content
or when no public source URIs were assigned to the file.@RequiredRoles(value={"access.protected.services","process.content"}) UUID startReprocessingJobWithSources(FileIdentifier contentIdentifier, Collection<SourceIdentifier> selectedSourceIdentifiers, int jobPriority) throws AuthenticationException, IllegalRequestException
startReprocessingJob(FileIdentifier, boolean, int)
with the major
difference that it allows to explicitly select which of the sources assigned with the package will
be used for reprocessing.
Note: Calling this method with a source identifier that has not been assigned to the file
will result in throwing an IllegalRequestException
. Only assigned sources are allowed
to be used as method parameters.
contentIdentifier
- The identifier of a previously stored file content.selectedSourceIdentifiers
- A list of identifiers to assign with the reprocessing job.jobPriority
- the priority of the job as an integer value between 1 <= x <= 7.
1 is the lowest priority, 7 the highest and 4 is the default value.
AuthenticationException
- In case of the current user is not
authenticated or doesn't have the right to access the service.
IllegalRequestException
- If the content identifier does not point to an existing file content
or when no public source URIs were assigned to the file.@RequiredRoles(value={"access.protected.services","process.content"}) UUID cloneAndStartJob(UUID originalJobId) throws AuthenticationException, IllegalRequestException
Job.State#ABORTED
, in order to
avoid double retrieval of the same processing results.
This method is useful to restart stale jobs (jobs running for a very long time without an update).
Note: Closing a job does not abort processing, it only sets the ABORTED flag within the DB. Processing
services outside of the ACL need to query this state if they need to act on the event of closing a job.
In case of a job is closed and results still reach the method call
storeProcessingResultsAndFinalizeJobs(java.util.Collection)
, the processing results of the
relevant job will get discarded and warning will be logged as indication.
originalJobId
- the job to clone and close.
AuthenticationException
- In case of the current user is not
authenticated or doesn't have the right to access the service.
IllegalRequestException
- If the jobId does not point to an existing job.@RequiredRoles(value={"access.protected.services","process.content"}) List<Source> getAssignedSources(UUID jobId) throws AuthenticationException
jobId
- the id of the job to query.
AuthenticationException
- In case of the current user is not
authenticated or doesn't have the right to access the service.@RequiredRoles(value={"access.protected.services","process.content"}) SourceIdentifier assignProcessSource(UUID jobId, URI remoteSourceURI, Date lastModified, String contentTag, com.trendmicro.grid.acl.metadata.Metadata metadata) throws AuthenticationException, IllegalRequestException
temporary == true
'.
jobId
- the id of the job to add the source to.remoteSourceURI
- The remote URI of the source.lastModified
- The remote last modified date of the source, if known (may be set to 'null').contentTag
- The remote content tag (e.g. ETAG) of the source, if known (may be set to 'null').metadata
- The metadata to store with the source.
AuthenticationException
- In case of the current user is not
authenticated or doesn't have the right to access the service.
IllegalRequestException
- In case of the job ID is not pointing to a prepared job or if the source
is already assigned to another job in the same session.@RequiredRoles(value={"access.protected.services","process.content","create.binary.content"}) URL assignContentToProcessSource(SourceIdentifier sourceIdentifier) throws AuthenticationException, IllegalRequestException
sourceIdentifier
- The identifier of a previously assigned process source.
AuthenticationException
- In case of the current user is not
authenticated or doesn't have the right to access the service.
IllegalRequestException
- In case of the source identifier is not referring to a previously
assigned process source.@RequiredRoles(value={"access.protected.services","process.content"}) void assignExistingContentToProcessSource(SourceIdentifier sourceIdentifier, FileIdentifier contentIdentifier) throws AuthenticationException, IllegalRequestException
sourceIdentifier
- The identifier of a previously assigned process source.contentIdentifier
- The identifier of a previously stored file content.
AuthenticationException
- In case of the current user is not
authenticated or doesn't have the right to access the service.
IllegalRequestException
- In case of the source identifier is not referring to a previously
assigned process source OR in case of the file identifier doesn't
refer to a file stored inside the file content repository.@RequiredRoles(value={"access.protected.services","process.content","create.binary.content"}) URL assignProcessSourceWithContent(UUID jobId, FileIdentifier contentIdentifier, URI remoteSourceURI, Date lastModified, String contentTag, com.trendmicro.grid.acl.metadata.Metadata metadata) throws AuthenticationException, IllegalRequestException
SourceIdentifier sourceIdentifier = assignProcessSource(jobId, remoteSourceURI, lastModified, contentTag, metadata);
boolean contentMayBeMissing = true;
Source source = sourceService.getSource(sourceIdentifier);
if (source != null) {
FileIdentifier existingIdentifier = source.getSourceContentIdentifier();
if (existingIdentifier != null) {
contentMayBeMissing = !existingIdentifier.equals(contentIdentifier);
}
}
URL putURL = null;
if (contentMayBeMissing) {
try {
assignExistingContentToProcessSource(sourceIdentifier, contentIdentifier);
} catch (IllegalRequestException ignored) {
putURL = assignContentToProcessSource(sourceIdentifier);
}
}
if (putURL != null) {
//TODO: Do the upload
}
can be replaced with:
URL putURL = assignProcessSourceWithContent(jobId, contentIdentifier, remoteSourceURI, lastModified, contentTag, metadata);
if (putURL != null) {
//TODO: Do the upload
}
jobId
- the id of the job to add the source to.remoteSourceURI
- The remote URI of the source.lastModified
- The remote last modified date of the source, if known (may be set to 'null').contentTag
- The remote content tag (e.g. ETAG) of the source, if known (may be set to 'null').metadata
- The metadata to store with the source.contentIdentifier
- The identifier of a previously stored file content.
AuthenticationException
- In case of the current user is not
authenticated or doesn't have the right to access the service.
IllegalRequestException
- In case of the job ID is not pointing to a prepared job or if the source
is already assigned to another job in the same session.@RequiredRoles(value={"access.protected.services","process.content"}) void storeProcessingResultsAndFinalizeJobs(Collection<ProcessPackageDataSet> processingResults) throws AuthenticationException, StorageFailedException
processingResults
- the processing results to update.
AuthenticationException
- In case of the current user is not
authenticated or doesn't have the right to access the service.
StorageFailedException
- In case of the storage failed on one of the data sets.@RequiredRoles(value="access.protected.services") UUIDListPage getRunningJobs(int pageNumber) throws AuthenticationException
pageNumber
- The page number of the list page to return (0 is first page).
AuthenticationException
- In case of the current user is not
authenticated or doesn't have the right to access the service.@RequiredRoles(value="access.protected.services") UUIDListPage getJobsInState(Job.State jobState, int pageNumber) throws AuthenticationException
pageNumber
- The page number of the list page to return (0 is first page).jobState
- The state of the jobs to query.
AuthenticationException
- In case of the current user is not
authenticated or doesn't have the right to access the service.@RequiredRoles(value="access.protected.services") UUIDListPage getJobsInStateAndRange(Job.State jobState, DaysRange lastUpdatedRange, int pageNumber) throws AuthenticationException
pageNumber
- The page number of the list page to return (0 is first page).jobState
- The state of the jobs to query.lastUpdatedRange
- The range when the last update was recorded.
AuthenticationException
- In case of the current user is not
authenticated or doesn't have the right to access the service.@ResponseWrapper(className="com.trendmicro.grid.acl.l0.wrappers.GetJobStatesResponse") @RequiredRoles(value="access.protected.services") Collection<Job.State> getJobStates(Collection<UUID> jobIds) throws AuthenticationException
jobIds
- The GUIDs of the jobs to return.
AuthenticationException
- In case of the current user is not
authenticated or doesn't have the right to access the service.@RequiredRoles(value="access.protected.services") Job getJob(UUID job) throws AuthenticationException
job
- The GUID of the job to return the details from.
AuthenticationException
- In case of the current user is not
authenticated or doesn't have the right to access the service.@ResponseWrapper(className="com.trendmicro.grid.acl.l0.wrappers.GetJobsResponse") @RequiredRoles(value="access.protected.services") Collection<Job> getJobs(Collection<UUID> jobIds) throws AuthenticationException
jobIds
- The GUIDs of the jobs to return.
AuthenticationException
- In case of the current user is not
authenticated or doesn't have the right to access the service.@RequiredRoles(value={"access.protected.services","process.content"}) void updateJob(Job job) throws AuthenticationException, IllegalRequestException
job
- the details to update.
AuthenticationException
- In case of the current user is not
authenticated or doesn't have the right to access the service.
IllegalRequestException
- In case of the values were changed to invalid settings.@RequiredRoles(value="access.protected.services") JobDetails getJobDetails(UUID job) throws AuthenticationException
job
- The GUID of the job to return the details for.
AuthenticationException
- In case of the current user is not
authenticated or doesn't have the right to access the service.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |