//%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. // //============================================================================== // //%///////////////////////////////////////////////////////////////////////////// #ifndef Pegasus_IndicationOperationAggregate_h #define Pegasus_IndicationOperationAggregate_h #include #include #include #include #include #include #include #include "ProviderClassList.h" PEGASUS_NAMESPACE_BEGIN /** IndicationOperationAggregate is the class that manages the aggregation of indication provider responses to requests sent by the IndicationService. This class is modeled on the OperationAggregate class used by the CIMOperationRequestDispatcher. @author Hewlett-Packard Company */ class PEGASUS_SERVER_LINKAGE IndicationOperationAggregate { public: /** Constructs an IndicationOperationAggregate instance. @param origRequest the original request, if any, received by the Indication Service @param indicationSubclasses the list of indication subclasses for the subscription */ IndicationOperationAggregate( CIMRequestMessage* origRequest, const Array& indicationSubclasses); ~IndicationOperationAggregate(); /** Gets the original request, if any, received by the IndicationService for this aggregation. The original request may be Create Instance, Modify Instance, or Delete Instance. In the cases of Deletion of an Expired or Referencing Subscription, there is no original request. @return a pointer to the request, if there is a request 0, otherwise */ CIMRequestMessage* getOrigRequest() const; /** Gets the message type of the original request, if any, received by the IndicationService. @return the request type, if there is a request 0, otherwise */ Uint32 getOrigType() const; /** Determines if the original request requires a response, based on the type of the original request. Create Instance, Modify Instance, and Delete Instance requests require a response. @return TRUE, if original request requires a response FALSE, otherwise */ Boolean requiresResponse() const; /** Gets the list of indication subclasses for the subscription. @return the list of indication subclasses */ Array& getIndicationSubclasses(); /** Gets the number of requests to be issued for this aggregation. @return number of requests to be issued */ Uint32 getNumberIssued() const; /** Sets the number of requests to be issued for this aggregation. Note: It is the responsibility of the caller to set the number of requests correctly. @param i the number of requests */ void setNumberIssued(Uint32 i); /** Appends a new response to the response list for this aggregation. Note: The _appendResponseMutex is used to synchronize appending of responses by multiple threads. Note: The correctness of the return value from this method depends on the caller having correctly set the number of requests with the setNumberIssued() method. @param response the response @return TRUE, if all expected responses have now been received FALSE, otherwise */ Boolean appendResponse(CIMResponseMessage* response); /** Gets the count of responses received for this aggregation. @return count of responses received */ Uint32 getNumberResponses() const; /** Gets the response at the specified position in the list for this aggregation. Note: It is the responsibility of the caller to ensure that all threads are done using the appendResponse() method before any thread uses the getResponse() method. @return a pointer to the response */ CIMResponseMessage* getResponse(Uint32 pos) const; /** Appends a new request to the request list for this aggregation. Note: The _appendRequestMutex is used to synchronize appending of requests by multiple threads. @param request the request */ void appendRequest(CIMRequestMessage* request); /** Gets the count of requests issued for this aggregation. @return count of requests issued */ Uint32 getNumberRequests() const; /** Gets the request at the specified position in the list for this aggregation. Note: It is the responsibility of the caller to ensure that all threads are done using the appendRequest() method before any thread uses the getRequest() method. @return a pointer to the request */ CIMRequestMessage* getRequest(Uint32 pos) const; /** Finds the provider that sent the response with the specified message ID. Note: It is the responsibility of the caller to ensure that all threads are done using the appendRequest() method before any thread uses the findProvider() method. @return a ProviderClassList struct for the provider that sent the response */ ProviderClassList findProvider(const String& messageId) const; private: /** Hidden (unimplemented) default constructor */ IndicationOperationAggregate(); /** Hidden (unimplemented) copy constructor */ IndicationOperationAggregate(const IndicationOperationAggregate& x); /** Hidden (unimplemented) assignment operator */ IndicationOperationAggregate& operator==( const IndicationOperationAggregate& x); CIMRequestMessage* _origRequest; Array _indicationSubclasses; Uint32 _numberIssued; Array _requestList; Mutex _appendRequestMutex; Array _responseList; Mutex _appendResponseMutex; Magic<0x872FB41C> _magic; }; PEGASUS_NAMESPACE_END #endif /* Pegasus_IndicationOperationAggregate_h */