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
00035 #include "OW_config.h"
00036 #include "OW_IndicationRepLayerImpl.hpp"
00037 #include "OW_Format.hpp"
00038 #include "OW_CIMProperty.hpp"
00039 #include "OW_CIMParameter.hpp"
00040 #include "OW_CIMException.hpp"
00041 #include "OW_CIMNameSpace.hpp"
00042 #include "OW_CIMMethod.hpp"
00043 #include "OW_CIMParamValue.hpp"
00044 #include "OW_CIMClass.hpp"
00045 #include "OW_CIMInstance.hpp"
00046 #include "OW_CIMObjectPath.hpp"
00047 #include "OW_IndicationRepLayerMediator.hpp"
00048 #include "OW_CIMOMEnvironment.hpp"
00049 #include "OW_CIMValue.hpp"
00050 #include "OW_CIMQualifierType.hpp"
00051 #include "OW_Logger.hpp"
00052 #include "OW_ServiceIFCNames.hpp"
00053 #include "OW_CIMDateTime.hpp"
00054
00055 namespace OW_NAMESPACE
00056 {
00057
00058 namespace
00059 {
00060 const String COMPONENT_NAME("ow.owcimomd.indication.LifecycleCreator");
00061 }
00062
00063 using namespace WBEMFlags;
00065 IndicationRepLayer::~IndicationRepLayer()
00066 {
00067 }
00069 IndicationRepLayerImpl::~IndicationRepLayerImpl()
00070 {
00071 }
00073 String
00074 IndicationRepLayerImpl::getName() const
00075 {
00076 return ServiceIFCNames::IndicationRepLayer;
00077 }
00079 CIMInstance
00080 IndicationRepLayerImpl::getInstance(
00081 const String& ns,
00082 const CIMObjectPath& instanceName,
00083 ELocalOnlyFlag localOnly, EIncludeQualifiersFlag includeQualifiers, EIncludeClassOriginFlag includeClassOrigin,
00084 const StringArray* propertyList, OperationContext& context)
00085 {
00086 CIMInstance theInst = m_pServer->getInstance(ns, instanceName, localOnly,
00087 includeQualifiers, includeClassOrigin, propertyList, context);
00088
00089 if (m_pEnv->getIndicationRepLayerMediator()->getInstReadSubscriptionCount() > 0)
00090 {
00091 try
00092 {
00093 CIMInstance expInst("CIM_InstRead");
00094 expInst.setProperty("SourceInstance", CIMValue(theInst));
00095 expInst.setProperty("IndicationTime", CIMValue(CIMDateTime(DateTime::getCurrent())));
00096 exportIndication(expInst, ns);
00097 }
00098 catch (CIMException&)
00099 {
00100 OW_LOG_DEBUG(m_pEnv->getLogger(COMPONENT_NAME), "Unable to export indication for getInstance"
00101 " because CIM_InstRead does not exist");
00102 }
00103 }
00104 return theInst;
00105 }
00107 CIMValue
00108 IndicationRepLayerImpl::invokeMethod(
00109 const String& ns,
00110 const CIMObjectPath& path,
00111 const String& methodName, const CIMParamValueArray& inParams,
00112 CIMParamValueArray& outParams, OperationContext& context)
00113 {
00114 CIMValue rval = m_pServer->invokeMethod(ns, path, methodName, inParams,
00115 outParams, context);
00116 if (m_pEnv->getIndicationRepLayerMediator()->getInstMethodCallSubscriptionCount() > 0)
00117 {
00118 if (path.isInstancePath())
00119 {
00120 try
00121 {
00122 CIMInstance expInst("CIM_InstMethodCall");
00123 CIMInstance theInst = m_pServer->getInstance(ns, path, E_NOT_LOCAL_ONLY,
00124 E_INCLUDE_QUALIFIERS, E_INCLUDE_CLASS_ORIGIN, NULL, context);
00125
00126 if (!theInst)
00127 {
00128
00129 return rval;
00130 }
00131
00132 CIMInstance ParamsEmbed;
00133 ParamsEmbed.setClassName("__MethodParameters");
00134
00135 for (size_t i = 0; i < inParams.size(); i++)
00136 {
00137 CIMProperty prop(inParams[i].getName(), inParams[i].getValue());
00138 ParamsEmbed.setProperty(prop);
00139 }
00140
00141 for (size_t i = 0; i < outParams.size(); i++)
00142 {
00143 CIMProperty prop(outParams[i].getName(), outParams[i].getValue());
00144 ParamsEmbed.setProperty(prop);
00145 }
00146
00147
00148 expInst.setProperty("SourceInstance", CIMValue(theInst));
00149 expInst.setProperty("MethodName", CIMValue(methodName));
00150 expInst.setProperty("MethodParameters", CIMValue(ParamsEmbed));
00151 expInst.setProperty("PreCall", CIMValue(false));
00152 expInst.setProperty("ReturnValue", CIMValue(rval.toString()));
00153 expInst.setProperty("IndicationTime", CIMValue(CIMDateTime(DateTime::getCurrent())));
00154 exportIndication(expInst, ns);
00155 }
00156 catch (CIMException&)
00157 {
00158 OW_LOG_DEBUG(m_pEnv->getLogger(COMPONENT_NAME), "Unable to export indication for"
00159 " invokeMethod because CIM_InstMethodCall does not exist");
00160 }
00161 }
00162 }
00163 return rval;
00164 }
00165 #ifndef OW_DISABLE_SCHEMA_MANIPULATION
00166
00167 CIMClass
00168 IndicationRepLayerImpl::modifyClass(const String &ns,
00169 const CIMClass& cc, OperationContext& context)
00170 {
00171 CIMClass CCOrig = m_pServer->modifyClass(ns, cc, context);
00172
00173 if (m_pEnv->getIndicationRepLayerMediator()->getClassModificationSubscriptionCount() > 0)
00174 {
00175
00176 try
00177 {
00178 CIMInstance expInst("CIM_ClassModification");
00179 expInst.setProperty("PreviousClassDefinition", CIMValue(CCOrig));
00180 expInst.setProperty("ClassDefinition", CIMValue(cc));
00181 expInst.setProperty("IndicationTime", CIMValue(CIMDateTime(DateTime::getCurrent())));
00182 exportIndication(expInst, ns);
00183 }
00184 catch (CIMException&)
00185 {
00186 OW_LOG_DEBUG(m_pEnv->getLogger(COMPONENT_NAME), "Unable to export indication for modifyClass"
00187 " because CIM_ClassModification does not exist");
00188 }
00189 }
00190 return CCOrig;
00191 }
00193 void
00194 IndicationRepLayerImpl::createClass(const String& ns,
00195 const CIMClass& cc, OperationContext& context)
00196 {
00197 m_pServer->createClass(ns, cc, context);
00198 if (m_pEnv->getIndicationRepLayerMediator()->getClassCreationSubscriptionCount() > 0)
00199 {
00200
00201 try
00202 {
00203 CIMInstance expInst("CIM_ClassCreation");
00204 expInst.setProperty("ClassDefinition", CIMValue(cc));
00205 expInst.setProperty("IndicationTime", CIMValue(CIMDateTime(DateTime::getCurrent())));
00206 exportIndication(expInst, ns);
00207 }
00208 catch(CIMException&)
00209 {
00210 OW_LOG_DEBUG(m_pEnv->getLogger(COMPONENT_NAME), "Unable to export indication for createClass"
00211 " because CIM_ClassCreation does not exist");
00212 }
00213 }
00214 }
00216 CIMClass
00217 IndicationRepLayerImpl::deleteClass(const String& ns, const String& className,
00218 OperationContext& context)
00219 {
00220 CIMClass cc = m_pServer->deleteClass(ns, className, context);
00221 if (m_pEnv->getIndicationRepLayerMediator()->getClassDeletionSubscriptionCount() > 0)
00222 {
00223 try
00224 {
00225 CIMInstance expInst("CIM_ClassDeletion");
00226 expInst.setProperty("ClassDefinition", CIMValue(cc));
00227 expInst.setProperty("IndicationTime", CIMValue(CIMDateTime(DateTime::getCurrent())));
00228 exportIndication(expInst, ns);
00229 }
00230 catch (CIMException&)
00231 {
00232 OW_LOG_DEBUG(m_pEnv->getLogger(COMPONENT_NAME), "Unable to export indication for"
00233 " deleteClass because CIM_ClassDeletion does not exist");
00234 }
00235 }
00236
00237 return cc;
00238 }
00239 #endif // #ifndef OW_DISABLE_SCHEMA_MANIPULATION
00240 #ifndef OW_DISABLE_INSTANCE_MANIPULATION
00241
00242 CIMInstance
00243 IndicationRepLayerImpl::modifyInstance(
00244 const String& ns,
00245 const CIMInstance& modifiedInstance,
00246 EIncludeQualifiersFlag includeQualifiers,
00247 const StringArray* propertyList,
00248 OperationContext& context)
00249 {
00250 CIMInstance ciOrig = m_pServer->modifyInstance(ns, modifiedInstance,
00251 includeQualifiers, propertyList, context);
00252 if (m_pEnv->getIndicationRepLayerMediator()->getInstModificationSubscriptionCount() > 0)
00253 {
00254 try
00255 {
00256 CIMInstance expInst("CIM_InstModification");
00257 expInst.setProperty("PreviousInstance", CIMValue(ciOrig));
00258
00259
00260 expInst.setProperty("SourceInstance", CIMValue(modifiedInstance));
00261 expInst.setProperty("IndicationTime", CIMValue(CIMDateTime(DateTime::getCurrent())));
00262 exportIndication(expInst, ns);
00263 }
00264 catch (CIMException&)
00265 {
00266 OW_LOG_DEBUG(m_pEnv->getLogger(COMPONENT_NAME), "Unable to export indication for modifyInstance"
00267 " because CIM_InstModification does not exist");
00268 }
00269 }
00270 return ciOrig;
00271 }
00273 CIMObjectPath
00274 IndicationRepLayerImpl::createInstance(const String& ns,
00275 const CIMInstance& ci, OperationContext& context)
00276 {
00277 CIMObjectPath rval = m_pServer->createInstance(ns, ci, context);
00278 if (m_pEnv->getIndicationRepLayerMediator()->getInstCreationSubscriptionCount() > 0)
00279 {
00280 try
00281 {
00282 CIMInstance expInst("CIM_InstCreation");
00283 expInst.setProperty("SourceInstance", CIMValue(ci));
00284 expInst.setProperty("IndicationTime", CIMValue(CIMDateTime(DateTime::getCurrent())));
00285 exportIndication(expInst, ns);
00286 }
00287 catch(CIMException&)
00288 {
00289 OW_LOG_DEBUG(m_pEnv->getLogger(COMPONENT_NAME), "Unable to export indication for createInstance"
00290 " because CIM_InstCreation does not exist");
00291 }
00292 }
00293 return rval;
00294 }
00296 CIMInstance
00297 IndicationRepLayerImpl::deleteInstance(const String& ns, const CIMObjectPath& path,
00298 OperationContext& context)
00299 {
00300 CIMInstance instOrig = m_pServer->deleteInstance(ns, path, context);
00301 if (m_pEnv->getIndicationRepLayerMediator()->getInstDeletionSubscriptionCount() > 0)
00302 {
00303 try
00304 {
00305 CIMInstance expInst("CIM_InstDeletion");
00306 expInst.setProperty("SourceInstance", CIMValue(instOrig));
00307 expInst.setProperty("IndicationTime", CIMValue(CIMDateTime(DateTime::getCurrent())));
00308 exportIndication(expInst, ns);
00309 }
00310 catch (CIMException&)
00311 {
00312 OW_LOG_DEBUG(m_pEnv->getLogger(COMPONENT_NAME), "Unable to export indication for deleteInstance"
00313 " because CIM_InstDeletion does not exist");
00314 }
00315 }
00316 return instOrig;
00317 }
00318 #endif // #ifndef OW_DISABLE_INSTANCE_MANIPULATION
00319 IndicationRepLayerImpl::IndicationRepLayerImpl() : IndicationRepLayer(), m_pServer(0) {}
00320 void IndicationRepLayerImpl::open(const String&) {}
00321 void IndicationRepLayerImpl::close() {}
00322 void IndicationRepLayerImpl::init(const ServiceEnvironmentIFCRef& env) {}
00323 void IndicationRepLayerImpl::shutdown() {}
00324 ServiceEnvironmentIFCRef IndicationRepLayerImpl::getEnvironment() const
00325 {
00326 return m_pEnv;
00327 }
00328 void IndicationRepLayerImpl::enumClasses(const String& ns,
00329 const String& className,
00330 CIMClassResultHandlerIFC& result,
00331 EDeepFlag deep, ELocalOnlyFlag localOnly, EIncludeQualifiersFlag includeQualifiers,
00332 EIncludeClassOriginFlag includeClassOrigin, OperationContext& context)
00333 {
00334 m_pServer->enumClasses(ns, className, result, deep, localOnly, includeQualifiers,
00335 includeClassOrigin, context);
00336 }
00337 void IndicationRepLayerImpl::enumClassNames(
00338 const String& ns,
00339 const String& className,
00340 StringResultHandlerIFC& result,
00341 EDeepFlag deep, OperationContext& context)
00342 {
00343 m_pServer->enumClassNames(ns, className, result, deep, context);
00344 }
00345 void IndicationRepLayerImpl::enumInstances(
00346 const String& ns,
00347 const String& className,
00348 CIMInstanceResultHandlerIFC& result,
00349 EDeepFlag deep,
00350 ELocalOnlyFlag localOnly,
00351 EIncludeQualifiersFlag includeQualifiers,
00352 EIncludeClassOriginFlag includeClassOrigin,
00353 const StringArray* propertyList,
00354 EEnumSubclassesFlag enumSubclasses,
00355 OperationContext& context)
00356 {
00357 m_pServer->enumInstances(ns, className, result, deep, localOnly, includeQualifiers,
00358 includeClassOrigin, propertyList, enumSubclasses, context);
00359 }
00360 void IndicationRepLayerImpl::enumInstanceNames(
00361 const String& ns,
00362 const String& className,
00363 CIMObjectPathResultHandlerIFC& result,
00364 EDeepFlag deep, OperationContext& context)
00365 {
00366 return m_pServer->enumInstanceNames(ns, className, result, deep, context);
00367 }
00368 CIMQualifierType IndicationRepLayerImpl::getQualifierType(
00369 const String& ns,
00370 const String& qualifierName, OperationContext& context)
00371 {
00372 return m_pServer->getQualifierType(ns, qualifierName, context);
00373 }
00374 CIMClass IndicationRepLayerImpl::getClass(
00375 const String& ns,
00376 const String& className,
00377 ELocalOnlyFlag localOnly, EIncludeQualifiersFlag includeQualifiers,
00378 EIncludeClassOriginFlag includeClassOrigin, const StringArray* propertyList,
00379 OperationContext& context)
00380 {
00381 return m_pServer->getClass(ns, className, localOnly, includeQualifiers,
00382 includeClassOrigin, propertyList, context);
00383 }
00384 #ifndef OW_DISABLE_QUALIFIER_DECLARATION
00385 void IndicationRepLayerImpl::enumQualifierTypes(
00386 const String& ns,
00387 CIMQualifierTypeResultHandlerIFC& result, OperationContext& context)
00388 {
00389 m_pServer->enumQualifierTypes(ns, result, context);
00390 }
00391 void IndicationRepLayerImpl::deleteQualifierType(const String& ns, const String& qualName,
00392 OperationContext& context)
00393 {
00394 m_pServer->deleteQualifierType(ns, qualName, context);
00395 }
00396 void IndicationRepLayerImpl::setQualifierType(const String& ns,
00397 const CIMQualifierType& qt, OperationContext& context)
00398 {
00399 m_pServer->setQualifierType(ns, qt, context);
00400 }
00401 #endif // #ifndef OW_DISABLE_QUALIFIER_DECLARATION
00402 #ifndef OW_DISABLE_INSTANCE_MANIPULATION
00403 #if !defined(OW_DISABLE_PROPERTY_OPERATIONS)
00404 void IndicationRepLayerImpl::setProperty(
00405 const String& ns,
00406 const CIMObjectPath &name,
00407 const String &propertyName, const CIMValue &cv,
00408 OperationContext& context)
00409 {
00410 m_pServer->setProperty(ns, name, propertyName, cv, context);
00411 }
00412 #endif // #if !defined(OW_DISABLE_PROPERTY_OPERATIONS)
00413 #endif // #ifndef OW_DISABLE_INSTANCE_MANIPULATION
00414 #if !defined(OW_DISABLE_PROPERTY_OPERATIONS)
00415 CIMValue IndicationRepLayerImpl::getProperty(
00416 const String& ns,
00417 const CIMObjectPath &name,
00418 const String &propertyName, OperationContext& context)
00419 {
00420 return m_pServer->getProperty(ns, name, propertyName, context);
00421 }
00422 #endif // #if !defined(OW_DISABLE_PROPERTY_OPERATIONS)
00423 #ifndef OW_DISABLE_ASSOCIATION_TRAVERSAL
00424 void IndicationRepLayerImpl::associators(
00425 const String& ns,
00426 const CIMObjectPath &path,
00427 CIMInstanceResultHandlerIFC& result,
00428 const String &assocClass, const String &resultClass,
00429 const String &role, const String &resultRole,
00430 EIncludeQualifiersFlag includeQualifiers, EIncludeClassOriginFlag includeClassOrigin,
00431 const StringArray* propertyList, OperationContext& context)
00432 {
00433 m_pServer->associators(ns, path, result, assocClass, resultClass, role,
00434 resultRole, includeQualifiers, includeClassOrigin, propertyList, context);
00435 }
00436 void IndicationRepLayerImpl::associatorsClasses(
00437 const String& ns,
00438 const CIMObjectPath &path,
00439 CIMClassResultHandlerIFC& result,
00440 const String &assocClass, const String &resultClass,
00441 const String &role, const String &resultRole,
00442 EIncludeQualifiersFlag includeQualifiers, EIncludeClassOriginFlag includeClassOrigin,
00443 const StringArray* propertyList, OperationContext& context)
00444 {
00445 m_pServer->associatorsClasses(ns, path, result, assocClass, resultClass, role,
00446 resultRole, includeQualifiers, includeClassOrigin, propertyList, context);
00447 }
00448 void IndicationRepLayerImpl::references(
00449 const String& ns,
00450 const CIMObjectPath &path,
00451 CIMInstanceResultHandlerIFC& result,
00452 const String &resultClass, const String &role,
00453 EIncludeQualifiersFlag includeQualifiers, EIncludeClassOriginFlag includeClassOrigin,
00454 const StringArray* propertyList, OperationContext& context)
00455 {
00456 m_pServer->references(ns, path, result, resultClass, role,
00457 includeQualifiers, includeClassOrigin, propertyList, context);
00458 }
00459 void IndicationRepLayerImpl::referencesClasses(
00460 const String& ns,
00461 const CIMObjectPath &path,
00462 CIMClassResultHandlerIFC& result,
00463 const String &resultClass, const String &role,
00464 EIncludeQualifiersFlag includeQualifiers, EIncludeClassOriginFlag includeClassOrigin,
00465 const StringArray* propertyList, OperationContext& context)
00466 {
00467 m_pServer->referencesClasses(ns, path, result, resultClass, role,
00468 includeQualifiers, includeClassOrigin, propertyList, context);
00469 }
00470 void IndicationRepLayerImpl::associatorNames(
00471 const String& ns,
00472 const CIMObjectPath &path,
00473 CIMObjectPathResultHandlerIFC& result,
00474 const String &assocClass,
00475 const String &resultClass, const String &role,
00476 const String &resultRole, OperationContext& context)
00477 {
00478 m_pServer->associatorNames(ns, path, result, assocClass, resultClass, role,
00479 resultRole, context);
00480 }
00481 void IndicationRepLayerImpl::referenceNames(
00482 const String& ns,
00483 const CIMObjectPath &path,
00484 CIMObjectPathResultHandlerIFC& result,
00485 const String &resultClass,
00486 const String &role, OperationContext& context)
00487 {
00488 m_pServer->referenceNames(ns, path, result, resultClass, role, context);
00489 }
00490 #endif // #ifndef OW_DISABLE_ASSOCIATION_TRAVERSAL
00491 void IndicationRepLayerImpl::execQuery(
00492 const String& ns,
00493 CIMInstanceResultHandlerIFC& result,
00494 const String &query, const String& queryLanguage,
00495 OperationContext& context)
00496 {
00497 m_pServer->execQuery(ns, result, query, queryLanguage, context);
00498 }
00499 #if !defined(OW_DISABLE_INSTANCE_MANIPULATION) && !defined(OW_DISABLE_NAMESPACE_MANIPULATION)
00500 void IndicationRepLayerImpl::deleteNameSpace(const String &ns, OperationContext& context)
00501 {
00502 m_pServer->deleteNameSpace(ns, context);
00503 }
00504 void IndicationRepLayerImpl::createNameSpace(const String& ns, OperationContext& context)
00505 {
00506 m_pServer->createNameSpace(ns, context);
00507 }
00508 #endif // #ifndef OW_DISABLE_INSTANCE_MANIPULATION
00509 void IndicationRepLayerImpl::enumNameSpace(StringResultHandlerIFC& result,
00510 OperationContext& context)
00511 {
00512 m_pServer->enumNameSpace(result, context);
00513 }
00514 void IndicationRepLayerImpl::beginOperation(WBEMFlags::EOperationFlag op, OperationContext& context)
00515 {
00516 m_pServer->beginOperation(op, context);
00517 }
00518 void IndicationRepLayerImpl::endOperation(WBEMFlags::EOperationFlag op, OperationContext& context, WBEMFlags::EOperationResultFlag result)
00519 {
00520 m_pServer->endOperation(op, context, result);
00521 }
00522 void IndicationRepLayerImpl::setCIMServer(const RepositoryIFCRef& src)
00523 {
00524 m_pServer = src;
00525 ServiceEnvironmentIFCRef env = m_pServer->getEnvironment();
00526 m_pEnv = env.cast_to<CIMOMEnvironment>();
00527 }
00528 void IndicationRepLayerImpl::exportIndication(const CIMInstance& instance,
00529 const String& instNS)
00530 {
00531 m_pEnv->exportIndication(instance, instNS);
00532 }
00533
00534 }
00535
00537 extern "C" OW_EXPORT OW_NAMESPACE::IndicationRepLayer*
00538 createIndicationRepLayer()
00539 {
00540 return new OW_NAMESPACE::IndicationRepLayerImpl;
00541 }
00543 #if !defined(OW_STATIC_SERVICES)
00544 extern "C" OW_EXPORT const char*
00545 getOWVersion()
00546 {
00547 return OW_VERSION;
00548 }
00549 #endif
00550
00551