public abstract class TaskAction extends AbstractModelObject implements Action
Action
implementation for those who kick some
processing asynchronously (such as SCM tagging.)
The class offers the basic set of functionality to do it.
TaskThread
Modifier and Type | Field and Description |
---|---|
protected WeakReference<AnnotatedLargeText> |
log
Hold the log of the tagging operation.
|
protected TaskThread |
workerThread
If non-null, that means either the activitiy is in progress
asynchronously, or it failed unexpectedly and the thread is dead.
|
Constructor and Description |
---|
TaskAction() |
Modifier and Type | Method and Description |
---|---|
void |
doClearError(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
Clears the error status.
|
void |
doProgressiveHtml(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
Handles incremental log output.
|
void |
doProgressiveLog(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
Handles incremental log output.
|
protected abstract ACL |
getACL()
Gets the
ACL against which getPermission() is checked. |
abstract String |
getIconFileName()
Gets the file name of the icon.
|
org.kohsuke.stapler.framework.io.LargeText |
getLog()
Deprecated.
as of 1.350
Use
obtainLog() , which returns the same object in a more type-safe signature. |
protected abstract Permission |
getPermission()
Gets the permission object that represents the permission (against
getACL() ) to perform this task. |
String |
getSearchUrl()
Returns the URL of this item relative to the parent
SearchItem . |
TaskThread |
getWorkerThread() |
AnnotatedLargeText |
obtainLog()
Obtains the log file.
|
getSearch, getSearchIndex, getSearchName, makeSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendError
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getDisplayName, getUrlName
protected transient volatile TaskThread workerThread
protected transient WeakReference<AnnotatedLargeText> log
protected abstract Permission getPermission()
getACL()
) to perform this task.
Generally your implementation of getIconFileName()
should return null if !getACL().hasPermission(getPermission())
.protected abstract ACL getACL()
ACL
against which getPermission()
is checked.public abstract String getIconFileName()
getIconFileName
in interface Action
If an absolute file name that starts from '/' is returned (like "/plugin/foo/abc.gif'), then it will be interpreted as a path from the context root of Jenkins. This is useful to pick up image files from a plugin.
Finally, return null to hide it from the task list. This is normally not very useful, but this can be used for actions that only contribute floatBox.jelly and no task list item. The other case where this is useful is to avoid showing links that require a privilege when the user is anonymous.
getPermission()
@Deprecated public org.kohsuke.stapler.framework.io.LargeText getLog()
obtainLog()
, which returns the same object in a more type-safe signature.public AnnotatedLargeText obtainLog()
The default implementation get this from workerThread
,
so when it's complete, the log could be gone any time.
Derived classes that persist the text should override this method so that it fetches the file from disk.
public String getSearchUrl()
SearchItem
SearchItem
.getSearchUrl
in interface SearchItem
public TaskThread getWorkerThread()
public void doProgressiveLog(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException
IOException
public void doProgressiveHtml(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException
IOException
public void doClearError(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException
IOException
javax.servlet.ServletException
Copyright © 2018. All rights reserved.