version 1.13, 2002/03/15 18:32:55
|
version 1.14, 2002/03/21 18:49:58
|
|
|
#include <Pegasus/Common/XmlWriter.h> | #include <Pegasus/Common/XmlWriter.h> |
#include <Pegasus/Repository/CIMRepository.h> | #include <Pegasus/Repository/CIMRepository.h> |
#include <Pegasus/Provider/OperationFlag.h> | #include <Pegasus/Provider/OperationFlag.h> |
#include <Pegasus/Server/CIMOperationRequestDispatcher.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> |
|
|
| |
IndicationService::IndicationService ( | IndicationService::IndicationService ( |
CIMRepository * repository, | CIMRepository * repository, |
CIMServer * server) |
ProviderRegistrationManager * providerRegManager) |
: Base ("Server::IndicationService", MessageQueue::getNextQueueId ()), | : Base ("Server::IndicationService", MessageQueue::getNextQueueId ()), |
_repository (repository), | _repository (repository), |
_server (server) |
_providerRegManager (providerRegManager) |
{ | { |
// | // |
// ATTN: This call to _initialize is here temporarily -- in future, it | // ATTN: This call to _initialize is here temporarily -- in future, it |
|
|
// | // |
| |
// | // |
// Get handle to Provider Registration Manager |
|
// |
|
_providerRegManager = |
|
_server->getDispatcher ()->getProviderRegistrationManager (); |
|
|
|
// |
|
// Make sure subscription classes include Creator property | // Make sure subscription classes include Creator property |
// | // |
_checkClasses (); | _checkClasses (); |
|
|
_sendEnableRequests (indicationProviders, | _sendEnableRequests (indicationProviders, |
activeSubscriptions [i].getInstanceName ().getNameSpace (), | activeSubscriptions [i].getInstanceName ().getNameSpace (), |
propertyList, condition, queryLanguage, | propertyList, condition, queryLanguage, |
activeSubscriptions [i].getInstance ()); |
activeSubscriptions [i]); |
| |
// | // |
// Merge provider list into list of unique providers to start | // Merge provider list into list of unique providers to start |
|
|
// | // |
_sendEnableRequests (indicationProviders, | _sendEnableRequests (indicationProviders, |
request->nameSpace, requiredProperties, condition, | request->nameSpace, requiredProperties, condition, |
queryLanguage, instance); |
queryLanguage, |
|
CIMNamedInstance (instanceRef, instance)); |
| |
// | // |
// Send start message to each provider | // Send start message to each provider |
|
|
{ | { |
_sendEnableRequests (indicationProviders, | _sendEnableRequests (indicationProviders, |
request->nameSpace, requiredProperties, condition, | request->nameSpace, requiredProperties, condition, |
queryLanguage, instance); |
queryLanguage, |
|
CIMNamedInstance (instanceReference, instance)); |
| |
// | // |
// Send start message to each provider | // Send start message to each provider |
|
|
if (indicationProviders.size () > 0) | if (indicationProviders.size () > 0) |
{ | { |
_sendDisableRequests (indicationProviders, | _sendDisableRequests (indicationProviders, |
request->nameSpace, instance); |
request->nameSpace, |
|
CIMNamedInstance (instanceReference, instance)); |
} | } |
} | } |
} | } |
|
|
// instance | // instance |
// | // |
String currentUser = request->userName; | String currentUser = request->userName; |
//cout << "creator: " << creator << endl; |
|
//cout << "currentUser: " << currentUser << endl; |
|
//cout << "System::isPrivilegedUser (currentUser): " << |
|
//System::isPrivilegedUser (currentUser) << endl; |
|
if ((creator != String::EMPTY) && | if ((creator != String::EMPTY) && |
(!System::isPrivilegedUser (currentUser)) && | (!System::isPrivilegedUser (currentUser)) && |
(currentUser != creator)) | (currentUser != creator)) |
|
|
// Send disable requests | // Send disable requests |
// | // |
_sendDisableRequests (indicationProviders, | _sendDisableRequests (indicationProviders, |
request->nameSpace, subscriptionInstance); |
request->nameSpace, CIMNamedInstance |
|
(request->instanceName, subscriptionInstance)); |
} | } |
| |
// | // |
|
|
_sendEnableRequests (indicationProviders, | _sendEnableRequests (indicationProviders, |
newSubscriptions [i].getInstanceName ().getNameSpace (), | newSubscriptions [i].getInstanceName ().getNameSpace (), |
requiredProperties, condition, queryLanguage, | requiredProperties, condition, queryLanguage, |
newSubscriptions [i].getInstance ()); |
newSubscriptions [i]); |
| |
// | // |
// Send start message to each provider | // Send start message to each provider |
|
|
{ | { |
_sendDisableRequests (indicationProviders, | _sendDisableRequests (indicationProviders, |
formerSubscriptions [i].getInstanceName ().getNameSpace (), | formerSubscriptions [i].getInstanceName ().getNameSpace (), |
formerSubscriptions [i].getInstance ()); |
formerSubscriptions [i]); |
} | } |
| |
// | // |
|
|
if (!instance.existsProperty (_PROPERTY_SYSTEMNAME)) | if (!instance.existsProperty (_PROPERTY_SYSTEMNAME)) |
{ | { |
instance.addProperty (CIMProperty (_PROPERTY_SYSTEMNAME, | instance.addProperty (CIMProperty (_PROPERTY_SYSTEMNAME, |
System::getHostName ())); |
System::getFullyQualifiedHostName ())); |
} | } |
| |
if (!instance.existsProperty (_PROPERTY_SYSTEMCREATIONCLASSNAME)) | if (!instance.existsProperty (_PROPERTY_SYSTEMCREATIONCLASSNAME)) |
|
|
// | // |
instance.addProperty (CIMProperty | instance.addProperty (CIMProperty |
(_PROPERTY_SYSTEMCREATIONCLASSNAME, | (_PROPERTY_SYSTEMCREATIONCLASSNAME, |
"CIM_UnitaryComputerSystem")); |
System::getSystemCreationClassName ())); |
} | } |
| |
if (instance.getClassName () == _CLASS_FILTER) | if (instance.getClassName () == _CLASS_FILTER) |
|
|
// instance | // instance |
// | // |
String currentUser = request->userName; | String currentUser = request->userName; |
//cout << "creator: " << creator << endl; |
|
//cout << "currentUser: " << currentUser << endl; |
|
//cout << "System::isPrivilegedUser (currentUser): " << |
|
//System::isPrivilegedUser (currentUser) << endl; |
|
if ((creator != String::EMPTY) && | if ((creator != String::EMPTY) && |
(!System::isPrivilegedUser (currentUser)) && | (!System::isPrivilegedUser (currentUser)) && |
(currentUser != creator)) | (currentUser != creator)) |
|
|
return (filterQuery); | return (filterQuery); |
} | } |
| |
|
String IndicationService::_getSourceNameSpace ( |
|
const CIMInstance & subscription, |
|
const String & nameSpaceName) const |
|
{ |
|
CIMValue filterValue; |
|
CIMReference filterReference; |
|
CIMInstance filterInstance; |
|
String sourceNameSpace; |
|
|
|
const char METHOD_NAME [] = "IndicationService::_getSourceNameSpace"; |
|
|
|
PEG_FUNC_ENTER (TRC_INDICATION_SERVICE, METHOD_NAME); |
|
|
|
filterValue = subscription.getProperty (subscription.findProperty |
|
(_PROPERTY_FILTER)).getValue (); |
|
|
|
filterValue.get (filterReference); |
|
|
|
filterInstance = _repository->getInstance (nameSpaceName, filterReference); |
|
|
|
sourceNameSpace = filterInstance.getProperty (filterInstance.findProperty |
|
(_PROPERTY_SOURCENAMESPACE)).getValue ().toString (); |
|
|
|
PEG_FUNC_EXIT (TRC_INDICATION_SERVICE, METHOD_NAME); |
|
return (sourceNameSpace); |
|
} |
|
|
String IndicationService::_getFilterQueryLanguage ( | String IndicationService::_getFilterQueryLanguage ( |
const CIMInstance & subscription, | const CIMInstance & subscription, |
const String & nameSpaceName) const | const String & nameSpaceName) const |
|
|
const Array <String> & indicationSubclasses, | const Array <String> & indicationSubclasses, |
const CIMPropertyList & requiredPropertyList) const | const CIMPropertyList & requiredPropertyList) const |
{ | { |
Array <String> requiredProperties; |
|
struct ProviderClassList provider; | struct ProviderClassList provider; |
Array <struct ProviderClassList> indicationProviders; | Array <struct ProviderClassList> indicationProviders; |
Array <CIMInstance> providerInstances; | Array <CIMInstance> providerInstances; |
|
|
PEG_FUNC_ENTER (TRC_INDICATION_SERVICE, METHOD_NAME); | PEG_FUNC_ENTER (TRC_INDICATION_SERVICE, METHOD_NAME); |
| |
// | // |
// If all properties are required, must pass empty array |
|
// |
|
if (requiredPropertyList.isNull ()) |
|
{ |
|
requiredProperties.clear (); |
|
} |
|
else |
|
{ |
|
requiredProperties = requiredPropertyList.getPropertyNameArray (); |
|
} |
|
|
|
// |
|
// For each indication subclass, get providers | // For each indication subclass, get providers |
// | // |
for (Uint8 i = 0; i < indicationSubclasses.size (); i++) | for (Uint8 i = 0; i < indicationSubclasses.size (); i++) |
|
|
if (_providerRegManager->getIndicationProviders | if (_providerRegManager->getIndicationProviders |
(nameSpace, | (nameSpace, |
indicationSubclasses [i], | indicationSubclasses [i], |
requiredProperties, |
requiredPropertyList, |
providerInstances, | providerInstances, |
providerModuleInstances)) | providerModuleInstances)) |
{ | { |
|
|
} | } |
} | } |
| |
|
// |
|
// ATTN: Check if list includes all properties? |
|
// |
|
|
PEG_FUNC_EXIT (TRC_INDICATION_SERVICE, METHOD_NAME); | PEG_FUNC_EXIT (TRC_INDICATION_SERVICE, METHOD_NAME); |
return (CIMPropertyList (propertyList)); | return (CIMPropertyList (propertyList)); |
} | } |
|
|
// Send disable requests | // Send disable requests |
// | // |
_sendDisableRequests (indicationProviders, nameSpace, | _sendDisableRequests (indicationProviders, nameSpace, |
subscriptions [i].getInstance ()); |
subscriptions [i]); |
| |
// | // |
// Delete referencing subscription instance from repository | // Delete referencing subscription instance from repository |
|
|
WQLSelectStatement selectStatement; | WQLSelectStatement selectStatement; |
String indicationClassName; | String indicationClassName; |
Array <String> indicationSubclasses; | Array <String> indicationSubclasses; |
|
String sourceNameSpace; |
condition = String::EMPTY; | condition = String::EMPTY; |
queryLanguage = String::EMPTY; | queryLanguage = String::EMPTY; |
const char METHOD_NAME [] = "IndicationService::_getEnableParams"; | const char METHOD_NAME [] = "IndicationService::_getEnableParams"; |
|
|
} | } |
| |
// | // |
|
// Get filter source namespace |
|
// |
|
sourceNameSpace = _getSourceNameSpace (subscriptionInstance, nameSpaceName); |
|
|
|
// |
// Get indication provider class lists | // Get indication provider class lists |
// | // |
indicationProviders = _getIndicationProviders | indicationProviders = _getIndicationProviders |
(nameSpaceName, indicationClassName, indicationSubclasses, |
(sourceNameSpace, indicationClassName, indicationSubclasses, |
propertyList); | propertyList); |
//cout << "Indication Providers to enable: " << indicationProviders.size () | //cout << "Indication Providers to enable: " << indicationProviders.size () |
//<< endl; | //<< endl; |
|
|
const CIMInstance & subscriptionInstance) | const CIMInstance & subscriptionInstance) |
{ | { |
String filterQuery; | String filterQuery; |
|
String sourceNameSpace; |
WQLSelectStatement selectStatement; | WQLSelectStatement selectStatement; |
String indicationClassName; | String indicationClassName; |
Array <String> indicationSubclasses; | Array <String> indicationSubclasses; |
|
|
} | } |
| |
// | // |
|
// Get filter source namespace |
|
// |
|
sourceNameSpace = _getSourceNameSpace (subscriptionInstance, nameSpaceName); |
|
|
|
// |
// Get indication provider class lists | // Get indication provider class lists |
// | // |
indicationProviders = _getIndicationProviders | indicationProviders = _getIndicationProviders |
(nameSpaceName, indicationClassName, indicationSubclasses, |
(sourceNameSpace, indicationClassName, indicationSubclasses, |
propertyList); | propertyList); |
//cout << "Indication Providers to disable: " << indicationProviders.size () | //cout << "Indication Providers to disable: " << indicationProviders.size () |
//<< endl; | //<< endl; |
|
|
const CIMPropertyList & propertyList, | const CIMPropertyList & propertyList, |
const String & condition, | const String & condition, |
const String & queryLanguage, | const String & queryLanguage, |
const CIMInstance & subscription) |
const CIMNamedInstance & subscription) |
{ | { |
CIMValue propValue; | CIMValue propValue; |
Uint16 repeatNotificationPolicy; | Uint16 repeatNotificationPolicy; |
String otherRepeatNotificationPolicy; |
|
CIMDateTime repeatNotificationInterval; |
|
CIMDateTime repeatNotificationGap; |
|
Uint16 repeatNotificationCount; |
|
const char METHOD_NAME [] = "IndicationService::_sendEnableRequests"; | const char METHOD_NAME [] = "IndicationService::_sendEnableRequests"; |
| |
PEG_FUNC_ENTER (TRC_INDICATION_SERVICE, METHOD_NAME); | PEG_FUNC_ENTER (TRC_INDICATION_SERVICE, METHOD_NAME); |
| |
// | // |
// Get thresholding parameter values from subscription instance |
// Get repeat notification policy value from subscription instance |
// | // |
|
propValue = subscription.getInstance ().getProperty |
propValue = subscription.getProperty (subscription.findProperty |
(subscription.getInstance ().findProperty |
(_PROPERTY_REPEATNOTIFICATIONPOLICY)).getValue (); | (_PROPERTY_REPEATNOTIFICATIONPOLICY)).getValue (); |
propValue.get (repeatNotificationPolicy); | propValue.get (repeatNotificationPolicy); |
if ((repeatNotificationPolicy != _POLICY_UNKNOWN) && |
|
(repeatNotificationPolicy != _POLICY_NONE)) |
|
{ |
|
propValue = subscription.getProperty (subscription.findProperty |
|
(_PROPERTY_REPEATNOTIFICATIONINTERVAL)).getValue (); |
|
propValue.get (repeatNotificationInterval); |
|
propValue = subscription.getProperty (subscription.findProperty |
|
(_PROPERTY_REPEATNOTIFICATIONGAP)).getValue (); |
|
propValue.get (repeatNotificationGap); |
|
propValue = subscription.getProperty (subscription.findProperty |
|
(_PROPERTY_REPEATNOTIFICATIONCOUNT)).getValue (); |
|
propValue.get (repeatNotificationCount); |
|
|
|
// |
|
// ATTN: Threshold parameter values must go into Operation Context |
|
// |
|
} |
|
if (repeatNotificationPolicy == _POLICY_OTHER) |
|
{ |
|
propValue = subscription.getProperty (subscription.findProperty |
|
(_PROPERTY_OTHERREPEATNOTIFICATIONPOLICY)).getValue (); |
|
propValue.get (otherRepeatNotificationPolicy); |
|
|
|
// |
|
// ATTN: Threshold parameter values must go into Operation Context |
|
// |
|
} |
|
| |
// | // |
// Send enable request to each provider | // Send enable request to each provider |
|
|
indicationProviders [i].providerModule, | indicationProviders [i].providerModule, |
propertyList, | propertyList, |
repeatNotificationPolicy, | repeatNotificationPolicy, |
otherRepeatNotificationPolicy, |
|
repeatNotificationInterval, |
|
repeatNotificationGap, |
|
repeatNotificationCount, |
|
condition, | condition, |
queryLanguage, | queryLanguage, |
subscription, | subscription, |
|
|
const CIMPropertyList & propertyList, | const CIMPropertyList & propertyList, |
const String & condition, | const String & condition, |
const String & queryLanguage, | const String & queryLanguage, |
const CIMInstance & subscription) |
const CIMNamedInstance & subscription) |
{ | { |
CIMValue propValue; | CIMValue propValue; |
Uint16 repeatNotificationPolicy; | Uint16 repeatNotificationPolicy; |
String otherRepeatNotificationPolicy; |
|
CIMDateTime repeatNotificationInterval; |
|
CIMDateTime repeatNotificationGap; |
|
Uint16 repeatNotificationCount; |
|
const char METHOD_NAME [] = "IndicationService::_sendModifyRequests"; | const char METHOD_NAME [] = "IndicationService::_sendModifyRequests"; |
| |
PEG_FUNC_ENTER (TRC_INDICATION_SERVICE, METHOD_NAME); | PEG_FUNC_ENTER (TRC_INDICATION_SERVICE, METHOD_NAME); |
| |
// | // |
// Get thresholding parameter values from subscription instance |
// Get repeat notification policy value from subscription instance |
// | // |
propValue = subscription.getProperty (subscription.findProperty |
propValue = subscription.getInstance ().getProperty |
|
(subscription.getInstance ().findProperty |
(_PROPERTY_REPEATNOTIFICATIONPOLICY)).getValue (); | (_PROPERTY_REPEATNOTIFICATIONPOLICY)).getValue (); |
propValue.get (repeatNotificationPolicy); | propValue.get (repeatNotificationPolicy); |
if ((repeatNotificationPolicy != _POLICY_UNKNOWN) && |
|
(repeatNotificationPolicy != _POLICY_NONE)) |
|
{ |
|
propValue = subscription.getProperty (subscription.findProperty |
|
(_PROPERTY_REPEATNOTIFICATIONINTERVAL)).getValue (); |
|
propValue.get (repeatNotificationInterval); |
|
propValue = subscription.getProperty (subscription.findProperty |
|
(_PROPERTY_REPEATNOTIFICATIONGAP)).getValue (); |
|
propValue.get (repeatNotificationGap); |
|
propValue = subscription.getProperty (subscription.findProperty |
|
(_PROPERTY_REPEATNOTIFICATIONCOUNT)).getValue (); |
|
propValue.get (repeatNotificationCount); |
|
|
|
// |
|
// ATTN: Threshold parameter values must go into Operation Context |
|
// |
|
} |
|
if (repeatNotificationPolicy == _POLICY_OTHER) |
|
{ |
|
propValue = subscription.getProperty (subscription.findProperty |
|
(_PROPERTY_OTHERREPEATNOTIFICATIONPOLICY)).getValue (); |
|
propValue.get (otherRepeatNotificationPolicy); |
|
|
|
// |
|
// ATTN: Threshold parameter values must go into Operation Context |
|
// |
|
} |
|
| |
// | // |
// Send modify request to each provider | // Send modify request to each provider |
|
|
indicationProviders [i].providerModule, | indicationProviders [i].providerModule, |
propertyList, | propertyList, |
repeatNotificationPolicy, | repeatNotificationPolicy, |
otherRepeatNotificationPolicy, |
|
repeatNotificationInterval, |
|
repeatNotificationGap, |
|
repeatNotificationCount, |
|
condition, | condition, |
queryLanguage, | queryLanguage, |
subscription, | subscription, |
|
|
void IndicationService::_sendDisableRequests | void IndicationService::_sendDisableRequests |
(const Array <struct ProviderClassList> & indicationProviders, | (const Array <struct ProviderClassList> & indicationProviders, |
const String & nameSpace, | const String & nameSpace, |
const CIMInstance & subscription) |
const CIMNamedInstance & subscription) |
{ | { |
const char METHOD_NAME [] = "IndicationService::_sendDisableRequests"; | const char METHOD_NAME [] = "IndicationService::_sendDisableRequests"; |
| |