1 martin 1.6 //%LICENSE////////////////////////////////////////////////////////////////
|
2 martin 1.7 //
|
3 martin 1.6 // Licensed to The Open Group (TOG) under one or more contributor license
4 // agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
5 // this work for additional information regarding copyright ownership.
6 // Each contributor licenses this file to you under the OpenPegasus Open
7 // Source License; you may not use this file except in compliance with the
8 // License.
|
9 martin 1.7 //
|
10 martin 1.6 // Permission is hereby granted, free of charge, to any person obtaining a
11 // copy of this software and associated documentation files (the "Software"),
12 // to deal in the Software without restriction, including without limitation
13 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 // and/or sell copies of the Software, and to permit persons to whom the
15 // Software is furnished to do so, subject to the following conditions:
|
16 martin 1.7 //
|
17 martin 1.6 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
|
19 martin 1.7 //
|
20 martin 1.6 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
21 martin 1.7 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
22 martin 1.6 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24 // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
27 martin 1.7 //
|
28 martin 1.6 //////////////////////////////////////////////////////////////////////////
|
29 h.sterling 1.1 //
30 // Author: Chip Vincent (cvincent@us.ibm.com)
31 //
32 // Modified By: Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
33 // Nitin Upasani, Hewlett-Packard Company (Nitin_Upasani@hp.com)
34 // Mike Day, IBM (mdday@us.ibm.com)
35 // Yi Zhou, Hewlett-Packard Company (yi_zhou@hp.com)
36 // Heather Sterling, IBM (hsterl@us.ibm.com)
37 //
38 //%/////////////////////////////////////////////////////////////////////////////
39
40 #include "DynamicConsumerFacade.h"
41
42 #include <Pegasus/Common/InternalException.h>
43 #include <Pegasus/Common/MessageLoader.h>
44
45
46 PEGASUS_NAMESPACE_BEGIN
47
48 class op_counter
49 {
50 h.sterling 1.1 public:
51 op_counter(AtomicInt *counter)
52 : _counter(counter)
53 {
54 (*_counter)++;
55 }
56 ~op_counter(void)
57 {
58 (*_counter)--;
59 }
60 private:
61 op_counter(void);
62 AtomicInt *_counter;
63 };
64
65
66 template<class T>
67 inline T * getInterface(CIMIndicationConsumerProvider* consumer)
68 {
69 T * p = dynamic_cast<T *>(consumer);
70
71 h.sterling 1.1 if(p == 0)
72 {
73 //l10n
|
74 marek 1.5 //throw PEGASUS_CIM_EXCEPTION(
75 // CIM_ERR_NOT_SUPPORTED,
76 // "Invalid provider interface.");
77 throw PEGASUS_CIM_EXCEPTION_L(
78 CIM_ERR_NOT_SUPPORTED,
79 MessageLoaderParms(
80 "ProviderManager.ProviderFacade.INVALID_PROVIDER_INTERFACE",
81 "Provider interface is not valid."));
|
82 h.sterling 1.1 }
83
84 return(p);
85 }
86
|
87 marek 1.5 DynamicConsumerFacade::DynamicConsumerFacade(
88 CIMIndicationConsumerProvider* consumer) : _consumer(consumer)
|
89 h.sterling 1.1 {
90 }
91
92 DynamicConsumerFacade::~DynamicConsumerFacade(void)
93 {
94 }
95
96 void DynamicConsumerFacade::initialize(CIMOMHandle & cimom)
97 {
98 _consumer->initialize(cimom);
99 }
100
101 void DynamicConsumerFacade::terminate(void)
102 {
103 _consumer->terminate();
104 }
105
106 // CIMIndicationConsumerProvider interface
107 void DynamicConsumerFacade::consumeIndication(
108 const OperationContext & context,
109 const String & destinationPath,
110 h.sterling 1.1 const CIMInstance & indication)
111 {
112 op_counter ops(&_current_operations);
113
|
114 marek 1.5 CIMIndicationConsumer * consumer = getInterface<CIMIndicationConsumer>
115 (_consumer);
|
116 h.sterling 1.1
117 consumer->consumeIndication(
118 context,
119 destinationPath,
120 indication);
121 }
122
123 PEGASUS_NAMESPACE_END
124
|