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 #ifndef SALOME_NAMINGSERVICE_H
00029 #define SALOME_NAMINGSERVICE_H
00030
00031 #include <SALOMEconfig.h>
00032 #include CORBA_CLIENT_HEADER(SALOME_ContainerManager)
00033 #include CORBA_CLIENT_HEADER(SALOME_Component)
00034
00035 #include <vector>
00036 #include <string>
00037 #include "utilities.h"
00038 #include "Utils_Mutex.hxx"
00039 #include "ServiceUnreachable.hxx"
00040
00041 #include "SALOME_NamingService_defs.hxx"
00042
00043 class NAMINGSERVICE_EXPORT SALOME_NamingService
00044 {
00045 public:
00046 SALOME_NamingService();
00047 SALOME_NamingService(CORBA::ORB_ptr orb);
00048
00049 virtual ~SALOME_NamingService();
00050
00051 void init_orb(CORBA::ORB_ptr orb=0);
00052 void Register(CORBA::Object_ptr ObjRef,
00053 const char* Path)
00054 throw(ServiceUnreachable);
00055 CORBA::Object_ptr Resolve(const char* Path)
00056 throw( ServiceUnreachable);
00057 CORBA::Object_ptr ResolveFirst(const char* Path)
00058 throw( ServiceUnreachable);
00059 CORBA::Object_ptr ResolveComponent(const char* hostname,
00060 const char* containerName,
00061 const char* componentName,
00062 const int nbproc=0)
00063 throw(ServiceUnreachable);
00064 std::string ContainerName(const char *ContainerName);
00065 std::string ContainerName(const Engines::MachineParameters& params);
00066 std::string BuildContainerNameForNS(const char *ContainerName,
00067 const char *hostname);
00068 std::string
00069 BuildContainerNameForNS(const Engines::MachineParameters& params,
00070 const char *hostname);
00071 int Find(const char* name)
00072 throw(ServiceUnreachable);
00073 bool Create_Directory(const char* Path)
00074 throw(ServiceUnreachable);
00075 bool Change_Directory(const char* Path)
00076 throw(ServiceUnreachable);
00077 char* Current_Directory()
00078 throw(ServiceUnreachable);
00079 void list()
00080 throw(ServiceUnreachable);
00081 std::vector<std::string> list_directory()
00082 throw(ServiceUnreachable);
00083 std::vector<std::string> list_subdirs()
00084 throw(ServiceUnreachable);
00085 std::vector<std::string> list_directory_recurs()
00086 throw(ServiceUnreachable);
00087 void Destroy_Name(const char* Path)
00088 throw(ServiceUnreachable);
00089 virtual void Destroy_Directory(const char* Path)
00090 throw(ServiceUnreachable);
00091 virtual void Destroy_FullDirectory(const char* Path)
00092 throw(ServiceUnreachable);
00093 char* getIORaddr();
00094 CORBA::ORB_ptr orb();
00095
00096 protected:
00097 Utils_Mutex _myMutex;
00098 CORBA::ORB_var _orb;
00099 CosNaming::NamingContext_var _root_context, _current_context;
00100
00101 void _initialize_root_context();
00102 int _createContextNameDir(std::string path,
00103 CosNaming::Name& context_name,
00104 std::vector<std::string>& splitPath,
00105 bool onlyDir);
00106 void _Find(const char* name, CORBA::Long& occurence_number);
00107 void _current_directory(std::vector<std::string>& splitPath,
00108 int& lengthResult,
00109 CosNaming::NamingContext_var contextToFind,
00110 bool& notFound);
00111 void _list_directory_recurs(std::vector<std::string>& myList,
00112 std::string relativeSubDir,
00113 std::string absCurDirectory);
00114
00115 };
00116
00117 #endif // SALOME_NAMINGSERVICE_H
00118