00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #include "OW_config.h"
00031 #include "OW_PerlIndicationProviderProxy.hpp"
00032 #include "NPIExternal.hpp"
00033 #include "OW_CIMException.hpp"
00034 #include "OW_Format.hpp"
00035 #include "OW_Logger.hpp"
00036 #include "OW_NPIProviderIFCUtils.hpp"
00037 #include "OW_WQLSelectStatement.hpp"
00038
00039 namespace OW_NAMESPACE
00040 {
00041
00042 namespace
00043 {
00044 const String COMPONENT_NAME("ow.provider.perlnpi.ifc");
00045 }
00046
00048 void
00049 PerlIndicationProviderProxy::deActivateFilter(
00050 const ProviderEnvironmentIFCRef& env,
00051 const WQLSelectStatement& filter,
00052 const String& eventType,
00053 const String& nameSpace,
00054 const StringArray& classes)
00055 {
00056 bool lastActivation = (--m_activationCount == 0);
00057 OW_LOG_DEBUG(env->getLogger(COMPONENT_NAME), "deactivateFilter");
00058 if (m_ftable->fp_deActivateFilter != NULL)
00059 {
00060 ::NPIHandle _npiHandle = { 0, 0, 0, 0, m_ftable->npicontext};
00061
00062 NPIHandleFreer nhf(_npiHandle);
00063 OW_LOG_DEBUG(env->getLogger(COMPONENT_NAME), "deactivateFilter");
00064 ProviderEnvironmentIFCRef env2(env);
00065 _npiHandle.thisObject = static_cast<void *>(&env2);
00066
00067
00068
00069
00070 SelectExp exp;
00071 ::CIMObjectPath cop;
00072 m_ftable->fp_deActivateFilter( &_npiHandle, exp, eventType.c_str(), cop, lastActivation);
00073 if (_npiHandle.errorOccurred)
00074 {
00075 OW_THROWCIMMSG(CIMException::FAILED,
00076 _npiHandle.providerError);
00077 }
00078 }
00079 }
00081 void
00082 PerlIndicationProviderProxy::activateFilter(
00083 const ProviderEnvironmentIFCRef& env,
00084 const WQLSelectStatement& filter,
00085 const String& eventType,
00086 const String& nameSpace,
00087 const StringArray& classes)
00088 {
00089 bool firstActivation = (m_activationCount++ == 0);
00090 OW_LOG_DEBUG(env->getLogger(COMPONENT_NAME), "activateFilter");
00091 if (m_ftable->fp_activateFilter != NULL)
00092 {
00093 OW_LOG_DEBUG(env->getLogger(COMPONENT_NAME), "activateFilter2");
00094 ::NPIHandle _npiHandle = { 0, 0, 0, 0, m_ftable->npicontext};
00095 NPIHandleFreer nhf(_npiHandle);
00096 ProviderEnvironmentIFCRef env2(env);
00097 _npiHandle.thisObject = static_cast<void *>(&env2);
00098
00099
00100
00101
00102 SelectExp exp;
00103 ::CIMObjectPath cop;
00104 m_ftable->fp_activateFilter( &_npiHandle, exp, eventType.c_str(), cop, firstActivation);
00105 if (_npiHandle.errorOccurred)
00106 {
00107 OW_THROWCIMMSG(CIMException::FAILED,
00108 _npiHandle.providerError);
00109 }
00110 }
00111 }
00113 void
00114 PerlIndicationProviderProxy::authorizeFilter(
00115 const ProviderEnvironmentIFCRef& env,
00116 const WQLSelectStatement& filter,
00117 const String& eventType,
00118 const String& nameSpace,
00119 const StringArray& classes,
00120 const String& owner)
00121 {
00122 OW_LOG_DEBUG(env->getLogger(COMPONENT_NAME), "authorizeFilter");
00123 if (m_ftable->fp_authorizeFilter != NULL)
00124 {
00125 ::NPIHandle _npiHandle = { 0, 0, 0, 0, m_ftable->npicontext};
00126
00127 NPIHandleFreer nhf(_npiHandle);
00128 OW_LOG_DEBUG(env->getLogger(COMPONENT_NAME), "authorizeFilter2");
00129 ProviderEnvironmentIFCRef env2(env);
00130 _npiHandle.thisObject = static_cast<void *>(&env2);
00131
00132
00133
00134
00135 SelectExp exp;
00136 ::CIMObjectPath cop;
00137 m_ftable->fp_authorizeFilter( &_npiHandle, exp, eventType.c_str(), cop, owner.c_str());
00138 if (_npiHandle.errorOccurred)
00139 {
00140 OW_THROWCIMMSG(CIMException::FAILED,
00141 _npiHandle.providerError);
00142 }
00143 }
00144 }
00146 int
00147 PerlIndicationProviderProxy::mustPoll(
00148 const ProviderEnvironmentIFCRef& env,
00149 const WQLSelectStatement& filter,
00150 const String& eventType,
00151 const String& nameSpace,
00152 const StringArray& classes)
00153 {
00154 OW_LOG_DEBUG(env->getLogger(COMPONENT_NAME), "mustPoll");
00155 if (m_ftable->fp_mustPoll != NULL)
00156 {
00157 ::NPIHandle _npiHandle = { 0, 0, 0, 0, m_ftable->npicontext};
00158 NPIHandleFreer nhf(_npiHandle);
00159 OW_LOG_DEBUG(env->getLogger(COMPONENT_NAME), "mustPoll2");
00160 ProviderEnvironmentIFCRef env2(env);
00161 _npiHandle.thisObject = static_cast<void *>(&env2);
00162
00163
00164
00165
00166 SelectExp exp;
00167 ::CIMObjectPath cop;
00168 int rval = m_ftable->fp_mustPoll( &_npiHandle, exp, eventType.c_str(), cop);
00169 if (_npiHandle.errorOccurred)
00170 {
00171 OW_THROWCIMMSG(CIMException::FAILED,
00172 _npiHandle.providerError);
00173 }
00174
00175
00176
00177 if (rval > 0)
00178 {
00179 return 5 * 60;
00180 }
00181 }
00182 return 0;
00183 }
00184
00185 }
00186