version 1.113, 2004/02/12 21:08:05
|
version 1.114, 2004/02/13 21:32:05
|
|
|
#include <Pegasus/Common/ArrayInternal.h> | #include <Pegasus/Common/ArrayInternal.h> |
#include <Pegasus/Common/CIMDateTime.h> | #include <Pegasus/Common/CIMDateTime.h> |
#include <Pegasus/Common/CIMProperty.h> | #include <Pegasus/Common/CIMProperty.h> |
#include <Pegasus/Common/HashTable.h> |
|
#include <Pegasus/Common/MessageQueue.h> | #include <Pegasus/Common/MessageQueue.h> |
#ifdef PEGASUS_INDICATION_PERFINST | #ifdef PEGASUS_INDICATION_PERFINST |
#include <Pegasus/Common/Stopwatch.h> | #include <Pegasus/Common/Stopwatch.h> |
|
|
#include <Pegasus/Common/PegasusVersion.h> | #include <Pegasus/Common/PegasusVersion.h> |
#include <Pegasus/Common/AcceptLanguages.h> // l10n | #include <Pegasus/Common/AcceptLanguages.h> // l10n |
#include <Pegasus/Common/ContentLanguages.h> // l10n | #include <Pegasus/Common/ContentLanguages.h> // l10n |
#include <Pegasus/Repository/CIMRepository.h> |
// l10n |
|
#include <Pegasus/Common/MessageLoader.h> |
|
#include <Pegasus/Common/String.h> |
#include <Pegasus/Server/ProviderRegistrationManager/ProviderRegistrationManager.h> | #include <Pegasus/Server/ProviderRegistrationManager/ProviderRegistrationManager.h> |
#include <Pegasus/WQL/WQLParser.h> | #include <Pegasus/WQL/WQLParser.h> |
#include <Pegasus/WQL/WQLSelectStatement.h> | #include <Pegasus/WQL/WQLSelectStatement.h> |
| |
|
#include "IndicationConstants.h" |
|
#include "IndicationMessageConstants.h" |
|
#include "SubscriptionRepository.h" |
|
#include "SubscriptionTable.h" |
#include "IndicationService.h" | #include "IndicationService.h" |
| |
// l10n |
|
#include <Pegasus/Common/MessageLoader.h> |
|
#include <Pegasus/Common/String.h> |
|
| |
PEGASUS_USING_STD; | PEGASUS_USING_STD; |
| |
|
|
ProviderRegistrationManager * providerRegManager) | ProviderRegistrationManager * providerRegManager) |
: Base (PEGASUS_QUEUENAME_INDICATIONSERVICE, | : Base (PEGASUS_QUEUENAME_INDICATIONSERVICE, |
MessageQueue::getNextQueueId ()), | MessageQueue::getNextQueueId ()), |
_repository (repository), |
|
_providerRegManager (providerRegManager) | _providerRegManager (providerRegManager) |
{ | { |
_enableSubscriptionsForNonprivilegedUsers = false; | _enableSubscriptionsForNonprivilegedUsers = false; |
|
|
| |
try | try |
{ | { |
|
// |
|
// Create Subscription Repository |
|
// |
|
_subscriptionRepository = new SubscriptionRepository (repository); |
|
|
|
// |
|
// Create Subscription Table |
|
// |
|
_subscriptionTable = new SubscriptionTable (_subscriptionRepository); |
|
|
// Initialize the Indication Service | // Initialize the Indication Service |
_initialize (); | _initialize (); |
} | } |
catch (Exception & e) | catch (Exception & e) |
{ | { |
PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2, |
PEG_TRACE_STRING (TRC_INDICATION_SERVICE_INTERNAL, Tracer::LEVEL2, |
"Exception caught in attempting to initialize Indication Service: " + | "Exception caught in attempting to initialize Indication Service: " + |
e.getMessage ()); | e.getMessage ()); |
} | } |
|
|
| |
void IndicationService::_initialize (void) | void IndicationService::_initialize (void) |
{ | { |
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, "IndicationService::_initialize"); |
|
|
#ifdef PEGASUS_INDICATION_PERFINST | #ifdef PEGASUS_INDICATION_PERFINST |
Stopwatch stopWatch; | Stopwatch stopWatch; |
#endif | #endif |
|
|
Array <CIMInstance> activeSubscriptions; | Array <CIMInstance> activeSubscriptions; |
Array <CIMInstance> noProviderSubscriptions; | Array <CIMInstance> noProviderSubscriptions; |
Array <ProviderClassList> enableProviders; | Array <ProviderClassList> enableProviders; |
Boolean warningLogged = false; |
Boolean invalidInstance = false; |
|
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, "IndicationService::_initialize"); |
|
| |
// | // |
// Find required services | // Find required services |
|
|
_handlerService = hmservices [0]; | _handlerService = hmservices [0]; |
| |
// | // |
// FUTURE: Add code to find repository service, if repository becomes a |
|
// service |
|
// |
|
|
|
// |
|
// Set arrays of valid property values | // Set arrays of valid property values |
// | // |
_validStates.append (_STATE_UNKNOWN); | _validStates.append (_STATE_UNKNOWN); |
|
|
// | // |
// Get existing active subscriptions from each namespace in the repository | // Get existing active subscriptions from each namespace in the repository |
// | // |
warningLogged = _getActiveSubscriptionsFromRepository (activeSubscriptions); |
invalidInstance = _subscriptionRepository->getActiveSubscriptions |
|
(activeSubscriptions); |
noProviderSubscriptions.clear (); | noProviderSubscriptions.clear (); |
| |
String condition; | String condition; |
|
|
// Append this subscription to no provider list and | // Append this subscription to no provider list and |
// Insert entries into the subscription hash tables | // Insert entries into the subscription hash tables |
// | // |
if (!_handleError (activeSubscriptions [i])) |
if (!_subscriptionRepository->reconcileFatalError |
|
(activeSubscriptions [i])) |
{ | { |
noProviderSubscriptions.append (activeSubscriptions [i]); | noProviderSubscriptions.append (activeSubscriptions [i]); |
| |
_insertToHashTables (activeSubscriptions [i], |
_subscriptionTable->insertSubscription (activeSubscriptions [i], |
indicationProviders, indicationSubclasses, sourceNameSpace); | indicationProviders, indicationSubclasses, sourceNameSpace); |
} | } |
continue; | continue; |
|
|
{ | { |
// | // |
// This instance from the repository is corrupted | // This instance from the repository is corrupted |
// Log a message and skip it |
// Skip it |
// L10N TODO DONE -- new log message |
|
// | // |
if (!warningLogged) |
invalidInstance = true; |
{ |
|
//Logger::put (Logger::STANDARD_LOG, System::CIMSERVER, |
|
//Logger::WARNING, _MSG_INVALID_INSTANCES); |
|
Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER, |
|
Logger::WARNING, _MSG_INVALID_INSTANCES_KEY, |
|
_MSG_INVALID_INSTANCES); |
|
warningLogged = true; |
|
} |
|
break; | break; |
} | } |
| |
|
|
} // for each active subscription | } // for each active subscription |
| |
// | // |
|
// Log a message if any invalid instances were found |
|
// |
|
if (invalidInstance) |
|
{ |
|
Logger::put_l (Logger::STANDARD_LOG, System::CIMSERVER, Logger::WARNING, |
|
_MSG_INVALID_INSTANCES_KEY, _MSG_INVALID_INSTANCES); |
|
} |
|
|
|
// |
// Log a message for any subscription for which there is no longer any | // Log a message for any subscription for which there is no longer any |
// provider | // provider |
// | // |
|
|
| |
void IndicationService::_terminate (void) | void IndicationService::_terminate (void) |
{ | { |
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, "IndicationService::_terminate"); |
|
|
Array <CIMInstance> activeSubscriptions; | Array <CIMInstance> activeSubscriptions; |
CIMInstance indicationInstance; | CIMInstance indicationInstance; |
| |
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, "IndicationService::_terminate"); |
|
|
|
// | // |
// A message is already logged that CIM Server is shutting down -- | // A message is already logged that CIM Server is shutting down -- |
// no need to log a message | // no need to log a message |
|
|
// | // |
// Create instance for disabled subscription | // Create instance for disabled subscription |
// | // |
instanceRef = _createInstance (request, instance, false); |
instanceRef = _subscriptionRepository->createInstance |
|
(instance, request->nameSpace, request->userName, |
|
request->acceptLanguages, request->contentLanguages, |
|
false); |
} | } |
} | } |
else | else |
|
|
// | // |
// Create instance for filter or handler | // Create instance for filter or handler |
// | // |
instanceRef = _createInstance (request, instance, false); |
instanceRef = _subscriptionRepository->createInstance |
|
(instance, request->nameSpace, request->userName, |
|
request->acceptLanguages, request->contentLanguages, |
|
false); |
} | } |
} | } |
} | } |
|
|
// | // |
// Get instance from repository | // Get instance from repository |
// | // |
instance = _repository->getInstance (request->nameSpace, |
instance = _subscriptionRepository->getInstance |
request->instanceName, request->localOnly, |
(request->nameSpace, request->instanceName, request->localOnly, |
request->includeQualifiers, request->includeClassOrigin, | request->includeQualifiers, request->includeClassOrigin, |
propertyList); | propertyList); |
| |
|
|
_updatePropertyList (request->className, | _updatePropertyList (request->className, |
propertyList, setTimeRemaining, startTimeAdded, durationAdded); | propertyList, setTimeRemaining, startTimeAdded, durationAdded); |
| |
enumInstances = _repository->enumerateInstancesForClass |
enumInstances = _subscriptionRepository->enumerateInstancesForClass |
(request->nameSpace, request->className, | (request->nameSpace, request->className, |
request->deepInheritance, request->localOnly, | request->deepInheritance, request->localOnly, |
request->includeQualifiers, request->includeClassOrigin, | request->includeQualifiers, request->includeClassOrigin, |
|
|
void IndicationService::_handleEnumerateInstanceNamesRequest | void IndicationService::_handleEnumerateInstanceNamesRequest |
(const Message* message) | (const Message* message) |
{ | { |
PEG_METHOD_ENTER ( |
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
TRC_INDICATION_SERVICE, |
|
"IndicationService::_handleEnumerateInstancesNamesRequest"); | "IndicationService::_handleEnumerateInstancesNamesRequest"); |
| |
CIMEnumerateInstanceNamesRequestMessage* request = | CIMEnumerateInstanceNamesRequestMessage* request = |
|
|
{ | { |
_checkNonprivilegedAuthorization(request->userName); | _checkNonprivilegedAuthorization(request->userName); |
| |
enumInstanceNames = _repository->enumerateInstanceNamesForClass |
enumInstanceNames = |
|
_subscriptionRepository->enumerateInstanceNamesForClass |
(request->nameSpace, request->className, false); | (request->nameSpace, request->className, false); |
} | } |
catch (CIMException& exception) | catch (CIMException& exception) |
|
|
// | // |
CIMInstance instance; | CIMInstance instance; |
| |
try |
instance = _subscriptionRepository->getInstance |
{ |
(request->nameSpace, instanceReference); |
instance = _repository->getInstance (request->nameSpace, |
|
instanceReference); |
|
} |
|
catch (Exception&) |
|
{ |
|
PEG_METHOD_EXIT (); |
|
throw; |
|
} |
|
| |
CIMInstance modifiedInstance = request->modifiedInstance; | CIMInstance modifiedInstance = request->modifiedInstance; |
if (_canModify (request, instanceReference, instance, modifiedInstance)) | if (_canModify (request, instanceReference, instance, modifiedInstance)) |
|
|
// Get current state from instance | // Get current state from instance |
// | // |
Uint16 currentState; | Uint16 currentState; |
if (!_getState (instance, currentState)) |
Boolean valid = true; |
|
if (_subscriptionRepository->getState (instance, currentState)) |
|
{ |
|
valid = _validateState (currentState); |
|
} |
|
|
|
if (!valid) |
{ | { |
// | // |
// This instance from the repository is corrupted | // This instance from the repository is corrupted |
|
|
PEG_METHOD_EXIT (); | PEG_METHOD_EXIT (); |
//throw PEGASUS_CIM_EXCEPTION (CIM_ERR_FAILED, | //throw PEGASUS_CIM_EXCEPTION (CIM_ERR_FAILED, |
//_MSG_INVALID_INSTANCES); | //_MSG_INVALID_INSTANCES); |
MessageLoaderParms parms(_MSG_INVALID_INSTANCES_KEY, _MSG_INVALID_INSTANCES); |
MessageLoaderParms parms (_MSG_INVALID_INSTANCES_KEY, |
|
_MSG_INVALID_INSTANCES); |
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, parms); | throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, parms); |
} | } |
| |
|
|
// subscription | // subscription |
// | // |
instance.setPath (instanceReference); | instance.setPath (instanceReference); |
_handleError (instance); |
_subscriptionRepository->reconcileFatalError (instance); |
PEG_METHOD_EXIT (); | PEG_METHOD_EXIT (); |
| |
// l10n | // l10n |
|
|
// _MSG_NO_PROVIDERS); | // _MSG_NO_PROVIDERS); |
| |
throw PEGASUS_CIM_EXCEPTION_L (CIM_ERR_NOT_SUPPORTED, | throw PEGASUS_CIM_EXCEPTION_L (CIM_ERR_NOT_SUPPORTED, |
MessageLoaderParms(_MSG_NO_PROVIDERS_KEY, _MSG_NO_PROVIDERS)); |
MessageLoaderParms (_MSG_NO_PROVIDERS_KEY, |
|
_MSG_NO_PROVIDERS)); |
} | } |
} | } |
| |
|
|
try | try |
{ | { |
modifiedInstance.setPath (instanceReference); | modifiedInstance.setPath (instanceReference); |
_repository->modifyInstance (request->nameSpace, |
_subscriptionRepository->modifyInstance |
modifiedInstance, |
(request->nameSpace, modifiedInstance, |
request->includeQualifiers, propertyList); | request->includeQualifiers, propertyList); |
| |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
Logger::put (Logger::STANDARD_LOG, System::CIMSERVER, |
|
Logger::TRACE, |
"IndicationService::_handleModifyInstanceRequest - Name Space: $0 Instance name: $1", | "IndicationService::_handleModifyInstanceRequest - Name Space: $0 Instance name: $1", |
request->nameSpace.getString(), | request->nameSpace.getString(), |
modifiedInstance.getClassName().getString()); | modifiedInstance.getClassName().getString()); |
|
|
if (request->instanceName.getClassName ().equal | if (request->instanceName.getClassName ().equal |
(PEGASUS_CLASSNAME_INDSUBSCRIPTION)) | (PEGASUS_CLASSNAME_INDSUBSCRIPTION)) |
{ | { |
try |
subscriptionInstance = |
{ |
_subscriptionRepository->getInstance |
subscriptionInstance = _repository->getInstance |
|
(request->nameSpace, request->instanceName); | (request->nameSpace, request->instanceName); |
} | } |
catch (Exception&) |
|
{ |
|
PEG_METHOD_EXIT (); |
|
throw; |
|
} |
|
} |
|
| |
// | // |
// Delete instance from repository | // Delete instance from repository |
// | // |
try | try |
{ | { |
_repository->deleteInstance (request->nameSpace, |
_subscriptionRepository->deleteInstance |
request->instanceName); |
(request->nameSpace, request->instanceName); |
| |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
Logger::put (Logger::STANDARD_LOG, System::CIMSERVER, |
|
Logger::TRACE, |
"IndicationService::_handleDeleteInstanceRequest - Name Space: $0 Instance name: $1", | "IndicationService::_handleDeleteInstanceRequest - Name Space: $0 Instance name: $1", |
request->nameSpace.getString(), | request->nameSpace.getString(), |
request->instanceName.getClassName().getString()); | request->instanceName.getClassName().getString()); |
|
|
// Subscription was enabled, but had no providers | // Subscription was enabled, but had no providers |
// Remove entries from the subscription hash tables | // Remove entries from the subscription hash tables |
// | // |
_removeFromHashTables (subscriptionInstance, |
_subscriptionTable->removeSubscription |
|
(subscriptionInstance, |
indicationSubclasses, sourceNamespaceName, | indicationSubclasses, sourceNamespaceName, |
indicationProviders); | indicationProviders); |
} | } |
|
|
// | // |
// Look up the subscription in the active subscriptions table | // Look up the subscription in the active subscriptions table |
// | // |
String activeSubscriptionsKey = _generateActiveSubscriptionsKey |
|
(request->subscriptionInstanceNames [i]); |
|
ActiveSubscriptionsTableEntry tableValue; | ActiveSubscriptionsTableEntry tableValue; |
if (_lockedLookupActiveSubscriptionsEntry( |
if (_subscriptionTable->getSubscriptionEntry |
activeSubscriptionsKey, |
(request->subscriptionInstanceNames [i], tableValue)) |
tableValue)) |
|
{ | { |
matchedSubscriptions.append (tableValue.subscription); | matchedSubscriptions.append (tableValue.subscription); |
} | } |
|
|
continue; | continue; |
} | } |
| |
_getFilterProperties ( |
_subscriptionRepository->getFilterProperties ( |
matchedSubscriptions[i], | matchedSubscriptions[i], |
matchedSubscriptions[i].getPath ().getNameSpace (), | matchedSubscriptions[i].getPath ().getNameSpace (), |
filterQuery); | filterQuery); |
|
|
} | } |
} | } |
| |
handlerNamedInstance = _getHandler |
handlerNamedInstance = _subscriptionRepository->getHandler |
(matchedSubscriptions[i]); | (matchedSubscriptions[i]); |
| |
// l10n | // l10n |
|
|
{ | { |
PEG_TRACE_STRING (TRC_DISCARDED_DATA, Tracer::LEVEL2, | PEG_TRACE_STRING (TRC_DISCARDED_DATA, Tracer::LEVEL2, |
"Sending Indication and HandlerService returns " | "Sending Indication and HandlerService returns " |
"CIMException: " + handler_response->cimException.getMessage()); |
"CIMException: " + |
|
handler_response->cimException.getMessage ()); |
} | } |
| |
delete handler_response; | delete handler_response; |
|
|
void IndicationService::_handleNotifyProviderRegistrationRequest | void IndicationService::_handleNotifyProviderRegistrationRequest |
(const Message* message) | (const Message* message) |
{ | { |
PEG_METHOD_ENTER ( |
PEG_METHOD_ENTER ( TRC_INDICATION_SERVICE, |
TRC_INDICATION_SERVICE, |
|
"IndicationService::_handleNotifyProviderRegistrationRequest"); | "IndicationService::_handleNotifyProviderRegistrationRequest"); |
| |
CIMNotifyProviderRegistrationRequestMessage* request = | CIMNotifyProviderRegistrationRequestMessage* request = |
|
|
CIMPropertyList newPropertyNames = request->newPropertyNames; | CIMPropertyList newPropertyNames = request->newPropertyNames; |
CIMPropertyList oldPropertyNames = request->oldPropertyNames; | CIMPropertyList oldPropertyNames = request->oldPropertyNames; |
| |
|
// |
|
// Set path in each instance, so instances may later be easily |
|
// compared |
|
// ATTN: this code may be removed once bugzilla 1196 has been fixed |
|
// |
|
CIMClass providerClass = _subscriptionRepository->getClass |
|
(PEGASUS_NAMESPACENAME_INTEROP, PEGASUS_CLASSNAME_PROVIDER, |
|
true, true, false, CIMPropertyList ()); |
|
CIMClass providerModuleClass = _subscriptionRepository->getClass |
|
(PEGASUS_NAMESPACENAME_INTEROP, PEGASUS_CLASSNAME_PROVIDERMODULE, |
|
true, true, false, CIMPropertyList ()); |
|
provider.setPath (provider.buildPath (providerClass)); |
|
providerModule.setPath (providerModule.buildPath (providerModuleClass)); |
|
|
Array <CIMInstance> newSubscriptions; | Array <CIMInstance> newSubscriptions; |
Array <CIMInstance> formerSubscriptions; | Array <CIMInstance> formerSubscriptions; |
Array <ProviderClassList> indicationProviders; | Array <ProviderClassList> indicationProviders; |
|
|
| |
// l10n start | // l10n start |
String acceptLangs = String::EMPTY; | String acceptLangs = String::EMPTY; |
Uint32 propIndex = instance.findProperty(PEGASUS_PROPERTYNAME_INDSUB_ACCEPTLANGS); |
Uint32 propIndex = instance.findProperty |
|
(PEGASUS_PROPERTYNAME_INDSUB_ACCEPTLANGS); |
if (propIndex != PEG_NOT_FOUND) | if (propIndex != PEG_NOT_FOUND) |
{ | { |
instance.getProperty(propIndex).getValue().get(acceptLangs); | instance.getProperty(propIndex).getValue().get(acceptLangs); |
} | } |
String contentLangs = String::EMPTY; | String contentLangs = String::EMPTY; |
propIndex = instance.findProperty(PEGASUS_PROPERTYNAME_INDSUB_CONTENTLANGS); |
propIndex = instance.findProperty |
|
(PEGASUS_PROPERTYNAME_INDSUB_CONTENTLANGS); |
if (propIndex != PEG_NOT_FOUND) | if (propIndex != PEG_NOT_FOUND) |
{ | { |
instance.getProperty(propIndex).getValue().get(contentLangs); | instance.getProperty(propIndex).getValue().get(contentLangs); |
|
|
// | // |
// Look up the subscription in the active subscriptions table | // Look up the subscription in the active subscriptions table |
// | // |
String activeSubscriptionsKey = _generateActiveSubscriptionsKey |
|
(newSubscriptions [i].getPath ()); |
|
ActiveSubscriptionsTableEntry tableValue; | ActiveSubscriptionsTableEntry tableValue; |
if (_lockedLookupActiveSubscriptionsEntry (activeSubscriptionsKey, |
if (_subscriptionTable->getSubscriptionEntry |
tableValue)) |
(newSubscriptions [i].getPath (), tableValue)) |
{ | { |
// | // |
// If the provider is already in the subscription's list, | // If the provider is already in the subscription's list, |
// send a Modify request, otherwise send a Create request | // send a Modify request, otherwise send a Create request |
// | // |
Uint32 providerIndex = _providerInList (provider, tableValue); |
Uint32 providerIndex = _subscriptionTable->providerInList |
|
(provider, tableValue); |
if (providerIndex != PEG_NOT_FOUND) | if (providerIndex != PEG_NOT_FOUND) |
{ | { |
// | // |
|
|
indicationSubclasses, | indicationSubclasses, |
creator); | creator); |
} | } |
} // subscription found in table |
} |
else | else |
{ | { |
// | // |
// Subscription not found in Active Subscriptions table | // Subscription not found in Active Subscriptions table |
// | // |
PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2, |
|
"Subscription (" + activeSubscriptionsKey + |
|
") not found in ActiveSubscriptionsTable"); |
|
} | } |
} | } |
| |
|
|
// | // |
// Log a message for each subscription | // Log a message for each subscription |
// | // |
CIMClass providerClass = _repository->getClass |
CIMClass providerClass = _subscriptionRepository->getClass |
(PEGASUS_NAMESPACENAME_INTEROP, PEGASUS_CLASSNAME_PROVIDER, | (PEGASUS_NAMESPACENAME_INTEROP, PEGASUS_CLASSNAME_PROVIDER, |
true, true, false, CIMPropertyList ()); | true, true, false, CIMPropertyList ()); |
CIMInstance providerCopy = provider.clone (); | CIMInstance providerCopy = provider.clone (); |
|
|
// | // |
// Get Provider Name, Subscription Filter Name and Handler Name | // Get Provider Name, Subscription Filter Name and Handler Name |
// | // |
String logString1 = _getProviderLogString (providerCopy); |
String logString1 = getProviderLogString (providerCopy); |
String logString2 = _getSubscriptionLogString | String logString2 = _getSubscriptionLogString |
(newSubscriptions [j]); | (newSubscriptions [j]); |
| |
|
|
// operation, send a Delete request | // operation, send a Delete request |
// Otherwise, send a Modify request | // Otherwise, send a Modify request |
// | // |
String activeSubscriptionsKey = _generateActiveSubscriptionsKey |
|
(formerSubscriptions [i].getPath ()); |
|
ActiveSubscriptionsTableEntry tableValue; | ActiveSubscriptionsTableEntry tableValue; |
if (_lockedLookupActiveSubscriptionsEntry (activeSubscriptionsKey, |
if (_subscriptionTable->getSubscriptionEntry |
tableValue)) |
(formerSubscriptions [i].getPath (), tableValue)) |
{ | { |
Uint32 providerIndex = _providerInList (provider, tableValue); |
Uint32 providerIndex = _subscriptionTable->providerInList |
|
(provider, tableValue); |
if (providerIndex != PEG_NOT_FOUND) | if (providerIndex != PEG_NOT_FOUND) |
{ | { |
CIMNamespaceName sourceNameSpace; | CIMNamespaceName sourceNameSpace; |
|
|
// | // |
else | else |
{ | { |
Uint32 classIndex = _classInList (className, |
Uint32 classIndex = _subscriptionTable->classInList |
tableValue.providers [providerIndex]); |
(className, tableValue.providers [providerIndex]); |
if (classIndex != PEG_NOT_FOUND) | if (classIndex != PEG_NOT_FOUND) |
{ | { |
// | // |
|
|
} | } |
else | else |
{ | { |
PEG_TRACE_STRING (TRC_INDICATION_SERVICE, |
PEG_TRACE_STRING (TRC_INDICATION_SERVICE_INTERNAL, |
Tracer::LEVEL2, | Tracer::LEVEL2, |
"Class " + className.getString() + | "Class " + className.getString() + |
" not found in tableValue.providers"); | " not found in tableValue.providers"); |
|
|
// | // |
// Subscription not found in Active Subscriptions table | // Subscription not found in Active Subscriptions table |
// | // |
PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2, |
|
"Subscription (" + activeSubscriptionsKey + |
|
") not found in ActiveSubscriptionsTable"); |
|
} | } |
} | } |
| |
|
|
// | // |
// Log a message for each subscription | // Log a message for each subscription |
// | // |
CIMClass providerClass = _repository->getClass |
CIMClass providerClass = _subscriptionRepository->getClass |
(PEGASUS_NAMESPACENAME_INTEROP, PEGASUS_CLASSNAME_PROVIDER, | (PEGASUS_NAMESPACENAME_INTEROP, PEGASUS_CLASSNAME_PROVIDER, |
true, true, false, CIMPropertyList ()); | true, true, false, CIMPropertyList ()); |
CIMInstance providerCopy = provider.clone (); | CIMInstance providerCopy = provider.clone (); |
|
|
// | // |
// Get Provider Name, Subscription Filter Name and Handler Name | // Get Provider Name, Subscription Filter Name and Handler Name |
// | // |
String logString1 = _getProviderLogString (providerCopy); |
String logString1 = getProviderLogString (providerCopy); |
String logString2 = _getSubscriptionLogString | String logString2 = _getSubscriptionLogString |
(formerSubscriptions [j]); | (formerSubscriptions [j]); |
| |
|
|
PEG_METHOD_EXIT (); | PEG_METHOD_EXIT (); |
} | } |
| |
Uint32 IndicationService::_providerInList |
|
(const CIMInstance & provider, |
|
const ActiveSubscriptionsTableEntry & tableValue) |
|
{ |
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
|
"IndicationService::_providerInList"); |
|
|
|
CIMClass providerClass = _repository->getClass |
|
(PEGASUS_NAMESPACENAME_INTEROP, PEGASUS_CLASSNAME_PROVIDER, |
|
true, true, false, CIMPropertyList ()); |
|
|
|
// |
|
// Look for the provider in the list |
|
// |
|
for (Uint32 i = 0; i < tableValue.providers.size (); i++) |
|
{ |
|
if (_sameInstance (tableValue.providers [i].provider, provider, |
|
providerClass)) |
|
{ |
|
return i; |
|
} |
|
} |
|
|
|
return PEG_NOT_FOUND; |
|
|
|
PEG_METHOD_EXIT (); |
|
} |
|
|
|
Uint32 IndicationService::_classInList |
|
(const CIMName & className, |
|
const ProviderClassList & providerClasses) |
|
{ |
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
|
"IndicationService::_classInList"); |
|
|
|
// |
|
// Look for the class in the list |
|
// |
|
for (Uint32 i = 0; i < providerClasses.classList.size (); i++) |
|
{ |
|
if (providerClasses.classList [i].equal (className)) |
|
{ |
|
return i; |
|
} |
|
} |
|
|
|
return PEG_NOT_FOUND; |
|
|
|
PEG_METHOD_EXIT (); |
|
} |
|
|
|
void IndicationService::_handleNotifyProviderTerminationRequest | void IndicationService::_handleNotifyProviderTerminationRequest |
(const Message * message) | (const Message * message) |
{ | { |
Array <CIMInstance> providerSubscriptions; |
|
CIMInstance indicationInstance; |
|
|
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, | PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
"IndicationService::_handleNotifyProviderTermination"); | "IndicationService::_handleNotifyProviderTermination"); |
| |
|
Array <CIMInstance> providerSubscriptions; |
|
CIMInstance indicationInstance; |
|
|
CIMNotifyProviderTerminationRequestMessage* request = | CIMNotifyProviderTerminationRequestMessage* request = |
(CIMNotifyProviderTerminationRequestMessage*) message; | (CIMNotifyProviderTerminationRequestMessage*) message; |
| |
Array <CIMInstance> providers = request->providers; | Array <CIMInstance> providers = request->providers; |
| |
|
CIMClass providerClass = _subscriptionRepository->getClass |
|
(PEGASUS_NAMESPACENAME_INTEROP, PEGASUS_CLASSNAME_PROVIDER, |
|
true, true, false, CIMPropertyList ()); |
|
|
for (Uint32 i = 0; i < providers.size (); i++) | for (Uint32 i = 0; i < providers.size (); i++) |
{ | { |
// | // |
|
// Set path in each instance, so instances may later be easily |
|
// compared |
|
// ATTN: this code may be removed once bugzilla 1196 has been fixed |
|
// (including getClass call above) |
|
// |
|
providers [i].setPath (providers [i].buildPath (providerClass)); |
|
|
|
// |
// Get list of affected subscriptions | // Get list of affected subscriptions |
// | // |
// _getProviderSubscriptions also updates the Active Subscriptions |
// _subscriptionTable->getProviderSubscriptions also updates the |
// hash table, and implements each subscription's On Fatal Error |
// Active Subscriptions hash table, and implements each subscription's |
// policy, if necessary |
// On Fatal Error policy, if necessary |
// | // |
providerSubscriptions.clear (); | providerSubscriptions.clear (); |
providerSubscriptions = _getProviderSubscriptions (providers [i]); |
providerSubscriptions = _subscriptionTable->getProviderSubscriptions |
|
(providers [i]); |
| |
if (providerSubscriptions.size () > 0) | if (providerSubscriptions.size () > 0) |
{ | { |
|
|
// | // |
// Log a message for each subscription | // Log a message for each subscription |
// | // |
CIMClass providerClass = _repository->getClass |
CIMClass providerClass = _subscriptionRepository->getClass |
(PEGASUS_NAMESPACENAME_INTEROP, PEGASUS_CLASSNAME_PROVIDER, | (PEGASUS_NAMESPACENAME_INTEROP, PEGASUS_CLASSNAME_PROVIDER, |
true, true, false, CIMPropertyList ()); | true, true, false, CIMPropertyList ()); |
CIMInstance providerCopy = providers [i].clone (); | CIMInstance providerCopy = providers [i].clone (); |
|
|
// | // |
// Get Provider Name, Subscription Filter Name and Handler Name | // Get Provider Name, Subscription Filter Name and Handler Name |
// | // |
String logString1 = _getProviderLogString (providerCopy); |
String logString1 = getProviderLogString (providerCopy); |
String logString2 = _getSubscriptionLogString | String logString2 = _getSubscriptionLogString |
(providerSubscriptions [j]); | (providerSubscriptions [j]); |
| |
|
|
Array <CIMInstance> capabilities = request->capInstances; | Array <CIMInstance> capabilities = request->capInstances; |
| |
// | // |
|
// Set path in each instance, so instances may later be easily |
|
// compared |
|
// ATTN: this code may be removed once bugzilla 1196 has been fixed |
|
// |
|
CIMClass providerClass = _subscriptionRepository->getClass |
|
(PEGASUS_NAMESPACENAME_INTEROP, PEGASUS_CLASSNAME_PROVIDER, |
|
true, true, false, CIMPropertyList ()); |
|
CIMClass providerModuleClass = _subscriptionRepository->getClass |
|
(PEGASUS_NAMESPACENAME_INTEROP, PEGASUS_CLASSNAME_PROVIDERMODULE, |
|
true, true, false, CIMPropertyList ()); |
|
provider.setPath (provider.buildPath (providerClass)); |
|
providerModule.setPath (providerModule.buildPath (providerModuleClass)); |
|
|
|
// |
// Get class name, namespace names, and property list | // Get class name, namespace names, and property list |
// from each capability instance | // from each capability instance |
// | // |
|
|
// | // |
// Error getting information from Capabilities instance | // Error getting information from Capabilities instance |
// | // |
PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2, |
PEG_TRACE_STRING (TRC_INDICATION_SERVICE_INTERNAL, Tracer::LEVEL2, |
"Exception caught in handling provider enable notification: " + | "Exception caught in handling provider enable notification: " + |
exception.getMessage ()); | exception.getMessage ()); |
break; | break; |
} | } |
catch (...) | catch (...) |
{ | { |
PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2, |
PEG_TRACE_STRING (TRC_INDICATION_SERVICE_INTERNAL, Tracer::LEVEL2, |
"Error in handling provider enable notification"); | "Error in handling provider enable notification"); |
break; | break; |
} | } |
|
|
// | // |
// Get Provider Name, Subscription Filter Name and Handler Name | // Get Provider Name, Subscription Filter Name and Handler Name |
// | // |
String logString1 = _getProviderLogString (provider); |
String logString1 = getProviderLogString (provider); |
String logString2 = _getSubscriptionLogString | String logString2 = _getSubscriptionLogString |
(subscriptions [s]); | (subscriptions [s]); |
| |
|
|
PEG_METHOD_EXIT (); | PEG_METHOD_EXIT (); |
} | } |
| |
Boolean IndicationService::_handleError ( |
|
const CIMInstance subscription) |
|
{ |
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
|
"IndicationService::_handleError"); |
|
|
|
Boolean handleError = false; |
|
|
|
// |
|
// Get the value of the On Fatal Error Policy property |
|
// |
|
CIMValue errorPolicyValue; |
|
Uint16 onFatalErrorPolicy; |
|
errorPolicyValue = subscription.getProperty |
|
(subscription.findProperty |
|
(_PROPERTY_ONFATALERRORPOLICY)).getValue (); |
|
errorPolicyValue.get (onFatalErrorPolicy); |
|
|
|
if (errorPolicyValue == _ERRORPOLICY_DISABLE) |
|
{ |
|
// |
|
// FUTURE: Failure Trigger Time Interval should be allowed to pass |
|
// before implementing On Fatal Error Policy |
|
// |
|
// Set the Subscription State to disabled |
|
// |
|
_disableSubscription (subscription); |
|
handleError = true; |
|
} |
|
else if (errorPolicyValue == _ERRORPOLICY_REMOVE) |
|
{ |
|
// |
|
// FUTURE: Failure Trigger Time Interval should be allowed to pass |
|
// before implementing On Fatal Error Policy |
|
// |
|
// Delete the subscription |
|
// |
|
_deleteSubscription (subscription); |
|
handleError = true; |
|
} |
|
|
|
PEG_METHOD_EXIT (); |
|
return handleError; |
|
} |
|
|
|
void IndicationService::_disableSubscription ( |
|
CIMInstance subscription) |
|
{ |
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
|
"IndicationService::_disableSubscription"); |
|
|
|
// |
|
// Create property list |
|
// |
|
CIMPropertyList propertyList; |
|
Array <CIMName> properties; |
|
properties.append (_PROPERTY_STATE); |
|
propertyList = CIMPropertyList (properties); |
|
|
|
// |
|
// Set Time of Last State Change to current date time |
|
// |
|
CIMInstance instance = subscription; |
|
CIMDateTime currentDateTime = CIMDateTime::getCurrentDateTime (); |
|
if (instance.findProperty (_PROPERTY_LASTCHANGE) == PEG_NOT_FOUND) |
|
{ |
|
instance.addProperty |
|
(CIMProperty (_PROPERTY_LASTCHANGE, currentDateTime)); |
|
} |
|
else |
|
{ |
|
CIMProperty lastChange = instance.getProperty |
|
(instance.findProperty (_PROPERTY_LASTCHANGE)); |
|
lastChange.setValue (CIMValue (currentDateTime)); |
|
} |
|
|
|
// |
|
// Set Subscription State to Disabled |
|
// |
|
CIMProperty state = instance.getProperty (instance.findProperty |
|
(_PROPERTY_STATE)); |
|
state.setValue (CIMValue (_STATE_DISABLED)); |
|
|
|
// |
|
// Modify the instance in the repository |
|
// |
|
try |
|
{ |
|
_repository->modifyInstance |
|
(subscription.getPath ().getNameSpace (), |
|
subscription, false, propertyList); |
|
} |
|
catch (Exception & exception) |
|
{ |
|
PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2, |
|
"Exception caught in attempting to disable a subscription: " + |
|
exception.getMessage ()); |
|
} |
|
|
|
PEG_METHOD_EXIT (); |
|
} |
|
|
|
void IndicationService::_deleteSubscription ( |
|
const CIMInstance subscription) |
|
{ |
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
|
"IndicationService::_deleteSubscription"); |
|
|
|
// |
|
// Delete referencing subscription instance from repository |
|
// |
|
try |
|
{ |
|
_repository->deleteInstance |
|
(subscription.getPath ().getNameSpace (), |
|
subscription.getPath ()); |
|
} |
|
catch (Exception & exception) |
|
{ |
|
PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2, |
|
"Exception caught in attempting to delete a subscription: " + |
|
exception.getMessage ()); |
|
} |
|
|
|
PEG_METHOD_EXIT (); |
|
} |
|
|
|
Boolean IndicationService::_canCreate ( | Boolean IndicationService::_canCreate ( |
CIMInstance & instance, | CIMInstance & instance, |
const CIMNamespaceName & nameSpace) | const CIMNamespaceName & nameSpace) |
|
|
CIMValue filterValue = filterProperty.getValue (); | CIMValue filterValue = filterProperty.getValue (); |
CIMObjectPath filterPath; | CIMObjectPath filterPath; |
filterValue.get (filterPath); | filterValue.get (filterPath); |
try |
CIMInstance filterInstance = |
{ |
_subscriptionRepository->getInstance (nameSpace, filterPath, |
CIMInstance filterInstance = _repository->getInstance |
|
(nameSpace, filterPath, |
|
true, false, false, CIMPropertyList ()); | true, false, false, CIMPropertyList ()); |
} |
|
catch (Exception &) |
|
{ |
|
PEG_METHOD_EXIT (); |
|
throw; |
|
} |
|
| |
CIMProperty handlerProperty = instance.getProperty | CIMProperty handlerProperty = instance.getProperty |
(instance.findProperty (_PROPERTY_HANDLER)); | (instance.findProperty (_PROPERTY_HANDLER)); |
CIMValue handlerValue = handlerProperty.getValue (); | CIMValue handlerValue = handlerProperty.getValue (); |
CIMObjectPath handlerPath; | CIMObjectPath handlerPath; |
handlerValue.get (handlerPath); | handlerValue.get (handlerPath); |
try |
CIMInstance handlerInstance = |
{ |
_subscriptionRepository->getInstance (nameSpace, handlerPath, |
CIMInstance handlerInstance = _repository->getInstance |
|
(nameSpace, handlerPath, |
|
true, false, false, CIMPropertyList ()); | true, false, false, CIMPropertyList ()); |
} |
|
catch (Exception &) |
|
{ |
|
PEG_METHOD_EXIT (); |
|
throw; |
|
} |
|
| |
// | // |
// Set the key bindings in the subscription instance | // Set the key bindings in the subscription instance |
|
|
const Uint16 otherValue, | const Uint16 otherValue, |
const Array <Uint16> & validValues) | const Array <Uint16> & validValues) |
{ | { |
Uint16 result = defaultValue; |
|
|
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, | PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
"IndicationService::_checkPropertyWithOther"); | "IndicationService::_checkPropertyWithOther"); |
| |
|
Uint16 result = defaultValue; |
|
|
// | // |
// If the property doesn't exist, add it with the default value | // If the property doesn't exist, add it with the default value |
// | // |
|
|
const CIMName & propertyName, | const CIMName & propertyName, |
const String & defaultValue) | const String & defaultValue) |
{ | { |
String result = defaultValue; |
|
|
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, | PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
"IndicationService::_checkPropertyWithDefault"); | "IndicationService::_checkPropertyWithDefault"); |
| |
|
String result = defaultValue; |
|
|
// | // |
// If the property doesn't exist, add it with the default value | // If the property doesn't exist, add it with the default value |
// | // |
|
|
PEG_METHOD_EXIT (); | PEG_METHOD_EXIT (); |
} | } |
| |
CIMObjectPath IndicationService::_createInstance ( |
Boolean IndicationService::_canModify ( |
CIMCreateInstanceRequestMessage * request, |
const CIMModifyInstanceRequestMessage * request, |
CIMInstance instance, |
const CIMObjectPath & instanceReference, |
Boolean enabled) |
const CIMInstance & instance, |
|
CIMInstance & modifiedInstance) |
{ | { |
CIMObjectPath instanceRef; |
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, "IndicationService::_canModify"); |
| |
// | // |
// Add creator property to Instance |
// Currently, only modification allowed is of Subscription State |
// NOTE: userName is only set in the request if authentication |
// property in Subscription class |
// is turned on |
|
// | // |
String currentUser = request->userName; |
if (!instanceReference.getClassName ().equal |
if (instance.findProperty (PEGASUS_PROPERTYNAME_INDSUB_CREATOR) == |
(PEGASUS_CLASSNAME_INDSUBSCRIPTION)) |
PEG_NOT_FOUND) |
|
{ |
|
instance.addProperty (CIMProperty |
|
(PEGASUS_PROPERTYNAME_INDSUB_CREATOR, currentUser)); |
|
} |
|
else |
|
{ | { |
CIMProperty creator = instance.getProperty |
PEG_METHOD_EXIT (); |
(instance.findProperty |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY); |
(PEGASUS_PROPERTYNAME_INDSUB_CREATOR)); |
|
creator.setValue (CIMValue (currentUser)); |
|
} | } |
| |
// l10n |
if (request->includeQualifiers) |
// Add the language properties to the Instance |
|
// Note: These came from the Accept-Language and Content-Language |
|
// headers in the HTTP messages, and may be empty. |
|
AcceptLanguages acceptLangs = request->acceptLanguages; |
|
if (instance.findProperty (PEGASUS_PROPERTYNAME_INDSUB_ACCEPTLANGS) == |
|
PEG_NOT_FOUND) |
|
{ |
|
instance.addProperty (CIMProperty |
|
(PEGASUS_PROPERTYNAME_INDSUB_ACCEPTLANGS, |
|
acceptLangs.toString())); |
|
} |
|
else |
|
{ | { |
CIMProperty langs = instance.getProperty |
PEG_METHOD_EXIT (); |
(instance.findProperty |
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY); |
(PEGASUS_PROPERTYNAME_INDSUB_ACCEPTLANGS)); |
|
langs.setValue (CIMValue (acceptLangs.toString())); |
|
} |
|
|
|
ContentLanguages contentLangs = request->contentLanguages; |
|
if (instance.findProperty (PEGASUS_PROPERTYNAME_INDSUB_CONTENTLANGS) == |
|
PEG_NOT_FOUND) |
|
{ |
|
instance.addProperty (CIMProperty |
|
(PEGASUS_PROPERTYNAME_INDSUB_CONTENTLANGS, |
|
contentLangs.toString())); |
|
} |
|
else |
|
{ |
|
CIMProperty langs = instance.getProperty |
|
(instance.findProperty |
|
(PEGASUS_PROPERTYNAME_INDSUB_CONTENTLANGS)); |
|
langs.setValue (CIMValue (contentLangs.toString())); |
|
} |
|
// l10n -end |
|
|
|
if (instance.getClassName ().equal |
|
(PEGASUS_CLASSNAME_INDSUBSCRIPTION)) |
|
{ |
|
// |
|
// Set Time of Last State Change to current date time |
|
// |
|
CIMDateTime currentDateTime = |
|
CIMDateTime::getCurrentDateTime (); |
|
if (instance.findProperty (_PROPERTY_LASTCHANGE) == |
|
PEG_NOT_FOUND) |
|
{ |
|
instance.addProperty |
|
(CIMProperty (_PROPERTY_LASTCHANGE, currentDateTime)); |
|
} |
|
else |
|
{ |
|
CIMProperty lastChange = instance.getProperty |
|
(instance.findProperty (_PROPERTY_LASTCHANGE)); |
|
lastChange.setValue (CIMValue (currentDateTime)); |
|
} |
|
|
|
CIMDateTime startDateTime; |
|
if (enabled) |
|
{ |
|
startDateTime = currentDateTime; |
|
} |
|
else |
|
{ |
|
// |
|
// If subscription is not enabled, set Subscription |
|
// Start Time to null CIMDateTime value |
|
// |
|
startDateTime = CIMDateTime (); |
|
} |
|
|
|
// |
|
// Set Subscription Start Time |
|
// |
|
if (instance.findProperty (_PROPERTY_STARTTIME) == |
|
PEG_NOT_FOUND) |
|
{ |
|
instance.addProperty |
|
(CIMProperty (_PROPERTY_STARTTIME, startDateTime)); |
|
} |
|
else |
|
{ |
|
CIMProperty startTime = instance.getProperty |
|
(instance.findProperty (_PROPERTY_STARTTIME)); |
|
startTime.setValue (CIMValue (startDateTime)); |
|
} |
|
} |
|
|
|
// |
|
// Create instance in repository |
|
// |
|
try |
|
{ |
|
instanceRef = _repository->createInstance ( |
|
request->nameSpace, |
|
instance); |
|
|
|
Logger::put ( |
|
Logger::STANDARD_LOG, |
|
System::CIMSERVER, |
|
Logger::TRACE, |
|
"IndicationService::_handleCreateInstanceRequest - Name Space: $0 Instance name: $1", |
|
request->nameSpace.getString (), |
|
instance.getClassName ().getString ()); |
|
} |
|
catch (CIMException&) |
|
{ |
|
throw; |
|
} |
|
catch (Exception & exception) |
|
{ |
|
throw PEGASUS_CIM_EXCEPTION (CIM_ERR_FAILED, exception.getMessage ()); |
|
} |
|
|
|
return instanceRef; |
|
} |
|
|
|
Boolean IndicationService::_canModify ( |
|
const CIMModifyInstanceRequestMessage * request, |
|
const CIMObjectPath & instanceReference, |
|
const CIMInstance & instance, |
|
CIMInstance & modifiedInstance) |
|
{ |
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, "IndicationService::_canModify"); |
|
|
|
// |
|
// Currently, only modification allowed is of Subscription State |
|
// property in Subscription class |
|
// |
|
if (!instanceReference.getClassName ().equal |
|
(PEGASUS_CLASSNAME_INDSUBSCRIPTION)) |
|
{ |
|
PEG_METHOD_EXIT (); |
|
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY); |
|
} |
|
|
|
if (request->includeQualifiers) |
|
{ |
|
PEG_METHOD_EXIT (); |
|
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, String::EMPTY); |
|
} | } |
| |
// | // |
|
|
const CIMNamespaceName & nameSpace, | const CIMNamespaceName & nameSpace, |
const String & currentUser) | const String & currentUser) |
{ | { |
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, "IndicationService::_canDelete"); |
|
|
CIMName superClass; | CIMName superClass; |
CIMName propName; | CIMName propName; |
| |
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, "IndicationService::_canDelete"); |
|
|
|
// | // |
// Get the instance to be deleted from the respository | // Get the instance to be deleted from the respository |
// | // |
CIMInstance instance; | CIMInstance instance; |
| |
try |
instance = _subscriptionRepository->getInstance |
{ |
(nameSpace, instanceReference); |
instance = _repository->getInstance (nameSpace, instanceReference); |
|
} |
|
catch (Exception&) |
|
{ |
|
PEG_METHOD_EXIT (); |
|
throw; |
|
} |
|
| |
// | // |
// Get creator from instance | // Get creator from instance |
|
|
// | // |
CIMClass refClass; | CIMClass refClass; |
| |
try |
refClass = _subscriptionRepository->getClass (nameSpace, |
{ |
instanceReference.getClassName (), true, true, false, |
refClass = _repository->getClass (nameSpace, |
CIMPropertyList ()); |
instanceReference.getClassName (), |
|
true, true, false, CIMPropertyList ()); |
|
} |
|
catch (Exception&) |
|
{ |
|
PEG_METHOD_EXIT (); |
|
throw; |
|
} |
|
|
|
superClass = refClass.getSuperClassName(); | superClass = refClass.getSuperClassName(); |
| |
// | // |
|
|
// If deleting transient handler, first delete any referencing | // If deleting transient handler, first delete any referencing |
// subscriptions | // subscriptions |
// | // |
if (_isTransient (nameSpace, instanceReference)) |
if (_subscriptionRepository->isTransient (nameSpace, |
|
instanceReference)) |
{ | { |
_deleteReferencingSubscriptions (nameSpace, propName, | _deleteReferencingSubscriptions (nameSpace, propName, |
instanceReference); | instanceReference); |
|
|
// | // |
// Get all the subscriptions in the same namespace from the respository | // Get all the subscriptions in the same namespace from the respository |
// | // |
Array <CIMInstance> subscriptions = _getSubscriptions (nameSpace); |
Array <CIMInstance> subscriptions = |
|
_subscriptionRepository->getSubscriptions (nameSpace); |
| |
CIMValue propValue; | CIMValue propValue; |
| |
|
|
return true; | return true; |
} | } |
| |
|
|
Boolean IndicationService::_getActiveSubscriptionsFromRepository ( |
|
Array <CIMInstance> & activeSubscriptions) const |
|
{ |
|
Array <CIMNamespaceName> nameSpaceNames; |
|
Array <CIMInstance> subscriptions; |
|
CIMValue subscriptionStateValue; |
|
Uint16 subscriptionState; |
|
Boolean warningLogged = false; |
|
|
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
|
"IndicationService::_getActiveSubscriptionsFromRepository"); |
|
|
|
activeSubscriptions.clear (); |
|
|
|
// |
|
// Get list of namespaces in repository |
|
// |
|
nameSpaceNames = _repository->enumerateNameSpaces (); |
|
|
|
// |
|
// Get existing subscriptions from each namespace in the repository |
|
// |
|
for (Uint32 i = 0; i < nameSpaceNames.size (); i++) |
|
{ |
|
|
|
// |
|
// Get existing subscriptions in current namespace |
|
// |
|
subscriptions = _getSubscriptions (nameSpaceNames [i]); |
|
|
|
// |
|
// Process each subscription |
|
// |
|
for (Uint32 j = 0; j < subscriptions.size (); j++) |
|
{ |
|
// |
|
// Get subscription state |
|
// |
|
if (!_getState (subscriptions [j], subscriptionState)) |
|
{ |
|
// |
|
// This instance from the repository is corrupted |
|
// Skip it |
|
// L10N TODO DONE -- new log message |
|
// |
|
if (!warningLogged) |
|
{ |
|
//Logger::put (Logger::STANDARD_LOG, System::CIMSERVER, |
|
//Logger::WARNING, _MSG_INVALID_INSTANCES); |
|
Logger::put_l(Logger::STANDARD_LOG, System::CIMSERVER, |
|
Logger::WARNING, |
|
_MSG_INVALID_INSTANCES_KEY, |
|
_MSG_INVALID_INSTANCES); |
|
warningLogged = true; |
|
} |
|
break; |
|
} |
|
|
|
// |
|
// Process each enabled subscription |
|
// |
|
if ((subscriptionState == _STATE_ENABLED) || |
|
(subscriptionState == _STATE_ENABLEDDEGRADED)) |
|
{ |
|
// |
|
// CIMInstances returned from repository do not include |
|
// namespace |
|
// Set namespace here |
|
// |
|
CIMObjectPath instanceName = |
|
subscriptions [j].getPath (); |
|
instanceName.setNameSpace (nameSpaceNames [i]); |
|
subscriptions [j].setPath (instanceName); |
|
activeSubscriptions.append (subscriptions [j]); |
|
} // if subscription is enabled |
|
} // for each subscription |
|
} // for each namespace |
|
|
|
PEG_METHOD_EXIT (); |
|
return warningLogged; |
|
} |
|
|
|
Array <CIMInstance> IndicationService::_getActiveSubscriptions () |
|
{ |
|
Array <CIMInstance> activeSubscriptions; |
|
|
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
|
"IndicationService::_getActiveSubscriptions"); |
|
|
|
// Do not call any other methods that need _activeSubscriptionsTableLock |
|
ReadLock lock(_activeSubscriptionsTableLock); |
|
|
|
// |
|
// Iterate through the subscription table |
|
// |
|
for (ActiveSubscriptionsTable::Iterator i = |
|
_activeSubscriptionsTable.start (); i; i++) |
|
{ |
|
// |
|
// Append subscription to the list |
|
// |
|
activeSubscriptions.append (i.value ().subscription); |
|
} |
|
|
|
PEG_METHOD_EXIT (); |
|
return activeSubscriptions; |
|
} |
|
|
|
|
|
Array <CIMInstance> IndicationService::_getMatchingSubscriptions ( | Array <CIMInstance> IndicationService::_getMatchingSubscriptions ( |
const CIMName & supportedClass, | const CIMName & supportedClass, |
const Array <CIMNamespaceName> nameSpaces, | const Array <CIMNamespaceName> nameSpaces, |
|
|
const Boolean checkProvider, | const Boolean checkProvider, |
const CIMInstance & provider) | const CIMInstance & provider) |
{ | { |
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
|
"IndicationService::_getMatchingSubscriptions"); |
|
|
Array <CIMInstance> matchingSubscriptions; | Array <CIMInstance> matchingSubscriptions; |
Array <CIMInstance> subscriptions; | Array <CIMInstance> subscriptions; |
| |
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
subscriptions = _subscriptionTable->getMatchingSubscriptions |
"IndicationService::_getMatchingSubscriptions"); |
(supportedClass, nameSpaces, checkProvider, provider); |
| |
for (Uint32 i = 0; i < nameSpaces.size (); i++) |
for (Uint32 i = 0; i < subscriptions.size (); i++) |
{ |
|
// |
|
// Look up the indicationClass-sourceNamespace pair in the |
|
// Subscription Classes table |
|
// |
|
String subscriptionClassesKey = _generateSubscriptionClassesKey |
|
(supportedClass, nameSpaces [i]); |
|
SubscriptionClassesTableEntry tableValue; |
|
if (_lockedLookupSubscriptionClassesEntry (subscriptionClassesKey, |
|
tableValue)) |
|
{ |
|
subscriptions = tableValue.subscriptions; |
|
for (Uint32 j = 0; j < subscriptions.size (); j++) |
|
{ | { |
Boolean match = true; | Boolean match = true; |
| |
if (checkProvider) |
|
{ |
|
// |
|
// Check if the provider who generated this indication |
|
// accepted this subscription |
|
// |
|
String activeSubscriptionsKey = |
|
_generateActiveSubscriptionsKey |
|
(subscriptions [j].getPath ()); |
|
ActiveSubscriptionsTableEntry tableValue; |
|
if (_lockedLookupActiveSubscriptionsEntry |
|
(activeSubscriptionsKey, tableValue)) |
|
{ |
|
// |
|
// If provider is not in list, it did not accept the |
|
// subscription |
|
// |
|
if ((_providerInList (provider, tableValue)) == |
|
PEG_NOT_FOUND) |
|
{ |
|
match = false; |
|
break; |
|
} |
|
} |
|
} |
|
|
|
// | // |
// If supported properties is null (all properties) | // If supported properties is null (all properties) |
// the subscription can be supported | // the subscription can be supported |
|
|
// | // |
// Get filter properties | // Get filter properties |
// | // |
_getFilterProperties (subscriptions [j], |
_subscriptionRepository->getFilterProperties |
subscriptions [j].getPath ().getNameSpace (), |
(subscriptions [i], |
|
subscriptions [i].getPath ().getNameSpace (), |
filterQuery, sourceNameSpace); | filterQuery, sourceNameSpace); |
selectStatement = _getSelectStatement (filterQuery); | selectStatement = _getSelectStatement (filterQuery); |
| |
|
|
// Compare subscription property list | // Compare subscription property list |
// with supported property list | // with supported property list |
// | // |
for (Uint32 k = 0; |
for (Uint32 j = 0; |
k < propertyList.size () && match; |
j < propertyList.size () && match; |
k++) |
j++) |
{ | { |
if (!ContainsCIMName | if (!ContainsCIMName |
(supportedProperties.getPropertyNameArray(), | (supportedProperties.getPropertyNameArray(), |
propertyList[k])) |
propertyList [j])) |
{ | { |
match = false; | match = false; |
break; | break; |
|
|
// | // |
// Add current subscription to list | // Add current subscription to list |
// | // |
matchingSubscriptions.append (subscriptions [j]); |
matchingSubscriptions.append (subscriptions [i]); |
} |
|
} |
|
} | } |
} | } |
| |
|
|
Array <CIMInstance> & newSubscriptions, | Array <CIMInstance> & newSubscriptions, |
Array <CIMInstance> & formerSubscriptions) | Array <CIMInstance> & formerSubscriptions) |
{ | { |
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
|
"IndicationService::_getModifiedSubscriptions"); |
|
|
Array <CIMInstance> newList; | Array <CIMInstance> newList; |
Array <CIMInstance> formerList; | Array <CIMInstance> formerList; |
Array <CIMInstance> bothList; | Array <CIMInstance> bothList; |
| |
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
|
"IndicationService::_getModifiedSubscriptions"); |
|
|
|
newSubscriptions.clear (); | newSubscriptions.clear (); |
formerSubscriptions.clear (); | formerSubscriptions.clear (); |
| |
|
|
// For each newly supported namespace, lookup to retrieve list of | // For each newly supported namespace, lookup to retrieve list of |
// subscriptions for the indication class-source namespace pair | // subscriptions for the indication class-source namespace pair |
// | // |
for (Uint32 i = 0; i < newNameSpaces.size (); i++) |
newList = _subscriptionTable->getMatchingSubscriptions |
{ |
(supportedClass, newNameSpaces); |
// |
|
// Look up the indicationClass-sourceNamespace pair in the |
|
// Subscription Classes table |
|
// |
|
String subscriptionClassesKey = _generateSubscriptionClassesKey |
|
(supportedClass, newNameSpaces [i]); |
|
SubscriptionClassesTableEntry tableValue; |
|
if (_lockedLookupSubscriptionClassesEntry (subscriptionClassesKey, |
|
tableValue)) |
|
{ |
|
for (Uint32 j = 0; j < tableValue.subscriptions.size (); j++) |
|
newList.append (tableValue.subscriptions [j]); |
|
} |
|
} |
|
| |
// | // |
// For each formerly supported namespace, lookup to retrieve list of | // For each formerly supported namespace, lookup to retrieve list of |
// subscriptions for the indication class-source namespace pair | // subscriptions for the indication class-source namespace pair |
// | // |
for (Uint32 k = 0; k < oldNameSpaces.size (); k++) |
formerList = _subscriptionTable->getMatchingSubscriptions |
{ |
(supportedClass, oldNameSpaces); |
// |
|
// Look up the indicationClass-sourceNamespace pair in the |
|
// Subscription Classes table |
|
// |
|
String subscriptionClassesKey = _generateSubscriptionClassesKey |
|
(supportedClass, oldNameSpaces [k]); |
|
SubscriptionClassesTableEntry tableValue; |
|
if (_lockedLookupSubscriptionClassesEntry (subscriptionClassesKey, |
|
tableValue)) |
|
{ |
|
for (Uint32 m = 0; m < tableValue.subscriptions.size (); m++) |
|
formerList.append (tableValue.subscriptions [m]); |
|
} |
|
} |
|
| |
// | // |
// Find subscriptions that appear in both lists, and move them to a third | // Find subscriptions that appear in both lists, and move them to a third |
|
|
// | // |
// Get filter properties | // Get filter properties |
// | // |
_getFilterProperties (newList [n], |
_subscriptionRepository->getFilterProperties (newList [n], |
newList [n].getPath ().getNameSpace (), filterQuery, | newList [n].getPath ().getNameSpace (), filterQuery, |
sourceNameSpace); | sourceNameSpace); |
selectStatement = _getSelectStatement (filterQuery); | selectStatement = _getSelectStatement (filterQuery); |
|
|
// | // |
// Get filter properties | // Get filter properties |
// | // |
_getFilterProperties (bothList [b], |
_subscriptionRepository->getFilterProperties (bothList [b], |
bothList [b].getPath ().getNameSpace (), filterQuery, | bothList [b].getPath ().getNameSpace (), filterQuery, |
sourceNameSpace); | sourceNameSpace); |
selectStatement = _getSelectStatement (filterQuery); | selectStatement = _getSelectStatement (filterQuery); |
|
|
PEG_METHOD_EXIT (); | PEG_METHOD_EXIT (); |
} | } |
| |
Array <CIMInstance> IndicationService::_getSubscriptions ( |
|
const CIMNamespaceName & nameSpaceName) const |
|
{ |
|
Array <CIMInstance> subscriptions; |
|
|
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
|
"IndicationService::_getSubscriptions"); |
|
|
|
// |
|
// Get existing subscriptions in current namespace |
|
// |
|
try |
|
{ |
|
subscriptions = _repository->enumerateInstances |
|
(nameSpaceName, PEGASUS_CLASSNAME_INDSUBSCRIPTION); |
|
} |
|
catch (CIMException& e) |
|
{ |
|
// |
|
// Some namespaces may not include the subscription class |
|
// In that case, just return no subscriptions |
|
// Any other exception is an error |
|
// |
|
if (e.getCode () != CIM_ERR_INVALID_CLASS) |
|
{ |
|
PEG_METHOD_EXIT (); |
|
throw e; |
|
} |
|
} |
|
|
|
PEG_METHOD_EXIT (); |
|
return subscriptions; |
|
} |
|
|
|
Boolean IndicationService::_inPropertyList ( | Boolean IndicationService::_inPropertyList ( |
const CIMPropertyList & requiredProperties, | const CIMPropertyList & requiredProperties, |
const CIMPropertyList & supportedProperties) | const CIMPropertyList & supportedProperties) |
|
|
// | // |
for (Uint32 i = 0; i < requiredProperties.size (); i++) | for (Uint32 i = 0; i < requiredProperties.size (); i++) |
{ | { |
if (!ContainsCIMName (supportedProperties.getPropertyNameArray (), |
if (!ContainsCIMName |
|
(supportedProperties.getPropertyNameArray (), |
requiredProperties[i])) | requiredProperties[i])) |
{ | { |
return false; | return false; |
|
|
return true; | return true; |
} | } |
| |
Array <CIMInstance> IndicationService::_getProviderSubscriptions ( |
WQLSelectStatement IndicationService::_getSelectStatement ( |
const CIMInstance & provider) |
const String & filterQuery) const |
{ | { |
Array <CIMInstance> providerSubscriptions; |
|
|
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, | PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
"IndicationService::_getProviderSubscriptions"); |
"IndicationService::_getSelectStatement"); |
| |
// |
|
// Iterate through the subscription table to find subscriptions served by |
|
// the provider |
|
// NOTE: updating entries (remove and insert) while iterating through the |
|
// table does not work reliably, and it is not clear if that is supposed to |
|
// work; for now, the IndicationService first iterates through the active |
|
// subscriptions table to find subscriptions served by the provider, then |
|
// looks up and updates each affected subscription |
|
// |
|
{ |
|
// |
|
// Do not call any other methods that need _activeSubscriptionsTableLock |
|
// |
|
ReadLock lock (_activeSubscriptionsTableLock); |
|
|
|
CIMClass providerClass = _repository->getClass |
|
(PEGASUS_NAMESPACENAME_INTEROP, PEGASUS_CLASSNAME_PROVIDER, |
|
true, true, false, CIMPropertyList ()); |
|
for (ActiveSubscriptionsTable::Iterator i = |
|
_activeSubscriptionsTable.start (); i; i++) |
|
{ |
|
// |
|
// If provider matches, append subscription to the list |
|
// |
|
ActiveSubscriptionsTableEntry tableValue = i.value (); |
|
for (Uint32 j = 0; j < tableValue.providers.size (); j++) |
|
{ |
|
if (_sameInstance (tableValue.providers [j].provider, provider, |
|
providerClass)) |
|
{ |
|
// |
|
// Add the subscription to the list |
|
// |
|
providerSubscriptions.append (tableValue.subscription); |
|
break; |
|
} |
|
} |
|
} |
|
} |
|
|
|
// |
|
// Look up and update hash table entry for each affected subscription |
|
// |
|
for (Uint32 k = 0; k < providerSubscriptions.size (); k++) |
|
{ |
|
// |
|
// Update the entry in the active subscriptions hash table |
|
// |
|
String activeSubscriptionsKey = _generateActiveSubscriptionsKey |
|
(providerSubscriptions [k].getPath ()); |
|
ActiveSubscriptionsTableEntry tableValue; |
|
if (_lockedLookupActiveSubscriptionsEntry (activeSubscriptionsKey, |
|
tableValue)) |
|
{ |
|
// |
|
// Remove the provider from the list of providers serving the |
|
// subscription |
|
// |
|
Uint32 providerIndex = _providerInList (provider, tableValue); |
|
if (providerIndex != PEG_NOT_FOUND) |
|
{ |
|
tableValue.providers.remove (providerIndex); |
|
if (tableValue.providers.size () > 0) |
|
{ |
|
// |
|
// At least one provider is still serving the |
|
// subscription |
|
// Update entry in Active Subscriptions table |
|
// |
|
WriteLock lock (_activeSubscriptionsTableLock); |
|
_removeActiveSubscriptionsEntry |
|
(activeSubscriptionsKey); |
|
_insertActiveSubscriptionsEntry |
|
(tableValue.subscription, tableValue.providers); |
|
} |
|
else |
|
{ |
|
// |
|
// If the terminated provider was the only provider |
|
// serving the subscription, implement the |
|
// subscription's On Fatal Error Policy |
|
// |
|
if (!_handleError (tableValue.subscription)) |
|
{ |
|
// |
|
// If subscription was not disabled or deleted |
|
// Update entry in Active Subscriptions table |
|
// |
|
WriteLock lock (_activeSubscriptionsTableLock); |
|
_removeActiveSubscriptionsEntry |
|
(activeSubscriptionsKey); |
|
_insertActiveSubscriptionsEntry |
|
(tableValue.subscription, tableValue.providers); |
|
} |
|
} |
|
} |
|
else |
|
{ |
|
PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2, |
|
"Provider (" + provider.getPath().toString() + |
|
") not found in list for Subscription (" + |
|
activeSubscriptionsKey + |
|
") in ActiveSubscriptionsTable"); |
|
} |
|
} |
|
else |
|
{ |
|
PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2, |
|
"Subscription (" + activeSubscriptionsKey + |
|
") not found in ActiveSubscriptionsTable"); |
|
// |
|
// The subscription may have been deleted in the mean time |
|
// If so, no further update is required |
|
// |
|
} |
|
} |
|
|
|
PEG_METHOD_EXIT (); |
|
return providerSubscriptions; |
|
} |
|
|
|
Boolean IndicationService::_providerInUse ( |
|
const CIMInstance & provider) |
|
{ |
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
|
"IndicationService::_providerInUse"); |
|
|
|
// |
|
// The caller must acquire a lock on the Active Subscriptions table |
|
// before calling |
|
// |
|
|
|
// |
|
// Iterate through the subscription table |
|
// |
|
CIMClass providerClass = _repository->getClass |
|
(PEGASUS_NAMESPACENAME_INTEROP, PEGASUS_CLASSNAME_PROVIDER, |
|
true, true, false, CIMPropertyList ()); |
|
for (ActiveSubscriptionsTable::Iterator i = |
|
_activeSubscriptionsTable.start (); i; i++) |
|
{ |
|
// |
|
// If provider matches, return true |
|
// |
|
for (Uint32 j = 0; j < i.value ().providers.size (); j++) |
|
{ |
|
ActiveSubscriptionsTableEntry tableValue = i.value (); |
|
if (_sameInstance (tableValue.providers [j].provider, provider, |
|
providerClass)) |
|
{ |
|
return true; |
|
} |
|
} |
|
} |
|
|
|
PEG_METHOD_EXIT (); |
|
return false; |
|
} |
|
|
|
void IndicationService::_getFilterProperties ( |
|
const CIMInstance & subscription, |
|
const CIMNamespaceName & nameSpaceName, |
|
String & query, |
|
CIMNamespaceName & sourceNameSpace, |
|
String & queryLanguage) |
|
{ |
|
CIMValue filterValue; |
|
CIMObjectPath filterReference; |
|
CIMInstance filterInstance; |
|
|
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
|
"IndicationService::_getFilterProperties"); |
|
|
|
filterValue = subscription.getProperty (subscription.findProperty |
|
(_PROPERTY_FILTER)).getValue (); |
|
|
|
filterValue.get (filterReference); |
|
|
|
try |
|
{ |
|
filterInstance = _repository->getInstance (nameSpaceName, |
|
filterReference); |
|
} |
|
catch (Exception & exception) |
|
{ |
|
PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2, |
|
"Exception caught in getting filter instance (" + |
|
filterReference.toString() + "): " + |
|
exception.getMessage ()); |
|
PEG_METHOD_EXIT (); |
|
throw; |
|
} |
|
|
|
query = filterInstance.getProperty (filterInstance.findProperty |
|
(_PROPERTY_QUERY)).getValue ().toString (); |
|
|
|
sourceNameSpace = filterInstance.getProperty (filterInstance.findProperty |
|
(_PROPERTY_SOURCENAMESPACE)).getValue ().toString (); |
|
|
|
queryLanguage = filterInstance.getProperty |
|
(filterInstance.findProperty (_PROPERTY_QUERYLANGUAGE)). |
|
getValue ().toString (); |
|
|
|
PEG_METHOD_EXIT (); |
|
} |
|
|
|
void IndicationService::_getFilterProperties ( |
|
const CIMInstance & subscription, |
|
const CIMNamespaceName & nameSpaceName, |
|
String & query, |
|
CIMNamespaceName & sourceNameSpace) |
|
{ |
|
CIMValue filterValue; |
|
CIMObjectPath filterReference; |
|
CIMInstance filterInstance; |
|
|
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
|
"IndicationService::_getFilterProperties"); |
|
|
|
filterValue = subscription.getProperty (subscription.findProperty |
|
(_PROPERTY_FILTER)).getValue (); |
|
|
|
filterValue.get (filterReference); |
|
|
|
try |
|
{ |
|
filterInstance = _repository->getInstance (nameSpaceName, |
|
filterReference); |
|
} |
|
catch (Exception & exception) |
|
{ |
|
PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2, |
|
"Exception caught in getting filter instance (" + |
|
filterReference.toString() + "): " + |
|
exception.getMessage ()); |
|
PEG_METHOD_EXIT (); |
|
throw; |
|
} |
|
|
|
query = filterInstance.getProperty (filterInstance.findProperty |
|
(_PROPERTY_QUERY)).getValue ().toString (); |
|
|
|
sourceNameSpace = filterInstance.getProperty (filterInstance.findProperty |
|
(_PROPERTY_SOURCENAMESPACE)).getValue ().toString (); |
|
|
|
PEG_METHOD_EXIT (); |
|
} |
|
|
|
void IndicationService::_getFilterProperties ( |
|
const CIMInstance & subscription, |
|
const CIMNamespaceName & nameSpaceName, |
|
String & query) |
|
{ |
|
CIMValue filterValue; |
|
CIMObjectPath filterReference; |
|
CIMInstance filterInstance; |
|
|
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
|
"IndicationService::_getFilterProperties"); |
|
|
|
filterValue = subscription.getProperty (subscription.findProperty |
|
(_PROPERTY_FILTER)).getValue (); |
|
|
|
filterValue.get (filterReference); |
|
|
|
try |
|
{ |
|
filterInstance = _repository->getInstance (nameSpaceName, |
|
filterReference); |
|
} |
|
catch (Exception & exception) |
|
{ |
|
PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2, |
|
"Exception caught in getting filter instance (" + |
|
filterReference.toString() + "): " + |
|
exception.getMessage ()); |
|
PEG_METHOD_EXIT (); |
|
throw; |
|
} |
|
|
|
query = filterInstance.getProperty (filterInstance.findProperty |
|
(_PROPERTY_QUERY)).getValue ().toString (); |
|
|
|
PEG_METHOD_EXIT (); |
|
} |
|
|
|
WQLSelectStatement IndicationService::_getSelectStatement ( |
|
const String & filterQuery) const |
|
{ |
|
WQLSelectStatement selectStatement; | WQLSelectStatement selectStatement; |
| |
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
|
"IndicationService::_getSelectStatement"); |
|
|
|
try | try |
{ | { |
selectStatement.clear (); | selectStatement.clear (); |
|
|
const WQLSelectStatement & selectStatement, | const WQLSelectStatement & selectStatement, |
const CIMNamespaceName & nameSpaceName) const | const CIMNamespaceName & nameSpaceName) const |
{ | { |
CIMName indicationClassName; |
|
Array <CIMName> indicationSubclasses; |
|
|
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, | PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
"IndicationService::_getIndicationClassName"); | "IndicationService::_getIndicationClassName"); |
| |
|
CIMName indicationClassName; |
|
Array <CIMName> indicationSubclasses; |
|
|
indicationClassName = selectStatement.getClassName (); | indicationClassName = selectStatement.getClassName (); |
| |
// | // |
// Validate that class is an Indication class | // Validate that class is an Indication class |
// The Indication Qualifier should exist and have the value True | // The Indication Qualifier should exist and have the value True |
// | // |
Boolean validClass = false; |
Boolean validClass = _subscriptionRepository->validateIndicationClassName |
CIMClass theClass; |
(indicationClassName, nameSpaceName); |
|
|
try |
|
{ |
|
theClass = _repository->getClass ( |
|
nameSpaceName, |
|
indicationClassName, |
|
false, |
|
true, |
|
false, |
|
CIMPropertyList()); |
|
} |
|
catch (Exception&) |
|
{ |
|
PEG_METHOD_EXIT (); |
|
throw; |
|
} |
|
|
|
if (theClass.findQualifier (_QUALIFIER_INDICATION) != PEG_NOT_FOUND) |
|
{ |
|
CIMQualifier theQual = theClass.getQualifier (theClass.findQualifier |
|
(_QUALIFIER_INDICATION)); |
|
CIMValue theVal = theQual.getValue (); |
|
if (!theVal.isNull ()) |
|
{ |
|
Boolean indicationClass; |
|
theVal.get (indicationClass); |
|
validClass = indicationClass; |
|
} |
|
} |
|
| |
if (!validClass) | if (!validClass) |
{ | { |
// l10n | // l10n |
|
|
// String exceptionStr = _MSG_INVALID_CLASSNAME; | // String exceptionStr = _MSG_INVALID_CLASSNAME; |
String exceptionStr = String("Invalid indication class name "); | String exceptionStr = String("Invalid indication class name "); |
// exceptionStr.append (indicationClassName.getString()); | // exceptionStr.append (indicationClassName.getString()); |
|
|
| |
throw PEGASUS_CIM_EXCEPTION_L (CIM_ERR_INVALID_PARAMETER, | throw PEGASUS_CIM_EXCEPTION_L (CIM_ERR_INVALID_PARAMETER, |
MessageLoaderParms ( | MessageLoaderParms ( |
_MSG_INVALID_CLASSNAME_IN_FROM_PROPERTY_KEY, |
_MSG_INVALID_CLASSNAME_IN_FROM_PROPERTY_KEY, exceptionStr, |
exceptionStr, |
|
indicationClassName.getString(), | indicationClassName.getString(), |
PEGASUS_CLASSNAME_INDFILTER.getString(), | PEGASUS_CLASSNAME_INDFILTER.getString(), |
_PROPERTY_QUERY.getString())); | _PROPERTY_QUERY.getString())); |
|
|
return indicationClassName; | return indicationClassName; |
} | } |
| |
Array <CIMName> IndicationService::_getIndicationSubclasses ( |
Array <ProviderClassList> IndicationService::_getIndicationProviders ( |
const CIMNamespaceName & nameSpace, |
|
const CIMName & indicationClassName) const |
|
{ |
|
Array <CIMName> indicationSubclasses; |
|
|
|
const char METHOD_NAME [] = "IndicationService::_getIndicationSubclasses"; |
|
|
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
|
"IndicationService::_getIndicationSubclasses"); |
|
|
|
try |
|
{ |
|
indicationSubclasses = _repository->enumerateClassNames |
|
(nameSpace, indicationClassName, true); |
|
} |
|
catch (Exception&) |
|
{ |
|
PEG_METHOD_EXIT (); |
|
throw; |
|
} |
|
|
|
indicationSubclasses.append (indicationClassName); |
|
|
|
PEG_METHOD_EXIT (); |
|
return indicationSubclasses; |
|
} |
|
|
|
Array <ProviderClassList> |
|
IndicationService::_getIndicationProviders ( |
|
const CIMNamespaceName & nameSpace, | const CIMNamespaceName & nameSpace, |
const CIMName & indicationClassName, | const CIMName & indicationClassName, |
const Array <CIMName> & indicationSubclasses, | const Array <CIMName> & indicationSubclasses, |
const CIMPropertyList & requiredPropertyList) const | const CIMPropertyList & requiredPropertyList) const |
{ | { |
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
|
"IndicationService::_getIndicationProviders"); |
|
|
ProviderClassList provider; | ProviderClassList provider; |
Array <ProviderClassList> indicationProviders; | Array <ProviderClassList> indicationProviders; |
Array <CIMInstance> providerInstances; | Array <CIMInstance> providerInstances; |
Array <CIMInstance> providerModuleInstances; | Array <CIMInstance> providerModuleInstances; |
Boolean duplicate = false; | Boolean duplicate = false; |
| |
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
|
"IndicationService::_getIndicationProviders"); |
|
|
|
// | // |
// For each indication subclass, get providers | // For each indication subclass, get providers |
// | // |
CIMClass providerClass = _repository->getClass |
CIMClass providerClass = _subscriptionRepository->getClass |
(PEGASUS_NAMESPACENAME_INTEROP, PEGASUS_CLASSNAME_PROVIDER, | (PEGASUS_NAMESPACENAME_INTEROP, PEGASUS_CLASSNAME_PROVIDER, |
true, true, false, CIMPropertyList ()); | true, true, false, CIMPropertyList ()); |
CIMClass providerModuleClass = _repository->getClass |
CIMClass providerModuleClass = _subscriptionRepository->getClass |
(PEGASUS_NAMESPACENAME_INTEROP, PEGASUS_CLASSNAME_PROVIDERMODULE, | (PEGASUS_NAMESPACENAME_INTEROP, PEGASUS_CLASSNAME_PROVIDERMODULE, |
true, true, false, CIMPropertyList ()); | true, true, false, CIMPropertyList ()); |
for (Uint32 i = 0; i < indicationSubclasses.size (); i++) | for (Uint32 i = 0; i < indicationSubclasses.size (); i++) |
|
|
duplicate = false; | duplicate = false; |
| |
// | // |
|
// Set path in each instance, so instances may later be easily |
|
// compared |
|
// ATTN: this code may be removed once bugzilla 1196 has been |
|
// fixed |
|
// (including getClass calls above) |
|
// |
|
providerInstances [j].setPath |
|
(providerInstances [j].buildPath (providerClass)); |
|
providerModuleInstances [j].setPath |
|
(providerModuleInstances [j].buildPath |
|
(providerModuleClass)); |
|
|
|
// |
// See if indication provider is already in list | // See if indication provider is already in list |
// | // |
for (Uint32 k = 0; | for (Uint32 k = 0; |
k < indicationProviders.size () && !duplicate; k++) | k < indicationProviders.size () && !duplicate; k++) |
{ | { |
if ((_sameInstance (providerInstances [j], |
if ((providerInstances [j].getPath ().identical |
indicationProviders [k].provider, |
(indicationProviders [k].provider.getPath ())) && |
providerClass)) && |
(providerModuleInstances [j].getPath ().identical |
(_sameInstance (providerModuleInstances [j], |
(indicationProviders [k].providerModule.getPath ()))) |
indicationProviders [k].providerModule, |
|
providerModuleClass))) |
|
{ | { |
// | // |
// Indication provider is already in list | // Indication provider is already in list |
|
|
const CIMNamespaceName & nameSpaceName, | const CIMNamespaceName & nameSpaceName, |
const CIMName & indicationClassName) const | const CIMName & indicationClassName) const |
{ | { |
CIMPropertyList propertyList; |
|
|
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, | PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
"IndicationService::_getPropertyList"); | "IndicationService::_getPropertyList"); |
| |
|
CIMPropertyList propertyList; |
|
|
// | // |
// Get all the properties referenced in the projection list (SELECT clause) | // Get all the properties referenced in the projection list (SELECT clause) |
// | // |
|
|
// | // |
CIMClass indicationClass; | CIMClass indicationClass; |
| |
try |
|
{ |
|
// | // |
// Get the indication class object from the repository | // Get the indication class object from the repository |
// Specify localOnly=false because superclass properties are needed | // Specify localOnly=false because superclass properties are needed |
// Specify includeQualifiers=false because qualifiers are not needed | // Specify includeQualifiers=false because qualifiers are not needed |
// | // |
indicationClass = _repository->getClass (nameSpaceName, |
indicationClass = _subscriptionRepository->getClass |
indicationClassName, false, false, false, CIMPropertyList ()); |
(nameSpaceName, indicationClassName, false, false, false, |
} |
CIMPropertyList ()); |
catch (Exception&) |
|
{ |
|
PEG_METHOD_EXIT (); |
|
throw; |
|
} |
|
| |
Boolean allProperties = true; | Boolean allProperties = true; |
for (Uint32 i = 0; | for (Uint32 i = 0; |
|
|
String IndicationService::_getCondition | String IndicationService::_getCondition |
(const String & filterQuery) const | (const String & filterQuery) const |
{ | { |
String condition = String::EMPTY; |
|
|
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, | PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
"IndicationService::_getCondition"); | "IndicationService::_getCondition"); |
| |
|
String condition = String::EMPTY; |
|
|
// | // |
// Get condition substring from filter query | // Get condition substring from filter query |
// | // |
|
|
return condition; | return condition; |
} | } |
| |
|
void IndicationService::_deleteReferencingSubscriptions ( |
CIMInstance IndicationService::_getHandler ( |
const CIMNamespaceName & nameSpace, |
const CIMInstance & subscription) const |
const CIMName & referenceProperty, |
|
const CIMObjectPath & handler) |
{ | { |
CIMValue handlerValue; |
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
CIMObjectPath handlerRef; |
"IndicationService::_deleteReferencingSubscriptions"); |
CIMInstance handlerInstance; |
|
| |
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, "IndicationService::_getHandler"); |
Array <CIMInstance> deletedSubscriptions; |
| |
// | // |
// Get Handler reference from subscription instance |
// Delete referencing subscriptions from the repository |
// | // |
handlerValue = subscription.getProperty |
deletedSubscriptions = |
(subscription.findProperty |
_subscriptionRepository->deleteReferencingSubscriptions |
(_PROPERTY_HANDLER)).getValue (); |
(nameSpace, referenceProperty, handler); |
|
|
handlerValue.get (handlerRef); |
|
| |
// | // |
// Get Handler instance from the repository |
// Send delete request to each provider for each deleted subscription |
// | // |
try |
for (Uint32 i = 0; i < deletedSubscriptions.size (); i++) |
{ | { |
handlerInstance = _repository->getInstance |
|
(subscription.getPath ().getNameSpace (), handlerRef, |
|
false, false, false, CIMPropertyList ()); |
|
} |
|
catch (Exception&) |
|
{ |
|
PEG_METHOD_EXIT (); |
|
throw; |
|
} |
|
|
|
// |
|
// Set namespace in path in CIMInstance |
|
// |
|
handlerRef.setNameSpace |
|
(subscription.getPath ().getNameSpace ()); |
|
handlerInstance.setPath (handlerRef); |
|
|
|
PEG_METHOD_EXIT (); |
|
return handlerInstance; |
|
} |
|
|
|
Boolean IndicationService::_isTransient ( |
|
const CIMNamespaceName & nameSpace, |
|
const CIMObjectPath & handler) const |
|
{ |
|
CIMValue persistenceValue; |
|
Uint16 persistenceType; |
|
|
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
|
"IndicationService::_isTransient"); |
|
|
|
// |
|
// Get the handler instance from the respository |
|
// |
|
CIMInstance instance; |
|
|
|
try |
|
{ |
|
instance = _repository->getInstance (nameSpace, handler, |
|
false, false, false, CIMPropertyList ()); |
|
} |
|
catch (Exception&) |
|
{ |
|
PEG_METHOD_EXIT (); |
|
throw; |
|
} |
|
|
|
// |
|
// Get Persistence Type |
|
// |
|
persistenceValue = instance.getProperty (instance.findProperty |
|
(_PROPERTY_PERSISTENCETYPE)).getValue (); |
|
persistenceValue.get (persistenceType); |
|
|
|
// |
|
// If Persistence Type is Other, Other Persistence Type |
|
// property must exist |
|
// |
|
if (persistenceType == _PERSISTENCE_TRANSIENT) |
|
{ |
|
PEG_METHOD_EXIT (); |
|
return true; |
|
} |
|
else |
|
{ |
|
PEG_METHOD_EXIT (); |
|
return false; |
|
} |
|
} |
|
|
|
void IndicationService::_deleteReferencingSubscriptions ( |
|
const CIMNamespaceName & nameSpace, |
|
const CIMName & referenceProperty, |
|
const CIMObjectPath & handler) |
|
{ |
|
Array <CIMInstance> subscriptions; |
|
|
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
|
"IndicationService::_deleteReferencingSubscriptions"); |
|
|
|
// |
|
// Get existing subscriptions in the namespace |
|
// |
|
subscriptions = _getSubscriptions (nameSpace); |
|
|
|
// |
|
// Check each subscription for a reference to the specified instance |
|
// |
|
for (Uint32 i = 0; i < subscriptions.size (); i++) |
|
{ |
|
// |
|
// Get the reference property value from the subscription instance |
|
// |
|
CIMValue propValue = subscriptions [i].getProperty |
|
(subscriptions [i].findProperty |
|
(referenceProperty)).getValue (); |
|
CIMObjectPath ref; |
|
propValue.get (ref); |
|
|
|
// |
|
// If the current subscription references the specified instance, |
|
// delete it |
|
// |
|
if (handler == ref) |
|
{ |
|
// |
|
// Delete referencing subscription instance from repository |
|
// |
|
try |
|
{ |
|
// |
|
// Namespace and host must not be set in path passed to |
|
// repository |
|
// |
|
CIMObjectPath path ("", CIMNamespaceName (), |
|
subscriptions [i].getPath ().getClassName(), |
|
subscriptions [i].getPath ().getKeyBindings()); |
|
_repository->deleteInstance (nameSpace, path); |
|
} |
|
catch (Exception & exception) |
|
{ |
|
// |
|
// Deletion of referencing subscription failed |
|
// |
|
PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2, |
|
"Exception caught in deleting referencing subscription (" + |
|
subscriptions[i].getPath().toString() + "): " + |
|
exception.getMessage ()); |
|
} |
|
|
|
Array <ProviderClassList> indicationProviders; | Array <ProviderClassList> indicationProviders; |
Array <CIMName> indicationSubclasses; | Array <CIMName> indicationSubclasses; |
CIMNamespaceName sourceNamespaceName; | CIMNamespaceName sourceNamespaceName; |
| |
CIMObjectPath path = subscriptions [i].getPath (); |
CIMObjectPath path = deletedSubscriptions [i].getPath (); |
path.setNameSpace (nameSpace); | path.setNameSpace (nameSpace); |
subscriptions [i].setPath (path); |
deletedSubscriptions [i].setPath (path); |
| |
indicationProviders = _getDeleteParams (nameSpace, | indicationProviders = _getDeleteParams (nameSpace, |
subscriptions [i], indicationSubclasses, sourceNamespaceName); |
deletedSubscriptions [i], indicationSubclasses, |
|
sourceNamespaceName); |
| |
// | // |
// Send Delete requests | // Send Delete requests |
|
|
// The Creator from the subscription instance is used for userName, | // The Creator from the subscription instance is used for userName, |
// and authType is not set | // and authType is not set |
// | // |
CIMInstance instance = subscriptions [i]; |
CIMInstance instance = deletedSubscriptions [i]; |
String creator = String::EMPTY; | String creator = String::EMPTY; |
_getCreator (instance, creator); | _getCreator (instance, creator); |
| |
// l10n start | // l10n start |
String acceptLangs = String::EMPTY; | String acceptLangs = String::EMPTY; |
Uint32 propIndex = instance.findProperty(PEGASUS_PROPERTYNAME_INDSUB_ACCEPTLANGS); |
Uint32 propIndex = instance.findProperty |
|
(PEGASUS_PROPERTYNAME_INDSUB_ACCEPTLANGS); |
if (propIndex != PEG_NOT_FOUND) | if (propIndex != PEG_NOT_FOUND) |
{ | { |
instance.getProperty(propIndex).getValue().get(acceptLangs); | instance.getProperty(propIndex).getValue().get(acceptLangs); |
} | } |
String contentLangs = String::EMPTY; | String contentLangs = String::EMPTY; |
propIndex = instance.findProperty(PEGASUS_PROPERTYNAME_INDSUB_CONTENTLANGS); |
propIndex = instance.findProperty |
|
(PEGASUS_PROPERTYNAME_INDSUB_CONTENTLANGS); |
if (propIndex != PEG_NOT_FOUND) | if (propIndex != PEG_NOT_FOUND) |
{ | { |
instance.getProperty(propIndex).getValue().get(contentLangs); | instance.getProperty(propIndex).getValue().get(contentLangs); |
|
|
// l10n end | // l10n end |
| |
CIMObjectPath instanceName = | CIMObjectPath instanceName = |
subscriptions [i].getPath (); |
deletedSubscriptions [i].getPath (); |
instanceName.setNameSpace (nameSpace); | instanceName.setNameSpace (nameSpace); |
subscriptions [i].setPath (instanceName); |
deletedSubscriptions [i].setPath (instanceName); |
// l10n | // l10n |
_sendDeleteRequests (indicationProviders, sourceNamespaceName, | _sendDeleteRequests (indicationProviders, sourceNamespaceName, |
subscriptions [i], |
deletedSubscriptions [i], |
AcceptLanguages(acceptLangs), | AcceptLanguages(acceptLangs), |
ContentLanguages(contentLangs), | ContentLanguages(contentLangs), |
0, // no request | 0, // no request |
indicationSubclasses, | indicationSubclasses, |
creator); | creator); |
} | } |
} |
|
| |
PEG_METHOD_EXIT (); | PEG_METHOD_EXIT (); |
} | } |
|
|
"IndicationService::_deleteExpiredSubscription"); | "IndicationService::_deleteExpiredSubscription"); |
| |
CIMInstance subscriptionInstance; | CIMInstance subscriptionInstance; |
Array <ProviderClassList> indicationProviders; |
|
CIMNamespaceName nameSpace = subscription.getNameSpace (); |
|
subscription.setNameSpace (CIMNamespaceName ()); |
|
| |
// | // |
// Get instance from repository |
// Delete instance from repository |
// | // |
try |
subscriptionInstance = _subscriptionRepository->deleteSubscription |
{ |
(subscription); |
subscriptionInstance = _repository->getInstance |
|
(nameSpace, subscription); |
|
} |
|
catch (Exception&) |
|
{ |
|
PEG_METHOD_EXIT (); |
|
throw; |
|
} |
|
| |
// | // |
// Delete the subscription instance |
// If a valid instance object was returned, the subscription was |
|
// successfully deleted |
// | // |
try |
if (!subscriptionInstance.isUninitialized ()) |
{ | { |
_repository->deleteInstance (nameSpace, subscription); |
|
} |
|
catch (Exception & exception) |
|
{ |
|
PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2, |
|
"Exception caught in deleting expired subscription (" + |
|
subscriptionInstance.getPath().toString() + "): " + |
|
exception.getMessage ()); |
|
} |
|
|
|
// | // |
// If subscription was active, send delete requests to providers | // If subscription was active, send delete requests to providers |
// and update hash tables | // and update hash tables |
|
|
if ((subscriptionState == _STATE_ENABLED) || | if ((subscriptionState == _STATE_ENABLED) || |
(subscriptionState == _STATE_ENABLEDDEGRADED)) | (subscriptionState == _STATE_ENABLEDDEGRADED)) |
{ | { |
|
Array <ProviderClassList> indicationProviders; |
Array <CIMName> indicationSubclasses; | Array <CIMName> indicationSubclasses; |
CIMNamespaceName sourceNamespaceName; | CIMNamespaceName sourceNamespaceName; |
| |
subscription.setNameSpace (nameSpace); |
|
subscriptionInstance.setPath (subscription); | subscriptionInstance.setPath (subscription); |
| |
indicationProviders = _getDeleteParams | indicationProviders = _getDeleteParams |
(nameSpace, subscriptionInstance, |
(subscription.getNameSpace (), subscriptionInstance, |
indicationSubclasses, sourceNamespaceName); | indicationSubclasses, sourceNamespaceName); |
| |
// | // |
// Send Delete requests | // Send Delete requests |
// | // |
// NOTE: These Delete requests are not associated with a user request, |
// NOTE: These Delete requests are not associated with a user |
// so there is no associated authType or userName |
// request, so there is no associated authType or userName |
// The Creator from the subscription instance is used for userName, | // The Creator from the subscription instance is used for userName, |
// and authType is not set | // and authType is not set |
// | // |
|
|
_getCreator (subscriptionInstance, creator); | _getCreator (subscriptionInstance, creator); |
| |
// | // |
// Get the language tags that were saved with the subscription instance |
// Get the language tags that were saved with the subscription |
|
// instance |
// | // |
String acceptLangs = String::EMPTY; | String acceptLangs = String::EMPTY; |
Uint32 propIndex = subscriptionInstance.findProperty | Uint32 propIndex = subscriptionInstance.findProperty |
|
|
indicationSubclasses, | indicationSubclasses, |
creator); | creator); |
} | } |
|
} |
|
else |
|
{ |
|
// |
|
// The subscription may have already been deleted by another thread |
|
// |
|
} |
| |
PEG_METHOD_EXIT (); | PEG_METHOD_EXIT (); |
} | } |
|
|
String & condition, | String & condition, |
String & queryLanguage) | String & queryLanguage) |
{ | { |
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
|
"IndicationService::_getCreateParams"); |
|
|
String filterQuery; | String filterQuery; |
WQLSelectStatement selectStatement; | WQLSelectStatement selectStatement; |
CIMName indicationClassName; | CIMName indicationClassName; |
condition = String::EMPTY; | condition = String::EMPTY; |
queryLanguage = String::EMPTY; | queryLanguage = String::EMPTY; |
| |
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
|
"IndicationService::_getCreateParams"); |
|
|
|
// | // |
// Get filter properties | // Get filter properties |
// | // |
_getFilterProperties (subscriptionInstance, nameSpaceName, |
_subscriptionRepository->getFilterProperties (subscriptionInstance, |
filterQuery, sourceNameSpace, queryLanguage); |
nameSpaceName, filterQuery, sourceNameSpace, queryLanguage); |
selectStatement = _getSelectStatement (filterQuery); | selectStatement = _getSelectStatement (filterQuery); |
| |
// | // |
|
|
// | // |
// Get list of subclass names for indication class | // Get list of subclass names for indication class |
// | // |
indicationSubclasses = _getIndicationSubclasses (sourceNameSpace, |
indicationSubclasses = _subscriptionRepository->getIndicationSubclasses |
indicationClassName); |
(sourceNameSpace, indicationClassName); |
| |
// | // |
// Get property list from filter query (FROM and WHERE | // Get property list from filter query (FROM and WHERE |
|
|
String & condition, | String & condition, |
String & queryLanguage) | String & queryLanguage) |
{ | { |
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
|
"IndicationService::_getCreateParams"); |
|
|
String filterQuery; | String filterQuery; |
WQLSelectStatement selectStatement; | WQLSelectStatement selectStatement; |
condition = String::EMPTY; | condition = String::EMPTY; |
queryLanguage = String::EMPTY; | queryLanguage = String::EMPTY; |
| |
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
|
"IndicationService::_getCreateParams"); |
|
|
|
// | // |
// Get filter properties | // Get filter properties |
// | // |
_getFilterProperties (subscriptionInstance, nameSpaceName, |
_subscriptionRepository->getFilterProperties (subscriptionInstance, |
filterQuery, sourceNameSpace, queryLanguage); |
nameSpaceName, filterQuery, sourceNameSpace, queryLanguage); |
selectStatement = _getSelectStatement (filterQuery); | selectStatement = _getSelectStatement (filterQuery); |
| |
// | // |
|
|
// | // |
// Get list of subclass names for indication class | // Get list of subclass names for indication class |
// | // |
indicationSubclasses = _getIndicationSubclasses (sourceNameSpace, |
indicationSubclasses = _subscriptionRepository->getIndicationSubclasses |
indicationClassName); |
(sourceNameSpace, indicationClassName); |
| |
PEG_METHOD_EXIT (); | PEG_METHOD_EXIT (); |
} | } |
|
|
Array <CIMName> & indicationSubclasses, | Array <CIMName> & indicationSubclasses, |
CIMNamespaceName & sourceNameSpace) | CIMNamespaceName & sourceNameSpace) |
{ | { |
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
|
"IndicationService::_getDeleteParams"); |
|
|
String filterQuery; | String filterQuery; |
WQLSelectStatement selectStatement; | WQLSelectStatement selectStatement; |
CIMName indicationClassName; | CIMName indicationClassName; |
CIMPropertyList propertyList; | CIMPropertyList propertyList; |
Array <ProviderClassList> indicationProviders; | Array <ProviderClassList> indicationProviders; |
| |
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
|
"IndicationService::_getDeleteParams"); |
|
|
|
// | // |
// Get filter properties | // Get filter properties |
// | // |
_getFilterProperties (subscriptionInstance, nameSpaceName, |
_subscriptionRepository->getFilterProperties (subscriptionInstance, |
filterQuery, sourceNameSpace); |
nameSpaceName, filterQuery, sourceNameSpace); |
selectStatement = _getSelectStatement (filterQuery); | selectStatement = _getSelectStatement (filterQuery); |
| |
// | // |
|
|
// | // |
// Get list of subclass names for indication class | // Get list of subclass names for indication class |
// | // |
indicationSubclasses = _getIndicationSubclasses (sourceNameSpace, |
indicationSubclasses = _subscriptionRepository->getIndicationSubclasses |
indicationClassName); |
(sourceNameSpace, indicationClassName); |
| |
// | // |
// Get property list from filter query (FROM and WHERE | // Get property list from filter query (FROM and WHERE |
|
|
// | // |
// Get indication provider class lists from Active Subscriptions table | // Get indication provider class lists from Active Subscriptions table |
// | // |
String activeSubscriptionsKey = _generateActiveSubscriptionsKey |
|
(subscriptionInstance.getPath ()); |
|
ActiveSubscriptionsTableEntry tableValue; | ActiveSubscriptionsTableEntry tableValue; |
if (_lockedLookupActiveSubscriptionsEntry (activeSubscriptionsKey, |
if (_subscriptionTable->getSubscriptionEntry |
tableValue)) |
(subscriptionInstance.getPath (), tableValue)) |
{ | { |
indicationProviders = tableValue.providers; | indicationProviders = tableValue.providers; |
} | } |
|
|
// | // |
// Subscription not found in Active Subscriptions table | // Subscription not found in Active Subscriptions table |
// | // |
PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2, |
|
"Subscription (" + activeSubscriptionsKey + |
|
") not found in ActiveSubscriptionsTable"); |
|
} | } |
| |
PEG_METHOD_EXIT (); | PEG_METHOD_EXIT (); |
|
|
const String & userName, | const String & userName, |
const String & authType) | const String & authType) |
{ | { |
CIMValue propValue; |
|
Uint16 repeatNotificationPolicy; |
|
|
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, | PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
"IndicationService::_sendCreateRequests"); | "IndicationService::_sendCreateRequests"); |
| |
|
CIMValue propValue; |
|
Uint16 repeatNotificationPolicy; |
|
|
// If there are no providers to accept the subscription, just return | // If there are no providers to accept the subscription, just return |
if (indicationProviders.size() == 0) | if (indicationProviders.size() == 0) |
{ | { |
|
|
| |
default: | default: |
{ | { |
PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2, |
PEG_TRACE_STRING (TRC_INDICATION_SERVICE_INTERNAL, |
"Unexpected origRequest type " + |
Tracer::LEVEL2, "Unexpected origRequest type " + |
String (MessageTypeToString (origRequest->getType ())) + | String (MessageTypeToString (origRequest->getType ())) + |
" in _sendCreateRequests"); | " in _sendCreateRequests"); |
break; | break; |
|
|
const String & userName, | const String & userName, |
const String & authType) | const String & authType) |
{ | { |
CIMValue propValue; |
|
Uint16 repeatNotificationPolicy; |
|
|
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, | PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
"IndicationService::_sendModifyRequests"); | "IndicationService::_sendModifyRequests"); |
| |
|
CIMValue propValue; |
|
Uint16 repeatNotificationPolicy; |
|
|
// If there are no providers to accept the subscription update, just return | // If there are no providers to accept the subscription update, just return |
if (indicationProviders.size() == 0) | if (indicationProviders.size() == 0) |
{ | { |
|
|
} | } |
else | else |
{ | { |
PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2, |
PEG_TRACE_STRING (TRC_INDICATION_SERVICE_INTERNAL, Tracer::LEVEL2, |
"Unexpected origRequest type " + | "Unexpected origRequest type " + |
String (MessageTypeToString (origRequest->getType ())) + | String (MessageTypeToString (origRequest->getType ())) + |
" in _sendModifyRequests"); | " in _sendModifyRequests"); |
|
|
} | } |
else | else |
{ | { |
PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2, |
PEG_TRACE_STRING (TRC_INDICATION_SERVICE_INTERNAL, Tracer::LEVEL2, |
"No origRequest in _sendModifyRequests"); | "No origRequest in _sendModifyRequests"); |
} | } |
| |
|
|
| |
default: | default: |
{ | { |
PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2, |
PEG_TRACE_STRING (TRC_INDICATION_SERVICE_INTERNAL, |
"Unexpected origRequest type " + |
Tracer::LEVEL2, "Unexpected origRequest type " + |
String (MessageTypeToString (origRequest->getType ())) + | String (MessageTypeToString (origRequest->getType ())) + |
" in _sendDeleteRequests"); | " in _sendDeleteRequests"); |
break; | break; |
|
|
| |
default: | default: |
{ | { |
PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2, |
PEG_TRACE_STRING (TRC_INDICATION_SERVICE_INTERNAL, Tracer::LEVEL2, |
"Unexpected request type " + |
"Unexpected request type " + String (MessageTypeToString |
String (MessageTypeToString |
|
(operationAggregate->getRequest (0)->getType ())) + | (operationAggregate->getRequest (0)->getType ())) + |
" in _handleOperationResponseAggregation"); | " in _handleOperationResponseAggregation"); |
break; | break; |
|
|
} | } |
else | else |
{ | { |
PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL3, |
PEG_TRACE_STRING (TRC_INDICATION_SERVICE_INTERNAL, Tracer::LEVEL3, |
"Provider (" + provider.provider.getPath().toString() + | "Provider (" + provider.provider.getPath().toString() + |
") rejected create subscription: " + | ") rejected create subscription: " + |
response->cimException.getMessage ()); | response->cimException.getMessage ()); |
|
|
// If subscription is not disabled or removed, send alert and | // If subscription is not disabled or removed, send alert and |
// Insert entries into the subscription hash tables | // Insert entries into the subscription hash tables |
// | // |
if (!_handleError (request->subscriptionInstance)) |
if (!_subscriptionRepository->reconcileFatalError |
|
(request->subscriptionInstance)) |
{ | { |
// | // |
// Insert entries into the subscription hash tables | // Insert entries into the subscription hash tables |
// | // |
_insertToHashTables (request->subscriptionInstance, |
_subscriptionTable->insertSubscription |
|
(request->subscriptionInstance, |
acceptedProviders, | acceptedProviders, |
operationAggregate->getIndicationSubclasses (), | operationAggregate->getIndicationSubclasses (), |
request->nameSpace); | request->nameSpace); |
|
|
// | // |
// Update the entry in the active subscriptions hash table | // Update the entry in the active subscriptions hash table |
// | // |
enableProviders = _updateHashTable |
enableProviders = _subscriptionTable->updateProviders |
(request->subscriptionInstance.getPath (), provider, true); | (request->subscriptionInstance.getPath (), provider, true); |
| |
// | // |
|
|
(origRequest->capInstances [j].findProperty | (origRequest->capInstances [j].findProperty |
(_PROPERTY_CLASSNAME)).getValue ().get (cName); | (_PROPERTY_CLASSNAME)).getValue ().get (cName); |
CIMName className = CIMName (cName); | CIMName className = CIMName (cName); |
Uint32 classIndex = _classInList (className, provider); |
Uint32 classIndex = _subscriptionTable->classInList |
|
(className, provider); |
if (classIndex == PEG_NOT_FOUND) | if (classIndex == PEG_NOT_FOUND) |
{ | { |
provider.classList.append (className); | provider.classList.append (className); |
|
|
// | // |
// Update the entry in the active subscriptions hash table | // Update the entry in the active subscriptions hash table |
// | // |
enableProviders = _updateHashTable |
enableProviders = _subscriptionTable->updateProviders |
(request->subscriptionInstance.getPath (), provider, true); | (request->subscriptionInstance.getPath (), provider, true); |
| |
// | // |
|
|
CIMInstance instance = request->subscriptionInstance; | CIMInstance instance = request->subscriptionInstance; |
try | try |
{ | { |
instanceRef = _createInstance |
instanceRef = _subscriptionRepository->createInstance |
(origRequest, request->subscriptionInstance, true); |
(request->subscriptionInstance, origRequest->nameSpace, |
|
origRequest->userName, origRequest->acceptLanguages, |
|
origRequest->contentLanguages, true); |
instanceRef.setNameSpace | instanceRef.setNameSpace |
(request->subscriptionInstance.getPath().getNameSpace()); | (request->subscriptionInstance.getPath().getNameSpace()); |
instance.setPath (instanceRef); | instance.setPath (instanceRef); |
|
|
// | // |
// Insert entries into the subscription hash tables | // Insert entries into the subscription hash tables |
// | // |
enableProviders = _insertToHashTables (instance, |
enableProviders = _subscriptionTable->insertSubscription |
|
(instance, |
acceptedProviders, | acceptedProviders, |
operationAggregate->getIndicationSubclasses (), | operationAggregate->getIndicationSubclasses (), |
request->nameSpace); | request->nameSpace); |
|
|
// | // |
// Insert entries into the subscription hash tables | // Insert entries into the subscription hash tables |
// | // |
enableProviders = _insertToHashTables |
enableProviders = _subscriptionTable->insertSubscription |
(request->subscriptionInstance, | (request->subscriptionInstance, |
acceptedProviders, | acceptedProviders, |
operationAggregate->getIndicationSubclasses (), | operationAggregate->getIndicationSubclasses (), |
|
|
// | // |
ProviderClassList provider = operationAggregate->findProvider | ProviderClassList provider = operationAggregate->findProvider |
(response->messageId); | (response->messageId); |
PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL3, |
PEG_TRACE_STRING (TRC_INDICATION_SERVICE_INTERNAL, Tracer::LEVEL3, |
"Provider (" + provider.provider.getPath ().toString() + | "Provider (" + provider.provider.getPath ().toString() + |
") rejected enable indications: " + | ") rejected enable indications: " + |
response->cimException.getMessage ()); | response->cimException.getMessage ()); |
|
|
// | // |
ProviderClassList provider = operationAggregate->findProvider | ProviderClassList provider = operationAggregate->findProvider |
(response->messageId); | (response->messageId); |
PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL3, |
PEG_TRACE_STRING (TRC_INDICATION_SERVICE_INTERNAL, Tracer::LEVEL3, |
"Provider (" + provider.provider.getPath ().toString() + | "Provider (" + provider.provider.getPath ().toString() + |
") rejected modify subscription: " + | ") rejected modify subscription: " + |
response->cimException.getMessage ()); | response->cimException.getMessage ()); |
|
|
} | } |
| |
// | // |
// Update subscription hash tables |
// Update active subscriptions hash table |
// | // |
CIMModifySubscriptionRequestMessage * request = | CIMModifySubscriptionRequestMessage * request = |
(CIMModifySubscriptionRequestMessage *) | (CIMModifySubscriptionRequestMessage *) |
|
|
(CIMNotifyProviderRegistrationRequestMessage *) | (CIMNotifyProviderRegistrationRequestMessage *) |
operationAggregate->getOrigRequest (); | operationAggregate->getOrigRequest (); |
| |
String activeSubscriptionsKey = _generateActiveSubscriptionsKey |
_subscriptionTable->updateClasses |
(request->subscriptionInstance.getPath ()); |
(request->subscriptionInstance.getPath (), origRequest->provider, |
ActiveSubscriptionsTableEntry tableValue; |
origRequest->className); |
if (_lockedLookupActiveSubscriptionsEntry (activeSubscriptionsKey, |
|
tableValue)) |
|
{ |
|
Uint32 providerIndex = _providerInList (origRequest->provider, |
|
tableValue); |
|
if (providerIndex != PEG_NOT_FOUND) |
|
{ |
|
Uint32 classIndex = _classInList (origRequest->className, |
|
tableValue.providers [providerIndex]); |
|
if (classIndex == PEG_NOT_FOUND) |
|
{ |
|
tableValue.providers [providerIndex].classList.append |
|
(origRequest->className); |
|
} |
|
else // classIndex != PEG_NOT_FOUND |
|
{ |
|
tableValue.providers [providerIndex].classList.remove |
|
(classIndex); |
|
} |
|
{ |
|
WriteLock lock(_activeSubscriptionsTableLock); |
|
_removeActiveSubscriptionsEntry |
|
(activeSubscriptionsKey); |
|
_insertActiveSubscriptionsEntry |
|
(tableValue.subscription, tableValue.providers); |
|
} |
|
} |
|
else |
|
{ |
|
PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2, |
|
"Provider (" + origRequest->provider.getPath().toString() + |
|
") not found in list for Subscription (" + |
|
activeSubscriptionsKey + |
|
") in ActiveSubscriptionsTable"); |
|
} |
|
} |
|
else |
|
{ |
|
PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2, |
|
"Subscription (" + activeSubscriptionsKey + |
|
") not found in ActiveSubscriptionsTable"); |
|
} |
|
| |
PEG_METHOD_EXIT (); | PEG_METHOD_EXIT (); |
} | } |
|
|
// | // |
// Log a trace message | // Log a trace message |
// | // |
PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL3, |
PEG_TRACE_STRING (TRC_INDICATION_SERVICE_INTERNAL, Tracer::LEVEL3, |
"Provider (" + provider.provider.getPath ().toString() + | "Provider (" + provider.provider.getPath ().toString() + |
") rejected delete subscription: " + | ") rejected delete subscription: " + |
response->cimException.getMessage ()); | response->cimException.getMessage ()); |
|
|
ProviderClassList provider; | ProviderClassList provider; |
provider.provider = origRequest->provider; | provider.provider = origRequest->provider; |
provider.providerModule = origRequest->providerModule; | provider.providerModule = origRequest->providerModule; |
disableProviders = _updateHashTable |
disableProviders = _subscriptionTable->updateProviders |
(request->subscriptionInstance.getPath (), provider, false); | (request->subscriptionInstance.getPath (), provider, false); |
} | } |
| |
|
|
// | // |
// Remove entries from the subscription hash tables | // Remove entries from the subscription hash tables |
// | // |
disableProviders = _removeFromHashTables |
disableProviders = _subscriptionTable->removeSubscription |
(request->subscriptionInstance, | (request->subscriptionInstance, |
operationAggregate->getIndicationSubclasses (), | operationAggregate->getIndicationSubclasses (), |
request->nameSpace, | request->nameSpace, |
checkProviders); | checkProviders); |
} |
} |
|
|
// |
|
// Send Disable Indications requests to any provider no longer in |
|
// use |
|
// |
|
if (disableProviders.size () > 0) |
|
{ |
|
_sendDisable (disableProviders, operationAggregate->getOrigRequest ()); |
|
} |
|
|
|
// |
|
// For Delete Instance or Modify Instance, send response |
|
// |
|
if (operationAggregate->requiresResponse ()) |
|
{ |
|
CIMResponseMessage * response; |
|
if (operationAggregate->getOrigType () == |
|
CIM_DELETE_INSTANCE_REQUEST_MESSAGE) |
|
{ |
|
// l10n |
|
// Note: don't need to set Content-language in the response |
|
response = new CIMDeleteInstanceResponseMessage ( |
|
operationAggregate->getOrigMessageId (), |
|
cimException, |
|
operationAggregate->getOrigRequest ()->queueIds.copyAndPop ()); |
|
} |
|
|
|
else // CIM_MODIFY_INSTANCE_REQUEST_MESSAGE |
|
{ |
|
// l10n |
|
// Note: don't need to set Content-language in the response |
|
// |
|
response = new CIMModifyInstanceResponseMessage ( |
|
operationAggregate->getOrigMessageId (), |
|
cimException, |
|
operationAggregate->getOrigRequest ()->queueIds.copyAndPop ()); |
|
} |
|
|
|
// |
|
// Preserve message key |
|
// |
|
response->setKey (operationAggregate->getOrigRequest ()->getKey ()); |
|
|
|
// |
|
// Set response destination |
|
// |
|
response->dest = operationAggregate->getOrigDest (); |
|
|
|
// |
|
// Set HTTP method in response from request |
|
// |
|
response->setHttpMethod |
|
(operationAggregate->getOrigRequest ()->getHttpMethod ()); |
|
|
|
Base::_enqueueResponse |
|
(operationAggregate->getOrigRequest (), response); |
|
} |
|
|
|
PEG_METHOD_EXIT (); |
|
} |
|
|
|
void IndicationService::_handleDisableResponseAggregation ( |
|
IndicationOperationAggregate * operationAggregate) |
|
{ |
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
|
"IndicationService::_handleDisableResponseAggregation"); |
|
|
|
// |
|
// Examine provider responses |
|
// |
|
for (Uint32 i = 0; i < operationAggregate->getNumberResponses (); i++) |
|
{ |
|
// |
|
// If response is not SUCCESS, provider rejected the disable |
|
// |
|
CIMResponseMessage * response = operationAggregate->getResponse (i); |
|
if (response->cimException.getCode () != CIM_ERR_SUCCESS) |
|
{ |
|
// |
|
// Find provider from which response was sent |
|
// Log a trace message |
|
// |
|
ProviderClassList provider = operationAggregate->findProvider |
|
(response->messageId); |
|
PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL3, |
|
"Provider (" + provider.provider.getPath ().toString() + |
|
") rejected disable indications: " + |
|
response->cimException.getMessage ()); |
|
} |
|
} |
|
|
|
PEG_METHOD_EXIT (); |
|
} |
|
|
|
String IndicationService::_generateActiveSubscriptionsKey ( |
|
const CIMObjectPath & subscriptionRef) |
|
{ |
|
String activeSubscriptionsKey; |
|
|
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
|
"IndicationService::_generateActiveSubscriptionsKey"); |
|
|
|
// |
|
// Append subscription namespace name to key |
|
// |
|
activeSubscriptionsKey.append |
|
(subscriptionRef.getNameSpace ().getString()); |
|
|
|
// |
|
// Get filter and handler key bindings from subscription reference |
|
// |
|
Array<CIMKeyBinding> subscriptionKB = subscriptionRef.getKeyBindings (); |
|
Array<CIMKeyBinding> filterKB; |
|
Array<CIMKeyBinding> handlerKB; |
|
for (Uint32 i = 0; i < subscriptionKB.size (); i++) |
|
{ |
|
if ((subscriptionKB [i].getName () == _PROPERTY_FILTER) && |
|
(subscriptionKB [i].getType () == CIMKeyBinding::REFERENCE)) |
|
{ |
|
CIMObjectPath filterRef (subscriptionKB [i].getValue ()); |
|
filterKB = filterRef.getKeyBindings (); |
|
} |
|
if ((subscriptionKB [i].getName () == _PROPERTY_HANDLER) && |
|
(subscriptionKB [i].getType () == CIMKeyBinding::REFERENCE)) |
|
{ |
|
CIMObjectPath handlerRef (subscriptionKB [i].getValue ()); |
|
handlerKB = handlerRef.getKeyBindings (); |
|
} |
|
} |
|
|
|
// |
|
// Append subscription filter key values to key |
|
// |
|
for (Uint32 j = 0; j < filterKB.size (); j++) |
|
{ |
|
activeSubscriptionsKey.append (filterKB [j].getValue ()); |
|
} |
|
|
|
// |
|
// Append subscription handler key values to key |
|
// |
|
for (Uint32 k = 0; k < handlerKB.size (); k++) |
|
{ |
|
activeSubscriptionsKey.append (handlerKB [k].getValue ()); |
|
} |
|
|
|
PEG_METHOD_EXIT (); |
|
return activeSubscriptionsKey; |
|
} |
|
|
|
Boolean IndicationService::_lockedLookupActiveSubscriptionsEntry ( |
|
const String & key, |
|
ActiveSubscriptionsTableEntry & tableEntry) |
|
{ |
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
|
"IndicationService::_lockedLookupActiveSubscriptionsEntry"); |
|
|
|
ReadLock lock(_activeSubscriptionsTableLock); |
|
|
|
return (_activeSubscriptionsTable.lookup (key, tableEntry)); |
|
|
|
PEG_METHOD_EXIT (); |
|
} |
|
|
|
void IndicationService::_insertActiveSubscriptionsEntry ( |
|
const CIMInstance & subscription, |
|
const Array <ProviderClassList> & providers) |
|
{ |
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
|
"IndicationService::_insertActiveSubscriptionsEntry"); |
|
|
|
String activeSubscriptionsKey = _generateActiveSubscriptionsKey |
|
(subscription.getPath ()); |
|
ActiveSubscriptionsTableEntry entry; |
|
entry.subscription = subscription; |
|
entry.providers = providers; |
|
|
|
_activeSubscriptionsTable.insert (activeSubscriptionsKey, entry); |
|
|
|
#ifdef PEGASUS_INDICATION_HASHTRACE |
|
String traceString; |
|
traceString.append (activeSubscriptionsKey); |
|
traceString.append (" Providers: "); |
|
for (Uint32 i = 0; i < providers.size (); i++) |
|
{ |
|
String providerName = providers [i].provider.getProperty |
|
(providers [i].provider.findProperty |
|
(_PROPERTY_NAME)).getValue ().toString (); |
|
traceString.append (providerName); |
|
traceString.append (" Classes: "); |
|
for (Uint32 j = 0; j < providers[i].classList.size (); j++) |
|
{ |
|
traceString.append (providers[i].classList[j].getString()); |
|
traceString.append (" "); |
|
} |
|
} |
|
|
|
PEG_TRACE_STRING (TRC_INDICATION_SERVICE_INTERNAL, Tracer::LEVEL3, |
|
"INSERTED _activeSubscriptionsTable entry: " + traceString); |
|
#endif |
|
|
|
PEG_METHOD_EXIT (); |
|
} |
|
|
|
void IndicationService::_removeActiveSubscriptionsEntry ( |
|
const String & key) |
|
{ |
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
|
"IndicationService::_removeActiveSubscriptionsEntry"); |
|
|
|
_activeSubscriptionsTable.remove (key); |
|
#ifdef PEGASUS_INDICATION_HASHTRACE |
|
PEG_TRACE_STRING (TRC_INDICATION_SERVICE_INTERNAL, |
|
Tracer::LEVEL3, |
|
"REMOVED _activeSubscriptionsTable entry: " + key); |
|
#endif |
|
|
|
PEG_METHOD_EXIT (); |
|
} |
|
|
|
String IndicationService::_generateSubscriptionClassesKey ( |
|
const CIMName & indicationClassName, |
|
const CIMNamespaceName & sourceNamespaceName) |
|
{ |
|
String subscriptionClassesKey; |
|
|
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
|
"IndicationService::_generateSubscriptionClassesKey"); |
|
|
|
// |
|
// Append indication class name to key |
|
// |
|
subscriptionClassesKey.append (indicationClassName.getString ()); |
|
|
|
// |
|
// Append source namespace name to key |
|
// |
|
subscriptionClassesKey.append (sourceNamespaceName.getString ()); |
|
|
|
PEG_METHOD_EXIT (); |
|
return subscriptionClassesKey; |
|
} |
|
|
|
Boolean IndicationService::_lockedLookupSubscriptionClassesEntry ( |
|
const String & key, |
|
SubscriptionClassesTableEntry & tableEntry) |
|
{ |
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
|
"IndicationService::_lockedLookupSubscriptionClassesEntry"); |
|
|
|
ReadLock lock(_subscriptionClassesTableLock); |
|
|
|
PEG_METHOD_EXIT (); |
|
|
|
return (_subscriptionClassesTable.lookup (key, tableEntry)); |
|
} |
|
|
|
void IndicationService::_lockedInsertSubscriptionClassesEntry ( |
|
const CIMName & indicationClassName, |
|
const CIMNamespaceName & sourceNamespaceName, |
|
const Array <CIMInstance> & subscriptions) |
|
{ |
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
|
"IndicationService::_lockedInsertSubscriptionClassesEntry"); |
|
|
|
String subscriptionClassesKey = _generateSubscriptionClassesKey |
|
(indicationClassName, sourceNamespaceName); |
|
SubscriptionClassesTableEntry entry; |
|
entry.indicationClassName = indicationClassName; |
|
entry.sourceNamespaceName = sourceNamespaceName; |
|
entry.subscriptions = subscriptions; |
|
{ |
|
WriteLock lock(_subscriptionClassesTableLock); |
|
_subscriptionClassesTable.insert (subscriptionClassesKey, entry); |
|
} |
|
|
|
#ifdef PEGASUS_INDICATION_HASHTRACE |
|
String traceString; |
|
traceString.append (subscriptionClassesKey); |
|
traceString.append (" Subscriptions: "); |
|
for (Uint32 i = 0; i < subscriptions.size (); i++) |
|
{ |
|
traceString.append (subscriptions [i].getPath ().toString()); |
|
traceString.append (" "); |
|
} |
|
|
|
PEG_TRACE_STRING (TRC_INDICATION_SERVICE_INTERNAL, Tracer::LEVEL3, |
|
"INSERTED _subscriptionClassesTable entry: " + traceString); |
|
#endif |
|
|
|
PEG_METHOD_EXIT (); |
|
} |
|
|
|
void IndicationService::_lockedRemoveSubscriptionClassesEntry ( |
|
const String & key) |
|
{ |
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
|
"IndicationService::_lockedRemoveSubscriptionClassesEntry"); |
|
|
|
WriteLock lock(_subscriptionClassesTableLock); |
|
|
|
_subscriptionClassesTable.remove (key); |
|
|
|
#ifdef PEGASUS_INDICATION_HASHTRACE |
|
PEG_TRACE_STRING (TRC_INDICATION_SERVICE_INTERNAL, Tracer::LEVEL3, |
|
"REMOVED _subscriptionClassesTable entry: " + key); |
|
#endif |
|
|
|
PEG_METHOD_EXIT (); |
|
} |
|
|
|
Array <ProviderClassList> IndicationService::_insertToHashTables ( |
|
const CIMInstance & subscription, |
|
const Array <ProviderClassList> & providers, |
|
const Array <CIMName> & indicationSubclassNames, |
|
const CIMNamespaceName & sourceNamespaceName) |
|
{ |
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
|
"IndicationService::_insertToHashTables"); |
|
|
|
Array <ProviderClassList> enableProviders; |
|
|
|
// |
|
// Insert entry into active subscriptions table |
|
// |
|
{ |
|
WriteLock lock(_activeSubscriptionsTableLock); |
|
|
|
// |
|
// If provider is not yet in the table, add to list of |
|
// providers to enable |
|
// |
|
for (Uint32 i = 0; i < providers.size (); i++) |
|
{ |
|
if (!_providerInUse (providers [i].provider)) |
|
{ |
|
enableProviders.append (providers [i]); |
|
} |
|
} |
|
_insertActiveSubscriptionsEntry (subscription, providers); |
|
} |
|
|
|
// |
|
// Insert or update entries in subscription classes table |
|
// |
|
for (Uint32 i = 0; i < indicationSubclassNames.size (); i++) |
|
{ |
|
String subscriptionClassesKey = _generateSubscriptionClassesKey |
|
(indicationSubclassNames [i], sourceNamespaceName); |
|
SubscriptionClassesTableEntry tableValue; |
|
if (_lockedLookupSubscriptionClassesEntry (subscriptionClassesKey, |
|
tableValue)) |
|
{ |
|
// |
|
// If entry exists for this IndicationClassName-SourceNamespace |
|
// pair, remove old entry and insert new entry |
|
// |
|
Array <CIMInstance> subscriptions = tableValue.subscriptions; |
|
subscriptions.append (subscription); |
|
_lockedRemoveSubscriptionClassesEntry (subscriptionClassesKey); |
|
_lockedInsertSubscriptionClassesEntry (indicationSubclassNames [i], |
|
sourceNamespaceName, subscriptions); |
|
} |
|
else |
|
{ |
|
// |
|
// If no entry exists for this |
|
// IndicationClassName-SourceNamespace pair, insert new entry |
|
// |
|
Array <CIMInstance> subscriptions; |
|
subscriptions.append (subscription); |
|
_lockedInsertSubscriptionClassesEntry (indicationSubclassNames [i], |
|
sourceNamespaceName, subscriptions); |
|
} |
|
} |
|
|
|
PEG_METHOD_EXIT (); |
|
return enableProviders; |
|
} |
|
|
|
Array <ProviderClassList> IndicationService::_updateHashTable ( |
|
const CIMObjectPath & subscriptionPath, |
|
const ProviderClassList & provider, |
|
Boolean addProvider) |
|
{ |
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
|
"IndicationService::_updateHashTable"); |
|
|
|
Array <ProviderClassList> providers; |
|
|
|
String activeSubscriptionsKey = _generateActiveSubscriptionsKey |
|
(subscriptionPath); |
|
ActiveSubscriptionsTableEntry tableValue; |
|
if (_lockedLookupActiveSubscriptionsEntry (activeSubscriptionsKey, |
|
tableValue)) |
|
{ |
|
Uint32 providerIndex = _providerInList (provider.provider, tableValue); |
|
if (addProvider) |
|
{ |
|
if (providerIndex == PEG_NOT_FOUND) |
|
{ |
|
tableValue.providers.append (provider); |
|
} |
|
else |
|
{ |
|
CIMInstance p = provider.provider; |
|
PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2, |
|
"Provider " + _getProviderLogString (p) + |
|
" already in list for Subscription (" + |
|
activeSubscriptionsKey + |
|
") in ActiveSubscriptionsTable"); |
|
} |
|
} |
|
else |
|
{ |
|
if (providerIndex != PEG_NOT_FOUND) |
|
{ |
|
tableValue.providers.remove (providerIndex); |
|
} |
|
else |
|
{ |
|
CIMInstance p = provider.provider; |
|
PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2, |
|
"Provider " + _getProviderLogString (p) + |
|
" not found in list for Subscription (" + |
|
activeSubscriptionsKey + |
|
") in ActiveSubscriptionsTable"); |
|
} |
|
} |
|
{ |
|
WriteLock lock (_activeSubscriptionsTableLock); |
|
_removeActiveSubscriptionsEntry (activeSubscriptionsKey); |
|
if (!_providerInUse (provider.provider)) |
|
{ |
|
providers.append (provider); |
|
} |
|
_insertActiveSubscriptionsEntry (tableValue.subscription, |
|
tableValue.providers); |
|
} |
|
} |
|
else |
|
{ |
|
PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2, |
|
"Subscription (" + activeSubscriptionsKey + |
|
") not found in ActiveSubscriptionsTable"); |
|
| |
// | // |
// The subscription may have been deleted in the mean time |
// Send Disable Indications requests to any provider no longer in |
// If so, no further update is required |
// use |
// | // |
} |
if (disableProviders.size () > 0) |
|
|
PEG_METHOD_EXIT (); |
|
return providers; |
|
} |
|
|
|
Array <ProviderClassList> IndicationService::_removeFromHashTables ( |
|
const CIMInstance & subscription, |
|
const Array <CIMName> & indicationSubclassNames, |
|
const CIMNamespaceName & sourceNamespaceName, |
|
const Array <ProviderClassList> & providers) |
|
{ | { |
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
_sendDisable (disableProviders, operationAggregate->getOrigRequest ()); |
"IndicationService::_removeFromHashTables"); |
} |
|
|
Array <ProviderClassList> disableProviders; |
|
| |
// | // |
// Remove entry from active subscriptions table |
// For Delete Instance or Modify Instance, send response |
// | // |
|
if (operationAggregate->requiresResponse ()) |
{ | { |
WriteLock lock(_activeSubscriptionsTableLock); |
CIMResponseMessage * response; |
|
if (operationAggregate->getOrigType () == |
_removeActiveSubscriptionsEntry ( |
CIM_DELETE_INSTANCE_REQUEST_MESSAGE) |
_generateActiveSubscriptionsKey (subscription.getPath ())); |
|
|
|
for (Uint32 i = 0; i < providers.size (); i++) |
|
{ |
|
if (!_providerInUse (providers [i].provider)) |
|
{ | { |
disableProviders.append (providers [i]); |
// l10n |
} |
// Note: don't need to set Content-language in the response |
|
response = new CIMDeleteInstanceResponseMessage ( |
|
operationAggregate->getOrigMessageId (), |
|
cimException, |
|
operationAggregate->getOrigRequest ()->queueIds.copyAndPop ()); |
} | } |
|
|
|
else // CIM_MODIFY_INSTANCE_REQUEST_MESSAGE |
|
{ |
|
// l10n |
|
// Note: don't need to set Content-language in the response |
|
// |
|
response = new CIMModifyInstanceResponseMessage ( |
|
operationAggregate->getOrigMessageId (), |
|
cimException, |
|
operationAggregate->getOrigRequest ()->queueIds.copyAndPop ()); |
} | } |
| |
// | // |
// Remove or update entries in subscription classes table |
// Preserve message key |
// | // |
for (Uint32 i = 0; i < indicationSubclassNames.size (); i++) |
response->setKey (operationAggregate->getOrigRequest ()->getKey ()); |
{ |
|
String subscriptionClassesKey = _generateSubscriptionClassesKey |
|
(indicationSubclassNames [i], sourceNamespaceName); |
|
SubscriptionClassesTableEntry tableValue; |
|
if (_lockedLookupSubscriptionClassesEntry (subscriptionClassesKey, |
|
tableValue)) |
|
{ |
|
// | // |
// If entry exists for this IndicationClassName-SourceNamespace |
// Set response destination |
// pair, remove subscription from the list |
|
// | // |
Array <CIMInstance> subscriptions = tableValue.subscriptions; |
response->dest = operationAggregate->getOrigDest (); |
for (Uint32 j = 0; j < subscriptions.size (); j++) |
|
{ |
|
if (subscriptions [j].getPath().identical |
|
(subscription.getPath())) |
|
{ |
|
subscriptions.remove (j); |
|
} |
|
} |
|
| |
// | // |
// Remove the old entry |
// Set HTTP method in response from request |
// | // |
_lockedRemoveSubscriptionClassesEntry (subscriptionClassesKey); |
response->setHttpMethod |
|
(operationAggregate->getOrigRequest ()->getHttpMethod ()); |
|
|
|
Base::_enqueueResponse |
|
(operationAggregate->getOrigRequest (), response); |
|
} |
|
|
|
PEG_METHOD_EXIT (); |
|
} |
|
|
|
void IndicationService::_handleDisableResponseAggregation ( |
|
IndicationOperationAggregate * operationAggregate) |
|
{ |
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
|
"IndicationService::_handleDisableResponseAggregation"); |
| |
// | // |
// If there are still subscriptions in the list, insert the |
// Examine provider responses |
// new entry |
|
// | // |
if (subscriptions.size () > 0) |
for (Uint32 i = 0; i < operationAggregate->getNumberResponses (); i++) |
{ | { |
_lockedInsertSubscriptionClassesEntry ( |
// |
indicationSubclassNames [i], |
// If response is not SUCCESS, provider rejected the disable |
sourceNamespaceName, subscriptions); |
// |
} |
CIMResponseMessage * response = operationAggregate->getResponse (i); |
} |
if (response->cimException.getCode () != CIM_ERR_SUCCESS) |
else |
|
{ | { |
// | // |
// Entry not found in Subscription Classes table |
// Find provider from which response was sent |
|
// Log a trace message |
// | // |
PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2, |
ProviderClassList provider = operationAggregate->findProvider |
"Indication subclass and namespace (" + subscriptionClassesKey + |
(response->messageId); |
") not found in SubscriptionClassesTable"); |
PEG_TRACE_STRING (TRC_INDICATION_SERVICE_INTERNAL, Tracer::LEVEL3, |
|
"Provider (" + provider.provider.getPath ().toString() + |
|
") rejected disable indications: " + |
|
response->cimException.getMessage ()); |
} | } |
} | } |
| |
PEG_METHOD_EXIT (); | PEG_METHOD_EXIT (); |
return disableProviders; |
|
} | } |
| |
CIMInstance IndicationService::_createAlertInstance ( | CIMInstance IndicationService::_createAlertInstance ( |
|
|
const Array <CIMInstance> & subscriptions, | const Array <CIMInstance> & subscriptions, |
/* const */ CIMInstance & alertInstance) | /* const */ CIMInstance & alertInstance) |
{ | { |
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, "IndicationService::_sendAlerts"); |
|
|
CIMInstance current; | CIMInstance current; |
Boolean duplicate; | Boolean duplicate; |
Array <CIMInstance> handlers; | Array <CIMInstance> handlers; |
| |
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, "IndicationService::_sendAlerts"); |
|
|
|
handlers.clear (); | handlers.clear (); |
| |
PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL4, | PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL4, |
|
|
// | // |
// Get handler instance | // Get handler instance |
// | // |
current = _getHandler (subscriptions [i]); |
current = _subscriptionRepository->getHandler (subscriptions [i]); |
| |
// | // |
// Merge into list of unique handler instances | // Merge into list of unique handler instances |
|
|
| |
default: | default: |
{ | { |
PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2, |
PEG_TRACE_STRING (TRC_INDICATION_SERVICE_INTERNAL, |
"Unexpected origRequest type " + |
Tracer::LEVEL2, "Unexpected origRequest type " + |
String (MessageTypeToString (origRequest->getType ())) + | String (MessageTypeToString (origRequest->getType ())) + |
" in _sendEnable"); | " in _sendEnable"); |
break; | break; |
|
|
| |
default: | default: |
{ | { |
PEG_TRACE_STRING (TRC_INDICATION_SERVICE, Tracer::LEVEL2, |
PEG_TRACE_STRING (TRC_INDICATION_SERVICE_INTERNAL, |
"Unexpected origRequest type " + |
Tracer::LEVEL2, "Unexpected origRequest type " + |
String (MessageTypeToString (origRequest->getType ())) + | String (MessageTypeToString (origRequest->getType ())) + |
" in _sendDisable"); | " in _sendDisable"); |
break; | break; |
|
|
WQLSimplePropertySource IndicationService::_getPropertySourceFromInstance( | WQLSimplePropertySource IndicationService::_getPropertySourceFromInstance( |
CIMInstance& indicationInstance) | CIMInstance& indicationInstance) |
{ | { |
WQLSimplePropertySource source; |
|
|
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, | PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
"IndicationService::_getPropertySourceFromInstance"); | "IndicationService::_getPropertySourceFromInstance"); |
| |
|
WQLSimplePropertySource source; |
|
|
for (Uint32 i=0; i < indicationInstance.getPropertyCount(); i++) | for (Uint32 i=0; i < indicationInstance.getPropertyCount(); i++) |
{ | { |
CIMProperty property = indicationInstance.getProperty(i); | CIMProperty property = indicationInstance.getProperty(i); |
|
|
(creatorIndex).getValue (); | (creatorIndex).getValue (); |
if (creatorValue.isNull ()) | if (creatorValue.isNull ()) |
{ | { |
PEG_TRACE_STRING (TRC_INDICATION_SERVICE, |
PEG_TRACE_STRING (TRC_INDICATION_SERVICE_INTERNAL, |
Tracer::LEVEL4, |
Tracer::LEVEL2, |
"Null Subscription Creator property value"); | "Null Subscription Creator property value"); |
| |
// | // |
|
|
traceString.append ("array of "); | traceString.append ("array of "); |
} | } |
traceString.append (cimTypeToString (creatorValue.getType ())); | traceString.append (cimTypeToString (creatorValue.getType ())); |
PEG_TRACE_STRING (TRC_INDICATION_SERVICE, |
PEG_TRACE_STRING (TRC_INDICATION_SERVICE_INTERNAL, |
Tracer::LEVEL4, |
Tracer::LEVEL2, |
"Subscription Creator property value of incorrect type: " | "Subscription Creator property value of incorrect type: " |
+ traceString); | + traceString); |
| |
|
|
} | } |
else | else |
{ | { |
PEG_TRACE_STRING (TRC_INDICATION_SERVICE, |
PEG_TRACE_STRING (TRC_INDICATION_SERVICE_INTERNAL, |
Tracer::LEVEL4, |
Tracer::LEVEL2, |
"Missing Subscription Creator property"); | "Missing Subscription Creator property"); |
| |
// | // |
|
|
return true; | return true; |
} | } |
| |
Boolean IndicationService::_getState ( |
Boolean IndicationService::_validateState ( |
const CIMInstance & instance, |
const Uint16 state) const |
Uint16 & state) const |
|
{ |
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, "IndicationService::_getState"); |
|
|
|
Uint32 stateIndex = instance.findProperty (_PROPERTY_STATE); |
|
if (stateIndex != PEG_NOT_FOUND) |
|
{ |
|
CIMValue stateValue = instance.getProperty |
|
(stateIndex).getValue (); |
|
if (stateValue.isNull ()) |
|
{ |
|
PEG_TRACE_STRING (TRC_INDICATION_SERVICE, |
|
Tracer::LEVEL4, |
|
"Null SubscriptionState property value"); |
|
|
|
// |
|
// This is a corrupted/invalid instance |
|
// |
|
return false; |
|
} |
|
else if ((stateValue.getType () != CIMTYPE_UINT16) || |
|
(stateValue.isArray ())) |
|
{ |
|
String traceString; |
|
if (stateValue.isArray ()) |
|
{ |
|
traceString.append ("array of "); |
|
} |
|
traceString.append (cimTypeToString (stateValue.getType ())); |
|
PEG_TRACE_STRING (TRC_INDICATION_SERVICE, |
|
Tracer::LEVEL4, |
|
"SubscriptionState property value of incorrect type: " |
|
+ traceString); |
|
|
|
// |
|
// This is a corrupted/invalid instance |
|
// |
|
return false; |
|
} |
|
else |
|
{ | { |
stateValue.get (state); |
|
|
|
// | // |
// Validate the value | // Validate the value |
// | // |
|
|
// | // |
return false; | return false; |
} | } |
} |
|
} |
|
else |
|
{ |
|
PEG_TRACE_STRING (TRC_INDICATION_SERVICE, |
|
Tracer::LEVEL4, |
|
"Missing SubscriptionState property"); |
|
|
|
// |
|
// This is a corrupted/invalid instance |
|
// |
|
return false; |
|
} |
|
| |
PEG_METHOD_EXIT (); |
|
return true; | return true; |
} | } |
| |
|
|
String IndicationService::_getSubscriptionLogString | String IndicationService::_getSubscriptionLogString |
(CIMInstance & subscription) | (CIMInstance & subscription) |
{ | { |
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
|
"IndicationService::_getSubscriptionLogString"); |
|
|
|
// | // |
// Get Subscription Filter Name and Handler Name | // Get Subscription Filter Name and Handler Name |
// | // |
|
|
} | } |
} | } |
| |
PEG_METHOD_EXIT (); |
|
return logString; | return logString; |
} | } |
| |
String IndicationService::_getProviderLogString |
String IndicationService::getProviderLogString |
(CIMInstance & provider) | (CIMInstance & provider) |
{ | { |
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
|
"IndicationService::_getProviderLogString"); |
|
|
|
String logString; | String logString; |
| |
logString = provider.getProperty (provider.findProperty | logString = provider.getProperty (provider.findProperty |
(_PROPERTY_NAME)).getValue ().toString (); | (_PROPERTY_NAME)).getValue ().toString (); |
| |
PEG_METHOD_EXIT (); |
|
return logString; | return logString; |
} | } |
| |
Boolean IndicationService::_sameInstance |
|
(const CIMInstance & instance1, |
|
const CIMInstance & instance2, |
|
const CIMClass & theClass) const |
|
{ |
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
|
"IndicationService::_sameInstance"); |
|
|
|
CIMObjectPath path1 = instance1.buildPath (theClass); |
|
CIMObjectPath path2 = instance2.buildPath (theClass); |
|
Boolean result = path1.identical (path2); |
|
|
|
PEG_METHOD_EXIT (); |
|
return result; |
|
} |
|
|
|
// |
|
// Class names |
|
// |
|
|
|
/** |
|
The name of the CIMOM Shutdown alert indication class |
|
*/ |
|
// |
|
// ATTN: Update once CimomShutdownAlertIndication has been defined |
|
// |
|
const CIMName IndicationService::_CLASS_CIMOM_SHUTDOWN_ALERT = |
|
CIMName ("CIM_AlertIndication"); |
|
|
|
/** |
|
The name of the No Provider alert indication class |
|
*/ |
|
// |
|
// ATTN: Update once NoProviderAlertIndication has been defined |
|
// |
|
const CIMName IndicationService::_CLASS_NO_PROVIDER_ALERT = |
|
CIMName ("CIM_AlertIndication"); |
|
|
|
/** |
|
The name of the CIMOM shutdown alert indication class |
|
*/ |
|
// |
|
// ATTN: Update once ProviderTerminatedAlertIndication has been defined |
|
// |
|
const CIMName IndicationService::_CLASS_PROVIDER_TERMINATED_ALERT = |
|
CIMName ("CIM_AlertIndication"); |
|
|
|
|
|
// |
|
// Property names |
|
// |
|
|
|
/** |
|
The name of the filter reference property for indication subscription class |
|
*/ |
|
const CIMName IndicationService::_PROPERTY_FILTER = CIMName ("Filter"); |
|
|
|
/** |
|
The name of the handler reference property for indication subscription class |
|
*/ |
|
const CIMName IndicationService::_PROPERTY_HANDLER = CIMName ("Handler"); |
|
|
|
/** |
|
The name of the subscription state property for indication subscription |
|
class |
|
*/ |
|
const CIMName IndicationService::_PROPERTY_STATE = |
|
CIMName ("SubscriptionState"); |
|
|
|
/** |
|
The name of the Other Subscription State property for Indication |
|
Subscription class |
|
*/ |
|
const CIMName IndicationService::_PROPERTY_OTHERSTATE = |
|
CIMName ("OtherSubscriptionState"); |
|
|
|
/** |
|
The name of the repeat notification policy property for indication |
|
subscription class |
|
*/ |
|
const CIMName IndicationService::_PROPERTY_REPEATNOTIFICATIONPOLICY = |
|
CIMName ("RepeatNotificationPolicy"); |
|
|
|
/** |
|
The name of the other repeat notification policy property for |
|
indication subscription class |
|
*/ |
|
const CIMName IndicationService::_PROPERTY_OTHERREPEATNOTIFICATIONPOLICY = |
|
CIMName ("OtherRepeatNotificationPolicy"); |
|
|
|
/** |
|
The name of the repeat notification interval property for indication |
|
subscription class |
|
*/ |
|
const CIMName IndicationService::_PROPERTY_REPEATNOTIFICATIONINTERVAL = |
|
CIMName ("RepeatNotificationInterval"); |
|
|
|
/** |
|
The name of the repeat notification gap property for indication |
|
subscription class |
|
*/ |
|
const CIMName IndicationService::_PROPERTY_REPEATNOTIFICATIONGAP = |
|
CIMName ("RepeatNotificationGap"); |
|
|
|
/** |
|
The name of the repeat notification count property for indication |
|
subscription class |
|
*/ |
|
const CIMName IndicationService::_PROPERTY_REPEATNOTIFICATIONCOUNT = |
|
CIMName ("RepeatNotificationCount"); |
|
|
|
/** |
|
The name of the On Fatal Error Policy property for Indication Subscription |
|
class |
|
*/ |
|
const CIMName IndicationService::_PROPERTY_ONFATALERRORPOLICY = |
|
CIMName ("OnFatalErrorPolicy"); |
|
|
|
/** |
|
The name of the Other On Fatal Error Policy property for Indication |
|
Subscription class |
|
*/ |
|
const CIMName IndicationService::_PROPERTY_OTHERONFATALERRORPOLICY = |
|
CIMName ("OtherOnFatalErrorPolicy"); |
|
|
|
/** |
|
The name of the Time Of Last State Change property for Indication |
|
Subscription class |
|
*/ |
|
const CIMName IndicationService::_PROPERTY_LASTCHANGE = |
|
CIMName ("TimeOfLastStateChange"); |
|
|
|
/** |
|
The name of the Subscription Start Time property for Indication |
|
Subscription class |
|
*/ |
|
const CIMName IndicationService::_PROPERTY_STARTTIME = |
|
CIMName ("SubscriptionStartTime"); |
|
|
|
/** |
|
The name of the Subscription Duration property for Indication |
|
Subscription class |
|
*/ |
|
const CIMName IndicationService::_PROPERTY_DURATION = |
|
CIMName ("SubscriptionDuration"); |
|
|
|
/** |
|
The name of the Subscription Time Remaining property for Indication |
|
Subscription class |
|
*/ |
|
const CIMName IndicationService::_PROPERTY_TIMEREMAINING = |
|
CIMName ("SubscriptionTimeRemaining"); |
|
|
|
/** |
|
The name of the query property for indication filter class |
|
*/ |
|
const CIMName IndicationService::_PROPERTY_QUERY = CIMName ("Query"); |
|
|
|
/** |
|
The name of the query language property for indication filter class |
|
*/ |
|
const CIMName IndicationService::_PROPERTY_QUERYLANGUAGE = |
|
CIMName ("QueryLanguage"); |
|
|
|
/** |
|
The name of the Source Namespace property for indication filter class |
|
*/ |
|
const CIMName IndicationService::_PROPERTY_SOURCENAMESPACE = |
|
CIMName ("SourceNamespace"); |
|
|
|
/** |
|
The name of the name property for indication filter and indications handler classes |
|
*/ |
|
const CIMName IndicationService::_PROPERTY_NAME = CIMName ("Name"); |
|
|
|
/** |
|
The name of the creation class name property for indication filter and |
|
indications handler classes |
|
*/ |
|
const CIMName IndicationService::_PROPERTY_CREATIONCLASSNAME = |
|
CIMName ("CreationClassName"); |
|
|
|
/** |
|
The name of the system name property for indication filter and indications |
|
handler classes |
|
*/ |
|
const CIMName IndicationService::_PROPERTY_SYSTEMNAME = |
|
CIMName ("SystemName"); |
|
|
|
/** |
|
The name of the system creation class name property for indication filter |
|
and indications handler classes |
|
*/ |
|
const CIMName IndicationService::_PROPERTY_SYSTEMCREATIONCLASSNAME = |
|
CIMName ("SystemCreationClassName"); |
|
|
|
/** |
|
The name of the Persistence Type property for Indication Handler class |
|
*/ |
|
const CIMName IndicationService::_PROPERTY_PERSISTENCETYPE = |
|
CIMName ("PersistenceType"); |
|
|
|
/** |
|
The name of the Other Persistence Type property for Indication Handler |
|
class |
|
*/ |
|
const CIMName IndicationService::_PROPERTY_OTHERPERSISTENCETYPE = |
|
CIMName ("OtherPersistenceType"); |
|
|
|
/** |
|
The name of the Destination property for CIM XML Indication Handler |
|
subclass |
|
*/ |
|
const CIMName IndicationService::_PROPERTY_DESTINATION = |
|
CIMName ("Destination"); |
|
|
|
/** |
|
The name of the TargetHost property for SNMP Mapper Indication |
|
Handler subclass |
|
*/ |
|
const CIMName IndicationService::_PROPERTY_TARGETHOST = |
|
CIMName ("TargetHost"); |
|
|
|
/** |
|
The name of the TargetHostFormat property for SNMP Indication Handler subclass |
|
*/ |
|
const CIMName IndicationService::_PROPERTY_TARGETHOSTFORMAT = |
|
CIMName ("TargetHostFormat"); |
|
|
|
/** |
|
The name of the SNMPVersion property for SNMP Indication Handler class |
|
*/ |
|
const CIMName IndicationService::_PROPERTY_SNMPVERSION = |
|
CIMName ("SNMPVersion"); |
|
|
|
/** |
|
The name of the Alert Type property for Alert Indication class |
|
*/ |
|
const CIMName IndicationService::_PROPERTY_ALERTTYPE = CIMName ("AlertType"); |
|
|
|
/** |
|
The name of the Other Alert Type property for Alert Indication class |
|
*/ |
|
const CIMName IndicationService::_PROPERTY_OTHERALERTTYPE = |
|
CIMName ("OtherAlertType"); |
|
|
|
/** |
|
The name of the Perceived Severity property for Alert Indication class |
|
*/ |
|
const CIMName IndicationService::_PROPERTY_PERCEIVEDSEVERITY = |
|
CIMName ("PerceivedSeverity"); |
|
|
|
/** |
|
The name of the Probable Cause property for Alert Indication class |
|
*/ |
|
const CIMName IndicationService::_PROPERTY_PROBABLECAUSE = |
|
CIMName ("ProbableCause"); |
|
|
|
/** |
|
The name of the Provider Name property for Provider class |
|
*/ |
|
const CIMName IndicationService::_PROPERTY_PROVIDERNAME = CIMName ("Name"); |
|
|
|
/** |
|
The name of the Provider Module Name property for Provider class |
|
*/ |
|
const CIMName IndicationService::_PROPERTY_PROVIDERMODULENAME = |
|
CIMName ("ProviderModuleName"); |
|
|
|
|
|
// |
|
// Qualifier names |
|
// |
|
|
|
/** |
|
The name of the Indication qualifier for classes |
|
*/ |
|
const CIMName IndicationService::_QUALIFIER_INDICATION = CIMName ("INDICATION"); |
|
|
|
|
|
// |
|
// Other literal values |
|
// |
|
|
|
/** |
|
The WHERE keyword in WQL |
|
*/ |
|
const char IndicationService::_QUERY_WHERE [] = "WHERE"; |
|
|
|
/** |
|
The string representing the asterisk all properties symbol in WQL |
|
*/ |
|
const char IndicationService::_QUERY_ALLPROPERTIES [] = "*"; |
|
|
|
/** |
|
A zero value CIMDateTime interval |
|
*/ |
|
const char IndicationService::_ZERO_INTERVAL_STRING [] = |
|
"00000000000000.000000:000"; |
|
|
|
// |
|
// Message substrings used in exception messages |
|
// |
|
|
|
// l10n |
|
|
|
// some have been commented out and put directly in the code for localization |
|
|
|
// this one is tricky because it is used in _checkRequiredProperty with the two below |
|
const char IndicationService::_MSG_MISSING_REQUIRED [] = "Missing required "; |
|
|
|
const char IndicationService::_MSG_KEY_PROPERTY [] = " key property"; |
|
const char IndicationService::_MSG_KEY_PROPERTY_KEY [] = |
|
"IndicationService.IndicationService._MSG_KEY_PROPERTY"; |
|
|
|
const char IndicationService::_MSG_PROPERTY [] = " property"; |
|
const char IndicationService::_MSG_PROPERTY_KEY [] = |
|
"IndicationService.IndicationService._MSG_PROPERTY"; |
|
|
|
const char IndicationService::_MSG_PROPERTY_PRESENT [] = |
|
" property present, but "; |
|
|
|
const char IndicationService::_MSG_VALUE_NOT [] = " value not "; |
|
|
|
const char IndicationService::_MSG_PROPERTY_PRESENT_BUT_VALUE_NOT_KEY [] = |
|
"IndicationService.IndicationService._MSG_PROPERTY_PRESENT_BUT_VALUE_NOT"; |
|
|
|
|
|
const char IndicationService::_MSG_NO_PROVIDERS [] = |
|
"There are no providers capable of serving the subscription"; |
|
const char IndicationService::_MSG_NO_PROVIDERS_KEY [] = |
|
"IndicationService.IndicationService._MSG_NO_PROVIDERS"; |
|
|
|
const char IndicationService::_MSG_NOT_ACCEPTED [] = |
|
"No providers accepted the subscription"; |
|
const char IndicationService::_MSG_NOT_ACCEPTED_KEY [] = |
|
"IndicationService.IndicationService._MSG_NOT_ACCEPTED"; |
|
|
|
const char IndicationService::_MSG_INVALID_CLASSNAME [] = |
|
"Invalid indication class name "; |
|
|
|
const char IndicationService::_MSG_IN_FROM [] = " in FROM clause of "; |
|
|
|
const char IndicationService::_MSG_INVALID_CLASSNAME_IN_FROM_PROPERTY_KEY [] = |
|
"IndicationService.IndicationService._MSG_INVALID_CLASSNAME_IN_FROM_PROPERTY"; |
|
|
|
const char IndicationService::_MSG_EXPIRED [] = |
|
"Expired subscription may not be modified; has been deleted"; |
|
const char IndicationService::_MSG_EXPIRED_KEY [] = |
|
"IndicationService.IndicationService._MSG_EXPIRED"; |
|
|
|
const char IndicationService::_MSG_REFERENCED [] = |
|
"A Filter or Handler referenced by a subscription may not be deleted"; |
|
const char IndicationService::_MSG_REFERENCED_KEY [] = |
|
"IndicationService.IndicationService._MSG_REFERENCED"; |
|
|
|
|
|
const char IndicationService::_MSG_INVALID_VALUE [] = |
|
"Invalid value "; |
|
|
|
const char IndicationService::_MSG_INVALID_TYPE [] = |
|
"Invalid type "; |
|
|
|
const char IndicationService::_MSG_FOR_PROPERTY [] = |
|
" for property "; |
|
|
|
const char IndicationService::_MSG_ARRAY_OF [] = |
|
" array of "; |
|
|
|
const char IndicationService::_MSG_INVALID_VALUE_FOR_PROPERTY_KEY [] = |
|
"IndicationService.IndicationService._MSG_INVALID_VALUE_FOR_PROPERTY"; |
|
|
|
const char IndicationService::_MSG_CLASS_NOT_SERVED [] = |
|
"The specified class is not served by the Indication Service"; |
|
|
|
const char IndicationService::_MSG_CLASS_NOT_SERVED_KEY [] = |
|
"IndicationService.IndicationService._MSG_CLASS_NOT_SERVED"; |
|
|
|
const char IndicationService::_MSG_INVALID_INSTANCES [] = |
|
"One or more invalid Subscription instances were ignored"; |
|
|
|
const char IndicationService::_MSG_INVALID_INSTANCES_KEY [] = |
|
"IndicationService.IndicationService.INVALID_SUBSCRIPTION_INSTANCES_IGNORED"; |
|
|
|
const char IndicationService::_MSG_PROVIDER_NO_LONGER_SERVING [] = |
|
"Provider ($0) is no longer serving subscription ($1)"; |
|
|
|
const char IndicationService::_MSG_PROVIDER_NO_LONGER_SERVING_KEY [] = |
|
"IndicationService.IndicationService._MSG_PROVIDER_NO_LONGER_SERVING"; |
|
|
|
const char IndicationService::_MSG_PROVIDER_NOW_SERVING [] = |
|
"Provider ($0) is now serving subscription ($1)"; |
|
|
|
const char IndicationService::_MSG_PROVIDER_NOW_SERVING_KEY [] = |
|
"IndicationService.IndicationService._MSG_PROVIDER_NOW_SERVING"; |
|
|
|
const char IndicationService::_MSG_NO_PROVIDER [] = |
|
"Subscription ($0) has no provider"; |
|
|
|
const char IndicationService::_MSG_NO_PROVIDER_KEY [] = |
|
"IndicationService.IndicationService._MSG_NO_PROVIDER"; |
|
|
|
const char IndicationService::_MSG_NON_PRIVILEGED_ACCESS_DISABLED [] = |
|
"User ($0) is not authorized to perform this operation."; |
|
|
|
const char IndicationService::_MSG_NON_PRIVILEGED_ACCESS_DISABLED_KEY [] = |
|
"IndicationService.IndicationService._MSG_NON_PRIVILEGED_ACCESS_DISABLED"; |
|
|
|
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |
| |
|
|