void ComputerSystemProvider::getInstance( const OperationContext& context, const CIMObjectPath& ref, const Boolean includeQualifiers, const Boolean includeClassOrigin, const CIMPropertyList& propertyList, InstanceResponseHandler &handler) { CIMName className = ref.getClassName(); _checkClass(className); Array<CIMKeyBinding> keys = ref.getKeyBindings(); //-- make sure we're the right instance unsigned int keyCount = NUMKEYS_COMPUTER_SYSTEM; CIMName keyName; String keyValue; if (keys.size() != keyCount) { throw CIMInvalidParameterException("Wrong number of keys"); } for (unsigned int ii = 0; ii < keys.size(); ii++) { keyName = keys[ii].getName(); keyValue = keys[ii].getValue(); //Put CLASS_EXTENDED_COMPUTER_SYSTEM in front CLASS_CIM_COMPUTER_SYSTEM //to prefer CLASS_EXTENDED_COMPUTER_SYSTEM as class being served first //followed by CLASS_CIM_UNITARY_COMPUTER_SYSTEM if (keyName.equal(PROPERTY_CREATION_CLASS_NAME) && (String::equalNoCase(keyValue,CLASS_EXTENDED_COMPUTER_SYSTEM) || String::equalNoCase(keyValue,CLASS_CIM_UNITARY_COMPUTER_SYSTEM) || String::equalNoCase(keyValue,CLASS_CIM_COMPUTER_SYSTEM) || String::equalNoCase(keyValue,String::EMPTY))) { keyCount--; } else if (keyName.equal("Name") && String::equalNoCase(keyValue,_cs.getHostName())) { keyCount--; } } if (keyCount) { throw CIMInvalidParameterException(String::EMPTY); } // return instance of specified class CIMInstance instance = _cs.buildInstance(ref.getClassName()); handler.processing(); handler.deliver(instance); handler.complete(); return; }
void IBM_CIMOMStatDataProvider::getInstance( const OperationContext & context, const CIMObjectPath & instanceReference, const Boolean includeQualifiers, const Boolean includeClassOrigin, const CIMPropertyList & propertyList, InstanceResponseHandler & handler) { CIMObjectPath localReference = CIMObjectPath( String::EMPTY, CIMNamespaceName(), instanceReference.getClassName(), instanceReference.getKeyBindings()); // begin processing the request handler.processing(); // instance index corresponds to reference index for(Uint32 i = 0; i < StatisticalData::NUMBER_OF_TYPES; i++) { // cout << "loop" << endl; if(localReference == _references[i]) { // deliver requested instance handler.deliver(getInstance(i)); break; } } // complete processing the request handler.complete(); }
void LinuxDiskDriveProvider::enumerateInstances( const OperationContext& context, const CIMObjectPath& ref, const Boolean includeQualifiers, const Boolean includeClassOrigin, const CIMPropertyList& propertyList, InstanceResponseHandler& handler ) { DiskDriveData diskdriveData; MediaAccessDeviceInformation *curDiskDrive; handler.processing(); curDiskDrive = diskdriveData.GetFirstDiskDrive(); while (curDiskDrive) { handler.deliver(build_instance(DISKDRIVECLASSNAME, curDiskDrive)); delete curDiskDrive; curDiskDrive = diskdriveData.GetNextDiskDrive(); } diskdriveData.EndGetDiskDrive(); handler.complete(); }
/***************************************************************************** * * Implementation of InstanceProvider enumerateInstances method. * *****************************************************************************/ void InteropProvider::enumerateInstances( const OperationContext & context, const CIMObjectPath & ref, const Boolean includeQualifiers, const Boolean includeClassOrigin, const CIMPropertyList& propertyList, InstanceResponseHandler & handler) { PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, "InteropProvider::enumerateInstances()"); initProvider(); // test for legal namespace for this provider. Exception if not //namespaceSupported(ref); // NOTE: Above is commented out because the routing tables will always // do the right thing and that's the only way requests get here. handler.processing(); // Call the internal enumerateInstances to generate instances of defined // class. This expects the instances to be returned complete including // complete path. handler.deliver(localEnumerateInstances(context, ref, propertyList)); handler.complete(); PEG_METHOD_EXIT(); }
/***************************************************************************** * * Implementation of InstanceProvider getInstance method. * *****************************************************************************/ void InteropProvider::getInstance( const OperationContext & context, const CIMObjectPath & instanceName, const Boolean includeQualifiers, const Boolean includeClassOrigin, const CIMPropertyList & propertyList, InstanceResponseHandler & handler) { PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, "InteropProvider::getInstance"); initProvider(); // test for legal namespace for this provider. Exception if not //namespaceSupported(instanceName); // NOTE: Above is commented out because the routing tables will always // do the right thing and that's the only way requests get here. handler.processing(); CIMInstance myInstance = localGetInstance( context, instanceName, propertyList); handler.deliver(myInstance); handler.complete(); PEG_METHOD_EXIT(); }
void LifecycleIndicationProvider::getInstance( const OperationContext & context, const CIMObjectPath & instanceReference, const Boolean includeQualifiers, const Boolean includeClassOrigin, const CIMPropertyList & propertyList, InstanceResponseHandler & handler) { // cout << "LifecycleIndicationProvider::getInstance()" << endl; handler.processing(); for(Uint32 i = 0, n = _instances.size(); i < n; i++) { if(instanceReference == _instances[i].getPath()) { // cout << "delivering " << _instances[i].getPath().toString() << endl; handler.deliver(_instances[i]); break; } } // It's not shown here, but your implementation of getInstance() might want // to generate a lifecycle indication for // InstRead_for_Sample_LifecycleIndicationProviderClass, for the instance // that is returned. See LifecycleIndicationProviderR.mof. handler.complete(); }
void LargeDataProvider::getInstance( const OperationContext & context, const CIMObjectPath & instanceReference, const Boolean includeQualifiers, const Boolean includeClassOrigin, const CIMPropertyList & propertyList, InstanceResponseHandler & handler) { cout << "------------------------------" << endl; cout << "LargeDataProvider::getInstance" << endl; cout << "------------------------------" << endl; // convert a potential fully qualified reference into a local reference // (class name and keys only). CIMObjectPath localReference = CIMObjectPath( String(), String(), instanceReference.getClassName(), instanceReference.getKeyBindings()); // begin processing the request handler.processing(); // instance index corresponds to reference index for(Uint32 i = 0, n = _instances.size(); i < n; i++) { if(localReference == _instanceNames[i]) { // deliver requested instance handler.deliver(_instances[i]); break; } } // complete processing the request handler.complete(); }
void benchmarkProvider::enumerateInstances( const OperationContext & context, const CIMObjectPath & classReference, const Boolean includeQualifiers, const Boolean includeClassOrigin, const CIMPropertyList & propertyList, InstanceResponseHandler & handler) { CIMInstance _instance; Uint32 numberOfProperties; Uint32 sizeOfPropertyValue; Uint32 numberOfInstances; CIMName className = classReference.getClassName(); test.getConfiguration(className, numberOfProperties, sizeOfPropertyValue, numberOfInstances); // begin processing the request handler.processing(); for (Uint32 i = 1; i <= numberOfInstances; i++) { _instance = _buildInstance(className, numberOfProperties, sizeOfPropertyValue , CIMValue(i)); handler.deliver(_instance); } // complete processing the request handler.complete(); }
void LargeDataProvider::enumerateInstances( const OperationContext & context, const CIMObjectPath & classReference, const Boolean includeQualifiers, const Boolean includeClassOrigin, const CIMPropertyList & propertyList, InstanceResponseHandler & handler) { char buffer[NO_OF_INSTANCES]; CIMInstance Instances[NO_OF_INSTANCES]; CIMObjectPath References[NO_OF_INSTANCES]; cout << "-------------------------------------" << endl; cout << "LargeDataProvider::enumerateInstances" << endl; cout << "-------------------------------------" << endl; // announce operation processing. handler.processing(); // creating some instances in a loop for generating a large amount of data // The number of instances is controlled by the macro var. NO_OF_INSTANCES. // TODO:: Need to fix the way in which the value of this variable is passed cout << "Number of Instances = " << NO_OF_INSTANCES << endl; for (Uint32 i = 0; i < NO_OF_INSTANCES; i++) { sprintf(buffer, "%d", i); Instances[i] = CIMInstance("SampleClass"); References[i] = CIMObjectPath("SampleClass.Id="+String(buffer)); Instances[i].addProperty(CIMProperty("Id", Uint16(i))); Instances[i].addProperty(CIMProperty("Message", String(buffer))); Instances[i].addProperty(CIMProperty("ReqType", String("Local"))); Instances[i].addProperty(CIMProperty("RequestNumber", Uint16(i+10))); Instances[i].addProperty(CIMProperty("TimeSpent", Uint16(i+2))); Instances[i].addProperty(CIMProperty("TimeIdeal", Uint16(100))); Instances[i].addProperty( CIMProperty("Performance", String("OK \00><\00"))); Instances[i].addProperty(CIMProperty("EndPoint", String("Instance "+String(buffer)+" Ends"))); _instances.append(Instances[i]); _instanceNames.append(References[i]); } for(Uint32 i = 0; i < NO_OF_INSTANCES; i++) // deliver instance handler.deliver(_instances[i]); // complete processing the request handler.complete(); }
void LinuxNetworkAdapterProvider::getInstance(const OperationContext& context, const CIMObjectPath& ref, const Boolean includeQualifiers, const Boolean includeClassOrigin, const CIMPropertyList& propertyList, InstanceResponseHandler& handler) { Array<CIMKeyBinding> keys = ref.getKeyBindings(); Uint32 i; NetworkAdapterData* located_interface; String unique_name; CIMName className; enum network_provider_types classType; className = ref.getClassName(); if (className.equal("Linux_EthernetAdapter")) { classType = NETWORK_ADAPTER_PROVIDER_ETHERNET; } else if (className.equal("Linux_NetworkAdapter")) { classType = NETWORK_ADAPTER_PROVIDER_OTHER; } else { throw CIMNotSupportedException(className.getString() + "::getInstance"); } for (i = 0; i < keys.size(); i++) if (keys[i].getName() == CIMName("Name")) unique_name = keys[i].getValue(); handler.processing(); located_interface = LocateInterface(unique_name); if (located_interface != NULL && interface_is_my_type(classType,located_interface)) { CIMInstance instance = build_instance(className, classType, located_interface); handler.deliver(instance); } delete located_interface; handler.complete(); return; }
void ParserTestProvider::getInstance( const OperationContext & context, const CIMObjectPath & instanceReference, const Boolean includeQualifiers, const Boolean includeClassOrigin, const CIMPropertyList & propertyList, InstanceResponseHandler & handler) { String Value; char csname[256]; int cnum; char badstrname[256]; cout << "ParserTestProvider::getInstance" << endl; CIMName className = instanceReference.getClassName(); CIMNamespaceName nameSpace = instanceReference.getNameSpace(); Array<CIMKeyBinding> keys = instanceReference.getKeyBindings(); for (int i = 0; i < (int)keys.size(); i++) { CIMName cimName = keys[i].getName(); Value = keys[i].getValue(); if (cimName.equal("BadStringName")) { strncpy(badstrname, Value.getCString(), 256); } } CIMInstance instance(CLASS_NAME); instance.setPath(CIMObjectPath(String::EMPTY, // hostname nameSpace, CLASS_NAME, keys)); instance.addProperty(CIMProperty("CName", String(CLASS_NAME))); instance.addProperty(CIMProperty("BadStringName", String(badstrname))); //begin processing the request handler.processing(); handler.deliver(instance); // complete processing the request handler.complete(); }
void LinuxNetworkAdapterProvider::enumerateInstances( const OperationContext& context, const CIMObjectPath& ref, const Boolean includeQualifiers, const Boolean includeClassOrigin, const CIMPropertyList& propertyList, InstanceResponseHandler& handler) { int i; NetworkAdapterData *iface; vector<String> adapter_names; CIMName className; enum network_provider_types classType; className = ref.getClassName(); if (className.equal("Linux_EthernetAdapter")) { classType = NETWORK_ADAPTER_PROVIDER_ETHERNET; } else if (className.equal("Linux_NetworkAdapter")) { classType = NETWORK_ADAPTER_PROVIDER_OTHER; } else { throw CIMNotSupportedException(className.getString() + "::enumerateInstances"); } adapter_names = NetworkAdapterData::list_all_adapters(); handler.processing(); for (i = 0; i < (int) adapter_names.size(); i++) { iface = LocateInterface(adapter_names[i]); if (iface != NULL && interface_is_my_type(classType, iface)) handler.deliver(build_instance(className, classType, iface)); delete iface; } handler.complete(); }
/** Retrieves either the stored errorInstance or indicationInstance from both the class and the static repository, performs a comparison, and returns the instance if they are the same. */ void EmbeddedInstanceProvider::getInstance( const OperationContext& context, const CIMObjectPath& ref, const Boolean includeQualifiers, const Boolean includeClassOrigin, const CIMPropertyList& propertyList, InstanceResponseHandler& handler) { handler.processing(); CIMInstance retInst; if (ref.getClassName().equal(CIMName("PG_EmbeddedError"))) retInst = errorInstance->clone(); else if (ref.getClassName().equal(CIMName("PG_InstMethodIndication"))) retInst = indicationInstance->clone(); handler.deliver(retInst); handler.complete(); }
void PG_TestPropertyTypes::enumerateInstances( const OperationContext& context, const CIMObjectPath& ref, const Boolean includeQualifiers, const Boolean includeClassOrigin, const CIMPropertyList& propertyList, InstanceResponseHandler& handler) { // ensure the Namespace is valid if (!ref.getNameSpace().equal ("test/static")) { throw CIMException(CIM_ERR_INVALID_NAMESPACE); } // ensure the class existing in the specified namespace if (!ref.getClassName().equal ("PG_TestPropertyTypes")) { throw CIMException(CIM_ERR_INVALID_CLASS); } // begin processing the request handler.processing(); // NOTE: It would be much more efficient to remember the instance names // get class definition from repository CIMClass cimclass = _cimom.getClass( context, ref.getNameSpace(), ref.getClassName(), false, true, true, CIMPropertyList()); for (Uint32 i = 0; i < _instances.size(); i++) { handler.deliver(_instances[i]); } // complete processing the request handler.complete(); }
void ExceptionsTest::getInstance( const OperationContext & context, const CIMObjectPath & instanceReference, const Boolean includeQualifiers, const Boolean includeClassOrigin, const CIMPropertyList & propertyList, InstanceResponseHandler & handler) { // convert a potential fully qualified reference into a local reference // (class name and keys only). CIMObjectPath localReference = CIMObjectPath( String(), String(), instanceReference.getClassName(), instanceReference.getKeyBindings()); CIMName className = instanceReference.getClassName(); // begin processing the request handler.processing(); cout <<"Calling Exception ExceptionsTest::getInstance 1" << endl; CheckExceptionType(EXCEPTION_TYPE); if (className == CIMName("FirstClass")) { // instance index corresponds to reference index for(Uint32 i = 0, n = _instances.size(); i < n; i++) { if(localReference == _instanceNames[i]) { // deliver requested instance handler.deliver(_instances[i]); break; } } } // complete processing the request handler.complete(); cout <<"Calling Exception ExceptionsTest::getInstance 2" << endl; CheckExceptionType(EXCEPTION_TYPE); }
void InstanceProvider::enumerateInstances( const OperationContext & context, const CIMObjectPath & classReference, const Boolean includeQualifiers, const Boolean includeClassOrigin, const CIMPropertyList & propertyList, InstanceResponseHandler & handler) { // begin processing the request handler.processing(); for(Uint32 i = 0, n = _instances.size(); i < n; i++) { // deliver instance handler.deliver(_instances[i]); } // complete processing the request handler.complete(); }
/* ================================================================================ NAME : enumerateInstances DESCRIPTION : Enumerates all of the IPProtocolEndpoint instances. : An array of instance references is returned. ASSUMPTIONS : None PRE-CONDITIONS : POST-CONDITIONS : NOTES : LocalOnly, DeepInheritance and propertyList are not : respected by this provider. Localization is not supported PARAMETERS : ================================================================================ */ void BIPTLEpProvider::enumerateInstances( const OperationContext & context, const CIMObjectPath & classReference, const Boolean includeQualifiers, const Boolean includeClassOrigin, const CIMPropertyList & propertyList, InstanceResponseHandler & handler) { #ifdef DEBUG cout << "BIPTLEpProvider::enumerateInstances()" << endl; #endif CIMName className = classReference.getClassName(); CIMNamespaceName nameSpace = classReference.getNameSpace(); // Validate the classname _checkClass(className); // Notify processing is starting handler.processing(); int i; InterfaceList _ifList; for (i = 0; i < _ifList.size(); i++) { IPInterface _ipif = _ifList.getInterface(i); if (_ipif.bindsToLANInterface()) { handler.deliver( _constructInstance(CLASS_PG_BINDS_IP_TO_LAN_ENDPOINT, nameSpace, _ipif ) ); } } // Notify processing is complete handler.complete(); return; } // enumerateInstances
void ParserTestProvider::enumerateInstances( const OperationContext & context, const CIMObjectPath & classReference, const Boolean includeQualifiers, const Boolean includeClassOrigin, const CIMPropertyList & propertyList, InstanceResponseHandler & handler) { // begin processing the request CIMName className = classReference.getClassName(); CIMNamespaceName nameSpace = classReference.getNameSpace(); //cout "[className: "<<className<<"], [in namespace: " << nameSpace << "]"; handler.processing(); Array<CIMKeyBinding> keys; keys.append(CIMKeyBinding("CName", String(CLASS_NAME), CIMKeyBinding::STRING)); keys.append(CIMKeyBinding("BadStringName", String(BADSTR_1), CIMKeyBinding::STRING)); CIMInstance instance(CLASS_NAME); instance.setPath(CIMObjectPath(String::EMPTY, nameSpace, CLASS_NAME, keys)); // keys instance.addProperty(CIMProperty("CName", String(CLASS_NAME))); instance.addProperty(CIMProperty("BadStringName", String(BADSTR_1))); for(Uint32 i = 0, n = _instances.size(); i < n; i++) handler.deliver(_instances[i]); // handler.deliver(instance); handler.complete(); }
void UNIX_PROVIDER::execQuery( const OperationContext& context, const CIMObjectPath& objectPath, const QueryExpression& query, InstanceResponseHandler& handler) { CIMName className; CIMInstance instance; CLASS_IMPLEMENTATION _p; className = objectPath.getClassName(); CIMNamespaceName nameSpace = objectPath.getNameSpace(); int pIndex; // only return instances when enumerate on our subclass, CIMOM // will call us as natural part of recursing through subtree on // enumerate - if we return instances on enumerate of our superclass, // there would be dups if (className.equal (_getClassCimName()) || className.equal(_getBaseClassCimName())) { handler.processing(); _p.initialize(); for (pIndex = 0; _p.load(pIndex); pIndex++) { CIMInstance ci = _constructInstance(_getClassCimName(), nameSpace, _p); if (query.evaluate(ci)) { handler.deliver(ci); } } _p.finalize(); handler.complete(); } else { throw CIMNotSupportedException(UNIX_PROVIDER_NAME "does not support class " + className.getString()); } return; }
void IBM_CIMOMStatDataProvider::enumerateInstances( const OperationContext & context, const CIMObjectPath & classReference, const Boolean includeQualifiers, const Boolean includeClassOrigin, const CIMPropertyList & propertyList, InstanceResponseHandler & handler) { // begin processing the request handler.processing(); // instance index corresponds to reference index for(Uint32 i = 0; i < StatisticalData::NUMBER_OF_TYPES; i++) { // deliver instance handler.deliver(getInstance(i)); } // complete processing the request handler.complete(); }
void OperatingSystemProvider::enumerateInstances( const OperationContext& context, const CIMObjectPath& ref, const Boolean includeQualifiers, const Boolean includeClassOrigin, const CIMPropertyList& propertyList, InstanceResponseHandler& handler) { CIMName className; CIMInstance instance; CIMObjectPath newref; className = ref.getClassName(); // only return instances when enumerate on our subclass, CIMOM // will call us as natural part of recursing through subtree on // enumerate - if we return instances on enumerate of our superclass, // there would be dups if (className.equal (EXTENDEDOPERATINGSYSTEMCLASS)) { handler.processing(); newref = _fill_reference(ref.getNameSpace(), className); instance = _build_instance(ref); instance.setPath(newref); handler.deliver(instance); handler.complete(); } else if (className.equal (STANDARDOPERATINGSYSTEMCLASS)) { handler.processing(); handler.complete(); } else { throw CIMNotSupportedException("OperatingSystemProvider " "does not support class " + className.getString()); } return; }
void benchmarkProvider::getInstance( const OperationContext & context, const CIMObjectPath & instanceReference, const Boolean includeQualifiers, const Boolean includeClassOrigin, const CIMPropertyList & propertyList, InstanceResponseHandler & handler) { CIMInstance _instance; Uint32 numberOfProperties; Uint32 sizeOfPropertyValue; Uint32 numberOfInstances; CIMName className = instanceReference.getClassName(); test.getConfiguration(className, numberOfProperties, sizeOfPropertyValue, numberOfInstances); Array<CIMKeyBinding> keyBindings = instanceReference.getKeyBindings(); if (keyBindings.size() != 1) { throw CIMException(CIM_ERR_NOT_SUPPORTED); } // begin processing the request handler.processing(); Uint32 ID; if (sscanf (keyBindings[0].getValue().getCString(), "%u", &ID) != 1) { throw CIMException (CIM_ERR_INVALID_PARAMETER); } _instance = _buildInstance(className, numberOfProperties, sizeOfPropertyValue , CIMValue(ID)); handler.deliver(_instance); // complete processing the request handler.complete(); }
void ComputerSystemProvider::enumerateInstances( const OperationContext& context, const CIMObjectPath& ref, const Boolean includeQualifiers, const Boolean includeClassOrigin, const CIMPropertyList& propertyList, InstanceResponseHandler& handler) { CIMName className = ref.getClassName(); _checkClass(className); handler.processing(); // Deliver instance only if request was for leaf class if (className.equal (CLASS_EXTENDED_COMPUTER_SYSTEM)) { Array<CIMKeyBinding> keys; keys.append(CIMKeyBinding( PROPERTY_CREATION_CLASS_NAME, CLASS_EXTENDED_COMPUTER_SYSTEM, CIMKeyBinding::STRING)); keys.append(CIMKeyBinding( PROPERTY_NAME, _cs.getHostName(), CIMKeyBinding::STRING)); CIMObjectPath instanceName( String::EMPTY, // Hostname not required CIMNamespaceName(), // Namespace not required CLASS_EXTENDED_COMPUTER_SYSTEM, keys); CIMInstance instance = _cs.buildInstance(CLASS_EXTENDED_COMPUTER_SYSTEM); instance.setPath(instanceName); handler.deliver(instance); } handler.complete(); return; }
void UNIX_PROVIDER::enumerateInstances( const OperationContext& context, const CIMObjectPath& ref, const Boolean includeQualifiers, const Boolean includeClassOrigin, const CIMPropertyList& propertyList, InstanceResponseHandler& handler) { CIMName className; CIMInstance instance; CIMObjectPath newref; CLASS_IMPLEMENTATION _p; className = ref.getClassName(); CIMNamespaceName nameSpace = ref.getNameSpace(); int pIndex; // only return instances when enumerate on our subclass, CIMOM // will call us as natural part of recursing through subtree on // enumerate - if we return instances on enumerate of our superclass, // there would be dups if (className.equal (_getClassCimName()) || className.equal(_getBaseClassCimName())) { handler.processing(); _p.initialize(); for (pIndex = 0; _p.load(pIndex); pIndex++) handler.deliver(_constructInstance(_getClassCimName(), nameSpace, _p)); _p.finalize(); handler.complete(); } else { throw CIMNotSupportedException(_getClassName() + "does not support class " + className.getString()); } return; }
void LinuxDiskDriveProvider::getInstance(const OperationContext& context, const CIMObjectPath& ref, const Boolean includeQualifiers, const Boolean includeClassOrigin, const CIMPropertyList& propertyList, InstanceResponseHandler& handler) { DiskDriveData diskdriveData; MediaAccessDeviceInformation *curDiskDrive; Array<CIMKeyBinding> keys = ref.getKeyBindings(); Uint32 i; String nameString; handler.processing(); /* Get the diskdrive that was requested */ i = 0; while (i < keys.size()) { if (keys[i].getName() == CIMName("Name")) nameString = keys[i].getValue(); i++; } if (nameString != String::EMPTY) { curDiskDrive = diskdriveData.GetDiskDrive(nameString); if (curDiskDrive!=NULL) { CIMInstance instance = build_instance(DISKDRIVECLASSNAME, curDiskDrive); handler.deliver(instance); delete curDiskDrive; } } handler.complete(); return; }
void TimingProvider::enumerateInstances( const OperationContext & context, const CIMObjectPath & classReference, const Boolean includeQualifiers, const Boolean includeClassOrigin, const CIMPropertyList & propertyList, InstanceResponseHandler & handler) { cout <<"TimingProvider::enumerateInstances" << endl; CIMName cn = classReference.getClassName(); String className = cn.getString(); sleep(15); // cout << "className = " << className << endl; // Create Instances for TimeOne Class if (String::equalNoCase(className, "TimeOne")) { sleep(5); // announce operation processing. handler.processing(); for(Uint32 i = 0, n = _instances.size(); i < n; i++) // deliver instance handler.deliver(_instances[i]); } // Create Instances for SecondClass if (String::equalNoCase(className, "TimeTwo")) { handler.processing(); sleep(5); for(Uint32 i = 0, n = _instances_2.size(); i < n; i++) // deliver instance handler.deliver(_instances_2[i]); } // complete processing the request handler.complete(); }
void LifecycleIndicationProvider::enumerateInstances( const OperationContext & context, const CIMObjectPath & ref, const Boolean includeQualifiers, const Boolean includeClassOrigin, const CIMPropertyList & propertyList, InstanceResponseHandler & handler) { // cout << "LifecycleIndicationProvider::enumerateInstances()" << endl; handler.processing(); for(Uint32 i = 0, n = _instances.size(); i < n; i++) { // cout << "delivering " << _instances[i].getPath().toString() << endl; handler.deliver(_instances[i]); } // Do you consider enumerateInstances() to be the "read" of an instance? // If so, then you might want to generate a lifecycle indication here for // InstRead_for_Sample_LifecycleIndicationProviderClass, for each instance // that is returned. See LifecycleIndicationProviderR.mof. handler.complete(); }
void ExceptionsTest::enumerateInstances( const OperationContext & context, const CIMObjectPath & classReference, const Boolean includeQualifiers, const Boolean includeClassOrigin, const CIMPropertyList & propertyList, InstanceResponseHandler & handler) { cout <<"Calling Exception ExceptionsTest::enumerateInstances 1" << endl; CheckExceptionType(EXCEPTION_TYPE); CIMName clName = classReference.getClassName(); String className = clName.getString(); if (String::equalNoCase(className, "FirstClass")) { // announce operation processing. handler.processing(); for(Uint32 i = 0, n = _instances.size(); i < n; i++) // deliver instance handler.deliver(_instances[i]); } if (String::equalNoCase(className, "SecondClass")) { handler.processing(); for(Uint32 i = 0, n = _instances_second.size(); i < n; i++) // deliver instance handler.deliver(_instances_second[i]); } if (String::equalNoCase(className, "ThirdClass")) { handler.processing(); for(Uint32 i = 0, n = _instances_third.size(); i < n; i++) // deliver instance handler.deliver(_instances_third[i]); } cout <<"Calling Exception ExceptionsTest::enumerateInstances 2" << endl; CheckExceptionType(EXCEPTION_TYPE); // complete processing the request handler.complete(); }
void OperatingSystemProvider::getInstance(const OperationContext& context, const CIMObjectPath& ref, const Boolean includeQualifiers, const Boolean includeClassOrigin, const CIMPropertyList& propertyList, InstanceResponseHandler &handler) { Array<CIMKeyBinding> keys; CIMInstance instance; OperatingSystem os; CIMName className; String csName; String name; //-- make sure we're working on the right class className = ref.getClassName(); if (!(className.equal (STANDARDOPERATINGSYSTEMCLASS)) && !(className.equal (EXTENDEDOPERATINGSYSTEMCLASS))) throw CIMNotSupportedException("OperatingSystemProvider does not support class " + className.getString()); //-- make sure we're the right instance int keyCount; CIMName keyName; keyCount = 4; keys = ref.getKeyBindings(); if ((unsigned int)keys.size() != (unsigned int)keyCount) throw CIMInvalidParameterException("Wrong number of keys"); // doesn't seem as though this code will handle duplicate keys, // but it appears as though the CIMOM strips those out for us. // Despite test cases, don't get invoked with 2 keys of the same // name. if (!os.getCSName(csName)) { throw CIMOperationFailedException("OperatingSystemProvider " "Can't determine name of computer system"); } if (!os.getName(name)) { throw CIMOperationFailedException("OperatingSystemProvider " "Can't determine name of Operating System"); } for (unsigned int ii = 0; ii < keys.size(); ii++) { keyName = keys[ii].getName(); if ((keyName.equal ("CSCreationClassName")) && String::equalNoCase(keys[ii].getValue(), CSCREATIONCLASSNAME.getString())) { keyCount--; } else if ((keyName.equal ("CSName")) && String::equalNoCase(keys[ii].getValue(), csName)) { keyCount--; } else if ((keyName.equal ("CreationClassName")) && String::equalNoCase(keys[ii].getValue(), STANDARDOPERATINGSYSTEMCLASS.getString())) { keyCount--; } else if ((keyName.equal ("Name")) && String::equalNoCase(keys[ii].getValue(), name)) { keyCount--; } else { throw CIMInvalidParameterException("OperatingSystemProvider" " unrecognized key " + keyName.getString()); } } if (keyCount) { throw CIMInvalidParameterException("Wrong keys"); } OSP_DEBUG("losp-> getInstance got the right keys"); handler.processing(); //-- fill 'er up... instance = _build_instance(ref); instance.setPath(ref); OSP_DEBUG("losp-> getInstance built an instance"); handler.deliver(instance); handler.complete(); OSP_DEBUG("losp-> getInstance done"); return; }
/* ================================================================================ NAME : getInstance DESCRIPTION : Returns a single instance. ASSUMPTIONS : None PRE-CONDITIONS : POST-CONDITIONS : NOTES : LocalOnly, DeepInheritance and propertyList are not : respected by this provider. Localization is not supported PARAMETERS : ================================================================================ */ void BIPTLEpProvider::getInstance(const OperationContext &ctx, const CIMObjectPath &instanceName, const Boolean includeQualifiers, const Boolean includeClassOrigin, const CIMPropertyList &propertyList, InstanceResponseHandler &handler) { #ifdef DEBUG cout << "BIPTLEpProvider::getInstance(" << instanceName.toString() << ")" << endl; #endif CIMKeyBinding kb; CIMName className = instanceName.getClassName(); CIMNamespaceName nameSpace = instanceName.getNameSpace(); int i; int keysFound; // this will be used as a bit array String sn; // system name String lepName, // LAN Endpoint Name ipeName, // IP Protocol Endpoint Name refCCN, // Reference's Creation Class Name refName; // Reference's Name // Grab the system name if (IPInterface::getSystemName(sn) == false) sn = String::EMPTY; // Validate the classname _checkClass(className); // Extract the key values Array<CIMKeyBinding> kbArray = instanceName.getKeyBindings(); // Leave immediately if wrong number of keys if ( kbArray.size() != NUMKEYS_PG_BINDS_IP_TO_LAN_ENDPOINT ) throw CIMInvalidParameterException("Wrong number of keys"); // Validate the keys. // Each loop iteration will set a bit in keysFound when a valid // key is found. If the expected bits aren't all set when // the loop finishes, it's a problem for (i=0, keysFound=0; i < NUMKEYS_PG_BINDS_IP_TO_LAN_ENDPOINT; i++) { kb = kbArray[i]; CIMName keyName = kb.getName(); String keyValue = kb.getValue(); // Antecedent must match if (keyName.equal (PROPERTY_ANTECEDENT)) { if (_goodPERefKeys(keyValue, refCCN, refName) && String::equalNoCase(refCCN, CLASS_CIM_LAN_ENDPOINT.getString())) { keysFound |= 1; lepName = refName; } else throw CIMInvalidParameterException(keyValue+": bad value for key "+ keyName.getString()); } // Dependent must match else if (keyName.equal (PROPERTY_DEPENDENT)) { if (_goodPERefKeys(keyValue, refCCN, refName) && String::equalNoCase(refCCN, CLASS_CIM_IP_PROTOCOL_ENDPOINT.getString())) { keysFound |= 2; ipeName = refName; } else throw CIMInvalidParameterException(keyValue+": bad value for key "+ keyName.getString()); } // Key name was not recognized by any of the above tests else throw CIMInvalidParameterException(keyName.getString()+ ": Unrecognized key"); } // for // We could get here if we didn't get all the keys, which // could happen if the right number of keys were supplied, // and they all had valid names and values, but there were // any duplicates (e.g., two Names, no SystemName) if (keysFound != (1<<NUMKEYS_PG_BINDS_IP_TO_LAN_ENDPOINT)-1) throw CIMInvalidParameterException("Bad object name"); // Get the Interface List InterfaceList _ifList; IPInterface _ipif; // Make sure the LAN Endpoint name is embedded in the IP Protocol Endpoint // name. If we can find the request interface and if it's one that // binds to a LAN Interface, then we've found the right one, so // return it to the client. if (ipeName.find(lepName) != PEG_NOT_FOUND && _ifList.findInterface(ipeName, _ipif) && _ipif.bindsToLANInterface()) { /* Notify processing is starting. */ handler.processing(); /* Return the instance. */ handler.deliver(_constructInstance(className, nameSpace, _ipif)); /* Notify processing is complete. */ handler.complete(); return; } throw CIMObjectNotFoundException(ipeName+": No such IP Interface"); return; // can never execute, but required to keep compiler happy }