PEP 55 Update license on source files to current license text and date
[tpot/pegasus/.git] / src / Providers / sample / RT_Indication / RT_IndicationConsumer / RT_IndicationConsumer.cpp
1 //%2003////////////////////////////////////////////////////////////////////////
2 //
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 //
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to
10 // deal in the Software without restriction, including without limitation the
11 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
12 // sell copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
14 // 
15 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
16 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
17 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
18 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
19 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
21 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 //
24 //==============================================================================
25 //
26 // Author: Nitin Upasani, Hewlett-Packard Company (Nitin_Upasani@hp.com)
27 //
28 // Modified By: Yi Zhou, Hewlett-Packard Company (yi_zhou@hp.com)
29 //
30 //%/////////////////////////////////////////////////////////////////////////////
31
32 #include <Pegasus/Common/Config.h>
33 #include <Pegasus/Provider/CIMIndicationConsumerProvider.h>
34
35 #include "RT_IndicationConsumer.h"
36
37 PEGASUS_NAMESPACE_BEGIN
38
39 PEGASUS_USING_STD;
40
41
42 RT_IndicationConsumer::RT_IndicationConsumer()
43 {
44 }
45
46 RT_IndicationConsumer::~RT_IndicationConsumer()
47 {
48 }
49
50 void RT_IndicationConsumer::initialize(CIMOMHandle& handle)
51 {
52 }
53
54 void RT_IndicationConsumer::terminate()
55 {
56 }
57
58 void RT_IndicationConsumer::consumeIndication(
59    const OperationContext & context,
60    const String& url,
61    const CIMInstance& indicationInstance)
62 {
63     String indicationID;
64     String indicationTime;
65     String methodName;
66
67     //
68     // get IndicationID
69     //
70     try
71     {
72
73         indicationID = indicationInstance.getProperty(
74                             indicationInstance.findProperty(
75                             PROPERTY_NAME_INDICATIONID)).getValue().toString();
76      }
77      catch (...)
78      {
79         indicationID = UNKNOWN;
80      }
81
82      //
83      // get IndicationTime 
84      //
85      try
86      {
87         indicationTime = indicationInstance.getProperty(
88                         indicationInstance.findProperty(
89                         PROPERTY_NAME_INDICATIONTIME)).getValue().toString();
90      }
91      catch (...)
92      {
93         indicationTime = UNKNOWN;
94      }
95
96      //
97      // get MethodName
98      //
99      try
100      {
101         indicationInstance.getProperty(indicationInstance.findProperty(
102                         PROPERTY_NAME_METHODNAME)).getValue().get(methodName);
103      }
104      catch (...)
105      {
106         methodName = UNKNOWN;
107      }
108
109     cout << "IndicationID = " << indicationID << ", IndicationTime = " <<
110         indicationTime << ", MethodName = " << methodName << endl;
111 }
112
113 PEGASUS_NAMESPACE_END