Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

ReplicaManagerImpl.h

Go to the documentation of this file.
00001 /*
00002  *
00003  * ReplicaManagerImpl.h
00004  *
00005  * Copyright (c) 2002 INFN, CERN on behalf of the EU DataGrid.
00006  * For license conditions see LICENSE file or 
00007  * http://www.edg.org/license.html
00008  * 
00009  */
00010 
00011 #ifndef ReplicaManagerImpl_H
00012 #define ReplicaManagerImpl_H 1
00013 
00014 /*
00015  * @author <a href="mailto:Peter.Kunszt@cern.ch">Peter Kunszt</a>
00016  * @author <a href="mailto:Andrea.Domenici@iet.unipi.it">Andrea Domenici</a>
00017  */
00018 
00019 #include <string>
00020 #include <vector>
00021 
00022 #include "EdgReplicaLocationService/LocalReplicaCatalog.h"
00023 #include "EdgReplicaMetadataCatalog/ReplicaMetadataCatalog.h"
00024 #include "EdgReplicaManager/ReplicaManager.h"
00025 #include "EdgReplicaManager/InfoService.h"
00026 #include "EdgReplicaManager/Configuration.h"
00027 
00028 namespace EdgReplicaManager {
00029 
00031     class ReplicaManagerImpl : public ReplicaManager {
00032     public:
00033 
00038         ReplicaManagerImpl(const std::string& vo)  throw( ReplicaManagerException);
00039 
00040         ReplicaManagerImpl(const std::string& vo, Configuration *conf)  throw( ReplicaManagerException);
00041 
00042         ~ReplicaManagerImpl();
00043 
00045         void listReplicas(std::string fileID, SFNList_t & sfns) 
00046             throw ( ReplicaManagerException, 
00047                     EdgReplicaLocationService::NoSuchGuidException,
00048                     EdgReplicaLocationService::NoSuchPfnException,
00049                     EdgReplicaMetadataCatalog::NoSuchAliasException,
00050                     EdgReplicaMetadataCatalog::CommunicationException,
00051                     EdgReplicaLocationService::CommunicationException );
00052 
00054         void getAccessCost(LFNList_t LFNList,
00055                            CEList_t CEList,
00056                            Protocols_t protocols,
00057                            AccessCosts_t &accessCost) 
00058             throw ( ReplicaManagerException,
00059                     EdgReplicaOptimization::ReplicationException,
00060                     EdgReplicaLocationService::NoSuchGuidException,
00061                     EdgReplicaLocationService::NoSuchPfnException ,
00062                     EdgReplicaMetadataCatalog::NoSuchAliasException,
00063                     EdgReplicaMetadataCatalog::CommunicationException,
00064                     EdgReplicaLocationService::CommunicationException);
00065 
00066         std::string listBestFile(std::string file, std::string seHost) 
00067             throw ( ReplicaManagerException,
00068                     EdgReplicaOptimization::ReplicationException,
00069                     EdgReplicaLocationService::NoSuchGuidException,
00070                     EdgReplicaLocationService::NoSuchPfnException ,
00071                     EdgReplicaMetadataCatalog::NoSuchAliasException,
00072                     EdgReplicaMetadataCatalog::CommunicationException,
00073                     EdgReplicaLocationService::CommunicationException );
00074 
00075         void setSecure() {
00076             m_secure = true;
00077         }
00078 
00079     private:
00080 
00081         /* private methods */
00082 
00083         void init()  throw( ReplicaManagerException);
00084         void initInfoService(const std::string& vo)  throw( ReplicaManagerException);
00085 
00086         void initLRC() throw(InfoServiceException);
00087         void initROS() throw(InfoServiceException);
00088         void initRMC() throw(InfoServiceException);
00089 
00090         bool startsWith(const std::string, const std::string);
00091         bool isLFN(std::string file);
00092         bool isGUID(std::string file);
00093         bool isSURL(std::string file);
00094 
00095         float convert2float( const char* const numstr );
00096 
00097 
00098   std::string withGuidPrefix(std::string str);
00099   std::string stripGuidPrefix(std::string str);
00100   std::string withLfnPrefix(std::string str);
00101   std::string stripLfnPrefix(std::string str);
00102 
00103         /* private member variables */
00104 
00105         // the service endpoints
00106         std::string m_lrcURL;
00107         std::string m_rosURL;
00108         std::string m_rmcURL;
00109         std::string m_localdomain;
00110 
00111         // the service clients
00112         EdgReplicaLocationService::LocalReplicaCatalog* m_lrc;
00113         EdgReplicaMetadataCatalog::ReplicaMetadataCatalog* m_rmc;
00114         EdgReplicaOptimization::ReplicaOptimization* m_ros;
00115 
00116         // info and configuration
00117         InfoService *m_infoService;
00118         Configuration *m_config;
00119         const std::string m_vo;
00120 
00121         // helpers
00122         bool m_myconfig;
00123         bool m_fakeROS;
00124         bool m_fullRLS;
00125         bool m_secure;
00126         std::string m_edgloc;
00127 
00128     };
00129 };
00130 
00131 #endif
The EU DataGrid Project. All rights reserved.