00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file DLL_Parser.h 00006 * 00007 * $Id: DLL_Parser.h 79237 2007-08-07 09:48:21Z johnnyw $ 00008 * 00009 * @author Carlos O'Ryan (coryan@cs.wustl.edu) 00010 */ 00011 //============================================================================= 00012 00013 #ifndef TAO_DLL_PARSER_H 00014 #define TAO_DLL_PARSER_H 00015 00016 #include /**/ "ace/pre.h" 00017 #include "ace/Service_Config.h" 00018 00019 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00020 # pragma once 00021 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00022 00023 #include "tao/IOR_Parser.h" 00024 00025 #if (TAO_HAS_DDL_PARSER == 1) 00026 00027 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00028 00029 /** 00030 * @class TAO_DLL_Parser 00031 * 00032 * @brief Implment the parser for the DLL-style IORs. 00033 * 00034 * The DLL-style IORs allows applications to transparently load object 00035 * implementations. The ORB can parse an IOR in the format: 00036 * 00037 * DLL:Service_Name 00038 * 00039 * the string_to_object() function will use ACE's Service Configurator 00040 * framework to dynamically load the service named 'Service_Name' 00041 * using all the normal platform-independent naming conventions and 00042 * environment variable lookup rules that are normally used by @c 00043 * ACE_DLL::open(). The ORB assumes that this service implements the 00044 * TAO_Object_Loader interface, and uses that interface to create a 00045 * new object implementation locally. The object reference for this 00046 * local object is returned to the application. 00047 * 00048 * This can be used in applications that sometimes require local 00049 * object while other times they may use a remote implementation. 00050 * For example, the application could be configured to use a remote 00051 * Event Service or to dynamically load an Event Service 00052 * implementation and use the local copy instead. The local Event 00053 * Service would federate to its remote peers to work as-if a single 00054 * Event Service was in place. 00055 * 00056 * Such an application could be written as follows: 00057 * 00058 * int main (int argc, char* argv) 00059 * { 00060 * CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); 00061 * 00062 * CORBA::Object_var object = 00063 * orb->resolve_initial_references("EventService"); 00064 * // Use <object> here... 00065 * } 00066 * 00067 * if the application is invoked using: 00068 * 00069 * $ program -ORBInitRef EventService=IOR:.... 00070 * 00071 * then a remote event service is used, but the application could also 00072 * be invoked using: 00073 * 00074 * $ program -ORBInitRef EventService=DLL:Event_Service_Loader 00075 * 00076 * In this case the Event_Service implementation will be dynamically 00077 * loaded without any modifications to the application code. 00078 * 00079 */ 00080 class TAO_DLL_Parser : public TAO_IOR_Parser 00081 { 00082 public: 00083 00084 /// The destructor 00085 virtual ~TAO_DLL_Parser (void); 00086 00087 // = The IOR_Parser methods, please read the documentation in 00088 // IOR_Parser.h 00089 virtual bool match_prefix (const char *ior_string) const; 00090 virtual CORBA::Object_ptr parse_string (const char *ior, 00091 CORBA::ORB_ptr orb); 00092 }; 00093 00094 TAO_END_VERSIONED_NAMESPACE_DECL 00095 00096 ACE_STATIC_SVC_DECLARE_EXPORT (TAO, TAO_DLL_Parser) 00097 ACE_FACTORY_DECLARE (TAO, TAO_DLL_Parser) 00098 00099 #endif /* TAO_HAS_DDL_PARSER == 1 */ 00100 00101 #include /**/ "ace/post.h" 00102 #endif /* TAO_DLL_PARSER_H */