#include <Naming_Context.h>
Inheritance diagram for ACE_Naming_Context:


Public Types | |
| enum | Context_Scope_Type { PROC_LOCAL, NODE_LOCAL, NET_LOCAL } |
Public Methods | |
| ACE_Naming_Context (void) | |
| "Do-nothing" constructor. More... | |
| ACE_Naming_Context (Context_Scope_Type scope_in, int light=0) | |
| int | open (Context_Scope_Type scope_in=ACE_Naming_Context::PROC_LOCAL, int light=0) |
| int | close (void) |
| Deletes the instance of Name Space. Must be called before switching name spaces. More... | |
| int | close_down (void) |
| Release all resources. Gets called by destructor and fini. More... | |
| ~ACE_Naming_Context (void) | |
| destructor, do some cleanup :TBD: last dtor should "compress" file. More... | |
| virtual int | init (int argc, ACE_TCHAR *argv[]) |
| Initialize name options and naming context when dynamically linked. More... | |
| virtual int | fini (void) |
| Close down the test when dynamically unlinked. More... | |
| virtual int | info (ACE_TCHAR **strp, size_t length) const |
| Returns information about this context. More... | |
| ACE_Name_Options * | name_options (void) |
| Returns the ACE_Name_Options associated with the Naming_Context. More... | |
| int | bind (const ACE_NS_WString &name_in, const ACE_NS_WString &value_in, const char *type_in="") |
| Bind a new name to a naming context (Wide character strings). More... | |
| int | bind (const char *name_in, const char *value_in, const char *type_in="") |
| Bind a new name to a naming context ( character strings). More... | |
| int | rebind (const ACE_NS_WString &name_in, const ACE_NS_WString &value_in, const char *type_in="") |
| int | rebind (const char *name_in, const char *value_in, const char *type_in="") |
| int | unbind (const ACE_NS_WString &name_in) |
| Delete a name from a ACE_Naming_Context (Wide charcter strings Interface). More... | |
| int | unbind (const char *name_in) |
| Delete a name from a ACE_Naming_Context (character strings interface). More... | |
| int | resolve (const ACE_NS_WString &name_in, ACE_NS_WString &value_out, char *&type_out) |
| Get value and type of a given name binding (Wide chars). The caller is responsible for deleting both <value_out> and <type_out>! More... | |
| int | resolve (const char *name_in, ACE_NS_WString &value_out, char *&type_out) |
| int | resolve (const char *name_in, char *&value_out, char *&type_out) |
| Get value and type of a given name binding ( chars ). The caller is responsible for deleting both <value_out> and <type_out>! More... | |
| int | list_names (ACE_PWSTRING_SET &set_out, const ACE_NS_WString &pattern_in) |
| Get a set of names matching a specified pattern (wchars). Matching means the names must begin with the pattern string. More... | |
| int | list_names (ACE_PWSTRING_SET &set_out, const char *pattern_in) |
| Get a set of names matching a specified pattern (chars). Matching means the names must begin with the pattern string. More... | |
| int | list_values (ACE_PWSTRING_SET &set_out, const ACE_NS_WString &pattern_in) |
| Get a set of values matching a specified pattern (wchars). Matching means the values must begin with the pattern string. More... | |
| int | list_values (ACE_PWSTRING_SET &set_out, const char *pattern_in) |
| Get a set of values matching a specified pattern (chars). Matching means the values must begin with the pattern string. More... | |
| int | list_types (ACE_PWSTRING_SET &set_out, const ACE_NS_WString &pattern_in) |
| Get a set of types matching a specified pattern (wchars). Matching means the types must begin with the pattern string. More... | |
| int | list_types (ACE_PWSTRING_SET &set_out, const char *pattern_in) |
| Get a set of types matching a specified pattern (chars). Matching means the types must begin with the pattern string. More... | |
| virtual int | list_name_entries (ACE_BINDING_SET &set_out, const ACE_NS_WString &pattern_in) |
| virtual int | list_name_entries (ACE_BINDING_SET &set_out, const char *pattern_in) |
| virtual int | list_value_entries (ACE_BINDING_SET &set_out, const ACE_NS_WString &pattern_in) |
| virtual int | list_value_entries (ACE_BINDING_SET &set_out, const char *pattern_in) |
| virtual int | list_type_entries (ACE_BINDING_SET &set_out, const ACE_NS_WString &pattern_in) |
| virtual int | list_type_entries (ACE_BINDING_SET &set_out, const char *pattern_in) |
| void | dump (void) |
| Dump the state of the object. More... | |
Private Methods | |
| int | local (void) |
| 1 if we're on the same local machine as the name server, else 0. More... | |
Private Attributes | |
| ACE_Name_Options * | name_options_ |
| Keep track of the options such as database name etc per Naming Context. More... | |
| ACE_Name_Space * | name_space_ |
| Name space (can be either local or remote) dynamically bound. More... | |
| ACE_TCHAR | hostname_ [MAXHOSTNAMELEN+1] |
| Holds the local hostname. More... | |
| const ACE_TCHAR * | netnameserver_host_ |
| Holds name of net name server. More... | |
| int | netnameserver_port_ |
| Holds port number of the net name server. More... | |
Manages a Naming Service . That represents a persistent string to string mapping for different scopes. The scope of a ACE_Naming_Context may be either local for the calling process (Note : A process is hereby not identified by it's pid, but by it's argv[0]. So different processes (in UNIX syntax) may access the same NameBindings), global for all processes running on one host or global for all processes on the net (that know the address of the net name server socket). Strings may be plain character strings or Wide character strings. A Name Binding consists of a name string (that's the key), a value string and an optional type string (no wide chars).
Definition at line 54 of file Naming_Context.h.
|
|
Definition at line 57 of file Naming_Context.h. Referenced by ACE_Local_Name_Space::ACE_Local_Name_Space, ACE_Name_Options::context, and ACE_Local_Name_Space::open.
00058 {
00059 /// Name lookup is local to the process.
00060 PROC_LOCAL,
00061 /// Name lookup is local to the node (host).
00062 NODE_LOCAL,
00063 /// Name lookup is local to the (sub)network.
00064 NET_LOCAL
00065 };
|
|
|
"Do-nothing" constructor.
Definition at line 142 of file Naming_Context.cpp. References ACE_NEW, and ACE_TRACE.
00143 : name_options_ (0), 00144 name_space_ (0) 00145 { 00146 ACE_TRACE ("ACE_Naming_Context::ACE_Naming_Context"); 00147 00148 ACE_NEW (this->name_options_, 00149 ACE_Name_Options); 00150 } |
|
||||||||||||
|
Specifies the scope of this namespace, opens and memory-maps the associated file (if accessible) or contacts the dedicated name server process for NET_LOCAL namespace. Note that <light> specifies whether or not we want to use ACE_Lite_MMap_Memory_Pool. By default we use ACE_MMap_Memory_Pool. Definition at line 152 of file Naming_Context.cpp. References ACE_ERROR, ACE_LIB_TEXT, ACE_NEW, ACE_TRACE, LM_ERROR, and open.
00154 : name_options_ (0), 00155 name_space_ (0) 00156 { 00157 ACE_TRACE ("ACE_Naming_Context::ACE_Naming_Context"); 00158 00159 ACE_NEW (this->name_options_, 00160 ACE_Name_Options); 00161 00162 // Initialize. 00163 if (this->open (scope_in, lite) == -1) 00164 ACE_ERROR ((LM_ERROR, 00165 ACE_LIB_TEXT ("%p\n"), 00166 ACE_LIB_TEXT ("ACE_Naming_Context::ACE_Naming_Context"))); 00167 } |
|
|
destructor, do some cleanup :TBD: last dtor should "compress" file.
Definition at line 381 of file Naming_Context.cpp. References ACE_TRACE, and close_down.
00382 {
00383 ACE_TRACE ("ACE_Naming_Context::~ACE_Naming_Context");
00384
00385 this->close_down ();
00386 }
|
|
||||||||||||||||
|
Bind a new name to a naming context ( character strings).
Definition at line 185 of file Naming_Context.cpp. References ACE_TRACE, and bind.
00188 {
00189 ACE_TRACE ("ACE_Naming_Context::bind");
00190 return this->bind (ACE_NS_WString (name_in),
00191 ACE_NS_WString (value_in),
00192 type_in);
00193 }
|
|
||||||||||||||||
|
Bind a new name to a naming context (Wide character strings).
Definition at line 176 of file Naming_Context.cpp. References ACE_TRACE, ACE_Name_Space::bind, and name_space_. Referenced by bind.
00179 {
00180 ACE_TRACE ("ACE_Naming_Context::bind");
00181 return this->name_space_->bind (name_in, value_in, type_in);
00182 }
|
|
|
Deletes the instance of Name Space. Must be called before switching name spaces.
Definition at line 132 of file Naming_Context.cpp. References ACE_TRACE, and name_space_. Referenced by close_down.
00133 {
00134 ACE_TRACE ("ACE_Naming_Context::close");
00135
00136 delete this->name_space_;
00137 this->name_space_ = 0;
00138
00139 return 0;
00140 }
|
|
|
Release all resources. Gets called by destructor and fini.
Definition at line 121 of file Naming_Context.cpp. References ACE_TRACE, close, and name_options_. Referenced by fini, and ~ACE_Naming_Context.
00122 {
00123 ACE_TRACE ("ACE_Naming_Context::close_down");
00124
00125 delete this->name_options_;
00126 this->name_options_ = 0;
00127
00128 return this->close ();
00129 }
|
|
|
Dump the state of the object.
Definition at line 389 of file Naming_Context.cpp. References ACE_TRACE, ACE_Name_Space::dump, and name_space_.
00390 {
00391 ACE_TRACE ("ACE_Naming_Context::dump");
00392 this->name_space_->dump();
00393 }
|
|
|
Close down the test when dynamically unlinked.
Reimplemented from ACE_Shared_Object. Definition at line 406 of file Naming_Context.cpp. References ACE_DEBUG, ACE_LIB_TEXT, close_down, ACE::debug, and LM_DEBUG.
00407 {
00408 if (ACE::debug ())
00409 ACE_DEBUG ((LM_DEBUG,
00410 ACE_LIB_TEXT ("ACE_Naming_Context::fini\n")));
00411 this->close_down ();
00412 return 0;
00413 }
|
|
||||||||||||
|
Returns information about this context.
Reimplemented from ACE_Shared_Object. |
|
||||||||||||
|
Initialize name options and naming context when dynamically linked.
Reimplemented from ACE_Shared_Object. Definition at line 396 of file Naming_Context.cpp. References ACE_DEBUG, ACE_LIB_TEXT, ACE_TCHAR, ACE::debug, LM_DEBUG, name_options_, open, and ACE_Name_Options::parse_args.
00397 {
00398 if (ACE::debug ())
00399 ACE_DEBUG ((LM_DEBUG,
00400 ACE_LIB_TEXT ("ACE_Naming_Context::init\n")));
00401 this->name_options_->parse_args (argc, argv);
00402 return this->open (this->name_options_->context ());
00403 }
|
|
||||||||||||
|
Get a set of names matching a specified pattern (wchars). Matching means the names must begin with the pattern string. Returns the complete binding associated each pattern match. Definition at line 337 of file Naming_Context.cpp. References ACE_TRACE, and list_name_entries.
00339 {
00340 ACE_TRACE ("ACE_Naming_Context::list_name_entries");
00341 return this->list_name_entries (set_out,
00342 ACE_NS_WString (pattern_in));
00343 }
|
|
||||||||||||
|
Get a set of names matching a specified pattern (wchars). Matching means the names must begin with the pattern string. Returns the complete binding associated each pattern match. Definition at line 328 of file Naming_Context.cpp. References ACE_TRACE, ACE_Name_Space::list_name_entries, and name_space_. Referenced by list_name_entries.
00330 {
00331 ACE_TRACE ("ACE_Naming_Context::list_name_entries");
00332 return this->name_space_->list_name_entries (set_out,
00333 pattern_in);
00334 }
|
|
||||||||||||
|
Get a set of names matching a specified pattern (chars). Matching means the names must begin with the pattern string.
Definition at line 283 of file Naming_Context.cpp. References ACE_TRACE, and list_names.
00285 {
00286 ACE_TRACE ("ACE_Naming_Context::list_names");
00287 return this->list_names (set_out,
00288 ACE_NS_WString (pattern_in));
00289 }
|
|
||||||||||||
|
Get a set of names matching a specified pattern (wchars). Matching means the names must begin with the pattern string.
Definition at line 274 of file Naming_Context.cpp. References ACE_TRACE, ACE_Name_Space::list_names, and name_space_. Referenced by list_names.
00276 {
00277 ACE_TRACE ("ACE_Naming_Context::list_names");
00278 return this->name_space_->list_names (set_out,
00279 pattern_in);
00280 }
|
|
||||||||||||
|
Get a set of types matching a specified pattern (wchars). Matching means the types must begin with the pattern string. Returns the complete binding associated each pattern match. Definition at line 373 of file Naming_Context.cpp. References ACE_TRACE, and list_type_entries.
00375 {
00376 ACE_TRACE ("ACE_Naming_Context::list_type_entries");
00377 return this->list_type_entries (set_out,
00378 ACE_NS_WString (pattern_in));
00379 }
|
|
||||||||||||
|
Get a set of types matching a specified pattern (wchars). Matching means the types must begin with the pattern string. Returns the complete binding associated each pattern match. Definition at line 364 of file Naming_Context.cpp. References ACE_TRACE, ACE_Name_Space::list_type_entries, and name_space_. Referenced by list_type_entries.
00366 {
00367 ACE_TRACE ("ACE_Naming_Context::list_type_entries");
00368 return this->name_space_->list_type_entries (set_out,
00369 pattern_in);
00370 }
|
|
||||||||||||
|
Get a set of types matching a specified pattern (chars). Matching means the types must begin with the pattern string.
Definition at line 319 of file Naming_Context.cpp. References ACE_TRACE, and list_types.
00321 {
00322 ACE_TRACE ("ACE_Naming_Context::list_types");
00323 return this->list_types (set_out,
00324 ACE_NS_WString (pattern_in));
00325 }
|
|
||||||||||||
|
Get a set of types matching a specified pattern (wchars). Matching means the types must begin with the pattern string.
Definition at line 310 of file Naming_Context.cpp. References ACE_TRACE, ACE_Name_Space::list_types, and name_space_. Referenced by list_types.
00312 {
00313 ACE_TRACE ("ACE_Naming_Context::list_types");
00314 return this->name_space_->list_types (set_out,
00315 pattern_in);
00316 }
|
|
||||||||||||
|
Get a set of values matching a specified pattern (wchars). Matching means the values must begin with the pattern string. Returns the complete binding associated each pattern match. Definition at line 355 of file Naming_Context.cpp. References ACE_TRACE, and list_value_entries.
00357 {
00358 ACE_TRACE ("ACE_Naming_Context::list_value_entries");
00359 return this->list_value_entries (set_out,
00360 ACE_NS_WString (pattern_in));
00361 }
|
|
||||||||||||
|
Get a set of values matching a specified pattern (wchars). Matching means the values must begin with the pattern string. Returns the complete binding associated each pattern match. Definition at line 346 of file Naming_Context.cpp. References ACE_TRACE, ACE_Name_Space::list_value_entries, and name_space_. Referenced by list_value_entries.
00348 {
00349 ACE_TRACE ("ACE_Naming_Context::list_value_entries");
00350 return this->name_space_->list_value_entries (set_out,
00351 pattern_in);
00352 }
|
|
||||||||||||
|
Get a set of values matching a specified pattern (chars). Matching means the values must begin with the pattern string.
Definition at line 301 of file Naming_Context.cpp. References ACE_TRACE, and list_values.
00303 {
00304 ACE_TRACE ("ACE_Naming_Context::list_values");
00305 return this->list_values (set_out,
00306 ACE_NS_WString (pattern_in));
00307 }
|
|
||||||||||||
|
Get a set of values matching a specified pattern (wchars). Matching means the values must begin with the pattern string.
Definition at line 292 of file Naming_Context.cpp. References ACE_TRACE, ACE_Name_Space::list_values, and name_space_. Referenced by list_values.
00294 {
00295 ACE_TRACE ("ACE_Naming_Context::list_values");
00296 return this->name_space_->list_values (set_out,
00297 pattern_in);
00298 }
|
|
|
1 if we're on the same local machine as the name server, else 0.
Definition at line 57 of file Naming_Context.cpp. References ACE_LIB_TEXT, ACE_TRACE, and ACE_OS_String::strcmp. Referenced by open.
00058 {
00059 ACE_TRACE ("ACE_Naming_Context::local");
00060 return ACE_OS::strcmp (this->netnameserver_host_,
00061 ACE_LIB_TEXT ("localhost")) == 0
00062 || ACE_OS::strcmp (this->netnameserver_host_,
00063 this->hostname_) == 0;
00064 }
|
|
|
Returns the ACE_Name_Options associated with the Naming_Context.
Definition at line 170 of file Naming_Context.cpp. References name_options_.
00171 {
00172 return this->name_options_;
00173 }
|
|
||||||||||||
|
Specifies the scope of this namespace, opens and memory-maps the associated file (if accessible) or contacts the dedicated name server process for NET_LOCAL namespace. Note that <light> specifies whether or not we want to use ACE_Lite_MMap_Memory_Pool. By default we use ACE_MMap_Memory_Pool. Definition at line 67 of file Naming_Context.cpp. References ACE_ERROR_RETURN, ACE_LIB_TEXT, ACE_LOG_MSG, ACE_NEW_RETURN, ACE_TCHAR, ACE_TRACE, ACE_OS::hostname, LM_ERROR, local, name_options_, name_space_, ACE_Name_Options::nameserver_host, ACE_Name_Options::nameserver_port, NET_LOCAL, netnameserver_host_, netnameserver_port_, and ACE_Name_Options::use_registry. Referenced by ACE_Naming_Context, and init.
00068 {
00069 ACE_TRACE ("ACE_Naming_Context::open");
00070 ACE_OS::hostname (this->hostname_,
00071 (sizeof this->hostname_ / sizeof (ACE_TCHAR)));
00072
00073 this->netnameserver_host_ =
00074 this->name_options_->nameserver_host ();
00075 this->netnameserver_port_ =
00076 this->name_options_->nameserver_port ();
00077
00078 // Perform factory operation to select appropriate type of
00079 // Name_Space subclass.
00080
00081 #if (defined (ACE_WIN32) && defined (UNICODE))
00082 // This only works on Win32 platforms when UNICODE is turned on
00083
00084 if (this->name_options_->use_registry ())
00085 // Use ACE_Registry
00086 ACE_NEW_RETURN (this->name_space_,
00087 ACE_Registry_Name_Space (this->name_options_),
00088 -1);
00089 #endif /* ACE_WIN32 && UNICODE */
00090 if (!this->name_options_->use_registry ())
00091 if (scope_in == ACE_Naming_Context::NET_LOCAL && this->local () == 0)
00092 {
00093 // Use NET_LOCAL name space, set up connection with remote server.
00094 ACE_NEW_RETURN (this->name_space_,
00095 ACE_Remote_Name_Space (this->netnameserver_host_,
00096 (u_short) this->netnameserver_port_),
00097 -1);
00098 }
00099 else // Use NODE_LOCAL or PROC_LOCAL name space.
00100 {
00101 if (lite)
00102 ACE_NEW_RETURN (this->name_space_,
00103 LITE_LOCAL_NAME_SPACE (scope_in,
00104 this->name_options_),
00105 -1);
00106 else
00107 ACE_NEW_RETURN (this->name_space_,
00108 LOCAL_NAME_SPACE (scope_in,
00109 this->name_options_),
00110 -1);
00111 }
00112
00113 if (ACE_LOG_MSG->op_status () != 0 || this->name_space_ == 0)
00114 ACE_ERROR_RETURN ((LM_ERROR,
00115 ACE_LIB_TEXT ("NAME_SPACE::NAME_SPACE\n")),
00116 -1);
00117 return 0;
00118 }
|
|
||||||||||||||||
|
Overwrite the value or type of an existing name in a ACE_Naming_Context or bind a new name to the context, if it didn't exist yet. ( charcter strings interface) Definition at line 207 of file Naming_Context.cpp. References ACE_TRACE, and rebind.
00210 {
00211 ACE_TRACE ("ACE_Naming_Context::rebind");
00212 return rebind (ACE_NS_WString (name_in),
00213 ACE_NS_WString (value_in),
00214 type_in);
00215 }
|
|
||||||||||||||||
|
Overwrite the value or type of an existing name in a ACE_Naming_Context or bind a new name to the context, if it didn't exist yet. (Wide charcter strings interface). Definition at line 196 of file Naming_Context.cpp. References ACE_TRACE, name_space_, and ACE_Name_Space::rebind. Referenced by rebind.
00199 {
00200 ACE_TRACE ("ACE_Naming_Context::rebind");
00201 return this->name_space_->rebind (name_in,
00202 value_in,
00203 type_in);
00204 }
|
|
||||||||||||||||
|
Get value and type of a given name binding ( chars ). The caller is responsible for deleting both <value_out> and <type_out>!
Definition at line 240 of file Naming_Context.cpp. References ACE_TRACE, ACE_NS_WString::char_rep, and resolve.
00243 {
00244 ACE_TRACE ("ACE_Naming_Context::resolve");
00245 ACE_NS_WString val_str;
00246
00247 if (this->resolve (ACE_NS_WString (name_in),
00248 val_str,
00249 type_out) == -1)
00250 return -1;
00251
00252 // Note that <char_rep> *allocates* the memory! Thus, caller is
00253 // responsible for deleting it!
00254 value_out = val_str.char_rep ();
00255
00256 return value_out == 0 ? -1 : 0;
00257 }
|
|
||||||||||||||||
|
Get value and type of a given name binding (Wide chars output). The caller is responsible for deleting both <value_out> and <type_out>! Definition at line 229 of file Naming_Context.cpp. References ACE_TRACE, and resolve.
00232 {
00233 ACE_TRACE ("ACE_Naming_Context::resolve");
00234 return this->resolve (ACE_NS_WString (name_in),
00235 value_out,
00236 type_out);
00237 }
|
|
||||||||||||||||
|
Get value and type of a given name binding (Wide chars). The caller is responsible for deleting both <value_out> and <type_out>!
Definition at line 218 of file Naming_Context.cpp. References ACE_TRACE, name_space_, and ACE_Name_Space::resolve. Referenced by resolve.
00221 {
00222 ACE_TRACE ("ACE_Naming_Context::resolve");
00223 return this->name_space_->resolve (name_in,
00224 value_out,
00225 type_out);
00226 }
|
|
|
Delete a name from a ACE_Naming_Context (character strings interface).
Definition at line 267 of file Naming_Context.cpp. References ACE_TRACE, and unbind.
00268 {
00269 ACE_TRACE ("ACE_Naming_Context::unbind");
00270 return this->unbind (ACE_NS_WString (name_in));
00271 }
|
|
|
Delete a name from a ACE_Naming_Context (Wide charcter strings Interface).
Definition at line 260 of file Naming_Context.cpp. References ACE_TRACE, name_space_, and ACE_Name_Space::unbind. Referenced by unbind.
00261 {
00262 ACE_TRACE ("ACE_Naming_Context::unbind");
00263 return this->name_space_->unbind (name_in);
00264 }
|
|
|
Holds the local hostname.
Definition at line 261 of file Naming_Context.h. |
|
|
Keep track of the options such as database name etc per Naming Context.
Definition at line 255 of file Naming_Context.h. Referenced by close_down, init, name_options, and open. |
|
|
Name space (can be either local or remote) dynamically bound.
Definition at line 258 of file Naming_Context.h. Referenced by bind, close, dump, list_name_entries, list_names, list_type_entries, list_types, list_value_entries, list_values, open, rebind, resolve, and unbind. |
|
|
Holds name of net name server.
Definition at line 264 of file Naming_Context.h. Referenced by open. |
|
|
Holds port number of the net name server.
Definition at line 267 of file Naming_Context.h. Referenced by open. |
1.2.14 written by Dimitri van Heesch,
© 1997-2002