version 1.3.4.1, 2004/02/17 01:35:03
|
version 1.35, 2010/08/20 12:12:01
|
|
|
//%2003//////////////////////////////////////////////////////////////////////// |
//%LICENSE//////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Development |
// Licensed to The Open Group (TOG) under one or more contributor license |
// Company, L. P., IBM Corp., The Open Group, Tivoli Systems. |
// agreements. Refer to the OpenPegasusNOTICE.txt file distributed with |
// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L. P.; |
// this work for additional information regarding copyright ownership. |
// IBM Corp.; EMC Corporation, The Open Group. |
// Each contributor licenses this file to you under the OpenPegasus Open |
// |
// Source License; you may not use this file except in compliance with the |
// Permission is hereby granted, free of charge, to any person obtaining a copy |
// License. |
// of this software and associated documentation files (the "Software"), to |
// |
// deal in the Software without restriction, including without limitation the |
// Permission is hereby granted, free of charge, to any person obtaining a |
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
// copy of this software and associated documentation files (the "Software"), |
// sell copies of the Software, and to permit persons to whom the Software is |
// to deal in the Software without restriction, including without limitation |
// furnished to do so, subject to the following conditions: |
// the rights to use, copy, modify, merge, publish, distribute, sublicense, |
// |
// and/or sell copies of the Software, and to permit persons to whom the |
// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN |
// Software is furnished to do so, subject to the following conditions: |
// 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 |
// The above copyright notice and this permission notice shall be included |
// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR |
// in all copies or substantial portions of the Software. |
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
// |
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
// 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 |
// Author: Chip Vincent (cvincent@us.ibm.com) |
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
// |
// |
// Modified By: |
////////////////////////////////////////////////////////////////////////// |
// Nag Boranna, Hewlett-Packard Company(nagaraja_boranna@hp.com) |
|
// Yi Zhou, Hewlett-Packard Company(yi_zhou@hp.com) |
|
// Jenny Yu, Hewlett-Packard Company (jenny_yu@hp.com) |
|
// Nitin Upasani, Hewlett-Packard Company (Nitin_Upasani@hp.com) |
|
// Carol Ann Krug Graves, Hewlett-Packard Company |
|
// (carolann_graves@hp.com) |
|
// Mike Day, IBM (mdday@us.ibm.com) |
|
// | // |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
|
|
#include <Pegasus/Common/Constants.h> | #include <Pegasus/Common/Constants.h> |
#include <Pegasus/Common/CIMObjectPath.h> | #include <Pegasus/Common/CIMObjectPath.h> |
#include <Pegasus/Common/Pair.h> | #include <Pegasus/Common/Pair.h> |
#include <Pegasus/Common/Triad.h> |
|
#include <Pegasus/Common/Thread.h> | #include <Pegasus/Common/Thread.h> |
#include <Pegasus/Common/HashTable.h> | #include <Pegasus/Common/HashTable.h> |
|
#include <Pegasus/Common/OperationContextInternal.h> |
| |
#include <Pegasus/ProviderManager2/ProviderManager.h> | #include <Pegasus/ProviderManager2/ProviderManager.h> |
|
#include <Pegasus/ProviderManager2/ProviderName.h> |
| |
#include <Pegasus/ProviderManager2/Default/LocalProviderManager.h> |
#include <Pegasus/ProviderManager2/Default/ProviderMessageHandler.h> |
#include <Pegasus/ProviderManager2/Default/OperationResponseHandler.h> |
#include <Pegasus/ProviderManager2/Default/Linkage.h> |
#include <Pegasus/ProviderManager2/Default/Provider.h> |
#include <Pegasus/Common/AsyncRequestExecutor.h> |
|
|
#include <Pegasus/Server/Linkage.h> |
|
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
typedef HashTable<String, |
class PEGASUS_DEFPM_LINKAGE DefaultProviderManager : public ProviderManager |
EnableIndicationsResponseHandler *, |
|
EqualFunc<String>, |
|
HashFunc<String> > IndicationResponseTable; |
|
|
|
class PEGASUS_SERVER_LINKAGE DefaultProviderManager : public ProviderManager |
|
{ | { |
public: | public: |
DefaultProviderManager(void); |
DefaultProviderManager(); |
virtual ~DefaultProviderManager(void); |
virtual ~DefaultProviderManager(); |
|
|
virtual Message * processMessage(Message * request) throw(); |
|
|
|
protected: |
|
Message * handleUnsupportedRequest(const Message * message) throw(); |
|
|
|
Message * handleGetInstanceRequest(const Message * message) throw(); |
|
Message * handleEnumerateInstancesRequest(const Message * message) throw(); |
|
Message * handleEnumerateInstanceNamesRequest(const Message * message) throw(); |
|
Message * handleCreateInstanceRequest(const Message * message) throw(); |
|
Message * handleModifyInstanceRequest(const Message * message) throw(); |
|
Message * handleDeleteInstanceRequest(const Message * message) throw(); |
|
|
|
Message * handleExecuteQueryRequest(const Message * message) throw(); |
|
|
|
Message * handleAssociatorsRequest(const Message * message) throw(); |
|
Message * handleAssociatorNamesRequest(const Message * message) throw(); |
|
Message * handleReferencesRequest(const Message * message) throw(); |
|
Message * handleReferenceNamesRequest(const Message * message) throw(); |
|
|
|
Message * handleGetPropertyRequest(const Message * message) throw(); |
|
Message * handleSetPropertyRequest(const Message * message) throw(); |
|
|
|
Message * handleInvokeMethodRequest(const Message * message) throw(); |
|
| |
Message * handleCreateSubscriptionRequest(const Message * message) throw(); |
virtual Message* processMessage(Message* message); |
Message * handleModifySubscriptionRequest(const Message * message) throw(); |
|
Message * handleDeleteSubscriptionRequest(const Message * message) throw(); |
|
Message * handleEnableIndicationsRequest(const Message * message) throw(); |
|
Message * handleDisableIndicationsRequest(const Message * message) throw(); |
|
| |
Message * handleConsumeIndicationRequest(const Message * message) throw(); |
virtual Boolean hasActiveProviders(); |
|
virtual void unloadIdleProviders(); |
| |
Message * handleDisableModuleRequest(const Message * message) throw(); |
// This function creates an instance of DefaultProviderManager. It is |
Message * handleEnableModuleRequest(const Message * message) throw(); |
// typically passed to either the ProviderManagerService constructor |
Message * handleStopAllProvidersRequest(const Message * message) throw(); |
// or the BasicProviderManagerRouter constructor as a way of decoupling |
|
// the pegprovidermanager and DefaultProviderManager libraries (otherwise |
/** |
// each library would contain a reference to the other). |
Inserts an entry into the enabled indication providers table. |
static ProviderManager* createDefaultProviderManagerCallback(); |
|
|
@param provider the provider instance |
private: |
@param handler pointer to the indication response handler |
CIMResponseMessage* _handleDisableModuleRequest( |
|
CIMRequestMessage* message); |
|
CIMResponseMessage* _handleEnableModuleRequest( |
|
CIMRequestMessage* message); |
|
CIMResponseMessage* _handleSubscriptionInitCompleteRequest( |
|
CIMRequestMessage* message); |
|
CIMResponseMessage* _handleIndicationServiceDisabledRequest( |
|
CIMRequestMessage* message); |
|
|
|
ProviderName _resolveProviderName(const ProviderIdContainer& providerId); |
|
|
|
ProviderOperationCounter _getProvider( |
|
const String& moduleFileName, |
|
const String& moduleName, |
|
const String& providerName); |
|
|
|
ProviderMessageHandler* _lookupProvider( |
|
const String& moduleName, |
|
const String& providerName); |
|
|
|
ProviderMessageHandler* _initProvider( |
|
ProviderMessageHandler* provider, |
|
const String& moduleFileName); |
|
|
|
ProviderModule* _lookupModule(const String& moduleFileName); |
|
|
|
void _shutdownAllProviders(); |
|
|
|
Sint16 _disableProvider( |
|
const String& moduleFileName, |
|
const String& providerName); |
|
|
|
/* |
|
Handler method invoked on a seperate thread per provider through |
|
a request executor to process an incoming request meant for all |
|
providers simultaneously. |
*/ | */ |
void _insertEntry(const Provider & provider, const EnableIndicationsResponseHandler *handler); |
static CIMException _asyncRequestCallback( |
|
void *callbackPtr, |
/** |
AsyncRequestExecutor::AsyncRequestMsg* request); |
Generates a String key from by combining the provider and provider |
|
module names. |
|
| |
@param provider the provider instance |
void _unloadProvider(ProviderMessageHandler* provider); |
| |
@return the generated key |
/** |
|
The _providerTableMutex must be locked whenever accessing the |
|
_providers table or the _modules table. It is okay to lock a |
|
ProviderStatus::_statusMutex while holding the _providerTableMutex, |
|
but one should never lock the _providerTableMutex while holding |
|
a ProviderStatus::_statusMutex. |
*/ | */ |
EnableIndicationsResponseHandler * _removeEntry(const String & key); |
Mutex _providerTableMutex; |
|
|
String _generateKey(const Provider & provider); |
|
| |
ProviderName _resolveProviderName(const ProviderName & providerName); |
typedef HashTable<String, ProviderMessageHandler*, |
String _resolvePhysicalName(const String & name); |
EqualFunc<String>, HashFunc<String> > ProviderTable; |
| |
protected: |
typedef HashTable<String, ProviderModule*, |
/** |
EqualFunc<String>, HashFunc<String> > ModuleTable; |
Table holding indication response handlers, one for each provider |
|
that has indications enabled. |
|
*/ |
|
IndicationResponseTable _responseTable; |
|
| |
|
ProviderTable _providers; |
|
ModuleTable _modules; |
}; | }; |
| |
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |