edu.isi.pegasus.planner.classes

## Class ReplicaLocation

- java.lang.Object
- - edu.isi.pegasus.planner.classes.Data
  - - edu.isi.pegasus.planner.classes.ReplicaLocation

All Implemented Interfaces:
  java.lang.Cloneable

    public class ReplicaLocation
    extends Data
    implements java.lang.Cloneable

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

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

### Field Summary

Fields
`private java.lang.String` `mLFN` The LFN associated with the entry.
`private java.util.List` `mPFNList` A list of `ReplicaCatalogEntry` objects containing the PFN's and associated attributes.
`static java.lang.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

Constructors
Constructor and Description
`ReplicaLocation()` Default constructor.
`ReplicaLocation(java.lang.String lfn, java.util.Collection pfns)` Overloaded constructor.
`ReplicaLocation(java.lang.String lfn, java.util.List pfns)` Overloaded constructor.

### Method Summary

All Methods Instance Methods Concrete Methods
`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(java.util.List tuples)` Add a PFN and it's attributes.
`java.lang.Object` `clone()` Returns the clone of the object.
`java.lang.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.
`java.util.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.
`java.util.Iterator` `pfnIterator()` Returns an iterator to the list of `ReplicaCatalogEntry` objects.
`private void` `sanitize(java.util.List tuples)` Sanitizes a tuple list .
`private void` `sanitize(ReplicaCatalogEntry tuple)` Sanitizes a tuple .
`void` `setLFN(java.lang.String lfn)` Sets the LFN.
`java.lang.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 java.lang.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 java.lang.String mLFN

The LFN associated with the entry.

#### mPFNList

    private java.util.List mPFNList

A list of `ReplicaCatalogEntry` objects containing the PFN's and associated attributes.

### Constructor Detail

#### ReplicaLocation

    public ReplicaLocation()

Default constructor.

#### ReplicaLocation

    public ReplicaLocation(java.lang.String lfn,
                           java.util.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(java.lang.String lfn,
                           java.util.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(java.util.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(java.lang.String lfn)

Sets the LFN.

Parameters:
  `lfn` - the lfn.

#### getLFN

    public java.lang.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:
  `java.lang.IndexOutOfBoundsException` - - if the index is out of range (index < 0 || index >= size()).

#### getPFNList

    public java.util.List getPFNList()

Returns the list of pfn's as `ReplicaCatalogEntry` objects.

Returns:
  List

#### pfnIterator

    public java.util.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 java.lang.Object clone()

Returns the clone of the object.

Overrides:
  `clone` in class `java.lang.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 java.lang.String toString()

Returns the textual description of the data class.

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

#### sanitize

    private void sanitize(java.util.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.