(file) Return to PresidentProvider.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus_unsupported / utils / cimreg / PresidentProvider

  1 mike  1.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 mike  1.1 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 23           //
 24           //==============================================================================
 25           //
 26           //%/////////////////////////////////////////////////////////////////////////////
 27           
 28           #include "PresidentProvider.h"
 29           
 30           PEGASUS_NAMESPACE_BEGIN
 31           
 32           PresidentProvider::PresidentProvider()
 33           {
 34           }
 35           
 36           PresidentProvider::~PresidentProvider()
 37           {
 38           }
 39           
 40           void PresidentProvider::initialize(CIMOMHandle& cimom)
 41           {
 42               {
 43 mike  1.1         CIMInstance inst("President");
 44                   inst.setPath(CIMObjectPath("President.Number=1"));
 45                   inst.addProperty(CIMProperty("Number", Uint32(1)));
 46                   inst.addProperty(CIMProperty("First", String("George")));
 47                   inst.addProperty(CIMProperty("Last", String("Washington")));
 48                   _instances.append(inst);
 49               }
 50           
 51               {
 52                   CIMInstance inst("President");
 53                   inst.setPath(CIMObjectPath("President.Number=2"));
 54                   inst.addProperty(CIMProperty("Number", Uint32(2)));
 55                   inst.addProperty(CIMProperty("First", String("John")));
 56                   inst.addProperty(CIMProperty("Last", String("Adams")));
 57                   _instances.append(inst);
 58               }
 59           
 60               {
 61                   CIMInstance inst("President");
 62                   inst.setPath(CIMObjectPath("President.Number=3"));
 63                   inst.addProperty(CIMProperty("Number", Uint32(2)));
 64 mike  1.1         inst.addProperty(CIMProperty("First", String("Thomas")));
 65                   inst.addProperty(CIMProperty("Last", String("Jefferson")));
 66                   _instances.append(inst);
 67               }
 68           }
 69           
 70           void PresidentProvider::terminate()
 71           {
 72               delete this;
 73           }
 74           
 75           void PresidentProvider::getInstance(
 76               const OperationContext& context,
 77               const CIMObjectPath& instanceReference,
 78               const Boolean includeQualifiers,
 79               const Boolean includeClassOrigin,
 80               const CIMPropertyList& propertyList,
 81               InstanceResponseHandler& handler)
 82           {
 83               CIMObjectPath cop = CIMObjectPath(
 84                   String(),
 85 mike  1.1         CIMNamespaceName(),
 86                   instanceReference.getClassName(),
 87                   instanceReference.getKeyBindings());
 88           
 89               handler.processing();
 90           
 91               for (Uint32 i = 0; i < _instances.size(); i++)
 92               {
 93                   if (cop == _instances[i].getPath())
 94                   {
 95                       handler.deliver(_instances[i]);
 96                       break;
 97                   }
 98               }
 99           
100               handler.complete();
101           }
102           
103           void PresidentProvider::enumerateInstances(
104               const OperationContext& context,
105               const CIMObjectPath& classReference,
106 mike  1.1     const Boolean includeQualifiers,
107               const Boolean includeClassOrigin,
108               const CIMPropertyList& propertyList,
109               InstanceResponseHandler& handler)
110           {
111               handler.processing();
112           
113               for (Uint32 i = 0; i < _instances.size(); i++)
114                   handler.deliver(_instances[i]);
115           
116               handler.complete();
117           }
118           
119           void PresidentProvider::enumerateInstanceNames(
120               const OperationContext& context,
121               const CIMObjectPath& classReference,
122               ObjectPathResponseHandler& handler)
123           {
124               handler.processing();
125           
126               for (Uint32 i = 0; i < _instances.size(); i++)
127 mike  1.1         handler.deliver(_instances[i].getPath());
128           
129               handler.complete();
130           }
131           
132           void PresidentProvider::modifyInstance(
133               const OperationContext& context,
134               const CIMObjectPath& instanceReference,
135               const CIMInstance& instanceObject,
136               const Boolean includeQualifiers,
137               const CIMPropertyList& propertyList,
138               ResponseHandler& handler)
139           {
140               throw CIMException(CIM_ERR_NOT_SUPPORTED);
141           }
142           
143           void PresidentProvider::createInstance(
144               const OperationContext& context,
145               const CIMObjectPath& instanceReference,
146               const CIMInstance& instanceObject,
147               ObjectPathResponseHandler& handler)
148 mike  1.1 {
149               throw CIMException(CIM_ERR_NOT_SUPPORTED);
150           }
151           
152           void PresidentProvider::deleteInstance(
153               const OperationContext& context,
154               const CIMObjectPath& instanceReference,
155               ResponseHandler& handler)
156           {
157               throw CIMException(CIM_ERR_NOT_SUPPORTED);
158           }
159           
160           PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2