version 1.29, 2009/05/27 05:56:29
|
version 1.29.8.1, 2013/04/08 10:36:23
|
|
|
"SubscriptionTable::getSubscriptionEntry"); | "SubscriptionTable::getSubscriptionEntry"); |
| |
Boolean succeeded = false; | Boolean succeeded = false; |
String activeSubscriptionsKey = _generateActiveSubscriptionsKey |
SubscriptionKey activeSubscriptionsKey = |
(subscriptionPath); |
SubscriptionKey(subscriptionPath); |
if (_lockedLookupActiveSubscriptionsEntry | if (_lockedLookupActiveSubscriptionsEntry |
(activeSubscriptionsKey, tableValue)) | (activeSubscriptionsKey, tableValue)) |
{ | { |
|
|
// | // |
PEG_TRACE((TRC_INDICATION_SERVICE, Tracer::LEVEL1, | PEG_TRACE((TRC_INDICATION_SERVICE, Tracer::LEVEL1, |
"Subscription (%s) not found in ActiveSubscriptionsTable", | "Subscription (%s) not found in ActiveSubscriptionsTable", |
(const char*)activeSubscriptionsKey.getCString())); |
(const char*)activeSubscriptionsKey.toString().getCString())); |
} | } |
| |
PEG_METHOD_EXIT (); | PEG_METHOD_EXIT (); |
|
|
// Check if the provider who generated this indication | // Check if the provider who generated this indication |
// accepted this subscription | // accepted this subscription |
// | // |
String activeSubscriptionsKey = |
SubscriptionKey activeSubscriptionsKey = |
_generateActiveSubscriptionsKey |
SubscriptionKey(subscriptions [j].getPath ()); |
(subscriptions [j].getPath ()); |
|
ActiveSubscriptionsTableEntry asTableValue; | ActiveSubscriptionsTableEntry asTableValue; |
if (_lockedLookupActiveSubscriptionsEntry( | if (_lockedLookupActiveSubscriptionsEntry( |
activeSubscriptionsKey, asTableValue)) | activeSubscriptionsKey, asTableValue)) |
|
|
// | // |
// Update the entry in the active subscriptions hash table | // Update the entry in the active subscriptions hash table |
// | // |
String activeSubscriptionsKey = |
SubscriptionKey activeSubscriptionsKey = |
_generateActiveSubscriptionsKey |
SubscriptionKey(providerSubscriptions [k].getPath ()); |
(providerSubscriptions [k].getPath ()); |
|
ActiveSubscriptionsTableEntry asTableValue; | ActiveSubscriptionsTableEntry asTableValue; |
if (_activeSubscriptionsTable.lookup( | if (_activeSubscriptionsTable.lookup( |
activeSubscriptionsKey, asTableValue)) | activeSubscriptionsKey, asTableValue)) |
|
|
"Provider (%s) not found in list for Subscription (%s)" | "Provider (%s) not found in list for Subscription (%s)" |
" in ActiveSubscriptionsTable", | " in ActiveSubscriptionsTable", |
(const char*)provider.getPath().toString().getCString(), | (const char*)provider.getPath().toString().getCString(), |
(const char*)activeSubscriptionsKey.getCString())); |
(const char*) |
|
activeSubscriptionsKey.toString().getCString())); |
} | } |
} | } |
else | else |
{ | { |
PEG_TRACE((TRC_INDICATION_SERVICE,Tracer::LEVEL2, | PEG_TRACE((TRC_INDICATION_SERVICE,Tracer::LEVEL2, |
"Subscription (%s) not found in ActiveSubscriptionsTable", | "Subscription (%s) not found in ActiveSubscriptionsTable", |
(const char*)activeSubscriptionsKey.getCString())); |
(const char*) |
|
activeSubscriptionsKey.toString().getCString())); |
// | // |
// The subscription may have been deleted in the mean time | // The subscription may have been deleted in the mean time |
// If so, no further update is required | // If so, no further update is required |
|
|
// | // |
// Update the entry in the active subscriptions hash table | // Update the entry in the active subscriptions hash table |
// | // |
String activeSubscriptionsKey = |
SubscriptionKey activeSubscriptionsKey = |
_generateActiveSubscriptionsKey |
SubscriptionKey( |
(providerModuleSubscriptions [k].subscription.getPath ()); |
providerModuleSubscriptions[k].subscription.getPath()); |
ActiveSubscriptionsTableEntry asTableValue; | ActiveSubscriptionsTableEntry asTableValue; |
if (_activeSubscriptionsTable.lookup( | if (_activeSubscriptionsTable.lookup( |
activeSubscriptionsKey, asTableValue)) | activeSubscriptionsKey, asTableValue)) |
|
|
return providerModuleSubscriptions; | return providerModuleSubscriptions; |
} | } |
| |
String SubscriptionTable::_generateActiveSubscriptionsKey ( |
|
const CIMObjectPath & subscription) const |
|
{ |
|
// |
|
// Get filter and handler object paths from subscription Filter and Handler |
|
// reference property values |
|
// |
|
Array<CIMKeyBinding> subscriptionKB = subscription.getKeyBindings (); |
|
String filterPath; |
|
String handlerPath; |
|
for (Uint32 i = 0; i < subscriptionKB.size (); i++) |
|
{ |
|
if ((subscriptionKB [i].getName () == PEGASUS_PROPERTYNAME_FILTER) && |
|
(subscriptionKB [i].getType () == CIMKeyBinding::REFERENCE)) |
|
{ |
|
filterPath = subscriptionKB [i].getValue (); |
|
} |
|
else |
|
if ((subscriptionKB [i].getName () == PEGASUS_PROPERTYNAME_HANDLER) && |
|
(subscriptionKB [i].getType () == CIMKeyBinding::REFERENCE)) |
|
{ |
|
handlerPath = subscriptionKB [i].getValue (); |
|
} |
|
} |
|
|
|
// |
|
// Construct subscription key from handler and filter. |
|
// To avoid ambiguity, the hostname part is removed, since the |
|
// hostname can only point to the local machine anyway. |
|
// |
|
const Char16 slash = '/'; |
|
if ((filterPath[0]==slash) && (filterPath[1]==slash)) |
|
{ |
|
Uint32 index = filterPath.find(2,slash); |
|
filterPath = filterPath.subString(index+1); |
|
} |
|
|
|
if ((handlerPath[0]==slash) && (handlerPath[1]==slash)) |
|
{ |
|
Uint32 index = handlerPath.find(2,slash); |
|
handlerPath = handlerPath.subString(index+1); |
|
} |
|
|
|
// |
|
// Assuming that most subscriptions will differ in the filter and handler |
|
// names, the namespace and classname of the subscription are added at the |
|
// end of the key. |
|
// |
|
String activeSubscriptionsKey(filterPath); |
|
activeSubscriptionsKey.append(handlerPath); |
|
activeSubscriptionsKey.append(slash); |
|
activeSubscriptionsKey.append(subscription.getNameSpace().getString()); |
|
activeSubscriptionsKey.append(slash); |
|
activeSubscriptionsKey.append(subscription.getClassName().getString()); |
|
|
|
return activeSubscriptionsKey; |
|
} |
|
|
|
Boolean SubscriptionTable::_lockedLookupActiveSubscriptionsEntry ( | Boolean SubscriptionTable::_lockedLookupActiveSubscriptionsEntry ( |
const String & key, |
const SubscriptionKey & key, |
ActiveSubscriptionsTableEntry & tableEntry) const | ActiveSubscriptionsTableEntry & tableEntry) const |
{ | { |
ReadLock lock(_activeSubscriptionsTableLock); | ReadLock lock(_activeSubscriptionsTableLock); |
|
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, | PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
"SubscriptionTable::_insertActiveSubscriptionsEntry"); | "SubscriptionTable::_insertActiveSubscriptionsEntry"); |
| |
String activeSubscriptionsKey = _generateActiveSubscriptionsKey |
SubscriptionKey activeSubscriptionsKey = |
(subscription.getPath ()); |
SubscriptionKey(subscription.getPath ()); |
ActiveSubscriptionsTableEntry entry; | ActiveSubscriptionsTableEntry entry; |
entry.subscription = subscription; | entry.subscription = subscription; |
entry.providers = providers; | entry.providers = providers; |
|
|
} | } |
| |
void SubscriptionTable::_removeActiveSubscriptionsEntry ( | void SubscriptionTable::_removeActiveSubscriptionsEntry ( |
const String & key) |
const SubscriptionKey & key) |
{ | { |
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, | PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
"SubscriptionTable::_removeActiveSubscriptionsEntry"); | "SubscriptionTable::_removeActiveSubscriptionsEntry"); |
|
|
#ifdef PEGASUS_INDICATION_HASHTRACE | #ifdef PEGASUS_INDICATION_HASHTRACE |
PEG_TRACE((TRC_INDICATION_SERVICE,Tracer::LEVEL4, | PEG_TRACE((TRC_INDICATION_SERVICE,Tracer::LEVEL4, |
"REMOVED _activeSubscriptionsTable entry: %s", | "REMOVED _activeSubscriptionsTable entry: %s", |
(const char*)key.getCString())); |
(const char*)key.toString().getCString())); |
#endif | #endif |
| |
PEG_METHOD_EXIT (); | PEG_METHOD_EXIT (); |
|
|
} | } |
| |
void SubscriptionTable::_updateSubscriptionProviders | void SubscriptionTable::_updateSubscriptionProviders |
(const String & activeSubscriptionsKey, |
(const SubscriptionKey & activeSubscriptionsKey, |
const CIMInstance & subscription, | const CIMInstance & subscription, |
const Array <ProviderClassList> & updatedProviderList) | const Array <ProviderClassList> & updatedProviderList) |
{ | { |
|
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, | PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
"SubscriptionTable::updateProviders"); | "SubscriptionTable::updateProviders"); |
| |
String activeSubscriptionsKey = _generateActiveSubscriptionsKey |
SubscriptionKey activeSubscriptionsKey = |
(subscriptionPath); |
SubscriptionKey(subscriptionPath); |
|
|
ActiveSubscriptionsTableEntry asTableValue; | ActiveSubscriptionsTableEntry asTableValue; |
{ | { |
// | // |
|
|
"in ActiveSubscriptionsTable", | "in ActiveSubscriptionsTable", |
(const char*)IndicationService::getProviderLogString(p) | (const char*)IndicationService::getProviderLogString(p) |
.getCString(), | .getCString(), |
(const char*)activeSubscriptionsKey.getCString())); |
(const char*)activeSubscriptionsKey |
|
.toString().getCString())); |
} | } |
} | } |
else | else |
|
|
"in ActiveSubscriptionsTable", | "in ActiveSubscriptionsTable", |
(const char*)IndicationService::getProviderLogString(p) | (const char*)IndicationService::getProviderLogString(p) |
.getCString(), | .getCString(), |
(const char*)activeSubscriptionsKey.getCString())); |
(const char*) |
|
activeSubscriptionsKey.toString().getCString())); |
} | } |
} | } |
} | } |
|
|
{ | { |
PEG_TRACE((TRC_INDICATION_SERVICE, Tracer::LEVEL2, | PEG_TRACE((TRC_INDICATION_SERVICE, Tracer::LEVEL2, |
"Subscription (%s) not found in ActiveSubscriptionsTable", | "Subscription (%s) not found in ActiveSubscriptionsTable", |
(const char*)activeSubscriptionsKey.getCString())); |
(const char*)activeSubscriptionsKey.toString().getCString())); |
| |
// | // |
// The subscription may have been deleted in the mean time | // The subscription may have been deleted in the mean time |
|
|
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, | PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
"SubscriptionTable::updateClasses"); | "SubscriptionTable::updateClasses"); |
| |
String activeSubscriptionsKey = _generateActiveSubscriptionsKey |
SubscriptionKey activeSubscriptionsKey = SubscriptionKey(subscriptionPath); |
(subscriptionPath); |
|
ActiveSubscriptionsTableEntry asTableValue; | ActiveSubscriptionsTableEntry asTableValue; |
| |
{ | { |
|
|
"Provider (%s) not found in list for Subscription (%s) in " | "Provider (%s) not found in list for Subscription (%s) in " |
"ActiveSubscriptionsTable", | "ActiveSubscriptionsTable", |
(const char*)provider.getPath().toString().getCString(), | (const char*)provider.getPath().toString().getCString(), |
(const char*)activeSubscriptionsKey.getCString())); |
(const char*) |
|
activeSubscriptionsKey.toString().getCString())); |
} | } |
} | } |
else | else |
|
|
// | // |
{ | { |
WriteLock lock(_activeSubscriptionsTableLock); | WriteLock lock(_activeSubscriptionsTableLock); |
|
|
_removeActiveSubscriptionsEntry ( | _removeActiveSubscriptionsEntry ( |
_generateActiveSubscriptionsKey (subscription.getPath ())); |
SubscriptionKey(subscription.getPath())); |
} | } |
| |
// | // |
|
|
const CIMNamespaceName & nameSpace, | const CIMNamespaceName & nameSpace, |
const CIMInstance& provider, | const CIMInstance& provider, |
Array<CIMInstance>& matchingSubscriptions, | Array<CIMInstance>& matchingSubscriptions, |
Array<String>& matchingSubscriptionKeys) |
Array<SubscriptionKey>& matchingSubscriptionKeys) |
{ | { |
PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, | PEG_METHOD_ENTER (TRC_INDICATION_SERVICE, |
"SubscriptionTable::getMatchingClassNamespaceSubscriptions"); | "SubscriptionTable::getMatchingClassNamespaceSubscriptions"); |
|
|
// Look up the indicationClass-sourceNamespace pair in the | // Look up the indicationClass-sourceNamespace pair in the |
// Subscription Classes table | // Subscription Classes table |
// | // |
String subscriptionClassesKey = _generateSubscriptionClassesKey |
String subscriptionClassesKey = |
(supportedClass, nameSpace); |
_generateSubscriptionClassesKey(supportedClass, nameSpace); |
SubscriptionClassesTableEntry scTableValue; | SubscriptionClassesTableEntry scTableValue; |
if (_lockedLookupSubscriptionClassesEntry( | if (_lockedLookupSubscriptionClassesEntry( |
subscriptionClassesKey, scTableValue)) | subscriptionClassesKey, scTableValue)) |
|
|
// Check if the provider who generated this indication | // Check if the provider who generated this indication |
// accepted this subscription | // accepted this subscription |
// | // |
String activeSubscriptionsKey = |
SubscriptionKey activeSubscriptionsKey = |
_generateActiveSubscriptionsKey |
SubscriptionKey(subscriptions [j].getPath ()); |
(subscriptions [j].getPath ()); |
|
ActiveSubscriptionsTableEntry asTableValue; | ActiveSubscriptionsTableEntry asTableValue; |
if (_lockedLookupActiveSubscriptionsEntry( | if (_lockedLookupActiveSubscriptionsEntry( |
activeSubscriptionsKey, asTableValue)) | activeSubscriptionsKey, asTableValue)) |
|
|
| |
void SubscriptionTable::updateMatchedIndicationCounts( | void SubscriptionTable::updateMatchedIndicationCounts( |
const CIMInstance & providerInstance, | const CIMInstance & providerInstance, |
const Array<String>& activeSubscriptionsKeys) |
const Array<SubscriptionKey>& activeSubscriptionsKeys) |
{ | { |
PEG_METHOD_ENTER(TRC_INDICATION_SERVICE, | PEG_METHOD_ENTER(TRC_INDICATION_SERVICE, |
"SubscriptionTable::updateMatchedIndicationCounts"); | "SubscriptionTable::updateMatchedIndicationCounts"); |
|
|
// If so, no further update is required. | // If so, no further update is required. |
PEG_TRACE((TRC_INDICATION_SERVICE, Tracer::LEVEL2, | PEG_TRACE((TRC_INDICATION_SERVICE, Tracer::LEVEL2, |
"Subscription %s not found in ActiveSubscriptionsTable", | "Subscription %s not found in ActiveSubscriptionsTable", |
(const char *) activeSubscriptionsKeys[i].getCString())); |
(const char *) |
|
activeSubscriptionsKeys[i].toString().getCString())); |
} | } |
} | } |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |