• 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.9 2011/10/16 08:32:32 hsommer 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, ACE_CString& type, PortableServer::POA_ptr poa, CORBA::ORB_ptr orb) :
00040         ContainerServices(compName, poa), m_orb(CORBA::ORB::_duplicate(orb))
00041         {
00042                 m_componentType = ACE_CString(type);
00043         }
00044     
00045   protected:
00049     virtual CORBA::Object* getCORBAComponent(const char* name)
00050         {
00051             return (CORBA::Object*)0;
00052         }
00053 
00060     virtual CORBA::Object* getCORBADynamicComponent(maci::ComponentSpec compSpec, bool markAsDefault)
00061         {
00062             return (CORBA::Object*)0;
00063         }
00064 
00069     virtual CORBA::Object* getCORBADefaultComponent(const char* idlType)
00070         {
00071             return (CORBA::Object*)0;
00072         }
00073 
00080     virtual CORBA::Object* getCORBACollocatedComponent(maci::ComponentSpec, bool, const char*)
00081         {
00082             return (CORBA::Object*)0;
00083         }
00084 
00088         CORBA::Object* getCORBAComponentNonSticky(const char*)
00089         {
00090             return (CORBA::Object*)NULL;
00091         }
00092         
00093 
00094 
00095   public:
00099     virtual maci::ComponentInfo getComponentDescriptor(const char* componentName)
00100         {
00101             maci::ComponentInfo retVal;
00102             return retVal;
00103         }
00104 
00105     virtual ACE_CString_Vector findComponents(const char *nameWilcard, const char *typeWildcard)
00106         {
00107             ACE_CString_Vector retVal;
00108             return retVal;
00109         }
00110 
00114     virtual void releaseComponent(const char *name)
00115         {}
00116 
00117     virtual void releaseAllComponents()
00118         {}
00119 
00123     virtual CDB::DAL_ptr getCDB() 
00124         {
00125 
00126             ACE_TCHAR corbalocRef[230];
00127             ACE_TCHAR * envRef = ACE_OS::getenv ("DAL_REFERENCE");
00128 
00129             if (envRef && *envRef)
00130                 {
00131                 ACS_LOG(0, "TestContainerServices::getCDB",
00132                         (LM_INFO, "CDB obtained via environment: '%s'", envRef));
00133                 strcpy(corbalocRef, envRef);
00134                 }
00135         else
00136             {
00137             // corbaloc::<hostname>:<port>/CDB
00138             const char* hostname = 0;
00139             hostname = ACSPorts::getIP();
00140             if (hostname==0)
00141                 return (CDB::DAL *)0;
00142             
00143           
00144             ACE_OS::sprintf(corbalocRef, "corbaloc::%s:%s/CDB", hostname, ACSPorts::getCDBPort().c_str());
00145 
00146             ACS_LOG(0, "TestContainerServices::getCDB",
00147                     (LM_INFO, "CDB reference generated using localhost address: '%s'", corbalocRef));
00148             }//if-than
00149 
00150         CDB::DAL_var dalObj = CDB::DAL::_nil();
00151         CORBA::Object_var obj = m_orb->string_to_object(corbalocRef);
00152   
00153         if (!CORBA::is_nil(obj.in()))
00154             {
00155             dalObj = CDB::DAL::_narrow(obj.in());
00156             if (CORBA::is_nil(dalObj.in())) 
00157                 {
00158                 ACS_SHORT_LOG((LM_INFO, "TestContainerServices::getCDB() - Failed to narrow CDB"));
00159                 return (CDB::DAL *)0;
00160                 }
00161             }
00162         
00163         return dalObj._retn();
00164         }
00165 
00166     virtual PortableServer::POA_var getOffShootPOA()
00167         {
00168             PortableServer::POA_var retVal;
00169             return retVal;
00170         }
00171 
00176     virtual void deactivateOffShoot(PortableServer::Servant cbServant)
00177         {;}
00178 
00179     virtual PortableServer::POA_var createOffShootPOA()
00180         {
00181             PortableServer::POA_var retVal;
00182             return retVal;
00183         }
00184 
00185     virtual ACS::OffShoot_ptr activateOffShoot(PortableServer::Servant cbServant)
00186         {
00187             return (ACS::OffShoot *)0;
00188         }
00189  
00190     virtual maci::ComponentStateManager* getComponentStateManager()
00191     {
00192         return (maci::ComponentStateManager*)NULL;
00193     }
00194 
00195     virtual acsalarm::AlarmSource* getAlarmSource()
00196     {
00197         return NULL;
00198     }
00199 
00200 };

Generated on Thu Jan 12 2012 23:13:50 for ACS-10.0 C++ API by  doxygen 1.7.0