hudson.model
Class Slave

java.lang.Object
  extended by hudson.model.AbstractModelObject
      extended by hudson.model.Node
          extended by hudson.model.Slave
All Implemented Interfaces:
ExtensionPoint, Describable<Node>, ModelObject, SearchableModelObject, SearchItem, AccessControlled, Serializable
Direct Known Subclasses:
AbstractCloudSlave, DumbSlave

public abstract class Slave
extends Node
implements Serializable

Information about a Hudson slave node.

Ideally this would have been in the hudson.slaves package, but for compatibility reasons, it can't.

TODO: move out more stuff to DumbSlave.

Author:
Kohsuke Kawaguchi
See Also:
Serialized Form

Nested Class Summary
static class Slave.JnlpJar
          Web-bound object used to serve jar files for JNLP.
static class Slave.SlaveDescriptor
           
 
Nested classes/interfaces inherited from class hudson.model.Node
Node.Mode, Node.NodeListener
 
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
 
Constructor Summary
Slave(String name, String nodeDescription, String remoteFS, int numExecutors, Node.Mode mode, String labelString, ComputerLauncher launcher, RetentionStrategy retentionStrategy)
          Deprecated. since 2009-02-20.
Slave(String name, String nodeDescription, String remoteFS, int numExecutors, Node.Mode mode, String labelString, ComputerLauncher launcher, RetentionStrategy retentionStrategy, List<? extends NodeProperty<?>> nodeProperties)
           
Slave(String name, String nodeDescription, String remoteFS, String numExecutors, Node.Mode mode, String labelString, ComputerLauncher launcher, RetentionStrategy retentionStrategy, List<? extends NodeProperty<?>> nodeProperties)
           
 
Method Summary
 Computer createComputer()
          Creates a new Computer object that acts as the UI peer of this Node.
 Launcher createLauncher(TaskListener listener)
          Returns a Launcher for executing programs on this node.
 boolean equals(Object o)
           
 ClockDifference getClockDifference()
          Estimates the clock difference with this slave.
 SlaveComputer getComputer()
          Gets the corresponding computer object.
 Slave.SlaveDescriptor getDescriptor()
          Gets the descriptor for this instance.
 String getLabelString()
          Returns the manually configured label for a node.
 ComputerLauncher getLauncher()
           
 Node.Mode getMode()
          Returns Node.Mode.EXCLUSIVE if this node is only available for those jobs that exclusively specifies this node as the assigned node.
 String getNodeDescription()
          Human-readable description of this node.
 String getNodeName()
          Name of this node.
 DescribableList<NodeProperty<?>,NodePropertyDescriptor> getNodeProperties()
          Gets the NodeProperty instances configured for this Node.
 int getNumExecutors()
          Returns the number of Executors.
 String getRemoteFS()
           
 RetentionStrategy getRetentionStrategy()
           
 FilePath getRootPath()
          Gets the root directory of this node.
 FilePath getWorkspaceFor(TopLevelItem item)
          Returns a "workspace" directory for the given TopLevelItem.
 FilePath getWorkspaceRoot()
          Root directory on this slave where all the job workspaces are laid out.
 int hashCode()
           
 void setLauncher(ComputerLauncher launcher)
           
 void setMode(Node.Mode mode)
           
 void setNodeName(String name)
          When the user clones a Node, Hudson uses this method to change the node name right after the cloned Node object is instantiated.
 void setRetentionStrategy(RetentionStrategy availabilityStrategy)
           
 
Methods inherited from class hudson.model.Node
canTake, checkPermission, createPath, getACL, getAssignedLabels, getChannel, getDisplayName, getFileSystemProvisioner, getLabelCloud, getNodePropertyDescriptors, getSearchUrl, getSelfLabel, hasPermission, isHoldOffLaunchUntilSave, setOfflineCause, toComputer
 
Methods inherited from class hudson.model.AbstractModelObject
getSearch, getSearchIndex, getSearchName
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Slave

@DataBoundConstructor
public Slave(String name,
                                  String nodeDescription,
                                  String remoteFS,
                                  String numExecutors,
                                  Node.Mode mode,
                                  String labelString,
                                  ComputerLauncher launcher,
                                  RetentionStrategy retentionStrategy,
                                  List<? extends NodeProperty<?>> nodeProperties)
      throws Descriptor.FormException,
             IOException
Throws:
Descriptor.FormException
IOException

Slave

@Deprecated
public Slave(String name,
                        String nodeDescription,
                        String remoteFS,
                        int numExecutors,
                        Node.Mode mode,
                        String labelString,
                        ComputerLauncher launcher,
                        RetentionStrategy retentionStrategy)
      throws Descriptor.FormException,
             IOException
Deprecated. since 2009-02-20.

Throws:
Descriptor.FormException
IOException

Slave

public Slave(String name,
             String nodeDescription,
             String remoteFS,
             int numExecutors,
             Node.Mode mode,
             String labelString,
             ComputerLauncher launcher,
             RetentionStrategy retentionStrategy,
             List<? extends NodeProperty<?>> nodeProperties)
      throws Descriptor.FormException,
             IOException
Throws:
Descriptor.FormException
IOException
Method Detail

getLauncher

public ComputerLauncher getLauncher()

setLauncher

public void setLauncher(ComputerLauncher launcher)

getRemoteFS

public String getRemoteFS()

getNodeName

public String getNodeName()
Description copied from class: Node
Name of this node.

Specified by:
getNodeName in class Node
Returns:
"" if this is master

setNodeName

public void setNodeName(String name)
Description copied from class: Node
When the user clones a Node, Hudson uses this method to change the node name right after the cloned Node object is instantiated.

This method is never used for any other purpose, and as such for all practical intents and purposes, the node name should be treated like immutable.

Specified by:
setNodeName in class Node

getNodeDescription

public String getNodeDescription()
Description copied from class: Node
Human-readable description of this node.

Specified by:
getNodeDescription in class Node

getNumExecutors

public int getNumExecutors()
Description copied from class: Node
Returns the number of Executors. This may be different from getExecutors().size() because it takes time to adjust the number of executors.

Specified by:
getNumExecutors in class Node

getMode

public Node.Mode getMode()
Description copied from class: Node
Returns Node.Mode.EXCLUSIVE if this node is only available for those jobs that exclusively specifies this node as the assigned node.

Specified by:
getMode in class Node

setMode

public void setMode(Node.Mode mode)

getNodeProperties

public DescribableList<NodeProperty<?>,NodePropertyDescriptor> getNodeProperties()
Description copied from class: Node
Gets the NodeProperty instances configured for this Node.

Specified by:
getNodeProperties in class Node

getRetentionStrategy

public RetentionStrategy getRetentionStrategy()

setRetentionStrategy

public void setRetentionStrategy(RetentionStrategy availabilityStrategy)

getLabelString

public String getLabelString()
Description copied from class: Node
Returns the manually configured label for a node. The list of assigned and dynamically determined labels is available via Node.getAssignedLabels() and includes all labels that have been manually configured. Mainly for form binding.

Specified by:
getLabelString in class Node

getClockDifference

public ClockDifference getClockDifference()
                                   throws IOException,
                                          InterruptedException
Description copied from class: Node
Estimates the clock difference with this slave.

Specified by:
getClockDifference in class Node
Returns:
always non-null.
Throws:
InterruptedException - if the operation is aborted.
IOException

createComputer

public Computer createComputer()
Description copied from class: Node
Creates a new Computer object that acts as the UI peer of this Node. Nobody but Hudson.updateComputerList() should call this method.


getWorkspaceFor

public FilePath getWorkspaceFor(TopLevelItem item)
Description copied from class: Node
Returns a "workspace" directory for the given TopLevelItem.

Workspace directory is usually used for keeping out the checked out source code, but it can be used for anything.

Specified by:
getWorkspaceFor in class Node
Returns:
null if this node is not connected hence the path is not available

getRootPath

public FilePath getRootPath()
Description copied from class: Node
Gets the root directory of this node.

Hudson always owns a directory on every node. This method returns that.

Specified by:
getRootPath in class Node
Returns:
null if the node is offline and hence the FilePath object is not available.

getWorkspaceRoot

public FilePath getWorkspaceRoot()
Root directory on this slave where all the job workspaces are laid out.

Returns:
null if not connected.

createLauncher

public Launcher createLauncher(TaskListener listener)
Description copied from class: Node
Returns a Launcher for executing programs on this node.

The callee must call Launcher.decorateFor(Node) before returning to complete the decoration.

Specified by:
createLauncher in class Node

getComputer

public SlaveComputer getComputer()
Gets the corresponding computer object.


equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

getDescriptor

public Slave.SlaveDescriptor getDescriptor()
Description copied from interface: Describable
Gets the descriptor for this instance.

Descriptor is a singleton for every concrete Describable implementation, so if a.getClass()==b.getClass() then a.getDescriptor()==b.getDescriptor() must hold.

Specified by:
getDescriptor in interface Describable<Node>
Specified by:
getDescriptor in class Node


Copyright © 2004-2013 Hudson. All Rights Reserved.