PIMR Package ("Implementation Repository ", just " Repository " below ) is intended to raise CORBA - services ("Implementations") accessibility . Besides you can use Repository instead of nameservice to simplify configuration of several interfacing CORBA - services . Repository functions are to trace services accessibility and to redirect requests to a running service. For this purpose Repository supports services register. Repository works under one of Unix-like OS or Windows NT. It's written in C++ using GradC++ToolBox.
PIMR is always available in CVS ( "COS/PIMR" module).
PIMR package is developed by GradSoft LTD, homepage: http://www.gradsoft.com.ua
PIMR package is distributed in source codes, and to install it you should do the next :
<project_root>).
<project_root>.
./configure with necessary options
(you can get options list by command ./configure" with \verb"--help option;
in particular, you can use --prefix=<smth> option to set installation directory )
su
gmake install
PATH user's environment variable.
<project_root>).
Edit environment.nt file in the subdirectory
<project_root>\config\Win32.
Set values of the next nmake-varaiables:
<project_root>.
<project_root>
and run make" ( \verb"make build ).
<project_root>
and run make install.
<project_root>
and run make uninstall.
<project_root>
and run make clean.
Before use PIMR you need to set it up by editing
the configuration file and using different command line options.
Information about command line argument you can get running PIMR with
--help option. Also you can use next options:
--help
Represents embedded information about command line options.
--config file_name
Allows to load command line arguments from file.
--with-naming initial_object
Sets up initial objects.
--ior-stdout
Object Reference to repository will be printed out to standard output .
--ior-file-PIMR file_name
If you use this option repository will try to print IOR-reference to repository service into the file.
And the repository options:
--configfile configuration_file
Makes repository to use this configuration file. If there is no such directive the
repository will try to use pimr.cfg file from current directory.
Don't mix up this option with --config option.
--logfile log_file
Makes repository to write reports to this file. If there is no such directive the
repository will try to use pimr.log file from current directory.
You can find more about log-file in the "Usage" part.
You can also specify options of the object broker you are using.
For instance, if to run repository, that uses ORBACUS , with following options :
pimr.exe --configfile conf.pimr --logfile log.pimr -OAport 12345 -ORBtrace_connections 2 --ior-stdoutit'll read repository configuration from "conf.pimr" file; we'll put log report to "log.pimr" file; repository ORB will use 12345 port and will print out test messages; at startup repository will print out it's IOR.
Repository configuration file is the program in TCL language. To set up PIMR several commands were added to the language. They are:
service {service name}
--ior {ior reference}
--repositoryid {idl interface}
[--restart {restart command}]
[--callback {ior reference}]
Informs repository about service and its parameters.
It's necessary for repository to be able to redirect requests to service and to
control its state. --restart option shows that if service is down it should be
restarted, this argument is optional.
forwardfreq {number}
Makes repository to initiate check of services state when redirecting not rarer than every N seconds.
checkfreq {number}
Makes repository to check if services are available not rarer than every N seconds.
redirecttimeout {number}
Sets the timeout in seconds for request redirection.
obsoletetimeout {number}
Makes repository to check if service is available in N seconds after the last check.
restarttimeout {number}
Sets the timeout in seconds for service restart. If timeout is exceeded while restarting service, the service Is marked out as failed and will not be restarted any more.
Let's consider, for instance, following configuration file:
#
# This is TCL demo config file for PIMR
#
set thisHost "127.0.0.1"
set thisPort 11000
service HelloService \
--ior "corbaloc::${thisHost}:${thisPort}/HelloService" \
--repositoryid "IDL:Demo/HelloWorlder:1.0" \
# --restart "startHelloWorlder.bat" \ This lines are commented
# --host "${thisHost}:${thisPort}" \ Note that ${thisHost}
# --callback "" \ will be computed by TCL.
forwardfreq 1
checkfreq 10
obsoletetimeout 15
restarttimeout 30
redirecttimeout 60
This configuration file gives information about one service named HelloService. Repository will seek for it on local host on the port 11000 by name HelloService. Repository will not restart the service, for there is no 'restart' command.
It is advisable to choose repository parameters observing the next rule: obsoletetimeout + checkfreq + restarttimeout < redirecttimeout
To check working capacity of the compiled package you can use test samples.
You can compile test examples under Windows running following command
from <project_root> directory:
nmake /f makefile.nt buildtests
To uninstall tests run:
nmake /f makefile.nt cleantests
Under Unix-like system use ???.
Now change directory to <project_root>/demo/
and view "readme"-files in this directory and in subdirectories.
Test CORBA-services are in <project_root>/demo/server*/
subdirectories. To run tests you can use verb"run.bat" files. Tests
interfaces you'll find in <project_root>/demo/*.idl files.
<project_root>/demo/client/ directory contains
client program for these services. Also there you'll find
run_straight.bat" and \verb"run_via_repository.bat
to start client directly and via repository accordingly.
<project_root>/demo/repository/ directory contains
repository configuration files for demo-samples and
repository*.bat start scripts.
Scripts start service and repository on ip-address 127.0.0.1 and ports 11000 (11001), 11111 accordingly. So, before starting the programs make sure given ports are available.
Start client. It should terminate with the error saying that service is unavailable.
Start HelloWorld running run.bat" or \verb|"run.sh| in
<project_root>/demo/server0/ directory.
Then run client program with run_straight.bat (Don't terminate
HelloWorld) from <project_root>/demo/client/ directory.
Client should run without errors and "Hello, world" should be
printed out in the service window .
repository.bat but don't start the service.
Make sure that repository considers HelloWorld service as terminated .
run_via_repository.bat.
Client should get OBJECT_NOT_EXIST exception.
run.bat
from <project_root>/demo/server0/ directory.
run_via_repository.bat.
Client should run without errors and "Hello, world" should be
printed out in the service window.
OBJECT_NOT_EXIST exception..
repository1.bat
but don't start the service. Wait (not longer than one minute) -
repository should start the service using restart.bat
script.
run_via_repository.bat.
Client should run without errors and "Hello, world" should be
printed out in the service window.
<project_root>/demo/server0/
directory using run.bat.
run_straight.bat.
Client should run without errors and "Hello, world" should be
printed out in the service window.
repository.bat.
<project_root>/demo/server1/
directory.
run_via_repository.bat.
Client should run without errors and "Hello, world" should be
printed out in the service window.
run_straight.bat.
Client should run with error saying that service is unavailable (for it runs
on the other port.).
To make repository control a service you should register it at repository. You can do it using the configuration file or using the RepositoryAdmin interface . Then client will be available by the following reference:
corbaloc::repository_host:repository_port/required_service_name
Client sends request using this corbaloc. Repository automatically redirects request to object-service.
Repository is available by next reference:
corbaloc:: repository_host:repository_port/Repository
Attention! Don't use "Repository" name when registering your services. This name is used to access the repository. If you try to register service with such a name you'll get PIMR::RepositoryAdmin::NotAviable exception.
When running repository records messages into log-file. By default it's
./pimr.log , but
you can change the location of the file using --configfile log-file command line
argument .
To choose type of messages you want to record to log-file set the following variables in لجر
PIMRPostConfig.h:
#define LOG_DEBUG_ENABLE false #define LOG_INFO_ENABLE true #define LOG_WARNING_ENABLE true #define LOG_ERROR_ENABLE true #define LOG_FATAL_ENABLE true
and recompile repository.