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_NPIPolledProviderProxy.hpp"
00032 #include "NPIExternal.hpp"
00033 #include "OW_CIMClass.hpp"
00034 #include "OW_CIMException.hpp"
00035 #include "OW_Format.hpp"
00036 #include "OW_NPIProviderIFCUtils.hpp"
00037 #include "OW_CIMValue.hpp"
00038 #include "OW_CIMObjectPath.hpp"
00039 #include "OW_CIMParamValue.hpp"
00040 #include "OW_Logger.hpp"
00041 
00042 namespace OW_NAMESPACE
00043 {
00044 
00045 namespace
00046 {
00047    const String COMPONENT_NAME("ow.provider.npi.ifc");
00048 }
00049 
00051 NPIPolledProviderProxy::~NPIPolledProviderProxy()
00052 {
00053 }
00055 Int32
00056 NPIPolledProviderProxy::getInitialPollingInterval(
00057      const ProviderEnvironmentIFCRef& env)
00058 {
00059       OW_LOG_DEBUG(env->getLogger(COMPONENT_NAME), "NPIPolledProviderIFC::getInitialPollingInterval()");
00060    return 1;
00061 }
00062 Int32
00063 NPIPolledProviderProxy::poll(const ProviderEnvironmentIFCRef &env)
00064 {
00065    CIMValue rval(CIMNULL);
00066    OW_LOG_DEBUG(env->getLogger(COMPONENT_NAME), "NPIPolledProviderIFC::poll()");
00067    if (m_ftable->fp_mustPoll != NULL)
00068    {
00069       ::NPIHandle _npiHandle = { 0, 0, 0, 0, m_ftable->npicontext};
00070       NPIHandleFreer nhf(_npiHandle);
00071       ProviderEnvironmentIFCRef env2(env);
00072       _npiHandle.thisObject = static_cast<void *>(&env2);
00073       char * expo = const_cast<char*>("SourceInstance.PercentageSpaceUse 80");
00074       SelectExp exp = {expo};
00075       ::CIMObjectPath cop = {NULL};
00076       m_ftable->fp_mustPoll( &_npiHandle, exp, expo, cop);
00077       if (_npiHandle.errorOccurred)
00078       {
00079          OW_THROWCIMMSG(CIMException::FAILED,
00080             _npiHandle.providerError);
00081       }
00082    }
00083    return 0;
00084 }
00085 void NPIPolledProviderProxy::activateFilter(
00086    const ProviderEnvironmentIFCRef& env, const String& query,
00087    const String& Type)
00088 {
00089    OW_LOG_DEBUG(env->getLogger(COMPONENT_NAME), "activateFilter");
00090    if (m_ftable->fp_activateFilter != NULL)
00091    {
00092       OW_LOG_DEBUG(env->getLogger(COMPONENT_NAME), "activateFilter2");
00093       ::NPIHandle _npiHandle = { 0, 0, 0, 0, m_ftable->npicontext};
00094       NPIHandleFreer nhf(_npiHandle);
00095       ProviderEnvironmentIFCRef env2(env);
00096       _npiHandle.thisObject = static_cast<void *>(&env2);
00097       char * expo = query.allocateCString();
00098       char * _type = Type.allocateCString();
00099       SelectExp exp = {expo};
00100       ::CIMObjectPath cop = {NULL};
00101          m_ftable->fp_activateFilter( &_npiHandle, exp, _type, cop, 0);
00102       free(expo);
00103       free(_type);
00104       if (_npiHandle.errorOccurred)
00105       {
00106          OW_THROWCIMMSG(CIMException::FAILED,
00107             _npiHandle.providerError);
00108       }
00109    }
00110 }
00111 void NPIPolledProviderProxy::deactivateFilter(
00112    const ProviderEnvironmentIFCRef& env, const String& query,
00113    const String& Type)
00114 {
00115    OW_LOG_DEBUG(env->getLogger(COMPONENT_NAME), "deactivateFilter");
00116    if (m_ftable->fp_deActivateFilter != NULL)
00117    {
00118       ::NPIHandle _npiHandle = { 0, 0, 0, 0, m_ftable->npicontext};
00119       NPIHandleFreer nhf(_npiHandle);
00120       OW_LOG_DEBUG(env->getLogger(COMPONENT_NAME), "deactivateFilter2");
00121       ProviderEnvironmentIFCRef env2(env);
00122       _npiHandle.thisObject = static_cast<void *>(&env2);
00123       char * expo = query.allocateCString();
00124       char * _type = Type.allocateCString();
00125       SelectExp exp = {expo};
00126       ::CIMObjectPath cop = {NULL};
00127       char * type = NULL;
00128          m_ftable->fp_deActivateFilter( &_npiHandle, exp, _type, cop, 0);
00129       free(type);
00130       free(expo);
00131       if (_npiHandle.errorOccurred)
00132       {
00133          OW_THROWCIMMSG(CIMException::FAILED,
00134             _npiHandle.providerError);
00135       }
00136    }
00137 }
00138 
00139 } 
00140