00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef REPOSITORY_H
00017 #define REPOSITORY_H
00018
00019 #include "Server_Info.h"
00020 #include "Activator_Info.h"
00021 #include "Locator_Options.h"
00022
00023 #include "ace/Hash_Map_Manager.h"
00024 #include "ace/Configuration.h"
00025 #include "ace/Auto_Ptr.h"
00026
00027 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00028 # pragma once
00029 #endif
00030
00031
00032
00033
00034
00035
00036
00037 class Locator_Repository
00038 {
00039 public:
00040 typedef ACE_Hash_Map_Manager_Ex<ACE_CString,
00041 Server_Info_Ptr,
00042 ACE_Hash<ACE_CString>,
00043 ACE_Equal_To<ACE_CString>,
00044 ACE_Null_Mutex> SIMap;
00045
00046 typedef ACE_Hash_Map_Manager_Ex<ACE_CString,
00047 Activator_Info_Ptr,
00048 ACE_Hash<ACE_CString>,
00049 ACE_Equal_To<ACE_CString>,
00050 ACE_Null_Mutex> AIMap;
00051
00052 Locator_Repository();
00053
00054
00055 int init (const Options& opts);
00056
00057
00058 int add_server (const ACE_CString& name,
00059 const ACE_CString& aname,
00060 const ACE_CString& startup_command,
00061 const ImplementationRepository::EnvironmentList& environment_vars,
00062 const ACE_CString& working_dir,
00063 ImplementationRepository::ActivationMode activation,
00064 int start_limit,
00065 const ACE_CString& partial_ior = ACE_CString(""),
00066 const ACE_CString& ior = ACE_CString(""),
00067 ImplementationRepository::ServerObject_ptr svrobj = ImplementationRepository::ServerObject::_nil()
00068 );
00069
00070 int add_activator (const ACE_CString& name,
00071 const CORBA::Long token,
00072 const ACE_CString& ior = ACE_CString(""),
00073 ImplementationRepository::Activator_ptr act = ImplementationRepository::Activator::_nil()
00074 );
00075
00076
00077 int update_server (const Server_Info& info);
00078
00079 int update_activator (const Activator_Info& info);
00080
00081
00082 Server_Info_Ptr get_server (const ACE_CString& name);
00083
00084 Activator_Info_Ptr get_activator (const ACE_CString& name);
00085
00086 bool has_activator(const ACE_CString& name);
00087
00088
00089 int remove_server (const ACE_CString& name);
00090
00091 int remove_activator (const ACE_CString& name);
00092
00093
00094 SIMap& servers(void);
00095
00096 AIMap& activators(void);
00097
00098 const char* repo_mode();
00099
00100 private:
00101
00102 Options::RepoMode rmode_;
00103
00104 SIMap server_infos_;
00105
00106 AIMap activator_infos_;
00107
00108 ACE_Auto_Ptr<ACE_Configuration> config_;
00109
00110 ACE_CString fname_;
00111 };
00112
00113
00114 #endif