next_inactive up previous

CASL: CORBA API: Programing Guide


CORBA API service is one of the CASL services. What is it? - It is simply CASL shell around ORB supplied together with CASL. It gives uniform interface to ORB functionality and set of utility functions.

C++ interface

CORBA services definitions is located in file:


Public methods of CASL service are listed below:

namespace CASL {

class CORBAService: public CASL::Service

   * return string "CORBAService"
  virtual const char* name() const;

   * init
  virtual void init(ServerContext* );

   * return 
   *    false, if we work in client-only mode.
   *    true, otherwice
  virtual bool requireThread();

   * run CORBA Service.
  virtual void run();

   * close
  virtual void close();

  // CORBA specific stuff.

   * return ORB
  virtual CORBA::ORB_ptr  getORB();

   * throw CASL::Exception with code 1001 and message about 
   * CORBA::SystemException
  virtual void  throwCORBAInvokedException(const CORBA::SystemException& ex);

   * print information about CORBA::SystemException to stream out.
  virtual void  printCORBASystemException(const CORBA::SystemException& ex, 
                                  ostream& out);

   * pring information about CORBA::SystemException to string
  virtual std::string  stringCORBASystemException(
                                      const CORBA::SystemException& ex);





Methods description

Standart service methods are : name, init, run and requireThread.

Individual explanation is required only for methods run() and requireThread : CORBA service is able to work as client and as server. Boolean ClientOnly parameter adjusts it.

If ClientOnly is true, CORBAService::init executes ORB initialization, run does nothing - i.e. in this case CASL CORBA service works as API service. In case ClientOnly is false 1 run contains call of orb::run(), and is called in separate thread, accordingly requireThread returns true. Then CASL application becomes server and retrieves CORBA requests by network. Notice, for proper work of CORBA application within CASL it is necessary to set thread policy to multithreaded.

All service parameters are:

CORBA service specific methods

Accessing CORBA service from other CASL components

CORBA service CASL is available from other CASL-components by CORBAService name.

Here is typical code fragment to retrieve this service:

void MyService::initCORBA() throw(CASL::Exception)
   CASL::Service* srv = getServerContext().getService("CORBAService");
   corbaService_p_ = dynamic_cast<CASL::CORBAService*>(srv);
   if (corbaService_p_==NULL) {
     throw CASL::Exception("Can't load CORBA Service: bad service type");

Libraries and startup configuration

CORBA service is in the shared library with name like libCASL_CORBA_<ORB-name>.so, which depend on ORB supplied together with CASL : for instance -

Accordingly, if you are using CORBA service CASL, then it is necessary to load CORBA service before yours. The configuration file will look like following

<Service Name="CORBAService" Library="libCASL_CORBA_TAO">
  <name> ClientOnly </name>
  <value> false </value>
  <name> ORBArgs  </name>
<Service Name="MyService" Library="libCASL_My">
  my parameters.

Error messages list

- CORBA system exception occurs.

Changes list

  1. 12.02.2002 - created.


... false1
by default

next_inactive up previous