hudson.model
Class TaskAction

java.lang.Object
  extended by hudson.model.AbstractModelObject
      extended by hudson.model.TaskAction
All Implemented Interfaces:
Action, ModelObject, SearchableModelObject, SearchItem
Direct Known Subclasses:
AbstractScmTagAction, MavenAbstractArtifactRecord

public abstract class TaskAction
extends AbstractModelObject
implements Action

Partial Action implementation for those who kick some processing asynchronously (such as SCM tagging.)

The class offers the basic set of functionality to do it.

Since:
1.191
Author:
Kohsuke Kawaguchi
See Also:
TaskThread

Field Summary
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 Summary
TaskAction()
           
 
Method Summary
 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 the permissions are checked.
 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 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.
 
Methods inherited from class hudson.model.AbstractModelObject
getSearch, getSearchIndex, getSearchName, makeSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface hudson.model.Action
getDisplayName, getIconFileName, getUrlName
 

Field Detail

workerThread

protected transient volatile TaskThread workerThread
If non-null, that means either the activitiy is in progress asynchronously, or it failed unexpectedly and the thread is dead.


log

protected transient WeakReference<AnnotatedLargeText> log
Hold the log of the tagging operation.

Constructor Detail

TaskAction

public TaskAction()
Method Detail

getPermission

protected abstract Permission getPermission()
Gets the permission object that represents the permission to perform this task.


getACL

protected abstract ACL getACL()
Gets the ACL against which the permissions are checked.


getLog

public 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.


obtainLog

public AnnotatedLargeText obtainLog()
Obtains the log file.

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.


getSearchUrl

public String getSearchUrl()
Description copied from interface: SearchItem
Returns the URL of this item relative to the parent SearchItem.

Specified by:
getSearchUrl in interface SearchItem
Returns:
URL like "foo" or "foo/bar". The path can end with '/'. The path that starts with '/' will be interpreted as the absolute path (within the context path of Hudson.)

getWorkerThread

public TaskThread getWorkerThread()

doProgressiveLog

public void doProgressiveLog(org.kohsuke.stapler.StaplerRequest req,
                             org.kohsuke.stapler.StaplerResponse rsp)
                      throws IOException
Handles incremental log output.

Throws:
IOException

doProgressiveHtml

public void doProgressiveHtml(org.kohsuke.stapler.StaplerRequest req,
                              org.kohsuke.stapler.StaplerResponse rsp)
                       throws IOException
Handles incremental log output.

Throws:
IOException

doClearError

public void doClearError(org.kohsuke.stapler.StaplerRequest req,
                         org.kohsuke.stapler.StaplerResponse rsp)
                  throws IOException,
                         javax.servlet.ServletException
Clears the error status.

Throws:
IOException
javax.servlet.ServletException


Copyright © 2004-2013. All Rights Reserved.