TAO_DLL_Parser Class Reference

Implment the parser for the DLL-style IORs. More...

#include <DLL_Parser.h>

Inheritance diagram for TAO_DLL_Parser:

Inheritance graph
[legend]
Collaboration diagram for TAO_DLL_Parser:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual ~TAO_DLL_Parser (void)
 The destructor.

virtual int match_prefix (const char *ior_string) const
virtual CORBA::Object_ptr parse_string (const char *ior, CORBA::ORB_ptr orb) throw (CORBA::SystemException)

Detailed Description

Implment the parser for the DLL-style IORs.

The DLL-style IORs allows applications to transparently load object implementations. The ORB can parse an IOR in the format:

DLL:Service_Name

the string_to_object() function will use ACE's Service Configurator framework to dynamically load the service named 'Service_Name' using all the normal platform-independent naming conventions and environment variable lookup rules that are normally used by ACE_DLL::open(). The ORB assumes that this service implements the TAO_Object_Loader interface, and uses that interface to create a new object implementation locally. The object reference for this local object is returned to the application.

This can be used in applications that sometimes require local object while other times they may use a remote implementation. For example, the application could be configured to use a remote Event Service or to dynamically load an Event Service implementation and use the local copy instead. The local Event Service would federate to its remote peers to work as-if a single Event Service was in place.

Such an application could be written as follows:

int main (int argc, char* argv) { CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);

CORBA::Object_var object = orb->resolve_initial_references("EventService"); // Use here... }

if the application is invoked using:

$ program -ORBInitRef EventService=IOR:....

then a remote event service is used, but the application could also be invoked using:

$ program -ORBInitRef EventService=DLL:Event_Service_Loader

In this case the Event_Service implementation will be dynamically loaded without any modifications to the application code.

Definition at line 78 of file DLL_Parser.h.


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_DLL_Parser::~TAO_DLL_Parser void   )  [virtual]
 

The destructor.

Definition at line 24 of file DLL_Parser.cpp.

00025 {
00026 }


Member Function Documentation

int TAO_DLL_Parser::match_prefix const char *  ior_string  )  const [virtual]
 

Return 1 if ior_string starts with a prefix known to this IOR parser

Implements TAO_IOR_Parser.

Definition at line 30 of file DLL_Parser.cpp.

References dll_prefix, and ACE_OS::strncmp().

00031 {
00032   return (ACE_OS::strncmp (ior_string,
00033                            ::dll_prefix,
00034                            sizeof (::dll_prefix) - 1) == 0);
00035 }

CORBA::Object_ptr TAO_DLL_Parser::parse_string const char *  ior,
CORBA::ORB_ptr  orb
throw (CORBA::SystemException) [virtual]
 

Parse the ior argument and return an object reference. The call may raise the standard system exceptions (NO_MEMORY, INV_OBJREF, etc.)

Implements TAO_IOR_Parser.

Definition at line 38 of file DLL_Parser.cpp.

References CORBA::Object::_nil(), CORBA::SystemException::_tao_minor_code(), ACE_ENV_ARG_PARAMETER, ACE_THROW_RETURN, TAO_ORB_Core::configuration(), TAO_Object_Loader::create_object(), and CORBA::ORB_ptr.

00042 {
00043   // Skip the prefix, we know it is there because this method in only
00044   // called if <match_prefix> returns 1.
00045   const char *name =
00046     ior + sizeof (::dll_prefix) - 1;
00047 
00048   TAO_ORB_Core *oc = orb->orb_core ();
00049 
00050   TAO_Object_Loader *loader =
00051     ACE_Dynamic_Service<TAO_Object_Loader>::instance
00052       (oc->configuration(), name);
00053 
00054   if (loader == 0)
00055     {
00056       ACE_THROW_RETURN
00057         (CORBA::INV_OBJREF
00058          (CORBA::SystemException::_tao_minor_code (
00059             0,
00060             EINVAL),
00061           CORBA::COMPLETED_NO),
00062          CORBA::Object::_nil ());
00063     }
00064 
00065   return loader->create_object (orb, 0, 0 ACE_ENV_ARG_PARAMETER);
00066 }


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 12:13:36 2006 for TAO by doxygen 1.3.6