| 1 |
|
| 2 |
|
| 3 |
This directory contains a test for the ACE_Name_Server library. This |
| 4 |
test program also illustrates how to use the ACE Service_Config |
| 5 |
mechanism, which enables the client code to be dynamically linked into |
| 6 |
the process at installation-time or run-time. |
| 7 |
|
| 8 |
The client test is an application that allows the user to vary the |
| 9 |
test parameters through the following menu driven interface: |
| 10 |
|
| 11 |
Name Service Main Menu |
| 12 |
---------------------- |
| 13 |
*** Using Process Local Database *** |
| 14 |
|
| 15 |
<P> Use Process Local Database |
| 16 |
<N> Use Node Local Database |
| 17 |
<H> Set Remote Name server <host> and <port> |
| 18 |
|
| 19 |
<B> Bind <key> <value> [<type>] |
| 20 |
<U> Unbind <key> |
| 21 |
<R> Rebind <key> <value> [<type>] |
| 22 |
<F> Find <key> |
| 23 |
<J> Lookup keys matching <pattern> |
| 24 |
<K> Lookup values matching <pattern> |
| 25 |
<L> Lookup types matching <pattern> |
| 26 |
<C> Complete lookup keys matching <pattern> |
| 27 |
<D> Complete lookup values matching <pattern> |
| 28 |
<E> Complete lookup types matching <pattern> |
| 29 |
|
| 30 |
<Q> or ^C (exit) |
| 31 |
|
| 32 |
Initially, the user can select the type of database -- process local, |
| 33 |
node local, or net local -- from the menu. |
| 34 |
|
| 35 |
<P> uses the process local database (i.e., the database is called the |
| 36 |
same name as the process and stored in /tmp). |
| 37 |
<N> uses the node local database (which defaults to /tmp/localnames). |
| 38 |
<H> uses the net local database by specifying host and port number (by |
| 39 |
default this is stored in a file called /tmp/globalnames on the server). |
| 40 |
|
| 41 |
The user can then create new bindings, delete existing bindings, or |
| 42 |
rebind bindings: |
| 43 |
|
| 44 |
<B> Bind <key> <value> [<type>] |
| 45 |
-- binds the key to the value and adds the |
| 46 |
binding to the database. Note that type |
| 47 |
information is optional. |
| 48 |
<U> Unbind <key> -- unbind a binding whose key is <key> |
| 49 |
<R> Rebind <key> <value> [<type>] |
| 50 |
-- rebind <key> to <value>. Once again <type> is optional. |
| 51 |
<F> Find <key> -- find the binding associated with key <key> |
| 52 |
<Q> or ^C (exit) -- exit gracefully, saving the contents of the |
| 53 |
Name Server in persistent shared memory. |
| 54 |
|
| 55 |
In addition, the user can do pattern matching for keys, values, and |
| 56 |
types. Note that pattern matching is supported using regular expressions. |
| 57 |
|
| 58 |
<J> Lookup keys matching <pattern> |
| 59 |
-- find all keys that match <pattern> |
| 60 |
<K> Lookup values matching <pattern> |
| 61 |
-- find all values that match <pattern> |
| 62 |
<L> Lookup types matching <pattern> |
| 63 |
-- find all types that match <pattern> |
| 64 |
|
| 65 |
<C> Complete lookup keys matching <pattern> |
| 66 |
-- find all bindings whose keys match <pattern> |
| 67 |
<D> Complete lookup values matching <pattern> |
| 68 |
-- find all bindings whose values match <pattern> |
| 69 |
<E> Complete lookup types matching <pattern> |
| 70 |
-- find all bindings whose types match <pattern> |
| 71 |
|
| 72 |
------------------------- |
| 73 |
Running the tests: |
| 74 |
|
| 75 |
The test program uses a DLL supported by the svc.conf file, which |
| 76 |
allows them to configure the client-side dynamically. The client test |
| 77 |
program accomplishes this by making use of a Singleton proxy object |
| 78 |
(Name_Service) to provide an interface to the client-side. |
| 79 |
|
| 80 |
The test programs rely on svc.conf to provide the necessary parameters |
| 81 |
for dynamically linking the Name Service library and then |
| 82 |
executing. In the absence of svc.conf, the test programs would use |
| 83 |
static binding. |
| 84 |
|
| 85 |
client: |
| 86 |
|
| 87 |
The client test can be started without any parameters. However, if the |
| 88 |
user wants to use the net local database, the hostname and the port |
| 89 |
number of the server containing the net local database can be given at |
| 90 |
"command line" in the svc.conf file, e.g.: |
| 91 |
|
| 92 |
dynamic ACE_Naming_Context Service_Object * libACE.so:_make_ACE_Naming_Context () |
| 93 |
"main -h tango.cs -p 7891" |
| 94 |
dynamic Name_Server_test Service_Object * .shobj/Client_Test.so:_make_Client_Test () "" |
| 95 |
|
| 96 |
The above example starts the client test application and sets up a |
| 97 |
connection to port 7891 to a Name Server running on tango.cs, which |
| 98 |
has the net local database. The Client_Test directive must come after |
| 99 |
ACE_Naming_Context since it relies on the ACE_Naming_Context having |
| 100 |
been dynamically linked. |
| 101 |
|
| 102 |
Note that you can also use environment variables in the "command |
| 103 |
line", as follows: |
| 104 |
|
| 105 |
dynamic ACE_Naming_Context Service_Object * libACE.so:_make_ACE_Naming_Context () |
| 106 |
"main -s $DB -p $PORT -h tango" |
| 107 |
dynamic Name_Server_test Service_Object * .shobj/Client_Test.so:_make_Client_Test () "" |
| 108 |
|
| 109 |
In this example, $DB and $PORT are environment variables that are |
| 110 |
automatically interpreted and substituted by ACE. In addition, note |
| 111 |
how you can give a relative name for the libACE_svcs.so and ACE will |
| 112 |
locate this for you automatically by reading your LD search path. |
| 113 |
|
| 114 |
server: |
| 115 |
|
| 116 |
The name server is needed only in the case where the net local |
| 117 |
database needs to be accessed. The server test needs to run on the |
| 118 |
machine that contains the net local database. To execute the server |
| 119 |
test, the user has to specify the port number at which the server will |
| 120 |
be listening in the svc.conf file. An implementation of a name |
| 121 |
service for ACE is available in the $ACE_ROOT/netsvcs/{lib,servers} |
| 122 |
directories. Please see the README files there for an explanation of |
| 123 |
how to run the server. |
| 124 |
|
| 125 |
|