TEMERITY

us.temerity.pipeline
Class ActionAgenda

java.lang.Object
  extended by us.temerity.pipeline.ActionAgenda
All Implemented Interfaces:
Serializable, Glueable

public class ActionAgenda
extends Object
implements Glueable, Serializable

The complete description of the information needed to execute a node action.

See Also:
Serialized Form

Constructor Summary
ActionAgenda()
          This constructor is required by the GlueDecoder to instantiate the class when encountered during the reading of GLUE format files and should not be called from user code.
ActionAgenda(ActionAgenda agenda, DoubleMap<OsType,String,String> envs)
          Construct an action agenda which includes a cooked toolset environment.
ActionAgenda(long jobID, NodeID nodeID, FileSeq primaryTarget, Set<FileSeq> secondaryTargets, Map<String,FileSeq> primarySources, Map<String,Set<FileSeq>> secondarySources, Map<String,ActionInfo> actionInfo, String toolset)
          Construct a new action agenda.
 
Method Summary
 String evaluate(String source)
          Replaces all references to environmental variables in the given source string with their values from agenda's Toolset environment.
 String evaluate(String source, OsType os)
          Replaces all references to environmental variables in the given source string with their values from agenda's Toolset environment.
static String evaluateInEnvironment(String source, Map<String,String> env)
          Replaces all references to environmental variables in the given source string with their values from the given Toolset environment.
 void fromGlue(GlueDecoder decoder)
          Restores the non-transient fields of the class from Glue.
 SortedMap<String,String> getEnvironment()
          Get the environment for the current operating system under which the action is executed.
 SortedMap<String,String> getEnvironment(OsType os)
          Get the environment for a specific operating system under which the action is executed.
 long getJobID()
          Get the unique job identifier.
 NodeID getNodeID()
          Gets the unique working version identifier of the target node.
 FileSeq getPrimarySource(String name)
          Get the primary file sequence of the given source node.
 FileSeq getPrimaryTarget()
          Get the primary file sequence to generate.
 SortedSet<FileSeq> getSecondarySources(String name)
          Get the secondary file sequences of the given source node.
 SortedSet<FileSeq> getSecondaryTargets()
          Get the secondary file sequences to generate.
 ActionInfo getSourceActionInfo(String name)
          The action parameter information for a given source node.
 String getSourceName()
          Get the fully resolved names of the first source node.
 Set<String> getSourceNames()
          Get the fully resolved names of the source nodes.
 String getSubProcessOwner()
          Get the name of the user which should own the process executing OS level process generated by the BaseAction.prep method.
 Path getTargetPath()
          Get the abstract pathname of the directory where the target file generated by the Action should be written as accessed by the current operating system.
 Path getTargetPath(OsType os)
          Get the abstract pathname of the directory where the target file generated by the Action should be written as accessed by the given operating system.
 TreeSet<FileSeq> getTargetSequences()
          Get the primary and secondary file sequences to generate.
 String getToolset()
          Get the name of the toolset environment.
 File getWorkingDir()
          Deprecated. The working directory returned by this method is always the working area directory which will ultimately contain the target files generated by the Action. However, it is more useful to know the directory where target files should be written by the Action using getTargetPath which varies according to the operating system used to execute the Action.
 File getWorkingDir(OsType os)
          Deprecated. The working directory returned by this method is always the working area directory which will ultimately contain the target files generated by the Action. However, it is more useful to know the directory where target files should be written by the Action using getTargetPath which varies according to the operating system used to execute the Action.
 Path getWorkingPath()
          Deprecated. The working directory returned by this method is always the working area directory which will ultimately contain the target files generated by the Action. However, it is more useful to know the directory where target files should be written by the Action using getTargetPath which varies according to the operating system used to execute the Action.
 Path getWorkingPath(OsType os)
          Deprecated. The working directory returned by this method is always the working area directory which will ultimately contain the target files generated by the Action. However, it is more useful to know the directory where target files should be written by the Action using getTargetPath which varies according to the operating system used to execute the Action.
 boolean hasSources()
          Whether there are any source nodes.
 void toGlue(GlueEncoder encoder)
          Saves the non-transient fields of this object as Glue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActionAgenda

public ActionAgenda()
This constructor is required by the GlueDecoder to instantiate the class when encountered during the reading of GLUE format files and should not be called from user code.


ActionAgenda

public ActionAgenda(long jobID,
                    NodeID nodeID,
                    FileSeq primaryTarget,
                    Set<FileSeq> secondaryTargets,
                    Map<String,FileSeq> primarySources,
                    Map<String,Set<FileSeq>> secondarySources,
                    Map<String,ActionInfo> actionInfo,
                    String toolset)
Construct a new action agenda.

Parameters:
jobID - The unique job identifier.
nodeID - The unique working version identifier of the target node.
primaryTarget - The primary file sequence to generate.
secondaryTargets - The secondary file sequences to generate.
primarySources - The primary file sequences indexed by fully resolved source node name.
secondarySources - The secondary file sequences indexed by fully resolved source node name.
actionInfo - The action parameter information for each source node linked to the target node by a Dependency link and which has an action.
toolset - The name of the toolset environment under which the action is executed.

ActionAgenda

public ActionAgenda(ActionAgenda agenda,
                    DoubleMap<OsType,String,String> envs)
Construct an action agenda which includes a cooked toolset environment.

Parameters:
agenda - The agenda to copy.
envs - The cooked toolset environments indexed by operating system type.
Method Detail

getJobID

public long getJobID()
Get the unique job identifier.


getNodeID

public NodeID getNodeID()
Gets the unique working version identifier of the target node.


getTargetSequences

public TreeSet<FileSeq> getTargetSequences()
Get the primary and secondary file sequences to generate.


getPrimaryTarget

public FileSeq getPrimaryTarget()
Get the primary file sequence to generate.


getSecondaryTargets

public SortedSet<FileSeq> getSecondaryTargets()
Get the secondary file sequences to generate.


hasSources

public boolean hasSources()
Whether there are any source nodes.


getSourceName

public String getSourceName()
Get the fully resolved names of the first source node.

Returns:
The first source node name or null if there are no sources.

getSourceNames

public Set<String> getSourceNames()
Get the fully resolved names of the source nodes.


getPrimarySource

public FileSeq getPrimarySource(String name)
Get the primary file sequence of the given source node.

Parameters:
name - The fully resolved node name.

getSecondarySources

public SortedSet<FileSeq> getSecondarySources(String name)
Get the secondary file sequences of the given source node.

Parameters:
name - The fully resolved node name.

getSourceActionInfo

public ActionInfo getSourceActionInfo(String name)
The action parameter information for a given source node.

Parameters:
name - The fully resolved node name.
Returns:
The action info or null if the given source does not have an action or is linked to the target node by a Association/Reference link.

getSubProcessOwner

public String getSubProcessOwner()
Get the name of the user which should own the process executing OS level process generated by the BaseAction.prep method.

On Unix and MacOS systems, this will be the same as the owner of the node. On Windows systems, all Actions are run as the "pipeline" user. This method is provided as a convenience to plugin developers for use in supplying the first argument to the SubProcessHeavy constructor returned the prep method.


getToolset

public String getToolset()
Get the name of the toolset environment.


getEnvironment

public SortedMap<String,String> getEnvironment()
                                        throws PipelineException
Get the environment for the current operating system under which the action is executed.

Throws:
PipelineException - If the current operating system is not supported by the toolset.

getEnvironment

public SortedMap<String,String> getEnvironment(OsType os)
Get the environment for a specific operating system under which the action is executed.

Returns:
The environment or null if not supported by the toolset.

evaluate

public String evaluate(String source)
                throws PipelineException
Replaces all references to environmental variables in the given source string with their values from agenda's Toolset environment.

For each environmental variable, any references to that variable in the source will be replaced with the value of the variable. There are two forms of reference to a variable:

${VARIABLE_NAME}
The reference is replaced with the value of the environmental variable (VARIABLE_NAME) with no changes.

${VARIABLE_NAME+}
The reference is replaced with the value of the environmental variable (VARIABLE_NAME) which has first been converted to an abstract file system pathname using the Path class. This has the effect of converting all back slashes "\" with forward slashes "/" in the environmental variable value.

Since Toolsets variable values should not contain references to other variables, the order in which the substitutions can be performed is arbitrary.

Parameters:
source - The string to evaluate.
Returns:
A string in which all references to enviromental variables have been replaced with their values.
Throws:
PipelineException

evaluate

public String evaluate(String source,
                       OsType os)
                throws PipelineException
Replaces all references to environmental variables in the given source string with their values from agenda's Toolset environment.

For each environmental variable, any references to that variable in the source will be replaced with the value of the variable. There are two forms of reference to a variable:

${VARIABLE_NAME}
The reference is replaced with the value of the environmental variable (VARIABLE_NAME) with no changes.

${VARIABLE_NAME+}
The reference is replaced with the value of the environmental variable (VARIABLE_NAME) which has first been converted to an abstract file system pathname using the Path class. This has the effect of converting all back slashes "\" with forward slashes "/" in the environmental variable value.

Since Toolsets variable values should not contain references to other variables, the order in which the substitutions can be performed is arbitrary.

Parameters:
source - The string to evaluate.
Returns:
A string in which all references to enviromental variables have been replaced with their values.
Throws:
PipelineException

evaluateInEnvironment

public static String evaluateInEnvironment(String source,
                                           Map<String,String> env)
Replaces all references to environmental variables in the given source string with their values from the given Toolset environment.

For each environmental variable, any references to that variable in the source will be replaced with the value of the variable. There are two forms of reference to a variable:

${VARIABLE_NAME}
The reference is replaced with the value of the environmental variable (VARIABLE_NAME) with no changes.

${VARIABLE_NAME+}
The reference is replaced with the value of the environmental variable (VARIABLE_NAME) which has first been converted to an abstract file system pathname using the Path class. This has the effect of converting all back slashes "\" with forward slashes "/" in the environmental variable value.

Since Toolsets variable values should not contain references to other variables, the order in which the substitutions can be performed is arbitrary.

Parameters:
source - The string to evaluate.
env - The environment.
Returns:
A string in which all references to enviromental variables have been replaced with their values.

getWorkingPath

@Deprecated
public Path getWorkingPath()
Deprecated. The working directory returned by this method is always the working area directory which will ultimately contain the target files generated by the Action. However, it is more useful to know the directory where target files should be written by the Action using getTargetPath which varies according to the operating system used to execute the Action.

Get the abstract pathname of the execution working directory for the current operating system.


getWorkingDir

@Deprecated
public File getWorkingDir()
Deprecated. The working directory returned by this method is always the working area directory which will ultimately contain the target files generated by the Action. However, it is more useful to know the directory where target files should be written by the Action using getTargetPath which varies according to the operating system used to execute the Action.

Get the execution working directory for the current operating system.


getWorkingPath

@Deprecated
public Path getWorkingPath(OsType os)
Deprecated. The working directory returned by this method is always the working area directory which will ultimately contain the target files generated by the Action. However, it is more useful to know the directory where target files should be written by the Action using getTargetPath which varies according to the operating system used to execute the Action.

Get abstract pathname of the execution working directory.


getWorkingDir

@Deprecated
public File getWorkingDir(OsType os)
Deprecated. The working directory returned by this method is always the working area directory which will ultimately contain the target files generated by the Action. However, it is more useful to know the directory where target files should be written by the Action using getTargetPath which varies according to the operating system used to execute the Action.

Get the execution working directory for the given operating system.


getTargetPath

public Path getTargetPath()
Get the abstract pathname of the directory where the target file generated by the Action should be written as accessed by the current operating system.

When a Action is executed on a Unix or MacOS system, this target directory is the same as the working area directory which contains the target node of the Action. However, when the Action run on a Windows system, the target directory returned by this method is a temporary location writable by the "pipeline" user. After the Action is run, Pipeline will move the files in this temporary target directory to the working area directory containing the node and change their ownership to that of the owner of the node.


getTargetPath

public Path getTargetPath(OsType os)
Get the abstract pathname of the directory where the target file generated by the Action should be written as accessed by the given operating system.

When a Action is executed on a Unix or MacOS system, this target directory is the same as the working area directory which contains the target node of the Action. However, when the Action run on a Windows system, the target directory returned by this method is a temporary location writable by the "pipeline" user. After the Action is run, Pipeline will move the files in this temporary target directory to the working area directory containing the node and change their ownership to that of the owner of the node.


toGlue

public void toGlue(GlueEncoder encoder)
            throws GlueException
Description copied from interface: Glueable
Saves the non-transient fields of this object as Glue. Typically, the implementation will call GlueEncoder.encode for each non-transient field of the parent object.

Specified by:
toGlue in interface Glueable
Parameters:
encoder - [modified] The object used to encode this object's fields into Glue format.
Throws:
GlueException

fromGlue

public void fromGlue(GlueDecoder decoder)
              throws GlueException
Description copied from interface: Glueable
Restores the non-transient fields of the class from Glue. Typically, the implementation will call GlueDecoder.decode for each non-transient field of the parent object.

Specified by:
fromGlue in interface Glueable
Parameters:
decoder - The object used to decode this object's fields from Glue format.
Throws:
GlueException

TEMERITY