org.griphyn.vdl.dax
Class Filename

java.lang.Object
  extended by org.griphyn.vdl.Chimera
      extended by org.griphyn.vdl.dax.DAX
          extended by org.griphyn.vdl.dax.Leaf
              extended by org.griphyn.vdl.dax.Filename
All Implemented Interfaces:
Cloneable

public class Filename
extends Leaf
implements Cloneable

This class captures the logical filename and its linkage. Also, some static methods allow to use the linkage constants outside the class.

Filename extends the Leaf class by adding a filename, linkage type, temporary pattern, and management attributes.

Version:
$Revision: 366 $
Author:
Jens-S. V??ckler, Yong Zhao
See Also:
Leaf, PseudoText

Field Summary
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.
private  String m_variable
           
 
Constructor Summary
Filename()
          Default ctor: create a hollow instance which needs to be filled with content.
Filename(LFN lfn)
          convenience ctor: create a DAX filename from a VDLx filename.
Filename(String filename)
          Default ctor: create an instance with a logical filename.
Filename(String filename, int link)
          ctor: create a file with a name and linkage.
Filename(String filename, int link, String hint)
          ctor: create a transient file with a name, linkage and hint.
Filename(String filename, int link, String hint, boolean dontRegister, int dontTransfer, String variable)
          ctor: Creates a filename given all specs.
Filename(String filename, int link, String hint, boolean dontRegister, int dontTransfer, String variable, boolean optional)
          ctor: Creates a filename given all specs.
 
Method Summary
private  boolean abbreviatable()
          Convenience function to call the static test, if a filename can use the abbreviated notation.
 Object clone()
          Creates and returns a copy of this object.
 boolean getDontRegister()
          Deprecated.  
 int getDontTransfer()
          Deprecated.  
 String getFilename()
          Accessor: Obtains the logical filename for this instance.
 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
 String getVariable()
          Accessor: Obtains the responsible variable.
 void setDontRegister(boolean dontRegister)
          Deprecated.  
 void setDontTransfer(int dontTransfer)
          Deprecated.  
 void setFilename(String name)
          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
 void setVariable(String variable)
          Accessor: Sets the responsible variable.
 String shortXML(String indent, String namespace, int flag)
          Dumps the state of the filename as PlainFilenameType or StdioFilenameType without the transiency information.
 void shortXML(Writer stream, String indent, String namespace, int flag)
          Dumps the state of the filename as PlainFilenameType or StdioFilenameType without the transiency information.
 String toString()
          Convert the logical filename and linkage into something human readable.
 void toString(Writer stream)
          Converts the active state into something meant for human consumption.
 String toXML(String indent, String namespace)
          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.
 
Methods inherited from class org.griphyn.vdl.Chimera
escape, quote, toXML, writeAttribute
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

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 false, the replica registration will not take place. This is useful for transient or non-important results.

See Also:
m_dontTransfer, m_temporary

m_dontTransfer

private int m_dontTransfer
Marks a filename for transfer to the result collector. If marked with false, 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. In optional mode, failure to transfer due to missing source file will not be fatal.

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_variable

private String m_variable

m_type

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

Constructor Detail

Filename

public Filename()
Default ctor: create a hollow instance which needs to be filled with content.


Filename

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

Parameters:
filename - is the logical filename to store.

Filename

public Filename(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.

Filename

public Filename(String filename,
                int link,
                String hint)
         throws IllegalArgumentException
ctor: create a 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 the transient filename. If null, the file is regular, if set, the file is assumed to be neither registered not transferred.
Throws:
IllegalArgumentException - if the linkage does not match the legal range.

Filename

public Filename(String filename,
                int link,
                String hint,
                boolean dontRegister,
                int dontTransfer,
                String variable)
         throws IllegalArgumentException
ctor: Creates a filename given all specs.

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.
variable - is the variable that is responsible for this LFN.
Throws:
IllegalArgumentException - if the linkage does not match the legal range, or the transfer mode does not match its legal range.
Since:
1.6

Filename

public Filename(String filename,
                int link,
                String hint,
                boolean dontRegister,
                int dontTransfer,
                String variable,
                boolean optional)
         throws IllegalArgumentException
ctor: Creates a filename given all specs.

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.
variable - is the variable that is responsible for this LFN.
optional - records the optionality of a given file.
Throws:
IllegalArgumentException - if the linkage does not match the legal range, or the transfer mode does not match its legal range.
Since:
1.8

Filename

public Filename(LFN lfn)
         throws IllegalArgumentException
convenience ctor: create a DAX filename from a VDLx filename.

Parameters:
lfn - is a VDLx logical filename.
Throws:
IllegalArgumentException
Method Detail

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 Filename constructor defaults to no linkage.
See Also:
setLink(int)

getFilename

public String getFilename()
Accessor: Obtains the logical filename for this instance.

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

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.6
See Also:
getRegister( )

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 )

getDontTransfer

public int getDontTransfer()
Deprecated. 

Accessor: Obtains the transfer mode.

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

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 )

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.8
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)

getVariable

public String getVariable()
Accessor: Obtains the responsible variable.

Returns:
the variable responsible for setting this LFN.
Since:
1.7
See Also:
setVariable( 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 name)
Accessor: Sets the filename

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

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.6
See Also:
#setRegister()

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( )

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.6
See Also:
#setTransfer( ), LFN.XFER_MANDATORY, LFN.XFER_OPTIONAL, LFN.XFER_NOT

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( ), LFN.XFER_MANDATORY, LFN.XFER_OPTIONAL, LFN.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.8
See Also:
getOptional()

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( )

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()

setVariable

public void setVariable(String variable)
Accessor: Sets the responsible variable.

Parameters:
variable - the variable responsible for setting this LFN.
Since:
1.7
See Also:
getVariable()

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:
LFN.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. This method overwrites the inherited methods since it appears to be faster to do it this way.

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

toString

public void toString(Writer stream)
              throws IOException
Converts the active state into something meant for human consumption. The method will be called when recursively traversing the instance tree.

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 fishy happens to the stream.

shortXML

public String shortXML(String indent,
                       String namespace,
                       int flag)
Dumps the state of the filename as PlainFilenameType or StdioFilenameType without the transiency information.

Overrides:
shortXML in class Leaf
Parameters:
indent - is a String of spaces used for pretty printing. The initial amount of spaces should be an empty string.
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.
flag - 0x01: also dump the linkage information, 0x02: also dump optionality
Returns:
a String which contains the state of the current class and its siblings using XML. Note that these strings might become large.
See Also:
Chimera.toXML( String, String )

toXML

public String toXML(String indent,
                    String namespace)
Dumps the state of the current element as XML output. This method converts the data into pretty-printed XML output meant for machine consumption. This method overwrites the inherited methods since it appears to be faster to do it this way.

Overrides:
toXML in class Chimera
Parameters:
indent - is a String of spaces used for pretty printing. The initial amount of spaces should be an empty string.
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.
Returns:
a String which contains the state of the current class and its siblings using XML. Note that these strings might become large.

shortXML

public void shortXML(Writer stream,
                     String indent,
                     String namespace,
                     int flag)
              throws IOException
Dumps the state of the filename as PlainFilenameType or StdioFilenameType without the transiency information.

Overrides:
shortXML in class Leaf
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.
flag - if 0x01, dump linkage, if 0x02 is set, dump optionality.
Throws:
IOException - if something fishy happens to the stream.
See Also:
Chimera.toXML( Writer, String, String )

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.

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.