00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef SALOME_NAMINGSERVICE_H
00030 #define SALOME_NAMINGSERVICE_H
00031
00032 #include <SALOMEconfig.h>
00033 #include CORBA_CLIENT_HEADER(SALOME_ContainerManager)
00034 #include CORBA_CLIENT_HEADER(SALOME_Component)
00035
00036 #include <vector>
00037 #include <string>
00038 #include "utilities.h"
00039 #include "Utils_Mutex.hxx"
00040 #include "ServiceUnreachable.hxx"
00041
00042 #include "SALOME_NamingService_defs.hxx"
00043
00044 #ifdef WNT
00045 #pragma warning(disable:4290) // Warning Exception ...
00046 #endif
00047
00048 class NAMINGSERVICE_EXPORT SALOME_NamingService
00049 {
00050 public:
00051 SALOME_NamingService();
00052 SALOME_NamingService(CORBA::ORB_ptr orb);
00053
00054 virtual ~SALOME_NamingService();
00055
00056 void init_orb(CORBA::ORB_ptr orb=0);
00057 void Register(CORBA::Object_ptr ObjRef,
00058 const char* Path)
00059 throw(ServiceUnreachable);
00060 CORBA::Object_ptr Resolve(const char* Path)
00061 throw( ServiceUnreachable);
00062 CORBA::Object_ptr ResolveFirst(const char* Path)
00063 throw( ServiceUnreachable);
00064 CORBA::Object_ptr ResolveComponent(const char* hostname,
00065 const char* containerName,
00066 const char* componentName,
00067 const int nbproc=0)
00068 throw(ServiceUnreachable);
00069 std::string ContainerName(const char *ContainerName);
00070 std::string ContainerName(const Engines::ContainerParameters& params);
00071 std::string BuildContainerNameForNS(const char *ContainerName,
00072 const char *hostname);
00073 std::string
00074 BuildContainerNameForNS(const Engines::ContainerParameters& params,
00075 const char *hostname);
00076
00077
00078 std::string ContainerName(const Engines::MachineParameters& params);
00079 std::string
00080 BuildContainerNameForNS(const Engines::MachineParameters& params,
00081 const char *hostname);
00082 int Find(const char* name)
00083 throw(ServiceUnreachable);
00084 bool Create_Directory(const char* Path)
00085 throw(ServiceUnreachable);
00086 bool Change_Directory(const char* Path)
00087 throw(ServiceUnreachable);
00088 char* Current_Directory()
00089 throw(ServiceUnreachable);
00090 void list()
00091 throw(ServiceUnreachable);
00092 std::vector<std::string> list_directory()
00093 throw(ServiceUnreachable);
00094 std::vector<std::string> list_subdirs()
00095 throw(ServiceUnreachable);
00096 std::vector<std::string> list_directory_recurs()
00097 throw(ServiceUnreachable);
00098 void Destroy_Name(const char* Path)
00099 throw(ServiceUnreachable);
00100 virtual void Destroy_Directory(const char* Path)
00101 throw(ServiceUnreachable);
00102 virtual void Destroy_FullDirectory(const char* Path)
00103 throw(ServiceUnreachable);
00104 char* getIORaddr();
00105 CORBA::ORB_ptr orb();
00106
00107 protected:
00108 Utils_Mutex _myMutex;
00109 CORBA::ORB_var _orb;
00110 CosNaming::NamingContext_var _root_context, _current_context;
00111
00112 void _initialize_root_context();
00113 int _createContextNameDir(std::string path,
00114 CosNaming::Name& context_name,
00115 std::vector<std::string>& splitPath,
00116 bool onlyDir);
00117 void _Find(const char* name, CORBA::Long& occurence_number);
00118 void _current_directory(std::vector<std::string>& splitPath,
00119 int& lengthResult,
00120 CosNaming::NamingContext_var contextToFind,
00121 bool& notFound);
00122 void _list_directory_recurs(std::vector<std::string>& myList,
00123 std::string relativeSubDir,
00124 std::string absCurDirectory);
00125
00126 };
00127
00128 #endif // SALOME_NAMINGSERVICE_H
00129