version 1.14, 2002/03/21 18:49:58
|
version 1.15, 2002/03/27 19:05:28
|
|
|
break; | break; |
| |
default: | default: |
// do nothing, unsupported message? |
// |
|
// A message type not supported by the Indication Service |
|
// ATTN-CAKG-P2-20020326: Should a CIM_ERR_NOT_SUPPORTED |
|
// response be returned?? |
|
// |
break; | break; |
} | } |
| |
|
|
| |
// | // |
// Make sure subscription classes include Creator property | // Make sure subscription classes include Creator property |
|
// ATTN-CAKG-P1-20020325: To Be Removed -- the repository is to be |
|
// modified to allow addition of property to an instance, without adding |
|
// property to the class |
// | // |
_checkClasses (); | _checkClasses (); |
| |
|
|
(_PROPERTY_DURATION)) && | (_PROPERTY_DURATION)) && |
(_isExpired (activeSubscriptions [i].getInstance ()))) | (_isExpired (activeSubscriptions [i].getInstance ()))) |
{ | { |
CIMClass subscriptionClass = _repository->getClass |
|
(activeSubscriptions [i].getInstanceName ().getNameSpace (), |
|
_CLASS_SUBSCRIPTION); |
|
|
|
_deleteExpiredSubscription | _deleteExpiredSubscription |
(activeSubscriptions [i].getInstanceName ().getNameSpace (), | (activeSubscriptions [i].getInstanceName ().getNameSpace (), |
activeSubscriptions [i].getInstanceName ()); | activeSubscriptions [i].getInstanceName ()); |
|
|
| |
// | // |
// Send enable request message to each provider | // Send enable request message to each provider |
|
// ATTN-CAKG-P3-20020315: These enable requests are not associated |
|
// with a user request, so there is no associated authType or userName |
|
// The Creator from the subscription instance is used for userName, |
|
// and authType is not set |
// | // |
_sendEnableRequests (indicationProviders, |
CIMInstance instance = activeSubscriptions [i].getInstance (); |
|
String creator = instance.getProperty (instance.findProperty |
|
(_PROPERTY_CREATOR)).getValue ().toString (); |
|
if (!_sendEnableRequests (indicationProviders, |
activeSubscriptions [i].getInstanceName ().getNameSpace (), | activeSubscriptions [i].getInstanceName ().getNameSpace (), |
propertyList, condition, queryLanguage, | propertyList, condition, queryLanguage, |
activeSubscriptions [i]); |
activeSubscriptions [i], creator)) |
|
{ |
|
noProviderSubscriptions.append (activeSubscriptions [i]); |
|
continue; |
|
} |
| |
// | // |
// Merge provider list into list of unique providers to start | // Merge provider list into list of unique providers to start |
|
|
{ | { |
// | // |
// If the property does not exist, add it to the class | // If the property does not exist, add it to the class |
|
// ATTN: To Be Removed -- the repository is to be modified to |
|
// allow addition of property to an instance, without adding |
|
// property to class |
// | // |
CIMClass theClass = _repository->getClass | CIMClass theClass = _repository->getClass |
(request->nameSpace, instance.getClassName ()); | (request->nameSpace, instance.getClassName ()); |
|
|
// | // |
// Send enable request message to each provider | // Send enable request message to each provider |
// | // |
_sendEnableRequests (indicationProviders, |
if (!_sendEnableRequests (indicationProviders, |
request->nameSpace, requiredProperties, condition, | request->nameSpace, requiredProperties, condition, |
queryLanguage, | queryLanguage, |
CIMNamedInstance (instanceRef, instance)); |
CIMNamedInstance (instanceRef, instance), |
|
request->userName, request->authType)) |
|
{ |
|
PEG_FUNC_EXIT (TRC_INDICATION_SERVICE, METHOD_NAME); |
|
throw PEGASUS_CIM_EXCEPTION (CIM_ERR_NOT_SUPPORTED, |
|
_MSG_NOT_ACCEPTED); |
|
} |
| |
// | // |
// Send start message to each provider | // Send start message to each provider |
|
|
throw PEGASUS_CIM_EXCEPTION (CIM_ERR_FAILED, exceptionStr); | throw PEGASUS_CIM_EXCEPTION (CIM_ERR_FAILED, exceptionStr); |
} | } |
| |
|
// |
|
// _canModify, above, already checked that propertyList is not |
|
// null, and that numProperties is 0 or 1 |
|
// |
if (request->propertyList.getNumProperties () > 0) | if (request->propertyList.getNumProperties () > 0) |
{ | { |
// | // |
|
|
&& ((currentState != _STATE_ENABLED) && | && ((currentState != _STATE_ENABLED) && |
(currentState != _STATE_ENABLEDDEGRADED))) | (currentState != _STATE_ENABLEDDEGRADED))) |
{ | { |
_sendEnableRequests (indicationProviders, |
if (!_sendEnableRequests (indicationProviders, |
request->nameSpace, requiredProperties, condition, | request->nameSpace, requiredProperties, condition, |
queryLanguage, | queryLanguage, |
CIMNamedInstance (instanceReference, instance)); |
CIMNamedInstance (instanceReference, instance), |
|
request->userName, request->authType)) |
|
{ |
|
PEG_FUNC_EXIT (TRC_INDICATION_SERVICE, METHOD_NAME); |
|
throw PEGASUS_CIM_EXCEPTION (CIM_ERR_NOT_SUPPORTED, |
|
_MSG_NOT_ACCEPTED); |
|
} |
| |
// | // |
// Send start message to each provider | // Send start message to each provider |
|
|
{ | { |
_sendDisableRequests (indicationProviders, | _sendDisableRequests (indicationProviders, |
request->nameSpace, | request->nameSpace, |
CIMNamedInstance (instanceReference, instance)); |
CIMNamedInstance (instanceReference, instance), |
|
request->userName, request->authType); |
} | } |
} | } |
} | } |
|
|
// | // |
_sendDisableRequests (indicationProviders, | _sendDisableRequests (indicationProviders, |
request->nameSpace, CIMNamedInstance | request->nameSpace, CIMNamedInstance |
(request->instanceName, subscriptionInstance)); |
(request->instanceName, subscriptionInstance), |
|
request->userName, request->authType); |
} | } |
| |
// | // |
|
|
} | } |
else | else |
{ | { |
|
String exceptionStr = _MSG_REFERENCED; |
PEG_FUNC_EXIT (TRC_INDICATION_SERVICE, METHOD_NAME); | PEG_FUNC_EXIT (TRC_INDICATION_SERVICE, METHOD_NAME); |
throw CIMException (CIM_ERR_NOT_SUPPORTED); |
throw PEGASUS_CIM_EXCEPTION (CIM_ERR_FAILED, exceptionStr); |
} | } |
} | } |
catch (CIMException& exception) | catch (CIMException& exception) |
|
|
for (Uint8 i = 0; i < indication.getPropertyCount(); i++) | for (Uint8 i = 0; i < indication.getPropertyCount(); i++) |
propertyList.append(indication.getProperty(i).getName()); | propertyList.append(indication.getProperty(i).getName()); |
| |
|
Array <String> nameSpaces; |
|
nameSpaces.append (request->nameSpace); |
matchedSubscriptions = _getMatchingSubscriptions( | matchedSubscriptions = _getMatchingSubscriptions( |
indication.getClassName(), CIMPropertyList(propertyList)); |
indication.getClassName (), nameSpaces, |
|
CIMPropertyList (propertyList)); |
| |
for (Uint8 i = 0; i < matchedSubscriptions.size(); i++) | for (Uint8 i = 0; i < matchedSubscriptions.size(); i++) |
{ | { |
match = true; | match = true; |
| |
|
// |
|
// Check for expired subscription |
|
// |
|
if ((matchedSubscriptions [i].getInstance ().existsProperty |
|
(_PROPERTY_DURATION)) && |
|
(_isExpired (matchedSubscriptions [i].getInstance ()))) |
|
{ |
|
_deleteExpiredSubscription |
|
(matchedSubscriptions [i].getInstanceName ().getNameSpace(), |
|
matchedSubscriptions [i].getInstanceName ()); |
|
|
|
continue; |
|
} |
|
|
filterQuery = _getFilterQuery( | filterQuery = _getFilterQuery( |
matchedSubscriptions[i].getInstance (), | matchedSubscriptions[i].getInstance (), |
matchedSubscriptions[i].getInstanceName ().getNameSpace ()); | matchedSubscriptions[i].getInstanceName ().getNameSpace ()); |
|
|
XmlWriter::getNextMessageId (), | XmlWriter::getNextMessageId (), |
request->nameSpace, | request->nameSpace, |
handlerNamedInstance.getInstance (), | handlerNamedInstance.getInstance (), |
//handlerRef.handler, |
|
indication, | indication, |
QueueIdStack(_handlerService, getQueueId())); | QueueIdStack(_handlerService, getQueueId())); |
| |
|
|
//AsyncReply *async_reply = SendWait(async_req); | //AsyncReply *async_reply = SendWait(async_req); |
SendForget(async_req); | SendForget(async_req); |
| |
|
// |
|
// ATTN-CAKG-P1-20020326: Check for error - implement |
|
// subscription's OnFatalErrorPolicy |
|
// |
|
|
//response = reinterpret_cast<CIMProcessIndicationResponseMessage *> | //response = reinterpret_cast<CIMProcessIndicationResponseMessage *> |
// ((static_cast<AsyncLegacyOperationResult *>(async_reply))->res); | // ((static_cast<AsyncLegacyOperationResult *>(async_reply))->res); |
| |
|
|
String errorDescription; | String errorDescription; |
| |
CIMInstance provider = request->provider; | CIMInstance provider = request->provider; |
|
CIMInstance providerModule = request->providerModule; |
String className = request->className; | String className = request->className; |
|
Array <String> newNameSpaces = request->newNamespaces; |
|
Array <String> oldNameSpaces = request->oldNamespaces; |
CIMPropertyList newPropertyNames = request->newPropertyNames; | CIMPropertyList newPropertyNames = request->newPropertyNames; |
CIMPropertyList oldPropertyNames = request->oldPropertyNames; | CIMPropertyList oldPropertyNames = request->oldPropertyNames; |
| |
|
|
// Get matching subscriptions | // Get matching subscriptions |
// | // |
newSubscriptions = _getMatchingSubscriptions (className, | newSubscriptions = _getMatchingSubscriptions (className, |
newPropertyNames); |
newNameSpaces, newPropertyNames); |
| |
break; | break; |
} | } |
|
|
// Get matching subscriptions | // Get matching subscriptions |
// | // |
formerSubscriptions = _getMatchingSubscriptions (className, | formerSubscriptions = _getMatchingSubscriptions (className, |
oldPropertyNames); |
oldNameSpaces, oldPropertyNames); |
| |
break; | break; |
} | } |
|
|
// | // |
// Get lists of affected subscriptions | // Get lists of affected subscriptions |
// | // |
_getModifiedSubscriptions (className, newPropertyNames, |
_getModifiedSubscriptions (className, newNameSpaces, oldNameSpaces, |
oldPropertyNames, newSubscriptions, formerSubscriptions); |
newPropertyNames, oldPropertyNames, |
|
newSubscriptions, formerSubscriptions); |
| |
break; | break; |
} | } |
|
|
// Construct provider class list from input provider and class name | // Construct provider class list from input provider and class name |
// | // |
indicationProvider.provider = provider; | indicationProvider.provider = provider; |
|
indicationProvider.providerModule = providerModule; |
indicationProvider.classList.append (className); | indicationProvider.classList.append (className); |
indicationProviders.append (indicationProvider); | indicationProviders.append (indicationProvider); |
| |
|
|
requiredProperties, condition, queryLanguage); | requiredProperties, condition, queryLanguage); |
| |
// | // |
// Send enable request |
// Send enable requests |
|
// ATTN-CAKG-P3-20020315: These enable requests are not associated |
|
// with a user request, so there is no associated authType or |
|
// userName |
|
// The Creator from the subscription instance is used for userName, |
|
// and authType is not set |
// | // |
_sendEnableRequests (indicationProviders, |
CIMInstance instance = newSubscriptions [i].getInstance (); |
|
String creator = instance.getProperty (instance.findProperty |
|
(_PROPERTY_CREATOR)).getValue ().toString (); |
|
if (!_sendEnableRequests (indicationProviders, |
newSubscriptions [i].getInstanceName ().getNameSpace (), | newSubscriptions [i].getInstanceName ().getNameSpace (), |
requiredProperties, condition, queryLanguage, | requiredProperties, condition, queryLanguage, |
newSubscriptions [i]); |
newSubscriptions [i], creator)) |
|
{ |
|
PEG_FUNC_EXIT (TRC_INDICATION_SERVICE, METHOD_NAME); |
|
throw PEGASUS_CIM_EXCEPTION (CIM_ERR_NOT_SUPPORTED, |
|
_MSG_NOT_ACCEPTED); |
|
} |
| |
// | // |
// Send start message to each provider | // Send start message to each provider |
|
|
if (formerSubscriptions.size () > 0) | if (formerSubscriptions.size () > 0) |
{ | { |
//cout << "formerSubscriptions.size (): " << formerSubscriptions.size () << endl; | //cout << "formerSubscriptions.size (): " << formerSubscriptions.size () << endl; |
CIMInstance indicationInstance; |
|
| |
// | // |
// Send disable request for each subscription that can no longer | // Send disable request for each subscription that can no longer |
// be supported | // be supported |
|
// ATTN-CAKG-P3-20020315: These disable requests are not associated |
|
// with a user request, so there is no associated authType or userName |
|
// The Creator from the subscription instance is used for userName, |
|
// and authType is not set |
// | // |
for (Uint8 i = 0; i < formerSubscriptions.size (); i++) | for (Uint8 i = 0; i < formerSubscriptions.size (); i++) |
{ | { |
|
CIMInstance instance = formerSubscriptions [i].getInstance (); |
|
String creator = instance.getProperty (instance.findProperty |
|
(_PROPERTY_CREATOR)).getValue ().toString (); |
_sendDisableRequests (indicationProviders, | _sendDisableRequests (indicationProviders, |
formerSubscriptions [i].getInstanceName ().getNameSpace (), | formerSubscriptions [i].getInstanceName ().getNameSpace (), |
formerSubscriptions [i]); |
formerSubscriptions [i], creator); |
} | } |
| |
// | // |
|
|
// Create NoProviderAlertIndication instance | // Create NoProviderAlertIndication instance |
// ATTN: NoProviderAlertIndication must be defined | // ATTN: NoProviderAlertIndication must be defined |
// | // |
indicationInstance = _createAlertInstance |
CIMInstance indicationInstance = _createAlertInstance |
(_CLASS_NO_PROVIDER_ALERT, formerSubscriptions); | (_CLASS_NO_PROVIDER_ALERT, formerSubscriptions); |
| |
// | // |
|
|
PEG_FUNC_EXIT (TRC_INDICATION_SERVICE, METHOD_NAME); | PEG_FUNC_EXIT (TRC_INDICATION_SERVICE, METHOD_NAME); |
} | } |
| |
|
// |
|
// ATTN-CAKG-P1-20020325: To Be Removed -- the repository is to be |
|
// modified to allow addition of property to an instance, without adding |
|
// property to the class |
|
// |
void IndicationService::_checkClasses (void) | void IndicationService::_checkClasses (void) |
{ | { |
const char METHOD_NAME [] = "IndicationService::_checkClasses"; | const char METHOD_NAME [] = "IndicationService::_checkClasses"; |
|
|
Uint16 onFatalErrorPolicy; | Uint16 onFatalErrorPolicy; |
CIMValue persistenceValue; | CIMValue persistenceValue; |
Uint16 persistenceType; | Uint16 persistenceType; |
|
CIMValue nameSpaceValue; |
|
String sourceNameSpace; |
| |
const char METHOD_NAME [] = "IndicationService::_canCreate"; | const char METHOD_NAME [] = "IndicationService::_canCreate"; |
| |
|
|
{ | { |
instance.addProperty (CIMProperty | instance.addProperty (CIMProperty |
(_PROPERTY_SOURCENAMESPACE, nameSpace)); | (_PROPERTY_SOURCENAMESPACE, nameSpace)); |
|
sourceNameSpace = nameSpace; |
} | } |
|
else |
|
{ |
|
nameSpaceValue = instance.getProperty (instance.findProperty |
|
(_PROPERTY_SOURCENAMESPACE)).getValue (); |
|
nameSpaceValue.get (sourceNameSpace); |
|
} |
|
|
|
// |
|
// Validate the query and indication class name |
|
// An exception is thrown if the query is invalid or the class |
|
// is not an indication class |
|
// |
|
String filterQuery = instance.getProperty (instance.findProperty |
|
(_PROPERTY_QUERY)).getValue ().toString (); |
|
WQLSelectStatement selectStatement = |
|
_getSelectStatement (filterQuery); |
|
String indicationClassName = _getIndicationClassName |
|
(selectStatement, sourceNameSpace); |
} | } |
| |
// | // |
|
|
// | // |
// Get all the subscriptions from the respository | // Get all the subscriptions from the respository |
// | // |
Array <CIMNamedInstance> instanceObjects = |
Array <CIMNamedInstance> subscriptions = |
_repository->enumerateInstances (nameSpace, _CLASS_SUBSCRIPTION); | _repository->enumerateInstances (nameSpace, _CLASS_SUBSCRIPTION); |
| |
CIMValue propValue; | CIMValue propValue; |
|
|
// Check each subscription for a reference to the instance to be | // Check each subscription for a reference to the instance to be |
// deleted | // deleted |
// | // |
for (Uint8 i = 0; i < instanceObjects.size(); i++) |
for (Uint8 i = 0; i < subscriptions.size(); i++) |
{ | { |
// | // |
// Get the subscription Filter or Handler property value | // Get the subscription Filter or Handler property value |
// | // |
propValue = instanceObjects[i].getInstance().getProperty |
propValue = subscriptions[i].getInstance().getProperty |
(instanceObjects[i].getInstance().findProperty |
(subscriptions[i].getInstance().findProperty |
(propName)).getValue(); | (propName)).getValue(); |
| |
CIMReference ref; | CIMReference ref; |
|
|
| |
Array <CIMNamedInstance> IndicationService::_getMatchingSubscriptions ( | Array <CIMNamedInstance> IndicationService::_getMatchingSubscriptions ( |
const String & targetClass, | const String & targetClass, |
|
const Array <String> nameSpaces, |
const CIMPropertyList & targetProperties) const | const CIMPropertyList & targetProperties) const |
{ | { |
Array <CIMNamedInstance> matchingSubscriptions; | Array <CIMNamedInstance> matchingSubscriptions; |
|
|
WQLSelectStatement selectStatement; | WQLSelectStatement selectStatement; |
String indicationClassName; | String indicationClassName; |
Array <String> indicationSubclasses; | Array <String> indicationSubclasses; |
|
String sourceNameSpace; |
CIMPropertyList propertyList; | CIMPropertyList propertyList; |
Boolean match; | Boolean match; |
| |
|
|
indicationSubclasses.append (indicationClassName); | indicationSubclasses.append (indicationClassName); |
| |
// | // |
// Does current subscription include target class? |
// Get filter source namespace |
// | // |
if (Contains (indicationSubclasses, targetClass)) |
sourceNameSpace = _getSourceNameSpace |
|
(subscriptions [j].getInstance (), nameSpaceNames [i]); |
|
|
|
// |
|
// Is current subscription for the target class and one of |
|
// the supported namespaces? |
|
// |
|
if ((Contains (indicationSubclasses, targetClass)) && |
|
(Contains (nameSpaces, sourceNameSpace))) |
{ | { |
match = true; | match = true; |
| |
|
|
| |
void IndicationService::_getModifiedSubscriptions ( | void IndicationService::_getModifiedSubscriptions ( |
const String & targetClass, | const String & targetClass, |
|
const Array <String> & newNameSpaces, |
|
const Array <String> & oldNameSpaces, |
const CIMPropertyList & newProperties, | const CIMPropertyList & newProperties, |
const CIMPropertyList & oldProperties, | const CIMPropertyList & oldProperties, |
Array <CIMNamedInstance> & newSubscriptions, | Array <CIMNamedInstance> & newSubscriptions, |
|
|
WQLSelectStatement selectStatement; | WQLSelectStatement selectStatement; |
String indicationClassName; | String indicationClassName; |
Array <String> indicationSubclasses; | Array <String> indicationSubclasses; |
CIMPropertyList propertyList; |
String sourceNameSpace; |
|
CIMPropertyList requiredProperties; |
Boolean newMatch; | Boolean newMatch; |
Boolean formerMatch; | Boolean formerMatch; |
| |
|
|
indicationSubclasses.append (indicationClassName); | indicationSubclasses.append (indicationClassName); |
| |
// | // |
// Does current subscription include target class? |
// Get filter source namespace |
|
// |
|
sourceNameSpace = _getSourceNameSpace |
|
(subscriptions [j].getInstance (), nameSpaceNames [i]); |
|
|
|
// |
|
// Is current subscription for the target class? |
// | // |
if (Contains (indicationSubclasses, targetClass)) | if (Contains (indicationSubclasses, targetClass)) |
{ | { |
newMatch = true; |
newMatch = false; |
formerMatch = true; |
formerMatch = false; |
| |
// | // |
// Get property list from filter query (FROM and WHERE | // Get property list from filter query (FROM and WHERE |
|
|
if ((selectStatement.getSelectPropertyNameCount () > 0) || | if ((selectStatement.getSelectPropertyNameCount () > 0) || |
(selectStatement.getWherePropertyNameCount () > 0)) | (selectStatement.getWherePropertyNameCount () > 0)) |
{ | { |
propertyList = _getPropertyList (selectStatement); |
requiredProperties = _getPropertyList (selectStatement); |
} | } |
| |
// | // |
// If new property list is null (all properties) |
// If source namespace is now supported, but previously |
// the subscription can be supported |
// was not, check if required properties are now supported |
// |
|
if (!newProperties.isNull ()) |
|
{ |
|
// |
|
// If the subscription requires all properties, |
|
// but new property list does not include all |
|
// properties, the subscription cannot be supported |
|
// |
|
if (propertyList.isNull ()) |
|
{ |
|
newMatch = false; |
|
} |
|
else |
|
{ |
|
// |
|
// Compare subscription property list |
|
// with new property list |
|
// | // |
for (Uint8 k = 0; |
if ((Contains (newNameSpaces, sourceNameSpace)) && |
k < propertyList.getNumProperties (); k++) |
(!Contains (oldNameSpaces, sourceNameSpace))) |
{ |
|
if (!Contains |
|
(newProperties.getPropertyNameArray (), |
|
propertyList.getPropertyName (k))) |
|
{ | { |
newMatch = false; |
newMatch = _inPropertyList (requiredProperties, |
} |
newProperties); |
} |
|
} |
|
} | } |
| |
// | // |
// If old property list is null (all properties) |
// If source namespace was previously supported, but now |
// the subscription previously could be supported |
// is not, check if required properties were previously |
// |
// supported |
if (!oldProperties.isNull ()) |
|
{ |
|
// |
|
// If the subscription requires all properties, |
|
// but old property list does not include all |
|
// properties, the subscription previously could |
|
// not be supported |
|
// | // |
if (propertyList.isNull ()) |
else if ((Contains (oldNameSpaces, sourceNameSpace)) && |
|
(!Contains (newNameSpaces, sourceNameSpace))) |
{ | { |
formerMatch = false; |
formerMatch = _inPropertyList (requiredProperties, |
|
oldProperties); |
} | } |
else |
|
{ |
|
// | // |
// Compare subscription property list |
// If source namespace was previously supported, and still |
// with old property list |
// is supported, check required properties |
// | // |
for (Uint8 m = 0; |
else if ((Contains (newNameSpaces, sourceNameSpace)) && |
m < propertyList.getNumProperties (); m++) |
(Contains (oldNameSpaces, sourceNameSpace))) |
{ | { |
if (!Contains |
newMatch = _inPropertyList (requiredProperties, |
(oldProperties.getPropertyNameArray (), |
newProperties); |
propertyList.getPropertyName (m))) |
formerMatch = _inPropertyList (requiredProperties, |
{ |
oldProperties); |
formerMatch = false; |
|
} |
|
} |
|
} |
|
} | } |
| |
// | // |
|
|
PEG_FUNC_EXIT (TRC_INDICATION_SERVICE, METHOD_NAME); | PEG_FUNC_EXIT (TRC_INDICATION_SERVICE, METHOD_NAME); |
} | } |
| |
|
Boolean IndicationService::_inPropertyList ( |
|
const CIMPropertyList & requiredProperties, |
|
const CIMPropertyList & supportedProperties) |
|
{ |
|
const char METHOD_NAME [] = |
|
"IndicationService::_inPropertyList"; |
|
|
|
PEG_FUNC_ENTER (TRC_INDICATION_SERVICE, METHOD_NAME); |
|
// |
|
// If property list is null (all properties) |
|
// all the required properties are supported |
|
// |
|
if (supportedProperties.isNull ()) |
|
{ |
|
return true; |
|
} |
|
else |
|
{ |
|
// |
|
// If the subscription requires all properties, |
|
// but property list does not include all |
|
// properties, the required properties cannot be supported |
|
// |
|
if (requiredProperties.isNull ()) |
|
{ |
|
return false; |
|
} |
|
else |
|
{ |
|
// |
|
// Compare required property list |
|
// with property list |
|
// |
|
for (Uint8 i = 0; i < requiredProperties.getNumProperties (); i++) |
|
{ |
|
if (!Contains (supportedProperties.getPropertyNameArray (), |
|
requiredProperties.getPropertyName (i))) |
|
{ |
|
return false; |
|
} |
|
} |
|
} |
|
} |
|
|
|
PEG_FUNC_EXIT (TRC_INDICATION_SERVICE, METHOD_NAME); |
|
return true; |
|
} |
|
|
Array <CIMNamedInstance> IndicationService::_getProviderSubscriptions ( | Array <CIMNamedInstance> IndicationService::_getProviderSubscriptions ( |
const CIMReference & providerReference) | const CIMReference & providerReference) |
{ | { |
|
|
try | try |
{ | { |
selectStatement.clear (); | selectStatement.clear (); |
|
// |
|
// ATTN-CAKG-P1-20020326: this method is not thread safe - it must be |
|
// guarded with mutexes by the caller |
|
// |
WQLParser::parse (filterQuery, selectStatement); | WQLParser::parse (filterQuery, selectStatement); |
} | } |
catch (ParseError & pe) | catch (ParseError & pe) |
{ | { |
|
String exceptionStr = pe.getMessage (); |
PEG_FUNC_EXIT (TRC_INDICATION_SERVICE, METHOD_NAME); | PEG_FUNC_EXIT (TRC_INDICATION_SERVICE, METHOD_NAME); |
throw CIMException (CIM_ERR_INVALID_PARAMETER); |
throw PEGASUS_CIM_EXCEPTION (CIM_ERR_INVALID_PARAMETER, exceptionStr); |
} | } |
catch (MissingNullTerminator & mnt) | catch (MissingNullTerminator & mnt) |
{ | { |
|
String exceptionStr = mnt.getMessage (); |
PEG_FUNC_EXIT (TRC_INDICATION_SERVICE, METHOD_NAME); | PEG_FUNC_EXIT (TRC_INDICATION_SERVICE, METHOD_NAME); |
throw CIMException (CIM_ERR_INVALID_PARAMETER); |
throw PEGASUS_CIM_EXCEPTION (CIM_ERR_INVALID_PARAMETER, exceptionStr); |
} | } |
| |
PEG_FUNC_EXIT (TRC_INDICATION_SERVICE, METHOD_NAME); | PEG_FUNC_EXIT (TRC_INDICATION_SERVICE, METHOD_NAME); |
|
|
indicationClassName = selectStatement.getClassName (); | indicationClassName = selectStatement.getClassName (); |
| |
// | // |
// Get list of subclass names for indication class |
// Validate that class is an Indication class |
|
// The Indication Qualifier should exist and have the value True |
// | // |
indicationSubclasses = _repository->enumerateClassNames |
Boolean validClass = false; |
(nameSpaceName, _CLASS_INDICATION, true); |
CIMClass theClass = _repository->getClass |
indicationSubclasses.append (_CLASS_INDICATION); |
(nameSpaceName, indicationClassName); |
|
if (theClass.existsQualifier (_QUALIFIER_INDICATION)) |
|
{ |
|
CIMQualifier theQual = theClass.getQualifier (theClass.findQualifier |
|
(_QUALIFIER_INDICATION)); |
|
CIMValue theVal = theQual.getValue (); |
|
if (!theVal.isNull ()) |
|
{ |
|
Boolean indicationClass; |
|
theVal.get (indicationClass); |
|
validClass = indicationClass; |
|
} |
|
} |
| |
// |
if (!validClass) |
// Validate query FROM clause consists of a single subclass of |
|
// the Indication class |
|
// |
|
if (!Contains (indicationSubclasses, indicationClassName)) |
|
{ | { |
String exceptionStr = _MSG_INVALID_CLASSNAME; | String exceptionStr = _MSG_INVALID_CLASSNAME; |
exceptionStr.append (indicationClassName); | exceptionStr.append (indicationClassName); |
exceptionStr.append (_MSG_IN_FROM); | exceptionStr.append (_MSG_IN_FROM); |
exceptionStr.append (_CLASS_FILTER); | exceptionStr.append (_CLASS_FILTER); |
|
exceptionStr.append (" "); |
exceptionStr.append (_PROPERTY_QUERY); | exceptionStr.append (_PROPERTY_QUERY); |
exceptionStr.append (_MSG_PROPERTY); | exceptionStr.append (_MSG_PROPERTY); |
PEG_FUNC_EXIT (TRC_INDICATION_SERVICE, METHOD_NAME); | PEG_FUNC_EXIT (TRC_INDICATION_SERVICE, METHOD_NAME); |
|
|
// | // |
// Send disable requests | // Send disable requests |
// | // |
|
CIMInstance instance = subscriptions [i].getInstance (); |
|
String creator = instance.getProperty (instance.findProperty |
|
(_PROPERTY_CREATOR)).getValue ().toString (); |
_sendDisableRequests (indicationProviders, nameSpace, | _sendDisableRequests (indicationProviders, nameSpace, |
subscriptions [i]); |
subscriptions [i], creator); |
| |
// | // |
// Delete referencing subscription instance from repository | // Delete referencing subscription instance from repository |
|
|
return indicationProviders; | return indicationProviders; |
} | } |
| |
void IndicationService::_sendEnableRequests |
Boolean IndicationService::_sendEnableRequests |
(const Array <struct ProviderClassList> & indicationProviders, | (const Array <struct ProviderClassList> & indicationProviders, |
const String & nameSpace, | const String & nameSpace, |
const CIMPropertyList & propertyList, | const CIMPropertyList & propertyList, |
const String & condition, | const String & condition, |
const String & queryLanguage, | const String & queryLanguage, |
const CIMNamedInstance & subscription) |
const CIMNamedInstance & subscription, |
|
const String & userName, |
|
const String & authType) |
{ | { |
CIMValue propValue; | CIMValue propValue; |
Uint16 repeatNotificationPolicy; | Uint16 repeatNotificationPolicy; |
|
|
// | // |
// Send enable request to each provider | // Send enable request to each provider |
// | // |
|
Uint8 accepted = 0; |
for (Uint8 i = 0; i < indicationProviders.size (); i++) | for (Uint8 i = 0; i < indicationProviders.size (); i++) |
{ | { |
CIMEnableIndicationSubscriptionRequestMessage * request = | CIMEnableIndicationSubscriptionRequestMessage * request = |
|
//CIMCreateSubscriptionRequestMessage * request = |
new CIMEnableIndicationSubscriptionRequestMessage | new CIMEnableIndicationSubscriptionRequestMessage |
|
//new CIMCreateSubscriptionRequestMessage |
(XmlWriter::getNextMessageId (), | (XmlWriter::getNextMessageId (), |
nameSpace, | nameSpace, |
|
subscription, |
indicationProviders [i].classList, | indicationProviders [i].classList, |
indicationProviders [i].provider, | indicationProviders [i].provider, |
indicationProviders [i].providerModule, | indicationProviders [i].providerModule, |
|
|
repeatNotificationPolicy, | repeatNotificationPolicy, |
condition, | condition, |
queryLanguage, | queryLanguage, |
subscription, |
QueueIdStack (_providerManager, getQueueId ()), |
QueueIdStack (_providerManager, getQueueId ())); |
authType, |
|
userName); |
| |
AsyncOpNode* op = this->get_op(); | AsyncOpNode* op = this->get_op(); |
| |
|
|
// | // |
| |
CIMEnableIndicationSubscriptionResponseMessage * response = | CIMEnableIndicationSubscriptionResponseMessage * response = |
|
//CIMCreateSubscriptionResponseMessage * response = |
reinterpret_cast | reinterpret_cast |
<CIMEnableIndicationSubscriptionResponseMessage *> | <CIMEnableIndicationSubscriptionResponseMessage *> |
|
//<CIMCreateSubscriptionResponseMessage *> |
((static_cast <AsyncLegacyOperationResult *> | ((static_cast <AsyncLegacyOperationResult *> |
(async_reply))->get_result()); | (async_reply))->get_result()); |
| |
|
if (response->errorCode == CIM_ERR_SUCCESS) |
|
{ |
|
accepted++; |
|
// |
|
// ATTN: add entry to subscription table with provider and classes |
|
// |
|
//cout << "Enable accepted" << endl; |
|
} |
|
else |
|
{ |
|
//cout << "Enable rejected" << endl; |
|
//cout << "Error code: " << response->errorCode << endl; |
|
//cout << response->errorDescription << endl; |
|
} |
|
|
delete async_req; | delete async_req; |
delete async_reply; | delete async_reply; |
} | } |
| |
|
// |
|
// ATTN-CAKG-P1-20020326: Temporarily returning true (for testing purposes) |
|
// although there are no indication providers functioning |
|
// |
|
//Boolean result = (accepted > 0); |
|
Boolean result = true; |
|
return result; |
|
|
PEG_FUNC_EXIT (TRC_INDICATION_SERVICE, METHOD_NAME); | PEG_FUNC_EXIT (TRC_INDICATION_SERVICE, METHOD_NAME); |
} | } |
| |
|
|
const CIMPropertyList & propertyList, | const CIMPropertyList & propertyList, |
const String & condition, | const String & condition, |
const String & queryLanguage, | const String & queryLanguage, |
const CIMNamedInstance & subscription) |
const CIMNamedInstance & subscription, |
|
const String & userName, |
|
const String & authType) |
{ | { |
CIMValue propValue; | CIMValue propValue; |
Uint16 repeatNotificationPolicy; | Uint16 repeatNotificationPolicy; |
|
|
for (Uint8 i = 0; i < indicationProviders.size (); i++) | for (Uint8 i = 0; i < indicationProviders.size (); i++) |
{ | { |
CIMModifyIndicationSubscriptionRequestMessage* request = | CIMModifyIndicationSubscriptionRequestMessage* request = |
|
//CIMModifySubscriptionRequestMessage * request = |
new CIMModifyIndicationSubscriptionRequestMessage | new CIMModifyIndicationSubscriptionRequestMessage |
|
//new CIMModifySubscriptionRequestMessage |
(XmlWriter::getNextMessageId (), | (XmlWriter::getNextMessageId (), |
nameSpace, | nameSpace, |
|
subscription, |
indicationProviders [i].classList, | indicationProviders [i].classList, |
indicationProviders [i].provider, | indicationProviders [i].provider, |
indicationProviders [i].providerModule, | indicationProviders [i].providerModule, |
|
|
repeatNotificationPolicy, | repeatNotificationPolicy, |
condition, | condition, |
queryLanguage, | queryLanguage, |
subscription, |
QueueIdStack (_providerManager, getQueueId ()), |
QueueIdStack (_providerManager, getQueueId ())); |
authType, |
|
userName); |
| |
AsyncOpNode* op = this->get_op(); | AsyncOpNode* op = this->get_op(); |
| |
|
|
// | // |
| |
CIMModifyIndicationSubscriptionResponseMessage * response = | CIMModifyIndicationSubscriptionResponseMessage * response = |
|
//CIMModifySubscriptionResponseMessage * response = |
reinterpret_cast | reinterpret_cast |
<CIMModifyIndicationSubscriptionResponseMessage *> | <CIMModifyIndicationSubscriptionResponseMessage *> |
|
//<CIMModifySubscriptionResponseMessage *> |
((static_cast <AsyncLegacyOperationResult *> | ((static_cast <AsyncLegacyOperationResult *> |
(async_reply))->get_result()); | (async_reply))->get_result()); |
| |
|
// |
|
// ATTN-CAKG-P2-20020326: Do we need to look at the response? |
|
// Indication providers may ignore modify requests, so I don't think |
|
// we care whether they accept or reject the modification... |
|
// |
|
|
|
// |
|
// ATTN: modify entry in subscription table with provider and classes |
|
// |
|
|
delete async_req; | delete async_req; |
delete async_reply; | delete async_reply; |
} | } |
|
|
void IndicationService::_sendDisableRequests | void IndicationService::_sendDisableRequests |
(const Array <struct ProviderClassList> & indicationProviders, | (const Array <struct ProviderClassList> & indicationProviders, |
const String & nameSpace, | const String & nameSpace, |
const CIMNamedInstance & subscription) |
const CIMNamedInstance & subscription, |
|
const String & userName, |
|
const String & authType) |
{ | { |
const char METHOD_NAME [] = "IndicationService::_sendDisableRequests"; | const char METHOD_NAME [] = "IndicationService::_sendDisableRequests"; |
| |
|
|
for (Uint8 i = 0; i < indicationProviders.size (); i++) | for (Uint8 i = 0; i < indicationProviders.size (); i++) |
{ | { |
CIMDisableIndicationSubscriptionRequestMessage* request = | CIMDisableIndicationSubscriptionRequestMessage* request = |
|
//CIMDeleteSubscriptionRequestMessage * request = |
new CIMDisableIndicationSubscriptionRequestMessage | new CIMDisableIndicationSubscriptionRequestMessage |
|
//new CIMDeleteSubscriptionRequestMessage |
(XmlWriter::getNextMessageId (), | (XmlWriter::getNextMessageId (), |
nameSpace, | nameSpace, |
|
subscription, |
indicationProviders [i].classList, | indicationProviders [i].classList, |
indicationProviders [i].provider, | indicationProviders [i].provider, |
indicationProviders [i].providerModule, | indicationProviders [i].providerModule, |
subscription, |
QueueIdStack (_providerManager, getQueueId ()), |
QueueIdStack (_providerManager, getQueueId ())); |
authType, |
|
userName); |
| |
AsyncOpNode* op = this->get_op(); | AsyncOpNode* op = this->get_op(); |
| |
|
|
// | // |
| |
CIMDisableIndicationSubscriptionResponseMessage * response = | CIMDisableIndicationSubscriptionResponseMessage * response = |
|
//CIMDeleteSubscriptionResponseMessage * response = |
reinterpret_cast | reinterpret_cast |
<CIMDisableIndicationSubscriptionResponseMessage *> | <CIMDisableIndicationSubscriptionResponseMessage *> |
|
//<CIMDeleteSubscriptionResponseMessage *> |
((static_cast <AsyncLegacyOperationResult *> | ((static_cast <AsyncLegacyOperationResult *> |
(async_reply))->get_result()); | (async_reply))->get_result()); |
| |
|
// |
|
// ATTN-CAKG-P2-20020326: Do we need to look at the response? |
|
// I don't think there is any action to take if the disable is |
|
// rejected (perhaps log a message?) |
|
// |
|
|
|
// |
|
// ATTN: delete entry in subscription table with provider and classes |
|
// |
|
|
delete async_req; | delete async_req; |
delete async_reply; | delete async_reply; |
} | } |
|
|
"Creator"; | "Creator"; |
| |
// | // |
|
// Qualifier names |
|
// |
|
|
|
/** |
|
The name of the Indication qualifier for classes |
|
*/ |
|
const char IndicationService::_QUALIFIER_INDICATION [] = "INDICATION"; |
|
|
|
// |
// Service names | // Service names |
// | // |
| |
|
|
const char IndicationService::_MSG_NO_PROVIDERS [] = | const char IndicationService::_MSG_NO_PROVIDERS [] = |
"There are no providers capable of serving the subscription"; | "There are no providers capable of serving the subscription"; |
| |
|
const char IndicationService::_MSG_NOT_ACCEPTED [] = |
|
"No providers accepted the subscription"; |
|
|
const char IndicationService::_MSG_INVALID_CLASSNAME [] = | const char IndicationService::_MSG_INVALID_CLASSNAME [] = |
"Invalid indication class name "; | "Invalid indication class name "; |
| |
|
|
const char IndicationService::_MSG_EXPIRED [] = | const char IndicationService::_MSG_EXPIRED [] = |
"Expired subscription may not be modified; has been deleted"; | "Expired subscription may not be modified; has been deleted"; |
| |
|
const char IndicationService::_MSG_REFERENCED [] = |
|
"A Filter or Handler referenced by a subscription may not be deleted"; |
|
|
| |
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |