Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

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
Collaboration diagram for TAO_DLL_Parser:

Collaboration graph
List of all members.

Public Methods

 TAO_DLL_Parser (void)
 Constructor. More...

virtual ~TAO_DLL_Parser (void)
 The destructor. More...

virtual int match_prefix (const char *ior_string) const
 Return 1 if <ior_string> starts with a prefix known to this IOR parser. More...

virtual CORBA::Object_ptr parse_string (const char *ior, CORBA::ORB_ptr orb ACE_ENV_ARG_DECL_NOT_USED) 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:


the string_to_object() function will use ACE's Service Configurator to dynamically load the service named 'Service_Name'. 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 <object> 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 73 of file DLL_Parser.h.

Constructor & Destructor Documentation

ACE_INLINE TAO_DLL_Parser::TAO_DLL_Parser void   


Definition at line 4 of file DLL_Parser.i.

00005 {
00006 }

TAO_DLL_Parser::~TAO_DLL_Parser void    [virtual]

The destructor.

Definition at line 17 of file DLL_Parser.cpp.

00018 {
00019 }

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 24 of file DLL_Parser.cpp.

References dll_prefix, and ACE_OS_String::strncmp.

00025 {
00026   return (ACE_OS::strncmp (ior_string,
00027                            ::dll_prefix,
00028                            sizeof (::dll_prefix) - 1) == 0);
00029 }

CORBA::Object_ptr TAO_DLL_Parser::parse_string const char *    ior,
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 32 of file DLL_Parser.cpp.

References CORBA_SystemException::_tao_minor_code, ACE_ENV_ARG_DECL, ACE_ENV_ARG_PARAMETER, ACE_THROW_RETURN, TAO_Object_Loader::create_object, ACE_Dynamic_Service::instance, and TAO_DEFAULT_MINOR_CODE.

00036 {
00037   // Skip the prefix, we know it is there because this method in only
00038   // called if <match_prefix> returns 1.
00039   const char *name =
00040     ior + sizeof (::dll_prefix) - 1;
00042   TAO_Object_Loader *loader =
00043     ACE_Dynamic_Service<TAO_Object_Loader>::instance (name);
00045   if (loader == 0)
00046     {
00047       ACE_THROW_RETURN
00048         (CORBA::INV_OBJREF
00049          (CORBA_SystemException::_tao_minor_code (
00050             TAO_DEFAULT_MINOR_CODE,
00051             EINVAL),
00052           CORBA::COMPLETED_NO),
00053          CORBA::Object::_nil ());
00054     }
00056   return loader->create_object (orb, 0, 0 ACE_ENV_ARG_PARAMETER);
00057 }

The documentation for this class was generated from the following files:
Generated on Mon Jun 16 15:14:36 2003 for TAO by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002