Package edu.isi.pegasus.planner.classes
Class ReplicaStore
- java.lang.Object
-
- edu.isi.pegasus.planner.classes.Data
-
- edu.isi.pegasus.planner.classes.ReplicaStore
-
- All Implemented Interfaces:
java.lang.Cloneable
public class ReplicaStore extends Data implements java.lang.Cloneable
A Replica Store that allows us to store the entries from a replica catalog. The store map is indexed by LFN's and values stored are ReplicaLocation objects.- Version:
- $Revision$
- Author:
- Karan Vahi, Gaurang Mehta
- See Also:
org.griphyn.common.catalog.ReplicaCatalogEntry
-
-
Constructor Summary
Constructors Constructor Description ReplicaStore()
Default constructor.ReplicaStore(java.util.Map rces)
Overloaded constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(ReplicaLocation rl)
Adds replica catalog entries into the store.void
add(java.lang.String lfn, java.util.Collection tuples)
Adds replica catalog entries into the store.void
add(java.util.Map rces)
Adds ReplicaCatalogEntries into the store.java.lang.Object
clone()
Returns the clone of the object.boolean
containsLFN(java.lang.String lfn)
Returns a boolean indicating whether the store has a mapping for a particular LFN or not.protected ReplicaLocation
get(java.lang.String key)
Returns an entry corresponding to the LFNint
getLFNCount()
Returns the number of LFN's for which the mappings are stored in the store.java.util.Set
getLFNs()
Returns the set of LFN's for which the mappings are stored in the store.java.util.Set
getLFNs(java.util.Set lfns)
Returns aSet
of lfns for which the mappings are stored in the store, amongst theSet
passed as input.ReplicaLocation
getReplicaLocation(java.lang.String lfn)
Returns aReplicaLocation
corresponding to the LFN.boolean
isEmpty()
Returns a boolean indicating whether a store is empty or not.protected java.lang.Object
put(java.lang.String key, ReplicaLocation value)
Inserts entry in the store overwriting any existing entry.java.util.Iterator
replicaLocationIterator()
Returns an iterator to the list ofReplicaLocation
objects stored in the store.void
store(java.util.Map rces)
Stores replica catalog entries into the store.java.lang.String
toString()
Returns the textual description of the data class.-
Methods inherited from class edu.isi.pegasus.planner.classes.Data
setToString, vectorToString
-
-
-
-
Constructor Detail
-
ReplicaStore
public ReplicaStore()
Default constructor.
-
ReplicaStore
public ReplicaStore(java.util.Map rces)
Overloaded constructor. Intializes the member variables to the values passed.- Parameters:
rces
- map indexed by LFN's and each value is a collection of replica catalog entries for the LFN.
-
-
Method Detail
-
store
public void store(java.util.Map rces)
Stores replica catalog entries into the store. It overwrites any existing entries with the same LFN's. TheReplicaCatlogEntry
ends up being stored as aReplicaLocation
object.- Parameters:
rces
- map indexed by LFN's and each value is a collection of replica catalog entries for the LFN.
-
add
public void add(java.util.Map rces)
Adds ReplicaCatalogEntries into the store. Any existing mapping of the same LFN and PFN will be replaced, including all its attributes. TheReplicaCatlogEntry
ends up being stored as aReplicaLocation
object.- Parameters:
rces
- map indexed by LFN's and each value is a collection of replica catalog entries for the LFN.
-
add
public void add(java.lang.String lfn, java.util.Collection tuples)
Adds replica catalog entries into the store. Any existing mapping of the same LFN and PFN will be replaced, including all its attributes.- Parameters:
lfn
- the lfn.tuples
- list ofReplicaCatalogEntry
containing the PFN and the attributes.
-
add
public void add(ReplicaLocation rl)
Adds replica catalog entries into the store. Any existing mapping of the same LFN and PFN will be replaced, including all its attributes.- Parameters:
rl
- theReplicaLocation
containing a pfn and all the attributes.
-
getReplicaLocation
public ReplicaLocation getReplicaLocation(java.lang.String lfn)
Returns aReplicaLocation
corresponding to the LFN.- Parameters:
lfn
- the lfn for which the ReplicaLocation is required.- Returns:
ReplicaLocation
if entry exists else null.
-
replicaLocationIterator
public java.util.Iterator replicaLocationIterator()
Returns an iterator to the list ofReplicaLocation
objects stored in the store.- Returns:
- Iterator.
-
getLFNs
public java.util.Set getLFNs()
Returns the set of LFN's for which the mappings are stored in the store.- Returns:
- Set
-
getLFNs
public java.util.Set getLFNs(java.util.Set lfns)
Returns aSet
of lfns for which the mappings are stored in the store, amongst theSet
passed as input.- Parameters:
lfns
- the collections of lfns- Returns:
- Set
-
isEmpty
public boolean isEmpty()
Returns a boolean indicating whether a store is empty or not.- Returns:
- boolean
-
getLFNCount
public int getLFNCount()
Returns the number of LFN's for which the mappings are stored in the store.- Returns:
- int
-
clone
public java.lang.Object clone()
Returns the clone of the object.- Overrides:
clone
in classjava.lang.Object
- Returns:
- the clone
-
toString
public java.lang.String toString()
Returns the textual description of the data class.
-
containsLFN
public boolean containsLFN(java.lang.String lfn)
Returns a boolean indicating whether the store has a mapping for a particular LFN or not.- Parameters:
lfn
- the logical file name of the file.- Returns:
- boolean
-
put
protected java.lang.Object put(java.lang.String key, ReplicaLocation value)
Inserts entry in the store overwriting any existing entry.- Parameters:
key
- the keyvalue
-ReplicaLocation
object.- Returns:
- Object
-
get
protected ReplicaLocation get(java.lang.String key)
Returns an entry corresponding to the LFN- Parameters:
key
- the LFN- Returns:
ReplicaLocation
object if exists, else null.
-
-