示例#1
0
void
_addSubscription (CIMClient & client, String & filter, String & handler)
{
  CIMObjectPath path;
  CIMInstance retrievedInstance;
  //
  //  Create subscriptions
  //
  CIMInstance subscription01 = _buildSubscriptionInstance
    (_buildFilterOrHandlerPath (PEGASUS_CLASSNAME_INDFILTER, filter),
     PEGASUS_CLASSNAME_INDHANDLER_CIMXML,
     _buildFilterOrHandlerPath (PEGASUS_CLASSNAME_INDHANDLER_CIMXML,
				handler));
  _addUint16Property (subscription01, "OnFatalErrorPolicy", 2);
  _addStringProperty (subscription01, "OtherOnFatalErrorPolicy",
		      String::EMPTY, true);
  _addUint64Property (subscription01, "FailureTriggerTimeInterval", 60);
  _addUint16Property (subscription01, "SubscriptionState", 2);
  _addStringProperty (subscription01, "OtherSubscriptionState", String::EMPTY,
		      true);
  _addUint64Property (subscription01, "SubscriptionDuration",
		      PEGASUS_UINT64_LITERAL (60000000000));
  _addUint16Property (subscription01, "RepeatNotificationPolicy", 1);
  _addStringProperty (subscription01, "OtherRepeatNotificationPolicy",
		      "another policy");
  _addUint64Property (subscription01, "RepeatNotificationInterval", 60);
  _addUint64Property (subscription01, "RepeatNotificationGap", 30);
  _addUint16Property (subscription01, "RepeatNotificationCount", 5);
  path = client.createInstance (NAMESPACE, subscription01);

  _checkSubscriptionPath (path, filter,
			  PEGASUS_CLASSNAME_INDHANDLER_CIMXML, handler);
  retrievedInstance = client.getInstance (NAMESPACE, path);
  _checkUint16Property (retrievedInstance, "OnFatalErrorPolicy", 2);
  _checkStringProperty (retrievedInstance, "OtherOnFatalErrorPolicy",
			String::EMPTY, true);
  _checkUint64Property (retrievedInstance, "FailureTriggerTimeInterval", 60);
  _checkUint16Property (retrievedInstance, "SubscriptionState", 2);
  _checkStringProperty (retrievedInstance, "OtherSubscriptionState",
			String::EMPTY, true);
  _checkUint64Property (retrievedInstance, "SubscriptionDuration",
			PEGASUS_UINT64_LITERAL (60000000000));
  _checkUint16Property (retrievedInstance, "RepeatNotificationPolicy", 1);
  _checkStringProperty (retrievedInstance, "OtherRepeatNotificationPolicy",
			"another policy");
  _checkUint64Property (retrievedInstance, "RepeatNotificationInterval", 60);
  _checkUint64Property (retrievedInstance, "RepeatNotificationGap", 30);
  _checkUint16Property (retrievedInstance, "RepeatNotificationCount", 5);
}
示例#2
0
void
_deleteFilterInstance (CIMClient & client, const String & name)
{
  CIMObjectPath path = _buildFilterOrHandlerPath
    (PEGASUS_CLASSNAME_INDFILTER, name);
  client.deleteInstance (NAMESPACE, path);
}
示例#3
0
void _createSubscription(
    CIMClient& client,
    const String& filterName,
    const String& handlerName,
    Uint16 onFatalErrorPolicy = 2)
{
    CIMObjectPath filterPath;
    CIMObjectPath handlerPath;
    filterPath = _buildFilterOrHandlerPath(
        PEGASUS_CLASSNAME_INDFILTER, filterName, String::EMPTY,
        CIMNamespaceName());
    handlerPath = _buildFilterOrHandlerPath(
        PEGASUS_CLASSNAME_LSTNRDST_CIMXML, handlerName, String::EMPTY,
        CIMNamespaceName());
    _createSubscriptionInstance(
        client,
        filterPath,
        handlerPath,
        onFatalErrorPolicy);
}
void _create2 (CIMClient & client)
{
    try
    {
        _createSubscriptionInstance (client, 
            _buildFilterOrHandlerPath (PEGASUS_CLASSNAME_INDFILTER, 
                "DEFilter02", NAMESPACE1),
            _buildFilterOrHandlerPath (PEGASUS_CLASSNAME_INDHANDLER_CIMXML,
                "DEHandler02", NAMESPACE2), NAMESPACE3);
    }
    catch (Exception & e)
    {
        PEGASUS_STD (cerr) << "create2 failed: " << e.getMessage ()
                           << PEGASUS_STD (endl);
        exit (-1);
    }

    PEGASUS_STD (cout) << "+++++ create2 completed successfully"
                       << PEGASUS_STD (endl);
}
示例#5
0
CIMObjectPath _buildSubscriptionPath
  (const String & filterName,
   const CIMName & handlerClass, const String & handlerName)
{
  CIMObjectPath filterPath = _buildFilterOrHandlerPath
    (PEGASUS_CLASSNAME_INDFILTER, filterName);

  CIMObjectPath handlerPath = _buildFilterOrHandlerPath (handlerClass,
							 handlerName);

  Array < CIMKeyBinding > subscriptionKeyBindings;
  subscriptionKeyBindings.append (CIMKeyBinding ("Filter",
						 filterPath.toString (),
						 CIMKeyBinding::REFERENCE));
  subscriptionKeyBindings.
    append (CIMKeyBinding
	    ("Handler", handlerPath.toString (), CIMKeyBinding::REFERENCE));
  CIMObjectPath subscriptionPath ("", CIMNamespaceName (),
				  PEGASUS_CLASSNAME_INDSUBSCRIPTION,
				  subscriptionKeyBindings);

  return subscriptionPath;
}
示例#6
0
void _checkSubscriptionPath
  (const CIMObjectPath & path,
   const String & filterName,
   const CIMName & handlerClass, const String & handlerName)
{
  PEGASUS_ASSERT (path.getClassName () == PEGASUS_CLASSNAME_INDSUBSCRIPTION);
  Array < CIMKeyBinding > keyBindings = path.getKeyBindings ();
  Boolean filterFound = false;
  Boolean handlerFound = false;
  for (Uint32 i = 0; i < keyBindings.size (); i++)
    {
      if (keyBindings[i].getName ().equal ("Filter"))
	{
	  filterFound = true;
	  CIMObjectPath filterPath = _buildFilterOrHandlerPath
	    (PEGASUS_CLASSNAME_INDFILTER, filterName);
	  PEGASUS_ASSERT (keyBindings[i].getValue () ==
			  filterPath.toString ());
	}
      else if (keyBindings[i].getName ().equal ("Handler"))
	{
	  handlerFound = true;
	  CIMObjectPath handlerPath = _buildFilterOrHandlerPath
	    (handlerClass, handlerName);
	  PEGASUS_ASSERT (keyBindings[i].getValue () ==
			  handlerPath.toString ());
	}
      else
	{
	  PEGASUS_ASSERT (false);
	}
    }

  PEGASUS_ASSERT (filterFound);
  PEGASUS_ASSERT (handlerFound);
}
示例#7
0
void _deleteHandlerInstance
  (CIMClient & client, const CIMName & className, const String & name)
{
  CIMObjectPath path = _buildFilterOrHandlerPath (className, name);
  client.deleteInstance (NAMESPACE, path);
}