当前位置: 首页>>代码示例>>C++>>正文


C++ MethodResultResponseHandler::complete方法代码示例

本文整理汇总了C++中MethodResultResponseHandler::complete方法的典型用法代码示例。如果您正苦于以下问题:C++ MethodResultResponseHandler::complete方法的具体用法?C++ MethodResultResponseHandler::complete怎么用?C++ MethodResultResponseHandler::complete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MethodResultResponseHandler的用法示例。


在下文中一共展示了MethodResultResponseHandler::complete方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CIMNotSupportedException

void TestGroupingProvider2::invokeMethod(
    const OperationContext& context,
    const CIMObjectPath& objectReference,
    const CIMName& methodName,
    const Array<CIMParamValue>& inParameters,
    MethodResultResponseHandler& handler)
{
    if (!objectReference.getClassName().equal("Test_GroupingClass2"))
    {
        throw CIMNotSupportedException(
            objectReference.getClassName().getString());
    }

    handler.processing();
    if (methodName.equal("getNextIdentifier"))
    {
        handler.deliver(CIMValue(Uint32(getNextIdentifier())));
    }
    else if (methodName.equal("getSubscriptionCount"))
    {
         handler.deliver(CIMValue(_subscriptionCount));
    }

    handler.complete();
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:25,代码来源:TestGroupingProvider.cpp

示例2: invokeMethod

void OOPModuleFailureTestProvider::invokeMethod (
    const OperationContext & context,
    const CIMObjectPath & objectReference,
    const CIMName & methodName,
    const Array <CIMParamValue> & inParameters,
    MethodResultResponseHandler & handler)
{
    Boolean sendIndication = false;
    String identifier;
    handler.processing ();

    if (objectReference.getClassName ().equal ("FailureTestIndication") &&
        _enabled)
    {
        if (methodName.equal ("SendTestIndication"))
        {
            if ((inParameters.size() > 0) &&
                (inParameters[0].getParameterName () == "identifier"))
            {
                inParameters[0].getValue().get(identifier);
            }
            sendIndication = true;
            handler.deliver (CIMValue (0));
        }
    }
    else
    {
         handler.deliver (CIMValue (1));
         PEGASUS_STD (cout) << "Provider is not enabled." <<
         PEGASUS_STD (endl);
    }

    handler.complete ();

    if (sendIndication)
    {
        _generateIndication (_handler, identifier);
    }

    //
    //  If I am the OOPModuleInvokeFailureTestProvider, fail (i.e. exit)
    //
    if (String::equalNoCase (_providerName,
        "OOPModuleInvokeFailureTestProvider"))
    {
        if (methodName.equal ("Fail"))
        {
            exit (-1);
        }
    }
}
开发者ID:rdobson,项目名称:openpegasus,代码行数:51,代码来源:OOPModuleFailureTestProvider.cpp

示例3: invokeMethod

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());
    }
}
开发者ID:host1812,项目名称:scx_plugin_public,代码行数:37,代码来源:InteropMethodProvider.cpp

示例4: invokeMethod

//
// Invoke Method, used to modify user's password
//
void UserAuthProvider::invokeMethod(
    const OperationContext & context,
    const CIMObjectPath & ref,
    const CIMName & methodName,
    const Array<CIMParamValue> & inParams,
    MethodResultResponseHandler & handler)
{
    PEG_METHOD_ENTER(TRC_USER_MANAGER,"UserAuthProvider::invokeMethod");

    //
    // get userName
    //
    String user;
    try
    {
        IdentityContainer container = context.get(IdentityContainer::NAME);
        user= container.getUserName();
    }
    catch (...)
    {
        user= String::EMPTY;
    }
    //
    // verify user authorizations
    //
    if ( user != String::EMPTY || user != "" )
    {
        _verifyAuthorization(user);
    }

#ifndef PEGASUS_NO_PASSWORDFILE
    String            userName;
    String            password;
    String            newPassword;
    Array<CIMKeyBinding>     kbArray;

    // Begin processing the request
    handler.processing();

    // Check if the class name is PG_USER
    if (!ref.getClassName().equal (CLASS_NAME_PG_USER))
    {
        handler.complete();
        throw PEGASUS_CIM_EXCEPTION (CIM_ERR_NOT_SUPPORTED,
                                     ref.getClassName().getString());
    }

    // Check if the method name is correct
    if (!methodName.equal (METHOD_NAME_MODIFY_PASSWORD))
    {
        handler.complete();
        PEG_METHOD_EXIT();
        //l10n
        //throw PEGASUS_CIM_EXCEPTION (
        //CIM_ERR_FAILED,
        //"Unsupported method name, " + methodName.getString());
        MessageLoaderParms parms("ControlProviders.UserAuthProvider.UNSUPPORTED_METHOD_NAME",
                                 "Unsupported method name, $0",
                                 methodName.getString());
        throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,parms);
    }

    // Check if all the input parameters are passed.
    if ( inParams.size() < 2 )
    {
        handler.complete();
        PEG_METHOD_EXIT();
        //l10n
        //     throw PEGASUS_CIM_EXCEPTION( CIM_ERR_INVALID_PARAMETER,
        //                           "Input parameters are not valid.");
        MessageLoaderParms parms("ControlProviders.UserAuthProvider.INPUT_PARAMETERS_NOT_VALID",
                                 "Input parameters are not valid.");
        throw PEGASUS_CIM_EXCEPTION_L( CIM_ERR_INVALID_PARAMETER, parms);
    }

    try
    {
        kbArray = ref.getKeyBindings();

        if ( !kbArray.size() )
        {
            PEG_METHOD_EXIT();
            //l10n
            //throw PEGASUS_CIM_EXCEPTION( CIM_ERR_INVALID_PARAMETER,
            //       "Unable to find Key Property Username");
            MessageLoaderParms parms("ControlProviders.UserAuthProvider.UNABLE_TO_FIND_KEY_PROPERTY_USERNAME",
                                     "Unable to find Key Property Username");
            throw PEGASUS_CIM_EXCEPTION_L( CIM_ERR_INVALID_PARAMETER,parms);
        }

        //
        // Get the user name
        //
        if ( kbArray[0].getName() == PROPERTY_NAME_USERNAME )
        {
            userName = kbArray[0].getValue();
        }
//.........这里部分代码省略.........
开发者ID:ncultra,项目名称:Pegasus-2.5,代码行数:101,代码来源:UserAuthProvider.cpp

示例5: invokeMethod

/**
    When the "PropagateError" method is invoked, this function
    will read a CIM_Error embedded instance from the inParameters and use
    that instance to create an InstMethodIndication populating the Error[]
    property with the CIM_Error parameter and errorInstance stored in this
    class (if it's been created already). The output parameter of this method
    will contain the embedded instance received as input, and the newly
    created InstMethodIndication will be sent by the provider to any
    registered listeners.
*/
void EmbeddedInstanceProvider::invokeMethod(
        const OperationContext& context,
        const CIMObjectPath& objectReference,
        const CIMName& methodName,
        const Array<CIMParamValue>& inParameters,
        MethodResultResponseHandler& handler)
{
    // This should start sending indications with the stored Job instance
    // embedded in the InstMethodIndication
    handler.processing();
    if (!methodName.equal(CIMName("PropagateError")))
        throw CIMException(CIM_ERR_METHOD_NOT_AVAILABLE);

    if (inParameters.size() != 1)
    {
        throw CIMException(
            CIM_ERR_INVALID_PARAMETER, "Did not receive exactly 1 parameter");
    }

    CIMParamValue errorParam = inParameters[0];
    if (!String::equal(errorParam.getParameterName(), String("error")))
    {
        throw CIMException(
            CIM_ERR_INVALID_PARAMETER, "Did not find \"error\" parameter");
    }

    CIMInstance errorParamInst;
    errorParam.getValue().get(errorParamInst);
    if (errorParamInst.getPath().getClassName() != "PG_EmbeddedError")
    {
        throw CIMException(CIM_ERR_INVALID_PARAMETER);
    }
    errorParamInst.setPath(errorInstance->getPath());
    Array<CIMName> propList;
    for (unsigned int i = 0, n = errorParamInst.getPropertyCount(); i < n; i++)
    {
        propList.append(errorParamInst.getProperty(i).getName());
    }
    CIMInstance tmpErrorInstance(errorInstance->clone());
    if (!tmpErrorInstance.identical(errorParamInst))
    {
        throw Exception("Did not receive expected ErrorInstance");
    }

    // Build new indication instance
    CIMObjectPath indicationPath(System::getHostName(),
        CIMNamespaceName("test/EmbeddedInstance/Dynamic"),
        CIMName("PG_InstMethodIndication"));
    indicationInstance.reset(new CIMInstance("PG_InstMethodIndication"));
    indicationInstance->setPath(indicationPath);
    indicationInstance->addProperty(CIMProperty("MethodName",
        CIMValue(String("PropagateError"))));
    indicationInstance->addProperty(CIMProperty("PreCall",
        CIMValue(Boolean(false))));
    indicationInstance->addProperty(CIMProperty("SourceInstance",
        CIMValue(CIMObject(*errorInstance))));
    Array<CIMInstance> errorInstances;
    errorInstances.append(*errorInstance);
    errorInstances.append(*errorInstance);
    indicationInstance->addProperty(CIMProperty("Error",
        CIMValue(errorInstances)));

    handler.deliverParamValue(CIMParamValue(String("sameError"),
        CIMValue(errorParamInst)));
    handler.deliver(CIMValue(Uint32(1)));
    handler.complete();

    indicationHandler->deliver(*indicationInstance);
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:79,代码来源:EmbeddedInstanceProvider.cpp

示例6: invokeMethod

void ConfigSettingProvider::invokeMethod(
    const OperationContext & context,
    const CIMObjectPath & cimObjectPath,
    const CIMName & methodName,
    const Array<CIMParamValue> & inParams,
    MethodResultResponseHandler & handler)
{
    PEG_METHOD_ENTER(TRC_CONFIG,
        "ConfigSettingProvider::invokeMethod");

    if (!methodName.equal(METHOD_UPDATE_PROPERTY_VALUE))
    {
        throw CIMException(
            CIM_ERR_METHOD_NOT_FOUND, methodName.getString());
    }

    // Prepare the instance for modification.

    String propValue;
    Boolean resetValue = false;
    Boolean currentValueSet = false;
    Boolean plannedValueSet = false;
    Uint32 timeoutSeconds = 0;
    Array<CIMName> propertyList;

    for (Uint32 i = 0, n = inParams.size(); i < n ; ++i)
    {
        CIMName name = inParams[i].getParameterName();
        if (name.equal(PARAM_PROPERTYVALUE))
        {
            inParams[i].getValue().get(propValue);
        }
        else if (name.equal(PARAM_RESETVALUE))
        {
            inParams[i].getValue().get(resetValue);
        }
        else if (name.equal(PARAM_UPDATECURRENTVALUE))
        {
            inParams[i].getValue().get(currentValueSet);
        }
        else if (name.equal(PARAM_UPDATEPLANNEDVALUE))
        {
            inParams[i].getValue().get(plannedValueSet);
        }
        else if (name.equal(PARAM_TIMEOUTPERIOD))
        {
            inParams[i].getValue().get(timeoutSeconds);
        }
        else
        {
            throw CIMException(
                CIM_ERR_INVALID_PARAMETER, name.getString());
        }
    }

    CIMInstance modifiedInst(PG_CONFIG_SETTING);

    if (currentValueSet)
    {
        if (!resetValue)
        {
            CIMProperty prop =
                CIMProperty(CURRENT_VALUE, CIMValue(propValue));
            modifiedInst.addProperty(prop);
        }
        propertyList.append(CURRENT_VALUE);
    }

    if (plannedValueSet)
    {
        if (!resetValue)
        {
            CIMProperty prop =
                CIMProperty(PLANNED_VALUE, CIMValue(propValue));
            modifiedInst.addProperty(prop);
        }
        propertyList.append(PLANNED_VALUE);
    }

    handler.processing();

    _modifyInstance(
        context,
        cimObjectPath,
        modifiedInst,
        propertyList,
        timeoutSeconds);

    handler.deliver(CIMValue(true));
    handler.complete();

    PEG_METHOD_EXIT();
}
开发者ID:eSDK,项目名称:eSDK_OBS_API,代码行数:93,代码来源:ConfigSettingProvider.cpp


注:本文中的MethodResultResponseHandler::complete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。