org.griphyn.vdl.classes
Class LFN

java.lang.Object
  extended by org.griphyn.vdl.Chimera
      extended by org.griphyn.vdl.classes.VDL
          extended by org.griphyn.vdl.classes.Leaf
              extended by org.griphyn.vdl.classes.LFN
All Implemented Interfaces:
Serializable, Cloneable

public class LFN
extends Leaf
implements Cloneable, Serializable

This class captures the logical filename and its linkage. Also, some static methods allow to use the linkage constants outside the class. LFN extends the Leaf class by adding a filename and linkage type.

Version:
$Revision: 460 $
Author:
Jens-S. V??ckler, Yong Zhao
See Also:
Leaf, Text, Use, Value, Scalar, List, Serialized Form

Field Summary
static int INOUT
          Linkage type: file is used as input and output.
static int INPUT
          Linkage type: input file.
private  boolean m_dontRegister
          Marks a filename for registration in a replica catalog.
private  int m_dontTransfer
          Marks a filename for transfer to the result collector.
private  String m_filename
          The filename is the logical name of the file.
private  int m_link
          The linkage type of the logical file aids the linkage process.
private  boolean m_optional
          If a filename is marked as optional, it's non-existence must not stop a workflow.
private  String m_temporary
          If a filename is marked transient, the higher level planners might have some notion where to place it, or how to name it.
private  int m_type
          The type of the filename, whether it refers to a data, pattern or executable.
static int NONE
          Linkage type: no linkage, usually used for constants etc.
static int OUTPUT
          Linkage type: output file.
static int TYPE_DATA
          Type of File: Denotes a data file.
static int TYPE_EXECUTABLE
          Type of File: Denotes an executable file.
static int TYPE_PATTERN
          Type of File: Denotes a pattern.
static int XFER_MANDATORY
          Transfer mode: The transfer of the file to the result collector is mandatory.
static int XFER_NOT
          Transfer mode: The file will not be transferred to the result collector.
static int XFER_OPTIONAL
          Transfer mode: The transfer of the file to the result collector is optional.
 
Constructor Summary
LFN()
          ctor.
LFN(String filename)
          Default ctor: create an instance with a logical filename.
LFN(String filename, int link)
          ctor: create a file with a name and linkage.
LFN(String filename, int link, String hint)
          ctor: create a possibly transient file with a name, linkage and hint.
LFN(String filename, int link, String hint, boolean dontRegister, int dontTransfer)
          Deprecated.  
LFN(String filename, int link, String hint, boolean dontRegister, int dontTransfer, boolean optional)
          Deprecated.  
LFN(String filename, int link, String hint, boolean dontRegister, int dontTransfer, boolean optional, int type)
          ctor: Creates a filename given almost all specs.
 
Method Summary
private  boolean abbreviatable()
          Convenience function to call the static test, if a filename can use the abbreviated notation.
static boolean abbreviatable(String temp, boolean dr, int dt, boolean opt)
          Predicate to determine, if the output can be abbreviated.
 Object clone()
          Creates and returns a copy of this object.
 boolean getDontRegister()
          Deprecated.  
 int getDontTransfer()
          Deprecated.  
 String getFilename()
          Accessor: Obtains the logical filename of the object.
 int getLink()
          Accessor: Obtains the linkage type from the object.
 boolean getOptional()
          Acessor: Obtains the optionality of the file.
 boolean getRegister()
          Accessor: Obtains the predicate on registring with a replica catalog.
 String getTemporary()
          Accessor: Obtains the file name suggestion for a transient file.
 int getTransfer()
          Accessor: Obtains the transfering mode.
 int getType()
          Accessor: Returns the predicate on the type of the LFN
static boolean isInRange(int x)
          Predicate to determine, if an integer is within the valid range for linkage types.
 void setDontRegister(boolean dontRegister)
          Deprecated.  
 void setDontTransfer(int dontTransfer)
          Deprecated.  
 void setFilename(String fn)
          Accessor: Sets the filename
 void setLink(int link)
          Accessor: Sets the linkage type.
 void setOptional(boolean optional)
          Acessor: Sets the optionality of the file.
 void setRegister(boolean register)
          Accessor: Sets the predicate on registring with a replica catalog.
 void setTemporary(String name)
          Accessor: Sets a file name suggestion for a transient file.
 void setTransfer(int transfer)
          Accessor: Sets the transfer mode.
 void setType(int type)
          Accessor: Sets the predicate on the type of the LFN
 String toString()
          Convert the logical filename and linkage into something human readable.
static String toString(int x)
          Converts an integer into the symbolic linkage type represented by the constant.
 void toString(Writer stream)
          Prints the current content onto the stream.
 String toXML(String indent)
          Dumps the state of the current element as XML output.
 void toXML(Writer stream, String indent, String namespace)
          Dump the state of the current element as XML output.
static boolean transferInRange(int x)
          Predicate to determine, if an integer is within the valid range for transfer modes.
static String transferString(int x)
          Converts an integer into the symbolic transfer mode represented by the constant.
static boolean typeInRange(int x)
          Predicate to determine, if an integer is within the valid range for type
static int typeInt(String x)
          Converts a String into the corresponding integer value.
static String typeString(int x)
          Converts an integer into the symbolic type mode represented by the constant.
 
Methods inherited from class org.griphyn.vdl.classes.Leaf
getValue, setValue
 
Methods inherited from class org.griphyn.vdl.Chimera
escape, quote, toXML, toXML, writeAttribute
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NONE

public static final int NONE
Linkage type: no linkage, usually used for constants etc. It can also be used to indicate that the linkage is unknown. The NONE linkage does not participate in DAG construction.

See Also:
Constant Field Values

INPUT

public static final int INPUT
Linkage type: input file.

See Also:
Constant Field Values

OUTPUT

public static final int OUTPUT
Linkage type: output file.

See Also:
Constant Field Values

INOUT

public static final int INOUT
Linkage type: file is used as input and output. Please note that this linkage does not allow for DAG linking.

See Also:
Constant Field Values

m_filename

private String m_filename
The filename is the logical name of the file. With the help of the replica location service (RLS), the physical filename is determined by the concrete planner.


m_link

private int m_link
The linkage type of the logical file aids the linkage process.


m_dontRegister

private boolean m_dontRegister
Marks a filename for registration in a replica catalog. If marked with true, the replica registration will not take place. This is useful for transient or non-important results. Regular, tracked files are marked with false.

See Also:
m_dontTransfer, m_temporary

XFER_MANDATORY

public static final int XFER_MANDATORY
Transfer mode: The transfer of the file to the result collector is mandatory. Failure to transfer the file will make the workflow fail.

See Also:
Constant Field Values

XFER_OPTIONAL

public static final int XFER_OPTIONAL
Transfer mode: The transfer of the file to the result collector is optional. Failure to transfer the file will not abort the workflow.

See Also:
Constant Field Values

XFER_NOT

public static final int XFER_NOT
Transfer mode: The file will not be transferred to the result collector.

See Also:
Constant Field Values

TYPE_DATA

public static final int TYPE_DATA
Type of File: Denotes a data file. They are generally looked up in a replica catalog.

See Also:
Constant Field Values

TYPE_EXECUTABLE

public static final int TYPE_EXECUTABLE
Type of File: Denotes an executable file. They are generally looked up in a transformation catalog.

See Also:
Constant Field Values

TYPE_PATTERN

public static final int TYPE_PATTERN
Type of File: Denotes a pattern. They are generally looked up in a pattern catalog.

See Also:
Constant Field Values

m_dontTransfer

private int m_dontTransfer
Marks a filename for transfer to the result collector. If marked with true, the file is usually a temporary file, and will not be transferred to the output collector. Inter-pool transfers may still happen in multi-pool mode. Regular, tracked files are marked with false. Optional transfers have a special mark.

See Also:
m_dontRegister, m_temporary

m_temporary

private String m_temporary
If a filename is marked transient, the higher level planners might have some notion where to place it, or how to name it. Lower level planners are not necessarily required to follow this hint.

See Also:
m_dontRegister, m_dontTransfer

m_optional

private boolean m_optional
If a filename is marked as optional, it's non-existence must not stop a workflow. Regular files, however, are not optional.


m_type

private int m_type
The type of the filename, whether it refers to a data, pattern or executable.

Constructor Detail

LFN

public LFN()
ctor.


LFN

public LFN(String filename)
Default ctor: create an instance with a logical filename. The linkage defaults to NONE.

Parameters:
filename - is the logical filename to store.

LFN

public LFN(String filename,
           int link)
    throws IllegalArgumentException
ctor: create a file with a name and linkage.

Parameters:
filename - is the logical filename to store.
link - is the linkage of the file to remember.
Throws:
IllegalArgumentException - if the linkage does not match the legal range.

LFN

public LFN(String filename,
           int link,
           String hint)
    throws IllegalArgumentException
ctor: create a possibly transient file with a name, linkage and hint.

Parameters:
filename - is the logical filename to store.
link - is the linkage of the file to remember.
hint - is an expression for a temporary filename choice. If it is not null, the files will neither be marked for registration nor for transfer to the output collector.
Throws:
IllegalArgumentException - if the linkage does not match the legal range.

LFN

public LFN(String filename,
           int link,
           String hint,
           boolean dontRegister,
           int dontTransfer)
    throws IllegalArgumentException
Deprecated. 

ctor: Creates a filename given almost all specs. This is a backward compatible constructor, as it lacks access to the optional transfer attribute.

Parameters:
filename - is the logical filename to store.
link - is the linkage of the file to remember.
hint - is an expression for a temporary filename choice.
dontRegister - whether to to register with a replica catalog.
dontTransfer - whether to transfer the file to the collector.
Throws:
IllegalArgumentException - if the linkage does not match the legal range, or the transfer mode does not match its legal range.
Since:
1.21

LFN

public LFN(String filename,
           int link,
           String hint,
           boolean dontRegister,
           int dontTransfer,
           boolean optional)
    throws IllegalArgumentException
Deprecated. 

ctor: Creates a filename given almost all specs. This is a backward compatible constructor, as it lacks access to the optional transfer attribute.

Parameters:
filename - is the logical filename to store.
link - is the linkage of the file to remember.
hint - is an expression for a temporary filename choice.
dontRegister - whether to to register with a replica catalog.
dontTransfer - whether to transfer the file to the collector.
optional - whether the file is optional or required.
Throws:
IllegalArgumentException - if the linkage does not match the legal range, or the transfer mode does not match its legal range.
Since:
1.23

LFN

public LFN(String filename,
           int link,
           String hint,
           boolean dontRegister,
           int dontTransfer,
           boolean optional,
           int type)
    throws IllegalArgumentException
ctor: Creates a filename given almost all specs. This is a backward compatible constructor, as it lacks access to the optional transfer attribute.

Parameters:
filename - is the logical filename to store.
link - is the linkage of the file to remember.
hint - is an expression for a temporary filename choice.
dontRegister - whether to to register with a replica catalog.
dontTransfer - whether to transfer the file to the collector.
optional - whether the file is optional or required.
type - whether the file is data|executable|pattern
Throws:
IllegalArgumentException - if the linkage does not match the legal range, or the transfer mode does not match its legal range.
Since:
1.23
Method Detail

isInRange

public static boolean isInRange(int x)
Predicate to determine, if an integer is within the valid range for linkage types.

Parameters:
x - is the integer to test for in-intervall.
Returns:
true, if the integer satisfies NONE ≤ x ≤ INOUT, false otherwise.

toString

public static String toString(int x)
Converts an integer into the symbolic linkage type represented by the constant.

Parameters:
x - is the integer with the linkage type to symbolically convert
Returns:
a string with the symbolic linkage name, or null, if the constant is out of range.

transferInRange

public static boolean transferInRange(int x)
Predicate to determine, if an integer is within the valid range for transfer modes.

Parameters:
x - is the integer to test for in-intervall.
Returns:
true, if the integer satisfies XFER_MANDATORY ≤ x ≤ XFER_NOT, false otherwise.

transferString

public static String transferString(int x)
Converts an integer into the symbolic transfer mode represented by the constant.

Parameters:
x - is the integer with the linkage type to symbolically convert
Returns:
a string with the symbolic linkage name, or null, if the constant is out of range.

typeInRange

public static boolean typeInRange(int x)
Predicate to determine, if an integer is within the valid range for type

Parameters:
x - is the integer to test for in-intervall.
Returns:
true, if the integer satisfies TYPE_DATA ≤ x ≤ TYPE_PATTERN, false otherwise.

typeString

public static String typeString(int x)
Converts an integer into the symbolic type mode represented by the constant.

Parameters:
x - is the integer with the linkage type to symbolically convert
Returns:
a string with the symbolic linkage name, or null, if the constant is out of range.

typeInt

public static int typeInt(String x)
Converts a String into the corresponding integer value.

Parameters:
x - is the String to symbolically convert
Returns:
an integer with the value or -1 if not valid.

clone

public Object clone()
Creates and returns a copy of this object.

Specified by:
clone in class Leaf
Returns:
a new instance.

getLink

public int getLink()
Accessor: Obtains the linkage type from the object.

Returns:
the linkage type of the current object. Note that LFN objects default to no linkage.
See Also:
setLink(int)

getFilename

public String getFilename()
Accessor: Obtains the logical filename of the object.

Returns:
the logical filename.
See Also:
setFilename( java.lang.String )

getRegister

public boolean getRegister()
Accessor: Obtains the predicate on registring with a replica catalog.

Returns:
true if the file will be registered with a replica catalog.
Since:
2.1
See Also:
setRegister( boolean )

getType

public int getType()
Accessor: Returns the predicate on the type of the LFN

Returns:
the type of LFN
Since:
2.1
See Also:
setType( int )

getDontRegister

public boolean getDontRegister()
Deprecated. 

Accessor: Obtains the predicate on registring with a replica catalog.

Returns:
false if the file will be registered with a replica catalog.
Since:
1.21
See Also:
setRegister( boolean ), getRegister()

getTransfer

public int getTransfer()
Accessor: Obtains the transfering mode.

Returns:
true if the file will be tranferred to an output collector.
Since:
2.1
See Also:
setTransfer( int )

getDontTransfer

public int getDontTransfer()
Deprecated. 

Accessor: Obtains the transfering mode.

Returns:
false if the file will be tranferred to an output collector.
Since:
1.21
See Also:
getTransfer(), setTransfer( int )

getOptional

public boolean getOptional()
Acessor: Obtains the optionality of the file.

Returns:
false, if the file is required, or true, if it is optional.
Since:
1.23
See Also:
setOptional( boolean )

getTemporary

public String getTemporary()
Accessor: Obtains the file name suggestion for a transient file. If a filename is marked transient, the higher level planners might have some notion where to place it, or how to name it. Lower level planners are not necessarily required to follow this hint.

Returns:
the transient name suggestion of the file. The current settings will always be returned, regardless of the transiency state of the file.
See Also:
setTemporary(String)

setLink

public void setLink(int link)
             throws IllegalArgumentException
Accessor: Sets the linkage type.

Parameters:
link - is the new linkage type to use. Please note that it must match the range of legal values.
Throws:
IllegalArgumentException - if the range is beyong legal values.
See Also:
getLink()

setFilename

public void setFilename(String fn)
Accessor: Sets the filename

Parameters:
fn - is the new logical filename.
See Also:
getFilename()

setRegister

public void setRegister(boolean register)
Accessor: Sets the predicate on registring with a replica catalog.

Parameters:
register - is true, if the file should be registered with a replica catalog.
Since:
2.1
See Also:
getRegister( )

setType

public void setType(int type)
Accessor: Sets the predicate on the type of the LFN

Parameters:
type - the type of LFN
Since:
2.1
See Also:
getType( )

setDontRegister

public void setDontRegister(boolean dontRegister)
Deprecated. 

Accessor: Sets the predicate on registring with a replica catalog.

Parameters:
dontRegister - is false, if the file should be registered with a replica catalog.
Since:
1.21
See Also:
getDontRegister(), setRegister( boolean ), #getRegister( boolean )

setTransfer

public void setTransfer(int transfer)
                 throws IllegalArgumentException
Accessor: Sets the transfer mode.

Parameters:
transfer - the transfer flag
Throws:
IllegalArgumentException - if the transfer mode is outside its legal range.
Since:
2.1
See Also:
getTransfer( ), XFER_MANDATORY, XFER_OPTIONAL, XFER_NOT

setDontTransfer

public void setDontTransfer(int dontTransfer)
                     throws IllegalArgumentException
Deprecated. 

Accessor: Sets the transfer mode.

Parameters:
dontTransfer - is false, if the file should be transferred to the output collector.
Throws:
IllegalArgumentException - if the transfer mode is outside its legal range.
Since:
1.21
See Also:
getDontTransfer( ), XFER_MANDATORY, XFER_OPTIONAL, XFER_NOT

setOptional

public void setOptional(boolean optional)
Acessor: Sets the optionality of the file.

Parameters:
optional - false, if the file is required, or true, if it is optional.
Since:
1.23
See Also:
getOptional()

setTemporary

public void setTemporary(String name)
Accessor: Sets a file name suggestion for a transient file. If a filename is marked transient, the higher level planners might have some notion where to place it, or how to name it. Lower level planners are not necessarily required to follow this hint.

Parameters:
name - is a transient name suggestion for this filename instance. No automatic marking of transiency will be done!
See Also:
getTemporary()

abbreviatable

public static boolean abbreviatable(String temp,
                                    boolean dr,
                                    int dt,
                                    boolean opt)
Predicate to determine, if the output can be abbreviated. Filenames can be abbreviated, if one of these two conditions are met: The hint is null and dontRegister is false and dontTransfer is mandatory, or the hint exists, and dontRegister is true and dontTransfer is no transfer.

Parameters:
temp - is the temporary hint
dr - is the value of dontRegister
dt - is the value of dontTransfer
opt - is whether a given file is optional or not
Returns:
true, if the filename can use abbreviated mode

abbreviatable

private boolean abbreviatable()
Convenience function to call the static test, if a filename can use the abbreviated notation.

Returns:
true, if abbreviatable notation is possible.
See Also:
abbreviatable( String, boolean, int, boolean )

toString

public String toString()
Convert the logical filename and linkage into something human readable. The output is also slightly nudged towards machine parsability.

Overrides:
toString in class Chimera
Returns:
a textual description of the element and its attributes.

toString

public void toString(Writer stream)
              throws IOException
Prints the current content onto the stream.

Specified by:
toString in class Chimera
Parameters:
stream - is a stream opened and ready for writing. This can also be a string stream for efficient output.
Throws:
IOException - if something happens to the stream.

toXML

public String toXML(String indent)
Dumps the state of the current element as XML output. This method converts the data into pretty-printed XML output meant for machine consumption.

Parameters:
indent - is a String of spaces used for pretty printing. The initial amount of spaces should be an empty string.
Returns:
a String which contains the state of the current class and its siblings using XML. Note that these strings might become large.

toXML

public void toXML(Writer stream,
                  String indent,
                  String namespace)
           throws IOException
Dump the state of the current element as XML output. This function traverses all sibling classes as necessary, and converts the data into pretty-printed XML output. The stream interface should be able to handle large output efficiently, if you use a buffered writer.

Specified by:
toXML in class Chimera
Parameters:
stream - is a stream opened and ready for writing. This can also be a string stream for efficient output.
indent - is a String of spaces used for pretty printing. The initial amount of spaces should be an empty string. The parameter is used internally for the recursive traversal.
namespace - is the XML schema namespace prefix. If neither empty nor null, each element will be prefixed with this prefix, and the root element will map the XML namespace.
Throws:
IOException - if something fishy happens to the stream.
See Also:
BufferedWriter


Copyright © 2007 The University of Southern California. All Rights Reserved.