//%2003//////////////////////////////////////////////////////////////////////// // // 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. // // 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: Chip Vincent (cvincent@us.ibm.com) // // Modified By: // //%///////////////////////////////////////////////////////////////////////////// #ifndef Pegasus_CIMProvider_h #define Pegasus_CIMProvider_h #include #include #include #include #include #include PEGASUS_NAMESPACE_BEGIN /** Parent class for all provider interfaces.

The CIMProvider is the parent class for all provider interface types. The currently supported interfaces are:

  • {@link CIMInstanceProvider CIMInstanceProvider} - supports manipulation of CIM instances and their properties
  • {@link CIMMethodProvider CIMMethodProvider} - supports invocation of methods defined on CIM instances

A provider may inherit from either or both of these interface classes. A provider must implement every function in the chosen interface(s). However, it is not required that all operations be supported. If an operation is not supported, then a minimal implementation of the corresponding function must throw a {@link NotSupported NotSupported} exception.

\Label{mainParams}Certain parameters are passed in several of the functions in the provider interfaces. These are also described in their own sections, and include:

  • {@link OperationContext OperationContext} - contains information about the client's context, including the User ID. The provider must determine whether the specified user should be permitted to perform the operation. If the operation should not be permitted, the provider must throw an {@link AccessDenied AccessDenied} exception.
  • {@link CIMObjectPath CIMObjectPath} - specifies the CIM object on which the operation is to be performed. This parameter specifies the hostname, namespace, classname, and key values that uniquely identify an instance of a CIM object.

    hostname - specifies the name of the system on which the object resides. This is not required to be the system on which the CIM server is running, but generally will be.

    namespace - specifies the namespace on the aforementioned host in which the object resides.

    classname - specifies the class on which the requested operation is to be performed.

    keybindings - the set of key properties for the aforementioned class. The set of keys uniquely identifies a CIM instance in the host and namespace. It is permissible for clients to specify, and providers should accept, empty strings for key values when this would not be ambiguous. If the specification is ambiguous, or if a key name is invalid or missing, the provider should throw an {@link InvalidParameter InvalidParameter} exception.

  • {@link CIMInstance CIMInstance} - contains a representation of an instance of a CIM object to be used by the requested operation. This parameter should contain all of the key properties, as well as all properties necessary to perform the requested operation.
  • {@link CIMPropertyList CIMPropertyList} - specifies the properties on which this operation should be performed. The exact use of this parameter depends on the specific operation, and is described in the respective section.
  • {@link ResponseHandler ResponseHandler} - a callback handle used to return results to the CIM Server for subsequent return to the client.

Certain exceptions can be thrown by several of the functions in the provider interfaces. These are described in their own sections, and include:

  • {@link CIMNotSupportedException CIMNotSupportedException} - the operation is not supported.
  • {@link CIMInvalidParameterException CIMInvalidParameterException} - a parameter's value was invalid. This could be an unknown property or key name, an invalid flag, or other.
  • {@link CIMObjectNotFoundException CIMObjectNotFoundException} - the object specified in the {@link CIMObjectPath CIMObjectPath} parameter could not be found or does not exist.
  • {@link CIMObjectAlreadyExistsException CIMObjectAlreadyExistsException} - the object specified in a {@link createInstance createInstance} operation already exists.
  • {@link CIMAccessDeniedException CIMAccessDeniedException} - the requested operation is not permitted. This can be because the user specified in the {@link OperationContext} parameter is not authorized to perform the requested operation, or another reason.
  • {@link CIMOperationFailedException CIMOperationFailedException} - a failure occurred during processing of the operation.

The CIMProvider interface contains two functions that are inherited by all provider interfaces:

  • {@link initialize initialize} - Called before the first call to any client-requested operation; the provider should perform any processing that may be required before normal operation can begin.
  • {@link terminate terminate} - Called prior to the provider being stopped; the provider should perform any final processing that may be required.

Providers must implement these functions. A minimal implementation may simply return to the caller.

*/ class PEGASUS_PROVIDER_LINKAGE CIMProvider { public: /// CIMProvider(void); /// virtual ~CIMProvider(void); /** Perform any setup required before normal operation.

The initialize function allows the provider to conduct the necessary preparations to handle requests. It is called only once during the lifetime of the provider. This function must complete before the CIM Server invokes any other function of the provider, other than terminate.

@param cimom Reserved for future use. @exception None */ virtual void initialize(CIMOMHandle & cimom) = 0; /** Perform any cleanup required before termination.

The terminate function allows the provider to conduct the necessary preparations for termination. This function may be called by the CIM Server at any time, including initialization. Once invoked, no other provider functions are invoked until after an eventual call to initialize.

The provider may, for example, do the following in the terminate function:

  • close files or I/O streams
  • release resources such as shared memory
  • inform concurrently executing requests to complete immediately (this may be done by setting a global flag)
  • kill subprocesses
  • etc.

If the provider instance was created on the heap with new in PegasusCreateProvider, then it must be deleted in terminate:

void MyProvider::terminate()
    {
    ...
    delete this;
    ...
    return;
    }
@exception None */ virtual void terminate(void) = 0; #ifdef PEGASUS_PRESERVE_TRYTERMINATE /** Allow a provider to decline a terminate call. If the provider is unable to terminate, it should return false. Otherwise, it should call its terminate function and then return true, as in the default implementation. @exception None */ virtual Boolean tryTerminate(void) { terminate(); return true; } #endif }; #ifndef PEGASUS_REMOVE_DEPRECATED typedef CIMProvider CIMBaseProvider; #endif PEGASUS_NAMESPACE_END #endif