UniSet
1.4.0
|
00001 /* This file is part of the UniSet project 00002 * Copyright (c) 2002 Free Software Foundation, Inc. 00003 * Copyright (c) 2002 Pavel Vainerman 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00018 */ 00019 // -------------------------------------------------------------------------- 00024 // -------------------------------------------------------------------------- 00025 #ifndef ObjectRepository_H_ 00026 #define ObjectRepository_H_ 00027 // -------------------------------------------------------------------------- 00028 #include <omniORB4/CORBA.h> 00029 #include <omniORB4/Naming.hh> 00030 #include <string> 00031 #include "UniSetTypes.h" 00032 #include "Exceptions.h" 00033 #include "Configuration.h" 00034 // ----------------------------------------------------------------------------------------- 00035 //namespase ORepository 00036 //{ 00037 00045 class ObjectRepository 00046 { 00047 public: 00048 00049 ObjectRepository(UniSetTypes::Configuration* conf); 00050 ~ObjectRepository(); 00051 00055 00056 void registration(const std::string& name, const UniSetTypes::ObjectPtr oRef, const std::string& section, bool force=false) 00057 throw(UniSetTypes::ORepFailed, UniSetTypes::ObjectNameAlready, UniSetTypes::InvalidObjectName, UniSetTypes::NameNotFound); 00058 00060 void registration(const std::string& fullName, const UniSetTypes::ObjectPtr oRef, bool force=false) 00061 throw(UniSetTypes::ORepFailed, UniSetTypes::ObjectNameAlready,UniSetTypes::InvalidObjectName, UniSetTypes::NameNotFound); 00062 00064 void unregistration(const std::string& name, const std::string& section)throw(UniSetTypes::ORepFailed, UniSetTypes::NameNotFound); 00066 void unregistration(const std::string& fullName)throw(UniSetTypes::ORepFailed, UniSetTypes::NameNotFound); 00067 // @} 00068 // end of ORepGroup 00069 00071 UniSetTypes::ObjectPtr resolve(const std::string& name, const std::string NSName="NameService")throw(UniSetTypes::ORepFailed, UniSetTypes::NameNotFound); 00072 00073 // Функции не со строковыми именами, а с идентификаторами 00074 // void setListId( ListObjectId *lst ); 00075 00077 bool isExist( UniSetTypes::ObjectPtr oref ); 00079 bool isExist( const std::string& fullName ); 00080 00081 00088 enum ObjectType{ 00089 ObjectRef, 00090 Section 00091 }; 00092 00094 bool list(const std::string& section, UniSetTypes::ListObjectName *ls, unsigned int how_many=300)throw(UniSetTypes::ORepFailed); 00095 00097 bool listSections(const std::string& in_section, UniSetTypes::ListObjectName *ls, unsigned int how_many=300)throw(UniSetTypes::ORepFailed); 00098 // bool list_at(unsigned int start_pos, const char* section, ListObjectName *ls, unsigned int how_many=300)throw(ORepFailed); 00099 00100 // @} 00101 // end of ORepServiceGroup 00102 00103 protected: 00104 00105 ObjectRepository(); 00106 std::string nsName; 00107 UniSetTypes::Configuration* uconf; 00108 00109 bool list(const std::string& section, UniSetTypes::ListObjectName *ls, unsigned int how_many, ObjectType type); 00110 00111 private: 00112 bool init(); 00113 CosNaming::NamingContext_var localctx; 00114 }; 00115 00116 //}; 00117 // ----------------------------------------------------------------------------------------- 00118 #endif 00119 // -----------------------------------------------------------------------------------------