Locator_Repository.h

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 
00003 //=============================================================================
00004 /**
00005 *  @file Locator_Repository.h
00006 *
00007 *  Locator_Repository.h,v 1.4 2005/05/23 17:58:34 michel_j Exp
00008 *
00009 *  This class implements the Repository for the Implementation Repository.
00010 *
00011 *  @author Darrell Brunsch <brunsch@cs.wustl.edu>
00012 *  @author Priyanka Gontla <gontla_p@ociweb.com>
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 /* ACE_LACKS_PRAGMA_ONCE */
00030 
00031 /**
00032 * @class Locator_Repository
00033 *
00034 * @brief Database containing all ImR persistent information.
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   /// Initializes the Server Repository
00055   int init (const Options& opts);
00056 
00057   /// Add a new server to the Repository
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   /// Add a new activator to the Repository
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   /// Update the associated information.
00077   int update_server (const Server_Info& info);
00078   /// Update the associated information.
00079   int update_activator (const Activator_Info& info);
00080 
00081   /// Returns information related to startup.
00082   Server_Info_Ptr get_server (const ACE_CString& name);
00083   /// Returns information related to startup.
00084   Activator_Info_Ptr get_activator (const ACE_CString& name);
00085 
00086   bool has_activator(const ACE_CString& name);
00087 
00088   /// Removes the server from the Repository.
00089   int remove_server (const ACE_CString& name);
00090   /// Removes the activator from the Repository.
00091   int remove_activator (const ACE_CString& name);
00092 
00093   /// Returns the internal hash map containing the server information.
00094   SIMap& servers(void);
00095   /// Returns the internal hash map containing the activator information.
00096   AIMap& activators(void);
00097 
00098   const char* repo_mode();
00099 
00100 private:
00101   // Type mechanism to use for persistence.
00102   Options::RepoMode rmode_;
00103   // The in-memory list of the server information.
00104   SIMap server_infos_;
00105   // The in-memory list of the activator information.
00106   AIMap activator_infos_;
00107   // Several rmode_ values require this.
00108   ACE_Auto_Ptr<ACE_Configuration> config_;
00109   // XML requires the file name
00110   ACE_CString fname_;
00111 };
00112 
00113 
00114 #endif /* REPOSITORY_H */

Generated on Thu Nov 9 13:36:20 2006 for TAO_Implementation_Repository by doxygen 1.3.6