version 1.12, 2002/03/13 00:10:41
|
version 1.13, 2002/03/15 18:32:55
|
|
|
| |
void IndicationService::_initialize (void) | void IndicationService::_initialize (void) |
{ | { |
Array <struct SubscriptionRef> activeSubscriptions; |
Array <CIMNamedInstance> activeSubscriptions; |
Array <struct SubscriptionRef> noProviderSubscriptions; |
Array <CIMNamedInstance> noProviderSubscriptions; |
Array <CIMInstance> startProviders; | Array <CIMInstance> startProviders; |
Boolean duplicate; | Boolean duplicate; |
| |
|
|
// | // |
// Check for expired subscription | // Check for expired subscription |
// | // |
if ((activeSubscriptions [i].subscription.existsProperty |
if ((activeSubscriptions [i].getInstance ().existsProperty |
(_PROPERTY_DURATION)) && | (_PROPERTY_DURATION)) && |
(_isExpired (activeSubscriptions [i].subscription))) |
(_isExpired (activeSubscriptions [i].getInstance ()))) |
{ | { |
CIMClass subscriptionClass = _repository->getClass | CIMClass subscriptionClass = _repository->getClass |
(activeSubscriptions [i].nameSpaceName, _CLASS_SUBSCRIPTION); |
(activeSubscriptions [i].getInstanceName ().getNameSpace (), |
|
_CLASS_SUBSCRIPTION); |
| |
_deleteExpiredSubscription (activeSubscriptions [i].nameSpaceName, |
_deleteExpiredSubscription |
activeSubscriptions [i].subscription.getInstanceName |
(activeSubscriptions [i].getInstanceName ().getNameSpace (), |
(subscriptionClass)); |
activeSubscriptions [i].getInstanceName ()); |
| |
continue; | continue; |
} | } |
| |
_getEnableParams (activeSubscriptions [i].nameSpaceName, |
_getEnableParams |
activeSubscriptions [i].subscription, indicationProviders, |
(activeSubscriptions [i].getInstanceName ().getNameSpace (), |
|
activeSubscriptions [i].getInstance (), indicationProviders, |
propertyList, condition, queryLanguage); | propertyList, condition, queryLanguage); |
| |
if (indicationProviders.size () == 0) | if (indicationProviders.size () == 0) |
|
|
// Send enable request message to each provider | // Send enable request message to each provider |
// | // |
_sendEnableRequests (indicationProviders, | _sendEnableRequests (indicationProviders, |
activeSubscriptions [i].nameSpaceName, |
activeSubscriptions [i].getInstanceName ().getNameSpace (), |
propertyList, condition, queryLanguage, | propertyList, condition, queryLanguage, |
activeSubscriptions [i].subscription); |
activeSubscriptions [i].getInstance ()); |
| |
// | // |
// Merge provider list into list of unique providers to start | // Merge provider list into list of unique providers to start |
|
|
| |
void IndicationService::_terminate (void) | void IndicationService::_terminate (void) |
{ | { |
Array <struct SubscriptionRef> activeSubscriptions; |
Array <CIMNamedInstance> activeSubscriptions; |
CIMInstance indicationInstance; | CIMInstance indicationInstance; |
| |
const char METHOD_NAME [] = "IndicationService::_terminate"; | const char METHOD_NAME [] = "IndicationService::_terminate"; |
|
|
{ | { |
// | // |
// Add creator property to Instance | // Add creator property to Instance |
// ATTN: need method to get current user |
// NOTE: userName is only set in the request if authentication |
|
// is turned on |
|
// |
|
String currentUser = request->userName; |
|
try |
|
{ |
|
instance.addProperty (CIMProperty |
|
(_PROPERTY_CREATOR, currentUser)); |
|
} |
|
catch (NoSuchProperty & e) |
|
{ |
|
// |
|
// If the property does not exist, add it to the class |
|
// |
|
CIMClass theClass = _repository->getClass |
|
(request->nameSpace, instance.getClassName ()); |
|
theClass.addProperty (CIMProperty (_PROPERTY_CREATOR, |
|
CIMValue (String::EMPTY))); |
|
|
|
_repository->write_lock (); |
|
|
|
try |
|
{ |
|
_repository->modifyClass (request->nameSpace, |
|
theClass); |
|
} |
|
catch (Exception & exception) |
|
{ |
|
// |
|
// ATTN: Log a message?? |
// | // |
String currentUser = String::EMPTY; |
} |
instance.addProperty (CIMProperty (_PROPERTY_CREATOR, currentUser)); |
|
|
_repository->write_unlock (); |
|
|
|
instance.addProperty (CIMProperty |
|
(_PROPERTY_CREATOR, currentUser)); |
|
} |
| |
// | // |
// If the instance is of the CIM_IndicationSubscription class | // If the instance is of the CIM_IndicationSubscription class |
|
|
lastChange.setValue (CIMValue (currentDateTime)); | lastChange.setValue (CIMValue (currentDateTime)); |
} | } |
| |
|
CIMDateTime startDateTime; |
|
if ((subscriptionState == _STATE_ENABLED) || |
|
(subscriptionState == _STATE_ENABLEDDEGRADED)) |
|
{ |
|
startDateTime = currentDateTime; |
|
} |
|
else |
|
{ |
|
// |
|
// If subscription is not enabled, set Subscription |
|
// Start Time to null CIMDateTime value |
|
// |
|
startDateTime = CIMDateTime (); |
|
} |
|
|
// | // |
// Set Subscription Start Time to current date time |
// Set Subscription Start Time |
// | // |
if (!instance.existsProperty (_PROPERTY_STARTTIME)) | if (!instance.existsProperty (_PROPERTY_STARTTIME)) |
{ | { |
instance.addProperty | instance.addProperty |
(CIMProperty (_PROPERTY_STARTTIME, currentDateTime)); |
(CIMProperty (_PROPERTY_STARTTIME, startDateTime)); |
} | } |
else | else |
{ | { |
CIMProperty startTime = instance.getProperty | CIMProperty startTime = instance.getProperty |
(instance.findProperty (_PROPERTY_STARTTIME)); | (instance.findProperty (_PROPERTY_STARTTIME)); |
startTime.setValue (CIMValue (currentDateTime)); |
startTime.setValue (CIMValue (startDateTime)); |
} | } |
} | } |
| |
|
|
// ATTN: need method to get current date time in CIMDateTime | // ATTN: need method to get current date time in CIMDateTime |
// format | // format |
// | // |
|
CIMDateTime currentDateTime = CIMDateTime (); |
if (newState != currentState) | if (newState != currentState) |
{ | { |
CIMDateTime currentDateTime = CIMDateTime (); |
|
CIMProperty lastChange = instance.getProperty | CIMProperty lastChange = instance.getProperty |
(instance.findProperty (_PROPERTY_LASTCHANGE)); | (instance.findProperty (_PROPERTY_LASTCHANGE)); |
lastChange.setValue (CIMValue (currentDateTime)); | lastChange.setValue (CIMValue (currentDateTime)); |
} | } |
| |
// | // |
|
// If Subscription is to be enabled, and this is the first |
|
// time, set Subscription Start Time |
|
// |
|
if ((newState == _STATE_ENABLED) || |
|
(newState == _STATE_ENABLEDDEGRADED)) |
|
{ |
|
// |
|
// If Subscription Start Time is null, set value |
|
// to the current date time |
|
// |
|
CIMDateTime startTime; |
|
CIMProperty startTimeProperty = instance.getProperty |
|
(instance.findProperty (_PROPERTY_STARTTIME)); |
|
CIMValue startTimeValue = instance.getProperty |
|
(instance.findProperty |
|
(_PROPERTY_STARTTIME)).getValue (); |
|
if (startTimeValue.isNull ()) |
|
{ |
|
startTimeProperty.setValue (CIMValue (currentDateTime)); |
|
} |
|
else |
|
{ |
|
startTimeValue.get (startTime); |
|
if (startTime.isNull ()) |
|
{ |
|
startTimeProperty.setValue |
|
(CIMValue (currentDateTime)); |
|
} |
|
} |
|
} |
|
|
|
// |
// If subscription is to be enabled, determine if there are | // If subscription is to be enabled, determine if there are |
// any indication providers that can serve the subscription | // any indication providers that can serve the subscription |
// | // |
|
|
(_PROPERTY_CREATOR)).getValue ().toString (); | (_PROPERTY_CREATOR)).getValue ().toString (); |
| |
// | // |
// ATTN: need method to get current user |
|
// |
|
String currentUser = String::EMPTY; |
|
|
|
// |
|
// Current user must be privileged user or instance Creator to delete | // Current user must be privileged user or instance Creator to delete |
// ATTN: need method to determine if current user is Privileged |
// NOTE: if authentication was not turned on when instance was created, |
// |
// instance creator will be String::EMPTY |
if (/*(!System::isPrivilegedUser (currentUser) && */ |
// If creator is String::EMPTY, anyone may modify or delete the |
|
// instance |
|
// |
|
String currentUser = request->userName; |
|
//cout << "creator: " << creator << endl; |
|
//cout << "currentUser: " << currentUser << endl; |
|
//cout << "System::isPrivilegedUser (currentUser): " << |
|
//System::isPrivilegedUser (currentUser) << endl; |
|
if ((creator != String::EMPTY) && |
|
(!System::isPrivilegedUser (currentUser)) && |
(currentUser != creator)) | (currentUser != creator)) |
{ | { |
PEG_FUNC_EXIT (TRC_INDICATION_SERVICE, METHOD_NAME); | PEG_FUNC_EXIT (TRC_INDICATION_SERVICE, METHOD_NAME); |
|
|
Array<String> propertyList; | Array<String> propertyList; |
Boolean match; | Boolean match; |
| |
Array <struct SubscriptionRef> matchedSubscriptions; |
Array <CIMNamedInstance> matchedSubscriptions; |
struct HandlerRef handlerRef; |
CIMNamedInstance handlerNamedInstance; |
| |
WQLSelectStatement selectStatement; | WQLSelectStatement selectStatement; |
| |
|
|
match = true; | match = true; |
| |
filterQuery = _getFilterQuery( | filterQuery = _getFilterQuery( |
matchedSubscriptions[i].subscription, |
matchedSubscriptions[i].getInstance (), |
matchedSubscriptions[i].nameSpaceName); |
matchedSubscriptions[i].getInstanceName ().getNameSpace ()); |
| |
selectStatement = _getSelectStatement (filterQuery); | selectStatement = _getSelectStatement (filterQuery); |
| |
|
|
| |
if (match) | if (match) |
{ | { |
handlerRef = _getHandlerRef(matchedSubscriptions[i]); |
handlerNamedInstance = _getHandler |
|
(matchedSubscriptions[i]); |
| |
CIMRequestMessage * handler_request = | CIMRequestMessage * handler_request = |
new CIMHandleIndicationRequestMessage ( | new CIMHandleIndicationRequestMessage ( |
XmlWriter::getNextMessageId (), | XmlWriter::getNextMessageId (), |
request->nameSpace, | request->nameSpace, |
handlerRef.handler, |
handlerNamedInstance.getInstance (), |
|
//handlerRef.handler, |
indication, | indication, |
QueueIdStack(_handlerService, getQueueId())); | QueueIdStack(_handlerService, getQueueId())); |
| |
|
|
CIMPropertyList newPropertyNames = request->newPropertyNames; | CIMPropertyList newPropertyNames = request->newPropertyNames; |
CIMPropertyList oldPropertyNames = request->oldPropertyNames; | CIMPropertyList oldPropertyNames = request->oldPropertyNames; |
| |
Array <struct SubscriptionRef> newSubscriptions; |
Array <CIMNamedInstance> newSubscriptions; |
Array <struct SubscriptionRef> formerSubscriptions; |
Array <CIMNamedInstance> formerSubscriptions; |
Array <struct ProviderClassList> indicationProviders; | Array <struct ProviderClassList> indicationProviders; |
struct ProviderClassList indicationProvider; | struct ProviderClassList indicationProvider; |
| |
|
|
// | // |
for (Uint8 i = 0; i < newSubscriptions.size (); i++) | for (Uint8 i = 0; i < newSubscriptions.size (); i++) |
{ | { |
_getEnableParams (newSubscriptions [i].nameSpaceName, |
_getEnableParams |
newSubscriptions [i].subscription, indicationProviders, |
(newSubscriptions [i].getInstanceName ().getNameSpace (), |
|
newSubscriptions [i].getInstance (), indicationProviders, |
requiredProperties, condition, queryLanguage); | requiredProperties, condition, queryLanguage); |
| |
// | // |
// Send enable request | // Send enable request |
// | // |
_sendEnableRequests (indicationProviders, | _sendEnableRequests (indicationProviders, |
newSubscriptions [i].nameSpaceName, requiredProperties, |
newSubscriptions [i].getInstanceName ().getNameSpace (), |
condition, queryLanguage, newSubscriptions [i].subscription); |
requiredProperties, condition, queryLanguage, |
|
newSubscriptions [i].getInstance ()); |
| |
// | // |
// Send start message to each provider | // Send start message to each provider |
|
|
for (Uint8 i = 0; i < formerSubscriptions.size (); i++) | for (Uint8 i = 0; i < formerSubscriptions.size (); i++) |
{ | { |
_sendDisableRequests (indicationProviders, | _sendDisableRequests (indicationProviders, |
formerSubscriptions [i].nameSpaceName, |
formerSubscriptions [i].getInstanceName ().getNameSpace (), |
formerSubscriptions [i].subscription); |
formerSubscriptions [i].getInstance ()); |
} | } |
| |
// | // |
|
|
void IndicationService::_handleNotifyProviderTerminationRequest | void IndicationService::_handleNotifyProviderTerminationRequest |
(const Message * message) | (const Message * message) |
{ | { |
Array <struct SubscriptionRef> providerSubscriptions; |
Array <CIMNamedInstance> providerSubscriptions; |
CIMInstance indicationInstance; | CIMInstance indicationInstance; |
| |
const char METHOD_NAME [] = | const char METHOD_NAME [] = |
|
|
} | } |
} | } |
| |
|
if (instance.getClassName () == _CLASS_HANDLERCIMXML) |
|
{ |
// | // |
// Destination property is required for CIMXML and SNMP |
// Destination property is required for CIMXML |
// Handler subclasses |
// Handler subclass |
// | // |
if (!instance.existsProperty (_PROPERTY_DESTINATION)) | if (!instance.existsProperty (_PROPERTY_DESTINATION)) |
{ | { |
|
|
throw PEGASUS_CIM_EXCEPTION (CIM_ERR_INVALID_PARAMETER, | throw PEGASUS_CIM_EXCEPTION (CIM_ERR_INVALID_PARAMETER, |
exceptionStr); | exceptionStr); |
} | } |
|
} |
| |
if (instance.getClassName () == _CLASS_HANDLERSNMP) | if (instance.getClassName () == _CLASS_HANDLERSNMP) |
{ | { |
// | // |
|
// Trap Destination property is required for SNMP |
|
// Handler subclass |
|
// |
|
if (!instance.existsProperty (_PROPERTY_TRAPDESTINATION)) |
|
{ |
|
String exceptionStr = _MSG_MISSING_REQUIRED; |
|
exceptionStr.append (_PROPERTY_TRAPDESTINATION); |
|
exceptionStr.append (_MSG_PROPERTY); |
|
PEG_FUNC_EXIT (TRC_INDICATION_SERVICE, METHOD_NAME); |
|
throw PEGASUS_CIM_EXCEPTION (CIM_ERR_INVALID_PARAMETER, |
|
exceptionStr); |
|
} |
|
|
|
// |
// SNMP Type property is required for SNMP Handler | // SNMP Type property is required for SNMP Handler |
// | // |
if (!instance.existsProperty (_PROPERTY_SNMPTYPE)) | if (!instance.existsProperty (_PROPERTY_SNMPTYPE)) |
|
|
(_PROPERTY_CREATOR)).getValue ().toString (); | (_PROPERTY_CREATOR)).getValue ().toString (); |
| |
// | // |
// ATTN: need method to get current user |
|
// |
|
String currentUser = String::EMPTY; |
|
|
|
// |
|
// Current user must be privileged user or instance Creator to modify | // Current user must be privileged user or instance Creator to modify |
// ATTN: need method to determine if current user is Privileged |
// NOTE: if authentication was not turned on when instance was created, |
// |
// instance creator will be String::EMPTY |
if (/*(!System::isPrivilegedUser (currentUser)) && */ |
// If creator is String::EMPTY, anyone may modify or delete the |
|
// instance |
|
// |
|
String currentUser = request->userName; |
|
//cout << "creator: " << creator << endl; |
|
//cout << "currentUser: " << currentUser << endl; |
|
//cout << "System::isPrivilegedUser (currentUser): " << |
|
//System::isPrivilegedUser (currentUser) << endl; |
|
if ((creator != String::EMPTY) && |
|
(!System::isPrivilegedUser (currentUser)) && |
(currentUser != creator)) | (currentUser != creator)) |
{ | { |
PEG_FUNC_EXIT (TRC_INDICATION_SERVICE, METHOD_NAME); | PEG_FUNC_EXIT (TRC_INDICATION_SERVICE, METHOD_NAME); |
|
|
} | } |
| |
| |
Array <SubscriptionRef> IndicationService::_getActiveSubscriptions () const |
Array <CIMNamedInstance> IndicationService::_getActiveSubscriptions () const |
{ | { |
Array <SubscriptionRef> activeSubscriptions; |
Array <CIMNamedInstance> activeSubscriptions; |
Array <String> nameSpaceNames; | Array <String> nameSpaceNames; |
Array <CIMNamedInstance> subscriptions; | Array <CIMNamedInstance> subscriptions; |
CIMValue subscriptionStateValue; | CIMValue subscriptionStateValue; |
Uint16 subscriptionState; | Uint16 subscriptionState; |
struct SubscriptionRef current; |
|
| |
const char METHOD_NAME [] = | const char METHOD_NAME [] = |
"IndicationService::_getActiveSubscriptions"; | "IndicationService::_getActiveSubscriptions"; |
|
|
if ((subscriptionState == _STATE_ENABLED) || | if ((subscriptionState == _STATE_ENABLED) || |
(subscriptionState == _STATE_ENABLEDDEGRADED)) | (subscriptionState == _STATE_ENABLEDDEGRADED)) |
{ | { |
current.subscription = subscriptions [j].getInstance (); |
// |
current.nameSpaceName = nameSpaceNames [i]; |
// CIMNamedInstances returned from repository do not include |
|
// namespace |
activeSubscriptions.append (current); |
// Set namespace here |
|
// |
|
CIMReference instanceName = |
|
subscriptions [j].getInstanceName (); |
|
instanceName.setNameSpace (nameSpaceNames [i]); |
|
CIMNamedInstance currentInstance |
|
(instanceName, subscriptions [j].getInstance ()); |
|
activeSubscriptions.append (currentInstance); |
} // if subscription is enabled | } // if subscription is enabled |
} // for each subscription | } // for each subscription |
} // for each namespace | } // for each namespace |
|
|
} | } |
| |
| |
Array <SubscriptionRef> IndicationService::_getMatchingSubscriptions ( |
Array <CIMNamedInstance> IndicationService::_getMatchingSubscriptions ( |
const String & targetClass, | const String & targetClass, |
const CIMPropertyList & targetProperties) const | const CIMPropertyList & targetProperties) const |
{ | { |
Array <SubscriptionRef> matchingSubscriptions; |
Array <CIMNamedInstance> matchingSubscriptions; |
Array <String> nameSpaceNames; | Array <String> nameSpaceNames; |
Array <CIMNamedInstance> subscriptions; | Array <CIMNamedInstance> subscriptions; |
CIMValue subscriptionStateValue; | CIMValue subscriptionStateValue; |
Uint16 subscriptionState; | Uint16 subscriptionState; |
String filterQuery; |
|
WQLSelectStatement selectStatement; |
|
String indicationClassName; |
|
Array <String> indicationSubclasses; |
|
CIMPropertyList propertyList; |
|
Boolean match; |
|
struct SubscriptionRef current; |
|
| |
const char METHOD_NAME [] = | const char METHOD_NAME [] = |
"IndicationService::_getMatchingSubscriptions"; | "IndicationService::_getMatchingSubscriptions"; |
|
|
if ((subscriptionState == _STATE_ENABLED) || | if ((subscriptionState == _STATE_ENABLED) || |
(subscriptionState == _STATE_ENABLEDDEGRADED)) | (subscriptionState == _STATE_ENABLEDDEGRADED)) |
{ | { |
|
String filterQuery; |
|
WQLSelectStatement selectStatement; |
|
String indicationClassName; |
|
Array <String> indicationSubclasses; |
|
CIMPropertyList propertyList; |
|
Boolean match; |
|
|
// | // |
// Get filter query | // Get filter query |
// | // |
|
|
// | // |
if (match) | if (match) |
{ | { |
current.subscription = subscriptions [j].getInstance (); |
// |
current.nameSpaceName = nameSpaceNames [i]; |
// CIMNamedInstances returned from repository do not |
matchingSubscriptions.append (current); |
// include namespace |
|
// Set namespace here |
|
// |
|
CIMReference instanceName = |
|
subscriptions [j].getInstanceName (); |
|
instanceName.setNameSpace (nameSpaceNames [i]); |
|
CIMNamedInstance currentInstance |
|
(instanceName, subscriptions [j].getInstance ()); |
|
matchingSubscriptions.append (currentInstance); |
} | } |
|
|
} // if subscription includes target class | } // if subscription includes target class |
} // if subscription is enabled | } // if subscription is enabled |
} // for each subscription | } // for each subscription |
|
|
const String & targetClass, | const String & targetClass, |
const CIMPropertyList & newProperties, | const CIMPropertyList & newProperties, |
const CIMPropertyList & oldProperties, | const CIMPropertyList & oldProperties, |
Array <struct SubscriptionRef> & newSubscriptions, |
Array <CIMNamedInstance> & newSubscriptions, |
Array <struct SubscriptionRef> & formerSubscriptions) |
Array <CIMNamedInstance> & formerSubscriptions) |
{ | { |
Array <String> nameSpaceNames; | Array <String> nameSpaceNames; |
Array <CIMNamedInstance> subscriptions; | Array <CIMNamedInstance> subscriptions; |
CIMValue subscriptionStateValue; | CIMValue subscriptionStateValue; |
Uint16 subscriptionState; | Uint16 subscriptionState; |
String filterQuery; |
|
WQLSelectStatement selectStatement; |
|
String indicationClassName; |
|
Array <String> indicationSubclasses; |
|
CIMPropertyList propertyList; |
|
Boolean newMatch; |
|
Boolean formerMatch; |
|
struct SubscriptionRef current; |
|
| |
const char METHOD_NAME [] = | const char METHOD_NAME [] = |
"IndicationService::_getModifiedSubscriptions"; | "IndicationService::_getModifiedSubscriptions"; |
|
|
if ((subscriptionState == _STATE_ENABLED) || | if ((subscriptionState == _STATE_ENABLED) || |
(subscriptionState == _STATE_ENABLEDDEGRADED)) | (subscriptionState == _STATE_ENABLEDDEGRADED)) |
{ | { |
|
String filterQuery; |
|
WQLSelectStatement selectStatement; |
|
String indicationClassName; |
|
Array <String> indicationSubclasses; |
|
CIMPropertyList propertyList; |
|
Boolean newMatch; |
|
Boolean formerMatch; |
|
|
// | // |
// Get filter query | // Get filter query |
// | // |
|
|
} | } |
| |
// | // |
// Add current subscription ref to appropriate list |
// Add current subscription to appropriate list |
// | // |
if (newMatch && !formerMatch) | if (newMatch && !formerMatch) |
{ | { |
current.subscription = subscriptions [j].getInstance (); |
// |
current.nameSpaceName = nameSpaceNames [i]; |
// CIMNamedInstances returned from repository do not |
newSubscriptions.append (current); |
// include namespace |
|
// Set namespace here |
|
// |
|
CIMReference instanceName = |
|
subscriptions [j].getInstanceName (); |
|
instanceName.setNameSpace (nameSpaceNames [i]); |
|
CIMNamedInstance currentInstance |
|
(instanceName, subscriptions [j].getInstance ()); |
|
newSubscriptions.append (currentInstance); |
} | } |
else if (!newMatch && formerMatch) | else if (!newMatch && formerMatch) |
{ | { |
current.subscription = subscriptions [j].getInstance (); |
// |
current.nameSpaceName = nameSpaceNames [i]; |
// CIMNamedInstances returned from repository do not |
formerSubscriptions.append (current); |
// include namespace |
|
// Set namespace here |
|
// |
|
CIMReference instanceName = |
|
subscriptions [j].getInstanceName (); |
|
instanceName.setNameSpace (nameSpaceNames [i]); |
|
CIMNamedInstance currentInstance |
|
(instanceName, subscriptions [j].getInstance ()); |
|
formerSubscriptions.append (currentInstance); |
} | } |
|
|
} // if subscription includes target class | } // if subscription includes target class |
} // if subscription is enabled | } // if subscription is enabled |
} // for each subscription | } // for each subscription |
|
|
PEG_FUNC_EXIT (TRC_INDICATION_SERVICE, METHOD_NAME); | PEG_FUNC_EXIT (TRC_INDICATION_SERVICE, METHOD_NAME); |
} | } |
| |
Array <SubscriptionRef> IndicationService::_getProviderSubscriptions ( |
Array <CIMNamedInstance> IndicationService::_getProviderSubscriptions ( |
const CIMReference & providerReference) | const CIMReference & providerReference) |
{ | { |
Array <SubscriptionRef> providerSubscriptions; |
Array <CIMNamedInstance> providerSubscriptions; |
Array <String> propertyNames; | Array <String> propertyNames; |
Array <String> nameSpaceNames; | Array <String> nameSpaceNames; |
//Array <CIMNamedInstance> providerCapabilities; | //Array <CIMNamedInstance> providerCapabilities; |
|
|
} | } |
| |
| |
struct HandlerRef IndicationService::_getHandlerRef ( |
CIMNamedInstance IndicationService::_getHandler ( |
const struct SubscriptionRef & subscriptionRef) const |
const CIMNamedInstance & subscription) const |
{ | { |
CIMValue handlerValue; | CIMValue handlerValue; |
CIMReference handlerRef; | CIMReference handlerRef; |
CIMInstance handlerInstance; | CIMInstance handlerInstance; |
struct HandlerRef handler; |
const char METHOD_NAME [] = "IndicationService::_getHandler"; |
const char METHOD_NAME [] = "IndicationService::_getHandlerRef"; |
|
| |
PEG_FUNC_ENTER (TRC_INDICATION_SERVICE, METHOD_NAME); | PEG_FUNC_ENTER (TRC_INDICATION_SERVICE, METHOD_NAME); |
| |
// | // |
// Get Handler reference from subscription instance | // Get Handler reference from subscription instance |
// | // |
handlerValue = subscriptionRef.subscription.getProperty |
handlerValue = subscription.getInstance ().getProperty |
(subscriptionRef.subscription.findProperty |
(subscription.getInstance ().findProperty |
(_PROPERTY_HANDLER)).getValue (); | (_PROPERTY_HANDLER)).getValue (); |
| |
handlerValue.get (handlerRef); | handlerValue.get (handlerRef); |
|
|
// Get Handler instance from the repository | // Get Handler instance from the repository |
// | // |
handlerInstance = _repository->getInstance | handlerInstance = _repository->getInstance |
(subscriptionRef.nameSpaceName, handlerRef); |
(subscription.getInstanceName ().getNameSpace (), handlerRef); |
| |
handler.handler = handlerInstance; |
// |
handler.nameSpaceName = subscriptionRef.nameSpaceName; |
// Set namespace and create CIMNamedInstance |
|
// |
|
handlerRef.setNameSpace |
|
(subscription.getInstanceName ().getNameSpace ()); |
|
CIMNamedInstance handlerNamedInstance (handlerRef, handlerInstance); |
| |
PEG_FUNC_EXIT (TRC_INDICATION_SERVICE, METHOD_NAME); | PEG_FUNC_EXIT (TRC_INDICATION_SERVICE, METHOD_NAME); |
return (handler); |
return (handlerNamedInstance); |
} | } |
| |
Boolean IndicationService::_isTransient ( | Boolean IndicationService::_isTransient ( |
|
|
Uint64 duration; | Uint64 duration; |
durationValue = instance.getProperty | durationValue = instance.getProperty |
(instance.findProperty (_PROPERTY_DURATION)).getValue (); | (instance.findProperty (_PROPERTY_DURATION)).getValue (); |
|
if (durationValue.isNull ()) |
|
{ |
|
// |
|
// If there is no duration value set, the subscription has no |
|
// expiration date |
|
// |
|
return false; |
|
} |
|
else |
|
{ |
durationValue.get (duration); | durationValue.get (duration); |
|
} |
| |
// | // |
// Get current date time, and determine if subscription has expired | // Get current date time, and determine if subscription has expired |
|
|
else | else |
{ | { |
PEG_FUNC_EXIT (TRC_INDICATION_SERVICE, METHOD_NAME); | PEG_FUNC_EXIT (TRC_INDICATION_SERVICE, METHOD_NAME); |
return false /* true */; |
return true; |
} | } |
} | } |
| |
|
|
| |
CIMInstance IndicationService::_createAlertInstance ( | CIMInstance IndicationService::_createAlertInstance ( |
const String & alertClassName, | const String & alertClassName, |
const Array <struct SubscriptionRef> & subscriptionRefs) |
const Array <CIMNamedInstance> & subscriptions) |
{ | { |
const char METHOD_NAME [] = "IndicationService::_createAlertInstance"; | const char METHOD_NAME [] = "IndicationService::_createAlertInstance"; |
| |
|
|
// ATTN: update once alert classes have been defined | // ATTN: update once alert classes have been defined |
// NB: for _CLASS_NO_PROVIDER_ALERT and _CLASS_PROVIDER_TERMINATED_ALERT, | // NB: for _CLASS_NO_PROVIDER_ALERT and _CLASS_PROVIDER_TERMINATED_ALERT, |
// one of the properties will be a list of affected subscriptions | // one of the properties will be a list of affected subscriptions |
// It is for that reason that subscriptionRefs is passed in as a parameter |
// It is for that reason that subscriptions is passed in as a parameter |
// | // |
if (alertClassName == _CLASS_CIMOM_SHUTDOWN_ALERT) | if (alertClassName == _CLASS_CIMOM_SHUTDOWN_ALERT) |
{ | { |
|
|
} | } |
| |
void IndicationService::_sendAlerts ( | void IndicationService::_sendAlerts ( |
const Array <struct SubscriptionRef> & subscriptionRefs, |
const Array <CIMNamedInstance> & subscriptions, |
/* const */ CIMInstance & alertInstance) | /* const */ CIMInstance & alertInstance) |
{ | { |
struct HandlerRef current; |
CIMNamedInstance current; |
Boolean duplicate; | Boolean duplicate; |
Array <struct HandlerRef> handlers; |
Array <CIMNamedInstance> handlers; |
const char METHOD_NAME [] = "IndicationService::_sendAlerts"; | const char METHOD_NAME [] = "IndicationService::_sendAlerts"; |
| |
PEG_FUNC_ENTER (TRC_INDICATION_SERVICE, METHOD_NAME); | PEG_FUNC_ENTER (TRC_INDICATION_SERVICE, METHOD_NAME); |
|
|
// | // |
// Get list of unique handler instances for all subscriptions in list | // Get list of unique handler instances for all subscriptions in list |
// | // |
for (Uint8 i = 0; i < subscriptionRefs.size (); i++) |
for (Uint8 i = 0; i < subscriptions.size (); i++) |
{ | { |
// | // |
// Get handler instance | // Get handler instance |
// | // |
current = _getHandlerRef (subscriptionRefs [i]); |
current = _getHandler (subscriptions [i]); |
| |
// | // |
// Merge into list of unique handler instances | // Merge into list of unique handler instances |
|
|
duplicate = false; | duplicate = false; |
for (Uint8 j = 0; j < handlers.size () && !duplicate; j++) | for (Uint8 j = 0; j < handlers.size () && !duplicate; j++) |
{ | { |
if ((current.handler == handlers [j].handler) && |
if ((current.getInstance () == handlers [j].getInstance ()) && |
(current.nameSpaceName == handlers [j].nameSpaceName)) |
(current.getInstanceName () == handlers [j].getInstanceName ())) |
{ | { |
duplicate = true; | duplicate = true; |
} | } |
|
|
CIMHandleIndicationRequestMessage * handler_request = | CIMHandleIndicationRequestMessage * handler_request = |
new CIMHandleIndicationRequestMessage ( | new CIMHandleIndicationRequestMessage ( |
XmlWriter::getNextMessageId (), | XmlWriter::getNextMessageId (), |
handlers [k].nameSpaceName, |
handlers [k].getInstanceName ().getNameSpace (), |
handlers [k].handler, |
handlers [k].getInstance (), |
alertInstance, | alertInstance, |
QueueIdStack (_handlerService, getQueueId ())); | QueueIdStack (_handlerService, getQueueId ())); |
| |
|
|
The name of the SNMP Indication Handler class | The name of the SNMP Indication Handler class |
*/ | */ |
const char IndicationService::_CLASS_HANDLERSNMP [] = | const char IndicationService::_CLASS_HANDLERSNMP [] = |
"PG_IndicationHandlerSNMP"; |
"PG_IndicationHandlerSNMPMapper"; |
| |
/** | /** |
The name of the Indication class | The name of the Indication class |
|
|
"OtherPersistenceType"; | "OtherPersistenceType"; |
| |
/** | /** |
The name of the Destination property for Indication Handler subclasses |
The name of the Destination property for CIM XML Indication Handler |
|
subclass |
*/ | */ |
const char IndicationService::_PROPERTY_DESTINATION [] = "Destination"; | const char IndicationService::_PROPERTY_DESTINATION [] = "Destination"; |
| |
/** | /** |
|
The name of the Trap Destination property for SNMP Mapper Indication |
|
Handler subclass |
|
*/ |
|
const char IndicationService::_PROPERTY_TRAPDESTINATION [] = |
|
"TrapDestination"; |
|
|
|
/** |
The name of the SNMP Type property for SNMP Indication Handler class | The name of the SNMP Type property for SNMP Indication Handler class |
*/ | */ |
const char IndicationService::_PROPERTY_SNMPTYPE [] = "snmpType"; |
const char IndicationService::_PROPERTY_SNMPTYPE [] = "SNMPVersion"; |
| |
/** | /** |
The name of the Alert Type property for Alert Indication class | The name of the Alert Type property for Alert Indication class |