• Classes
  • Modules
  • Namespaces
  • Files
  • Related Pages
  • File List
  • File Members

baciTestContainerServices.h

Go to the documentation of this file.
00001 /*******************************************************************************
00002 *    ALMA - Atacama Large Millimiter Array
00003 *    (c) European Southern Observatory, 2002
00004 *    Copyright by ESO (in the framework of the ALMA collaboration),
00005 *    All rights reserved
00006 *
00007 *    This library is free software; you can redistribute it and/or
00008 *    modify it under the terms of the GNU Lesser General Public
00009 *    License as published by the Free Software Foundation; either
00010 *    version 2.1 of the License, or (at your option) any later version.
00011 *
00012 *    This library is distributed in the hope that it will be useful,
00013 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015 *    Lesser General Public License for more details.
00016 *
00017 *    You should have received a copy of the GNU Lesser General Public
00018 *    License along with this library; if not, write to the Free Software
00019 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
00020 *
00021 * "@(#) $Id: baciTestContainerServices.h,v 1.7 2008/10/09 06:18:16 cparedes Exp $"
00022 *
00023 * who       when      what
00024 * --------  --------  ----------------------------------------------
00025 */
00026  
00027 #include <vltPort.h>
00028 #include <acsutil.h> 
00029 #include <acsutilPorts.h>
00030 
00031 #include <acsContainerServices.h>
00032 
00033 //--------------------------------------
00034 class TestContainerServices : public virtual maci::ContainerServices
00035 {
00036   public:
00037     CORBA::ORB_var m_orb;
00038 
00039     TestContainerServices(ACE_CString& compName, PortableServer::POA_ptr poa, CORBA::ORB_ptr orb) :
00040         ContainerServices(compName, poa), m_orb(CORBA::ORB::_duplicate(orb))
00041         {;}
00042     
00043   protected:
00047     virtual CORBA::Object* getCORBAComponent(const char* name)
00048         {
00049             return (CORBA::Object*)0;
00050         }
00051 
00058     virtual CORBA::Object* getCORBADynamicComponent(maci::ComponentSpec compSpec, bool markAsDefault)
00059         {
00060             return (CORBA::Object*)0;
00061         }
00062 
00067     virtual CORBA::Object* getCORBADefaultComponent(const char* idlType)
00068         {
00069             return (CORBA::Object*)0;
00070         }
00071 
00078     virtual CORBA::Object* getCORBACollocatedComponent(maci::ComponentSpec, bool, const char*)
00079         {
00080             return (CORBA::Object*)0;
00081         }
00082 
00086         CORBA::Object* getCORBAComponentNonSticky(const char*)
00087         {
00088             return (CORBA::Object*)NULL;
00089         }
00090         
00091 
00092 
00093   public:
00097     virtual maci::ComponentInfo getComponentDescriptor(const char* componentName)
00098         {
00099             maci::ComponentInfo retVal;
00100             return retVal;
00101         }
00102 
00103     virtual ACE_CString_Vector findComponents(const char *nameWilcard, const char *typeWildcard)
00104         {
00105             ACE_CString_Vector retVal;
00106             return retVal;
00107         }
00108 
00112     virtual void releaseComponent(const char *name)
00113         {}
00114 
00115     virtual void releaseAllComponents()
00116         {}
00117 
00121     virtual CDB::DAL_ptr getCDB() 
00122         {
00123 
00124             ACE_TCHAR corbalocRef[230];
00125             ACE_TCHAR * envRef = ACE_OS::getenv ("DAL_REFERENCE");
00126 
00127             if (envRef && *envRef)
00128                 {
00129                 ACS_LOG(0, "TestContainerServices::getCDB",
00130                         (LM_INFO, "CDB obtained via environment: '%s'", envRef));
00131                 strcpy(corbalocRef, envRef);
00132                 }
00133         else
00134             {
00135             // corbaloc::<hostname>:<port>/CDB
00136             const char* hostname = 0;
00137             hostname = ACSPorts::getIP();
00138             if (hostname==0)
00139                 return (CDB::DAL *)0;
00140             
00141           
00142             ACE_OS::sprintf(corbalocRef, "corbaloc::%s:%s/CDB", hostname, ACSPorts::getCDBPort().c_str());
00143 
00144             ACS_LOG(0, "TestContainerServices::getCDB",
00145                     (LM_INFO, "CDB reference generated using localhost address: '%s'", corbalocRef));
00146             }//if-than
00147 
00148         CDB::DAL_var dalObj = CDB::DAL::_nil();
00149         CORBA::Object_var obj = m_orb->string_to_object(corbalocRef);
00150   
00151         if (!CORBA::is_nil(obj.in()))
00152             {
00153             dalObj = CDB::DAL::_narrow(obj.in());
00154             if (CORBA::is_nil(dalObj.in())) 
00155                 {
00156                 ACS_SHORT_LOG((LM_INFO, "TestContainerServices::getCDB() - Failed to narrow CDB"));
00157                 return (CDB::DAL *)0;
00158                 }
00159             }
00160         
00161         return dalObj._retn();
00162         }
00163 
00164     virtual PortableServer::POA_var getOffShootPOA()
00165         {
00166             PortableServer::POA_var retVal;
00167             return retVal;
00168         }
00169 
00174     virtual void deactivateOffShoot(PortableServer::Servant cbServant)
00175         {;}
00176 
00177     virtual PortableServer::POA_var createOffShootPOA()
00178         {
00179             PortableServer::POA_var retVal;
00180             return retVal;
00181         }
00182 
00183     virtual ACS::OffShoot_ptr activateOffShoot(PortableServer::Servant cbServant)
00184         {
00185             return (ACS::OffShoot *)0;
00186         }
00187  
00188     virtual maci::ComponentStateManager* getComponentStateManager()
00189     {
00190       return (maci::ComponentStateManager*)NULL;
00191     }
00192 };

Generated on Thu Jul 8 2010 19:47:47 for ACS-9.0 C++ API by  doxygen 1.7.0