hudson
Class FileSystemProvisioner.Default.DescriptorImpl

java.lang.Object
  extended by hudson.model.Descriptor<FileSystemProvisioner>
      extended by hudson.FileSystemProvisionerDescriptor
          extended by hudson.FileSystemProvisioner.Default.DescriptorImpl
All Implemented Interfaces:
ExtensionPoint, Saveable
Enclosing class:
FileSystemProvisioner.Default

@Extension
public static final class FileSystemProvisioner.Default.DescriptorImpl
extends FileSystemProvisionerDescriptor


Nested Class Summary
 
Nested classes/interfaces inherited from class hudson.model.Descriptor
Descriptor.FormException, Descriptor.PropertyType, Descriptor.Self
 
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
 
Field Summary
 
Fields inherited from class hudson.model.Descriptor
clazz
 
Fields inherited from interface hudson.model.Saveable
NOOP
 
Constructor Summary
FileSystemProvisioner.Default.DescriptorImpl()
           
 
Method Summary
 boolean discard(FilePath ws, TaskListener listener)
          Called to clean up a workspace that may potentially belong to this FileSystemProvisioner.
 String getDisplayName()
          Human readable name of this kind of configurable object.
 
Methods inherited from class hudson.model.Descriptor
addHelpFileRedirect, calcAutoCompleteSettings, calcFillSettings, configure, configure, doHelp, find, find, getCheckUrl, getConfigFile, getConfigPage, getCurrentDescriptorByNameUrl, getDescriptorFullUrl, getDescriptorUrl, getGlobalConfigPage, getGlobalPropertyType, getHelpFile, getHelpFile, getHelpFile, getId, getJsonSafeClassName, getKlass, getPlugin, getPossibleViewNames, getPropertyType, getPropertyType, getPropertyTypeOrDie, getT, getViewPage, isInstance, isSubTypeOf, load, newInstance, newInstance, newInstancesFromHeteroList, newInstancesFromHeteroList, save, self, toArray, toList, toMap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileSystemProvisioner.Default.DescriptorImpl

public FileSystemProvisioner.Default.DescriptorImpl()
Method Detail

discard

public boolean discard(FilePath ws,
                       TaskListener listener)
                throws IOException,
                       InterruptedException
Description copied from class: FileSystemProvisionerDescriptor
Called to clean up a workspace that may potentially belong to this FileSystemProvisioner.

Because users may modify the file system behind Hudson, and slaves may come and go when configuration changes hapen, in general case Hudson is unable to keep track of which jobs have workspaces in which slaves.

So instead we rey on a garbage collection mechanism, to look at workspaces left in the file system without the contextual information of the owner project, and try to clean that up.

This method is called to do this, after Hudson determines that the workspace should be deleted to reclaim disk space. The implementation of this method is expected to sniff the contents of the workspace, and if it looks like the one created by FileSystemProvisioner.prepareWorkspace(AbstractBuild, FilePath, TaskListener), perform the necessary deletion operation, and return true.

If the workspace isn't the one created by this FileSystemProvisioner, or if the workspace can be simply deleted by FilePath.deleteRecursive(), then simply return false to give other FileSystemProvisionerDescriptors a chance to discard them.

Specified by:
discard in class FileSystemProvisionerDescriptor
Parameters:
ws - The workspace directory to be removed.
listener - The status of the operation, error message, etc., should go here.
Returns:
true if this FileSystemProvisionerDescriptor is responsible for de-alocating the workspace. false otherwise, in which case the other FileSystemProvisionerDescriptors are asked to clean up the workspace.
Throws:
IOException
InterruptedException

getDisplayName

public String getDisplayName()
Description copied from class: Descriptor
Human readable name of this kind of configurable object.

Specified by:
getDisplayName in class Descriptor<FileSystemProvisioner>


Copyright © 2004-2013. All Rights Reserved.