| java.lang.Object org.griphyn.common.catalog.replica.RLI
RLI | public class RLI implements ReplicaCatalog(Code) | | This class implements the VDS replica catalog interface on top of RLI API.
A thing to take care of is that all delete and remove operations are
propoagated to all the Local Replica Catalogs (LRCs) reporting to the RLI.
Hence,
you should be careful while deleting LFNs, as deletions can cascade to
multiple LRCs. If you want to delete or remove an LFN from a particular LRC,
use the LRC implementation to connect to that LRC and call the corresponding
delete functions on that.
There is no transaction support in the implementation. The implementation
is best effort. Inconsistencies can occur if one of the LRCs goes offline,
or an operation fails for whatsoever reason.
author: Karan Vahi author: Gaurang Mehta version: $Revision: 159 $ |
Field Summary | |
final public static String | DEFAULT_RLI_TIMEOUT The default timeout in seconds to be used while querying the RLI. | final public static String | LRC_IGNORE_KEY The key that is used to designate the LRC whose results are to be
ignored. | final public static String | LRC_NOT_CONNECTED_MSG The error message for not connected to LRC. | final public static int | LRC_QUERY_IGNORE The LRC query state indicating that LRC has to be ignored. | final public static int | LRC_QUERY_NORMAL The LRC query state indicating that LRC needs to queried fully. | final public static int | LRC_QUERY_RESTRICT The LRC query state indicating that LRC has to be restricted query. | final public static String | LRC_RESTRICT_KEY The key that is used to designate the LRC whose results are to be
restricted. | final public static String | PROXY_KEY The key that if set, specifies the proxy to be picked up while connecting
to the RLS. | final public static String | RLI_NOT_CONNECTED_MSG The error message for not connected to RLI. | final public static String | RLI_TIMEOUT_KEY The key that is used to get hold of the timeout value from the properties
object. | final public static int | RLS_BULK_QUERY_SIZE The number of entries searched in each bulk query to RLS. | final public static String | RLS_TIMEOUT_KEY The key that is used to get hold of the timeout value from the properties
object. | final public static String | SITE_ATTRIBUTE The attribute in RLS that maps to a site handle. | final public static String | UNDEFINED_SITE The undefined pool attribute value. | final public static String | URL_KEY The key that is used to get hold of the url from the properties object. |
Constructor Summary | |
public | RLI() The default constructor, that creates an object which is not linked with
any RLS. |
Method Summary | |
public int | clear() Removes everything from all the LRCs that report to this RLI. | public void | close() Explicitely free resources before the garbage collection hits. | public boolean | connect(String url) Establishes a connection to the RLI, picking up the proxy from the default
location usually /tmp/ directory.
Parameters: url - the url to lrc to connect to. | public boolean | connect(Properties props) Establishes a connection to the RLI.
Parameters: props - contains all necessary data to establish the link. | public boolean | connect(String url, String proxy) Establishes a connection to the RLI.
Parameters: url - the url to lrc to connect to. Parameters: proxy - the path to the proxy file to be picked up. | public int | delete(String lfn, String pfn) Deletes a specific mapping from the replica catalog. | public int | delete(String lfn, ReplicaCatalogEntry tuple) Deletes a very specific mapping from the replica catalog. | public int | delete(String lfn, String name, 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. | public int | delete(Map x, boolean matchAttributes) Deletes multiple mappings into the replica catalog. | public int | deleteByResource(String lfn, String handle) Deletes all PFN entries for a given LFN from the replica catalog
where the resource handle is found. | protected int | getBatchSize() Returns the number of lfns in each batch while querying the lrc in the
bulk mode. | public RLSClient.LRC | getLRC() Gets a handle to the LRC that is associated with the RLS running at
url. | public RLSClient.RLI | getRLI() Gets a handle to the RLI that is associated with the RLS running at
url. | protected String[] | getRLSLRCIgnoreURLs(Properties properties) Returns the rls LRC urls to ignore for querying (requested by LIGO).
Referred to by the "pegasus.catalog.replica.lrc.ignore" property.
Parameters: properties - the properties passed in the connect method. | protected String[] | getRLSLRCRestrictURLs(Properties properties) Returns the rls LRC urls to restrict for querying (requested by LIGO).
Referred to by the "pegasus.catalog.replica.lrc.restrict" property.
Parameters: properties - the properties passed in the connect method. | public int | getTimeout(Properties properties) It returns the timeout value in seconds after which to timeout in case of
no activity from the RLI.
Referred to by the "rli.timeout" property.
Parameters: properties - the properties passed in the connect method. | public int | insert(String lfn, ReplicaCatalogEntry tuple) Inserts a new mapping into the LRC running at the URL, where the RLI
is running.
Parameters: lfn - is the logical filename under which to book the entry. Parameters: tuple - is the physical filename and associated PFN attributes. | public int | insert(String lfn, String pfn, String handle) Inserts a new mapping into the LRC running at the URL, where the RLI
is running.
This is a convenience function exposing the resource handle. | public int | insert(Map x) Inserts multiple mappings into the replica catalog. | public boolean | isClosed() Returns whether the connection to the RLS with which this instance is
associated is closed or not. | public Set | list() Lists all logical filenames in the catalog. | public Set | list(String constraint) Lists a subset of all logical filenames in the catalog.
Parameters: constraint - is a constraint for the logical filename only. | public String | lookup(String lfn, String handle) Retrieves the entry for a given filename and resource handle from
the RLS.
Parameters: lfn - is the logical filename to obtain information for. Parameters: handle - is the resource handle to obtain entries for. | public Collection | lookup(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. | public Map | lookup(Set lfns) Retrieves multiple entries for a given logical filename, up to the
complete LRC. | public Map | lookup(Set lfns, String handle) Retrieves multiple entries for a given logical filenames, up to the
complete catalog. | public Map | lookup(Map constraints) Retrieves multiple entries for a given logical filename, up to the
complete catalog. | public Set | lookupNoAttributes(String lfn) Retrieves all entries for a given LFN from the replica catalog.
Each entry in the result set is just a PFN string. | public Map | lookupNoAttributes(Set lfns) Retrieves all entries for a given LFN from the replica catalog.
Each entry in the result set is just a PFN string. | public Map | lookupNoAttributes(Set lfns, String handle) Retrieves multiple entries for a given logical filename, up to the
complete catalog. | public static void | main(String[] args) The main program, for some unit testing. | public int | remove(String lfn) Removes all mappings for an LFN from the replica catalog.
It can result in a deletion of more than one entry, and from more
than one local replica catalog that might be reporting to the RLI.
Parameters: lfn - is the logical filename to remove all mappings for. | public int | remove(Set lfns) Removes all mappings for a set of LFNs.
It can result in a deletion of more than one entry, and from more
than one local replica catalog that might be reporting to the RLI.
Parameters: lfns - is a set of logical filename to remove all mappings for. | public int | removeByAttribute(String name, Object value) Removes all entries from the replica catalog where the PFN attribute
is found, and matches exactly the object value.
It can result in a deletion of more than one entry, and from more
than one local replica catalog that might be reporting to the RLI.
Parameters: name - is the PFN attribute name to look for. Parameters: value - is an exact match of the attribute value to match. | public int | removeByAttribute(String handle) Removes all entries associated with a particular resource handle.
This is useful, if a site goes offline. | protected void | setBatchSize(Properties properties) Sets the number of lfns in each batch while querying the lrc in the
bulk mode. |
DEFAULT_RLI_TIMEOUT | final public static String DEFAULT_RLI_TIMEOUT(Code) | | The default timeout in seconds to be used while querying the RLI.
|
LRC_IGNORE_KEY | final public static String LRC_IGNORE_KEY(Code) | | The key that is used to designate the LRC whose results are to be
ignored.
|
LRC_NOT_CONNECTED_MSG | final public static String LRC_NOT_CONNECTED_MSG(Code) | | The error message for not connected to LRC.
|
LRC_QUERY_IGNORE | final public static int LRC_QUERY_IGNORE(Code) | | The LRC query state indicating that LRC has to be ignored.
|
LRC_QUERY_NORMAL | final public static int LRC_QUERY_NORMAL(Code) | | The LRC query state indicating that LRC needs to queried fully. The LRC
returns all PFNs irrespective of whether they have a site attribute or
not.
|
LRC_QUERY_RESTRICT | final public static int LRC_QUERY_RESTRICT(Code) | | The LRC query state indicating that LRC has to be restricted query.
LRC should return only PFNs with site attributes tagged.
|
LRC_RESTRICT_KEY | final public static String LRC_RESTRICT_KEY(Code) | | The key that is used to designate the LRC whose results are to be
restricted.
|
PROXY_KEY | final public static String PROXY_KEY(Code) | | The key that if set, specifies the proxy to be picked up while connecting
to the RLS.
|
RLI_NOT_CONNECTED_MSG | final public static String RLI_NOT_CONNECTED_MSG(Code) | | The error message for not connected to RLI.
|
RLI_TIMEOUT_KEY | final public static String RLI_TIMEOUT_KEY(Code) | | The key that is used to get hold of the timeout value from the properties
object.
|
RLS_BULK_QUERY_SIZE | final public static int RLS_BULK_QUERY_SIZE(Code) | | The number of entries searched in each bulk query to RLS.
|
RLS_TIMEOUT_KEY | final public static String RLS_TIMEOUT_KEY(Code) | | The key that is used to get hold of the timeout value from the properties
object.
|
SITE_ATTRIBUTE | final public static String SITE_ATTRIBUTE(Code) | | The attribute in RLS that maps to a site handle.
|
UNDEFINED_SITE | final public static String UNDEFINED_SITE(Code) | | The undefined pool attribute value. The pool attribute is assigned this
value if the pfn queried does not have a pool associated with it.
|
URL_KEY | final public static String URL_KEY(Code) | | The key that is used to get hold of the url from the properties object.
|
RLI | public RLI()(Code) | | The default constructor, that creates an object which is not linked with
any RLS. Use the connect method to connect to the RLS.
See Also: #connect(Properties). |
clear | public int clear()(Code) | | Removes everything from all the LRCs that report to this RLI.
Use with caution!
the number of removed entries. |
close | public void close()(Code) | | Explicitely free resources before the garbage collection hits.
|
connect | public boolean connect(String url)(Code) | | Establishes a connection to the RLI, picking up the proxy from the default
location usually /tmp/ directory.
Parameters: url - the url to lrc to connect to. true if connected now, or false to indicate a failure. |
connect | public boolean connect(Properties props)(Code) | | Establishes a connection to the RLI.
Parameters: props - contains all necessary data to establish the link. true if connected now, or false to indicate a failure. |
connect | public boolean connect(String url, String proxy)(Code) | | Establishes a connection to the RLI.
Parameters: url - the url to lrc to connect to. Parameters: proxy - the path to the proxy file to be picked up. null denotesdefault location. true if connected now, or false to indicate a failure. |
delete | public int delete(String lfn, String pfn)(Code) | | 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).
It can result in a deletion of more than one entry, and from more
than one local replica catalog that might be reporting to the RLI.
Parameters: lfn - is the logical filename in the tuple. Parameters: pfn - is the physical filename in the tuple. the number of removed entries. |
delete | public int delete(String lfn, ReplicaCatalogEntry tuple)(Code) | | 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).
It can result in a deletion of more than one entry, and from more
than one local replica catalog that might be reporting to the RLI.
Parameters: lfn - is the logical filename in the tuple. Parameters: tuple - is a description of the PFN and its attributes. the number of removed entries, either 0 or 1. |
delete | public int delete(String lfn, String name, Object value)(Code) | | 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.
It can result in a deletion of more than one entry, and from more
than one local replica catalog that might be reporting to the RLI.
Parameters: lfn - is the logical filename to look for. Parameters: name - is the PFN attribute name to look for. Parameters: value - is an exact match of the attribute value to match. the number of removed entries. |
delete | public int delete(Map x, boolean matchAttributes)(Code) | | 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).
The deletes are done in batches.
Parameters: x - is a map from logical filename string to list ofreplica catalog entries. Parameters: matchAttributes - whether mapping should be deleted only if allattributes match. the number of deletions. See Also: ReplicaCatalogEntry |
deleteByResource | public int deleteByResource(String lfn, String handle)(Code) | | 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, SITE_ATTRIBUTE, handle )
It can result in a deletion of more than one entry, and from more
than one local replica catalog that might be reporting to the RLI.
Parameters: lfn - is the logical filename to look for. Parameters: handle - is the resource handle the number of entries removed. |
getBatchSize | protected int getBatchSize()(Code) | | Returns the number of lfns in each batch while querying the lrc in the
bulk mode.
the batch size. |
getLRC | public RLSClient.LRC getLRC()(Code) | | Gets a handle to the LRC that is associated with the RLS running at
url.
RLSClient.LRC that points to the RLI that isrunning , or null in case connect method not being called. See Also: RLI.mRLIURL |
getRLI | public RLSClient.RLI getRLI()(Code) | | Gets a handle to the RLI that is associated with the RLS running at
url.
RLSClient.RLI that points to the RLI that isrunning , or null in case connect method not being called. See Also: RLI.mRLIURL |
getRLSLRCIgnoreURLs | protected String[] getRLSLRCIgnoreURLs(Properties properties)(Code) | | Returns the rls LRC urls to ignore for querying (requested by LIGO).
Referred to by the "pegasus.catalog.replica.lrc.ignore" property.
Parameters: properties - the properties passed in the connect method. String[] if a comma separated list supplied as the property value,else null |
getRLSLRCRestrictURLs | protected String[] getRLSLRCRestrictURLs(Properties properties)(Code) | | Returns the rls LRC urls to restrict for querying (requested by LIGO).
Referred to by the "pegasus.catalog.replica.lrc.restrict" property.
Parameters: properties - the properties passed in the connect method. String[] if a comma separated list supplied as the property value,else null |
getTimeout | public int getTimeout(Properties properties)(Code) | | It returns the timeout value in seconds after which to timeout in case of
no activity from the RLI.
Referred to by the "rli.timeout" property.
Parameters: properties - the properties passed in the connect method. the timeout value if specified else,the value specified by "rls.timeout" property, elseDEFAULT_RLI_TIMEOUT. See Also: RLI.DEFAULT_RLI_TIMEOUT |
insert | public int insert(String lfn, ReplicaCatalogEntry tuple)(Code) | | Inserts a new mapping into the LRC running at the URL, where the RLI
is running.
Parameters: lfn - is the logical filename under which to book the entry. Parameters: tuple - is the physical filename and associated PFN attributes. number of insertions, should always be 1. On failure,throws a RuntimeException. |
insert | public int insert(String lfn, String pfn, String handle)(Code) | | Inserts a new mapping into the LRC running at the URL, where the RLI
is running.
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. Parameters: pfn - is the physical filename associated with it. Parameters: handle - is a resource handle where the PFN resides. number of insertions, should always be 1. On failure,throws a RuntimeException. See Also: RLI.insert(String,ReplicaCatalogEntry) See Also: ReplicaCatalogEntry |
insert | public int insert(Map x)(Code) | | 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 replicacatalog entries. the number of insertions. See Also: ReplicaCatalogEntry |
isClosed | public boolean isClosed()(Code) | | Returns whether the connection to the RLS with which this instance is
associated is closed or not.
true, if the implementation is disassociated, false otherwise. See Also: RLI.close() |
list | public Set list()(Code) | | Lists all logical filenames in the catalog.
A set of all logical filenames known to the catalog. |
list | public Set list(String constraint)(Code) | | Lists a subset of all logical filenames in the catalog.
Parameters: constraint - is a constraint for the logical filename only. Itis a string that has some meaning to the implementing system. Thiscan be a SQL wildcard for queries, or a regular expression forJava-based memory collections. A set of logical filenames that match. The set may be empty |
lookup | public String lookup(String lfn, String handle)(Code) | | Retrieves the entry for a given filename and resource handle from
the RLS.
Parameters: lfn - is the logical filename to obtain information for. Parameters: handle - is the resource handle to obtain entries for. the (first) matching physical filename, ornull if no match was found. |
lookup | public Collection lookup(String lfn)(Code) | | 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. a collection of replica catalog entries, or null in case ofunable to connect to RLS. See Also: ReplicaCatalogEntry |
lookup | public Map lookup(Set lfns)(Code) | | Retrieves multiple entries for a given logical filename, up to the
complete LRC. It uses the bulk query api to the LRC to query for stuff.
Bulk query has been in RLS since version 2.0.8. Internally, the bulk
queries are done is sizes specified by variable mBatchSize.
Parameters: lfns - is a set of logical filename strings to look up. a map indexed by the LFN. Each value is a collectionof replica catalog entries for the LFN. See Also: ReplicaCatalogEntry See Also: RLI.getBatchSize() |
lookup | public Map lookup(Set lfns, String handle)(Code) | | Retrieves multiple entries for a given logical filenames, 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. Parameters: handle - is the resource handle, restricting the LFNs. a map indexed by the LFN. Each value is a collectionof replica catalog entries (all attributes). See Also: ReplicaCatalogEntry |
lookup | public Map lookup(Map constraints)(Code) | | 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.
At present it DOES NOT SUPPORT ATTRIBUTE MATCHING.
Parameters: constraints - is mapping of keys 'lfn', 'pfn' to a string thathas some meaning to the implementing system. This can be a SQLwildcard for queries, or a regular expression for Java-based memorycollections. Unknown keys are ignored. Using an empty map requeststhe complete catalog. a map indexed by the LFN. Each value is a collectionof replica catalog entries. See Also: ReplicaCatalogEntry |
lookupNoAttributes | public Set lookupNoAttributes(String lfn)(Code) | | 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. a set of PFN strings, or null in case of unable to connectto RLS. |
lookupNoAttributes | public Map lookupNoAttributes(Set lfns)(Code) | | 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: lfns - is a set of logical filename strings to look up. a map indexed by the LFN. Each value is a collectionof replica catalog entries for the LFN. |
lookupNoAttributes | public Map lookupNoAttributes(Set lfns, String handle)(Code) | | 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.
The noAttributes flag is missing on purpose, because
due to the resource handle, attribute lookups are already required.
Parameters: lfns - is a set of logical filename strings to look up. Parameters: handle - is the resource handle, restricting the LFNs. a map indexed by the LFN. Each value is a set ofphysical filenames. |
main | public static void main(String[] args)(Code) | | The main program, for some unit testing.
Parameters: args - String[] |
remove | public int remove(String lfn)(Code) | | Removes all mappings for an LFN from the replica catalog.
It can result in a deletion of more than one entry, and from more
than one local replica catalog that might be reporting to the RLI.
Parameters: lfn - is the logical filename to remove all mappings for. the number of removed entries. |
remove | public int remove(Set lfns)(Code) | | Removes all mappings for a set of LFNs.
It can result in a deletion of more than one entry, and from more
than one local replica catalog that might be reporting to the RLI.
Parameters: lfns - is a set of logical filename to remove all mappings for. the number of removed entries. |
removeByAttribute | public int removeByAttribute(String name, Object value)(Code) | | Removes all entries from the replica catalog where the PFN attribute
is found, and matches exactly the object value.
It can result in a deletion of more than one entry, and from more
than one local replica catalog that might be reporting to the RLI.
Parameters: name - is the PFN attribute name to look for. Parameters: value - is an exact match of the attribute value to match. the number of removed entries. |
removeByAttribute | public int removeByAttribute(String handle)(Code) | | 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.
It can result in a deletion of more than one entry, and from more
than one local replica catalog that might be reporting to the RLI.
Parameters: handle - is the site handle to remove all entries for. the number of removed entries. See Also: RLI.removeByAttribute(String,Object) |
setBatchSize | protected void setBatchSize(Properties properties)(Code) | | Sets the number of lfns in each batch while querying the lrc in the
bulk mode.
Parameters: properties - the properties passed while connecting. |
|
|