/** * Returns a Job by the provided sid. * * @param sid The sid for a job. * @return A Job. */ public Job getJob(String sid) { return new Job(this, JobCollection.REST_PATH + "/" + sid); }
/** * Returns the number of previews that have been generated so far for this * job. * * @return The number of previews. */ public int getNumPreviews() { checkReady(); return getInteger("numPreviews"); }
/** * Performs the requested action on this job. Valid values are: "pause", * "unpause", "finalize", "cancel", "touch", "setttl", "setpriority", * "enablepreview", and "disablepreview". * * @param action The action to perform. * @return The search job. */ public Job control(String action) { return control(action, null); }
/** * Indicates whether the job failed. * * @return {@code true} if the job failed, {@code false} if not. */ public boolean isFailed() { checkReady(); return getBoolean("isFailed"); }
/** * Returns the dispatch state for this job. <br> * Valid values are: QUEUED, PARSING, RUNNING, PAUSED, FINALIZING, FAILED, * or DONE. * * @return This job's dispatch state. */ public String getDispatchState() { checkReady(); return getString("dispatchState"); }
/** * Indicates whether the job is done. * * @return {@code true} if the job is done, {@code false} if not. */ public boolean isDone() { if (!isReady()) return false; if (!getBoolean("isDone")) { this.refresh(); } return getBoolean("isDone"); }
/** * Returns the count of events (pre-transforming) that were generated as a long. * * @return The number of events. */ public long getEventCountLong() { checkReady(); return getLong("eventCount"); }
/** * Returns the latest time in the time range to search. * @see #getCursorTime * @see #getEarliestTime * @see #getDoneProgress * * @return The latest time, in UTC format. */ public Date getLatestTime() { checkReady(); return getDate("latestTime"); }
/** * Returns the {@code InputStream} IO handle for the preview results from * this job. * * @return The preview results {@code InputStream} IO handle. */ public InputStream getResultsPreview() { checkReady(); return getResultsPreview(null); }
/** * Returns the {@code InputStream} IO handle for this job's events. * * @return The event {@code InputStream} IO handle. */ public InputStream getEvents() { checkReady(); return getEvents(null); }
/** * Returns the time that the search job took to complete. * * @return The run-time duration, in seconds. */ public float getRunDuration() { checkReady(); return getFloat("runDuration"); }
/** * Returns the {@code InputStream} IO handle for the results from this job. * * @return The results {@code InputStream} IO handle. */ public InputStream getResults() { checkReady(); return getResults(null); }
/** * Returns the {@code InputStream} IO handle for the summary for this job. * * @return The summary {@code InputStream} IO handle. */ public InputStream getSummary() { checkReady(); return getSummary(null); }
/** * Returns a list of search peers that were contacted for this search. * * @return The search peers. */ public String[] getSearchProviders() { checkReady(); return getStringArray("searchProviders", null); } /**
/** * Returns this job's search title. * * @return The search title. */ public String getSearch() { checkReady(); return getTitle(); }
/** * Returns the {@code InputStream} IO handle for the timeline for this job. * * @return The timeline {@code InputStream} IO handle. */ public InputStream getTimeline() { checkReady(); return getTimeline(null); }
/** * Returns this job's name (its search ID). * * @return The search job name. */ @Override public String getName() { checkReady(); return getSid(); }
/** * Returns the {@code InputStream} IO handle to the search log for this job. * * @return The search log {@code InputStream} IO handle. */ public InputStream getSearchLog() { checkReady(); return getSearchLog(null); }
/** * Sets this job's priority in the range of 0-10. * * @param value The new priority. */ public void setPriority(int value) { checkReady(); control("setpriority", new Args("priority", value)); }
/** * Performs the requested action on this job. Valid values are: "pause", * "unpause", "finalize", "cancel", "touch", "setttl", "setpriority", * "enablepreview", and "disablepreview". * * @param action The action to perform. * @param args Optional arguments for this action ("ttl" and "priority"). * @return The search job. */ public Job control(String action, Map args) { args = Args.create(args).add("action", action); service.post(actionPath("control"), args); invalidate(); return this; }