|
TEMERITY | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectus.temerity.pipeline.Named
us.temerity.pipeline.PluginID
us.temerity.pipeline.BasePlugin
us.temerity.pipeline.BaseAction
public class BaseAction
The superclass of all Pipeline node action plugins.
Actions are used by Pipeline to regenerate the files associated with non-leaf nodes in a consistent and reliable manner.
New kinds of actions can be written by subclassing this class. Due to the way plugins are loaded and communicated between applications, any fields added to a subclass will be reinitialized when the action is stored to disk or when it is sent over the network. Any data which must be retained by the action should be stored in an action parameter instead.
While new plugin subclass versions are being modified and tested the
underDevelopment method should be called in the subclasses
constructor to enable the plugin to be dynamically reloaded. Nodes which use one of
these dynamically reloadable Action plugins cannot be Checked-In until the plugin is
no longer under development.
Most Action plugins should be subclassed from CommonActionUtils instead of this
class in order to get the benefit of the many helper methods useful for writing the
new Action plugin class. This class is more bare bones and includes only the essentials
required by all Action plugins.
| Field Summary |
|---|
| Fields inherited from class us.temerity.pipeline.BasePlugin |
|---|
pDescription |
| Fields inherited from class us.temerity.pipeline.PluginID |
|---|
pVendor, pVersionID |
| Fields inherited from class us.temerity.pipeline.Named |
|---|
pName |
| Constructor Summary | |
|---|---|
|
BaseAction()
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. |
|
BaseAction(BaseAction action)
Copy constructor. |
protected |
BaseAction(String name,
VersionID vid,
String vendor,
String desc)
Construct with the given name, version, vendor and description. |
| Method Summary | |
|---|---|
protected void |
addPreset(String name,
ArrayList<String> choices)
Add a named set of parameter preset choices to the action. |
protected void |
addPresetValues(String name,
String choice,
TreeMap<String,Comparable> values)
Add the values of single valued parameters which should be set when a given preset choice is selected. |
protected void |
addSingleParam(ActionParam param)
Add a single valued parameter to this Action. |
static void |
chmod(int mode,
File file)
Deprecated. Since this method is not portable to all operation systems, it should be avoided in the prep method of portable Action plugins. The principle use of this
method was in creating execuable bash(1) scripts. However, this really isn't needed
even for bash(1) scripts since its just as easy to create a non-execuable script and
pass it as the argument to the bash(1) executable instead. |
protected void |
cleanupLater(File file)
Add the given file to the set of files which will be removed upon termination of the Java runtime. |
void |
clearAllLinkParams()
Unset all single valued LinkActionParam parameters. |
void |
clearLinkParams(String source)
Unset any single valued LinkActionParam parameters which are currently set to the given source node. |
Object |
clone()
Return a deep copy of this object. |
File |
createTemp(ActionAgenda agenda,
int mode,
String suffix)
Create a unique temporary file for the job with the given suffix and access permissions. |
File |
createTemp(ActionAgenda agenda,
String suffix)
Create a unique temporary file for the job with the given suffix. |
boolean |
equals(Object obj)
Indicates whether some other object is "equal to" this one. |
boolean |
equalSingleParams(BaseAction action)
Indicates whether the single valued parameters of the given action equal to this actions single valued parameters. |
boolean |
equalSourceParams(BaseAction action)
Indicates whether the per-source parameters of the given action equal to this actions per-source parameters for primary and secondary file sequences. |
void |
fromGlue(GlueDecoder decoder)
Restores the non-transient fields of the class from Glue. |
TreeMap<String,ActionParam> |
getInitialSourceParams()
Get an initial set of action parameters associated with an upstream node. |
PluginType |
getPluginType()
Get which general type of plugin this is. |
List<String> |
getPresetChoices(String name)
Get the choices for the given preset. |
SortedMap<String,Comparable> |
getPresetValues(String name,
String choice)
Get the preset values of single valued parameters set by a given preset choice. |
Set<FilePattern> |
getSecondarySequences(String source)
Get the file patterns of all secondary sequences with per-source parameters for the given node. |
Set<String> |
getSecondarySourceNames()
Get node names of the upstream nodes with secondary file sequence per-source parameters. |
ActionParam |
getSecondarySourceParam(String source,
FilePattern fpat,
String name)
Get the named parameter for a secondary file sequence of an upstream node. |
Collection<ActionParam> |
getSecondarySourceParams(String source,
FilePattern fpat)
Get all of the per-source parameters associated with the given secondary file sequence of an upstream node. |
Comparable |
getSecondarySourceParamValue(String source,
FilePattern fpat,
String name)
Get the value of the named parameter for a secondary file sequence of an upstream node. |
LayoutGroup |
getSingleLayout()
Get the grouping of single valued parameters used to layout components which represent the parameters in the user interface. |
ActionParam |
getSingleParam(String name)
Get the single valued parameter with the given name. |
Collection<ActionParam> |
getSingleParams()
Get all of the single valued parameters. |
Comparable |
getSingleParamValue(String name)
Get the value of the single valued parameter with the given name. |
List<String> |
getSourceLayout()
Get the grouping of per-source parameters used to layout components which represent the parameters in the user interface. |
Set<String> |
getSourceNames()
Get node names of the upstream nodes with primary file sequence per-source parameters. |
ActionParam |
getSourceParam(String source,
String name)
Get the named parameter for the primary file sequence of an upstream node. |
Collection<ActionParam> |
getSourceParams(String source)
Get all of the per-source parameters associated with the primary file sequence of an upstream node. |
Comparable |
getSourceParamValue(String source,
String name)
Get the value of the named parameter for the primary file sequence of an upstream node. |
static File |
getTempDir(ActionAgenda agenda)
Get the root directory used to store temporary files created by the job. |
static Path |
getTempPath(ActionAgenda agenda)
Get the abstract pathname of the root directory used to store temporary files created by the job. |
boolean |
hasSecondarySourceParams(String source,
FilePattern fpat)
Whether this action has per-source parameters for a secondary sequence of the given node. |
boolean |
hasSingleParams()
Does the action have any single valued parameters? |
boolean |
hasSourceParams(String source)
Whether this action has per-source parameters for the primary sequence of the given node. |
void |
initSecondarySourceParams(String source,
FilePattern fpat)
Initialize a new set of parameters for a secondary file sequence of an upstream node. |
void |
initSourceParams(String source)
Initialize a new set of parameters for the primary sequence of an upstream node. |
SubProcessHeavy |
prep(ActionAgenda agenda,
File outFile,
File errFile)
Construct a SubProcessHeavy instance which when executed will fulfill the
given action agenda. |
void |
removeAllSourceParams()
Remove all per-source parameters from this action. |
void |
removeSecondarySourceParams(String source)
Remove all of the per-source parameters associated with all secondary file sequence of the given upstream node. |
void |
removeSecondarySourceParams(String source,
FilePattern fpat)
Remove all of the per-source parameters associated with a secondary file sequence of the given upstream node. |
void |
removeSourceParams(String source)
Remove all of the per-source parameters associated with the primary file sequence of the given upstream node. |
void |
setSecondarySourceParamValue(String source,
FilePattern fpat,
String name,
Comparable value)
Set the value of a per-source parameter for secondary file sequence of an upstream node. |
protected void |
setSingleLayout(LayoutGroup group)
Sets the hierarchical grouping of parameters and presets which determine the layout of UI components. |
void |
setSingleParamValue(String name,
Comparable value)
Set the value of a single valued parameter. |
void |
setSingleParamValues(BaseAction action)
Copy the values of all of the single valued parameters from the given action. |
protected void |
setSourceLayout(List<String> pnames)
Specifies the ordering of per-source parameters in the user interface. |
void |
setSourceParamValue(String source,
String name,
Comparable value)
Set the value of a per-source parameter for primary file sequence of an upstream node. |
void |
setSourceParamValues(BaseAction action)
Copy the values of all of the per-source parameters from the given action. |
boolean |
supportsSourceParams()
Whether this action supports per-source parameters. |
void |
toGlue(GlueEncoder encoder)
Saves the non-transient fields of this object as Glue. |
| Methods inherited from class us.temerity.pipeline.BasePlugin |
|---|
addSupport, compareTo, getDescription, getFullMessage, getPluginID, getResource, getResources, getResourceSize, getSupports, isUnderDevelopment, removeSupport, setSupports, supports, toString, underDevelopment |
| Methods inherited from class us.temerity.pipeline.PluginID |
|---|
getVendor, getVersionID |
| Methods inherited from class us.temerity.pipeline.Named |
|---|
getName |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public BaseAction()
GlueDecoder to instantiate the class
when encountered during the reading of GLUE format files and should not be called
from user code.
protected BaseAction(String name,
VersionID vid,
String vendor,
String desc)
name - The short name of the action.vid - The action plugin revision number.vendor - The name of the plugin vendor.desc - A short description of the action.public BaseAction(BaseAction action)
Used internally to create a generic instances of plugin subclasses. This constructor should not be used in end user code!
| Method Detail |
|---|
public final PluginType getPluginType()
getPluginType in class BasePluginpublic final boolean hasSingleParams()
protected final void addSingleParam(ActionParam param)
This method is used by subclasses in their constructors initialize the set of single valued parameters that they support.
param - The parameter to add.public final Collection<ActionParam> getSingleParams()
The returned ArrayList may be empty if the action does not have any single valued parameters.
public final ActionParam getSingleParam(String name)
name - The name of the parameter.
null if no parameter with the given name exists.
public final Comparable getSingleParamValue(String name)
throws PipelineException
name - The name of the parameter.
PipelineException - If no single valued parameter with the given name exists.
public final void setSingleParamValue(String name,
Comparable value)
name - The name of the parameter.value - The new value of the parameter.public final void setSingleParamValues(BaseAction action)
Note that there is no requirement that the given action be the same plugin type or version. Any incompatible parameters will simply be ignored by the copy operation.
action - The action to use as the source of single valued parameter values.public final void clearLinkParams(String source)
source - The fully resolved dependency node name.public final void clearAllLinkParams()
public boolean supportsSourceParams()
Subclasses MUST override this method to return true if per-source
paramters are allowed to be added to the action.
public final boolean hasSourceParams(String source)
source - The fully resolved dependency node name.
public final boolean hasSecondarySourceParams(String source,
FilePattern fpat)
source - The fully resolved dependency node name.fpat - The file pattern of the secondary sequence of the upstream node.public final void initSourceParams(String source)
source - The fully resolved node name of the upstream node.
public final void initSecondarySourceParams(String source,
FilePattern fpat)
source - The fully resolved node name of the upstream node.fpat - The file pattern of the secondary sequence of the upstream node.public TreeMap<String,ActionParam> getInitialSourceParams()
Subclasses which support per-source parameters MUST override this method
to provide a means for initializing parameters for dependencies. The returned
table cannot be (null) or empty if hasSourceParams(java.lang.String) has been overridden
to return (true).
public final Set<String> getSourceNames()
public final Set<String> getSecondarySourceNames()
public final Set<FilePattern> getSecondarySequences(String source)
source - The fully resolved node name of the upstream node.
public final Comparable getSourceParamValue(String source,
String name)
throws PipelineException
source - The fully resolved node name of the upstream node.name - The name of the parameter.
PipelineException - If no parameter with the given name exists for the given upstream node.
public final ActionParam getSourceParam(String source,
String name)
source - The fully resolved node name of the upstream node.name - The name of the parameter.
null if no parameter with the given name exists
for the given source.public final Collection<ActionParam> getSourceParams(String source)
The returned Collection may be empty if the upstream node does
not have any parameters associated with its primary file sequence.
source - The fully resolved node name of the upstream node.
public final Comparable getSecondarySourceParamValue(String source,
FilePattern fpat,
String name)
throws PipelineException
source - The fully resolved node name of the upstream node.fpat - The secondary sequence file pattern.name - The name of the parameter.
PipelineException - If no parameter with the given name exists for the given secondary file sequence of
the upstream node.
public final ActionParam getSecondarySourceParam(String source,
FilePattern fpat,
String name)
source - The fully resolved node name of the upstream node.fpat - The secondary sequence file pattern.name - The name of the parameter.
null if no parameter with the given name exists
for given secondary file sequence of the upstream node.
public final Collection<ActionParam> getSecondarySourceParams(String source,
FilePattern fpat)
The returned Collection may be empty if the upstream node does
not have any parameters associated with the given secondary file sequence.
source - The fully resolved node name of the upstream node.fpat - The secondary sequence file pattern.
public final void setSourceParamValue(String source,
String name,
Comparable value)
source - The fully resolved node name of the upstream node.name - The name of the parameter.value - The new value of the parameter.
public final void setSecondarySourceParamValue(String source,
FilePattern fpat,
String name,
Comparable value)
source - The fully resolved node name of the upstream node.fpat - The file pattern of the secondary sequence of the upstream node.name - The name of the parameter.value - The new value of the parameter.public final void setSourceParamValues(BaseAction action)
For each source, if the given action has parameters for the source then this action will reinitialize its per-source parameters for that source. Any parameters are compatable will then be copied from the given action to this action.
Note that there is no requirement that the given action be the same plugin type or version. Any incompatible parameters will simply be ignored by the copy operation.
action - The action from which to copy per-source parameters.public final void removeSourceParams(String source)
source - The fully resolved node name of the upstream node.
public final void removeSecondarySourceParams(String source,
FilePattern fpat)
source - The fully resolved node name of the upstream node.fpat - The file pattern of the secondary sequence of the upstream node.public final void removeSecondarySourceParams(String source)
source - The fully resolved node name of the upstream node.public final void removeAllSourceParams()
Parameters associated with both primary and secondary file sequences of all upstream nodes will be removed.
protected final void addPreset(String name,
ArrayList<String> choices)
This method is used by subclasses in their constructors initialize the presets for single valued parameters that they support.
name - The name of the preset.choices - The names of the possible preset choices.
protected final void addPresetValues(String name,
String choice,
TreeMap<String,Comparable> values)
This method is used by subclasses in their constructors to specify the parameter
values set by a preset choice after first adding the preset using the
addPreset method.
name - The name of the preset.choice - The name of the preset choice which causes the parameter to be set.values - The value assiged to each singled valued parameter indexed by parameter name.public final List<String> getPresetChoices(String name)
name - The name of the preset.
null if no preset exists.
public final SortedMap<String,Comparable> getPresetValues(String name,
String choice)
name - The name of the preset.choice - The name of the preset choice which causes the parameter to be set.
null if no
preset choice exists.protected final void setSingleLayout(LayoutGroup group)
The given layouts must contain an entry for all single valued parameters and presets
defined for the action exactly once. A collapsible drawer component will be created
for each layout group which contains a field for each parameter or preset entry in the
order specified by the group. All null entries will cause additional space
to be added between the UI fields. Each layout subgroup will be represented by its own
drawer nested within the drawer for the parent layout group.
This method should be called by subclasses in their constructor after intializing all
single valued parameters with the addSingleParam method and
adding any preset choices with addPreset method.
group - The layout group.public final LayoutGroup getSingleLayout()
If no single valued parameter group has been previously specified, a group will be created which contains all single valued parameters in alphabetical order.
protected final void setSourceLayout(List<String> pnames)
The specified list of parameters names must contains all per-source parameters defined
for the action exactly once. A table will be constructed for the per-source parameters
with a row for each source node and a column for each per-source parameter. The order
of the parameters within the list will determine the ordering of the columns from
left to right. Parameter entries may not be null for per-source
parameters.
This method should be called by subclasses in their constructor if they have overriden
the supportsSourceParams to return true and
have implemented the getInitialSourceParams method.
pnames - The ordered per-source parameter names.public final List<String> getSourceLayout()
If no per-source parameter group has been previously specified, a group will be created which contains all per-source parameters in alphabetical order.
public SubProcessHeavy prep(ActionAgenda agenda,
File outFile,
File errFile)
throws PipelineException
SubProcessHeavy instance which when executed will fulfill the
given action agenda.
agenda - The agenda to be accomplished by the action.outFile - The file to which all STDOUT output is redirected.errFile - The file to which all STDERR output is redirected.
PipelineException - If unable to prepare a SubProcess due to illegal, missing or imcompatable
information in the action agenda or a general failure of the prep method code.
@Deprecated
public static final void chmod(int mode,
File file)
throws IOException
prep method of portable Action plugins. The principle use of this
method was in creating execuable bash(1) scripts. However, this really isn't needed
even for bash(1) scripts since its just as easy to create a non-execuable script and
pass it as the argument to the bash(1) executable instead.
See the manpage for chmod(2) for details about the legal values for mode.
mode - The access mode bitmask.file - The fully resolved path to the file to change.
IOException - If unable to change the mode of the given file.protected final void cleanupLater(File file)
file - The temporary file to cleanup.public static final Path getTempPath(ActionAgenda agenda)
agenda - The agenda to be accomplished by the action.public static final File getTempDir(ActionAgenda agenda)
agenda - The agenda to be accomplished by the action.
public final File createTemp(ActionAgenda agenda,
String suffix)
throws PipelineException
If successful, the temporary file will be added to the set of files which will be removed upon termination of the Java runtime (see @{link #cleanupLater cleanupLater}).
agenda - The agenda to be accomplished by the action.suffix - The filename suffix of the temporary file.
IOException - If unable to create the temporary file.
PipelineException
public final File createTemp(ActionAgenda agenda,
int mode,
String suffix)
throws PipelineException
If successful, the temporary file will be added to the set of files which will be removed upon termination of the Java runtime (see @{link #cleanupLater cleanupLater}).
This method is not supported by the Windows operating system since it relies on the
NativeFileSys.chmod method.
agenda - The agenda to be accomplished by the action.mode - The access mode bitmask.suffix - The filename suffix of the temporary file.
IOException - If unable to create the temporary file.
PipelineExceptionpublic final boolean equals(Object obj)
equals in class BasePluginobj - The reference object with which to compare.public final boolean equalSingleParams(BaseAction action)
public final boolean equalSourceParams(BaseAction action)
public final Object clone()
clone in class Named
public final void toGlue(GlueEncoder encoder)
throws GlueException
GlueableGlueEncoder.encode for each
non-transient field of the parent object.
toGlue in interface GlueabletoGlue in class PluginIDencoder - [modified]
The object used to encode this object's fields into Glue format.
GlueException
public final void fromGlue(GlueDecoder decoder)
throws GlueException
GlueableGlueDecoder.decode for each non-transient
field of the parent object.
fromGlue in interface GlueablefromGlue in class PluginIDdecoder - The object used to decode this object's fields from Glue format.
GlueException
|
TEMERITY | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||