public class Regex extends Default
The regular expressions are assigned different rank, that determine the order in which the expressions are employed. The rank values for the regex can expressed in user properties using the property. pegasus.selector.replica.regex.rank.[value] The value is an integer value that denotes the rank of an expression with a rank value of 1 being the highest rank.
A thing to note is that before applying any regular expressions on the PFN's, the file URL's that dont match the preferred site are explicitly filtered out.
In order to use the replica selector implemented by this class,
- the property pegasus.selector.replica.selector must be set to value Regex
Modifier and Type | Class and Description |
---|---|
private class |
Regex.Rank
A Data class that allows us to compile a regex expression
and associate a rank value with it.
|
Modifier and Type | Field and Description |
---|---|
private static int |
HIGHEST_RANK_VALUE
The highest value of rank.
|
private static int |
LOWEST_RANK_VALUE
The lowest rank value
|
private static String |
mDescription
A short description of the replica selector.
|
private SortedSet |
mSortedRegexSet
The Set of regular expressions that orders the regex expressions to use
in ascending order.
|
private static String |
PROPERTY_PREFIX
The property prefix for all Regex rank property.
|
FILE_URL_SCHEME, mLogger, mProps
LOCAL_SITE_HANDLE, VERSION
Constructor and Description |
---|
Regex(PegasusProperties properties)
The overloaded constructor, that is called by load method.
|
Modifier and Type | Method and Description |
---|---|
String |
description()
Returns a short description of the replica selector.
|
private SortedSet<Regex.Rank> |
getRegexSet(Properties properties)
Returns a sorted set containing the various Patterns pre-compiled.
|
ReplicaCatalogEntry |
selectReplica(ReplicaLocation rl,
String preferredSite,
boolean allowLocalFileURLs)
This chooses a location amongst all the locations returned by the replica
location service.
|
removeFileURL, removeFileURL, selectReplicas
private static final String mDescription
private static final String PROPERTY_PREFIX
private static final int HIGHEST_RANK_VALUE
private static final int LOWEST_RANK_VALUE
private SortedSet mSortedRegexSet
public Regex(PegasusProperties properties)
properties
- the PegasusProperties
object containing all
the properties required by Pegasus.public ReplicaCatalogEntry selectReplica(ReplicaLocation rl, String preferredSite, boolean allowLocalFileURLs)
selectReplica
in interface ReplicaSelector
selectReplica
in class Default
rl
- the ReplicaLocation
object containing all
the pfn's associated with that LFN.preferredSite
- the preffered site for picking up the replicas.allowLocalFileURLs
- indicates whether Replica Selector can select a replica
on the local site / submit host.ReplicaCatalogEntry
corresponding to the location selected.org.griphyn.cPlanner.classes.ReplicaLocation
public String description()
description
in interface ReplicaSelector
description
in class Default
private SortedSet<Regex.Rank> getRegexSet(Properties properties)
properties
- with the key being an integer specifying the rank
and value as regex expression to be applied.Copyright © 2011 The University of Southern California. All Rights Reserved.