org.griphyn.vdl.dax
Class Profile

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

public class Profile
extends DAX
implements Cloneable

A Profile captures scheduler system and application environment specific stuff in a uniform fashion. Each profile declaration assigns a value to a key within a namespace. As of this writing, valid namespaces are

vds
Virtual Data System specific material.
condor
If the job runs in using the Condor scheduler, certain items like the "universe" or "requirments" can be set. Please note that currently the universe is provided as a hint to the logical transformation itself.
dagman
The job graph will usually be run by Condor DAGMan. Some issues, e.g. the number of retries, are specific to DAGMan and not Condor.
env
The Unix environment variables that are required for the job.
In the future, more namespaces may be added.

Version:
$Revision: 50 $
Author:
Jens-S. V??ckler, Yong Zhao

Field Summary
private  String m_key
          The identifier within a namespace.
private  ArrayList m_leafList
          The value to above keys.
private  String m_namespace
          The namespace of a profile.
private  String m_origin
          This value records which entity was responsible for setting the profile in the first place.
 
Constructor Summary
Profile()
          Array ctor.
Profile(String namespace, String key)
          Standard ctor: set up everything except a value of the ns.key pair.
Profile(String namespace, String key, Collection children)
          Convenience ctor: set up the first piece of the value in one go.
Profile(String namespace, String key, Leaf firstChild)
          Convenience ctor: set up the first piece of the value in one go.
 
Method Summary
 void addLeaf(int index, Leaf vLeaf)
          Accessor: Inserts a Leaf value into a specific position of the list of gathered values.
 void addLeaf(Leaf vLeaf)
          Accessor: Append a value fragment to this profile instance.
 Object clone()
          Creates and returns a copy of this object.
 Enumeration enumerateLeaf()
          Deprecated. Use the new Collection based interfaces
 String getKey()
          Accessor: Gets the key identifier for the profile.
 Leaf[] getLeaf()
          Deprecated. Use the new Collection based interfaces
 Leaf getLeaf(int index)
          Accessor: Obtains the Leaf at a certain position in the list of profile value fragments.
 int getLeafCount()
          Accessor: Obtains the number of profile value fragments.
 List getLeafList()
          Accessor: Gets an array of all values that constitute the current content.
 String getNamespace()
          Accessor: Gets the namespace value for the profile.
 String getOrigin()
          Accessor: Obtains the originator for a profile.
 Iterator iterateLeaf()
          Accessor: Enumerates the internal values that constitute the content of the Scalar element.
 ListIterator listIterateLeaf()
          Accessor: Enumerates the internal values that constitute the content of the Leaf element.
 ListIterator listIterateLeaf(int start)
          Accessor: Enumerates the internal values that constitute the content of the Leaf element.
 void removeAllLeaf()
          Accessor: Removes all value fragments from the profile.
 Leaf removeLeaf(int index)
          Accessor: Remove a single fragment from the list of value fragments.
 void setKey(String key)
          Accessor: Adjusts the identifier within a namespace.
 void setLeaf(Collection leaves)
          Accessor: Overwrites internal list with an external list representing a Scalar value.
 void setLeaf(int index, Leaf vLeaf)
          Accessor: Overwrites a Filename or PseudoText value fragment at a certain position in the profile value fragment list.
 void setLeaf(Leaf[] leafArray)
          Deprecated. Use the new Collection based interfaces
 void setNamespace(String namespace)
          Accessor: Adjusts a namespace value to a new state.
 void setOrigin(String origin)
          Accessor: Sets the originator for a profile.
 void toString(Writer stream)
          Converts the active state into something meant for human consumption.
 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, toString, toXML, toXML, writeAttribute
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_namespace

private String m_namespace
The namespace of a profile. All profiles must mention their namespace in order to generate acceptable behaviour.


m_key

private String m_key
The identifier within a namespace. The meaning of the key can differ between namespaces. Within the unix namespace, it is the name of an environment variable. Within the condor namespace, it is a Condor submit file key.


m_leafList

private ArrayList m_leafList
The value to above keys. Any value passed down is an arbitrary mix of the three potential Leaf types. A profile value element only allows for PseudoText and Filename children in arbitrary number and order.

See Also:
Leaf, PseudoText, Filename

m_origin

private String m_origin
This value records which entity was responsible for setting the profile in the first place.

Constructor Detail

Profile

public Profile()
Array ctor.


Profile

public Profile(String namespace,
               String key)
Standard ctor: set up everything except a value of the ns.key pair.

Parameters:
namespace - is the namespace within which to operate.
key - is an identifier unique within the namespace.

Profile

public Profile(String namespace,
               String key,
               Leaf firstChild)
Convenience ctor: set up the first piece of the value in one go.

Parameters:
namespace - is the namespace within which to operate.
key - is an identifier unique within the namespace.
firstChild - is the first fragment of the value. Only Leafs of type Filename or PseudoText are permissable.
See Also:
Leaf, Filename, PseudoText

Profile

public Profile(String namespace,
               String key,
               Collection children)
Convenience ctor: set up the first piece of the value in one go.

Parameters:
namespace - is the namespace within which to operate.
key - is an identifier unique within the namespace.
children - is a collection of fragments for the value. Only Leafs of type Filename or PseudoText are permissable.
See Also:
Leaf, Filename, PseudoText
Method Detail

clone

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

Overrides:
clone in class Object
Returns:
a new instance.

addLeaf

public void addLeaf(Leaf vLeaf)
Accessor: Append a value fragment to this profile instance.

Parameters:
vLeaf - is the fragment to add. Note that only leaf values of Filename or PseudoText are allowed.
See Also:
Leaf, PseudoText, Filename

addLeaf

public void addLeaf(int index,
                    Leaf vLeaf)
             throws IndexOutOfBoundsException
Accessor: Inserts a Leaf value into a specific position of the list of gathered values.

Parameters:
index - is the position to insert the item into
vLeaf - is the value to append to the list. Note that only leaf values of Filename or PseudoText are allowed.
Throws:
IndexOutOfBoundsException - if the value cannot be added.
See Also:
Leaf, PseudoText, Filename

enumerateLeaf

public Enumeration enumerateLeaf()
Deprecated. Use the new Collection based interfaces

Accessor: Enumerates the internal values that constitute the content of the Profile value.

Returns:
the iterator to the value fragment list.

getLeaf

public Leaf getLeaf(int index)
             throws IndexOutOfBoundsException
Accessor: Obtains the Leaf at a certain position in the list of profile value fragments.

Parameters:
index - is the position in the list to obtain a value from
Returns:
The Filename or PseudoText at the position.
Throws:
IndexOutOfBoundsException - if the index points to an element in the list that does not contain any elments.
See Also:
Filename, PseudoText

getLeaf

public Leaf[] getLeaf()
Deprecated. Use the new Collection based interfaces

Accessor: Gets an array of all values that constitute the current value content of a profile.

Returns:
an array with a mixture of either PseudoText or Filename values.
See Also:
Filename, PseudoText

getLeafCount

public int getLeafCount()
Accessor: Obtains the number of profile value fragments.

Returns:
number of elements that an external array needs to be sized to.

getLeafList

public List getLeafList()
Accessor: Gets an array of all values that constitute the current content. This list is read-only.

Returns:
an array with a mixture of either PseudoText or Filename values.
See Also:
PseudoText, Filename

getNamespace

public String getNamespace()
Accessor: Gets the namespace value for the profile.

Returns:
the currently active namespace for this instance.
See Also:
setNamespace(java.lang.String)

getOrigin

public String getOrigin()
Accessor: Obtains the originator for a profile.

Returns:
an arbitrary string at the moment.
See Also:
setOrigin( java.lang.String )

getKey

public String getKey()
Accessor: Gets the key identifier for the profile.

Returns:
the currently active key for this instance.
See Also:
setKey(java.lang.String)

iterateLeaf

public Iterator iterateLeaf()
Accessor: Enumerates the internal values that constitute the content of the Scalar element.

Returns:
an iterator to walk the list with.

listIterateLeaf

public ListIterator listIterateLeaf()
Accessor: Enumerates the internal values that constitute the content of the Leaf element.

Returns:
a list iterator to walk the list with.

listIterateLeaf

public ListIterator listIterateLeaf(int start)
Accessor: Enumerates the internal values that constitute the content of the Leaf element.

Parameters:
start - is the start index
Returns:
a list iterator to walk the list with.

removeAllLeaf

public void removeAllLeaf()
Accessor: Removes all value fragments from the profile.


removeLeaf

public Leaf removeLeaf(int index)
Accessor: Remove a single fragment from the list of value fragments.

Parameters:
index - is the position at which an element is to be removed.
Returns:
the object that was removed. The removed item is either an Filename or a PseudoText.
See Also:
Filename, PseudoText

setLeaf

public void setLeaf(int index,
                    Leaf vLeaf)
             throws IndexOutOfBoundsException
Accessor: Overwrites a Filename or PseudoText value fragment at a certain position in the profile value fragment list.

Parameters:
index - position to overwrite an elment in.
vLeaf - is either a Filename or PseudoText object.
Throws:
IndexOutOfBoundsException - if the position pointed to is invalid.
See Also:
Filename, PseudoText

setLeaf

public void setLeaf(Leaf[] leafArray)
Deprecated. Use the new Collection based interfaces

Accessor: Overwrites internal value fragments list with an external list representing a profile value.

Parameters:
leafArray - is the external list of PseudoText or Filename objects used to overwrite things.
See Also:
PseudoText, Filename

setLeaf

public void setLeaf(Collection leaves)
Accessor: Overwrites internal list with an external list representing a Scalar value.

Parameters:
leaves - is the external list of PseudoText or Filename objects used to overwrite things.
See Also:
PseudoText, Filename

setOrigin

public void setOrigin(String origin)
Accessor: Sets the originator for a profile.

Parameters:
origin - is the new originator to use, may be null.
See Also:
getOrigin()

setNamespace

public void setNamespace(String namespace)
Accessor: Adjusts a namespace value to a new state.

Parameters:
namespace - is the new namespace to use.
See Also:
getNamespace()

setKey

public void setKey(String key)
Accessor: Adjusts the identifier within a namespace.

Parameters:
key - is the new identifier to use from now on.
See Also:
getKey()

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.

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.