edu.isi.pegasus.planner.classes
Class ReplicaStore

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

public class ReplicaStore
extends Data
implements 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: 2687 $
Author:
Karan Vahi, Gaurang Mehta
See Also:
org.griphyn.common.catalog.ReplicaCatalogEntry

Field Summary
private  Map mStore
          The replica store.
 
Fields inherited from class edu.isi.pegasus.planner.classes.Data
mLogger, mLogMsg
 
Constructor Summary
ReplicaStore()
          Default constructor.
ReplicaStore(Map rces)
          Overloaded constructor.
 
Method Summary
 void add(Map rces)
          Adds ReplicaCatalogEntries into the store.
 void add(ReplicaLocation rl)
          Adds replica catalog entries into the store.
 void add(String lfn, Collection tuples)
          Adds replica catalog entries into the store.
 Object clone()
          Returns the clone of the object.
 boolean containsLFN(String lfn)
          Returns a boolean indicating whether the store has a mapping for a particular LFN or not.
protected  ReplicaLocation get(String key)
          Returns an entry corresponding to the LFN
 int getLFNCount()
          Returns the number of LFN's for which the mappings are stored in the store.
 Set getLFNs()
          Returns the set of LFN's for which the mappings are stored in the store.
 Set getLFNs(Set lfns)
          Returns a Set of lfns for which the mappings are stored in the store, amongst the Set passed as input.
 ReplicaLocation getReplicaLocation(String lfn)
          Returns a ReplicaLocation corresponding to the LFN.
 boolean isEmpty()
          Returns a boolean indicating whether a store is empty or not.
protected  Object put(String key, ReplicaLocation value)
          Inserts entry in the store overwriting any existing entry.
 Iterator replicaLocationIterator()
          Returns an iterator to the list of ReplicaLocation objects stored in the store.
 void store(Map rces)
          Stores replica catalog entries into the store.
 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

mStore

private Map mStore
The replica store.

Constructor Detail

ReplicaStore

public ReplicaStore()
Default constructor.


ReplicaStore

public ReplicaStore(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(Map rces)
Stores replica catalog entries into the store. It overwrites any existing entries with the same LFN's. The ReplicaCatlogEntry ends up being stored as a ReplicaLocation 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(Map rces)
Adds ReplicaCatalogEntries into the store. Any existing mapping of the same LFN and PFN will be replaced, including all its attributes. The ReplicaCatlogEntry ends up being stored as a ReplicaLocation 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(String lfn,
                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 of ReplicaCatalogEntry 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 - the ReplicaLocation containing a pfn and all the attributes.

getReplicaLocation

public ReplicaLocation getReplicaLocation(String lfn)
Returns a ReplicaLocation corresponding to the LFN.

Parameters:
lfn - the lfn for which the ReplicaLocation is required.
Returns:
ReplicaLocation if entry exists else null.

replicaLocationIterator

public Iterator replicaLocationIterator()
Returns an iterator to the list of ReplicaLocation objects stored in the store.

Returns:
Iterator.

getLFNs

public Set getLFNs()
Returns the set of LFN's for which the mappings are stored in the store.

Returns:
Set

getLFNs

public Set getLFNs(Set lfns)
Returns a Set of lfns for which the mappings are stored in the store, amongst the Set 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 Object clone()
Returns the clone of the object.

Overrides:
clone in class Object
Returns:
the clone

toString

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

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

containsLFN

public boolean containsLFN(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 Object put(String key,
                     ReplicaLocation value)
Inserts entry in the store overwriting any existing entry.

Parameters:
key - the key
value - ReplicaLocation object.
Returns:
Object

get

protected ReplicaLocation get(String key)
Returns an entry corresponding to the LFN

Parameters:
key - the LFN
Returns:
ReplicaLocation object if exists, else null.


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