00001
00002
00003 #include "tao/DLL_Parser.h"
00004
00005 # if (TAO_HAS_DDL_PARSER == 1)
00006
00007 #include "tao/Object_Loader.h"
00008 #include "tao/Object.h"
00009 #include "tao/ORB_Constants.h"
00010 #include "tao/SystemException.h"
00011 #include "tao/ORB_Core.h"
00012
00013 #include "ace/Dynamic_Service.h"
00014 #include "ace/Log_Msg.h"
00015 #include "ace/OS_NS_string.h"
00016
00017 ACE_RCSID (tao,
00018 DLL_Parser,
00019 "$Id: DLL_Parser.cpp 79237 2007-08-07 09:48:21Z johnnyw $")
00020
00021 static const char dll_prefix[] = "DLL:";
00022
00023 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00024
00025 TAO_DLL_Parser::~TAO_DLL_Parser (void)
00026 {
00027 }
00028
00029
00030 bool
00031 TAO_DLL_Parser::match_prefix (const char *ior_string) const
00032 {
00033 return (ACE_OS::strncmp (ior_string,
00034 ::dll_prefix,
00035 sizeof (::dll_prefix) - 1) == 0);
00036 }
00037
00038 CORBA::Object_ptr
00039 TAO_DLL_Parser::parse_string (const char *ior,
00040 CORBA::ORB_ptr orb)
00041 {
00042
00043
00044 const char *name =
00045 ior + sizeof (::dll_prefix) - 1;
00046
00047 TAO_ORB_Core *oc = orb->orb_core ();
00048
00049 TAO_Object_Loader *loader =
00050 ACE_Dynamic_Service<TAO_Object_Loader>::instance
00051 (oc->configuration(), name);
00052
00053 if (loader == 0)
00054 {
00055 throw
00056 CORBA::INV_OBJREF
00057 (CORBA::SystemException::_tao_minor_code (
00058 0,
00059 EINVAL),
00060 CORBA::COMPLETED_NO);
00061 }
00062
00063 return loader->create_object (orb, 0, 0);
00064 }
00065
00066 TAO_END_VERSIONED_NAMESPACE_DECL
00067
00068 ACE_STATIC_SVC_DEFINE (TAO_DLL_Parser,
00069 ACE_TEXT ("DLL_Parser"),
00070 ACE_SVC_OBJ_T,
00071 &ACE_SVC_NAME (TAO_DLL_Parser),
00072 ACE_Service_Type::DELETE_THIS |
00073 ACE_Service_Type::DELETE_OBJ,
00074 0)
00075
00076
00077 ACE_FACTORY_DEFINE (TAO, TAO_DLL_Parser)
00078
00079 #endif