00001 #ifndef ACSNC_HELPER_H 00002 #define ACSNC_HELPER_H 00003 /******************************************************************************* 00004 * ALMA - Atacama Large Millimiter Array 00005 * (c) Associated Universities Inc., 2002 00006 * (c) European Southern Observatory, 2002 00007 * Copyright by ESO (in the framework of the ALMA collaboration) 00008 * and Cosylab 2002, All rights reserved 00009 * 00010 * This library is free software; you can redistribute it and/or 00011 * modify it under the terms of the GNU Lesser General Public 00012 * License as published by the Free Software Foundation; either 00013 * version 2.1 of the License, or (at your option) any later version. 00014 * 00015 * This library is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 * Lesser General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU Lesser General Public 00021 * License along with this library; if not, write to the Free Software 00022 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00023 * 00024 * "@(#) $Id: acsncHelper.h,v 1.74 2010/02/22 18:31:17 javarias Exp $" 00025 * 00026 * who when what 00027 * -------- -------- ---------------------------------------------- 00028 * david 20/09/02 created 00029 */ 00030 00031 /************************************************************************ 00032 * 00033 *---------------------------------------------------------------------- 00034 */ 00035 00036 #ifndef __cplusplus 00037 #error This is a C++ include file and cannot be used from plain C 00038 #endif 00039 00040 #include <orbsvcs/CosNamingC.h> 00041 #include <orbsvcs/CosNotifyChannelAdminS.h> 00042 #include <orbsvcs/CosNotifyCommC.h> 00043 #include <orbsvcs/CosNotifyFilterC.h> 00044 #include <orbsvcs/CosNotificationC.h> 00045 #include <orbsvcs/Notify/MonitorControlExt/NotifyMonitoringExtC.h> 00046 00047 #include "acsncS.h" 00048 #include "acsncC.h" 00049 #include "acsncORBHelper.h" 00050 #include "acsncCDBProperties.h" 00051 #include "acsncReconnectionCallback.h" 00052 00053 #include <basencHelper.h> 00054 00055 #include <ACSErrTypeCommon.h> 00056 00057 00067 #define ACSNC_STRING_MACRO(something) #something 00068 00069 namespace nc { 00070 00071 class ReconnectionCallback; 00072 00082 class Helper 00083 { 00084 public: 00093 Helper(const char* channelName, const char* acsNCDomainName = 0); 00094 00110 void 00111 resolveNamingService(CORBA::ORB_ptr orb_mp); 00112 00122 bool 00123 resolveNotifyChannel(); 00124 00132 bool resolveInternalNotificationChannel(); 00133 00143 static char * 00144 extractStructName(const char* idlStruct); 00145 00154 virtual std::string createRandomizedClientName(const std::string& clientName); 00155 00165 virtual void reconnect(::NotifyMonitoringExt::EventChannelFactory *ecf); 00166 00172 inline virtual std::string getCombinedChannelAndDomainName() const 00173 { 00174 return channelAndDomainName_m; 00175 } 00176 00177 protected: 00189 virtual const char* 00190 getChannelKind(); 00191 00202 virtual const char* 00203 getChannelDomain(); 00204 00210 virtual const char* 00211 getNotificationFactoryName() 00212 { 00213 if (!notificationServiceName_mp) 00214 { 00215 CDB::DAL_var dal = CDBProperties::getCDB(); 00216 notificationServiceName_mp = BaseHelper::getNotificationFactoryNameForChannel(dal.in(), channelName_mp, acsNCDomainName_mp); 00217 if (!notificationServiceName_mp) 00218 notificationServiceName_mp = CORBA::string_dup(acscommon::NOTIFICATION_FACTORY_NAME); 00219 } 00220 00221 return notificationServiceName_mp; 00222 } 00223 00224 00225 00235 virtual void 00236 resolveNotificationFactory(); 00237 00249 virtual void 00250 createNotificationChannel(); 00251 00255 virtual ~Helper(); 00256 00266 virtual const CosNotification::QoSProperties 00267 getQoSProps(); 00268 00278 virtual const CosNotification::AdminProperties 00279 getAdminProps(); 00280 00281 00285 CosNaming::NamingContext_var namingContext_m; 00286 00292 CosNotifyChannelAdmin::EventChannel_var notifyChannel_m; 00293 00300 CosNotifyChannelAdmin::InterFilterGroupOperator ifgop_m; 00301 00305 char *channelName_mp; 00306 00310 char *acsNCDomainName_mp; 00311 00315 std::string channelAndDomainName_m; 00316 00320 char *notificationServiceName_mp; 00321 00325 ORBHelper *orbHelper_mp; 00326 00327 00333 NotifyMonitoringExt::EventChannelFactory_var notifyFactory_m; 00334 00341 CosNotifyChannelAdmin::EventChannelFactory_var notifyFactoryOld_m; 00342 00347 CosNotifyChannelAdmin::ChannelID channelID_m; 00348 00349 00354 void 00355 integrationLog(const std::string& log); 00356 00357 ReconnectionCallback *callback_m; 00358 00359 private: 00360 00364 void operator=(const Helper&); 00365 00369 Helper(const Helper&); 00370 00375 bool okToLog_m; 00376 }; 00377 }; 00378 00379 #endif