edu.isi.pegasus.planner.catalog.replica.impl
public class RLI extends Object implements ReplicaCatalog
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_RLI_TIMEOUT
The default timeout in seconds to be used while querying the RLI.
|
static String |
LRC_IGNORE_KEY
The key that is used to designate the LRC whose results are to be
ignored.
|
static String |
LRC_NOT_CONNECTED_MSG
The error message for not connected to LRC.
|
static int |
LRC_QUERY_IGNORE
The LRC query state indicating that LRC has to be ignored.
|
static int |
LRC_QUERY_NORMAL
The LRC query state indicating that LRC needs to queried fully.
|
static int |
LRC_QUERY_RESTRICT
The LRC query state indicating that LRC has to be restricted query.
|
static String |
LRC_RESTRICT_KEY
The key that is used to designate the LRC whose results are to be
restricted.
|
private int |
mBatchSize
The batch size while querying the RLI in the bulk mode.
|
private Properties |
mConnectProps
The properties object containing all the properties, that are required
to connect to a RLS.
|
private LogManager |
mLogger
The handle to the logging object.
|
private String |
mLogMsg
The string holding the message that is logged in the logger.
|
private String[] |
mLRCIgnoreList
A String array contains the LRC URLs that have to be ignored for querying.
|
private String[] |
mLRCRestrictList
A String array contains the LRC URLs that have to be restricted for querying.
|
private org.globus.replica.rls.RLSClient.RLI |
mRLI
The handle to the client that allows access to the LRC running at the
url specified while connecting.
|
private String |
mRLIURL
The url to the RLI to which this instance implementation talks to.
|
private org.globus.replica.rls.RLSClient |
mRLS
The handle to the client that allows access to both the RLI and the LRC
running at the url specified while connecting.
|
private int |
mTimeout
The timeout in seconds to be applied while querying the RLI.
|
static String |
PROXY_KEY
The key that if set, specifies the proxy to be picked up while connecting
to the RLS.
|
static String |
RLI_NOT_CONNECTED_MSG
The error message for not connected to RLI.
|
static String |
RLI_TIMEOUT_KEY
The key that is used to get hold of the timeout value from the properties
object.
|
static int |
RLS_BULK_QUERY_SIZE
The number of entries searched in each bulk query to RLS.
|
static String |
RLS_TIMEOUT_KEY
The key that is used to get hold of the timeout value from the properties
object.
|
static String |
SITE_ATTRIBUTE
The attribute in RLS that maps to a site handle.
|
static String |
URL_KEY
The key that is used to get hold of the url from the properties object.
|
BATCH_KEY, c_prefix, DB_PREFIXDB_ALL_PREFIX| Constructor and Description |
|---|
RLI()
The default constructor, that creates an object which is not linked with
any RLS.
|
| Modifier and Type | Method and Description |
|---|---|
int |
clear()
Removes everything from all the LRCs that report to this RLI.
|
void |
close()
Explicitely free resources before the garbage collection hits.
|
boolean |
connect(Properties props)
Establishes a connection to the RLI.
|
boolean |
connect(String url)
Establishes a connection to the RLI, picking up the proxy from the default
location usually /tmp/ directory.
|
boolean |
connect(String url,
String proxy)
Establishes a connection to the RLI.
|
int |
delete(Map x,
boolean matchAttributes)
Deletes multiple mappings into the replica catalog.
|
int |
delete(String lfn,
ReplicaCatalogEntry tuple)
Deletes a very specific mapping from the replica catalog.
|
int |
delete(String lfn,
String pfn)
Deletes a specific mapping from the replica catalog.
|
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.
|
int |
deleteByResource(String lfn,
String handle)
Deletes all PFN entries for a given LFN from the replica catalog
where the resource handle is found.
|
private int |
determineQueryType(String url)
Returns a tri state indicating what type of query needs to be done to
a particular LRC.
|
protected int |
getBatchSize()
Returns the number of lfns in each batch while querying the lrc in the
bulk mode.
|
org.globus.replica.rls.RLSClient.LRC |
getLRC()
Gets a handle to the LRC that is associated with the RLS running at
url.
|
private Map |
getLRC2LFNS(Set lfns)
Returns a map indexed by lrc urls.
|
private Set |
getReportingLRC()
Retrieves the URLs of all the LRCs that report to the RLI.
|
org.globus.replica.rls.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).
|
protected String[] |
getRLSLRCRestrictURLs(Properties properties)
Returns the rls LRC urls to restrict for querying (requested by LIGO).
|
int |
getTimeout(Properties properties)
It returns the timeout value in seconds after which to timeout in case of
no activity from the RLI.
|
int |
insert(Map x)
Inserts multiple mappings into the replica catalog.
|
int |
insert(String lfn,
ReplicaCatalogEntry tuple)
Inserts a new mapping into the LRC running at the URL, where the RLI
is running.
|
int |
insert(String lfn,
String pfn,
String handle)
Inserts a new mapping into the LRC running at the URL, where the RLI
is running.
|
boolean |
isClosed()
Returns whether the connection to the RLS with which this instance is
associated is closed or not.
|
Set |
list()
Lists all logical filenames in the catalog.
|
Set |
list(String constraint)
Lists a subset of all logical filenames in the catalog.
|
Map |
lookup(Map constraints)
Retrieves multiple entries for a given logical filename, up to the
complete catalog.
|
Map |
lookup(Set lfns)
Retrieves multiple entries for a given logical filename, up to the
complete LRC.
|
Map |
lookup(Set lfns,
String handle)
Retrieves multiple entries for a given logical filenames, up to the
complete catalog.
|
Collection |
lookup(String lfn)
Retrieves all entries for a given LFN from the replica catalog.
|
String |
lookup(String lfn,
String handle)
Retrieves the entry for a given filename and resource handle from
the RLS.
|
Map |
lookupNoAttributes(Set lfns)
Retrieves all entries for a given LFN from the replica catalog.
|
Map |
lookupNoAttributes(Set lfns,
String handle)
Retrieves multiple entries for a given logical filename, up to the
complete catalog.
|
Set |
lookupNoAttributes(String lfn)
Retrieves all entries for a given LFN from the replica catalog.
|
static void |
main(String[] args)
The main program, for some unit testing.
|
int |
remove(Set lfns)
Removes all mappings for a set of LFNs.
|
int |
remove(String lfn)
Removes all mappings for an LFN from the replica catalog.
|
int |
removeByAttribute(String handle)
Removes all entries associated with a particular resource handle.
|
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.
|
protected void |
setBatchSize(Properties properties)
Sets the number of lfns in each batch while querying the lrc in the
bulk mode.
|
public static final int RLS_BULK_QUERY_SIZE
public static final String DEFAULT_RLI_TIMEOUT
public static final String RLS_TIMEOUT_KEY
public static final String RLI_TIMEOUT_KEY
public static final String LRC_IGNORE_KEY
public static final String LRC_RESTRICT_KEY
public static final String SITE_ATTRIBUTE
public static final String URL_KEY
public static final String PROXY_KEY
public static final String RLI_NOT_CONNECTED_MSG
public static final String LRC_NOT_CONNECTED_MSG
public static final int LRC_QUERY_NORMAL
public static final int LRC_QUERY_RESTRICT
public static final int LRC_QUERY_IGNORE
private org.globus.replica.rls.RLSClient mRLS
private org.globus.replica.rls.RLSClient.RLI mRLI
private String mRLIURL
private String[] mLRCIgnoreList
private String[] mLRCRestrictList
private LogManager mLogger
private String mLogMsg
private Properties mConnectProps
private int mBatchSize
private int mTimeout
public RLI()
connect(Properties).public boolean connect(String url)
url - the url to lrc to connect to.public boolean connect(Properties props)
public boolean connect(String url, String proxy)
url - the url to lrc to connect to.proxy - the path to the proxy file to be picked up. null denotes
default location.public org.globus.replica.rls.RLSClient.RLI getRLI()
RLSClient.RLI that points to the RLI that is
running , or null in case connect method not being called.mRLIURLpublic org.globus.replica.rls.RLSClient.LRC getLRC()
RLSClient.LRC that points to the RLI that is
running , or null in case connect method not being called.mRLIURLpublic String lookup(String lfn, String handle)
lookup in interface ReplicaCataloglfn - is the logical filename to obtain information for.handle - is the resource handle to obtain entries for.null if no match was found.public Collection lookup(String lfn)
lookup in interface ReplicaCataloglfn - is the logical filename to obtain information for.ReplicaCatalogEntrypublic Set lookupNoAttributes(String lfn)
lookupNoAttributes in interface ReplicaCataloglfn - is the logical filename to obtain information for.public Map lookup(Set lfns)
lookup in interface ReplicaCataloglfns - is a set of logical filename strings to look up.ReplicaCatalogEntry,
getBatchSize()public Map lookupNoAttributes(Set lfns)
lookupNoAttributes in interface ReplicaCataloglfns - is a set of logical filename strings to look up.public Map lookup(Set lfns, String handle)
lookup in interface ReplicaCataloglfns - is a set of logical filename strings to look up.handle - is the resource handle, restricting the LFNs.ReplicaCatalogEntrypublic Map lookupNoAttributes(Set lfns, String handle)
The noAttributes flag is missing on purpose, because
due to the resource handle, attribute lookups are already required.
lookupNoAttributes in interface ReplicaCataloglfns - is a set of logical filename strings to look up.handle - is the resource handle, restricting the LFNs.public Map lookup(Map constraints)
At present it DOES NOT SUPPORT ATTRIBUTE MATCHING.
lookup in interface ReplicaCatalogconstraints - is mapping of keys 'lfn', 'pfn' 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.ReplicaCatalogEntrypublic Set list()
list in interface ReplicaCatalogpublic Set list(String constraint)
list in interface ReplicaCatalogconstraint - 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 int insert(String lfn, ReplicaCatalogEntry tuple)
insert in interface ReplicaCataloglfn - is the logical filename under which to book the entry.tuple - is the physical filename and associated PFN attributes.public int insert(String lfn, String pfn, String handle)
ReplicaCatalogEntry element will be contructed, and passed to
the appropriate insert function.insert in interface ReplicaCataloglfn - 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.insert( String, ReplicaCatalogEntry ),
ReplicaCatalogEntrypublic int insert(Map x)
insert in interface ReplicaCatalogx - is a map from logical filename string to list of replica
catalog entries.ReplicaCatalogEntrypublic int delete(String lfn, String pfn)
delete in interface ReplicaCataloglfn - is the logical filename in the tuple.pfn - is the physical filename in the tuple.public int delete(String lfn, ReplicaCatalogEntry tuple)
delete in interface ReplicaCataloglfn - is the logical filename in the tuple.tuple - is a description of the PFN and its attributes.public int delete(String lfn, String name, Object value)
delete in interface ReplicaCataloglfn - 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 deleteByResource(String lfn, String handle)
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.
deleteByResource in interface ReplicaCataloglfn - is the logical filename to look for.handle - is the resource handlepublic int delete(Map x, boolean matchAttributes)
delete in interface ReplicaCatalogx - is a map from logical filename string to list of
replica catalog entries.matchAttributes - whether mapping should be deleted only if all
attributes match.ReplicaCatalogEntrypublic int remove(String lfn)
remove in interface ReplicaCataloglfn - is the logical filename to remove all mappings for.public int remove(Set lfns)
remove in interface ReplicaCataloglfns - is a set of logical filename to remove all mappings for.public int removeByAttribute(String name, Object value)
removeByAttribute in interface ReplicaCatalogname - is the PFN attribute name to look for.value - is an exact match of the attribute value to match.public int removeByAttribute(String handle)
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.removeByAttribute in interface ReplicaCataloghandle - is the site handle to remove all entries for.removeByAttribute( String, Object )public int clear()
clear in interface ReplicaCatalogpublic void close()
public boolean isClosed()
public int getTimeout(Properties properties)
properties - the properties passed in the connect method.DEFAULT_RLI_TIMEOUTprotected void setBatchSize(Properties properties)
properties - the properties passed while connecting.protected int getBatchSize()
private Map getLRC2LFNS(Set lfns)
lfns - the set of lfns queried to the RLI.private int determineQueryType(String url)
url - the LRC url.protected String[] getRLSLRCIgnoreURLs(Properties properties)
properties - the properties passed in the connect method.protected String[] getRLSLRCRestrictURLs(Properties properties)
properties - the properties passed in the connect method.private Set getReportingLRC()
public static void main(String[] args)
args - String[]