exceptionprovider.cpp

来自「Pegasus is an open-source implementation」· C++ 代码 · 共 245 行

CPP
245
字号
//%2006//////////////////////////////////////////////////////////////////////////// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;// 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.// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;// EMC Corporation; VERITAS Software Corporation; The Open Group.// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;// EMC Corporation; Symantec Corporation; The Open Group.//// Permission is hereby granted, free of charge, to any person obtaining a copy// of this software and associated documentation files (the "Software"), to// deal in the Software without restriction, including without limitation the// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or// sell copies of the Software, and to permit persons to whom the Software is// furnished to do so, subject to the following conditions:// // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.////==============================================================================////%/////////////////////////////////////////////////////////////////////////////#include "ExceptionProvider.h"PEGASUS_NAMESPACE_BEGINExceptionProvider::ExceptionProvider(){}ExceptionProvider::~ExceptionProvider(){}void ExceptionProvider::initialize(CIMOMHandle& cimom){}void ExceptionProvider::terminate(){    delete this;}void _throwException(const String& exceptionType){    if (exceptionType == "CIM_Exception")    {        throw CIMException(CIM_ERR_NOT_FOUND, "test cim exception");    }    else if (exceptionType == "Regular_Exception")    {        throw Exception("test regular exception");    }    else    {        throw Uint32(1);    }}void ExceptionProvider::getInstance(    const OperationContext& context,    const CIMObjectPath& instanceReference,    const Boolean includeQualifiers,    const Boolean includeClassOrigin,    const CIMPropertyList& propertyList,    InstanceResponseHandler& handler){    _throwException(instanceReference.getClassName().getString());}void ExceptionProvider::enumerateInstances(    const OperationContext& context,    const CIMObjectPath& classReference,    const Boolean includeQualifiers,    const Boolean includeClassOrigin,    const CIMPropertyList& propertyList,    InstanceResponseHandler& handler){    _throwException(classReference.getClassName().getString());}void ExceptionProvider::enumerateInstanceNames(    const OperationContext& context,    const CIMObjectPath& classReference,    ObjectPathResponseHandler& handler){    _throwException(classReference.getClassName().getString());}void ExceptionProvider::modifyInstance(    const OperationContext& context,    const CIMObjectPath& instanceReference,    const CIMInstance& instanceObject,    const Boolean includeQualifiers,    const CIMPropertyList& propertyList,    ResponseHandler& handler){    _throwException(instanceReference.getClassName().getString());}void ExceptionProvider::createInstance(    const OperationContext& context,    const CIMObjectPath& instanceReference,    const CIMInstance& instanceObject,    ObjectPathResponseHandler& handler){    _throwException(instanceReference.getClassName().getString());}void ExceptionProvider::deleteInstance(    const OperationContext& context,    const CIMObjectPath& instanceReference,    ResponseHandler& handler){    _throwException(instanceReference.getClassName().getString());}void ExceptionProvider::execQuery(    const OperationContext& context,    const CIMObjectPath& nameSpaceAndClass,    const QueryExpression& query,    InstanceResponseHandler& handler){    _throwException(nameSpaceAndClass.getClassName().getString());}void ExceptionProvider::associators(    const OperationContext& context,    const CIMObjectPath& objectName,    const CIMName& associationClass,    const CIMName& resultClass,    const String& role,    const String& resultRole,    const Boolean includeQualifiers,    const Boolean includeClassOrigin,    const CIMPropertyList& propertyList,    ObjectResponseHandler& handler){    _throwException(objectName.getClassName().getString());}void ExceptionProvider::associatorNames(    const OperationContext& context,    const CIMObjectPath& objectName,    const CIMName& associationClass,    const CIMName& resultClass,    const String& role,    const String& resultRole,    ObjectPathResponseHandler& handler){    _throwException(objectName.getClassName().getString());}void ExceptionProvider::references(    const OperationContext& context,    const CIMObjectPath& objectName,    const CIMName& resultClass,    const String& role,    const Boolean includeQualifiers,    const Boolean includeClassOrigin,    const CIMPropertyList& propertyList,    ObjectResponseHandler& handler){    _throwException(objectName.getClassName().getString());}void ExceptionProvider::referenceNames(    const OperationContext& context,    const CIMObjectPath& objectName,    const CIMName& resultClass,    const String& role,    ObjectPathResponseHandler& handler){    _throwException(objectName.getClassName().getString());}void ExceptionProvider::invokeMethod(    const OperationContext& context,    const CIMObjectPath& objectReference,    const CIMName& methodName,    const Array<CIMParamValue>& inParameters,    MethodResultResponseHandler& handler){    _throwException(objectReference.getClassName().getString());}void ExceptionProvider::enableIndications(IndicationResponseHandler& handler){}void ExceptionProvider::disableIndications(){}void ExceptionProvider::createSubscription(    const OperationContext& context,    const CIMObjectPath& subscriptionName,    const Array<CIMObjectPath>& classNames,    const CIMPropertyList& propertyList,    const Uint16 repeatNotificationPolicy){    _throwException(subscriptionName.getClassName().getString());}void ExceptionProvider::modifySubscription(    const OperationContext& context,    const CIMObjectPath& subscriptionName,    const Array<CIMObjectPath>& classNames,    const CIMPropertyList& propertyList,    const Uint16 repeatNotificationPolicy){    _throwException(subscriptionName.getClassName().getString());}void ExceptionProvider::deleteSubscription(    const OperationContext& context,    const CIMObjectPath& subscriptionName,    const Array<CIMObjectPath>& classNames){    _throwException(subscriptionName.getClassName().getString());}// CIMIndicationConsumerProvider interfacevoid ExceptionProvider::consumeIndication(    const OperationContext& context,    const String& destinationPath,    const CIMInstance& indication){    _throwException(destinationPath);}PEGASUS_NAMESPACE_END

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?