Array<CIMObject> CIMClientRep::references( const CIMNamespaceName& nameSpace, const CIMObjectPath& objectName, const CIMName& resultClass, const String& role, Boolean includeQualifiers, Boolean includeClassOrigin, const CIMPropertyList& propertyList ) { compareObjectPathtoCurrentConnection(objectName); AutoPtr<CIMRequestMessage> request(new CIMReferencesRequestMessage( String::EMPTY, nameSpace, objectName, resultClass, role, includeQualifiers, includeClassOrigin, propertyList, QueueIdStack())); Message* message = _doRequest(request, CIM_REFERENCES_RESPONSE_MESSAGE); CIMReferencesResponseMessage* response = (CIMReferencesResponseMessage*)message; AutoPtr<CIMReferencesResponseMessage> destroyer(response); return(response->cimObjects); }
Array<CIMObjectPath> CIMClientRep::referenceNames( const CIMNamespaceName& nameSpace, const CIMObjectPath& objectName, const CIMName& resultClass, const String& role ) { compareObjectPathtoCurrentConnection(objectName); AutoPtr<CIMRequestMessage> request(new CIMReferenceNamesRequestMessage( String::EMPTY, nameSpace, objectName, resultClass, role, QueueIdStack())); Message* message = _doRequest(request, CIM_REFERENCE_NAMES_RESPONSE_MESSAGE); CIMReferenceNamesResponseMessage* response = (CIMReferenceNamesResponseMessage*)message; AutoPtr<CIMReferenceNamesResponseMessage> destroyer(response); return(response->objectNames); }
CIMInstance CIMClientRep::getInstance( const CIMNamespaceName& nameSpace, const CIMObjectPath& instanceName, Boolean localOnly, Boolean includeQualifiers, Boolean includeClassOrigin, const CIMPropertyList& propertyList ) { compareObjectPathtoCurrentConnection(instanceName); AutoPtr<CIMRequestMessage> request(new CIMGetInstanceRequestMessage( String::EMPTY, nameSpace, instanceName, localOnly, includeQualifiers, includeClassOrigin, propertyList, QueueIdStack())); Message* message = _doRequest(request, CIM_GET_INSTANCE_RESPONSE_MESSAGE); CIMGetInstanceResponseMessage* response = (CIMGetInstanceResponseMessage*)message; AutoPtr<CIMGetInstanceResponseMessage> destroyer(response); return(response->cimInstance); }
CIMClass CIMClientRep::getClass( const CIMNamespaceName& nameSpace, const CIMName& className, Boolean localOnly, Boolean includeQualifiers, Boolean includeClassOrigin, const CIMPropertyList& propertyList ) { AutoPtr<CIMRequestMessage> request(new CIMGetClassRequestMessage( String::EMPTY, nameSpace, className, localOnly, includeQualifiers, includeClassOrigin, propertyList, QueueIdStack())); Message* message = _doRequest(request, CIM_GET_CLASS_RESPONSE_MESSAGE); CIMGetClassResponseMessage* response = (CIMGetClassResponseMessage*)message; AutoPtr<CIMGetClassResponseMessage> destroyer(response); return(response->cimClass); }
Array<CIMName> CIMClientRep::enumerateClassNames( const CIMNamespaceName& nameSpace, const CIMName& className, Boolean deepInheritance ) { AutoPtr<CIMRequestMessage> request(new CIMEnumerateClassNamesRequestMessage( String::EMPTY, nameSpace, className, deepInheritance, QueueIdStack())); Message* message = _doRequest(request, CIM_ENUMERATE_CLASS_NAMES_RESPONSE_MESSAGE); CIMEnumerateClassNamesResponseMessage* response = (CIMEnumerateClassNamesResponseMessage*)message; AutoPtr<CIMEnumerateClassNamesResponseMessage> destroyer(response); // Temporary code until internal structures use CIMName instead of String Array<CIMName> classNameArray; classNameArray.reserveCapacity(response->classNames.size()); for (Uint32 i=0; i<response->classNames.size(); i++) { classNameArray.append(response->classNames[i]); } return(classNameArray); }
Array<CIMInstance> CIMClientRep::enumerateInstances( const CIMNamespaceName& nameSpace, const CIMName& className, Boolean deepInheritance, Boolean localOnly, Boolean includeQualifiers, Boolean includeClassOrigin, const CIMPropertyList& propertyList ) { AutoPtr<CIMRequestMessage> request(new CIMEnumerateInstancesRequestMessage( String::EMPTY, nameSpace, className, deepInheritance, localOnly, includeQualifiers, includeClassOrigin, propertyList, QueueIdStack())); Message* message = _doRequest(request, CIM_ENUMERATE_INSTANCES_RESPONSE_MESSAGE); CIMEnumerateInstancesResponseMessage* response = (CIMEnumerateInstancesResponseMessage*)message; AutoPtr<CIMEnumerateInstancesResponseMessage> destroyer(response); return(response->cimNamedInstances); }
void CIMExportClient::exportIndication( const String& url, const CIMInstance& instanceName, const ContentLanguageList& contentLanguages) { PEG_METHOD_ENTER (TRC_EXPORT_CLIENT, "CIMExportClient::exportIndication()"); try { // encode request CIMRequestMessage* request = new CIMExportIndicationRequestMessage( String::EMPTY, url, instanceName, QueueIdStack(), String::EMPTY, String::EMPTY); request->operationContext.set (ContentLanguageListContainer(contentLanguages)); PEG_TRACE ((TRC_INDICATION_GENERATION, Tracer::LEVEL4, "Exporting %s Indication for destination %s:%d%s", (const char*)(instanceName.getClassName().getString(). getCString()), (const char*)(_connectHost.getCString()), _connectPortNumber, (const char*)(url.getCString()))); Message* message = _doRequest(request, CIM_EXPORT_INDICATION_RESPONSE_MESSAGE); PEG_TRACE ((TRC_INDICATION_GENERATION, Tracer::LEVEL4, "%s Indication for destination %s:%d%s exported successfully", (const char*)(instanceName.getClassName().getString(). getCString()), (const char*)(_connectHost.getCString()), _connectPortNumber, (const char*)(url.getCString()))); CIMExportIndicationResponseMessage* response = (CIMExportIndicationResponseMessage*)message; AutoPtr<CIMExportIndicationResponseMessage> ap(response); } catch (const Exception& e) { PEG_TRACE((TRC_DISCARDED_DATA, Tracer::LEVEL1, "Failed to export indication: %s", (const char*)e.getMessage().getCString())); throw; } catch (...) { PEG_TRACE_CSTRING (TRC_DISCARDED_DATA, Tracer::LEVEL1, "Failed to export indication"); throw; } PEG_METHOD_EXIT(); }
Array<CIMQualifierDecl> CIMClientRep::enumerateQualifiers( const CIMNamespaceName& nameSpace ) { AutoPtr<CIMRequestMessage> request(new CIMEnumerateQualifiersRequestMessage( String::EMPTY, nameSpace, QueueIdStack())); Message* message = _doRequest(request, CIM_ENUMERATE_QUALIFIERS_RESPONSE_MESSAGE); CIMEnumerateQualifiersResponseMessage* response = (CIMEnumerateQualifiersResponseMessage*)message; AutoPtr<CIMEnumerateQualifiersResponseMessage> destroyer(response); return(response->qualifierDeclarations); }
void CIMClientRep::setQualifier( const CIMNamespaceName& nameSpace, const CIMQualifierDecl& qualifierDeclaration ) { AutoPtr<CIMRequestMessage> request(new CIMSetQualifierRequestMessage( String::EMPTY, nameSpace, qualifierDeclaration, QueueIdStack())); Message* message = _doRequest(request, CIM_SET_QUALIFIER_RESPONSE_MESSAGE); CIMSetQualifierResponseMessage* response = (CIMSetQualifierResponseMessage*)message; AutoPtr<CIMSetQualifierResponseMessage> destroyer(response); }
void CIMClientRep::deleteQualifier( const CIMNamespaceName& nameSpace, const CIMName& qualifierName ) { AutoPtr<CIMRequestMessage> request(new CIMDeleteQualifierRequestMessage( String::EMPTY, nameSpace, qualifierName, QueueIdStack())); Message* message = _doRequest(request, CIM_DELETE_QUALIFIER_RESPONSE_MESSAGE); CIMDeleteQualifierResponseMessage* response = (CIMDeleteQualifierResponseMessage*)message; AutoPtr<CIMDeleteQualifierResponseMessage> destroyer(response); }
void CIMClientRep::createClass( const CIMNamespaceName& nameSpace, const CIMClass& newClass ) { AutoPtr<CIMRequestMessage> request(new CIMCreateClassRequestMessage( String::EMPTY, nameSpace, newClass, QueueIdStack())); Message* message = _doRequest(request, CIM_CREATE_CLASS_RESPONSE_MESSAGE); CIMCreateClassResponseMessage* response = (CIMCreateClassResponseMessage*)message; AutoPtr<CIMCreateClassResponseMessage> destroyer(response); }
void CIMClientRep::deleteClass( const CIMNamespaceName& nameSpace, const CIMName& className ) { AutoPtr<CIMRequestMessage> request(new CIMDeleteClassRequestMessage( String::EMPTY, nameSpace, className, QueueIdStack())); Message* message = _doRequest(request, CIM_DELETE_CLASS_RESPONSE_MESSAGE); CIMDeleteClassResponseMessage* response = (CIMDeleteClassResponseMessage*)message; AutoPtr<CIMDeleteClassResponseMessage> destroyer(response); }
void CIMClientRep::modifyClass( const CIMNamespaceName& nameSpace, const CIMClass& modifiedClass ) { AutoPtr<CIMRequestMessage> request(new CIMModifyClassRequestMessage( String::EMPTY, nameSpace, modifiedClass, QueueIdStack())); Message* message = _doRequest(request, CIM_MODIFY_CLASS_RESPONSE_MESSAGE); CIMModifyClassResponseMessage* response = (CIMModifyClassResponseMessage*)message; AutoPtr<CIMModifyClassResponseMessage> destroyer(response); }
void CIMClientRep::deleteInstance( const CIMNamespaceName& nameSpace, const CIMObjectPath& instanceName ) { compareObjectPathtoCurrentConnection(instanceName); AutoPtr<CIMRequestMessage> request(new CIMDeleteInstanceRequestMessage( String::EMPTY, nameSpace, instanceName, QueueIdStack())); Message* message = _doRequest(request, CIM_DELETE_INSTANCE_RESPONSE_MESSAGE); CIMDeleteInstanceResponseMessage* response = (CIMDeleteInstanceResponseMessage*)message; AutoPtr<CIMDeleteInstanceResponseMessage> destroyer(response); }
CIMQualifierDecl CIMClientRep::getQualifier( const CIMNamespaceName& nameSpace, const CIMName& qualifierName ) { AutoPtr<CIMRequestMessage> request(new CIMGetQualifierRequestMessage( String::EMPTY, nameSpace, qualifierName, QueueIdStack())); Message* message = _doRequest(request, CIM_GET_QUALIFIER_RESPONSE_MESSAGE); CIMGetQualifierResponseMessage* response = (CIMGetQualifierResponseMessage*)message; AutoPtr<CIMGetQualifierResponseMessage> destroyer(response); return(response->cimQualifierDecl); }
Array<CIMObjectPath> CIMClientRep::enumerateInstanceNames( const CIMNamespaceName& nameSpace, const CIMName& className ) { AutoPtr<CIMRequestMessage> request(new CIMEnumerateInstanceNamesRequestMessage( String::EMPTY, nameSpace, className, QueueIdStack())); Message* message = _doRequest(request, CIM_ENUMERATE_INSTANCE_NAMES_RESPONSE_MESSAGE); CIMEnumerateInstanceNamesResponseMessage* response = (CIMEnumerateInstanceNamesResponseMessage*)message; AutoPtr<CIMEnumerateInstanceNamesResponseMessage> destroyer(response); return(response->instanceNames); }
CIMObjectPath CIMClientRep::createInstance( const CIMNamespaceName& nameSpace, const CIMInstance& newInstance ) { compareObjectPathtoCurrentConnection(newInstance.getPath()); AutoPtr<CIMRequestMessage> request(new CIMCreateInstanceRequestMessage( String::EMPTY, nameSpace, newInstance, QueueIdStack())); Message* message = _doRequest(request, CIM_CREATE_INSTANCE_RESPONSE_MESSAGE); CIMCreateInstanceResponseMessage* response = (CIMCreateInstanceResponseMessage*)message; AutoPtr<CIMCreateInstanceResponseMessage> destroyer(response); return(response->instanceName); }
Array<CIMObject> CIMClientRep::execQuery( const CIMNamespaceName& nameSpace, const String& queryLanguage, const String& query ) { AutoPtr<CIMRequestMessage> request(new CIMExecQueryRequestMessage( String::EMPTY, nameSpace, queryLanguage, query, QueueIdStack())); Message* message = _doRequest(request, CIM_EXEC_QUERY_RESPONSE_MESSAGE); CIMExecQueryResponseMessage* response = (CIMExecQueryResponseMessage*)message; AutoPtr<CIMExecQueryResponseMessage> destroyer(response); return(response->cimObjects); }
void CIMClientRep::setProperty( const CIMNamespaceName& nameSpace, const CIMObjectPath& instanceName, const CIMName& propertyName, const CIMValue& newValue ) { compareObjectPathtoCurrentConnection(instanceName); AutoPtr<CIMRequestMessage> request(new CIMSetPropertyRequestMessage( String::EMPTY, nameSpace, instanceName, propertyName, newValue, QueueIdStack())); Message* message = _doRequest(request, CIM_SET_PROPERTY_RESPONSE_MESSAGE); CIMSetPropertyResponseMessage* response = (CIMSetPropertyResponseMessage*)message; AutoPtr<CIMSetPropertyResponseMessage> destroyer(response); }
void CIMClientRep::modifyInstance( const CIMNamespaceName& nameSpace, const CIMInstance& modifiedInstance, Boolean includeQualifiers, const CIMPropertyList& propertyList ) { compareObjectPathtoCurrentConnection(modifiedInstance.getPath()); AutoPtr<CIMRequestMessage> request(new CIMModifyInstanceRequestMessage( String::EMPTY, nameSpace, modifiedInstance, includeQualifiers, propertyList, QueueIdStack())); Message* message = _doRequest(request, CIM_MODIFY_INSTANCE_RESPONSE_MESSAGE); CIMModifyInstanceResponseMessage* response = (CIMModifyInstanceResponseMessage*)message; AutoPtr<CIMModifyInstanceResponseMessage> destroyer(response); }
CIMValue CIMClientRep::invokeMethod( const CIMNamespaceName& nameSpace, const CIMObjectPath& instanceName, const CIMName& methodName, const Array<CIMParamValue>& inParameters, Array<CIMParamValue>& outParameters ) { // ATTN-RK-P2-20020301: Does it make sense to have a nameSpace parameter // when the namespace should already be included in the instanceName? // ATTN-RK-P3-20020301: Do we need to make sure the caller didn't specify // a host name in the instanceName? // solved with PEP#139 Stage1 as other CIMOMs contained in the object path // will cause a TypeMisMatchException compareObjectPathtoCurrentConnection(instanceName); AutoPtr<CIMRequestMessage> request(new CIMInvokeMethodRequestMessage( String::EMPTY, nameSpace, instanceName, methodName, inParameters, QueueIdStack())); Message* message = _doRequest(request, CIM_INVOKE_METHOD_RESPONSE_MESSAGE); CIMInvokeMethodResponseMessage* response = (CIMInvokeMethodResponseMessage*)message; AutoPtr<CIMInvokeMethodResponseMessage> destroyer(response); outParameters = response->outParameters; return(response->retValue); }
Buffer WbemExecClient::issueRequest(const Buffer& request) { if (!_connected) { throw NotConnectedException(); } HTTPMessage* httpRequest = new HTTPMessage(request); // Note: A historical defect in the calculation of the Content-Length // header makes it possible that wbemexec input files exist with a // Content-Length value one larger than the actual content size. Adding // and extra newline character to the end of the message keeps those old // scripts working. httpRequest->message << "\n"; _authenticator.setRequestMessage(httpRequest); Boolean haveBeenChallenged = false; HTTPMessage* httpResponse; while (1) { HTTPMessage* httpRequestCopy = new HTTPMessage(*(HTTPMessage*)_authenticator.getRequestMessage()); _addAuthHeader(httpRequestCopy); Message* response = _doRequest(httpRequestCopy); PEGASUS_ASSERT(response->getType() == HTTP_MESSAGE); httpResponse = (HTTPMessage*)response; // If we've already been challenged or if the response does not // contain a challenge, there is nothing more to do. String startLine; Array<HTTPHeader> headers; Uint32 contentLength; httpResponse->parse(startLine, headers, contentLength); if (haveBeenChallenged || !_checkNeedToResend(headers)) { break; } // If the challenge contains a Connection: Close header, reestablish // the connection. String connectionHeader; if (HTTPMessage::lookupHeader( headers, "Connection", connectionHeader, false)) { if (String::equalNoCase(connectionHeader, "Close")) { _reconnect(); } } // Prompt for a password, if necessary if ((_password == String::EMPTY) && _isRemote) { _password = _promptForPassword(); _authenticator.setPassword(_password); } haveBeenChallenged = true; delete httpResponse; } AutoPtr<HTTPMessage> origRequest( (HTTPMessage*)_authenticator.releaseRequestMessage()); AutoPtr<HTTPMessage> destroyer(httpResponse); return httpResponse->message; }