Example #1
0
    //------------------------------------------------------
    CDB::DAL_ptr
    CDBProperties::getCDB()
    {
	//initialize return value to 0
	CDB::DAL_var retVal = 0;
	
	// TODO (?): Store the CDB reference in a static field to optimize
	
	//use a nice little trick to get at the CDB reference
	if ((maci::ContainerImpl::getContainer() != 0) && 
	    (maci::ContainerImpl::getContainer()->getContainerCORBAProxy() != maci::Container::_nil()))
	    {
	    retVal = maci::ContainerImpl::getContainer()->getService<CDB::DAL>("CDB", 
									 0, 
									 true);
	    }
	else
	    {
			if (maci::SimpleClient::getInstance() != 0)
			{
				retVal = maci::SimpleClient::getInstance()->getContainerServices()->getCDB();
			}
			else
			{		
		    	ACS_STATIC_SHORT_LOG((LM_ERROR,
						 "CDBProperties::getCDB",
						 "Container and SimpleClient refs null."));
			}
		}
	return retVal._retn();
    }
Example #2
0
CDB::DAL_ptr
MACIContainerServices::getCDB()
{
  CDB::DAL_var dalObj = CDB::DAL::_nil();
  ACS_TRACE("MACIContainerServices::getCDB");

  try
      {
      //bje: for some reason this should be done using get_component ....
      // ... and not get_service/getService
      CORBA::Object_var obj = m_manager->get_component(m_componentHandle, "CDB", false);
      dalObj = CDB::DAL::_narrow(obj.in());
      return dalObj._retn();   //bje: I do not know if this is OK, ...
      // ... since getCDB is local and not CORBA call so differen MM
      }
  catch (maciErrType::NoPermissionEx &ex)
      {
      throw CanNotGetCDBExImpl (ex, __FILE__, __LINE__,
				"MACIContainerServices::getCDB");
      }
  catch (maciErrType::CannotGetComponentEx &ex)
      {
      throw CanNotGetCDBExImpl (ex, __FILE__, __LINE__,
				"MACIContainerServices::getCDB");
      }
  catch( maciErrType::ComponentConfigurationNotFoundEx &ex)
      {
      throw CanNotGetCDBExImpl (ex, __FILE__, __LINE__,
				"MACIContainerServices::getCDB");
      }
  catch( CORBA::SystemException &ex )
      {
      ACSErrTypeCommon::CORBAProblemExImpl corbaProblemEx(__FILE__, __LINE__,
							  "MACIContainerServices::getCDB");
      corbaProblemEx.setMinor(ex.minor());
      corbaProblemEx.setCompletionStatus(ex.completed());
      corbaProblemEx.setInfo(ex._info().c_str());

      throw CanNotGetCDBExImpl (corbaProblemEx, __FILE__, __LINE__,
				"MACIContainerServices::getCDB");
      }
  catch (...)
      {
      ACSErrTypeCommon::UnexpectedExceptionExImpl uex(__FILE__, __LINE__,
						      "MACIContainerServices::getCDB");
      throw CanNotGetCDBExImpl (uex, __FILE__, __LINE__,
				"MACIContainerServices::getCDB");
      }//try-catch
}//getCDB