00001 // $Id: EventStreamHandler.cc,v 1.8 2011/03/07 15:31:32 mommsen Exp $ 00003 00004 #include "EventFilter/StorageManager/interface/Configuration.h" 00005 #include "EventFilter/StorageManager/interface/EventFileHandler.h" 00006 #include "EventFilter/StorageManager/interface/EventStreamConfigurationInfo.h" 00007 #include "EventFilter/StorageManager/interface/EventStreamHandler.h" 00008 00009 00010 namespace stor { 00011 00012 EventStreamHandler::EventStreamHandler 00013 ( 00014 const EventStreamConfigurationInfo& streamConfig, 00015 const SharedResourcesPtr sharedResources, 00016 const DbFileHandlerPtr dbFileHandler 00017 ): 00018 StreamHandler(sharedResources, dbFileHandler), 00019 streamConfig_(streamConfig), 00020 initMsgCollection_(sharedResources->initMsgCollection_) 00021 { 00022 streamRecord_->streamName = streamLabel(); 00023 streamRecord_->fractionToDisk = fractionToDisk(); 00024 } 00025 00026 00027 StreamHandler::FileHandlerPtr 00028 EventStreamHandler::newFileHandler(const I2OChain& event) 00029 { 00030 // the INIT message is not available when the EventStreamHandler is 00031 // constructed, so we need to fetch it when we first need a new file 00032 // handler (when the first event is received, which is after the 00033 // INIT messages have been received) 00034 if (initMsgView_.get() == 0) 00035 { 00036 initMsgView_ = initMsgCollection_->getElementForOutputModule(streamConfig_.outputModuleLabel()); 00037 } 00038 00039 FilesMonitorCollection::FileRecordPtr fileRecord = getNewFileRecord(event); 00040 00041 FileHandlerPtr newFileHandler( 00042 new EventFileHandler(initMsgView_, fileRecord, dbFileHandler_, 00043 diskWritingParams_, getMaxFileSize()) 00044 ); 00045 fileHandlers_.push_back(newFileHandler); 00046 00047 return newFileHandler; 00048 } 00049 00050 } // namespace stor 00051