250 std::string dsn = dataset;
253 if ( ::strncasecmp(dsn.c_str(),
"FID:",4)==0 )
254 dsn = dataset.substr(4), typ = FID;
255 else if ( ::strncasecmp(dsn.c_str(),
"LFN:",4)==0 )
256 dsn = dataset.substr(4), typ = LFN;
257 else if ( ::strncasecmp(dsn.c_str(),
"PFN:",4)==0 )
258 dsn = dataset.substr(4), typ = PFN;
262 if(std::find(s_badFiles.begin(),s_badFiles.end(),dsn) != s_badFiles.end()) {
271 if ( files.empty() ) {
275 error(
"connectDataIO> failed to resolve FID:"+dsn,
false).
ignore();
278 else if ( dsn.length() == 36 && dsn[8]==
'-' && dsn[13]==
'-' ) {
279 std::string gfal_name =
"gfal:guid:" + dsn;
282 if (
sc.isSuccess() )
return sc;
287 error(
"connectDataIO> Failed to resolve FID:"+dsn,
false).
ignore();
292 auto appmgr = serviceLocator()->as<
IProperty>();
294 for(
auto i=files.cbegin();
i!=files.cend(); ++
i) {
295 std::string pfn =
i->first;
296 if (
i != files.cbegin() ) {
298 <<
" with next entry in data federation:" << pfn <<
"." <<
endmsg;
301 if ( !
sc.isSuccess() ) {
313 <<
" Federated file could not be resolved from "
314 << files.size() <<
" entries." <<
endmsg;
329 <<
" Cannot access this dataset." <<
endmsg;
335 if ( !fid.empty() )
m_catalog->getPFN(fid, files);
336 if ( files.empty() ) {
338 if ( fid.empty() ) fid =
m_catalog->createFID();
339 m_catalog->registerPFN(fid,dsn,technology);
341 <<
" by its file ID:" << fid <<
endmsg;
359 auto e =
new Entry(technology, keep_open, rw,
connection);
365 error(
"connectDataIO> Cannot connect to database: PFN="+dsn+
" FID="+fid,
false).
ignore();
373 <<
" by its physical name." <<
endmsg;
374 log <<
"You may not be able to navigate back to the input file"
375 <<
" -- processing continues" <<
endmsg;
385 error(
"connectDataIO> Cannot connect to database: PFN="+dsn+
" FID="+fid,
false).
ignore();
392 s_badFiles.insert(fid);
394 else if ( typ == LFN ) {
399 catch (std::exception& e) {
400 error(std::string(
"connectDataIO> Caught exception:")+e.what(),
false).ignore();
403 error(std::string(
"connectDataIO> Caught unknown exception"),
false).
ignore();
406 error(
"connectDataIO> The dataset "+dsn+
" cannot be opened.",
false).
ignore();
407 s_badFiles.insert(dsn);
int getAppReturnCode(const SmartIF< IProperty > &appmgr)
Get the application (current) return code.
Definition of the MsgStream class used to transmit messages.
bool m_useGFAL
Property: Flag for auto gfal data access.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
bool isSuccess() const
Test for a status code of SUCCESS.
std::vector< NamedItem > Files
SmartIF< IIncidentSvc > m_incSvc
StatusCode error(CSTR msg, bool rethrow)
Small routine to issue exceptions.
bool m_disablePFNWarning
Property DisablePFNWarning: if set to True will not report when a file is opened by it's physical nam...
Connection * connection(const std::string &dsn) const override
Retrieve known connection.
virtual void fireIncident(const Incident &incident)=0
Fire an Incident.
This class is used for returning status codes from appropriate routines.
SmartIF< IFileCatalog > m_catalog
Reference to file catalog.
StatusCode setAppReturnCode(SmartIF< IProperty > &appmgr, int value, bool force=false)
Set the application return code.
bool m_quarantine
Property: Flag if unaccessible files should be quarantines in job.
ConnectionMap m_connectionMap
Map with I/O descriptors.
Base class for all Incidents (computing events).
StatusCode connectDataIO(int typ, IoType rw, CSTR fn, CSTR technology, bool keep, Connection *con)
The IProperty is the basic interface for all components which have properties that can be set or get...
StatusCode reconnect(Entry *e)
FidMap m_fidMap
Map of FID to PFN.