⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cimmanagedclient.cpp

📁 Pegasus is an open-source implementationof the DMTF CIM and WBEM standards. It is designed to be por
💻 CPP
📖 第 1 页 / 共 2 页
字号:
//%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.////==============================================================================// Author: Mike Brasher (mbrasher@bmc.com)//         Marek Szermutzky (MSzermutzky@de.ibm.com) PEP#139 Stage2//// Modified By: Nitin Upasani, Hewlett-Packard Company (Nitin_Upasani@hp.com)//              Yi Zhou, Hewlett-Packard Company (yi_zhou@hp.com)//              Nag Boranna, Hewlett-Packard Company (nagaraja_boranna@hp.com)//              Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)//              Carol Ann Krug Graves, Hewlett-Packard Company//                  (carolann_graves@hp.com)//              Jair Santos, Hewlett-Packard Company (jair.santos@hp.com)//              David Dillard, VERITAS Software Corp.//                  (david.dillard@veritas.com)////%/////////////////////////////////////////////////////////////////////////////#include "CIMManagedClient.h"PEGASUS_NAMESPACE_BEGIN// class constructorCIMManagedClient::CIMManagedClient(){    // *shrugs*    // using this constructor doesn't seem to clever    // remind, if you use it, don't forget to set the ConnectionManager    // via setConnectionManager()    setPegasusDefaultPort();    _cccm = 0;}CIMManagedClient::CIMManagedClient(CIMClientConnectionManager* cccm){    CDEBUG("Using given CIMClientConnectionManager*");    setPegasusDefaultPort();    _cccm = cccm;}void CIMManagedClient::setConnectionManager(CIMClientConnectionManager* cccm){    // delete _cccm;    _cccm = cccm;}CIMClientConnectionManager* CIMManagedClient::getConnectionManager(void){    return _cccm;}CIMManagedClient::~CIMManagedClient(){    // ubs, we shouldn't delete the ClientConnectionManager,    // as we don't know what it is anyway    // delete _cccm;}// l10n startvoid CIMManagedClient::setRequestAcceptLanguages(    const String& host,    const String& port,    const AcceptLanguageList& langs){    CIMClientRep * _rep;    _rep = getTargetCIMOM(host, port, CIMNamespaceName());    _rep->setRequestAcceptLanguages(langs);}AcceptLanguageList CIMManagedClient::getRequestAcceptLanguages(    const String& host,    const String& port) const{    CIMClientRep * _rep;    _rep = getTargetCIMOM(host, port, CIMNamespaceName());    return _rep->getRequestAcceptLanguages();}void CIMManagedClient::setRequestContentLanguages(    const String& host,    const String& port,    const ContentLanguageList& langs){    CIMClientRep * _rep;    _rep = getTargetCIMOM(host, port, CIMNamespaceName());    _rep->setRequestContentLanguages(langs);}ContentLanguageList CIMManagedClient::getRequestContentLanguages(const String& host, const String& port) const{    CIMClientRep * _rep;    _rep = getTargetCIMOM(host, port, CIMNamespaceName());    return _rep->getRequestContentLanguages();}ContentLanguageList CIMManagedClient::getResponseContentLanguages(const String& host, const String& port) const{    CIMClientRep * _rep;    _rep = getTargetCIMOM(host, port, CIMNamespaceName());    return _rep->getResponseContentLanguages();}void CIMManagedClient::setRequestDefaultLanguages(const String& host, const String& port){    CIMClientRep * _rep;    _rep = getTargetCIMOM(host, port, CIMNamespaceName());    _rep->setRequestDefaultLanguages();}// l10n endArray<CIMObjectPath> CIMManagedClient::enumerateInstanceNames(    const String& host,    const String& port,    const CIMNamespaceName& nameSpace,    const CIMName& className){    // test if host and namespace are provided    hasHostandNameSpace(host, nameSpace);    CIMClientRep *   _rep;    _rep = getTargetCIMOM(host, port, nameSpace);    Array<CIMObjectPath> returnedInstanceNames = _rep->enumerateInstanceNames(nameSpace, className);    for (Uint32 i = 0; i < returnedInstanceNames.size(); i++)    {        returnedInstanceNames[i].setHost(_getHostwithPort(host, port));        returnedInstanceNames[i].setNameSpace(nameSpace);    }    return returnedInstanceNames;}Array<CIMInstance> CIMManagedClient::enumerateInstances(    const String& host,    const String& port,    const CIMNamespaceName& nameSpace,    const CIMName& className,    Boolean deepInheritance,    Boolean localOnly,    Boolean includeQualifiers,    Boolean includeClassOrigin,    const CIMPropertyList& propertyList){    // test if host and namespace are provided    hasHostandNameSpace(host, nameSpace);    CIMClientRep *   _rep;    _rep = getTargetCIMOM(host, port, nameSpace);    Array<CIMInstance> returnedNamedInstances = _rep->enumerateInstances(        nameSpace,        className,        deepInheritance,        localOnly,        includeQualifiers,        includeClassOrigin,        propertyList);	// adding host, port and namespace to every Instance to make sure object path is	// full specified	for (Uint32 i = 0; i < returnedNamedInstances.size(); i++)	{		CIMObjectPath chgObjectPath = CIMObjectPath(returnedNamedInstances[i].getPath());		chgObjectPath.setHost(_getHostwithPort(host, port));		chgObjectPath.setNameSpace(nameSpace);		returnedNamedInstances[i].setPath(chgObjectPath);	}	return returnedNamedInstances;}Array<CIMObject> CIMManagedClient::execQuery(	const String& host,	const String& port,    const CIMNamespaceName& nameSpace,    const String& queryLanguage,    const String& query){	// test if host and namespace are provided	hasHostandNameSpace(host, nameSpace);	CIMClientRep *   _rep;	_rep = getTargetCIMOM(host, port, nameSpace);	Array<CIMObject> returnedCimObjects = _rep->execQuery(        nameSpace,        queryLanguage,        query);	// check if all objects contain a full specified object path	for (Uint32 i = 0; i < returnedCimObjects.size(); i++)	{		CIMObjectPath chgObjectPath = CIMObjectPath(returnedCimObjects[i].getPath());		// if there is no cimom and no namespace specified, set the current as default		// if there is no namespace, but a cimom specified, add the current namespace		// if there is no cimom, but a namespace specified, add the current cimom		// if there are both cimom and namespace specified, do nothing		// thus, only do something if either cimom or namespace is missing		// test for empty cimom		if (chgObjectPath.getHost() == String::EMPTY)		{			chgObjectPath.setHost(_getHostwithPort(host, port));		}		// test for empty namespace		if (chgObjectPath.getNameSpace().isNull())		{			chgObjectPath.setNameSpace(nameSpace);		}		returnedCimObjects[i].setPath(chgObjectPath);	}	return returnedCimObjects;}Array<CIMClass> CIMManagedClient::enumerateClasses(	const String& host,	const String& port,    const CIMNamespaceName& nameSpace,    const CIMName& className,    Boolean deepInheritance,    Boolean localOnly,    Boolean includeQualifiers,    Boolean includeClassOrigin){	// test if host and namespace are provided	hasHostandNameSpace(host, nameSpace);	CIMClientRep *   _rep;	_rep = getTargetCIMOM(host, port, nameSpace);	Array<CIMClass> returnedCimClasses = _rep->enumerateClasses(        nameSpace,        className,        deepInheritance,        localOnly,        includeQualifiers,        includeClassOrigin); 	// adding host, port and namespace to every Instance to make sure object path is	// full specified	for (Uint32 i = 0; i < returnedCimClasses.size(); i++)	{		CIMObjectPath chgObjectPath = CIMObjectPath(returnedCimClasses[i].getPath());		chgObjectPath.setHost(_getHostwithPort(host,port));		chgObjectPath.setNameSpace(nameSpace);		returnedCimClasses[i].setPath(chgObjectPath);	}	return returnedCimClasses;}Array<CIMName> CIMManagedClient::enumerateClassNames(	const String& host,	const String& port,    const CIMNamespaceName& nameSpace,    const CIMName& className,    Boolean deepInheritance){	// test if host and namespace are provided	hasHostandNameSpace(host, nameSpace);	CIMClientRep *   _rep;	_rep = getTargetCIMOM(host, port, nameSpace);    return _rep->enumerateClassNames(        nameSpace,        className,        deepInheritance);}CIMClass CIMManagedClient::getClass(	const String& host,	const String& port,    const CIMNamespaceName& nameSpace,    const CIMName& className,    Boolean localOnly,    Boolean includeQualifiers,    Boolean includeClassOrigin,    const CIMPropertyList& propertyList){	// test if host and namespace are provided	hasHostandNameSpace(host, nameSpace);	CIMClientRep *   _rep;	_rep = getTargetCIMOM(host, port, nameSpace);    CIMClass returnedCimClass = _rep->getClass(        nameSpace,        className,        localOnly,        includeQualifiers,        includeClassOrigin,        propertyList);	CIMObjectPath chgObjectPath = CIMObjectPath(returnedCimClass.getPath());	chgObjectPath.setHost(_getHostwithPort(host, port));	chgObjectPath.setNameSpace(nameSpace);	returnedCimClass.setPath(chgObjectPath);	return returnedCimClass;}void CIMManagedClient::createClass(	const String& host,	const String& port,    const CIMNamespaceName& nameSpace,    const CIMClass& newClass){	// test if host and namespace are provided	hasHostandNameSpace(host, nameSpace);	CIMClientRep *   _rep;	_rep = getTargetCIMOM(host, port, nameSpace);    _rep->createClass(        nameSpace,        newClass);}void CIMManagedClient::deleteClass(	const String& host,	const String& port,    const CIMNamespaceName& nameSpace,    const CIMName& className){	// test if host and namespace are provided	hasHostandNameSpace(host, nameSpace);	CIMClientRep *   _rep;	_rep = getTargetCIMOM(host, port, nameSpace);    _rep->deleteClass(        nameSpace,        className);}void CIMManagedClient::deleteQualifier(	const String& host,	const String& port,    const CIMNamespaceName& nameSpace,    const CIMName& qualifierName){	// test if host and namespace are provided	hasHostandNameSpace(host, nameSpace);	CIMClientRep *   _rep;	_rep = getTargetCIMOM(host, port, nameSpace);    _rep->deleteQualifier(        nameSpace,        qualifierName);}CIMQualifierDecl CIMManagedClient::getQualifier(	const String& host,	const String& port,    const CIMNamespaceName& nameSpace,    const CIMName& qualifierName){	// test if host and namespace are provided	hasHostandNameSpace(host, nameSpace);	CIMClientRep *   _rep;	_rep = getTargetCIMOM(host, port, nameSpace);    return _rep->getQualifier(        nameSpace,        qualifierName);}Array<CIMQualifierDecl> CIMManagedClient::enumerateQualifiers(	const String& host,	const String& port,    const CIMNamespaceName& nameSpace){	// test if host and namespace are provided	hasHostandNameSpace(host, nameSpace);	CIMClientRep *   _rep;	_rep = getTargetCIMOM(host, port, nameSpace);    return _rep->enumerateQualifiers(        nameSpace);}void CIMManagedClient::modifyClass(	const String& host,	const String& port,    const CIMNamespaceName& nameSpace,    const CIMClass& modifiedClass){	// test if host and namespace are provided

⌨️ 快捷键说明

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