edu.isi.pegasus.planner.classes
Class ReplicaLocation

java.lang.Object
  extended by edu.isi.pegasus.planner.classes.Data
      extended by edu.isi.pegasus.planner.classes.ReplicaLocation
All Implemented Interfaces:
Cloneable

public class ReplicaLocation
extends Data
implements Cloneable

A Data Class that associates a LFN with the PFN's. Attributes associated with the LFN go here.

Version:
$Revision: 2630 $
Author:
Karan Vahi, Gaurang Mehta
See Also:
org.griphyn.common.catalog.ReplicaCatalogEntry

Field Summary
private  String mLFN
          The LFN associated with the entry.
private  List mPFNList
          A list of ReplicaCatalogEntry objects containing the PFN's and associated attributes.
static String UNDEFINED_SITE_NAME
          The site name that is associated in the case the resource handle is not specified with the PFN.
 
Fields inherited from class edu.isi.pegasus.planner.classes.Data
mLogger, mLogMsg
 
Constructor Summary
ReplicaLocation()
          Default constructor.
ReplicaLocation(String lfn, Collection pfns)
          Overloaded constructor.
ReplicaLocation(String lfn, List pfns)
          Overloaded constructor.
 
Method Summary
 void addPFN(PFN pfn)
          Adds a PFN specified in the DAX to the object
 void addPFN(ReplicaCatalogEntry tuple)
          Add a PFN and it's attributes.
protected  void addPFNs(List tuples)
          Add a PFN and it's attributes.
 Object clone()
          Returns the clone of the object.
 String getLFN()
          Returns the associated LFN.
 ReplicaCatalogEntry getPFN(int index)
          Return a PFN as a ReplicaCatalogEntry
 int getPFNCount()
          Returns the number of pfn's associated with the lfn.
 List getPFNList()
          Returns the list of pfn's as ReplicaCatalogEntry objects.
 boolean merge(ReplicaLocation location)
          Merges the ReplicaLocation object to the existing one, only if the logical filenames match.
 Iterator pfnIterator()
          Returns an iterator to the list of ReplicaCatalogEntry objects.
private  void sanitize(List tuples)
          Sanitizes a tuple list .
private  void sanitize(ReplicaCatalogEntry tuple)
          Sanitizes a tuple .
 void setLFN(String lfn)
          Sets the LFN.
 String toString()
          Returns the textual description of the data class.
 
Methods inherited from class edu.isi.pegasus.planner.classes.Data
setToString, vectorToString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNDEFINED_SITE_NAME

public static final String UNDEFINED_SITE_NAME
The site name that is associated in the case the resource handle is not specified with the PFN.

See Also:
Constant Field Values

mLFN

private String mLFN
The LFN associated with the entry.


mPFNList

private List mPFNList
A list of ReplicaCatalogEntry objects containing the PFN's and associated attributes.

Constructor Detail

ReplicaLocation

public ReplicaLocation()
Default constructor.


ReplicaLocation

public ReplicaLocation(String lfn,
                       List pfns)
Overloaded constructor. Intializes the member variables to the values passed.

Parameters:
lfn - the logical filename.
pfns - the list of ReplicaCatalogEntry objects.

ReplicaLocation

public ReplicaLocation(String lfn,
                       Collection pfns)
Overloaded constructor. Intializes the member variables to the values passed.

Parameters:
lfn - the logical filename.
pfns - the list of ReplicaCatalogEntry objects.
Method Detail

addPFN

public void addPFN(PFN pfn)
Adds a PFN specified in the DAX to the object

Parameters:
pfn - the PFN

addPFN

public void addPFN(ReplicaCatalogEntry tuple)
Add a PFN and it's attributes. Any existing mapping with the same PFN will be replaced, including all its attributes.

Parameters:
tuple - the ReplicaCatalogEntry object containing the PFN and the attributes.

addPFNs

protected void addPFNs(List tuples)
Add a PFN and it's attributes.

Parameters:
tuples - the List object of ReplicaCatalogEntry objects, each containing the PFN and the attributes.

setLFN

public void setLFN(String lfn)
Sets the LFN.

Parameters:
lfn - the lfn.

getLFN

public String getLFN()
Returns the associated LFN.

Returns:
lfn

getPFN

public ReplicaCatalogEntry getPFN(int index)
Return a PFN as a ReplicaCatalogEntry

Parameters:
index - the pfn location.
Returns:
the element at the specified position in this list.
Throws:
IndexOutOfBoundsException - - if the index is out of range (index < 0 || index >= size()).

getPFNList

public List getPFNList()
Returns the list of pfn's as ReplicaCatalogEntry objects.

Returns:
List

pfnIterator

public Iterator pfnIterator()
Returns an iterator to the list of ReplicaCatalogEntry objects.

Returns:
Iterator.

getPFNCount

public int getPFNCount()
Returns the number of pfn's associated with the lfn.

Returns:
int

clone

public Object clone()
Returns the clone of the object.

Overrides:
clone in class Object
Returns:
the clone

merge

public boolean merge(ReplicaLocation location)
Merges the ReplicaLocation object to the existing one, only if the logical filenames match.

Parameters:
location - is another ReplicaLocations to merge with.
Returns:
true if a merge was successful, false if the LFNs did not match.

toString

public String toString()
Returns the textual description of the data class.

Specified by:
toString in class Data
Returns:
the textual description.

sanitize

private void sanitize(List tuples)
Sanitizes a tuple list . Sets the resource handle to a default value if not specified.

Parameters:
tuples - the tuple to be sanitized.

sanitize

private void sanitize(ReplicaCatalogEntry tuple)
Sanitizes a tuple . Sets the resource handle to a default value if not specified.

Parameters:
tuple - the tuple to be sanitized.


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