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* notifyServiceDomainName = 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 00155 virtual void reconnect(::NotifyMonitoringExt::EventChannelFactory *ecf); 00156 00157 00158 00159 protected: 00171 virtual const char* 00172 getChannelKind(); 00173 00184 virtual const char* 00185 getChannelDomain(); 00186 00192 virtual const char* 00193 getNotificationFactoryName() 00194 { 00195 if (!notificationServiceName_mp) 00196 { 00197 CDB::DAL_var dal = CDBProperties::getCDB(); 00198 notificationServiceName_mp = BaseHelper::getNotificationFactoryNameForChannel(dal.in(), channelName_mp, notifyServiceDomainName_mp); 00199 if (!notificationServiceName_mp) 00200 notificationServiceName_mp = CORBA::string_dup(acscommon::NOTIFICATION_FACTORY_NAME); 00201 } 00202 00203 return notificationServiceName_mp; 00204 } 00205 00206 00207 00217 virtual void 00218 resolveNotificationFactory(); 00219 00231 virtual void 00232 createNotificationChannel(); 00233 00237 virtual ~Helper(); 00238 00248 virtual const CosNotification::QoSProperties 00249 getQoSProps(); 00250 00260 virtual const CosNotification::AdminProperties 00261 getAdminProps(); 00262 00263 00267 CosNaming::NamingContext_var namingContext_m; 00268 00274 CosNotifyChannelAdmin::EventChannel_var notifyChannel_m; 00275 00282 CosNotifyChannelAdmin::InterFilterGroupOperator ifgop_m; 00283 00287 char *channelName_mp; 00288 00289 00293 char *notifyServiceDomainName_mp; 00294 00298 char *notificationServiceName_mp; 00299 00303 ORBHelper *orbHelper_mp; 00304 00305 00311 NotifyMonitoringExt::EventChannelFactory_var notifyFactory_m; 00312 00319 CosNotifyChannelAdmin::EventChannelFactory_var notifyFactoryOld_m; 00320 00325 CosNotifyChannelAdmin::ChannelID channelID_m; 00326 00327 00332 void 00333 integrationLog(const std::string& log); 00334 00335 ReconnectionCallback *callback_m; 00336 00337 private: 00338 00342 void operator=(const Helper&); 00343 00347 Helper(const Helper&); 00348 00353 bool okToLog_m; 00354 }; 00355 }; 00356 00357 #endif