Adapter_Activator.cpp

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //=============================================================================
00003 /**
00004  *  @file   Adapter_Activator.cpp
00005  *
00006  *  $Id: Adapter_Activator.cpp 77020 2007-02-12 13:56:49Z johnnyw $
00007  *
00008  *  @author Darrell Brunsch <brunsch@cs.wustl.edu>
00009  */
00010 //=============================================================================
00011 
00012 #include "Adapter_Activator.h"
00013 
00014 #include "ace/Log_Msg.h"
00015 
00016 ImR_Adapter::ImR_Adapter (void)
00017 : servant_locator_ (0)
00018 {
00019 }
00020 
00021 void
00022 ImR_Adapter::init (PortableServer::ServantLocator_ptr servant)
00023 {
00024   servant_locator_ = servant;
00025 }
00026 
00027 CORBA::Boolean
00028 ImR_Adapter::unknown_adapter (PortableServer::POA_ptr parent,
00029                                         const char *name)
00030 {
00031   ACE_ASSERT (! CORBA::is_nil(parent));
00032   ACE_ASSERT (name != 0);
00033   CORBA::PolicyList policies (2);
00034   policies.length (2);
00035 
00036   const char *exception_message = "Null Message";
00037 
00038   try
00039     {
00040       // Servant Retention Policy
00041       exception_message = "While PortableServer::POA::create_servant_retention_policy";
00042       policies[0] =
00043         parent->create_servant_retention_policy (PortableServer::NON_RETAIN);
00044 
00045       // Request Processing Policy
00046       exception_message = "While PortableServer::POA::create_request_processing_policy";
00047       policies[1] =
00048         parent->create_request_processing_policy (PortableServer::USE_SERVANT_MANAGER);
00049 
00050       PortableServer::POAManager_var poa_manager =
00051         parent->the_POAManager ();
00052 
00053       exception_message = "While create_POA";
00054       PortableServer::POA_var child =
00055         parent->create_POA (name,
00056                             poa_manager.in (),
00057                             policies);
00058 
00059       exception_message = "While unknown_adapter::policy->destroy";
00060       for (CORBA::ULong i = 0; i < policies.length (); ++i)
00061         {
00062           CORBA::Policy_ptr policy = policies[i];
00063           policy->destroy ();
00064         }
00065 
00066       exception_message = "While child->the_activator";
00067       child->the_activator (this);
00068 
00069       exception_message = "While unknown_adapter, set_servant_manager";
00070       child->set_servant_manager (this->servant_locator_);
00071     }
00072   catch (const CORBA::Exception& ex)
00073     {
00074       ACE_ERROR ((LM_ERROR,
00075                   "IMR_Adapter_Activator::unknown_adapter - %s\n",
00076                   exception_message));
00077       ex._tao_print_exception ("System Exception");
00078       return 0;
00079     }
00080 
00081   // Finally, now everything is fine
00082   return 1;
00083 }
00084 

Generated on Sun Jan 27 15:54:50 2008 for TAO_Implementation_Repository by doxygen 1.3.6