Beispiel #1
0
Boolean operator==(const CIMKeyBinding& x, const CIMKeyBinding& y)
{
    // Check that the names and types match
    if (!(x.getName().equal(y.getName())) ||
        !(x.getType() == y.getType()))
    {
        return false;
    }

    switch (x.getType())
    {
    case CIMKeyBinding::REFERENCE:
        try
        {
            // References should be compared as CIMObjectPaths
            return (CIMObjectPath(x.getValue()) == CIMObjectPath(y.getValue()));
        }
        catch (Exception&)
        {
            // If CIMObjectPath parsing fails, just compare strings
            return String::equal(x.getValue(), y.getValue());
        }
    case CIMKeyBinding::BOOLEAN:
        // Case-insensitive comparison is sufficient for booleans
        return String::equalNoCase(x.getValue(), y.getValue());
    case CIMKeyBinding::NUMERIC:
        // Note: This comparison assumes XML syntax for integers
        // First try comparing as unsigned integers
        {
            Uint64 xValue;
            Uint64 yValue;
            if (StringConversion::stringToUnsignedInteger(
                    x.getValue().getCString(), xValue) &&
                StringConversion::stringToUnsignedInteger(
                    y.getValue().getCString(), yValue))
            {
                return (xValue == yValue);
            }
        }
        // Next try comparing as signed integers
        {
            Sint64 xValue;
            Sint64 yValue;
            if (StringConversion::stringToSignedInteger(
                    x.getValue().getCString(), xValue) &&
                StringConversion::stringToSignedInteger(
                    y.getValue().getCString(), yValue))
            {
                return (xValue == yValue);
            }
        }
        // Note: Keys may not be real values, so don't try comparing as reals
        // We couldn't parse the numbers, so just compare the strings
        return String::equal(x.getValue(), y.getValue());
    default:  // CIMKeyBinding::STRING
        return String::equal(x.getValue(), y.getValue());
    }

    PEGASUS_UNREACHABLE(return false;)
}
//Test reference array type properties
void test05()
{
    Array<CIMObjectPath> oa;
    oa.append(CIMObjectPath("/root/cimv2:My_Class.a=1"));
    oa.append(CIMObjectPath("/root/cimv2:My_Class.a=2"));
    CIMProperty p1;

    Boolean gotException = false;
    try
    {
        p1 = CIMProperty(CIMName("property1"), oa, 0, CIMName("refclass"));
    }
    catch (TypeMismatchException&)
    {
        gotException = true;
    }
    PEGASUS_TEST_ASSERT(gotException);

    p1 = CIMProperty(CIMName("property1"), oa[0], 0, CIMName("refclass"));
    gotException = false;
    try
    {
        p1.setValue(oa);
    }
    catch (TypeMismatchException&)
    {
        gotException = true;
    }
    PEGASUS_TEST_ASSERT(gotException);
}
void InstanceProvider::initialize(CIMOMHandle & cimom)
{
	// create default instances
	CIMInstance instance1("Sample_InstanceProviderClass");
        instance1.setPath(CIMObjectPath("Sample_InstanceProviderClass.Identifier=1"));

	instance1.addProperty(CIMProperty("Identifier", Uint8(1)));   // key
	instance1.addProperty(CIMProperty("Message", String("Hello World")));

	_instances.append(instance1);

	CIMInstance instance2("Sample_InstanceProviderClass");
        instance2.setPath(CIMObjectPath("Sample_InstanceProviderClass.Identifier=2"));

	instance2.addProperty(CIMProperty("Identifier", Uint8(2)));   // key
	instance2.addProperty(CIMProperty("Message", String("Yo Planet")));

	_instances.append(instance2);

	CIMInstance instance3("Sample_InstanceProviderClass");
        instance3.setPath(CIMObjectPath("Sample_InstanceProviderClass.Identifier=3"));

	instance3.addProperty(CIMProperty("Identifier", Uint8(3)));   // key
	instance3.addProperty(CIMProperty("Message", String("Hey Earth")));

	_instances.append(instance3);
}
Beispiel #4
0
int _getInstance(const int argc, const char **argv)
{
  if (argv[0] == 0)
  {
    _giUsage();
    return 1;
  }
  
  // need to get class definition to find keys
  // first arg is name of class
  CIMClass cldef;
  try
  {
    cldef = _c.getClass( _nameSpace, argv[0] );
  }
  catch(Exception& e)
  {
    cerr << /* "getInstance: " << */ e.getMessage() << endl;
    return 1;
  }

  CIMObjectPath ref;
  CIMInstance inst;

  // If there are no more args, prompt user for keys
  if (argv[1] == 0) ref = CIMObjectPath(String::EMPTY, // hostname left blank
                                       _nameSpace,
                                       argv[0],
                                       _inputInstanceKeys(cldef));
  
  // else if there's another arg and it's "list", enumInstNames and print
  // a list from which user will select (return if none)
  else if (String::equalNoCase("list",argv[1]))
  {
    ref = _selectInstance(argv[0]);
    // An empty ObjectPath means nothing was selected
    if (ref.identical(CIMObjectPath())) return 0;
  }
    
  // else there's another arg but it's invalid
  else
  {
    _giUsage();
    return 1;
  }

  // get the specified instance
  try
  {
    inst = _c.getInstance(_nameSpace,ref);
  }
  catch(Exception& e)
  {
    cerr << /* "getInstance: " << */ e.getMessage() << endl;
    return 1;
  }
  _displayInstance(inst);
  return 0;
}
Beispiel #5
0
/*
================================================================================
NAME              : _constructKeyBindings
DESCRIPTION       : Constructs an array of keybindings for an IP Interface
ASSUMPTIONS       : None
PRE-CONDITIONS    :
POST-CONDITIONS   :
NOTES             :
PARAMETERS        : className, Process
================================================================================
*/
Array<CIMKeyBinding> BIPTLEpProvider::_constructKeyBindings(
					const CIMNamespaceName &nameSpace,
					const IPInterface &_ipif)
{
#ifdef DEBUG
  cout << "BIPTLEpProvider::_constructKeyBindings()" << endl;
#endif

  Array<CIMKeyBinding> keyBindings;
  String s, sn;
  CIMObjectPath op;

  if (_ipif.getSystemName(sn) == false)
  {
	throw CIMNotSupportedException(
		String("Host-specific module doesn't support Key `") +
		PROPERTY_SYSTEM_NAME.getString() + String("'"));
  }

  // Construct the key bindings
  op = CIMObjectPath(sn, //hostname
		       nameSpace,
		       CLASS_CIM_LAN_ENDPOINT,
                       _constructReference(
		                   CLASS_CIM_LAN_ENDPOINT,
				   sn,_ipif.get_LANInterfaceName()) );

  keyBindings.append(CIMKeyBinding(PROPERTY_ANTECEDENT,
                                   op.toString(),
                                   CIMKeyBinding::REFERENCE));

  if (_ipif.getName(s))
  {
	  op = CIMObjectPath(sn, //hostname
			       nameSpace,
			       CLASS_CIM_IP_PROTOCOL_ENDPOINT,
                               _constructReference(
			                   CLASS_CIM_IP_PROTOCOL_ENDPOINT,
					   sn,s) );

	  keyBindings.append(CIMKeyBinding(PROPERTY_DEPENDENT,
			     op.toString(),
                             CIMKeyBinding::REFERENCE));
  }
  else
  {
	throw CIMNotSupportedException(
		String("Host-specific module doesn't support Key `") +
		PROPERTY_NAME.getString() + String("'"));
  }

#ifdef DEBUG
  cout << "BIPTLEpProvider::_constructKeyBindings() -- done" << endl;
#endif

  return keyBindings;
}
Beispiel #6
0
int _getProperty(const int argc, const char **argv)
{
  // need to get class definition to find keys
  // first arg is name of class
  CIMClass cldef;
  try
  {
    cldef = _c.getClass( PEGASUS_NAMESPACENAME_INTEROP, argv[0] );
  }
  catch(Exception& e)
  {
    cerr << /* "getProperty: " << */ e.getMessage() << endl;
    return 1;
  }

  CIMObjectPath ref;
  CIMInstance inst;

  // If next arg is "ask", prompt user for keys
  if (String::equalNoCase("ask",argv[1])) ref = 
            CIMObjectPath(String::EMPTY,
                          PEGASUS_NAMESPACENAME_INTEROP,
                          argv[0],
                          _inputInstanceKeys(cldef) );

  // else if the next arg and is "list", enumInstNames and print
  // a list from which user will select  
  else if (String::equalNoCase("list",argv[1]))
  {
    ref = _selectInstance( argv[0] );
    if (ref.identical(CIMObjectPath())) return 0;
  }

  // else there's another arg but it's invalid
  else
  {
    return 1;
  }

  CIMProperty pDef;
  // if no more args, display property names and ask which
  if (argc < 3)
  {
    int n;
    for (n=0; n<cldef.getPropertyCount(); n++)
      cerr << n+1 << ": " << cldef.getProperty(n).getName().getString() << endl;
    cerr << "Property (1.." << cldef.getPropertyCount() << ")? ";
    cin >> n;
    pDef = cldef.getProperty(n-1);
  }
Beispiel #7
0
void testUserContextRequestor()
{
    try
    {
        CIMClient client;
        client.connectLocal();

        // Determine whether the CIM Server has authentication enabled

        CIMObjectPath authConfigInstName = CIMObjectPath(
            "PG_ConfigSetting.PropertyName=\"enableAuthentication\""); 
        CIMInstance authConfigInst =
            client.getInstance("root/PG_Internal", authConfigInstName);

        String authConfigValue;
        authConfigInst.getProperty(authConfigInst.findProperty("CurrentValue"))
            .getValue().get(authConfigValue);
        Boolean authenticationEnabled =
            String::equalNoCase(authConfigValue, "true");

        // Test a provider running in Requestor user context

        CIMObjectPath instName =
            CIMObjectPath("TST_UserContextRequestor.Id=1");
        CIMInstance cimInstance = client.getInstance(NAMESPACE, instName);

        String userContext;
        cimInstance.getProperty(cimInstance.findProperty("UserContext"))
            .getValue().get(userContext);

        if (verbose)
        {
            cout << "Requestor test: UserContext = " << userContext << endl;
        }

        if (authenticationEnabled)
        {
            PEGASUS_TEST_ASSERT(userContext == System::getEffectiveUserName());
        }
        else
        {
            PEGASUS_TEST_ASSERT(userContext == serverUserContext);
        }
    }
    catch (Exception& e)
    {
        cerr << "Error: " << e.getMessage() << endl;
        exit(1);
    }
}
CIMInstance UNIX_ClassifierElementInClassifierServiceProvider::constructInstance(
	const CIMName &className,
	const CIMNamespaceName &nameSpace,
	const UNIX_ClassifierElementInClassifierService &_p)
{
	CIMProperty p;

	CIMInstance inst(className);

	// Set path
	inst.setPath(CIMObjectPath(String(""), // hostname
			nameSpace,
			CIMName("UNIX_ClassifierElementInClassifierService"),
			constructKeyBindings(_p)));

	//CIM_Component Properties
	if (_p.getGroupComponent(p)) inst.addProperty(p);
	if (_p.getPartComponent(p)) inst.addProperty(p);

	//CIM_ServiceComponent Properties

	//CIM_ClassifierElementInClassifierService Properties
	if (_p.getClassifierOrder(p)) inst.addProperty(p);


	return inst;
}
CIMInstance UNIX_BlockStatisticsManifestCollectionProvider::constructInstance(
	const CIMName &className,
	const CIMNamespaceName &nameSpace,
	const UNIX_BlockStatisticsManifestCollection &_p)
{
	CIMProperty p;

	CIMInstance inst(className);

	// Set path
	inst.setPath(CIMObjectPath(String(""), // hostname
			nameSpace,
			CIMName("UNIX_BlockStatisticsManifestCollection"),
			constructKeyBindings(_p)));

	//CIM_ManagedElement Properties
	if (_p.getInstanceID(p)) inst.addProperty(p);
	if (_p.getCaption(p)) inst.addProperty(p);
	if (_p.getDescription(p)) inst.addProperty(p);
	if (_p.getElementName(p)) inst.addProperty(p);

	//CIM_Collection Properties

	//CIM_SystemSpecificCollection Properties

	//CIM_BlockStatisticsManifestCollection Properties
	if (_p.getIsDefault(p)) inst.addProperty(p);


	return inst;
}
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();
}
CIMInstance UNIX_AssociatedSupplyVoltageSensorProvider::constructInstance(
	const CIMName &className,
	const CIMNamespaceName &nameSpace,
	const UNIX_AssociatedSupplyVoltageSensor &_p)
{
	CIMProperty p;

	CIMInstance inst(className);

	// Set path
	inst.setPath(CIMObjectPath(String(""), // hostname
			nameSpace,
			CIMName("UNIX_AssociatedSupplyVoltageSensor"),
			constructKeyBindings(_p)));

	//CIM_Dependency Properties
	if (_p.getAntecedent(p)) inst.addProperty(p);
	if (_p.getDependent(p)) inst.addProperty(p);

	//CIM_AssociatedSensor Properties

	//CIM_AssociatedSupplyVoltageSensor Properties
	if (_p.getMonitoringRange(p)) inst.addProperty(p);


	return inst;
}
CIMInstance UNIX_AccountSettingDataProvider::constructInstance(
	const CIMName &className,
	const CIMNamespaceName &nameSpace,
	const UNIX_AccountSettingData &_p)
{
	CIMProperty p;

	CIMInstance inst(className);

	// Set path
	inst.setPath(CIMObjectPath(String(""), // hostname
			nameSpace,
			CIMName("UNIX_AccountSettingData"),
			constructKeyBindings(_p)));

	//CIM_ManagedElement Properties
	if (_p.getInstanceID(p)) inst.addProperty(p);
	if (_p.getCaption(p)) inst.addProperty(p);
	if (_p.getDescription(p)) inst.addProperty(p);
	if (_p.getElementName(p)) inst.addProperty(p);

	//CIM_SettingData Properties
	if (_p.getChangeableType(p)) inst.addProperty(p);
	if (_p.getConfigurationName(p)) inst.addProperty(p);

	//CIM_AccountSettingData Properties
	if (_p.getComplexPasswordRulesEnforced(p)) inst.addProperty(p);
	if (_p.getInactivityTimeout(p)) inst.addProperty(p);
	if (_p.getMaximumPasswordExpiration(p)) inst.addProperty(p);
	if (_p.getMaximumSuccessiveLoginFailures(p)) inst.addProperty(p);
	if (_p.getPasswordHistoryDepth(p)) inst.addProperty(p);


	return inst;
}
CIMInstance UNIX_CalculationBasedOnQueueProvider::constructInstance(
	const CIMName &className,
	const CIMNamespaceName &nameSpace,
	const UNIX_CalculationBasedOnQueue &_p)
{
	CIMProperty p;

	CIMInstance inst(className);

	// Set path
	inst.setPath(CIMObjectPath(String(""), // hostname
			nameSpace,
			CIMName("UNIX_CalculationBasedOnQueue"),
			constructKeyBindings(_p)));

	//CIM_Dependency Properties
	if (_p.getAntecedent(p)) inst.addProperty(p);
	if (_p.getDependent(p)) inst.addProperty(p);

	//CIM_ProvidesServiceToElement Properties

	//CIM_ServiceServiceDependency Properties
	if (_p.getTypeOfDependency(p)) inst.addProperty(p);
	if (_p.getRestartService(p)) inst.addProperty(p);

	//CIM_CalculationBasedOnQueue Properties


	return inst;
}
CIMInstance UNIX_BGPPeerUsesRouteMapProvider::constructInstance(
	const CIMName &className,
	const CIMNamespaceName &nameSpace,
	const UNIX_BGPPeerUsesRouteMap &_p)
{
	CIMProperty p;

	CIMInstance inst(className);

	// Set path
	inst.setPath(CIMObjectPath(String(""), // hostname
			nameSpace,
			CIMName("UNIX_BGPPeerUsesRouteMap"),
			constructKeyBindings(_p)));

	//CIM_MemberOfCollection Properties
	if (_p.getCollection(p)) inst.addProperty(p);
	if (_p.getMember(p)) inst.addProperty(p);

	//CIM_CollectedMSEs Properties

	//CIM_BGPPeerUsesRouteMap Properties
	if (_p.getMapSequence(p)) inst.addProperty(p);


	return inst;
}
Beispiel #15
0
void InstanceProvider::deleteInstance(
	const OperationContext & context,
	const CIMObjectPath & instanceReference,
	ResponseHandler & handler)
{
	// convert a potential fully qualified reference into a local reference
	// (class name and keys only).
	CIMObjectPath localReference = CIMObjectPath(
		String(),
		CIMNamespaceName(),
		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 == _instances[i].getPath())
		{
			// remove instance from the array
			_instances.remove(i);

			break;
		}
	}
	
	// complete processing the request
	handler.complete();
}
CIMInstance UNIX_BootConfigSettingProvider::constructInstance(
	const CIMName &className,
	const CIMNamespaceName &nameSpace,
	const UNIX_BootConfigSetting &_p)
{
	CIMProperty p;

	CIMInstance inst(className);

	// Set path
	inst.setPath(CIMObjectPath(String(""), // hostname
			nameSpace,
			CIMName("UNIX_BootConfigSetting"),
			constructKeyBindings(_p)));

	//CIM_ManagedElement Properties
	if (_p.getInstanceID(p)) inst.addProperty(p);
	if (_p.getCaption(p)) inst.addProperty(p);
	if (_p.getDescription(p)) inst.addProperty(p);
	if (_p.getElementName(p)) inst.addProperty(p);

	//CIM_SettingData Properties
	if (_p.getChangeableType(p)) inst.addProperty(p);
	if (_p.getConfigurationName(p)) inst.addProperty(p);

	//CIM_BootConfigSetting Properties


	return inst;
}
Beispiel #17
0
void testInstanceCollection()
{
    Buffer expected;
    FileSystem::loadFileToMemory(expected, "./instanceCollection.json");
    if (verbose) cout << "Expected: " << expected.getData() << endl;

    Buffer outputBuffer;
    JSONWriter writer(outputBuffer);
    CIMName className = "className";

    Array<CIMObject> instances;

    for (Uint32 i = 0; i < 10; i++)
    {
        CIMInstance x(className);
        x.addProperty(CIMProperty(CIMName("boolProp"), CIMValue(true)));
        x.addProperty(CIMProperty(CIMName("intProp"), CIMValue(i)));
        x.addProperty(CIMProperty(
                CIMName("stringProp"),
                CIMValue(String("hello world"))));
        Buffer objPath;
        objPath << className.getString() << ".intProp=" << i;
        x.setPath(CIMObjectPath(objPath.getData()));
        instances.append(x);
    }

    writer._append(instances);
    if (verbose) cout << "Got: " << outputBuffer.getData() << endl;

    PEGASUS_TEST_ASSERT(
            System::strcasecmp(
                expected.getData(),
                outputBuffer.getData()) == 0);
}
Beispiel #18
0
void AuditLogger::logUpdateInstanceOperation(
    const char* cimMethodName,
    AuditEvent eventType,
    const String& userName,
    const String& ipAddr,
    const CIMNamespaceName& nameSpace,
    const CIMObjectPath& instanceName,
    const String& moduleName,
    const String& providerName,
    CIMStatusCode statusCode)
{
    // check if SMF is gathering this type of records.
    if (_smf.isRecording(CIM_OPERATION) ||
        (! _isInternalWriterUsed) )
    {
        String cimInstanceName =
            CIMObjectPath("", CIMNamespaceName(), instanceName.getClassName(),
            instanceName.getKeyBindings()).toString();

        _writeCIMOperationRecord(
            INSTANCE_OPERATION, userName, statusCode,
            ipAddr, cimMethodName, cimInstanceName,
            nameSpace.getString(), providerName, moduleName );
    }
}
CIMInstance UNIX_BIOSServiceCapabilitiesProvider::constructInstance(
	const CIMName &className,
	const CIMNamespaceName &nameSpace,
	const UNIX_BIOSServiceCapabilities &_p)
{
	CIMProperty p;

	CIMInstance inst(className);

	// Set path
	inst.setPath(CIMObjectPath(String(""), // hostname
			nameSpace,
			CIMName("UNIX_BIOSServiceCapabilities"),
			constructKeyBindings(_p)));

	//CIM_ManagedElement Properties
	if (_p.getInstanceID(p)) inst.addProperty(p);
	if (_p.getCaption(p)) inst.addProperty(p);
	if (_p.getDescription(p)) inst.addProperty(p);
	if (_p.getElementName(p)) inst.addProperty(p);

	//CIM_Capabilities Properties

	//CIM_BIOSServiceCapabilities Properties
	if (_p.getMethodsSupported(p)) inst.addProperty(p);
	if (_p.getSupportedPasswordAlgorithms(p)) inst.addProperty(p);
	if (_p.getSupportedPasswordEncodings(p)) inst.addProperty(p);


	return inst;
}
Beispiel #20
0
void ParserTestProvider::enumerateInstanceNames(
    const OperationContext & context,
    const CIMObjectPath & classReference,
    ObjectPathResponseHandler & handler)
{
    //DEBUG("enumerateInstanceNames()");

    // begin processing the request
    CIMName className = classReference.getClassName();
    CIMNamespaceName nameSpace = classReference.getNameSpace();
    //DEBUG("[className: "<<className<<"], [in namespace: "<<nameSpace<<"]");

    handler.processing();

    Array<CIMKeyBinding> keys;

    keys.append(CIMKeyBinding("CName", 
                    String(CLASS_NAME),
                    CIMKeyBinding::STRING));
    keys.append(CIMKeyBinding("BadStr", 
                    String(BADSTR_1),
                    CIMKeyBinding::STRING));
    
    CIMObjectPath obj_path = CIMObjectPath(String(), 
                                nameSpace, 
                                className,
                                keys);
    handler.deliver(obj_path);
    // complete processing the request
    handler.complete();
}
Beispiel #21
0
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 CIMServer::auditLogInitializeCallback()
{
#ifdef PEGASUS_ENABLE_AUDIT_LOGGER

    Array<String> propertyNames;
    Array<String> propertyValues;

    // Get all current property names and values
    ConfigManager* configManager = ConfigManager::getInstance();

    configManager->getAllPropertyNames(propertyNames, false);

    for (Uint32 i = 0; i < propertyNames.size(); i++)
    {
        propertyValues.append(configManager->getCurrentValue(propertyNames[i]));
    }

    AuditLogger::logCurrentConfig(propertyNames, propertyValues);

    // get currently registered provider module instances
    Array<CIMInstance> moduleInstances;

    moduleInstances =
        _cimserver->_providerRegistrationManager->enumerateInstancesForClass(
        CIMObjectPath("PG_ProviderModule"));

    AuditLogger::logCurrentRegProvider(moduleInstances);

    AuditLogger::logCurrentEnvironmentVar();

#endif
}
CIMInstance UNIX_IPRouteProvider::_constructInstance(
    const CIMName &className,
    const CIMNamespaceName &nameSpace,
    const UNIX_IPRoute &_p)
{
  CIMProperty p;

  CIMInstance inst(className);

  // Set path
  inst.setPath(CIMObjectPath(String(""), // hostname
                             nameSpace,
                             CLASS_IMPLEMENTATION_CIM_NAME,
                             _constructKeyBindings(_p)));
  
  addManagedSystemElementProperties(inst, _p);

  if (_p.getAddressType(p)) inst.addProperty(p);
  if (_p.getServiceCreationClassName(p)) inst.addProperty(p);
  if (_p.getServiceName(p)) inst.addProperty(p);
  if (_p.getDestinationAddress(p)) inst.addProperty(p);
  if (_p.getDestinationMask(p)) inst.addProperty(p);
  if (_p.getIPDestinationAddress(p)) inst.addProperty(p);
  if (_p.getIPDestinationMask(p)) inst.addProperty(p);
  if (_p.getIsStatic(p)) inst.addProperty(p);
  return inst;
}
CIMInstance UNIX_AggregateRedundancyComponentProvider::constructInstance(
	const CIMName &className,
	const CIMNamespaceName &nameSpace,
	const UNIX_AggregateRedundancyComponent &_p)
{
	CIMProperty p;

	CIMInstance inst(className);

	// Set path
	inst.setPath(CIMObjectPath(String(""), // hostname
			nameSpace,
			CIMName("UNIX_AggregateRedundancyComponent"),
			constructKeyBindings(_p)));

	//CIM_Component Properties
	if (_p.getGroupComponent(p)) inst.addProperty(p);
	if (_p.getPartComponent(p)) inst.addProperty(p);

	//CIM_RedundancyComponent Properties

	//CIM_ExtentRedundancyComponent Properties

	//CIM_AggregateRedundancyComponent Properties


	return inst;
}
void ComputerSystemProvider::enumerateInstanceNames(
    const OperationContext& context,
    const CIMObjectPath &ref,
    ObjectPathResponseHandler& 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));

        handler.deliver(CIMObjectPath(
            _cs.getHostName(),
            ref.getNameSpace(),
            CLASS_EXTENDED_COMPUTER_SYSTEM,
            keys));
    }

    handler.complete();
    return;
}
void TestFaultyInstanceProvider::initialize(CIMOMHandle& cimom)
{
    // save cimom handle
    //_cimom = cimom;

    char namebuf[20];
    char pathbuf[45];
    memset(namebuf, 0x00, sizeof(namebuf));
    memset(pathbuf, 0x00, sizeof(pathbuf));

    // create default instances
    for (Uint32 i = 1; i <= 2; i++)
    {
        sprintf(namebuf, "%u", i);
        sprintf(pathbuf, "TST_FaultyInstanceInstance.Name=\"%u\"", i);
        {
            CIMInstance instance("TST_FaultyInstanceInstance");

            instance.addProperty(CIMProperty("name", String(namebuf)));
            instance.addProperty(CIMProperty("s", String("specified")));
            instance.addProperty(CIMProperty("n", Uint64(i)));
            instance.addProperty(CIMProperty("f", Real64(Real64(i)+0.001)));
            instance.addProperty(
                CIMProperty("d", CIMDateTime::getCurrentDateTime()));

            instance.setPath(CIMObjectPath(pathbuf));

            _instances.append(instance);
        }
    }
}
CIMInstance UNIX_AuthorizationServiceProvider::constructInstance(
	const CIMName &className,
	const CIMNamespaceName &nameSpace,
	const UNIX_AuthorizationService &_p)
{
	CIMProperty p;

	CIMInstance inst(className);

	// Set path
	inst.setPath(CIMObjectPath(String(""), // hostname
			nameSpace,
			CIMName("UNIX_AuthorizationService"),
			constructKeyBindings(_p)));

	//CIM_ManagedElement Properties
	if (_p.getInstanceID(p)) inst.addProperty(p);
	if (_p.getCaption(p)) inst.addProperty(p);
	if (_p.getDescription(p)) inst.addProperty(p);
	if (_p.getElementName(p)) inst.addProperty(p);

	//CIM_ManagedSystemElement Properties
	if (_p.getInstallDate(p)) inst.addProperty(p);
	if (_p.getName(p)) inst.addProperty(p);
	if (_p.getOperationalStatus(p)) inst.addProperty(p);
	if (_p.getStatusDescriptions(p)) inst.addProperty(p);
	if (_p.getStatus(p)) inst.addProperty(p);
	if (_p.getHealthState(p)) inst.addProperty(p);
	if (_p.getCommunicationStatus(p)) inst.addProperty(p);
	if (_p.getDetailedStatus(p)) inst.addProperty(p);
	if (_p.getOperatingStatus(p)) inst.addProperty(p);
	if (_p.getPrimaryStatus(p)) inst.addProperty(p);

	//CIM_LogicalElement Properties

	//CIM_EnabledLogicalElement Properties
	if (_p.getEnabledState(p)) inst.addProperty(p);
	if (_p.getOtherEnabledState(p)) inst.addProperty(p);
	if (_p.getRequestedState(p)) inst.addProperty(p);
	if (_p.getEnabledDefault(p)) inst.addProperty(p);
	if (_p.getTimeOfLastStateChange(p)) inst.addProperty(p);
	if (_p.getAvailableRequestedStates(p)) inst.addProperty(p);
	if (_p.getTransitioningToState(p)) inst.addProperty(p);

	//CIM_Service Properties
	if (_p.getSystemCreationClassName(p)) inst.addProperty(p);
	if (_p.getSystemName(p)) inst.addProperty(p);
	if (_p.getCreationClassName(p)) inst.addProperty(p);
	if (_p.getPrimaryOwnerName(p)) inst.addProperty(p);
	if (_p.getPrimaryOwnerContact(p)) inst.addProperty(p);
	if (_p.getStartMode(p)) inst.addProperty(p);
	if (_p.getStarted(p)) inst.addProperty(p);

	//CIM_SecurityService Properties

	//CIM_AuthorizationService Properties


	return inst;
}
CIMInstance UNIX_ComputerSystemMappedIOProvider::constructInstance(
	const CIMName &className,
	const CIMNamespaceName &nameSpace,
	const UNIX_ComputerSystemMappedIO &_p)
{
	CIMProperty p;

	CIMInstance inst(className);

	// Set path
	inst.setPath(CIMObjectPath(String(""), // hostname
			nameSpace,
			CIMName("UNIX_ComputerSystemMappedIO"),
			constructKeyBindings(_p)));

	//CIM_Component Properties
	if (_p.getGroupComponent(p)) inst.addProperty(p);
	if (_p.getPartComponent(p)) inst.addProperty(p);

	//CIM_SystemComponent Properties

	//CIM_ResourceOfSystem Properties

	//CIM_ComputerSystemResource Properties

	//CIM_ComputerSystemMappedIO Properties


	return inst;
}
Beispiel #29
0
CIMObjectPath
OperatingSystemProvider::_fill_reference(const CIMNamespaceName &nameSpace,
				         const CIMName &className)
{
    Array<CIMKeyBinding> keys;
    OperatingSystem os;
    String csName;
    String 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");
    }

    keys.append(CIMKeyBinding("CSCreationClassName",
 	                   CSCREATIONCLASSNAME.getString(),
			   CIMKeyBinding::STRING));
    keys.append(CIMKeyBinding("CSName", csName, CIMKeyBinding::STRING));
    keys.append(CIMKeyBinding("CreationClassName",
                              STANDARDOPERATINGSYSTEMCLASS.getString(),
                              CIMKeyBinding::STRING));
    keys.append(CIMKeyBinding("Name", name, CIMKeyBinding::STRING));

    return CIMObjectPath(csName, nameSpace, className, keys);
}
Beispiel #30
0
void TimingProvider::modifyInstance(
    const OperationContext & context,
    const CIMObjectPath & instanceReference,
    const CIMInstance & instanceObject,
    const Boolean includeQualifiers,
    const CIMPropertyList & propertyList,
    ResponseHandler & 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());
    cout <<"TimingProvider::modifyInstance" << endl;
    // 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])
        {
            // overwrite existing instance
            _instances[i] = instanceObject;

            break;
        }
    }
    // complete processing the request
    handler.complete();
}