|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.edg.data.reptor.ReplicaManagerImpl
The ReplicaManager implementation.
Constructor Summary | |
ReplicaManagerImpl(Configuration config)
Create a new ReplicaManager. |
Method Summary | |
void |
addAlias(java.net.URI guidIn,
java.net.URI lfnIn)
Add an alias LFN to a known GUID. |
java.net.URI |
copyAndRegisterFile(java.net.URI source,
java.net.URI dest,
java.net.URI logicalNameIn,
java.lang.String protocol,
int nstreams)
This method performs the task of copying a file into grid-aware storage and registering the copy in the Replica Catalog as an atomic operation. |
void |
copyFile(java.net.URI source,
java.net.URI destIn,
java.lang.String protocol,
int nstreams,
boolean force)
Copies a physical file from source to
destination using the specified transport
mechanism. |
void |
deleteFile(java.net.URI file,
java.lang.String seHostIn,
boolean all,
boolean all_lfn)
Delete a file from storage and unregister it. |
org.edg.data.ros.AccessCost[] |
getAccessCost(java.net.URI[] logicalName,
java.lang.String[] ces,
java.lang.String[] protocol)
Calculates the expected cost of accessing all the files specified by logicalName from each Computing Element host specified by ceHosts. |
java.net.URI |
getBestFile(java.net.URI logicalName,
java.lang.String seHost,
java.lang.String protocol,
java.lang.String turlProtocol,
int nstreams)
Return the storage file name (SURL) of the best file in terms of network latencies. |
java.net.URI |
getTurl(java.net.URI surlIn,
java.lang.String protocol)
Retrieve the Transfer URL (TURL) for a given Storage URL (SURL), using the given protocol. |
java.net.URI |
listBestFile(java.net.URI logicalNameIn,
java.lang.String seHost)
Return the 'best' replica for a given logical file identifier. |
java.net.URI |
listBestFile(java.net.URI logicalName,
java.lang.String seHost,
java.lang.String turlProtocol)
Return the 'best' replica for a given logical file identifier. |
java.net.URI |
listGUID(java.net.URI fileIn)
Returns the GUID of the given LFN or SURL. |
java.util.List |
listReplicas(java.net.URI fileIn)
Returns the Set of all known replicas of the file name that may be an LFN, GUID or SURL. |
java.net.URI |
registerFile(java.net.URI file,
java.net.URI logicalName)
Register a file in the Replica Catalog that is already stored on a Storage Element. |
java.net.URI |
registerGUID(java.net.URI surlIn,
java.net.URI guidIn)
Register a file in the Replica Catalog with a known GUID. |
void |
removeAlias(java.net.URI guidIn,
java.net.URI lfnIn)
Remove an alias LFN from a known GUID. |
java.net.URI |
replicateFile(java.net.URI source,
java.net.URI dest,
java.lang.String protocol,
int nstreams)
This method performs the task of replicating a file between grid-aware stores and registering the replica in the Replica Catalog as an atomic operation. |
void |
unregisterFile(java.net.URI surlIn,
java.net.URI guidIn)
Unregister a file from the Replica Catalog. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ReplicaManagerImpl(Configuration config) throws ReplicaManagerException, org.edg.data.util.InvalidConfigurationException
config
- the configuration object.Method Detail |
public java.net.URI registerFile(java.net.URI file, java.net.URI logicalName) throws InvalidFileNameException, java.io.FileNotFoundException, InfoServiceException, CatalogCommunicationException, AlreadyRegisteredException, LfnExistsException, InvalidInfoException, SurlExistsException, StorageResourceException, org.edg.data.util.InvalidFileTypeException, IllegalArgumentException, org.edg.data.util.ConnectionException
ReplicaManager
srm://storage.element.host/vopath/file.name
The logical
name is optional, it may declare a logical identifier that can
be used later to look up any instance of the file. The method
returns the GUID, the Grid Unique IDentifier of the file. The
detailed semantics are:
This method does not include any data movement (i.e. the storage file is not copied) and assumes that the storage file is already located at a known Storage Element.
registerFile
in interface ReplicaManager
file
- the file. It must be a valid
Storage File Name, i.e. the host part of the given URI needs
to be a recognized Storage Element.logicalName
- the logical name to be used in the catalog
to find the file again. If this parameter is null
,
an automatic name is generated and used.
InvalidFileNameException
- if file is not valid or the SE is not found
java.io.FileNotFoundException
- if file does not exist
InfoServiceException
CatalogCommunicationException
AlreadyRegisteredException
LfnExistsException
InvalidInfoException
SurlExistsException
StorageResourceException
org.edg.data.util.InvalidFileTypeException
IllegalArgumentException
org.edg.data.util.ConnectionException
ReplicaManager.registerFile(java.net.URI, java.net.URI)
public java.net.URI registerGUID(java.net.URI surlIn, java.net.URI guidIn) throws InvalidFileNameException, java.io.FileNotFoundException, InfoServiceException, CatalogCommunicationException, SurlExistsException, InvalidInfoException, StorageResourceException, org.edg.data.util.InvalidFileTypeException, org.edg.data.util.ConnectionException
ReplicaManager
srm://storage.element.host/vopath/file.name
The GUID is the GUID that this file should be registered with
for the case if the file was copied by other means. (TruckFTP
use case). While there is only one centralized catalog, there
is no need for this method, but if the catalogs are not
centralized, this method can be used to register a file with a
known GUID. Be careful, if the GUID corresponds to a wrong file
in the remote (probably unattainable) catalogs then once the
connection is established, the distributed catalog will
inconsistent data.
This method can also be used to register a second replica in
the same LRC, usually this does not happen.
registerGUID
in interface ReplicaManager
surlIn
- the file. It must be a valid
Storage File Name, i.e. the host part of the given URI needs
to be a recognized Storage Element.guidIn
- the GUID to be used in the catalog
to find the file again.
InvalidFileNameException
- if file is not valid or the SE is not found
java.io.FileNotFoundException
- if file does not exist
InfoServiceException
CatalogCommunicationException
SurlExistsException
InvalidInfoException
StorageResourceException
org.edg.data.util.InvalidFileTypeException
org.edg.data.util.ConnectionException
ReplicaManager.registerGUID(java.net.URI, java.net.URI)
public java.net.URI getTurl(java.net.URI surlIn, java.lang.String protocol) throws InvalidFileNameException, UnknownProtocolException, InfoServiceException, InvalidInfoException, StorageResourceException, FileHandleException, org.edg.data.util.InvalidFileTypeException, java.lang.SecurityException
ReplicaManager
getTurl
in interface ReplicaManager
surlIn
- the file. It must be a valid
Storage File Name, i.e. the host part of the given URI needs
to be a recognized Storage Element.protocol
- The protocol for the TURL (either 'file', 'gsiftp'/'gridftp' or 'rfio'.
InvalidFileNameException
- if file is not valid or the SE is not found
UnknownProtocolException
InfoServiceException
InvalidInfoException
StorageResourceException
FileHandleException
org.edg.data.util.InvalidFileTypeException
java.lang.SecurityException
ReplicaManager.getTurl(java.net.URI, java.lang.String)
public void addAlias(java.net.URI guidIn, java.net.URI lfnIn) throws CatalogCommunicationException, org.edg.data.util.InvalidFileTypeException, GUIDDoesNotExistException, LfnExistsException
ReplicaManager
addAlias
in interface ReplicaManager
guidIn
- GUID to add new alias forlfnIn
- the new LFN
CatalogCommunicationException
org.edg.data.util.InvalidFileTypeException
GUIDDoesNotExistException
LfnExistsException
ReplicaManager.addAlias(java.net.URI, java.net.URI)
public void unregisterFile(java.net.URI surlIn, java.net.URI guidIn) throws InvalidFileNameException, CatalogCommunicationException, GUIDDoesNotExistException, java.io.FileNotFoundException, org.edg.data.util.InvalidFileTypeException
ReplicaManager
This method does not include any data deletion (i.e. the storage file is not removed).
unregisterFile
in interface ReplicaManager
surlIn
- the storage file to unregister. It must be a valid
Storage File Name, i.e. the host part of the given URI needs
to be a recognized Storage Element.guidIn
- the GUID
java.io.FileNotFoundException
- if file does not exist
InvalidFileNameException
- if file is not valid or the SE is not found
GUIDDoesNotExistException
- if the GUID was not found in the catalog
CatalogCommunicationException
- if there was an error in contacting the LRC
org.edg.data.util.InvalidFileTypeException
ReplicaManager.unregisterFile(java.net.URI, java.net.URI)
public void removeAlias(java.net.URI guidIn, java.net.URI lfnIn) throws CatalogCommunicationException, org.edg.data.util.InvalidFileTypeException, GUIDDoesNotExistException
ReplicaManager
removeAlias
in interface ReplicaManager
guidIn
- GUID to remove the alias fromlfnIn
- the LFN
CatalogCommunicationException
org.edg.data.util.InvalidFileTypeException
GUIDDoesNotExistException
ReplicaManager.removeAlias(java.net.URI, java.net.URI)
public void copyFile(java.net.URI source, java.net.URI destIn, java.lang.String protocol, int nstreams, boolean force) throws CatalogCommunicationException, FileHandleException, InvalidFileNameException, UnknownProtocolException, InfoServiceException, ConfigurationException, FileCopierException, LfnDoesNotExistException, org.edg.data.util.InvalidFileTypeException, java.lang.SecurityException, StorageResourceException
ReplicaManager
source
to
destination
using the specified transport
mechanism. This action does not involve any updates to the
replica catalogs as the destination cannot be a grid-aware
store, in order to avoid catalog
corruption. copyAndRegisterFile needs to be used for that
purpose, i.e. to bring a file into the grid. The destination
does not accept GUIDs, LFNs or SURLs. As said, for those cases
copyAndRegisterFile or replicateFile needs to be used.
It provides all the capability of globus-url-copy and more,
accepting also GUIDs, LFNs and SURLs as the source file. Since
the destination is not on grid-storage, the destination file
will not be registered in the catalog.
Example: To get a local copy of a grid file, the source
file can be specified as a GUID or LFN and the destination file
as a local file. The result will be that the file will be
copied 'out of the grid' to the local file. Local file URIs need
to have the 'file' scheme.
copyFile
in interface ReplicaManager
source
- the source file. source
may be one
of the following:
destIn
- the physical destination file. Must be one
of the following:
protocol
- the protocol to be used. This parameter is only
considered if the source is specified using an SURL, LFN or
GUID. If it's not set (i.e. null
), the default
protocol is used as specified in the configuration file.nstreams
- the number of streams to be used (if the
protocol supports multiple streams, otherwise this parameter
has no effect). If it's set <= 0 the default number of streams
is used as specified in the configuration file.force
- is the flag that specifies whether the destination
should be overwritten or not. If false, the destination will not
be overwritten if it exists, but an error will be thrown.
FileHandleException
- if there is a problem with source
or destination
InfoServiceException
- if the info service cannot be contacted or has an error
InvalidFileNameException
- if the source or destination file are invalid
CatalogCommunicationException
- if the RLS or RMC could not be contacted
ConfigurationException
- if there is a configuration problem
FileCopierException
- if the copy operation fails
UnknownProtocolException
LfnDoesNotExistException
org.edg.data.util.InvalidFileTypeException
java.lang.SecurityException
StorageResourceException
ReplicaManager.copyFile(java.net.URI, java.net.URI, java.lang.String, int, boolean)
public java.net.URI copyAndRegisterFile(java.net.URI source, java.net.URI dest, java.net.URI logicalNameIn, java.lang.String protocol, int nstreams) throws InvalidFileNameException, ConfigurationException, InfoServiceException, FileHandleException, FileCopierException, CatalogCommunicationException, DestinationExistsException, LfnExistsException, java.io.FileNotFoundException, StorageResourceException, org.edg.data.util.InvalidFileTypeException, org.edg.data.util.ConnectionException, java.lang.SecurityException
ReplicaManager
destination
must refer to a Storage Element just
like for replicateFile. The difference to replicateFile is that
the latter requires the source
to be a valid grid
file descriptor, i.e. either an LFN, GUID or other SURL, while
copyAndRegisterFile does explicitly forbid such sources and
accepts only non-grid files. For files already in the grid,
replicateFile should be used.
The method returns the GUID of the new entry.
copyAndRegisterFile
in interface ReplicaManager
source
- the file to be registered. It must
be accessible through this name using the specified protocol in
the URI. The source
may be:
dest
- (optional) The physical destination
file. dest
may be specified in three
different ways:
null
, the 'closest' SE is located and the file is
stored as in the previous case.
logicalNameIn
- (optional) The logical name to be used in the catalog
to find the file again. If this parameter is null
,
only the GUID is used.protocol
- (optional) The protocol to be used (can be null in which
case the default protocol for the given SE is used)nstreams
- (optional) The number of parallel streams to be used for
the copy. If zero or less than zero, the default is used.
FileCopierException
- if the copy operation fails
ConfigurationException
- if there is a configuration problem
InvalidFileNameException
- if source or destination name is not valid
DestinationExistsException
- if destination already exists
InfoServiceException
- if there is problem with the information services.
java.io.FileNotFoundException
- if source does not exist
FileHandleException
- if there is some problem with source or destination
CatalogCommunicationException
- if the catalogs to register the file cannot be contacted
LfnExistsException
- if the LFN that the file should be registered with already exists
StorageResourceException
org.edg.data.util.InvalidFileTypeException
org.edg.data.util.ConnectionException
java.lang.SecurityException
ReplicaManager.copyAndRegisterFile(java.net.URI, java.net.URI, java.net.URI, java.lang.String, int)
public java.net.URI replicateFile(java.net.URI source, java.net.URI dest, java.lang.String protocol, int nstreams) throws java.io.FileNotFoundException, InvalidFileNameException, FileHandleException, FileCopierException, InfoServiceException, ConfigurationException, CatalogCommunicationException, GUIDDoesNotExistException, InvalidInfoException, StorageResourceException, SurlDoesNotExistException, LfnDoesNotExistException, org.edg.data.util.InvalidFileTypeException, org.edg.data.util.ConnectionException, java.lang.SecurityException
ReplicaManager
source
and destination
must
refer to a Storage Element.
The method returns the GUID of the entry upon success or throws
an appropriate exception upon failure.
replicateFile
in interface ReplicaManager
source
- the file to be replicated. The source
may be:
dest
- The physical destination. dest
may be
specified in three different ways: null
, the 'closest' SE is located
and the file is replicated to it as in the previous case (if it's not
already available there). protocol
- (optional) The protocol to be used (can be null in
which case the default protocol for the given destination SE is used)nstreams
- (optional) The number of parallel streams to be used
for the copy. If zero or less than zero, the default is used.
InvalidFileNameException
- if source or destination is not
valid
FileCopierException
- if the copy operation fails.
java.io.FileNotFoundException
- if source does not exist
FileHandleException
- if there is a problem with source or
destination
GUIDDoesNotExistException
- if source is in the catalog but has no GUID -
this means the catalog is corrupted
InfoServiceException
ConfigurationException
CatalogCommunicationException
InvalidInfoException
StorageResourceException
SurlDoesNotExistException
LfnDoesNotExistException
org.edg.data.util.InvalidFileTypeException
org.edg.data.util.ConnectionException
java.lang.SecurityException
ReplicaManager.replicateFile(java.net.URI, java.net.URI, java.lang.String, int)
public void deleteFile(java.net.URI file, java.lang.String seHostIn, boolean all, boolean all_lfn) throws InfoServiceException, ConfigurationException, InvalidFileNameException, CatalogCommunicationException, GUIDDoesNotExistException, FileHandleException, SurlDoesNotExistException, LfnDoesNotExistException, org.edg.data.util.InvalidFileTypeException, java.lang.SecurityException
ReplicaManager
deleteFile
in interface ReplicaManager
file
- GUID or SURL of the file to be deleted.seHostIn
- if GUID is given, this indicates from
which SE the replica should be removed. It needn't be given for an SURL.all
- boolean flag indicating whether all available instances should
be removed (only if file is a GUID). This is best efffort.all_lfn
- boolean flag indicating whether all LFN GUID mappings should also be deleted. Has only an effect if all_available is also set.
ConfigurationException
- if there is a problem with the configuration
CatalogCommunicationException
- if there is a problem with the communication with LRC or RMC
InvalidFileNameException
- if file is not a valid SURL or GUID
FileHandleException
- if there is a problem with contacting the SE
GUIDDoesNotExistException
- if the given file is not a valid GUID or has no GUID
InfoServiceException
SurlDoesNotExistException
LfnDoesNotExistException
org.edg.data.util.InvalidFileTypeException
java.lang.SecurityException
ReplicaManager.deleteFile(java.net.URI, java.lang.String, boolean, boolean)
public java.util.List listReplicas(java.net.URI fileIn) throws CatalogCommunicationException, java.io.FileNotFoundException, InvalidFileNameException, IllegalArgumentException, GUIDDoesNotExistException, SurlDoesNotExistException, LfnDoesNotExistException, org.edg.data.util.InvalidFileTypeException
ReplicaManager
listReplicas
in interface ReplicaManager
fileIn
- LFN, GUID or SURL of the file to get
CatalogCommunicationException
java.io.FileNotFoundException
InvalidFileNameException
IllegalArgumentException
GUIDDoesNotExistException
SurlDoesNotExistException
LfnDoesNotExistException
org.edg.data.util.InvalidFileTypeException
ReplicaManager.listReplicas(java.net.URI)
public java.net.URI listGUID(java.net.URI fileIn) throws InvalidFileNameException, CatalogCommunicationException, java.io.FileNotFoundException, GUIDDoesNotExistException, IllegalArgumentException, SurlDoesNotExistException, LfnDoesNotExistException, org.edg.data.util.InvalidFileTypeException
ReplicaManager
listGUID
in interface ReplicaManager
fileIn
- LFN or SURL of the file to get the GUID of.
InvalidFileNameException
CatalogCommunicationException
java.io.FileNotFoundException
GUIDDoesNotExistException
IllegalArgumentException
SurlDoesNotExistException
LfnDoesNotExistException
org.edg.data.util.InvalidFileTypeException
ReplicaManager.listGUID(java.net.URI)
public java.net.URI listBestFile(java.net.URI logicalName, java.lang.String seHost, java.lang.String turlProtocol) throws InfoServiceException, ConfigurationException, CatalogCommunicationException, InvalidFileNameException, InvalidInfoException, FileHandleException, StorageResourceException, java.io.FileNotFoundException, org.edg.data.util.InvalidFileTypeException, IllegalArgumentException, LfnDoesNotExistException
ReplicaManager
listBestFile
in interface ReplicaManager
logicalName
- logical file name or GUID of the file to get
the cheapest replica of.seHost
- the reference Storage Element. If this is null,
the default SE will be taken.turlProtocol
- The protocol that the TURL will be returned as.
InfoServiceException
ConfigurationException
CatalogCommunicationException
InvalidFileNameException
InvalidInfoException
FileHandleException
StorageResourceException
java.io.FileNotFoundException
org.edg.data.util.InvalidFileTypeException
IllegalArgumentException
LfnDoesNotExistException
ReplicaManager.listBestFile(java.net.URI, java.lang.String)
public java.net.URI listBestFile(java.net.URI logicalNameIn, java.lang.String seHost) throws InfoServiceException, ConfigurationException, CatalogCommunicationException, InvalidFileNameException, IllegalArgumentException, LfnDoesNotExistException, org.edg.data.util.InvalidFileTypeException
ReplicaManager
listBestFile
in interface ReplicaManager
logicalNameIn
- logical file name or GUID of the file to get
the cheapest replica of.seHost
- the reference Storage Element. If this is null,
the default SE will be taken.
InfoServiceException
ConfigurationException
CatalogCommunicationException
InvalidFileNameException
IllegalArgumentException
LfnDoesNotExistException
org.edg.data.util.InvalidFileTypeException
ReplicaManager.listBestFile(java.net.URI, java.lang.String)
public org.edg.data.ros.AccessCost[] getAccessCost(java.net.URI[] logicalName, java.lang.String[] ces, java.lang.String[] protocol) throws InvalidFileNameException, InfoServiceException, CatalogCommunicationException, OptorException, IllegalArgumentException, LfnDoesNotExistException, org.edg.data.util.InvalidFileTypeException
ReplicaManager
getAccessCost
in interface ReplicaManager
logicalName
- the array of LFNs or GUIDs.ces
- the array of ComputingElement hosts.protocol
- the array of transport protocols to be used.
AccessCost
array in same order as
ce
array
InfoServiceException
- if there has been a communication problem with an info service
OptorException
- if there has been a problem with the ROS call
CatalogCommunicationException
- if the LRC, RMC or ROS could not be contacted
InvalidFileNameException
- if one of the logicalNames is not an lfn.
IllegalArgumentException
LfnDoesNotExistException
org.edg.data.util.InvalidFileTypeException
ReplicaManager.getAccessCost(java.net.URI[], java.lang.String[], java.lang.String[])
public java.net.URI getBestFile(java.net.URI logicalName, java.lang.String seHost, java.lang.String protocol, java.lang.String turlProtocol, int nstreams) throws InvalidFileNameException, InfoServiceException, ConfigurationException, CatalogCommunicationException, InvalidInfoException, FileHandleException, FileCopierException, StorageResourceException, LfnDoesNotExistException, org.edg.data.util.InvalidFileTypeException, org.edg.data.util.ConnectionException
ReplicaManager
getBestFile
in interface ReplicaManager
logicalName
- the LFN or GUID of the file to find the best replica of.seHost
- destination StorageElement.protocol
- The protocol that will be used to replicate the fileturlProtocol
- The protocol that the TURL will be returned as.
InvalidFileNameException
InfoServiceException
ConfigurationException
CatalogCommunicationException
InvalidInfoException
FileHandleException
FileCopierException
StorageResourceException
LfnDoesNotExistException
org.edg.data.util.InvalidFileTypeException
org.edg.data.util.ConnectionException
ReplicaManager.getBestFile(java.net.URI, java.lang.String, java.lang.String, java.lang.String, int)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |