///////////////////////////////////////////////////////////////////////////// // WMIBaseProvider::execCIMQuery - retrieves a query result // // /////////////////////////////////////////////////////////////////////////// Array<CIMObject> WMIBaseProvider::execCIMQuery( const String& nameSpace, const String& userName, const String& password, const String& queryLanguage, const String& query, const CIMPropertyList& propertyList, Boolean includeQualifiers, Boolean includeClassOrigin) { Array<CIMObject> objects; CIMInstance cimInstance; CIMStatusCode errorCode = CIM_ERR_SUCCESS; String errorDescription; WMIQueryProvider provider; PEG_METHOD_ENTER(TRC_WMIPROVIDER,"WMIBaseProvider::execCIMQuery()"); try { // This fix uses the current boolean value stored in collector // to initialize it. provider.initialize(_collector->isLocalConnection()); objects = provider.execQuery(nameSpace, userName, password, queryLanguage, query, propertyList, includeQualifiers, includeClassOrigin); provider.terminate(); } catch(CIMException& exception) { provider.terminate(); errorCode = exception.getCode(); errorDescription = exception.getMessage(); throw PEGASUS_CIM_EXCEPTION(errorCode, errorDescription); } catch(Exception& exception) { provider.terminate(); errorCode = CIM_ERR_FAILED; errorDescription = exception.getMessage(); throw PEGASUS_CIM_EXCEPTION(errorCode, errorDescription); } catch(...) { provider.terminate(); throw CIMException(CIM_ERR_FAILED); } PEG_METHOD_EXIT(); return objects; }
Message* ProviderAgent::_processRequest(CIMRequestMessage* request) { PEG_METHOD_ENTER(TRC_PROVIDERAGENT, "ProviderAgent::_processRequest"); Message* response = 0; try { // Forward the request to the ProviderManager response = _providerManagerRouter.processMessage(request); } catch (Exception& e) { PEG_TRACE((TRC_PROVIDERAGENT, Tracer::LEVEL1, "Caught exception while processing request: %s", (const char*)e.getMessage().getCString())); CIMResponseMessage* cimResponse = request->buildResponse(); cimResponse->cimException = PEGASUS_CIM_EXCEPTION( CIM_ERR_FAILED, e.getMessage()); response = cimResponse; } catch (...) { PEG_TRACE_CSTRING(TRC_PROVIDERAGENT, Tracer::LEVEL1, "Caught exception while processing request."); CIMResponseMessage* cimResponse = request->buildResponse(); cimResponse->cimException = PEGASUS_CIM_EXCEPTION( CIM_ERR_FAILED, String::EMPTY); response = cimResponse; } PEG_METHOD_EXIT(); return response; }
Boolean IndicationHandlerService::_loadHandler( CIMHandleIndicationRequestMessage* request, CIMException& cimException) { PEG_METHOD_ENTER(TRC_IND_HANDLER, "IndicationHandlerService::__loadHandler()"); CIMName className = request->handlerInstance.getClassName(); try { CIMHandler* handlerLib = _lookupHandlerForClass(className); if (handlerLib) { ContentLanguageList langs = ((ContentLanguageListContainer)request->operationContext. get(ContentLanguageListContainer::NAME)).getLanguages(); handlerLib->handleIndication( request->operationContext, request->nameSpace.getString(), request->indicationInstance, request->handlerInstance, request->subscriptionInstance, langs); } else { cimException = PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED, MessageLoaderParms("HandlerService." "IndicationHandlerService.FAILED_TO_LOAD", "Failed to load Handler")); PEG_METHOD_EXIT(); return false; } } catch (Exception& e) { cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, e.getMessage()); PEG_METHOD_EXIT(); return false; } catch (...) { cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, "Exception: Unknown"); PEG_METHOD_EXIT(); return false; } PEG_METHOD_EXIT(); return true; }
Array<CIMObject> WMIClientRep::associators( const CIMNamespaceName& nameSpace, const CIMObjectPath& objectName, const CIMName& assocClass, const CIMName& resultClass, const String& role, const String& resultRole, Boolean includeQualifiers, Boolean includeClassOrigin, const CIMPropertyList& propertyList) { Array<CIMObject> cimObjects; CIMPropertyList myPropertyList(propertyList); CIMException cimException; try { //Initializes the WMI Provider Interface WMIAssociatorProvider provider; provider.initialize(TRUE); //Performs the WMI call cimObjects = provider.associators( nameSpace.getString(), String::EMPTY, String::EMPTY, objectName, assocClass.getString(), resultClass.getString(), role, resultRole, includeQualifiers, includeClassOrigin, myPropertyList); //terminate the provider provider.terminate(); } catch(CIMException&) { throw; } catch(Exception& exception) { cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, exception.getMessage()); throw cimException; } catch(...) { cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, "associators() failed!"); throw cimException; } return(cimObjects); }
PEGASUS_NAMESPACE_BEGIN // Call the appropriate handleQueryRequest handler for the defined // query language type or return false if the language type not supported. Boolean QuerySupportRouter::routeHandleExecQueryRequest( CIMOperationRequestDispatcher* opThis, CIMExecQueryRequestMessage* msg, CIMException& cimException, EnumerationContext* enumerationContext) { bool rtnStat = false; if (msg->queryLanguage=="WQL") { rtnStat = ((WQLOperationRequestDispatcher*)opThis)->handleQueryRequest( msg, cimException, enumerationContext); } #ifdef PEGASUS_ENABLE_CQL else if(msg->queryLanguage == "DMTF:CQL") { rtnStat = ((CQLOperationRequestDispatcher*)opThis)->handleQueryRequest( msg, cimException, enumerationContext); } #endif else { if (msg->operationContext.contains( SubscriptionFilterConditionContainer::NAME)) { SubscriptionFilterConditionContainer sub_cntr = msg->operationContext.get( SubscriptionFilterConditionContainer::NAME); cimException = PEGASUS_CIM_EXCEPTION( CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED, sub_cntr.getQueryLanguage()); } else { cimException = PEGASUS_CIM_EXCEPTION( CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED, msg->queryLanguage); } return false; } if (!rtnStat) { return false; } return true; }
///////////////////////////////////////////////////////////////////////////// // WMIBaseProvider::getCIMInstance - retrieves a CIMInstance object // // /////////////////////////////////////////////////////////////////////////// CIMInstance WMIBaseProvider::getCIMInstance(const String& nameSpace, const String& userName, const String& password, const CIMObjectPath &instanceName, const CIMPropertyList &propertyList) { CIMInstance cimInstance; CIMStatusCode errorCode = CIM_ERR_SUCCESS; String errorDescription; WMIInstanceProvider provider; PEG_METHOD_ENTER(TRC_WMIPROVIDER,"WMIBaseProvider::getCIMInstance()"); try { // This fix uses the current boolean value stored in collector // to initialize it. provider.initialize(_collector->isLocalConnection()); cimInstance = provider.getInstance(nameSpace, userName, password, instanceName, false, false, false, propertyList); provider.terminate(); } catch(CIMException& exception) { provider.terminate(); errorCode = exception.getCode(); errorDescription = exception.getMessage(); throw PEGASUS_CIM_EXCEPTION(errorCode, errorDescription); } catch(Exception& exception) { provider.terminate(); errorCode = CIM_ERR_FAILED; errorDescription = exception.getMessage(); throw PEGASUS_CIM_EXCEPTION(errorCode, errorDescription); } catch(...) { provider.terminate(); throw CIMException(CIM_ERR_FAILED); } PEG_METHOD_EXIT(); return cimInstance; }
Array<CIMInstance> WMIClientRep::enumerateInstances( const CIMNamespaceName& nameSpace, const CIMName& className, Boolean deepInheritance, Boolean localOnly, Boolean includeQualifiers, Boolean includeClassOrigin, const CIMPropertyList& propertyList) { Array<CIMInstance> cimInstances; CIMPropertyList myPropertyList(propertyList); CIMException cimException; try { //Initializes the WMI Provider Interface WMIInstanceProvider provider; provider.initialize(TRUE); //Performs the WMI call cimInstances = provider.enumerateInstances( nameSpace.getString(), String::EMPTY, String::EMPTY, className.getString(), deepInheritance, localOnly, includeQualifiers, includeClassOrigin, myPropertyList); //terminate the provider provider.terminate(); } catch(CIMException&) { throw; } catch(Exception& exception) { cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, exception.getMessage()); throw cimException; } catch(...) { cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, "enumerateInstances() failed!"); throw cimException; } return(cimInstances); }
CIMClass WMIClientRep::getClass( const CIMNamespaceName& nameSpace, const CIMName& className, Boolean localOnly, Boolean includeQualifiers, Boolean includeClassOrigin, const CIMPropertyList& propertyList) { CIMClass cimClass; CIMException cimException; try { //Initializes the WMI Provider Interface WMIClassProvider provider; provider.initialize(TRUE); //Performs the WMI call cimClass = provider.getClass( nameSpace.getString(), String::EMPTY, String::EMPTY, className.getString(), localOnly, includeQualifiers, includeClassOrigin, propertyList); //terminate the provider provider.terminate(); } catch(CIMException&) { throw; } catch(Exception& exception) { cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, exception.getMessage()); throw cimException; } catch(...) { cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, "getClass() failed!"); throw cimException; } return(cimClass); }
Array<CIMObjectPath> WMIClientRep::associatorNames( const CIMNamespaceName& nameSpace, const CIMObjectPath& objectName, const CIMName& assocClass, const CIMName& resultClass, const String& role, const String& resultRole) { Array<CIMObjectPath> objectNames; CIMException cimException; try { //Initializes the WMI Provider Interface WMIAssociatorProvider provider; provider.initialize(TRUE); //Performs the WMI call objectNames = provider.associatorNames( nameSpace.getString(), String::EMPTY, String::EMPTY, objectName, assocClass.getString(), resultClass.getString(), role, resultRole); //terminate the provider provider.terminate(); } catch(CIMException&) { throw; } catch(Exception& exception) { cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, exception.getMessage()); throw cimException; } catch(...) { cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, "associatorNames() failed!"); throw cimException; } return(objectNames); }
ProviderOperationCounter DefaultProviderManager::_getProvider( const String& moduleFileName, const String& moduleName, const String& providerName) { PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::_getProvider"); ProviderMessageHandler* pr = _lookupProvider(moduleName, providerName); if (!pr->status.isInitialized()) { _initProvider(pr, moduleFileName); } AutoMutex lock(pr->status.getStatusMutex()); if (!pr->status.isInitialized()) { PEG_METHOD_EXIT(); throw PEGASUS_CIM_EXCEPTION( CIM_ERR_FAILED, "provider initialization failed"); } ProviderOperationCounter poc(pr); PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4,"Returning Provider %s", (const char*)providerName.getCString())); PEG_METHOD_EXIT(); return poc; }
void EmailListenerDestination::_writeStrToFile( const String & mailHdrStr, FILE * filePtr) { PEG_METHOD_ENTER (TRC_IND_HANDLER, "EmailListenerDestination::_writeStrToFile"); String exceptionStr; if (fprintf(filePtr, "%s\n", (const char *)mailHdrStr.getCString()) < 0) { Tracer::trace(TRC_IND_HANDLER, Tracer::LEVEL4, "Failed to write the %s to the file: %s.", (const char *)mailHdrStr.getCString(), strerror(errno)); MessageLoaderParms parms( "Handler.EmailListenerDestination.EmailListenerDestination._MSG_WRITE_TO_THE_FILE_FAILED", "Failed to write the $0 to the file: $1.", mailHdrStr, strerror(errno)); exceptionStr.append(MessageLoader::getMessage(parms)); PEG_METHOD_EXIT(); throw PEGASUS_CIM_EXCEPTION (CIM_ERR_FAILED, exceptionStr); } PEG_METHOD_EXIT(); }
void EmailListenerDestination::_openFile( FILE **filePtr, char * mailFile) { PEG_METHOD_ENTER (TRC_IND_HANDLER, "EmailListenerDestination::_openFile"); String exceptionStr; *filePtr = fopen(tmpnam(mailFile), "w"); if (*filePtr == NULL) { Tracer::trace(TRC_IND_HANDLER, Tracer::LEVEL4, "fopen of %s failed: %s.", mailFile, strerror(errno)); MessageLoaderParms parms( "Handler.EmailListenerDestination.EmailListenerDestination._MSG_FAILED_TO_OPEN_THE_FILE", "fopen of $0 failed: $1.", mailFile, strerror(errno)); exceptionStr.append(MessageLoader::getMessage(parms)); PEG_METHOD_EXIT(); throw PEGASUS_CIM_EXCEPTION (CIM_ERR_FAILED, exceptionStr); } PEG_METHOD_EXIT(); }
void OperationResponseHandler::setStatus( const Uint32 code, const String& message) { _response->cimException = PEGASUS_CIM_EXCEPTION(CIMStatusCode(code), message); }
CIMValue WMIClientRep::invokeMethod( const CIMNamespaceName& nameSpace, const CIMObjectPath& instanceName, const CIMName& methodName, const Array<CIMParamValue>& inParameters, Array<CIMParamValue>& outParameters) { CIMValue retValue; CIMException cimException; try { //Initializes the WMI Provider Interface WMIMethodProvider provider; provider.initialize(TRUE); //Performs the WMI call retValue = provider.invokeMethod( nameSpace.getString(), String::EMPTY, String::EMPTY, instanceName, methodName.getString(), inParameters, outParameters); //terminate the provider provider.terminate(); } catch(CIMException&) { throw; } catch(Exception& exception) { cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, exception.getMessage()); throw cimException; } catch(...) { cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, "invokeMethod() failed!"); throw cimException; } return(retValue); }
//async request handler method invoked on a seperate thread per provider //through the async request executor. CIMException DefaultProviderManager::_asyncRequestCallback( void *callbackPtr, AsyncRequestExecutor::AsyncRequestMsg* request) { PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "DefaultProviderManager::_asyncRequestCallback"); CIMException responseException; //extract the parameters UnloadProviderRequest* my_request = dynamic_cast<UnloadProviderRequest*>(request); if(my_request != NULL) { PEGASUS_ASSERT(0 != callbackPtr); DefaultProviderManager *dpmPtr = static_cast<DefaultProviderManager*>(callbackPtr); ProviderMessageHandler* provider = dynamic_cast<ProviderMessageHandler*>(my_request->_provider); try { AutoMutex lock(provider->status.getStatusMutex()); //unload the provider if (provider->status.isInitialized()) { dpmPtr->_unloadProvider(provider); } else { PEGASUS_ASSERT(0); } } catch (CIMException& e) { PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL1,"CIMException: %s", (const char*)e.getMessage().getCString())); responseException = e; } catch (Exception& e) { PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL1,"Exception: %s", (const char*)e.getMessage().getCString())); responseException = CIMException(CIM_ERR_FAILED, e.getMessage()); } catch (PEGASUS_STD(exception)& e) { responseException = CIMException(CIM_ERR_FAILED, e.what()); } catch (...) { PEG_TRACE_CSTRING(TRC_PROVIDERMANAGER, Tracer::LEVEL1, "Exception: Unknown"); responseException = PEGASUS_CIM_EXCEPTION( CIM_ERR_FAILED, "Unknown error."); } }
void IndicationFormatter::validateTextFormatParameters ( const CIMPropertyList & propertyList, const CIMClass & indicationClass, const Array<String> & textFormatParams) { PEG_METHOD_ENTER (TRC_IND_FORMATTER, "IndicationFormatter::validateTextFormatParameters"); Array <String> indicationClassProperties; String exceptionStr; // All the properties are selected if (propertyList.isNull ()) { for (Uint32 i = 0; i < indicationClass.getPropertyCount (); i++) { indicationClassProperties.append( indicationClass.getProperty (i).getName ().getString()); } } // partial properties are selected else { Array<CIMName> propertyNames = propertyList.getPropertyNameArray(); for (Uint32 j = 0; j < propertyNames.size(); j++) { indicationClassProperties.append(propertyNames[j].getString()); } } // check if the textFormatParams is contained in the // indicationClassProperties for (Uint32 k = 0; k < textFormatParams.size(); k++) { if (!Contains(indicationClassProperties, textFormatParams[k])) { // The property name in TextFormatParameters is not // included in the select clause of the associated filter query MessageLoaderParms parms( "IndicationFormatter.IndicationFormatter._MSG_MISS_MATCHED_PROPERTY_NAME", "The property name $0 in $1 does not match the properties in the select clause", textFormatParams[k], _PROPERTY_TEXTFORMATPARAMETERS.getString()); exceptionStr.append(MessageLoader::getMessage(parms)); PEG_METHOD_EXIT(); throw PEGASUS_CIM_EXCEPTION ( CIM_ERR_INVALID_PARAMETER, exceptionStr); } } PEG_METHOD_EXIT(); }
Array<CIMObject> WMIClientRep::execQuery( const CIMNamespaceName& nameSpace, const String& queryLanguage, const String& query) { Array<CIMObject> cimObjects; CIMException cimException; try { //Initializes the WMI Provider Interface WMIQueryProvider provider; provider.initialize(TRUE); //Performs the WMI call cimObjects = provider.execQuery( nameSpace.getString(), String::EMPTY, String::EMPTY, queryLanguage, query); //terminate the provider provider.terminate(); } catch(CIMException&) { throw; } catch(Exception& exception) { cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, exception.getMessage()); throw cimException; } catch(...) { cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, "execQuery() failed!"); throw cimException; } return(cimObjects); }
Array<CIMName> WMIClientRep::enumerateClassNames( const CIMNamespaceName& nameSpace, const CIMName& className, Boolean deepInheritance) { Array<CIMName> classNames; CIMException cimException; try { //Initializes the WMI Provider Interface WMIClassProvider provider; provider.initialize(TRUE); //Performs the WMI call classNames = provider.enumerateClassNames( nameSpace.getString(), String::EMPTY, String::EMPTY, className.getString(), deepInheritance); //terminate the provider provider.terminate(); } catch(CIMException&) { throw; } catch(Exception& exception) { cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, exception.getMessage()); throw cimException; } catch(...) { cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, "enumerateClassNames() failed!"); throw cimException; } return(classNames); }
void WMIClientRep::setProperty( const CIMNamespaceName& nameSpace, const CIMObjectPath& instanceName, const CIMName& propertyName, const CIMValue& newValue ) { CIMException cimException; try { //Initializes the WMI Provider Interface WMIInstanceProvider provider; provider.initialize(TRUE); //Performs the WMI call provider.setProperty( nameSpace.getString(), String::EMPTY, String::EMPTY, instanceName, propertyName.getString(), newValue); //terminate the provider provider.terminate(); } catch(CIMException&) { throw; } catch(Exception& exception) { cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, exception.getMessage()); throw cimException; } catch(...) { cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, "setProperty() failed!"); throw cimException; } }
void WMIClientRep::modifyInstance( const CIMNamespaceName& nameSpace, const CIMInstance& modifiedInstance, Boolean includeQualifiers, const CIMPropertyList& propertyList) { CIMException cimException; try { //Initializes the WMI Provider Interface WMIInstanceProvider provider; provider.initialize(TRUE); //Performs the WMI call provider.modifyInstance( nameSpace.getString(), String::EMPTY, String::EMPTY, modifiedInstance, includeQualifiers, propertyList); //terminate the provider provider.terminate(); } catch(CIMException&) { throw; } catch(Exception& exception) { cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, exception.getMessage()); throw cimException; } catch(...) { cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, "modifyInstance() failed!"); throw cimException; } }
CIMObjectPath WMIClientRep::createInstance( const CIMNamespaceName& nameSpace, const CIMInstance& newInstance) { CIMObjectPath instanceName; CIMException cimException; try { //Initializes the WMI Provider Interface WMIInstanceProvider provider; provider.initialize(TRUE); //Performs the WMI call instanceName = provider.createInstance( nameSpace.getString(), String::EMPTY, String::EMPTY, newInstance); //terminate the provider provider.terminate(); } catch(CIMException&) { throw; } catch(Exception& exception) { cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, exception.getMessage()); throw cimException; } catch(...) { cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, "createInstance() failed!"); throw cimException; } return (instanceName); }
CIMQualifierDecl WMIClientRep::getQualifier( const CIMNamespaceName& nameSpace, const CIMName& qualifierName) { CIMQualifierDecl cimQualifierDecl; CIMException cimException; try { //Initializes the WMI Provider Interface WMIQualifierProvider provider; provider.initialize(TRUE); //Performs the WMI call cimQualifierDecl = provider.getQualifier( nameSpace.getString(), String::EMPTY, String::EMPTY, qualifierName.getString()); //terminate the provider provider.terminate(); } catch(CIMException&) { throw; } catch(Exception& exception) { cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, exception.getMessage()); throw cimException; } catch(...) { cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, "getQualifier() failed!"); throw cimException; } return(cimQualifierDecl); }
void FQLQueryExpressionRep::_parse() { if (_queryLanguage=="DMTF:FQL") { _stmt = new FQLQueryStatement(); FQLParser::parse(_query, *_stmt); } else { PEGASUS_CIM_EXCEPTION(CIM_ERR_QUERY_LANGUAGE_NOT_SUPPORTED, _queryLanguage); } }
Array<CIMQualifierDecl> WMIClientRep::enumerateQualifiers( const CIMNamespaceName& nameSpace) { Array<CIMQualifierDecl> qualifierDeclarations; CIMException cimException; try { //Initializes the WMI Provider Interface WMIQualifierProvider provider; provider.initialize(TRUE); //Performs the WMI call qualifierDeclarations = provider.enumerateQualifiers( nameSpace.getString(), String::EMPTY, String::EMPTY); //terminate the provider provider.terminate(); } catch(CIMException&) { throw; } catch(Exception& exception) { cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, exception.getMessage()); throw cimException; } catch(...) { cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, "enumerateQualifiers() failed!"); throw cimException; } return(qualifierDeclarations); }
void WMIClientRep::modifyClass( const CIMNamespaceName& nameSpace, const CIMClass& modifiedClass) { CIMException cimException; try { //Initializes the WMI Provider Interface WMIClassProvider provider; provider.initialize(TRUE); //Performs the WMI call provider.modifyClass( nameSpace.getString(), String::EMPTY, String::EMPTY, modifiedClass); //terminate the provider provider.terminate(); } catch(CIMException&) { throw; } catch(Exception& exception) { cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, exception.getMessage()); throw cimException; } catch(...) { cimException = PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, "modifyClass() failed!"); throw cimException; } }
void CIMPropertyRep::resolve( DeclContext* declContext, const CIMNamespaceName& nameSpace, Boolean isInstancePart, Boolean propagateQualifiers) { CIMQualifierList dummy; CIMScope scope = CIMScope::PROPERTY; if (_value.getType() == CIMTYPE_REFERENCE) { scope = CIMScope::REFERENCE; // Validate that the reference class exists. CIMName referenceClassName; if (_referenceClassName.isNull()) { CIMObjectPath reference; _value.get(reference); referenceClassName = reference.getClassName(); } else { referenceClassName = _referenceClassName; } CIMClass referenceClass = declContext->lookupClass( nameSpace, referenceClassName); if (referenceClass.isUninitialized()) { throw PEGASUS_CIM_EXCEPTION( CIM_ERR_INVALID_PARAMETER, referenceClassName.getString()); } } _qualifiers.resolve( declContext, nameSpace, scope, isInstancePart, dummy, propagateQualifiers); }
CIMExportIndicationRequestMessage* CIMExportRequestDecoder::decodeExportIndicationRequest( Uint32 queueId, XmlParser& parser, const String& messageId, const String& requestUri) { CIMInstance instanceName; String destStr = requestUri.subString( requestUri.find("/CIMListener") + 12, PEG_NOT_FOUND); for (const char* name; XmlReader::getEParamValueTag(parser, name);) { if (System::strcasecmp(name, "NewIndication") == 0) { XmlReader::getInstanceElement(parser, instanceName); } else { MessageLoaderParms mlParms( "ExportServer.CIMExportRequestDecoder." "UNRECOGNIZED_EXPPARAMVALUE_NAME", "Unrecognized EXPPARAMVALUE Name $0", name); throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, mlParms); } XmlReader::expectEndTag(parser, "EXPPARAMVALUE"); } CIMExportIndicationRequestMessage* request = new CIMExportIndicationRequestMessage( messageId, destStr, instanceName, QueueIdStack(queueId, _returnQueueId)); return request; }
Uint32 test21() { const char* METHOD_NAME = "test21"; Tracer::setTraceFile(FILE4); Tracer::setTraceComponents("ALL"); Tracer::setTraceLevel(Tracer::LEVEL4); PEG_METHOD_ENTER(TRC_CONFIG, METHOD_NAME); // test tracing CIMException try { throw PEGASUS_CIM_EXCEPTION( CIM_ERR_NOT_SUPPORTED, "CIM Exception Message for Level4 in test21."); } catch (CIMException& e) { Tracer::traceCIMException(TRC_CONFIG,Tracer::LEVEL4, e); } return 0; }
PEGASUS_NAMESPACE_BEGIN /* ATTN: This method provider is used by ProviderRegistrationProvider to update InteropProvider Cache. If SLP is enabled we invoke SLPProvider's 'update' method to update registrations in this method. Note that 'updateCache' method is not defined as part of class PG_ProviderProfileCapabilities. This method is used purely for internal purpose for the communication between InteropProvider and ProviderRegistrationProvider. */ void InteropProvider::invokeMethod( const OperationContext & context, const CIMObjectPath & objectReference, const CIMName & methodName, const Array<CIMParamValue> & inParameters, MethodResultResponseHandler & handler) { if(objectReference.getNameSpace().equal (PEGASUS_NAMESPACENAME_INTEROP) && objectReference.getClassName().equal( PEGASUS_CLASSNAME_PG_PROVIDERPROFILECAPABILITIES) && methodName.equal("updateCache")) { handler.processing(); #ifdef PEGASUS_ENABLE_SLP sendUpdateRegMessageToSLPProvider(context); #endif updateProfileCache++; handler.complete(); } else { throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, objectReference.getNameSpace().getString()); } }
// // Function that determines in which namespaces a provider supports a given // class. This information is needed to properly implement the // ElementConformsToProfile association. // Array<String> findProviderNamespacesForElement( const String & moduleName, const String & providerName, const CIMName & elementClass, CIMRepository * repository, Array<CIMInstance> & providerCapabilitiesInstances) { Array<CIMInstance> capabilities; if (providerCapabilitiesInstances.size() == 0) { Array<CIMName> propList; propList.append(PROVIDERCAPABILITIES_PROPERTY_PROVIDERMODULENAME); propList.append(PROVIDERCAPABILITIES_PROPERTY_PROVIDERNAME); propList.append(PROVIDERCAPABILITIES_PROPERTY_NAMESPACES); propList.append(PROVIDERCAPABILITIES_PROPERTY_CLASSNAME); capabilities = repository->enumerateInstancesForClass( PEGASUS_NAMESPACENAME_INTEROP, PEGASUS_CLASSNAME_PROVIDERCAPABILITIES, false, false, false); } else { capabilities = providerCapabilitiesInstances; } for (Uint32 i = 0, n = capabilities.size(); i < n; ++i) { CIMInstance & currentCapabilities = capabilities[i]; Uint32 propIndex = currentCapabilities.findProperty( PROVIDERCAPABILITIES_PROPERTY_PROVIDERMODULENAME); PEGASUS_ASSERT(propIndex != PEG_NOT_FOUND); String currentName; currentCapabilities.getProperty(propIndex).getValue().get( currentName); if (currentName == moduleName) { propIndex = currentCapabilities.findProperty( PROVIDERCAPABILITIES_PROPERTY_PROVIDERNAME); PEGASUS_ASSERT(propIndex != PEG_NOT_FOUND); currentCapabilities.getProperty(propIndex).getValue().get( currentName); if (currentName == providerName) { propIndex = currentCapabilities.findProperty( PROVIDERCAPABILITIES_PROPERTY_CLASSNAME); PEGASUS_ASSERT(propIndex != PEG_NOT_FOUND); currentCapabilities.getProperty(propIndex).getValue().get( currentName); if (elementClass.equal(CIMName(currentName))) { propIndex = currentCapabilities.findProperty( PROVIDERCAPABILITIES_PROPERTY_NAMESPACES); PEGASUS_ASSERT(propIndex != PEG_NOT_FOUND); Array<String> namespaces; currentCapabilities.getProperty(propIndex).getValue().get( namespaces); return namespaces; } } } } throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_FOUND, "Could not find provider capabilities registered for module " + moduleName + ", provider " + providerName + ", and class " + elementClass.getString()); }