2 h.sterling 1.1 //
3 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
4 // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
5 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
6 // IBM Corp.; EMC Corporation, The Open Group.
7 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
8 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
9 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 // EMC Corporation; VERITAS Software Corporation; The Open Group.
|
13 h.sterling 1.1 //
14 // Permission is hereby granted, free of charge, to any person obtaining a copy
15 // of this software and associated documentation files (the "Software"), to
16 // deal in the Software without restriction, including without limitation the
17 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
18 // sell copies of the Software, and to permit persons to whom the Software is
19 // furnished to do so, subject to the following conditions:
20 //
21 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
22 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
23 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
24 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
25 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
26 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
27 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 //
30 //==============================================================================
31 //
32 // Author: Chip Vincent (cvincent@us.ibm.com)
33 //
34 h.sterling 1.1 // Modified By: Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
35 // Nitin Upasani, Hewlett-Packard Company (Nitin_Upasani@hp.com)
36 // Mike Day, IBM (mdday@us.ibm.com)
37 // Yi Zhou, Hewlett-Packard Company (yi_zhou@hp.com)
38 // Heather Sterling, IBM (hsterl@us.ibm.com)
39 //
40 //%/////////////////////////////////////////////////////////////////////////////
41
42 #include "DynamicConsumerFacade.h"
43
44 #include <Pegasus/Common/InternalException.h>
45 #include <Pegasus/Common/MessageLoader.h>
46
47
48 PEGASUS_NAMESPACE_BEGIN
49
50 class op_counter
51 {
52 public:
53 op_counter(AtomicInt *counter)
54 : _counter(counter)
55 h.sterling 1.1 {
56 (*_counter)++;
57 }
58 ~op_counter(void)
59 {
60 (*_counter)--;
61 }
62 private:
63 op_counter(void);
64 AtomicInt *_counter;
65 };
66
67
68 template<class T>
69 inline T * getInterface(CIMIndicationConsumerProvider* consumer)
70 {
71 T * p = dynamic_cast<T *>(consumer);
72
73 if(p == 0)
74 {
75 //l10n
76 h.sterling 1.1 //throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED, "Invalid provider interface.");
77 throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_NOT_SUPPORTED, MessageLoaderParms(
|
80 h.sterling 1.1 }
81
82 return(p);
83 }
84
85 DynamicConsumerFacade::DynamicConsumerFacade(CIMIndicationConsumerProvider* consumer) : _consumer(consumer)
86 {
87 }
88
89 DynamicConsumerFacade::~DynamicConsumerFacade(void)
90 {
91 }
92
93 void DynamicConsumerFacade::initialize(CIMOMHandle & cimom)
94 {
95 _consumer->initialize(cimom);
96 }
97
98 void DynamicConsumerFacade::terminate(void)
99 {
100 _consumer->terminate();
101 h.sterling 1.1 }
102
103 // CIMIndicationConsumerProvider interface
104 void DynamicConsumerFacade::consumeIndication(
105 const OperationContext & context,
106 const String & destinationPath,
107 const CIMInstance & indication)
108 {
109 op_counter ops(&_current_operations);
110
111 CIMIndicationConsumer * consumer = getInterface<CIMIndicationConsumer>(_consumer);
112
113 consumer->consumeIndication(
114 context,
115 destinationPath,
116 indication);
117 }
118
119 PEGASUS_NAMESPACE_END
120
|