1 mike 1.2 //%/////////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (c) 2000, 2001 BMC Software, Hewlett Packard, IBM, The Open Group,
4 // Tivoli Systems
5 //
6 // Permission is hereby granted, free of charge, to any person obtaining a copy
7 // of this software and associated documentation files (the "Software"), to
8 // deal in the Software without restriction, including without limitation the
9 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 // sell copies of the Software, and to permit persons to whom the Software is
11 // furnished to do so, subject to the following conditions:
12 //
13 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
14 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
15 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
16 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
17 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
18 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
19 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 //
22 mike 1.2 //==============================================================================
23 //
24 // Author: Nitin Upasani, Hewlett-Packard Company (Nitin_Upasani@hp.com)
25 //
26 // Modified By:
27 //
28 //%/////////////////////////////////////////////////////////////////////////////
29
30 #include <Pegasus/Common/Config.h>
|
33 mike 1.2 #include <iostream>
34 #include <Pegasus/ExportClient/CIMExportClient.h>
35 #include <Pegasus/Handler/CIMHandler.h>
36 #include <Pegasus/Repository/CIMRepository.h>
37
38 PEGASUS_NAMESPACE_BEGIN
39
40 PEGASUS_USING_STD;
41
42 //#define DDD(X) X
43 #define DDD(X) // X
44
45 DDD(static const char* _CIMXMLINDICATIONHANDLER = "CIMxmlIndicationHandler::";)
46
47 class PEGASUS_HANDLER_LINKAGE CIMxmlIndicationHandler: public CIMHandler
48 {
49 public:
50
51 CIMxmlIndicationHandler()
52 {
53 DDD(cout << _CIMXMLINDICATIONHANDLER << "CIMxmlIndicationHandler()" << endl;)
54 mike 1.2 }
55
56 virtual ~CIMxmlIndicationHandler()
57 {
58 DDD(cout << _CIMXMLINDICATIONHANDLER << "~CIMxmlIndicationHandler()" << endl;)
59 }
60
61 void initialize(CIMRepository* repository)
62 {
63 DDD(cout << _CIMXMLINDICATIONHANDLER << "initialize()" << endl;)
64 }
65
66 void terminate()
67 {
68 DDD(cout << _CIMXMLINDICATIONHANDLER << "terminate()" << endl;)
69 }
70
71 void handleIndication(
72 CIMInstance& indicationHandlerInstance,
73 CIMInstance& indicationInstance,
74 String nameSpace)
75 mike 1.2 {
76 //get destination for the indication
77 Uint32 pos = indicationHandlerInstance.findProperty("destination");
78 if (pos == PEG_NOT_FOUND)
79 {
80 // ATTN: Deal with a malformed handler instance
81 }
82
83 CIMProperty prop = indicationHandlerInstance.getProperty(pos);
84
85 String dest;
86 try
87 {
88 prop.getValue().get(dest);
89 }
90 catch (TypeMismatch& e)
91 {
92 // ATTN: Deal with a malformed handler instance
93 }
94
95 try
96 mike 1.2 {
97 Monitor* monitor = new Monitor;
98 HTTPConnector* httpConnector = new HTTPConnector(monitor);
99 CIMExportClient exportclient(monitor, httpConnector);
|