version 1.52, 2004/06/28 09:33:01
|
version 1.59, 2004/10/17 20:40:01
|
|
|
//%2003//////////////////////////////////////////////////////////////////////// |
//%2004//////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Development |
// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development |
// Company, L. P., IBM Corp., The Open Group, Tivoli Systems. |
// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. |
// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L. P.; | // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L. P.; |
// IBM Corp.; EMC Corporation, The Open Group. | // IBM Corp.; EMC Corporation, The Open Group. |
|
// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.; |
|
// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. |
// | // |
// Permission is hereby granted, free of charge, to any person obtaining a copy | // Permission is hereby granted, free of charge, to any person obtaining a copy |
// of this software and associated documentation files (the "Software"), to | // of this software and associated documentation files (the "Software"), to |
|
|
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
CIMRepository* ProviderManagerService::_repository=NULL; |
|
|
|
inline Boolean _isSupportedRequestType(const Message * message) | inline Boolean _isSupportedRequestType(const Message * message) |
{ | { |
// ATTN: needs implementation | // ATTN: needs implementation |
|
|
return; | return; |
} | } |
| |
|
// Note: This method should not throw an exception. It is used as a thread |
|
// entry point, and any exceptions thrown are ignored. |
PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL | PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL |
ProviderManagerService::handleCimOperation(void * arg) throw() |
ProviderManagerService::handleCimOperation(void * arg) |
{ | { |
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, | PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
"ProviderManagerService::handleCimOperation"); | "ProviderManagerService::handleCimOperation"); |
|
|
PEGASUS_ASSERT(async != 0); | PEGASUS_ASSERT(async != 0); |
| |
Message * response = 0; | Message * response = 0; |
|
Boolean consumerLookupFailed = false; |
|
|
|
if (request->getType() == CIM_EXPORT_INDICATION_REQUEST_MESSAGE) |
|
{ |
|
// |
|
// Get a ProviderIdContainer for ExportIndicationRequestMessage. |
|
// Note: This can be removed when the CIMExportRequestDispatcher |
|
// is updated to add the ProviderIdContainer to the message. |
|
// |
|
CIMInstance providerModule; |
|
CIMInstance provider; |
|
const CIMExportIndicationRequestMessage* expRequest = |
|
dynamic_cast<const CIMExportIndicationRequestMessage*>(request); |
|
if (_providerRegistrationManager->lookupIndicationConsumer( |
|
expRequest->destinationPath, provider, providerModule)) |
|
{ |
|
request->operationContext.insert( |
|
ProviderIdContainer(providerModule, provider)); |
|
} |
|
else |
|
{ |
|
consumerLookupFailed = true; |
|
} |
|
} |
| |
if ((dynamic_cast<CIMOperationRequestMessage*>(request) != 0) || |
if (consumerLookupFailed) |
|
{ |
|
CIMResponseMessage* cimResponse = request->buildResponse(); |
|
cimResponse->cimException = PEGASUS_CIM_EXCEPTION( |
|
CIM_ERR_NOT_SUPPORTED, String::EMPTY); |
|
response = cimResponse; |
|
} |
|
else if ((dynamic_cast<CIMOperationRequestMessage*>(request) != 0) || |
(dynamic_cast<CIMIndicationRequestMessage*>(request) != 0) || | (dynamic_cast<CIMIndicationRequestMessage*>(request) != 0) || |
(request->getType() == CIM_EXPORT_INDICATION_REQUEST_MESSAGE) || | (request->getType() == CIM_EXPORT_INDICATION_REQUEST_MESSAGE) || |
(request->getType() == CIM_INITIALIZE_PROVIDER_REQUEST_MESSAGE)) | (request->getType() == CIM_INITIALIZE_PROVIDER_REQUEST_MESSAGE)) |
|
|
// | // |
CIMInstance providerModule; | CIMInstance providerModule; |
| |
CIMIndicationRequestMessage* indRequest = |
|
dynamic_cast<CIMIndicationRequestMessage*>(request); |
|
if (indRequest != 0) |
|
{ |
|
ProviderIdContainer pidc = indRequest->operationContext.get(ProviderIdContainer::NAME); |
|
providerModule = pidc.getModule(); |
|
} |
|
else if (request->getType() == CIM_EXPORT_INDICATION_REQUEST_MESSAGE) |
|
{ |
|
// Get a ProviderIdContainer for ExportIndicationRequestMessage |
|
ProviderIdContainer pidc = _getProviderIdContainer(request); |
|
request->operationContext.insert(pidc); |
|
|
|
providerModule = pidc.getModule(); |
|
} |
|
else |
|
{ |
|
// The provider ID container is added to the OperationContext | // The provider ID container is added to the OperationContext |
// by the CIMOperationRequestDispatcher for all CIM operation | // by the CIMOperationRequestDispatcher for all CIM operation |
// requests to providers, so it does not need to be added again. | // requests to providers, so it does not need to be added again. |
|
|
ProviderIdContainer pidc = | ProviderIdContainer pidc = |
request->operationContext.get(ProviderIdContainer::NAME); | request->operationContext.get(ProviderIdContainer::NAME); |
providerModule = pidc.getModule(); | providerModule = pidc.getModule(); |
} |
|
| |
// | // |
// Check if the target provider is disabled | // Check if the target provider is disabled |
|
|
return(PEGASUS_THREAD_RETURN(0)); | return(PEGASUS_THREAD_RETURN(0)); |
} | } |
| |
ProviderIdContainer ProviderManagerService::_getProviderIdContainer( |
|
const CIMRequestMessage* message) |
|
{ |
|
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, |
|
"ProviderManagerService::_getProviderIdContainer"); |
|
|
|
CIMInstance providerModule; |
|
CIMInstance provider; |
|
Boolean remoteNamespace=false; |
|
String remoteInfo=String::EMPTY; |
|
|
|
switch (message->getType()) |
|
{ |
|
case CIM_GET_CLASS_REQUEST_MESSAGE: |
|
case CIM_DELETE_CLASS_REQUEST_MESSAGE: |
|
case CIM_CREATE_CLASS_REQUEST_MESSAGE: |
|
case CIM_MODIFY_CLASS_REQUEST_MESSAGE: |
|
case CIM_ENUMERATE_CLASSES_REQUEST_MESSAGE: |
|
case CIM_ENUMERATE_CLASS_NAMES_REQUEST_MESSAGE: |
|
case CIM_GET_QUALIFIER_REQUEST_MESSAGE: |
|
case CIM_SET_QUALIFIER_REQUEST_MESSAGE: |
|
case CIM_DELETE_QUALIFIER_REQUEST_MESSAGE: |
|
case CIM_ENUMERATE_QUALIFIERS_REQUEST_MESSAGE: |
|
// The ProviderManagerService does not support class operations |
|
PEGASUS_ASSERT(0); |
|
break; |
|
|
|
case CIM_GET_INSTANCE_REQUEST_MESSAGE: |
|
case CIM_DELETE_INSTANCE_REQUEST_MESSAGE: |
|
case CIM_CREATE_INSTANCE_REQUEST_MESSAGE: |
|
case CIM_MODIFY_INSTANCE_REQUEST_MESSAGE: |
|
case CIM_ENUMERATE_INSTANCES_REQUEST_MESSAGE: |
|
case CIM_ENUMERATE_INSTANCE_NAMES_REQUEST_MESSAGE: |
|
case CIM_GET_PROPERTY_REQUEST_MESSAGE: |
|
case CIM_SET_PROPERTY_REQUEST_MESSAGE: |
|
{ |
|
// Look up instance provider |
|
const CIMOperationRequestMessage* request = |
|
dynamic_cast<const CIMOperationRequestMessage*>(message); |
|
_providerRegistrationManager->lookupInstanceProvider( |
|
request->nameSpace, request->className, provider, providerModule); |
|
remoteNamespace=_repository->isRemoteNameSpace(request->nameSpace,remoteInfo); |
|
break; |
|
} |
|
|
|
case CIM_EXEC_QUERY_REQUEST_MESSAGE: |
|
{ |
|
// Look up instance query provider |
|
const CIMOperationRequestMessage* request = |
|
dynamic_cast<const CIMOperationRequestMessage*>(message); |
|
Boolean hasNoQuery; |
|
_providerRegistrationManager->lookupInstanceProvider( |
|
request->nameSpace, request->className, provider, providerModule, |
|
0, &hasNoQuery); |
|
// We shouldn't have gotten this far if this isn't a query provider |
|
PEGASUS_ASSERT(!hasNoQuery); |
|
remoteNamespace=_repository->isRemoteNameSpace(request->nameSpace,remoteInfo); |
|
break; |
|
} |
|
|
|
case CIM_ASSOCIATORS_REQUEST_MESSAGE: |
|
{ |
|
// Look up association provider |
|
const CIMAssociatorsRequestMessage* request = |
|
dynamic_cast<const CIMAssociatorsRequestMessage*>(message); |
|
Array<CIMInstance> providerModules; |
|
Array<CIMInstance> providers; |
|
_providerRegistrationManager->lookupAssociationProvider( |
|
request->nameSpace, request->assocClass, |
|
providers, providerModules); |
|
providerModule = providerModules[0]; |
|
provider = providers[0]; |
|
remoteNamespace=_repository->isRemoteNameSpace(request->nameSpace,remoteInfo); |
|
break; |
|
} |
|
|
|
case CIM_ASSOCIATOR_NAMES_REQUEST_MESSAGE: |
|
{ |
|
// Look up association provider |
|
const CIMAssociatorNamesRequestMessage* request = |
|
dynamic_cast<const CIMAssociatorNamesRequestMessage*>(message); |
|
Array<CIMInstance> providerModules; |
|
Array<CIMInstance> providers; |
|
_providerRegistrationManager->lookupAssociationProvider( |
|
request->nameSpace, request->assocClass, |
|
providers, providerModules); |
|
providerModule = providerModules[0]; |
|
provider = providers[0]; |
|
remoteNamespace=_repository->isRemoteNameSpace(request->nameSpace,remoteInfo); |
|
break; |
|
} |
|
|
|
case CIM_REFERENCES_REQUEST_MESSAGE: |
|
{ |
|
// Look up association provider |
|
const CIMReferencesRequestMessage* request = |
|
dynamic_cast<const CIMReferencesRequestMessage*>(message); |
|
Array<CIMInstance> providerModules; |
|
Array<CIMInstance> providers; |
|
_providerRegistrationManager->lookupAssociationProvider( |
|
request->nameSpace, request->resultClass, |
|
providers, providerModules); |
|
providerModule = providerModules[0]; |
|
provider = providers[0]; |
|
remoteNamespace=_repository->isRemoteNameSpace(request->nameSpace,remoteInfo); |
|
break; |
|
} |
|
|
|
case CIM_REFERENCE_NAMES_REQUEST_MESSAGE: |
|
{ |
|
// Look up association provider |
|
const CIMReferenceNamesRequestMessage* request = |
|
dynamic_cast<const CIMReferenceNamesRequestMessage*>(message); |
|
Array<CIMInstance> providerModules; |
|
Array<CIMInstance> providers; |
|
_providerRegistrationManager->lookupAssociationProvider( |
|
request->nameSpace, request->resultClass, |
|
providers, providerModules); |
|
providerModule = providerModules[0]; |
|
provider = providers[0]; |
|
remoteNamespace=_repository->isRemoteNameSpace(request->nameSpace,remoteInfo); |
|
break; |
|
} |
|
|
|
case CIM_INVOKE_METHOD_REQUEST_MESSAGE: |
|
{ |
|
// Look up method provider |
|
const CIMInvokeMethodRequestMessage* request = |
|
dynamic_cast<const CIMInvokeMethodRequestMessage*>(message); |
|
_providerRegistrationManager->lookupMethodProvider( |
|
request->nameSpace, request->className, request->methodName, |
|
provider, providerModule); |
|
remoteNamespace=_repository->isRemoteNameSpace(request->nameSpace,remoteInfo); |
|
break; |
|
} |
|
|
|
case CIM_EXPORT_INDICATION_REQUEST_MESSAGE: |
|
{ |
|
const CIMExportIndicationRequestMessage* request = |
|
dynamic_cast<const CIMExportIndicationRequestMessage*>(message); |
|
_providerRegistrationManager->lookupIndicationConsumer( |
|
request->destinationPath, provider, providerModule); |
|
break; |
|
} |
|
|
|
case CIM_ENABLE_INDICATIONS_REQUEST_MESSAGE: |
|
case CIM_DISABLE_INDICATIONS_REQUEST_MESSAGE: |
|
case CIM_CREATE_SUBSCRIPTION_REQUEST_MESSAGE: |
|
case CIM_MODIFY_SUBSCRIPTION_REQUEST_MESSAGE: |
|
case CIM_DELETE_SUBSCRIPTION_REQUEST_MESSAGE: |
|
{ |
|
// Provider information is already in the message |
|
const CIMIndicationRequestMessage* request = |
|
dynamic_cast<const CIMIndicationRequestMessage*>(message); |
|
ProviderIdContainer pidc = request->operationContext.get(ProviderIdContainer::NAME); |
|
providerModule = pidc.getModule(); |
|
provider = pidc.getProvider(); |
|
break; |
|
} |
|
|
|
case CIM_ENABLE_INDICATION_SUBSCRIPTION_REQUEST_MESSAGE: |
|
case CIM_MODIFY_INDICATION_SUBSCRIPTION_REQUEST_MESSAGE: |
|
case CIM_DISABLE_INDICATION_SUBSCRIPTION_REQUEST_MESSAGE: |
|
case CIM_PROCESS_INDICATION_REQUEST_MESSAGE: |
|
case CIM_HANDLE_INDICATION_REQUEST_MESSAGE: |
|
case CIM_NOTIFY_PROVIDER_REGISTRATION_REQUEST_MESSAGE: |
|
case CIM_NOTIFY_PROVIDER_TERMINATION_REQUEST_MESSAGE: |
|
// These messages are not handled by the ProviderManagerService |
|
PEGASUS_ASSERT(0); |
|
break; |
|
|
|
case CIM_DISABLE_MODULE_REQUEST_MESSAGE: |
|
case CIM_ENABLE_MODULE_REQUEST_MESSAGE: |
|
case CIM_STOP_ALL_PROVIDERS_REQUEST_MESSAGE: |
|
// These messages are handled specially by the ProviderManagerService |
|
PEGASUS_ASSERT(0); |
|
break; |
|
|
|
case CIM_INITIALIZE_PROVIDER_REQUEST_MESSAGE: |
|
{ |
|
// Provider information is already in the message |
|
const CIMInitializeProviderRequestMessage* request = |
|
dynamic_cast<const CIMInitializeProviderRequestMessage*>(message); |
|
|
|
const ProviderIdContainer container = |
|
request->operationContext.get(ProviderIdContainer::NAME); |
|
providerModule = container.getModule(); |
|
provider = container.getProvider(); |
|
break; |
|
} |
|
|
|
} |
|
|
|
PEGASUS_ASSERT(!providerModule.isUninitialized()); |
|
PEGASUS_ASSERT(!provider.isUninitialized()); |
|
|
|
PEG_METHOD_EXIT(); |
|
return ProviderIdContainer(providerModule, provider, remoteNamespace, remoteInfo); |
|
} |
|
|
|
// Updates the providerModule instance and the ProviderRegistrationManager | // Updates the providerModule instance and the ProviderRegistrationManager |
void ProviderManagerService::_updateProviderModuleStatus( | void ProviderManagerService::_updateProviderModuleStatus( |
CIMInstance& providerModule, | CIMInstance& providerModule, |
|
|
try | try |
{ | { |
AcceptLanguageListContainer cntr = request->operationContext.get(AcceptLanguageListContainer::NAME); | AcceptLanguageListContainer cntr = request->operationContext.get(AcceptLanguageListContainer::NAME); |
}catch(Exception &e) |
}catch(const Exception &) |
{ | { |
request->operationContext.insert(AcceptLanguageListContainer(AcceptLanguages::EMPTY)); | request->operationContext.insert(AcceptLanguageListContainer(AcceptLanguages::EMPTY)); |
} | } |