edu.isi.pegasus.planner.catalog

## Interface ReplicaCatalog

All Superinterfaces:
  Catalog

All Known Implementing Classes:
  Directory, FlushedCache, JDBCRC, MRC, Regex, SimpleFile

    public interface ReplicaCatalog
    extends Catalog

This interface describes a minimum set of essential tasks required from a replica catalog. The method verbs have a steering meaning associated with them:

lookup
  retrieves physical filenames or replica entries
list
  retrieves only lists of logical filenames
delete
  removes an entry specified by LFN and PFN
remove
  removes en-bulk by LFN

Version:
  $Revision$
Author:
  Jens-S. Vöckler, Karan Vahi

### Field Summary

Fields
`static java.lang.String` `BATCH_KEY` The suffix for the property that if set, specifies the size of the chunk in which the implementations handle multiple queries.
`static java.lang.String` `c_prefix` Prefix for the property subset to use with this catalog.
`static java.lang.String` `DB_PREFIX` The DB Driver properties prefix.
`static java.lang.String` `PROXY_KEY` The key that if set, specifies the proxy to be picked up while connecting to the RLS.

### Fields inherited from interface edu.isi.pegasus.planner.catalog.Catalog

`DB_ALL_PREFIX`

### Method Summary

All Methods Instance Methods Abstract Methods
`int` `clear()` Removes everything.
`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.
`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.
`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.
`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.

### Methods inherited from interface edu.isi.pegasus.planner.catalog.Catalog

`close, connect, isClosed`

### Field Detail

#### c_prefix

    static final java.lang.String c_prefix

Prefix for the property subset to use with this catalog.

See Also:
  Constant Field Values

#### DB_PREFIX

    static final java.lang.String DB_PREFIX

The DB Driver properties prefix.

See Also:
  Constant Field Values

#### PROXY_KEY

    static final java.lang.String PROXY_KEY

The key that if set, specifies the proxy to be picked up while connecting to the RLS.

See Also:
  Constant Field Values

#### BATCH_KEY

    static final java.lang.String BATCH_KEY

The suffix for the property that if set, specifies the size of the chunk in which the implementations handle multiple queries. The property that needs to be specified is vds.rc.chunk.size.

See Also:
  Constant Field Values

### Method Detail

#### lookup

    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.

Parameters:
  `lfn` - is the logical filename to obtain information for.
  `handle` - is the resource handle to obtain entries for.
Returns:
  the (first) matching physical filename, or `null` if no match was found.

#### lookup

    java.util.Collection lookup(java.lang.String lfn)

Retrieves all entries for a given LFN from the replica catalog. Each entry in the result set is a tuple of a PFN and all its attributes.

Parameters:
  `lfn` - is the logical filename to obtain information for.
Returns:
  a collection of replica catalog entries
See Also:
  `ReplicaCatalogEntry`

#### lookupNoAttributes

    java.util.Set lookupNoAttributes(java.lang.String lfn)

Retrieves all entries for a given LFN from the replica catalog. Each entry in the result set is just a PFN string. Duplicates are reduced through the set paradigm.

Parameters:
  `lfn` - is the logical filename to obtain information for.
Returns:
  a set of PFN strings

#### lookup

    java.util.Map lookup(java.util.Set lfns)

Retrieves multiple entries for a given logical filename, up to the complete catalog. Retrieving full catalogs should be harmful, but may be helpful in an online display or portal.

Parameters:
  `lfns` - is a set of logical filename strings to look up.
Returns:
  a map indexed by the LFN. Each value is a collection of replica catalog entries for the LFN.
See Also:
  `ReplicaCatalogEntry`

#### lookupNoAttributes

    java.util.Map lookupNoAttributes(java.util.Set lfns)

Retrieves multiple entries for a given logical filename, up to the complete catalog. Retrieving full catalogs should be harmful, but may be helpful in an online display or portal.

Parameters:
  `lfns` - is a set of logical filename strings to look up.
Returns:
  a map indexed by the LFN. Each value is a set of PFN strings.

#### lookup

    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. Retrieving full catalogs should be harmful, but may be helpful in online display or portal.

Parameters:
  `lfns` - is a set of logical filename strings to look up.
  `handle` - is the resource handle, restricting the LFNs.
Returns:
  a map indexed by the LFN. Each value is a collection of replica catalog entries (all attributes).
See Also:
  `ReplicaCatalogEntry`

#### lookupNoAttributes

    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. Retrieving full catalogs should be harmful, but may be helpful in online display or portal.

Parameters:
  `lfns` - is a set of logical filename strings to look up.
  `handle` - is the resource handle, restricting the LFNs.
Returns:
  a map indexed by the LFN. Each value is a set of physical filenames.

#### lookup

    java.util.Map lookup(java.util.Map constraints)

Retrieves multiple entries for a given logical filename, up to the complete catalog. Retrieving full catalogs should be harmful, but may be helpful in online display or portal.

Parameters:
  `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.
Returns:
  a map indexed by the LFN. Each value is a collection of replica catalog entries.
See Also:
  `ReplicaCatalogEntry`

#### list

    java.util.Set list()

Lists all logical filenames in the catalog.

Returns:
  A set of all logical filenames known to the catalog.

#### list

    java.util.Set list(java.lang.String constraint)

Lists a subset of all logical filenames in the catalog.

Parameters:
  `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.
Returns:
  A set of logical filenames that match. The set may be empty

#### insert

    int insert(java.lang.String lfn,
               ReplicaCatalogEntry tuple)

Inserts a new mapping into the replica catalog.

Parameters:
  `lfn` - is the logical filename under which to book the entry.
  `tuple` - is the physical filename and associated PFN attributes.
Returns:
  number of insertions, should always be 1. On failure, throw an exception, don't use zero.

#### insert

    int insert(java.lang.String lfn,
               java.lang.String pfn,
               java.lang.String handle)

Inserts a new mapping into the replica catalog. This is a convenience function exposing the resource handle. Internally, the `ReplicaCatalogEntry` element will be contructed, and passed to the appropriate insert function.

Parameters:
  `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.
Returns:
  number of insertions, should always be 1. On failure, throw an exception, don't use zero.
See Also:
  `insert( String, ReplicaCatalogEntry )`, `ReplicaCatalogEntry`

#### insert

    int insert(java.util.Map x)

Inserts multiple mappings into the replica catalog. The input is a map indexed by the LFN. The value for each LFN key is a collection of replica catalog entries.

Parameters:
  `x` - is a map from logical filename string to list of replica catalog entries.
Returns:
  the number of insertions.
See Also:
  `ReplicaCatalogEntry`

#### delete

    int delete(java.util.Map x,
               boolean matchAttributes)

Deletes multiple mappings into the replica catalog. The input is a map indexed by the LFN. The value for each LFN key is a collection of replica catalog entries. On setting matchAttributes to false, all entries having matching lfn pfn mapping to an entry in the Map are deleted. However, upon removal of an entry, all attributes associated with the pfn also evaporate (cascaded deletion).

Parameters:
  `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.
Returns:
  the number of deletions.
See Also:
  `ReplicaCatalogEntry`

#### delete

    int delete(java.lang.String lfn,
               java.lang.String pfn)

Deletes a specific mapping from the replica catalog. We don't care about the resource handle. More than one entry could theoretically be removed. Upon removal of an entry, all attributes associated with the PFN also evaporate (cascading deletion).

Parameters:
  `lfn` - is the logical filename in the tuple.
  `pfn` - is the physical filename in the tuple.
Returns:
  the number of removed entries.

#### delete

    int delete(java.lang.String lfn,
               ReplicaCatalogEntry tuple)

Deletes a very specific mapping from the replica catalog. The LFN must be matches, the PFN, and all PFN attributes specified in the replica catalog entry. More than one entry could theoretically be removed. Upon removal of an entry, all attributes associated with the PFN also evaporate (cascading deletion).

Parameters:
  `lfn` - is the logical filename in the tuple.
  `tuple` - is a description of the PFN and its attributes.
Returns:
  the number of removed entries, either 0 or 1.

#### delete

    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. This method may be useful to remove all replica entries that have a certain MD5 sum associated with them. It may also be harmful overkill.

Parameters:
  `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.
Returns:
  the number of removed entries.

#### deleteByResource

    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. Karan requested this convenience method, which can be coded like

      delete( lfn, RESOURCE_HANDLE, handle )

Parameters:
  `lfn` - is the logical filename to look for.
  `handle` - is the resource handle
Returns:
  the number of entries removed.

#### remove

    int remove(java.lang.String lfn)

Removes all mappings for an LFN from the replica catalog.

Parameters:
  `lfn` - is the logical filename to remove all mappings for.
Returns:
  the number of removed entries.

#### remove

    int remove(java.util.Set lfns)

Removes all mappings for a set of LFNs.

Parameters:
  `lfns` - is a set of logical filename to remove all mappings for.
Returns:
  the number of removed entries.

#### removeByAttribute

    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.

Parameters:
  `name` - is the PFN attribute name to look for.
  `value` - is an exact match of the attribute value to match.
Returns:
  the number of removed entries.

#### removeByAttribute

    int removeByAttribute(java.lang.String handle)

Removes all entries associated with a particular resource handle. This is useful, if a site goes offline. It is a convenience method, which calls the generic `removeByAttribute` method.

Parameters:
  `handle` - is the site handle to remove all entries for.
Returns:
  the number of removed entries.
See Also:
  `removeByAttribute( String, Object )`

#### clear

    int clear()

Removes everything. Use with caution!

Returns:
  the number of removed entries.