Exemple #1
0
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);
}
Exemple #2
0
Array<CIMClass> WMIClientRep::enumerateClasses(
    const CIMNamespaceName& nameSpace,
    const CIMName& className,
    Boolean deepInheritance,
    Boolean localOnly,
    Boolean includeQualifiers,
    Boolean includeClassOrigin)
{
    Array<CIMClass> cimClasses;
	CIMException cimException;

	try
	{
		//Initializes the WMI Provider Interface
    	WMIClassProvider provider;
		provider.initialize(TRUE);

		//Performs the WMI call
		cimClasses = provider.enumerateClasses(
			nameSpace.getString(),
			String::EMPTY,
			String::EMPTY,
			className.getString(),
			deepInheritance,
			localOnly,
			includeQualifiers,
			includeClassOrigin);

		//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, "enumerateClasses() failed!");
		throw cimException;
	}

	return(cimClasses);
}
Exemple #3
0
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;
	}
}
Exemple #4
0
/////////////////////////////////////////////////////////////////////////////
// WMIBaseProvider::getCIMClass - retrieves a CIMClass object
//
// ///////////////////////////////////////////////////////////////////////////
CIMClass WMIBaseProvider::getCIMClass(const String& nameSpace,
										const String& userName,
										const String& password,
										const String& className,
										const CIMPropertyList &propertyList)
{
	CIMClass cimClass;
	CIMStatusCode errorCode = CIM_ERR_SUCCESS;
	String errorDescription;
	WMIClassProvider provider;

	PEG_METHOD_ENTER(TRC_WMIPROVIDER,"WMIBaseProvider::getCIMClass()");

	try
	{
        // This fix uses the current boolean value stored in collector
        // to initialize it. 
        provider.initialize(_collector->isLocalConnection()); 

		cimClass = provider.getClass(nameSpace, userName, password, className, false, true, true, 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 cimClass;
}