public class MRC extends java.lang.Object implements ReplicaCatalog
To use it set
pegasus.catalog.replica MRCEach associated replica catalog can be configured via properties as follows.
The user associates a variable name referred to as [value] for each of the catalogs, where [value] is any legal identifier (concretely [A-Za-z][_A-Za-z0-9]*) For each associated replica catalogs the user specifies the following properties.
pegasus.catalog.replica.mrc.[value] to specify the type of replica catalog. pegasus.catalog.replica.mrc.[value].key to specify a property name key for a particular catalog
For example, if a user wants to query two lrc's at the same time he/she can specify as follows
pegasus.catalog.replica.mrc.lrc1 LRC pegasus.catalog.replica.mrc.lrc2.url rls://sukhna pegasus.catalog.replica.mrc.lrc2 LRC pegasus.catalog.replica.mrc.lrc2.url rls://smarty
In the above example, lrc1, lrc2 are any valid identifier names and url is the property key that needed to be specified.
Modifier and Type | Field and Description |
---|---|
protected LogManager |
mLogger
The handle to the logging manager.
|
protected java.util.List |
mRCList
The list of replica catalogs that need to be queried for.
|
static java.lang.String |
PROPERTY_PREFIX
The prefix for the property subset for connecting to the individual
catalogs.
|
static java.lang.String |
TYPE_KEY
The property key that designates the type of replica catalog to connect
to.
|
BATCH_KEY, c_prefix, DB_PREFIX, PROXY_KEY
DB_ALL_PREFIX
Constructor and Description |
---|
MRC()
The default constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
clear()
Removes everything from the catalogs.
|
void |
close()
Explicitely free resources before the garbage collection hits.
|
boolean |
connect(java.util.Properties props)
Establishes a link between the implementation and the thing the
implementation is build upon.
|
protected boolean |
connect(java.lang.String name,
java.util.Properties properties)
Connects to an individual replica catalog.
|
int |
delete(java.util.Map x,
boolean matchAttributes)
Deletes multiple mappings into the replica catalog.
|
int |
delete(java.lang.String lfn,
ReplicaCatalogEntry tuple)
Deletes a very specific mapping from the replica catalog.
|
int |
delete(java.lang.String lfn,
java.lang.String pfn)
Deletes a specific mapping from the replica catalog.
|
int |
delete(java.lang.String lfn,
java.lang.String name,
java.lang.Object value)
Deletes all PFN entries for a given LFN from the replica catalog where
the PFN attribute is found, and matches exactly the object value.
|
int |
deleteByResource(java.lang.String lfn,
java.lang.String handle)
Deletes all PFN entries for a given LFN from the replica catalog where
the resource handle is found.
|
protected java.lang.String |
getKey(java.lang.String key,
java.lang.String prefix)
Returns the key with the prefix stripped off.
|
protected java.lang.String |
getName(java.lang.String key)
Returns the name from the key.
|
int |
insert(java.util.Map x)
Inserts multiple mappings into the replica catalog.
|
int |
insert(java.lang.String lfn,
ReplicaCatalogEntry tuple)
Inserts a new mapping into the replica catalog.
|
int |
insert(java.lang.String lfn,
java.lang.String pfn,
java.lang.String handle)
Inserts a new mapping into the replica catalog.
|
boolean |
isClosed()
Predicate to check, if the connection with the catalog's
implementation is still active.
|
java.util.Set |
list()
Lists all logical filenames in the catalog.
|
java.util.Set |
list(java.lang.String constraint)
Lists a subset of all logical filenames in the catalog.
|
java.util.Map |
lookup(java.util.Map constraints)
Retrieves multiple entries for a given logical filename, up to the
complete catalog.
|
java.util.Map |
lookup(java.util.Set lfns)
Retrieves multiple entries for a given logical filename, up to the
complete catalog.
|
java.util.Map |
lookup(java.util.Set lfns,
java.lang.String handle)
Retrieves multiple entries for a given logical filename, up to the
complete catalog.
|
java.util.Collection |
lookup(java.lang.String lfn)
Retrieves all entries for a given LFN from the replica catalog.
|
java.lang.String |
lookup(java.lang.String lfn,
java.lang.String handle)
Retrieves the entry for a given filename and resource handle from the
replica catalog.
|
java.util.Map |
lookupNoAttributes(java.util.Set lfns)
Retrieves multiple entries for a given logical filename, up to the
complete catalog.
|
java.util.Map |
lookupNoAttributes(java.util.Set lfns,
java.lang.String handle)
Retrieves multiple entries for a given logical filename, up to the
complete catalog.
|
java.util.Set |
lookupNoAttributes(java.lang.String lfn)
Retrieves all entries for a given LFN from the replica catalog.
|
protected java.util.Iterator |
rcIterator()
Returns an iterator to iterate through the list of ReplicaCatalogs that
MRC is associated with.
|
int |
remove(java.util.Set lfns)
Removes all mappings for a set of LFNs.
|
int |
remove(java.lang.String lfn)
Removes all mappings for an LFN from the replica catalog.
|
int |
removeByAttribute(java.lang.String handle)
Removes all entries associated with a particular resource handle.
|
int |
removeByAttribute(java.lang.String name,
java.lang.Object value)
Removes all entries from the replica catalog where the PFN attribute
is found, and matches exactly the object value.
|
public static final java.lang.String PROPERTY_PREFIX
public static final java.lang.String TYPE_KEY
protected java.util.List mRCList
protected LogManager mLogger
public int clear()
clear
in interface ReplicaCatalog
public void close()
public boolean connect(java.util.Properties props)
protected boolean connect(java.lang.String name, java.util.Properties properties)
name
- the name given by the user in the properties file.properties
- the properties to use for connecting.protected java.util.Iterator rcIterator()
protected java.lang.String getName(java.lang.String key)
key
- Stringprotected java.lang.String getKey(java.lang.String key, java.lang.String prefix)
key
- the keyprefix
- StringTYPE_KEY
public int delete(java.lang.String lfn, java.lang.String name, java.lang.Object value)
delete
in interface ReplicaCatalog
lfn
- is the logical filename to look for.name
- is the PFN attribute name to look for.value
- is an exact match of the attribute value to match.public int delete(java.lang.String lfn, ReplicaCatalogEntry tuple)
delete
in interface ReplicaCatalog
lfn
- is the logical filename in the tuple.tuple
- is a description of the PFN and its attributes.public int delete(java.util.Map x, boolean matchAttributes)
delete
in interface ReplicaCatalog
x
- is a map from logical filename string to list of replica
catalog entries.matchAttributes
- whether mapping should be deleted only if all
attributes match.ReplicaCatalogEntry
public int delete(java.lang.String lfn, java.lang.String pfn)
delete
in interface ReplicaCatalog
lfn
- is the logical filename in the tuple.pfn
- is the physical filename in the tuple.public int deleteByResource(java.lang.String lfn, java.lang.String handle)
deleteByResource
in interface ReplicaCatalog
lfn
- is the logical filename to look for.handle
- is the resource handlepublic int insert(java.lang.String lfn, java.lang.String pfn, java.lang.String handle)
insert
in interface ReplicaCatalog
lfn
- is the logical filename under which to book the entry.pfn
- is the physical filename associated with it.handle
- is a resource handle where the PFN resides.java.lang.UnsupportedOperationException
ReplicaCatalog.insert( String, ReplicaCatalogEntry )
,
ReplicaCatalogEntry
public int insert(java.lang.String lfn, ReplicaCatalogEntry tuple)
insert
in interface ReplicaCatalog
lfn
- is the logical filename under which to book the entry.tuple
- is the physical filename and associated PFN attributes.java.lang.UnsupportedOperationException
public int insert(java.util.Map x)
insert
in interface ReplicaCatalog
x
- is a map from logical filename string to list of replica
catalog entries.java.lang.UnsupportedOperationException
ReplicaCatalogEntry
public boolean isClosed()
isClosed
in interface Catalog
Catalog.close()
public java.util.Set list(java.lang.String constraint)
list
in interface ReplicaCatalog
constraint
- is a constraint for the logical filename only. It
is a string that has some meaning to the implementing system. This
can be a SQL wildcard for queries, or a regular expression for
Java-based memory collections.public java.util.Set list()
list
in interface ReplicaCatalog
public java.lang.String lookup(java.lang.String lfn, java.lang.String handle)
lookup
in interface ReplicaCatalog
lfn
- is the logical filename to obtain information for.handle
- is the resource handle to obtain entries for.null
if no match was found.public java.util.Collection lookup(java.lang.String lfn)
lookup
in interface ReplicaCatalog
lfn
- is the logical filename to obtain information for.ReplicaCatalogEntry
public java.util.Map lookup(java.util.Set lfns, java.lang.String handle)
lookup
in interface ReplicaCatalog
lfns
- is a set of logical filename strings to look up.handle
- is the resource handle, restricting the LFNs.ReplicaCatalogEntry
public java.util.Map lookup(java.util.Map constraints)
lookup
in interface ReplicaCatalog
constraints
- is mapping of keys 'lfn', 'pfn', or any attribute
name, e.g. the resource handle 'site', to a string that has some
meaning to the implementing system. This can be a SQL wildcard for
queries, or a regular expression for Java-based memory collections.
Unknown keys are ignored. Using an empty map requests the complete
catalog.ReplicaCatalogEntry
public java.util.Map lookup(java.util.Set lfns)
lookup
in interface ReplicaCatalog
lfns
- is a set of logical filename strings to look up.ReplicaCatalogEntry
public java.util.Set lookupNoAttributes(java.lang.String lfn)
lookupNoAttributes
in interface ReplicaCatalog
lfn
- is the logical filename to obtain information for.public java.util.Map lookupNoAttributes(java.util.Set lfns)
lookupNoAttributes
in interface ReplicaCatalog
lfns
- is a set of logical filename strings to look up.public java.util.Map lookupNoAttributes(java.util.Set lfns, java.lang.String handle)
lookupNoAttributes
in interface ReplicaCatalog
lfns
- is a set of logical filename strings to look up.handle
- is the resource handle, restricting the LFNs.public int remove(java.lang.String lfn)
remove
in interface ReplicaCatalog
lfn
- is the logical filename to remove all mappings for.public int remove(java.util.Set lfns)
remove
in interface ReplicaCatalog
lfns
- is a set of logical filename to remove all mappings for.public int removeByAttribute(java.lang.String name, java.lang.Object value)
removeByAttribute
in interface ReplicaCatalog
name
- is the PFN attribute name to look for.value
- is an exact match of the attribute value to match.public int removeByAttribute(java.lang.String handle)
removeByAttribute
in interface ReplicaCatalog
handle
- is the site handle to remove all entries for.ReplicaCatalog.removeByAttribute( String, Object )