hudson.model
Class ViewJob<JobT extends ViewJob<JobT,RunT>,RunT extends Run<JobT,RunT>>

java.lang.Object
  extended by hudson.model.AbstractModelObject
      extended by hudson.model.Actionable
          extended by hudson.model.AbstractItem
              extended by hudson.model.Job<JobT,RunT>
                  extended by hudson.model.ViewJob<JobT,RunT>
All Implemented Interfaces:
ExtensionPoint, DescriptorByNameOwner, Item, ModelObject, PersistenceRoot, Saveable, SearchableModelObject, SearchItem, AccessControlled, ModelObjectWithContextMenu, OnMaster, org.kohsuke.stapler.HttpDeletable, org.kohsuke.stapler.StaplerOverridable

public abstract class ViewJob<JobT extends ViewJob<JobT,RunT>,RunT extends Run<JobT,RunT>>
extends Job<JobT,RunT>

Job that monitors activities that happen outside Hudson, which requires occasional batch reload activity to obtain the up-to-date information.

This can be used as a base class to derive custom Job type.

Author:
Kohsuke Kawaguchi

Nested Class Summary
 
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
 
Nested classes/interfaces inherited from interface jenkins.model.ModelObjectWithContextMenu
ModelObjectWithContextMenu.ContextMenu, ModelObjectWithContextMenu.MenuItem
 
Field Summary
static boolean reloadPeriodically
          In the very old version of Hudson, an external job submission was just creating files on the file system, so we needed to periodically reload the jobs from a file system to pick up new records.
protected  RunMap<RunT> runs
          All Runs.
 
Fields inherited from class hudson.model.Job
HISTORY_ADAPTER, nextBuildNumber, properties
 
Fields inherited from class hudson.model.AbstractItem
description, displayName, name, PRONOUN
 
Fields inherited from interface hudson.model.Item
BUILD, CANCEL, CONFIGURE, CREATE, DELETE, DISCOVER, EXTENDED_READ, PERMISSIONS, READ, WIPEOUT, WORKSPACE
 
Fields inherited from interface hudson.model.Saveable
NOOP
 
Constructor Summary
protected ViewJob(ItemGroup parent, String name)
           
protected ViewJob(Jenkins parent, String name)
          Deprecated. as of 1.390
 
Method Summary
protected  SortedMap<Integer,RunT> _getRuns()
          Gets all the runs.
 boolean isBuildable()
          Returns true if we should display "build now" icon
 void onLoad(ItemGroup<? extends Item> parent, String name)
          Called right after when a Item is loaded from disk.
protected abstract  void reload()
          Reloads the list of Runs.
 void removeRun(RunT run)
          Called from Run to remove it from this job.
protected  void submit(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          Derived class can override this to perform additional config submission work.
 
Methods inherited from class hudson.model.Job
addProperty, assignBuildNumber, createHistoryWidget, delete, doBuildStatus, doConfigSubmit, doDescription, doDoRename, doRssAll, doRssFailed, getACL, getAllJobs, getAllProperties, getBuild, getBuildByNumber, getBuildDir, getBuildDiscarder, getBuildForCLI, getBuildHealth, getBuildHealthReports, getBuilds, getBuilds, getBuildsAsMap, getBuildsByTimestamp, getBuildStatusUrl, getBuildTimeGraph, getCharacteristicEnvVars, getDynamic, getEnvironment, getEstimatedDuration, getFirstBuild, getIconColor, getLastBuild, getLastBuildsOverThreshold, getLastCompletedBuild, getLastFailedBuild, getLastStableBuild, getLastSuccessfulBuild, getLastUnstableBuild, getLastUnsuccessfulBuild, getLogRotator, getNearestBuild, getNearestOldBuild, getNewBuilds, getNextBuildNumber, getOverrides, getPermalinks, getPronoun, getProperties, getProperty, getProperty, getQueueItem, getTimeline, getWidgets, isBuilding, isHoldOffBuildUntilSave, isInQueue, isKeepDependencies, isLogUpdated, isNameEditable, logRotate, makeSearchIndex, onCopiedFrom, performDelete, removeProperty, removeProperty, renameTo, save, saveNextBuildNumber, setBuildDiscarder, setLogRotator, supportsLogRotator, updateNextBuildNumber
 
Methods inherited from class hudson.model.AbstractItem
checkPermission, delete, doConfigDotXml, doDoDelete, doSetName, doSubmitDescription, getAbsoluteUrl, getApi, getConfigFile, getDescription, getDescriptorByName, getDisplayName, getDisplayNameOrNull, getFullDisplayName, getFullName, getName, getParent, getRelativeNameFrom, getRelativeNameFrom, getRelativeNameFromGroup, getRootDir, getSearchName, getSearchUrl, getShortUrl, getUrl, hasPermission, onCreatedFromScratch, resolveForCLI, setDescription, setDisplayName, setDisplayNameOrNull, toString, updateByXml, updateByXml
 
Methods inherited from class hudson.model.Actionable
addAction, doContextMenu, getAction, getAction, getActions, getActions
 
Methods inherited from class hudson.model.AbstractModelObject
getSearch, getSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface hudson.search.SearchableModelObject
getSearch
 
Methods inherited from interface hudson.search.SearchItem
getSearchIndex
 

Field Detail

runs

protected transient RunMap<RunT extends Run<JobT,RunT>> runs
All Runs. Copy-on-write semantics.


reloadPeriodically

public static boolean reloadPeriodically
In the very old version of Hudson, an external job submission was just creating files on the file system, so we needed to periodically reload the jobs from a file system to pick up new records.

We then switched to submission via HTTP, so this reloading is no longer necessary, so only do this when explicitly requested.

Constructor Detail

ViewJob

protected ViewJob(Jenkins parent,
                  String name)
Deprecated. as of 1.390


ViewJob

protected ViewJob(ItemGroup parent,
                  String name)
Method Detail

isBuildable

public boolean isBuildable()
Description copied from class: Job
Returns true if we should display "build now" icon

Specified by:
isBuildable in class Job<JobT extends ViewJob<JobT,RunT>,RunT extends Run<JobT,RunT>>

onLoad

public void onLoad(ItemGroup<? extends Item> parent,
                   String name)
            throws IOException
Description copied from class: AbstractItem
Called right after when a Item is loaded from disk. This is an opporunity to do a post load processing.

Specified by:
onLoad in interface Item
Overrides:
onLoad in class Job<JobT extends ViewJob<JobT,RunT>,RunT extends Run<JobT,RunT>>
name - Name of the directory (not a path --- just the name portion) from which the configuration was loaded. This usually becomes the name of this item.
Throws:
IOException

_getRuns

protected SortedMap<Integer,RunT> _getRuns()
Description copied from class: Job
Gets all the runs. The resulting map must be treated immutable (by employing copy-on-write semantics.) The map is descending order, with newest builds at the top.

Specified by:
_getRuns in class Job<JobT extends ViewJob<JobT,RunT>,RunT extends Run<JobT,RunT>>

removeRun

public void removeRun(RunT run)
Description copied from class: Job
Called from Run to remove it from this job. The files are deleted already. So all the callee needs to do is to remove a reference from this Job.

Specified by:
removeRun in class Job<JobT extends ViewJob<JobT,RunT>,RunT extends Run<JobT,RunT>>

reload

protected abstract void reload()
Reloads the list of Runs. This operation can take a long time.

The loaded Runs should be set to runs.


submit

protected void submit(org.kohsuke.stapler.StaplerRequest req,
                      org.kohsuke.stapler.StaplerResponse rsp)
               throws IOException,
                      javax.servlet.ServletException,
                      Descriptor.FormException
Description copied from class: Job
Derived class can override this to perform additional config submission work.

Overrides:
submit in class Job<JobT extends ViewJob<JobT,RunT>,RunT extends Run<JobT,RunT>>
Throws:
IOException
javax.servlet.ServletException
Descriptor.FormException


Copyright © 2004-2013. All Rights Reserved.