Class Replica
- java.lang.Object
-
- edu.isi.pegasus.planner.transfer.mapper.impl.Replica
-
- All Implemented Interfaces:
OutputMapper
public class Replica extends java.lang.Object implements OutputMapper
This class connects to a Replica Catalog backend to determine where an output file should be placed on the output site. At present the location on the output site returned is the first matching entry in the Replica Catalog. By default, if no replica catalog backend is specified, the RC defaults to Regex replica catalog backend. To use this mapper, user needs to set the following propertiespegasus.dir.storage.mapper Replica pegasus.dir.storage.mapper.replica
pegasus.dir.storage.mapper.replica.file the RC file at the backend to use, \ if using a file based RC - Author:
- Karan Vahi
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
DEFAULT_REPLICA_BACKEND
The default replica catalog backend.private static java.lang.String
DESCRIPTION
Short description.protected LogManager
mLogger
The handle to the logger.protected java.lang.String
mOutputSite
The output site where the data needs to be placed.protected ReplicaCatalog
mRCCatalog
protected SiteStore
mSiteStore
Handle to the Site Catalog contents.static java.lang.String
PROPERTY_PREFIX
The prefix for the property subset for connecting to the individual catalogs.static java.lang.String
READ_ONLY_KEY
The name of the key that disables writing back to the cache file.private static java.lang.String
SHORT_NAME
The short name for this backend.-
Fields inherited from interface edu.isi.pegasus.planner.transfer.mapper.OutputMapper
VERSION
-
-
Constructor Summary
Constructors Constructor Description Replica()
The default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
description()
Returns a short description of the mapper.protected java.lang.String
getErrorMessagePrefix()
Returns the prefix message to be attached to an error messageprivate java.lang.String
getShortName()
void
initialize(PegasusBag bag, ADag workflow)
Initializes the mappers.java.lang.String
map(java.lang.String lfn, java.lang.String site, FileServerType.OPERATION operation)
Maps a LFN to a location on the filsystem of a site and returns a single externally accessible URL corresponding to that location.java.lang.String
map(java.lang.String lfn, java.lang.String site, FileServerType.OPERATION operation, boolean existing)
Maps a LFN to a location on the filsystem of a site and returns a single externally accessible URL corresponding to that location.java.util.List<java.lang.String>
mapAll(java.lang.String lfn, java.lang.String site, FileServerType.OPERATION operation)
Maps a LFN to a location on the filsystem of a site and returns all the possible equivalent externally accessible URL corresponding to that location.
-
-
-
Field Detail
-
PROPERTY_PREFIX
public static final java.lang.String PROPERTY_PREFIX
The prefix for the property subset for connecting to the individual catalogs.- See Also:
- Constant Field Values
-
DESCRIPTION
private static final java.lang.String DESCRIPTION
Short description.- See Also:
- Constant Field Values
-
READ_ONLY_KEY
public static final java.lang.String READ_ONLY_KEY
The name of the key that disables writing back to the cache file. Designates a static file. i.e. read only- See Also:
- Constant Field Values
-
SHORT_NAME
private static final java.lang.String SHORT_NAME
The short name for this backend.- See Also:
- Constant Field Values
-
DEFAULT_REPLICA_BACKEND
private java.lang.String DEFAULT_REPLICA_BACKEND
The default replica catalog backend.
-
mLogger
protected LogManager mLogger
The handle to the logger.
-
mSiteStore
protected SiteStore mSiteStore
Handle to the Site Catalog contents.
-
mOutputSite
protected java.lang.String mOutputSite
The output site where the data needs to be placed.
-
mRCCatalog
protected ReplicaCatalog mRCCatalog
-
-
Method Detail
-
initialize
public void initialize(PegasusBag bag, ADag workflow) throws MapperException
Initializes the mappers.- Specified by:
initialize
in interfaceOutputMapper
- Parameters:
bag
- the bag of objects that is useful for initialization.workflow
- the workflow refined so far.- Throws:
MapperException
- if unable to construct URL for any reason
-
map
public java.lang.String map(java.lang.String lfn, java.lang.String site, FileServerType.OPERATION operation) throws MapperException
Maps a LFN to a location on the filsystem of a site and returns a single externally accessible URL corresponding to that location. It queries the underlying Replica Catalog and returns the first matching PFN.- Specified by:
map
in interfaceOutputMapper
- Parameters:
lfn
- the lfnsite
- the output siteoperation
- whether we want a GET or a PUT URL- Returns:
- the URL to file that was mapped
- Throws:
MapperException
- if unable to construct URL for any reason
-
map
public java.lang.String map(java.lang.String lfn, java.lang.String site, FileServerType.OPERATION operation, boolean existing) throws MapperException
Maps a LFN to a location on the filsystem of a site and returns a single externally accessible URL corresponding to that location. It queries the underlying Replica Catalog and returns the first matching PFN.- Specified by:
map
in interfaceOutputMapper
- Parameters:
lfn
- the lfnsite
- the output siteoperation
- whether we want a GET or a PUT URLexisting
- indicates whether to create a new location/placement for a file, or rely on existing placement on the site.- Returns:
- externally accessible URL to the mapped file.
- Throws:
MapperException
- if unable to construct URL for any reason
-
mapAll
public java.util.List<java.lang.String> mapAll(java.lang.String lfn, java.lang.String site, FileServerType.OPERATION operation) throws MapperException
Maps a LFN to a location on the filsystem of a site and returns all the possible equivalent externally accessible URL corresponding to that location. In case of the replica backed only one URL is returned and that is the first matching PFN for the output site.- Specified by:
mapAll
in interfaceOutputMapper
- Parameters:
lfn
- the lfnsite
- the output siteoperation
- whether we want a GET or a PUT URL- Returns:
- List
of externally accessible URLs to the mapped file. - Throws:
MapperException
- if unable to construct URL for any reason
-
getErrorMessagePrefix
protected java.lang.String getErrorMessagePrefix()
Returns the prefix message to be attached to an error message- Returns:
-
getShortName
private java.lang.String getShortName()
-
description
public java.lang.String description()
Returns a short description of the mapper.- Specified by:
description
in interfaceOutputMapper
- Returns:
-
-