Package org.cip4.jdflib.util
Class JDFSpawn
- java.lang.Object
-
- org.cip4.jdflib.util.JDFSpawn
-
public class JDFSpawn extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description booleanbCopyCommentsif true, copy commentsbooleanbCopyCustomerInfoif true, copy customer infobooleanbCopyNodeInfoif true, copy node infobooleanbFixResourcesif true, ensure sufficient partitioning of rw resources, else do not add missing partitionsbooleanbSpawnIdenticalif true, copy identical elementsbooleanbSpawnROPartsOnlyif true, reduce read only partitions, else retain entire resourcebooleanbSpawnRWPartsMultipleif true, allow multiple rw spawning of resources note that this feature causes race conditions when mergingstatic intexAlreadyMergedexception id for multiple merge attemptstatic intexMultiSpawnRWexception id for multiple rw spawnsjava.lang.StringparentURLjava.lang.StringspawnURLVStringvRWResources_inlist of all resources to copy rwVJDFAttributeMapvSpawnPartslist of partitions to spawn
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcalcAuditSpawnIDs(JDFSpawned spawnAudit, java.util.HashSet<java.lang.String> vvRO, java.util.HashSet<java.lang.String> vvRW)java.util.Collection<JDFResource>checkSpawnedResources()return the resources that would be spawned RW multiple timesjava.util.Collection<JDFResource>cleanSpawnedResources()cleans up node so that no multiple spawnIDs remain
removes SpawnIDS and SpawnStatus from all resources that are spawnedRW by this spawn;
note that the vRWResources_in and vSpawnParts MUST be populated
audits are not modifiedVStringgetvROSpawnParts()voidsetNode(JDFNode newNode)set the node to spawnvoidsetvROSpawnParts(VString vROSpawnParts)JDFNodespawn()spawn a node; url is the file name of the new node, vRWResourceUsage is the vector of Resources Usages (or Names if no usage exists for the process) that are spawned RW, all others are spawned read only; vParts is the vector of part maps that are to be spawned, defaults to no part, i.e.JDFNodespawn(java.lang.String _parentURL, java.lang.String _spawnURL, VString _vRWResources_in, VJDFAttributeMap _vSpawnParts, boolean _bSpawnROPartsOnly, boolean _bCopyNodeInfo, boolean _bCopyCustomerInfo, boolean _bCopyComments)spawn a node; url is the file name of the new node, vRWResourceUsage is the vector of Resources Usages (or Names if no usage exists for the process) that are spawned RW, all others are spawned read only; vParts is the vector of part maps that are to be spawned, defaults to no part, i.e.JDFNodespawnInformative()spawn a node in informative mode without modifying the root JDF; url is the file name of the new node, the parameters except for the list of rw resources, which are by definition empty, are identical to those of Spawn vRWResourceUsage is the vector of Resources Usages, Resource Names or Resource IDs that are spawned RW, all others are spawned read only; vParts is the vector of part maps that are to be spawned, defaults to no part, i.e.JDFNodespawnInformative(java.lang.String _parentURL, java.lang.String _spawnURL, VJDFAttributeMap _vSpawnParts, boolean _bSpawnROPartsOnly, boolean _bCopyNodeInfo, boolean _bCopyCustomerInfo, boolean _bCopyComments)spawn a node in informative mode without modifying the root JDF; url is the file name of the new node, the parameters except for the list of rw resources, which are by definition empty, are identical to those of Spawn vRWResourceUsage is the vector of Resources Usages, Resource Names or Resource IDs that are spawned RW, all others are spawned read only; vParts is the vector of part maps that are to be spawned, defaults to no part, i.e.java.lang.StringtoString()JDFNodeunSpawn(java.lang.String spawnID)Method unSpawn.voidunSpawnChild(JDFNode childNode)remove all spawn related stuff from the spawned childNode
-
-
-
Field Detail
-
bSpawnROPartsOnly
public boolean bSpawnROPartsOnly
if true, reduce read only partitions, else retain entire resource
-
bSpawnRWPartsMultiple
public boolean bSpawnRWPartsMultiple
if true, allow multiple rw spawning of resources note that this feature causes race conditions when merging
-
bCopyNodeInfo
public boolean bCopyNodeInfo
if true, copy node info
-
bSpawnIdentical
public boolean bSpawnIdentical
if true, copy identical elements
-
bCopyCustomerInfo
public boolean bCopyCustomerInfo
if true, copy customer info
-
bCopyComments
public boolean bCopyComments
if true, copy comments
-
bFixResources
public boolean bFixResources
if true, ensure sufficient partitioning of rw resources, else do not add missing partitions
-
parentURL
public java.lang.String parentURL
-
spawnURL
public java.lang.String spawnURL
-
vRWResources_in
public VString vRWResources_in
list of all resources to copy rw
-
vSpawnParts
public VJDFAttributeMap vSpawnParts
list of partitions to spawn
-
exAlreadyMerged
public static final int exAlreadyMerged
exception id for multiple merge attempt- See Also:
- Constant Field Values
-
exMultiSpawnRW
public static final int exMultiSpawnRW
exception id for multiple rw spawns- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JDFSpawn
public JDFSpawn(JDFNode nodeToSpawn)
- Parameters:
nodeToSpawn- the node to be spawned
-
-
Method Detail
-
getvROSpawnParts
public VString getvROSpawnParts()
- Returns:
- the vROSpawnParts
-
setvROSpawnParts
public void setvROSpawnParts(VString vROSpawnParts)
- Parameters:
vROSpawnParts- the vROSpawnParts to set if set
-
setNode
public void setNode(JDFNode newNode)
set the node to spawn- Parameters:
newNode- the node to set- Throws:
JDFException- if node is NOT in the same document as the initial node
-
spawn
public JDFNode spawn()
spawn a node; url is the file name of the new node, vRWResourceUsage is the vector of Resources Usages (or Names if no usage exists for the process) that are spawned RW, all others are spawned read only; vParts is the vector of part maps that are to be spawned, defaults to no part, i.e. the whole thing the format is one of:
ResName:Input
ResName:Output
ResName:ProcessUsage- Returns:
- The spawned node
- Since:
- 050831 added bCopyComments @ tbd enhance nested spawning of partitioned nodes default: spawn(parentURL, null, null, null, false, false, false, false)
-
cleanSpawnedResources
public java.util.Collection<JDFResource> cleanSpawnedResources()
cleans up node so that no multiple spawnIDs remain
removes SpawnIDS and SpawnStatus from all resources that are spawnedRW by this spawn;
note that the vRWResources_in and vSpawnParts MUST be populated
audits are not modified- Returns:
- the list of cleaned resource leaves, null if no cleanup was necessary
-
checkSpawnedResources
public java.util.Collection<JDFResource> checkSpawnedResources()
return the resources that would be spawned RW multiple times- Returns:
- Collection: set of resources or resource partitions that would be spawned rw multiple times null if all is well
-
calcAuditSpawnIDs
protected void calcAuditSpawnIDs(JDFSpawned spawnAudit, java.util.HashSet<java.lang.String> vvRO, java.util.HashSet<java.lang.String> vvRW)
-
spawnInformative
public JDFNode spawnInformative()
spawn a node in informative mode without modifying the root JDF; url is the file name of the new node, the parameters except for the list of rw resources, which are by definition empty, are identical to those of Spawn vRWResourceUsage is the vector of Resources Usages, Resource Names or Resource IDs that are spawned RW, all others are spawned read only; vParts is the vector of part maps that are to be spawned, defaults to no part, i.e. the whole thing- Returns:
- JDFDoc: The spawned node's owner document.
-
spawn
public JDFNode spawn(java.lang.String _parentURL, java.lang.String _spawnURL, VString _vRWResources_in, VJDFAttributeMap _vSpawnParts, boolean _bSpawnROPartsOnly, boolean _bCopyNodeInfo, boolean _bCopyCustomerInfo, boolean _bCopyComments)
spawn a node; url is the file name of the new node, vRWResourceUsage is the vector of Resources Usages (or Names if no usage exists for the process) that are spawned RW, all others are spawned read only; vParts is the vector of part maps that are to be spawned, defaults to no part, i.e. the whole thing- Parameters:
_parentURL-_spawnURL- : URL of the spawned JDF file_vRWResources_in- : vector of resource names and Usage / ProcessUsage that are spawned as rw
the format is one of:
ResName:Input
ResName:Output
ResName:ProcessUsage_vSpawnParts- vector of mAttributes that describe the parts to spawn, only valid PartIDKeys are allowed_bSpawnROPartsOnly- if true, only the parts of RO resources that are specified in vParts are spawned, else the complete resource is spawned_bCopyNodeInfo- copy the NodeInfo elements into the Ancestors_bCopyCustomerInfo- copy the CustomerInfo elements into the Ancestors_bCopyComments- copy the Comment elements into the Ancestors- Returns:
- The spawned node
- Since:
- 050831 added bCopyComments @ tbd enhance nested spawning of partitioned nodes default: spawn(parentURL, null, null, null, false, false, false, false)
-
spawnInformative
public JDFNode spawnInformative(java.lang.String _parentURL, java.lang.String _spawnURL, VJDFAttributeMap _vSpawnParts, boolean _bSpawnROPartsOnly, boolean _bCopyNodeInfo, boolean _bCopyCustomerInfo, boolean _bCopyComments)
spawn a node in informative mode without modifying the root JDF; url is the file name of the new node, the parameters except for the list of rw resources, which are by definition empty, are identical to those of Spawn vRWResourceUsage is the vector of Resources Usages, Resource Names or Resource IDs that are spawned RW, all others are spawned read only; vParts is the vector of part maps that are to be spawned, defaults to no part, i.e. the whole thing- Parameters:
_parentURL-_spawnURL- : URL of the spawned JDF file_vSpawnParts- : vector of mAttributes that describe the parts to spawn_bSpawnROPartsOnly- if true, only the parts of RO resources that are specified in vParts are spawned, else the complete resource is spawned_bCopyNodeInfo- copy the NodeInfo elements into the Ancestors_bCopyCustomerInfo- copy the CustomerInfo elements into the Ancestors_bCopyComments- copy the Comment elements into the Ancestors- Returns:
- JDFDoc: The spawned node's owner document.
-
unSpawn
public JDFNode unSpawn(java.lang.String spawnID)
Method unSpawn. undo a spawn, removing any and all bookkeeping of that spawning- Parameters:
spawnID- spawnID of the spawn to undo, if null find the first spawned node- Returns:
- the fixed unspawned node
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object- Returns:
- See Also:
Object.toString()
-
unSpawnChild
public void unSpawnChild(JDFNode childNode)
remove all spawn related stuff from the spawned childNode- Parameters:
childNode-
-
-