// $Id: README 62177 2004-11-25 01:02:37Z jtc $

This directory has a generic server which opens and reads the svc.conf file in 
the directory and dynamically loads and unloads the various ORB services as per 
the entries made in the svc.conf file.

To Load a Service Dynamically:
*****************************

1. Add an entry to the svc.conf which specifies the service name that you wish to
   load dynamically.
	
	The syntax for loading a service dynamically is:

	dynamic < Service name i.e. name that you want the Service Repository to
                  use to identify the dynamically linked Service_Object
                  so that you can look it up later via, 
	          e.g., ACE_Dynamic_Service::instance () > \
                < The type of the service > \
                < The shared DLL that has the function
                  _make_Service_Name () , called the factory function> : \
                <factory_function> \
	       "< arguments to be passed to the service similar to command line arguments>"


To load Naming Service dynamically :
----------------------------------
	
  dynamic TAO_Naming_Loader Service_Object * \
          TAO_CosNaming_Serv:_make_TAO_Naming_Loader () "dummy -o ns.ior"

  So, here we want our service name to be TAO_Naming_Loader and its a
  <Service_Object *> and the factory function is in TAO_CosNaming_Serv
  DLL. We specify argv [0] to be "dummy" and the actual arguments
  start from argv [1] as in the usual case.

To load Event Service dynamically:
---------------------------------
	
	In the case of Event Service, we also want to load the default
Event Service Factory in addition to the Event Service. So, we need to
add these two entries when we want to load the event service.

# Dynamically configure the default Event Service Factory
dynamic CEC_Factory Service_Object * \
	TAO_CosEvent_Serv:_make_TAO_CEC_Default_Factory () ""

# Dynamically configure the event service into the application process.
dynamic TAO_CEC_Event_Loader Service_Object * \
        TAO_CosEvent_Serv:_make_TAO_CEC_Event_Loader () "dummy -o foo.ref"

To load Trading Service dynamically:
---------------------------------

#  Dynamically configure the trading service into the application process.
dynamic TAO_Trading_Loader Service_Object * \
	TAO_CosTrading_Serv:_make_TAO_Trading_Loader () "dummy -TSdumpior foo.ref"

To Remove a Service
*******************

	The directive for removing a service is <remove>. Removing a 
service is simpler. Add the following entry to the same svc.conf file
after commenting the entry for loading the same service, so that
the service is not loaded again.


The generic entry is :

remove Service_Name

To Unload Naming Service :
------------------------

# Dynamically remove the Naming Service from the application process.
remove TAO_Naming_Loader

To Unload Event Service :
------------------------

# Dynamically remove the Event Service from the application process.
remove TAO_Event_Loader

To Unload Trading Service :
------------------------

# Dynamically remove the Event Service from the application process.
remove TAO_Trading_Loader

To Run TAO_Service :
==================

1. Start with a empty svc.conf file. Run the TAO_Service. Make sure
that you start with an empty svc.conf file because the ORB_init () and
the service configurator get pretty confused. 

In detail, the svc.conf file is read and services loaded when 
ORB_init () is called in the main (). But, to load any service, we
need to initialize the ORB. Here, it gets confused. To avoid this,
run the TAO_Service with no entries in the svc.conf file.

2. After running the server, now start adding entries to the svc.conf
file depending on the services you wish to load. After adding an
entry, send a SIGHUP signal:

% kill -1 PID_of_TAO_Service

	 to the TAO_Service. The service configurator reads the
svc.conf file again and reconfigures the services.

3. If you want to test if the service is loaded successfully, run the
generic client program < tests_svc_loader.cpp > located in 
orbsvcs/tests/tests_svc_loader. For more details about the
tests_svc_loader.cpp, read the README in the same directory.

4. If you want to remove the service at any instant, add an entry to
the svc.conf file to reflect your intent and send a signal to the
TAO_Service again.
