~scarneiro/ubuntu/oneiric/opendrim-lmp-recordlog/fix-for-756108

« back to all changes in this revision

Viewing changes to OpenDRIM_RecordLog/cmpiOpenDRIM_RecordLog.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Guillaume BOTTEX
  • Date: 2009-08-19 17:08:36 UTC
  • Revision ID: james.westby@ubuntu.com-20090819170836-4pdxix40ulw5xqds
Tags: upstream-1.1.1
ImportĀ upstreamĀ versionĀ 1.1.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*###############################################################################
 
2
# Linux Management Providers (LMP), OpenDRIM_RecordLogPackage provider package
 
3
# Copyright (C) 2007 Ilsoo Byun, ETRI <widepis@etri.re.kr, widepis@empal.com>
 
4
 
5
# This program is being developed under the "OpenDRIM" project.
 
6
# The "OpenDRIM" project web page: http://opendrim.sourceforge.net
 
7
# The "OpenDRIM" project mailing list: opendrim@googlegroups.com
 
8
 
9
# This program is free software; you can redistribute it and/or
 
10
# modify it under the terms of the GNU General Public License
 
11
# as published by the Free Software Foundation; version 2
 
12
# of the License.
 
13
 
14
# This program is distributed in the hope that it will be useful,
 
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
# GNU General Public License for more details.
 
18
 
19
# You should have received a copy of the GNU General Public License
 
20
# along with this program; if not, write to the Free Software
 
21
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
22
#################################################################################
 
23
 
 
24
#################################################################################
 
25
# To contributors, please leave your contact information in this section
 
26
# AND comment your changes in the source code.
 
27
 
28
# Modified by 2008 Guillaume BOTTEX, ETRI <guillaumebottex@etri.re.kr, guillaumebottex@gmail.com>
 
29
###############################################################################*/
 
30
 
 
31
#include "cmpiOpenDRIM_RecordLog.h"
 
32
 
 
33
CMPIObjectPath* OpenDRIM_RecordLogPackage_OpenDRIM_RecordLog_toCMPIObjectPath(const CMPIBroker* broker, const OpenDRIM_RecordLog& instance) {
 
34
        _E_;
 
35
        Objectpath op(broker, OpenDRIM_RecordLog_classnames[0], OpenDRIM_RecordLog_NAMESPACE);
 
36
 
 
37
        if (!instance.InstanceID_isNULL)
 
38
                op.addKey("InstanceID", instance.InstanceID);
 
39
 
 
40
        _L_;
 
41
        return op.getHdl();
 
42
}
 
43
 
 
44
CMPIInstance* OpenDRIM_RecordLogPackage_OpenDRIM_RecordLog_toCMPIInstance(const CMPIBroker* broker, const OpenDRIM_RecordLog& instance) {
 
45
        _E_;
 
46
        Objectpath op(broker, OpenDRIM_RecordLogPackage_OpenDRIM_RecordLog_toCMPIObjectPath(broker, instance));
 
47
        Instance ci(broker, op);
 
48
 
 
49
        if (!instance.Caption_isNULL)
 
50
                ci.setProperty("Caption", instance.Caption);
 
51
 
 
52
        if (!instance.Description_isNULL)
 
53
                ci.setProperty("Description", instance.Description);
 
54
 
 
55
        if (!instance.ElementName_isNULL)
 
56
                ci.setProperty("ElementName", instance.ElementName);
 
57
 
 
58
        if (!instance.InstallDate_isNULL)
 
59
                ci.setPropertyDatetime("InstallDate", instance.InstallDate);
 
60
 
 
61
        if (!instance.Name_isNULL)
 
62
                ci.setProperty("Name", instance.Name);
 
63
 
 
64
        if (!instance.OperationalStatus_isNULL)
 
65
                ci.setProperty("OperationalStatus", instance.OperationalStatus);
 
66
 
 
67
        if (!instance.StatusDescriptions_isNULL)
 
68
                ci.setProperty("StatusDescriptions", instance.StatusDescriptions);
 
69
 
 
70
        if (!instance.Status_isNULL)
 
71
                ci.setProperty("Status", instance.Status);
 
72
 
 
73
        if (!instance.HealthState_isNULL)
 
74
                ci.setProperty("HealthState", instance.HealthState);
 
75
 
 
76
        if (!instance.PrimaryStatus_isNULL)
 
77
                ci.setProperty("PrimaryStatus", instance.PrimaryStatus);
 
78
 
 
79
        if (!instance.DetailedStatus_isNULL)
 
80
                ci.setProperty("DetailedStatus", instance.DetailedStatus);
 
81
 
 
82
        if (!instance.OperatingStatus_isNULL)
 
83
                ci.setProperty("OperatingStatus", instance.OperatingStatus);
 
84
 
 
85
        if (!instance.CommunicationStatus_isNULL)
 
86
                ci.setProperty("CommunicationStatus", instance.CommunicationStatus);
 
87
 
 
88
        if (!instance.EnabledState_isNULL)
 
89
                ci.setProperty("EnabledState", instance.EnabledState);
 
90
 
 
91
        if (!instance.OtherEnabledState_isNULL)
 
92
                ci.setProperty("OtherEnabledState", instance.OtherEnabledState);
 
93
 
 
94
        if (!instance.RequestedState_isNULL)
 
95
                ci.setProperty("RequestedState", instance.RequestedState);
 
96
 
 
97
        if (!instance.EnabledDefault_isNULL)
 
98
                ci.setProperty("EnabledDefault", instance.EnabledDefault);
 
99
 
 
100
        if (!instance.TimeOfLastStateChange_isNULL)
 
101
                ci.setPropertyDatetime("TimeOfLastStateChange", instance.TimeOfLastStateChange);
 
102
 
 
103
        if (!instance.AvailableRequestedStates_isNULL)
 
104
                ci.setProperty("AvailableRequestedStates", instance.AvailableRequestedStates);
 
105
 
 
106
        if (!instance.TransitioningToState_isNULL)
 
107
                ci.setProperty("TransitioningToState", instance.TransitioningToState);
 
108
 
 
109
        if (!instance.MaxNumberOfRecords_isNULL)
 
110
                ci.setProperty("MaxNumberOfRecords", instance.MaxNumberOfRecords);
 
111
 
 
112
        if (!instance.CurrentNumberOfRecords_isNULL)
 
113
                ci.setProperty("CurrentNumberOfRecords", instance.CurrentNumberOfRecords);
 
114
 
 
115
        if (!instance.LogState_isNULL)
 
116
                ci.setProperty("LogState", instance.LogState);
 
117
 
 
118
        if (!instance.OverwritePolicy_isNULL)
 
119
                ci.setProperty("OverwritePolicy", instance.OverwritePolicy);
 
120
 
 
121
        if (!instance.Facility_isNULL)
 
122
                ci.setProperty("Facility", instance.Facility);
 
123
 
 
124
        if (!instance.Severity_isNULL)
 
125
                ci.setProperty("Severity", instance.Severity);
 
126
 
 
127
        _L_;
 
128
        return ci.getHdl();
 
129
}
 
130
 
 
131
void OpenDRIM_RecordLogPackage_OpenDRIM_RecordLog_toCPP(const CMPIBroker* broker, const CMPIObjectPath* ref, OpenDRIM_RecordLog& instance) {
 
132
        _E_;
 
133
        Objectpath op(broker, (CMPIObjectPath*) ref);
 
134
 
 
135
        if (op.getKey("InstanceID", instance.InstanceID) == OK)
 
136
                instance.InstanceID_isNULL = false;
 
137
 
 
138
        _L_;
 
139
}
 
140
 
 
141
void OpenDRIM_RecordLogPackage_OpenDRIM_RecordLog_toCPP(const CMPIBroker* broker, const CMPIInstance* ci, OpenDRIM_RecordLog& instance) {
 
142
        _E_;
 
143
        Instance inst(broker, (CMPIInstance*) ci);
 
144
 
 
145
        if (inst.getProperty("Caption", instance.Caption) == OK)
 
146
                instance.Caption_isNULL = false;
 
147
 
 
148
        if (inst.getProperty("Description", instance.Description) == OK)
 
149
                instance.Description_isNULL = false;
 
150
 
 
151
        if (inst.getProperty("ElementName", instance.ElementName) == OK)
 
152
                instance.ElementName_isNULL = false;
 
153
 
 
154
        if (inst.getPropertyDatetime("InstallDate", instance.InstallDate) == OK)
 
155
                instance.InstallDate_isNULL = false;
 
156
 
 
157
        if (inst.getProperty("Name", instance.Name) == OK)
 
158
                instance.Name_isNULL = false;
 
159
 
 
160
        if (inst.getProperty("OperationalStatus", instance.OperationalStatus) == OK)
 
161
                instance.OperationalStatus_isNULL = false;
 
162
 
 
163
        if (inst.getProperty("StatusDescriptions", instance.StatusDescriptions) == OK)
 
164
                instance.StatusDescriptions_isNULL = false;
 
165
 
 
166
        if (inst.getProperty("Status", instance.Status) == OK)
 
167
                instance.Status_isNULL = false;
 
168
 
 
169
        if (inst.getProperty("HealthState", instance.HealthState) == OK)
 
170
                instance.HealthState_isNULL = false;
 
171
 
 
172
        if (inst.getProperty("PrimaryStatus", instance.PrimaryStatus) == OK)
 
173
                instance.PrimaryStatus_isNULL = false;
 
174
 
 
175
        if (inst.getProperty("DetailedStatus", instance.DetailedStatus) == OK)
 
176
                instance.DetailedStatus_isNULL = false;
 
177
 
 
178
        if (inst.getProperty("OperatingStatus", instance.OperatingStatus) == OK)
 
179
                instance.OperatingStatus_isNULL = false;
 
180
 
 
181
        if (inst.getProperty("CommunicationStatus", instance.CommunicationStatus) == OK)
 
182
                instance.CommunicationStatus_isNULL = false;
 
183
 
 
184
        if (inst.getProperty("EnabledState", instance.EnabledState) == OK)
 
185
                instance.EnabledState_isNULL = false;
 
186
 
 
187
        if (inst.getProperty("OtherEnabledState", instance.OtherEnabledState) == OK)
 
188
                instance.OtherEnabledState_isNULL = false;
 
189
 
 
190
        if (inst.getProperty("RequestedState", instance.RequestedState) == OK)
 
191
                instance.RequestedState_isNULL = false;
 
192
 
 
193
        if (inst.getProperty("EnabledDefault", instance.EnabledDefault) == OK)
 
194
                instance.EnabledDefault_isNULL = false;
 
195
 
 
196
        if (inst.getPropertyDatetime("TimeOfLastStateChange", instance.TimeOfLastStateChange) == OK)
 
197
                instance.TimeOfLastStateChange_isNULL = false;
 
198
 
 
199
        if (inst.getProperty("AvailableRequestedStates", instance.AvailableRequestedStates) == OK)
 
200
                instance.AvailableRequestedStates_isNULL = false;
 
201
 
 
202
        if (inst.getProperty("TransitioningToState", instance.TransitioningToState) == OK)
 
203
                instance.TransitioningToState_isNULL = false;
 
204
 
 
205
        if (inst.getProperty("MaxNumberOfRecords", instance.MaxNumberOfRecords) == OK)
 
206
                instance.MaxNumberOfRecords_isNULL = false;
 
207
 
 
208
        if (inst.getProperty("CurrentNumberOfRecords", instance.CurrentNumberOfRecords) == OK)
 
209
                instance.CurrentNumberOfRecords_isNULL = false;
 
210
 
 
211
        if (inst.getProperty("LogState", instance.LogState) == OK)
 
212
                instance.LogState_isNULL = false;
 
213
 
 
214
        if (inst.getProperty("OverwritePolicy", instance.OverwritePolicy) == OK)
 
215
                instance.OverwritePolicy_isNULL = false;
 
216
 
 
217
        if (inst.getProperty("InstanceID", instance.InstanceID) == OK)
 
218
                instance.InstanceID_isNULL = false;
 
219
 
 
220
        if (inst.getProperty("Facility", instance.Facility) == OK)
 
221
                instance.Facility_isNULL = false;
 
222
 
 
223
        if (inst.getProperty("Severity", instance.Severity) == OK)
 
224
                instance.Severity_isNULL = false;
 
225
 
 
226
        _L_;
 
227
}
 
228
 
 
229
void OpenDRIM_RecordLogPackage_OpenDRIM_RecordLog_toCPP(const CMPIBroker* broker, const CMPIArgs* in, OpenDRIM_RecordLog_RequestStateChange_In& args) {
 
230
        _E_;
 
231
        CMPIStatus rc;
 
232
        CMPIData data;
 
233
 
 
234
        unsigned short RequestedState;
 
235
        data = in->ft->getArg(in, "RequestedState", &rc);
 
236
        if (rc.rc == OK) {
 
237
                CT_ToC(data, RequestedState);   
 
238
                args.setRequestedState(RequestedState);
 
239
        }                       
 
240
 
 
241
        Objectpath Job;
 
242
        data = in->ft->getArg(in, "Job", &rc);
 
243
        if (rc.rc == OK) {
 
244
                CT_ToC(broker, data, Job);      
 
245
                args.setJob(Job);
 
246
        }                       
 
247
 
 
248
        string TimeoutPeriod;
 
249
        data = in->ft->getArg(in, "TimeoutPeriod", &rc);
 
250
        if (rc.rc == OK) {
 
251
                CT_ToCDatetime(data, TimeoutPeriod);    
 
252
                args.setTimeoutPeriod(TimeoutPeriod);
 
253
        }                       
 
254
 
 
255
        _L_;
 
256
}
 
257
 
 
258
void OpenDRIM_RecordLogPackage_OpenDRIM_RecordLog_toCMPIArg(const CMPIBroker* broker, CMPIArgs* out, const OpenDRIM_RecordLog_RequestStateChange_Out& args) {
 
259
        _E_;
 
260
        CMPIValue value;
 
261
        int errorMessage;
 
262
 
 
263
        Objectpath Job;
 
264
        errorMessage = args.getJob(Job);
 
265
        if (errorMessage == OK) {
 
266
                value = CT_toCMPI(Job);
 
267
                out->ft->addArg(out, "Job", &value, CMPI_ref);
 
268
        }
 
269
 
 
270
        _L_;
 
271
}