Commits

Anonymous committed 4a6488e

new property Folder.CheckItems. Bug 29015

Comments (0)

Files changed (5)

+2007-08-23  Paolo Calafiura  <calaf@localhost.localdomain>
+	* class SG::Folder: new property CheckItems. Set to check if 
+	item types are known to ClassIDSvc. False by default.
+	* share/SGFolder_test.txt: set Folder::CheckItems for this test
+	* tagged as SGComps-00-00-05
+
 2007-07-09  Paolo Calafiura 
 	* cmt/requirements: moved ProxyProviderSvc_test to ControlTest to 
 	remove StoreGate <-> SGComps dep loop

share/SGFolder_test.ref

 //GP: include ../share/SGFolder_test.txt                                      (0,0)
 MessageSvc.OutputLevel = 2;                                             //GP: (5,1)
 ToolSvc.MyFolder.ItemList =  [ "Foo#Bla" , "Bar#*" , "8101" , "8107#" , "Baricco#*" ] ;//GP: (6,1)
-//GP: end  ../share/SGFolder_test.txt                                         (7,1)
+ToolSvc.MyFolder.CheckItems = 1;                                        //GP: (7,1)
+//GP: end  ../share/SGFolder_test.txt                                         (8,1)
 //GP:================================================================================
 
 JobOptionsSvc        INFO Job options successfully read in from ../share/SGFolder_test.txt
 ApplicationMgr      DEBUG Getting my own properties
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
-                                                   Welcome to ApplicationMgr $Revision: 1.1.1.1 $
-                                          running on lxplus203.cern.ch on Fri Jun  1 00:43:16 2007
+                                                   Welcome to ApplicationMgr $Revision: 1.2 $
+                                          running on lxplus097.cern.ch on Fri Aug 24 00:36:31 2007
 ====================================================================================================================================
 ApplicationMgr       INFO Successfully loaded modules : 
 ApplicationMgr       INFO Application Manager Configured successfully
 ApplicationMgr       INFO Application Manager Initialized successfully
 ApplicationMgr Ready
 ToolSvc             DEBUG Service base class initialized successfully
-ToolSvc              INFO History Service not active - AlgTools not registered
-ClassIDSvc           INFO Initializing ClassIDSvc - package version CLIDComps-00-00-01
+ClassIDSvc           INFO Initializing ClassIDSvc - package version CLIDComps-00-00-02
 ClassIDSvc          DEBUG Service base class initialized successfully
-ClassIDSvc           INFO  getRegistryEntries: read 196 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 2 CLIDRegistry entries for module ALL
 ClassIDSvc           INFO ClassIDSvc Initialized successfully 
 ToolSvc.MyFolder    ERROR add: can not find type [Baricco] in clid db
 ToolSvc.MyFolder    ERROR add: can not find type [cucu] in clid db

share/SGFolder_test.txt

 // common job opts for SG unit tests
 
-// $Id: SGFolder_test.txt,v 1.1.1.1 2007-06-22 23:21:47 calaf Exp $
+// $Id: SGFolder_test.txt,v 1.2 2007-08-23 22:48:15 calaf Exp $
 
 MessageSvc.OutputLevel = 2;
 ToolSvc.MyFolder.ItemList = { "Foo#Bla", "Bar#*", "8101", "8107#", "Baricco#*"};
+ToolSvc.MyFolder.CheckItems = true;
 Folder::Folder( const std::string& type, 
 		const std::string& name,
 		const IInterface* parent) : 
-  AlgTool( type, name, parent ), m_pCLIDSvc("ClassIDSvc", name)
+  AlgTool( type, name, parent ), 
+  m_pCLIDSvc("ClassIDSvc", name),
+  m_checkItems(false)
 {
   declareProperty("ItemList", m_itemList,
 		  " list of data objects identified by a class name (or clid)#key pairs. One can use '*' as key value to add all objects of a given type to the Folder ").ignore();
   m_itemList.declareUpdateHandler(&Folder::decodeItemList, this);
+  declareProperty("CheckItems", m_checkItems, 
+		  "check if item types are known to ClassIDSvc");
 }
 
 
 
 //-----------------------------------------------------------------------------
 StatusCode Folder::initialize() {
-  return m_pCLIDSvc.retrieve();
+  return m_checkItems.value() ? m_pCLIDSvc.retrieve() : StatusCode::SUCCESS;
 }
 
 //-----------------------------------------------------------------------------
 StatusCode 
 Folder::add(const std::string& typeName, const std::string& skey) {
   CLID clid;
-  StatusCode sc(m_pCLIDSvc->getIDOfTypeName(typeName, clid));
+  StatusCode sc(m_checkItems.value() ? 
+		m_pCLIDSvc->getIDOfTypeName(typeName, clid) : 
+		StatusCode::SUCCESS);
   if (sc.isSuccess()) sc=add(clid, skey);
   else {
     MsgStream log(msgSvc(), name());
 StatusCode
 Folder::add(const CLID& clid, const std::string& skey) {
   StatusCode sc(StatusCode::FAILURE);
-  if ( m_pCLIDSvc->isIDInUse(clid) ) {
+  if ( !m_checkItems.value() || m_pCLIDSvc->isIDInUse(clid) ) {
     m_list.insert(FolderItem(clid, skey));
     sc = StatusCode::SUCCESS;
   } else if (0 != clid) {
    * @brief a run-time configurable list of data objects
    *
    * @author pcalafiura@lbl.gov - ATLAS Collaboration
-   * $Id: SGFolder.h,v 1.3 2007-06-24 04:29:40 calaf Exp $
+   * $Id: SGFolder.h,v 1.4 2007-08-23 22:48:15 calaf Exp $
    **/
 
 #include <string>
     void decodeItemList(Property&);
     void decodeItem(std::string); //FIXME
     ItemList m_list; 
+    /// property: check if item types are known to ClassIDSvc
+    BooleanProperty m_checkItems;
 
   };
 } //ns SG