// ==================================================================
// PG_ProviderModule
// ==================================================================
- [Version("2.5.0"), Description ( "A ProviderModule contains "
+ [Version("2.11.0"), Description ( "A ProviderModule contains "
"one or more Providers. ") ]
class PG_ProviderModule : CIM_LogicalElement {
[Key, Override("Name"), Description ("A human-readable name that"
"CIM_ManagedSystemElement.OperationalStatus"} ]
string OtherStatusDescription;
+ [Description(
+ " A string specifying a group name for the provider module."
+ " If the specified value is \"CIMServer\", provider module"
+ " is loaded into the CIMServer process. Provider modules"
+ " having the same group name other than \"CIMServer\" are"
+ " loaded into a single agent process except when overridden"
+ " by specific UserContext values. If the value is not specified,"
+ " each provider module is loaded into different agent process."
+ " Provider modules having different UserContext values but the"
+ " same group name are loaded according to the UserContext"
+ " information")]
+ string ModuleGroupName;
+
+ [Description(
+ " Sets the module group name")]
+ sint16 setModuleGroupName([IN] string moduleGroupName);
+
[Description ("")]
uint32 start();
[Description ("")]
.\" .TA c \" lowercase initial letter of .TH name
.TH "cimprovider" "1" "" "" ""
.SH "NAME"
-cimprovider \- disable, enable, remove , list or display status of registered CIM providers or
+cimprovider \- disable, enable, remove , group, list or display status of registered CIM providers or
CIM provider modules
.SH "SYNOPSIS"
\fBcimprovider\fP \fB\-d\fP \fB\-m\fP module
\fBcimprovider\fP \fB\-r\fP \fB\-m\fP module [ \fB\-p\fP provider ]
-\fBcimprovider\fP \fB\-l\fP [ \fB\-s\fP | \fB\-m\fP module ]
+\fBcimprovider\fP \fB\-g\fP group \fB\-m\fP module
+
+\fBcimprovider\fP \fB\-l\fP [ \fB\-s\fP | \fB\-f\fP | \fB\-m\fP module ]
\fBcimprovider\fP \fB\-h\fP
.SH "DESCRIPTION"
The
.B cimprovider
-command provides a command line interface to disable, enable, unregister, and
-list registered CIM providers. If a CIM provider is disabled, the CIM Server
+command provides a command line interface to disable, enable, unregister, group
+and list registered CIM providers. If a CIM provider is disabled, the CIM Server
rejects any requests to the provider. If a CIM provider is enabled, the CIM
Server forwards requests to the provider. And if a CIM provider is
unregistered, the CIM Server will no longer have any information about the
must be re\-registered (typically by loading its registration schema via the
.B cimmof
command).
+.PP
+The fourth form of
+.B cimprovider
+sets the provider module group. If the provider module is active, provider module is disabled first,
+group is set and enabled again. If group name is
+.B CIMServer,
+provider module is loaded into
+.B CIMServer
+process depending on
+.B UserContext
+value. Specify empty string to remove from grouping.
.PP
The last form of
.B cimprovider
in the specified provider
.I module
(not affecting any other providers in that module).
+.TP
+.B \-g
+Sets the CIM provider module
+.I group.
+Specify empty string to remove from
+.I grouping.
+If the
+.I provider module
+is active,
+.I provider module
+is disabled first,
+.I group
+is set and enabled again. All
+.I provider modules
+with the same
+.I group
+name are loaded into a single agent process except when overridden by specific
+.I UserContext
+values. If
+.I group
+name is
+.I CIMServer
+,
+.I provider module
+is loaded into
+.I CIMServer process depending on
+.I UserContext
+value.
.TP
.B \-s
Displays the status of provider modules.
.TP
+.B \-f
+Displays the full status of provider modules with group name.
+.TP
.B \-\-version
Display CIM Server version number.
.SH "EXIT STATUS"
"OperatingSystemProvider" provider module.
.IP
.B cimprovider \-l \-m OperatingSystemProvider
+.PP
+Set the group name of the "OperatingSystemProvider" provider module to "CIMServer".
+.IP
+.B cimprovider \-g CIMServer \-m OperatingSystemProvider
+.PP
+Remove "OperatingSystemProvider" provider module from grouping.
+.IP
+.B cimprovider \-g """""" \-m OperatingSystemProvider
.SH "SEE ALSO"
.PP
cimmof(1), cimserver(1).
*/
static const Uint32 OPERATION_TYPE_VERSION = 6;
+/**
+ This constant represents provider module group set operation.
+*/
+static const Uint32 OPERATION_TYPE_GROUP = 7;
+
/**
The constants representing the messages.
static const char ERR_USAGE[] =
"Use '--help' to obtain command syntax.";
+static const char SETTING_PROVIDERMODULE_GROUP_KEY[] =
+ "Clients.cimprovider.CIMProviderCommand.SETTING_PROVIDERMODULE_GROUP";
+
+static const char SETTING_PROVIDERMODULE_GROUP[] =
+ "Setting the provider module group...";
+
+static const char SET_PROVIDERMODULE_GROUP_SUCCESS_KEY[] =
+ "Clients.cimprovider.CIMProviderCommand."
+ "SET_PROVIDERMODULE_GROUP_SUCCESS";
+
+static const char SET_PROVIDERMODULE_GROUP_SUCCESS[] =
+ "Provider module group set successfully.";
+
+static const char SET_PROVIDERMODULE_GROUP_FAILURE_KEY[] =
+ "Clients.cimprovider.CIMProviderCommand."
+ "SET_PROVIDERMODULE_GROUP_FAILURE";
+
+static const char SET_PROVIDERMODULE_GROUP_FAILURE[] =
+ "Failed to set the provider module group.";
+
+
static const char LONG_HELP[] = "help";
static const char LONG_VERSION[] = "version";
*/
static const char OPTION_STATUS = 's';
+/**
+ The option character used to specify get full module status.
+*/
+static const char OPTION_FULLSTATUS = 'f';
+
/**
The option character used to display help info.
*/
*/
static const char OPTION_VERSION = 'v';
+/**
+ The option character used to specify the module group name.
+*/
+static const char OPTION_GROUP = 'g';
+
/**
The name of the Method that implements stop provider or module
*/
*/
static const CIMName START_METHOD = CIMName("start");
+/**
+ The name of the Method that implements the provider module group setting.
+*/
+static const CIMName SETMODULEGROUPNAME_METHOD = CIMName("SetModuleGroupName");
+
+/**
+ ModuleGroupName param or property.
+*/
+static const String MODULEGROUPNAME = "ModuleGroupName";
+
/**
This is a CLI used to update providers of the CIM Server. This
command supports operations to stop, start, list and delete provider
ostream& outPrintWriter,
ostream& errPrintWriter);
+ //
+ // Sets the provider module group
+ //
+ // @param outPrintWriter The stream to which command output is written.
+ // @param errPrintWriter The stream to which command errors are written.
+ //
+ // @return Uint32 command result
+ // @exception CIMException if the setModuleGroupName operation generates
+ // an exception.
+ //
+ Uint32 _setProviderModuleGroupName(
+ ostream& outPrintWriter,
+ ostream& errPrintWriter);
+
+
//
// List all the registered providers or modules.
//
//
String _moduleName;
+ //
+ // The name of the provider module group.
+ //
+ String _moduleGroupName;
+
//
// The name of the provider.
//
//
Boolean _statusSet;
+ //
+ // The flag to indicate whether the full status is set or not
+ //
+ Boolean _fullStatusSet;
+
+ //
+ // The flag to indicate whether the group is set or not
+ //
+ Boolean _moduleGroupSet;
+
String usage;
};
_moduleSet = false;
_providerSet = false;
_statusSet = false;
+ _fullStatusSet = false;
+ _moduleGroupSet = false;
/**
Build the usage string for the config command.
usage.append(" -").append(OPTION_ENABLE);
usage.append(" -").append(OPTION_MODULE).append(" module \n");
+ usage.append(" -").append(OPTION_GROUP).append(" group");
+ usage.append(" -").append(OPTION_MODULE).append(" module \n");
+
usage.append(" -").append(OPTION_REMOVE);
usage.append(" -").append(OPTION_MODULE).append(" module");
usage.append(" [ -").append(OPTION_PROVIDER).append(" provider ] \n");
usage.append(" -").append(OPTION_LIST);
usage.append(" [ -").append(OPTION_STATUS);
+ usage.append(" | -").append(OPTION_FULLSTATUS);
usage.append(" | -").append(OPTION_MODULE).append(" module ] \n");
usage.append(" -").append(OPTION_HELP).append("\n");
"Disable the specified CIM provider module\n");
usage.append(" -e - "
"Enable the specified CIM provider module\n");
+ usage.append(" -g - "
+ "Sets the CIM provider module group. Specify\n"
+ " empty string to remove from grouping.\n"
+ " If the provider module is active, provider\n"
+ " module is disabled first, group is set and\n"
+ " enabled again. All provider modules with the same\n"
+ " group name are loaded into a single agent process\n"
+ " except when overridden by specific UserContext\n"
+ " values. If group name is CIMServer, provider module\n"
+ " is loaded into CIMServer process depending on\n"
+ " UserContext value\n");
usage.append(" -h, --help - Display this help message\n");
usage.append(" -l - "
"Display all the registered provider modules\n");
" it contains\n");
usage.append(" -s - "
"Display the status of registered provider modules\n");
+ usage.append(" -f - "
+ "Full status, display the status of registered\n"
+ " provider modules and module group name\n");
usage.append(" --version - Display CIM Server version number\n");
// Localize the usage text
//
optString.append(OPTION_DISABLE);
optString.append(OPTION_ENABLE);
+ optString.append(OPTION_GROUP);
+ optString.append(getoopt::GETOPT_ARGUMENT_DESIGNATOR);
optString.append(OPTION_HELP);
optString.append(OPTION_LIST);
optString.append(OPTION_MODULE);
optString.append(getoopt::GETOPT_ARGUMENT_DESIGNATOR);
optString.append(OPTION_REMOVE);
optString.append(OPTION_STATUS);
+ optString.append(OPTION_FULLSTATUS);
//
// Initialize and parse options
break;
}
+ case OPTION_GROUP:
+ {
+ if (_operationType != OPERATION_TYPE_UNINITIALIZED)
+ {
+ //
+ // More than one operation option was found
+ //
+ throw UnexpectedOptionException(OPTION_GROUP);
+ }
+
+ if (options.isSet(OPTION_GROUP) > 1)
+ {
+ //
+ // More than one group option was found
+ //
+ throw DuplicateOptionException(OPTION_GROUP);
+ }
+
+ _operationType = OPERATION_TYPE_GROUP;
+ _moduleGroupName = options[i].Value();
+ _moduleGroupSet = true;
+
+ break;
+ }
case OPTION_REMOVE:
{
if (_operationType != OPERATION_TYPE_UNINITIALIZED)
break;
}
+ case OPTION_FULLSTATUS:
+ {
+ if (options.isSet(OPTION_FULLSTATUS) > 1)
+ {
+ //
+ // More than one status option was found
+ //
+ throw DuplicateOptionException(OPTION_FULLSTATUS);
+ }
+
+ _fullStatusSet = true;
+
+ break;
+ }
case OPTION_HELP:
{
MSG_PATH, REQUIRED_ARGS_MISSING_KEY, REQUIRED_ARGS_MISSING));
}
- if (_operationType == OPERATION_TYPE_DISABLE)
+ if (_operationType == OPERATION_TYPE_DISABLE
+ || _operationType == OPERATION_TYPE_ENABLE
+ || _operationType == OPERATION_TYPE_GROUP)
{
if (_providerSet)
{
}
}
- if (_operationType == OPERATION_TYPE_ENABLE)
+ if (_operationType == OPERATION_TYPE_GROUP)
{
- if (_providerSet)
- {
- throw CommandFormatException(localizeMessage(MSG_PATH,
- UNEXPECTED_OPTION_KEY,
- UNEXPECTED_OPTION));
- }
-
- if (!_moduleSet)
+ if (!_moduleGroupSet)
{
- throw MissingOptionException(OPTION_MODULE);
+ throw MissingOptionException(OPTION_GROUP);
}
}
+
if (_operationType == OPERATION_TYPE_REMOVE && !_moduleSet)
{
throw MissingOptionException(OPTION_MODULE);
UNEXPECTED_OPTION));
}
- if (_operationType == OPERATION_TYPE_LIST && _statusSet && _moduleSet)
+ if (_operationType == OPERATION_TYPE_LIST &&
+ ( (_statusSet && _moduleSet) || (_fullStatusSet && _moduleSet) ||
+ _fullStatusSet && _statusSet))
{
throw CommandFormatException(localizeMessage(MSG_PATH,
UNEXPECTED_OPTION_KEY,
}
break;
+ case OPERATION_TYPE_GROUP:
+ try
+ {
+ return _setProviderModuleGroupName(
+ outPrintWriter, errPrintWriter);
+ }
+ catch (CIMException& e)
+ {
+ CIMStatusCode code = e.getCode();
+ if (code == CIM_ERR_FAILED)
+ {
+ outPrintWriter << localizeMessage(MSG_PATH,
+ SET_PROVIDERMODULE_GROUP_FAILURE_KEY,
+ SET_PROVIDERMODULE_GROUP_FAILURE) << endl;
+ errPrintWriter << e.getMessage() << endl;
+ }
+ else if (code == CIM_ERR_INVALID_CLASS)
+ {
+ outPrintWriter << localizeMessage(MSG_PATH,
+ SET_PROVIDERMODULE_GROUP_FAILURE_KEY,
+ SET_PROVIDERMODULE_GROUP_FAILURE) << endl;
+ outPrintWriter << localizeMessage(MSG_PATH,
+ PG_PROVIDER_SCHEMA_NOT_LOADED,
+ PG_PROVIDER_SCHEMA_NOT_LOADED) << endl;
+ }
+ else
+ {
+ errPrintWriter << e.getMessage() << endl;
+ }
+ return RC_ERROR;
+ }
+ catch (Exception& e)
+ {
+ errPrintWriter << e.getMessage() << endl;
+ return RC_ERROR;
+ }
+ break;
+
case OPERATION_TYPE_LIST:
try
{
}
//
+// Set the provider module group name
+//
+Uint32 CIMProviderCommand::_setProviderModuleGroupName(
+ ostream& outPrintWriter,
+ ostream& errPrintWriter)
+{
+ PEGASUS_ASSERT(_moduleSet);
+ PEGASUS_ASSERT(_moduleGroupSet);
+
+ // get the module instance
+ CIMInstance moduleInstance = _getModuleInstance();
+
+ CIMObjectPath moduleRef = moduleInstance.getPath();
+ moduleRef.setNameSpace(PEGASUS_NAMESPACENAME_PROVIDERREG);
+ moduleRef.setClassName(PEGASUS_CLASSNAME_PROVIDERMODULE);
+
+ CIMKeyBinding kb1(CIMName("Name"), _moduleName, CIMKeyBinding::STRING);
+ Array<CIMKeyBinding> keys;
+ keys.append(kb1);
+
+ moduleRef.setKeyBindings(keys);
+
+ outPrintWriter << localizeMessage(MSG_PATH,
+ SETTING_PROVIDERMODULE_GROUP_KEY,
+ SETTING_PROVIDERMODULE_GROUP) << endl;
+
+ Array<CIMParamValue> inParams;
+ Array<CIMParamValue> outParams;
+
+ inParams.append(CIMParamValue(MODULEGROUPNAME, _moduleGroupName));
+
+ CIMValue ret_value = _client->invokeMethod(
+ PEGASUS_NAMESPACENAME_PROVIDERREG,
+ moduleRef,
+ SETMODULEGROUPNAME_METHOD,
+ inParams,
+ outParams);
+
+ Sint16 retValue;
+ ret_value.get(retValue);
+ if (retValue == 0)
+ {
+ outPrintWriter << localizeMessage(MSG_PATH,
+ SET_PROVIDERMODULE_GROUP_SUCCESS_KEY,
+ SET_PROVIDERMODULE_GROUP_SUCCESS) << endl;
+ return RC_SUCCESS;
+ }
+ else
+ {
+ outPrintWriter << localizeMessage(MSG_PATH,
+ SET_PROVIDERMODULE_GROUP_FAILURE_KEY,
+ SET_PROVIDERMODULE_GROUP_FAILURE) << endl;
+ return RC_ERROR;
+ }
+}
+
// Enable the provider module
//
Uint32 CIMProviderCommand::_startProvider(
ostream& outPrintWriter,
ostream& errPrintWriter)
{
- Uint32 maxLength=0;
+ Uint32 maxModuleLength=0;
+ Uint32 maxStatusLength=0;
+
Uint32 length=0;
Array<Uint16> _status;
String output;
String statusValue;
- if (_statusSet)
+ Array<String> modulesStatus;
+
+ if (_statusSet || _fullStatusSet)
{
// get max length of module name
for (Uint32 i=0; i < moduleNames.size(); i++)
{
- if (maxLength < moduleNames[i].size())
+ if (maxModuleLength < moduleNames[i].size())
{
- maxLength = moduleNames[i].size();
+ maxModuleLength = moduleNames[i].size();
}
}
- output = "MODULE";
-
- for (Uint32 i = 0; i < maxLength; i++)
- {
- output.append(" ");
- }
-
- output.append("STATUS");
-#ifdef PEGASUS_OS_VMS
- //
- // When outputing to a file using outPrintWriter,
- // characters appear one per line.
- // Use printf instead.
- //
- printf("%s\n", (const char *) output.getCString());
-#else
- outPrintWriter << output << endl;
-#endif
-
for (Uint32 i =0; i < instances.size(); i++)
{
- output = moduleNames[i];
- length = maxLength +6 - moduleNames[i].size();
-
- for (Uint32 j = 0; j < length; j++)
- {
- output.append(" ");
- }
-
Uint32 pos = instances[i].findProperty(_PROPERTY_OPERATIONALSTATUS);
if (pos == PEG_NOT_FOUND)
{
output.append(statusValue);
output.append(" ");
}
+ modulesStatus.append(output);
+ if (output.size() > maxStatusLength)
+ {
+ maxStatusLength = output.size();
+ }
+ output.clear();
+ }
+
+ output.clear();
+ output = "MODULE";
+
+ for (Uint32 x =0; x < maxModuleLength; ++x)
+ {
+ output.append(" ");
+ }
+
+ output.append("STATUS");
+
+ if (_fullStatusSet)
+ {
+ for (Uint32 x =0; x < maxStatusLength; ++x)
+ {
+ output.append(" ");
+ }
+ output.append("GROUP");
+ }
+
#ifdef PEGASUS_OS_VMS
//
// When outputing to a file using outPrintWriter,
#else
outPrintWriter << output << endl;
#endif
- }
+ for (Uint32 i = 0, n = moduleNames.size(); i < n ; ++i)
+ {
+ output.clear();
+ output.append(moduleNames[i]);
+ for (Uint32 x =0,
+ m = maxModuleLength - moduleNames[i].size() + 6;
+ x < m; ++x)
+ {
+ output.append(" ");
+ }
+
+ output.append(modulesStatus[i]);
+
+ if (_fullStatusSet)
+ {
+
+ String groupName;
+ Uint32 pos = instances[i].findProperty(MODULEGROUPNAME);
+ if (pos != PEG_NOT_FOUND)
+ {
+ CIMValue value = instances[i].getProperty(pos).getValue();
+ value.get(groupName);
+ for (Uint32 x =0,
+ m = maxStatusLength - modulesStatus[i].size() + 6;
+ x < m; ++x)
+ {
+ output.append(" ");
+ }
+ output.append(groupName);
+ }
+ }
+
+#ifdef PEGASUS_OS_VMS
+ //
+ // When outputing to a file using outPrintWriter,
+ // characters appear one per line.
+ // Use printf instead.
+ //
+ printf("%s\n", (const char *) output.getCString());
+#else
+ outPrintWriter << output << endl;
+#endif
+ }
}
else
{
const Array<Uint16> currentModuleStatus,
const Array<Uint16> newModuleStatus);
+ /** Constructs and logs audit message of a provider module group change
+ @param moduleName - The name of the provider module
+ @param oldModuleGroupName - The old group name of the provider module
+ @param newModuleGroupName - The new group name of the provider module
+ */
+ static void logSetProvModuleGroupName(
+ const String & moduleName,
+ const String & oldModuleGroupName,
+ const String & newModuleGroupName);
+
+
/** Constructs and logs audit message of local authentication
@param userName - The user name for this operation
@param successful - True on successful basic authentication,
}
}
+void AuditLogger::logSetProvModuleGroupName(
+ const String & moduleName,
+ const String & oldModuleGroupName,
+ const String & newModuleGroupName)
+{
+ MessageLoaderParms msgParms(
+ "Common.AuditLogger.SET_PROVIDER_MODULE_GROUP",
+ "The ModuleGroupName of provider module \"$0\" has changed from \"$1\""
+ " to \"$2\".",
+ moduleName, oldModuleGroupName, newModuleGroupName);
+
+ _writeAuditMessage(TYPE_CONFIGURATION,
+ SUBTYPE_PROVIDER_MODULE_STATUS_CHANGE,
+ EVENT_UPDATE, Logger::INFORMATION, msgParms);
+}
+
+
void AuditLogger::logUpdateProvModuleStatus(
const String & moduleName,
const Array<Uint16> currentModuleStatus,
}
}
+void AuditLogger::logSetProvModuleGroupName(
+ const String & moduleName,
+ const String & oldModuleGroupName,
+ const String & newModuleGroupName)
+{
+// ATTN: Implement for z/OS.
+}
+
void AuditLogger::logUpdateProvModuleStatus(
const String & moduleName,
const Array<Uint16> currentModuleStatus,
CIMNameCast("UserContext");
const CIMName PEGASUS_PROPERTYNAME_MODULE_DESIGNATEDUSER =
CIMNameCast("DesignatedUserContext");
+const CIMName PEGASUS_PROPERTYNAME_MODULE_MODULEGROUPNAME =
+ CIMNameCast("ModuleGroupName");
/**
The name of the Destination property for CIM XML Indication Handler
extern const CIMName PEGASUS_PROPERTYNAME_MODULE_USERCONTEXT;
PEGASUS_COMMON_LINKAGE
extern const CIMName PEGASUS_PROPERTYNAME_MODULE_DESIGNATEDUSER;
+PEGASUS_COMMON_LINKAGE
+ extern const CIMName PEGASUS_PROPERTYNAME_MODULE_MODULEGROUPNAME;
/**
The name of the Destination property for CIM XML Indication Handler
*/
static const CIMName _START_PROVIDER = CIMNameCast("Start");
+/**
+ setting provider module group method
+*/
+static const CIMName _SET_MODULEGROUPNAME = CIMNameCast("SetModuleGroupName");
+
+/**
+ input param for setModuleGroupName name method
+*/
+static const CIMName _PARAM_MODULEGROUPNAME = CIMNameCast("ModuleGroupName");
+
+
ProviderRegistrationProvider::ProviderRegistrationProvider(
ProviderRegistrationManager * providerRegistrationManager)
{
}
}
+
// if _PROPERTY_PROVIDERMODULE_NAME key not found
if( !moduleFound)
{
// enable module
ret_value = _enableModule(objectReference, moduleName, al);
}
+ else if (methodName.equal(_SET_MODULEGROUPNAME))
+ {
+ String paramName;
+ if (!inParameters.size() ||
+ ((paramName = inParameters[0].getParameterName())
+ != _PARAM_MODULEGROUPNAME))
+ {
+ throw PEGASUS_CIM_EXCEPTION(CIM_ERR_INVALID_PARAMETER, paramName);
+ }
+ // set group
+ String moduleGroupName;
+ inParameters[0].getValue().get(moduleGroupName);
+ ret_value = _setModuleGroupName(
+ objectReference, moduleName, moduleGroupName, al);
+ }
else
{
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_METHOD_NOT_AVAILABLE,
handler.complete();
}
+Sint16 ProviderRegistrationProvider::_setModuleGroupName(
+ const CIMObjectPath & moduleRef,
+ const String & moduleName,
+ const String & moduleGroupName,
+ const AcceptLanguageList & al)
+{
+ Sint32 disableRC = _disableModule (moduleRef, moduleName, false, al);
+
+ if (disableRC == -1)
+ {
+ throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,
+ MessageLoaderParms(
+ "ControlProviders.ProviderRegistrationProvider."
+ "ProviderRegistrationProvider."
+ "DISABLE_PROVIDER_FAILED",
+ "disable the provider failed."));
+ }
+
+ if (disableRC == -2)
+ {
+ throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,
+ MessageLoaderParms(
+ "ControlProviders.ProviderRegistrationProvider."
+ "ProviderRegistrationProvider."
+ "DISABLE_PROVIDER_FAILED_PROVIDER_BUSY",
+ "disable the provider failed: Provider is busy."));
+ }
+
+ String errorMsg;
+
+ if (!_providerRegistrationManager->setProviderModuleGroupName(
+ moduleName, moduleGroupName, errorMsg))
+ {
+ throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,
+ MessageLoaderParms(
+ "ControlProviders.ProviderRegistrationProvider."
+ "ProviderRegistrationProvider."
+ "SET_PROVIDERMODULEGROUPNAME_FAILED",
+ "Failed to set the ModuleGroupName: $0.",
+ errorMsg));
+ }
+
+ // Enable the module only if it was previously enabled.
+ if (disableRC == 0)
+ {
+ try
+ {
+ _enableModule(moduleRef, moduleName, al);
+ }
+ catch(const Exception &e)
+ {
+ PEG_TRACE((TRC_CONTROLPROVIDER,Tracer::LEVEL1,
+ "Exception caught while enabling the provider module %s : %s",
+ (const char*)moduleName.getCString(),
+ (const char*)e.getMessage().getCString()));
+ }
+ catch(...)
+ {
+ PEG_TRACE((
+ TRC_CONTROLPROVIDER,
+ Tracer::LEVEL1,
+ "Unknown error occurred while"
+ " enabling the provider modules %s.",
+ (const char*)moduleName.getCString()));
+ }
+ }
+
+ return 0;
+}
+
+
// get provider manager service
MessageQueueService * ProviderRegistrationProvider::_getProviderManagerService()
{
Boolean disableProviderOnly,
const AcceptLanguageList & al);
+ Sint16 _setModuleGroupName(const CIMObjectPath & moduleRef,
+ const String & moduleName,
+ const String & moduleGroupName,
+ const AcceptLanguageList & al);
+
//
// If the provider is an indication provider, return true
// otherwise, return false
PEGASUS_NAMESPACE_BEGIN
+static String _GROUP_PREFIX = "grp:";
+static String _MODULE_PREFIX = "mod:";
+
/////////////////////////////////////////////////////////////////////////////
// OutstandingRequestTable and OutstandingRequestEntry
/////////////////////////////////////////////////////////////////////////////
{
public:
ProviderAgentContainer(
- const String & moduleName,
+ const String & groupNameWithType,
const String & userName,
Uint16 userContext,
PEGASUS_INDICATION_CALLBACK_T indicationCallback,
Boolean isInitialized();
- String getModuleName() const;
+ String getGroupNameWithType() const;
CIMResponseMessage* processMessage(CIMRequestMessage* request);
void unloadIdleProviders();
Mutex _agentMutex;
/**
- Name of the provider module served by this Provider Agent.
+ Name of the provider module or group served by this Provider Agent.
+ */
+ String _moduleOrGroupName;
+
+ /**
+ Name of the group with type(group or module indicator)
+ served by this Provider Agent.
*/
- String _moduleName;
+ String _groupNameWithType;
/**
The user context in which this Provider Agent operates.
ProviderManagerRouter::_subscriptionInitComplete member variable.
*/
Boolean _subscriptionInitComplete;
+
};
Uint32 ProviderAgentContainer::_numProviderProcesses = 0;
static_cast<CIMResponseMessage*>((void*)&_REQUEST_NOT_PROCESSED);
ProviderAgentContainer::ProviderAgentContainer(
- const String & moduleName,
+ const String & groupName,
const String & userName,
Uint16 userContext,
PEGASUS_INDICATION_CALLBACK_T indicationCallback,
PEGASUS_PROVIDERMODULEFAIL_CALLBACK_T providerModuleFailCallback,
Boolean subscriptionInitComplete)
:
- _moduleName(moduleName),
+ _groupNameWithType(groupName),
_userName(userName),
_userContext(userContext),
_indicationCallback(indicationCallback),
_isInitialized(false),
_subscriptionInitComplete(subscriptionInitComplete)
{
-
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
"ProviderAgentContainer::ProviderAgentContainer");
+
+ // Remove prefixes "grp" and "mod" and get actual module or group name.
+ _moduleOrGroupName = _groupNameWithType.subString(4);
+
PEG_METHOD_EXIT();
}
AnonymousPipe* writePipe;
int status = Executor::startProviderAgent(
- (const char*)_moduleName.getCString(),
+ (const char*)_moduleOrGroupName.getCString(),
ConfigManager::getPegasusHome(),
_userName,
pid,
throw Exception(MessageLoaderParms(
"ProviderManager.OOPProviderManagerRouter.CIMPROVAGT_START_FAILED",
"Failed to start cimprovagt \"$0\".",
- _moduleName));
+ _moduleOrGroupName));
}
# if defined(PEGASUS_HAS_SIGNALS)
"ProviderManager.OOPProviderManagerRouter."
"CIMPROVAGT_COMMUNICATION_FAILED",
"Failed to communicate with cimprovagt \"$0\".",
- _moduleName));
+ _moduleOrGroupName));
}
// Wait for a null response from the Provider Agent indicating it has
"ProviderManager.OOPProviderManagerRouter."
"CIMPROVAGT_COMMUNICATION_FAILED",
"Failed to communicate with cimprovagt \"$0\".",
- _moduleName));
+ _moduleOrGroupName));
}
PEGASUS_ASSERT(message == 0);
"ProviderManager.OOPProviderManagerRouter."
"CIMPROVAGT_THREAD_ALLOCATION_FAILED",
"Failed to allocate thread for cimprovagt \"$0\".",
- _moduleName));
+ _moduleOrGroupName));
}
}
}
// the failure to the Provider Manager Service. The Provider
// Manager Service will inform the Indication Service.
//
- _providerModuleFailCallback(_moduleName, _userName, _userContext);
+ Array<String> moduleNames;
+
+ // If this agent is servicing the group of modules, get all related
+ // provider module names.
+ if (!String::compare(_groupNameWithType, _GROUP_PREFIX, 4))
+ {
+ OOPProviderManagerRouter::getProviderRegistrationManager()->
+ getProviderModuleNamesForGroup(
+ _moduleOrGroupName, moduleNames);
+ }
+ else
+ {
+ moduleNames.append(_moduleOrGroupName);
+ }
+
+ for (Uint32 i = 0, n = moduleNames.size(); i < n; i++)
+ {
+ _providerModuleFailCallback(
+ moduleNames[i], _userName, _userContext);
+ }
}
}
catch (...)
PEG_METHOD_EXIT();
}
-String ProviderAgentContainer::getModuleName() const
+String ProviderAgentContainer::getGroupNameWithType() const
{
- return _moduleName;
+ return _groupNameWithType;
}
CIMResponseMessage* ProviderAgentContainer::processMessage(
}
else if (request->getType() == CIM_DISABLE_MODULE_REQUEST_MESSAGE)
{
+ response = request->buildResponse();
CIMDisableModuleResponseMessage* dmResponse =
dynamic_cast<CIMDisableModuleResponseMessage*>(response);
PEGASUS_ASSERT(dmResponse != 0);
"ProviderManager.OOPProviderManagerRouter."
"CIMPROVAGT_CONNECTION_LOST",
"Lost connection with cimprovagt \"$0\".",
- _moduleName));
+ _moduleOrGroupName));
}
}
catch (CIMException& e)
// OOPProviderManagerRouter
/////////////////////////////////////////////////////////////////////////////
+ProviderRegistrationManager*
+ OOPProviderManagerRouter::_providerRegistrationManager;
+
OOPProviderManagerRouter::OOPProviderManagerRouter(
+ ProviderRegistrationManager *providerRegistrationManager,
PEGASUS_INDICATION_CALLBACK_T indicationCallback,
PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback,
PEGASUS_PROVIDERMODULEFAIL_CALLBACK_T providerModuleFailCallback)
_responseChunkCallback = responseChunkCallback;
_providerModuleFailCallback = providerModuleFailCallback;
_subscriptionInitComplete = false;
-
+ _providerRegistrationManager = providerRegistrationManager;
PEG_METHOD_EXIT();
}
PEG_METHOD_EXIT();
}
+ProviderRegistrationManager*
+ OOPProviderManagerRouter::getProviderRegistrationManager()
+{
+ return _providerRegistrationManager;
+}
+
Message* OOPProviderManagerRouter::processMessage(Message* message)
{
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
{
// Fan out the request to all Provider Agent processes for this module
- // Retrieve the provider module name
- String moduleName;
- _getProviderModuleName(providerModule,moduleName);
+ // Retrieve the provider group name.
+ String groupNameWithType;
+ _getGroupNameWithType(providerModule, groupNameWithType);
+
// Look up the Provider Agents for this module
Array<ProviderAgentContainer*> paArray =
- _lookupProviderAgents(moduleName);
+ _lookupProviderAgents(groupNameWithType);
for (Uint32 i=0; i<paArray.size(); i++)
{
{
// Fan out the request to all Provider Agent processes for this module
- // Retrieve the provider module name
- String moduleName;
- _getProviderModuleName(providerModule,moduleName);
+ // Retrieve the provider module group name.
+ String groupNameWithType;
+ _getGroupNameWithType(providerModule, groupNameWithType);
// Look up the Provider Agents for this module
Array<ProviderAgentContainer*> paArray =
- _lookupProviderAgents(moduleName);
+ _lookupProviderAgents(groupNameWithType);
for (Uint32 i=0; i<paArray.size(); i++)
{
const CIMInstance& providerModule,
CIMRequestMessage* request)
{
- // Retrieve the provider module name
- String moduleName;
- _getProviderModuleName(providerModule,moduleName);
+ // Retrieve the provider module group name
+ String groupNameWithType;
+ _getGroupNameWithType(providerModule, groupNameWithType);
#if defined(PEGASUS_OS_ZOS)
// For z/OS we don't start an extra provider agent for
PEG_TRACE((
TRC_PROVIDERMANAGER,
Tracer::LEVEL4,
- "Module name = %s, User context = %hd, User name = %s",
- (const char*) moduleName.getCString(),
+ "Group name with type = %s, User context = %hd, User name = %s",
+ (const char*) groupNameWithType.getCString(),
userContext,
(const char*) userName.getCString()));
#endif
ProviderAgentContainer* pa = 0;
+
#ifdef PEGASUS_OS_PASE
String userUpper = userName;
userUpper.toUpper();
- String key = moduleName + ":" + userUpper;
+ String key = groupNameWithType + ":" + userUpper;
#else
- String key = moduleName + ":" + userName;
+ String key = groupNameWithType + ":" + userName;
#endif
AutoMutex lock(_providerAgentTableMutex);
if (!_providerAgentTable.lookup(key, pa))
{
pa = new ProviderAgentContainer(
- moduleName, userName, userContext,
+ groupNameWithType, userName, userContext,
_indicationCallback, _responseChunkCallback,
_providerModuleFailCallback,
_subscriptionInitComplete);
_providerAgentTable.insert(key, pa);
}
+
return pa;
}
Array<ProviderAgentContainer*> OOPProviderManagerRouter::_lookupProviderAgents(
- const String& moduleName)
+ const String& groupNameWithType)
{
Array<ProviderAgentContainer*> paArray;
AutoMutex lock(_providerAgentTableMutex);
for (ProviderAgentTable::Iterator i = _providerAgentTable.start(); i; i++)
{
- if (i.value()->getModuleName() == moduleName)
+ if (i.value()->getGroupNameWithType() == groupNameWithType)
{
paArray.append(i.value());
}
PEG_METHOD_EXIT();
}
+void OOPProviderManagerRouter::_getGroupNameWithType(
+ const CIMInstance &providerModule,
+ String &groupNameWithType)
+{
+ Uint32 idx = providerModule.findProperty(
+ PEGASUS_PROPERTYNAME_MODULE_MODULEGROUPNAME);
+
+ String moduleName;
+ String groupName;
+
+ if (idx != PEG_NOT_FOUND)
+ {
+ providerModule.getProperty(idx).getValue().get(groupName);
+ }
+
+ // Note: If group name is not found, module name is used as group name.
+ // prefixes "grp" and "mod" is used to distinguish between the provider
+ // modules who have same group and module names.
+ if (groupName.size())
+ {
+ groupNameWithType.assign(_GROUP_PREFIX);
+ groupNameWithType.append(groupName);
+ }
+ else
+ {
+ _getProviderModuleName(providerModule, moduleName);
+ groupNameWithType.assign(_MODULE_PREFIX);
+ groupNameWithType.append(moduleName);
+ }
+}
+
void OOPProviderManagerRouter::_getProviderModuleName(
const CIMInstance & providerModule,
String & moduleName)
#include <Pegasus/ProviderManagerService/ProviderManagerRouter.h>
#include <Pegasus/ProviderManagerService/Linkage.h>
+#include \
+ <Pegasus/Server/ProviderRegistrationManager/ProviderRegistrationManager.h>
+
PEGASUS_NAMESPACE_BEGIN
typedef void (*PEGASUS_PROVIDERMODULEFAIL_CALLBACK_T)(const String &,
{
public:
OOPProviderManagerRouter(
+ ProviderRegistrationManager *providerRegistrationManager,
PEGASUS_INDICATION_CALLBACK_T indicationCallback,
PEGASUS_RESPONSE_CHUNK_CALLBACK_T responseChunkCallback,
PEGASUS_PROVIDERMODULEFAIL_CALLBACK_T providerModuleFailCallback);
virtual void unloadIdleProviders();
+ static ProviderRegistrationManager* getProviderRegistrationManager();
+
private:
//
// Private methods
const CIMInstance & providerModule,
String & moduleName);
+ /**
+ Determine groupName from the providerModule. Function sets
+ groupName. A type prefix(grp or mod) is added to distinguish
+ between group and module names.
+ If ModuleGroupName property value is not specified, moduleName is set
+ to groupName.
+ */
+ void _getGroupNameWithType(
+ const CIMInstance &providerModule,
+ String &groupNameWithType);
+
/** Unimplemented */
OOPProviderManagerRouter();
/** Unimplemented */
_providerAgentTable is accessed.
*/
Mutex _providerAgentTableMutex;
+
+ static ProviderRegistrationManager *_providerRegistrationManager;
+
};
PEGASUS_NAMESPACE_END
// If StopAllProviders, terminate the agent process.
// If DisableModule not successful, leave agent process running.
+ // If there are any active providers after DisableModule request
+ // successful, this agent might be servicing the group of
+ // provider modules, leave agent process running.
if ((request->getType() == CIM_STOP_ALL_PROVIDERS_REQUEST_MESSAGE) ||
((request->getType() == CIM_DISABLE_MODULE_REQUEST_MESSAGE) &&
- (!dynamic_cast<CIMDisableModuleRequestMessage*>(request)->
- disableProviderOnly) &&
+ (!_providerManagerRouter.hasActiveProviders()) &&
(respMsg->cimException.getCode() == CIM_ERR_SUCCESS)))
{
// Operation is successful. End the agent process.
PEGASUS_NAMESPACE_BEGIN
+const String PG_PROVMODULE_GROUPNAME_CIMSERVER = "CIMServer";
+
ProviderManagerService* ProviderManagerService::providerManagerService=NULL;
Boolean ProviderManagerService::_allProvidersStopped = false;
Uint32 ProviderManagerService::_indicationServiceQueueId = PEG_NOT_FOUND;
_unloadIdleProvidersBusy = 0;
- _basicProviderManagerRouter = 0;
- _oopProviderManagerRouter = 0;
-
- // Determine which ProviderManagerRouter(s) to use
-
_forceProviderProcesses = ConfigManager::parseBooleanValue(
ConfigManager::getInstance()->getCurrentValue(
"forceProviderProcesses"));
-#if defined(PEGASUS_DISABLE_PROV_USERCTXT) || defined(PEGASUS_OS_ZOS)
- if (_forceProviderProcesses)
- {
- _oopProviderManagerRouter = new OOPProviderManagerRouter(
- indicationCallback, responseChunkCallback,
- providerModuleFailureCallback);
- }
- else
- {
- _basicProviderManagerRouter = new BasicProviderManagerRouter(
- indicationCallback, responseChunkCallback,
- createDefaultProviderManagerCallback);
- }
-#else
_oopProviderManagerRouter = new OOPProviderManagerRouter(
- indicationCallback, responseChunkCallback,
+ providerRegistrationManager,
+ indicationCallback,
+ responseChunkCallback,
providerModuleFailureCallback);
- if (!_forceProviderProcesses)
- {
- _basicProviderManagerRouter = new BasicProviderManagerRouter(
- indicationCallback, responseChunkCallback,
- createDefaultProviderManagerCallback);
- }
-#endif
-#ifdef PEGASUS_ENABLE_REMOTE_CMPI
- if (!_basicProviderManagerRouter)
- {
- _basicProviderManagerRouter = new BasicProviderManagerRouter(
- indicationCallback, responseChunkCallback,
- createDefaultProviderManagerCallback);
- }
-#endif
+ _basicProviderManagerRouter = new BasicProviderManagerRouter(
+ indicationCallback,
+ responseChunkCallback,
+ createDefaultProviderManagerCallback);
}
ProviderManagerService::~ProviderManagerService(void)
providerModule.getProperty(pos).getValue().get(userContext);
}
+ String moduleGroupName;
+ Uint32 idx = providerModule.findProperty(
+ PEGASUS_PROPERTYNAME_MODULE_MODULEGROUPNAME);
+ if (idx != PEG_NOT_FOUND)
+ {
+ providerModule.getProperty(idx).getValue().get(moduleGroupName);
+ }
+
// Load proxy-provider into CIMServer, in case of remote namespace
// requests. (ie through _basicProviderManagerRouter). -V 3913
#ifdef PEGASUS_ENABLE_REMOTE_CMPI
// Forward the request to the appropriate ProviderManagerRouter, based
// on the CIM Server configuration and the UserContext setting.
- if (_forceProviderProcesses
+ if ( (_forceProviderProcesses &&
+ moduleGroupName != PG_PROVMODULE_GROUPNAME_CIMSERVER)
#if !defined(PEGASUS_DISABLE_PROV_USERCTXT) && !defined(PEGASUS_OS_ZOS)
|| (userContext == PG_PROVMODULE_USERCTXT_REQUESTOR)
|| (userContext == PG_PROVMODULE_USERCTXT_DESIGNATED)
const CIMName _PROPERTY_SUPPORTEDPROPERTIES =CIMNameCast("SupportedProperties");
const CIMName _PROPERTY_SUPPORTEDMETHODS = CIMNameCast("SupportedMethods");
const CIMName _PROPERTY_INDICATIONDESTINATIONS = CIMNameCast("Destinations");
+const CIMName _PROPERTY_MODULEGROUPNAME = CIMNameCast("ModuleGroupName");
/**
ProviderRegistration table is used to keep track of provider registration
return (_providerModuleStatus);
}
+void ProviderRegistrationManager::getProviderModuleNamesForGroup(
+ const String& moduleGroupName,
+ Array<String> &moduleNames)
+{
+ String name;
+
+ ReadLock lock(_registrationTableLock);
+
+ // Retrieve required provider modules from registration hash table
+ // instead of repository. This significantly decreases the time required.
+ for (Table::Iterator i=_registrationTable->table.start(); i; i++)
+ {
+ Array<CIMInstance> instances;
+ instances = i.value()->getInstances();
+ for (Uint32 j = 0; j < instances.size(); j++)
+ {
+ if (instances[j].getClassName().equal(
+ PEGASUS_CLASSNAME_PROVIDERMODULE))
+ {
+ Uint32 pos = instances[j].findProperty(
+ _PROPERTY_MODULEGROUPNAME);
+ if (pos != PEG_NOT_FOUND)
+ {
+ instances[j].getProperty(pos).getValue().get(name);
+ if (String::equalNoCase(moduleGroupName, name))
+ {
+ pos = instances[j].findProperty(
+ _PROPERTY_PROVIDERMODULE_NAME);
+ if (pos != PEG_NOT_FOUND)
+ {
+ instances[j].getProperty(pos).getValue().get(name);
+ moduleNames.append(name);
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+Boolean ProviderRegistrationManager::setProviderModuleGroupName(
+ const String& providerModuleName,
+ const String& moduleGroupName,
+ String &errorMsg)
+{
+ WriteLock lock(_registrationTableLock);
+
+ String oldModuleGroupName;
+
+ try
+ {
+ Array <CIMKeyBinding> moduleKeyBindings;
+
+ moduleKeyBindings.append (CIMKeyBinding
+ (_PROPERTY_PROVIDERMODULE_NAME,
+ providerModuleName, CIMKeyBinding::STRING));
+ CIMObjectPath reference ("", CIMNamespaceName (),
+ PEGASUS_CLASSNAME_PROVIDERMODULE, moduleKeyBindings);
+
+ //
+ // get the old group value.
+ //
+ CIMValue groupValue = _repository->getProperty(
+ PEGASUS_NAMESPACENAME_INTEROP,
+ reference, _PROPERTY_MODULEGROUPNAME);
+ groupValue.get(oldModuleGroupName);
+
+ //
+ // update provider module with the new group name
+ //
+ _repository->setProperty(
+ PEGASUS_NAMESPACENAME_INTEROP,
+ reference, _PROPERTY_MODULEGROUPNAME, moduleGroupName);
+
+ //
+ // get instance from the repository
+ //
+ CIMInstance _instance = _repository->getInstance(
+ PEGASUS_NAMESPACENAME_INTEROP,
+ reference,
+ false,
+ false,
+ CIMPropertyList());
+ //
+ // remove old entry from table
+ //
+ String _moduleKey = _generateKey(providerModuleName, MODULE_KEY);
+ ProviderRegistrationTable* _entry = 0;
+ if (_registrationTable->table.lookup(_moduleKey, _entry))
+ {
+ delete _entry;
+ _registrationTable->table.remove(_moduleKey);
+ }
+
+ //
+ // add the updated instance to the table
+ //
+ Array<CIMInstance> instances;
+ instances.append(_instance);
+ _addInstancesToTable(_moduleKey, instances);
+ }
+ catch (const Exception & e)
+ {
+ errorMsg = e.getMessage();
+ PEG_TRACE((TRC_DISCARDED_DATA, Tracer::LEVEL1,
+ "Group name %s cannot be set to the provider module %s : %s",
+ (const char*)moduleGroupName.getCString(),
+ (const char*)providerModuleName.getCString(),
+ (const char*)errorMsg.getCString()));
+ return false;
+ }
+ catch (...)
+ {
+ errorMsg = "Unknown error";
+ PEG_TRACE((TRC_DISCARDED_DATA, Tracer::LEVEL1,
+ "Unknown error occured while setting the group name %s"
+ " to the provider module : %s",
+ (const char*)moduleGroupName.getCString(),
+ (const char*)providerModuleName.getCString()));
+ return false;
+ }
+
+ PEG_AUDIT_LOG(
+ logSetProvModuleGroupName(
+ providerModuleName,
+ oldModuleGroupName,
+ moduleGroupName));
+
+ return (true);
+}
+
Boolean ProviderRegistrationManager::updateProviderModuleStatus(
const String& providerModuleName,
const Array<Uint16>& removeStatus,
const Array<Uint16>& appendStatus,
Array<Uint16>& outStatus);
+ /**
+ Retrieves all the provider module names who have the given
+ moduleGroupName in common.
+
+ @param moduleGroupName String specifying name of the provider
+ module group.
+ @param moduleNames OUTPUT array of string returning the provider
+ module names for the group
+
+ */
+ void getProviderModuleNamesForGroup(
+ const String& moduleGroupName,
+ Array<String>& moduleNames);
+
+ /**
+ Sets the provider module group name for the specified provider
+ module.
+
+ @param providerModuleName String specifying name of the provider
+ module.
+ @param moduleGroupName String specifying name of the provider
+ module group.
+ @param errorMsg Output arg, String containing the reason for failure
+
+ @return True if the ModuleGroupName set successfully,
+ Otherwise, return false.
+ */
+ Boolean setProviderModuleGroupName(
+ const String& providerModuleName,
+ const String& moduleGroupName,
+ String &errorMsg);
+
/**
Determines whether specified provider is an indication provider.
Clients.cimprovider.CIMProviderCommand.MENU.STANDARD:string {
"Usage: cimprovider -d -m module\n"
" -e -m module\n"
+ " -g group -m module\n"
" -r -m module [ -p provider ]\n"
- " -l [ -s | -m module ]\n"
+ " -l [ -s | -f | -m module ]\n"
" -h\n"
" --help\n"
" --version\n"
" Options:\n"
" -d - Disable the specified CIM provider module.\n"
" -e - Enable the specified CIM provider module.\n"
+ " -g - Sets the CIM provider module group. Specify\n"
+ " empty string to remove from grouping.\n"
+ " If the provider module is active, provider\n"
+ " module is disabled first, group is set and\n"
+ " enabled again. All provider modules with the same\n"
+ " group name are loaded into a single agent process\n"
+ " except when overridden by specific UserContext\n"
+ " values. If group name is CIMServer, provider module\n"
+ " is loaded into CIMServer process depending on\n"
+ " UserContext value.\n"
" -r - Remove the registration for a provider (if specified)\n"
" or for the specified provider module and all the providers\n"
" it contains.\n"
" -m - Specify the provider module for the operation.\n"
" -p - Specify the provider for the operation.\n"
" -s - Display the status of registered provider modules.\n"
+ " -f - Full status, display the status of registered\n"
+ " provider modules and module group name.\n"
" -h, --help - Display this help message.\n"
" --version - Display CIM Server version number.\n"
"\n"
Clients.cimprovider.CIMProviderCommand.ERR_USAGE:string {"PGC00628: Use ''--help'' to obtain command syntax."}
+ Clients.cimprovider.CIMProviderCommand.SETTING_PROVIDERMODULE_GROUP:string {"PGC00628: Setting the provider module group..."}
+
+ Clients.cimprovider.CIMProviderCommand.SET_PROVIDERMODULE_GROUP_SUCCESS:string {"PGC00629: Provider module group set successfully."}
+
+ Clients.cimprovider.CIMProviderCommand.SET_PROVIDERMODULE_GROUP_FAILURE:string {"PGC00630: Failed to set the provider module group."}
+
// ==========================================================
// Messages for CIMUserCommand
*/
ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.UNSUPPORTED_INTERFACETYPE_VALUE:string {"PGS03034: InterfaceType property value {0} is not supported."}
+ /**
+ * @note PGS03035:
+ * Do not translate the word 'ModuleGroupName' since it is the name of a CIM property.
+ * Substitution {0} is a string containing reason for the failure
+ * to set the ModuleGroupName.
+ */
+ ControlProviders.ProviderRegistrationProvider.ProviderRegistrationProvider.SET_PROVIDERMODULEGROUPNAME_FAILED:string {"PGS03035: Failed to set the ModuleGroupName: {0}."}
+
// ==========================================================
// Messages for UserAuthProvider
*/
Common.AuditLogger.CERTIFICATE_BASED_USER_VALIDATION:string {"PGS17817: Certificate based user validation attempt: successful = {0}, from IP address = {5}, user name = {1}, issuer name = {2}, subject name = {3}, serial number = {4}."}
+ /**
+ * @note PGS17818:
+ * Do not translate the word 'ModuleGroupName' since it is the name of a CIM property.
+ * Substitution {0} is a string containing a provider module name
+ * Substitution {1} is a string containing a current ModuleGroupName
+ * value
+ * Substitution {2} is a string containing a new ModuleGroupName
+ * value
+ *
+ */
+ Common.AuditLogger.SET_PROVIDER_MODULE_GROUP:string {"PGS17818: The ModuleGroupName of provider module \"{0}\" has changed from \"{1}\" to \"{2}\"."}
+
// ==========================================================
// Messages for DynListener.cimlistener
// Please use message prefix "PGS18000"
--- /dev/null
+//%LICENSE////////////////////////////////////////////////////////////////
+//
+// Licensed to The Open Group (TOG) under one or more contributor license
+// agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
+// this work for additional information regarding copyright ownership.
+// Each contributor licenses this file to you under the OpenPegasus Open
+// Source License; you may not use this file except in compliance with the
+// License.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the "Software"),
+// to deal in the Software without restriction, including without limitation
+// the rights to use, copy, modify, merge, publish, distribute, sublicense,
+// and/or sell copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//////////////////////////////////////////////////////////////////////////
+
+class Test_GroupingClass : CIM_Indication
+{
+ [key]
+ uint32 id;
+ uint32 getNextIdentifier();
+};
+
+class Test_GroupingClass1 : Test_GroupingClass
+{
+ uint32 resetIdentifier();
+ uint32 testFail();
+};
+
+class Test_GroupingClass2 : Test_GroupingClass
+{
+};
+
@ $(ECHO) +++++ Loading MethodTestProvider class definitions into $(TESTPROVIDERNS) namespace ...
@ cimmofl "-R$(REPOSITORY_DIR)" "-N$(REPOSITORY_NAME)" "-M$(REPOSITORY_MODE)" "-n$(TESTPROVIDERNS)" MethodTestProvider.mof
+ @ $(ECHO) +++++ Loading GroupMethodProvider class definitions into $(TESTPROVIDERNS) namespace ...
+ @ cimmofl "-R$(REPOSITORY_DIR)" "-N$(REPOSITORY_NAME)" "-M$(REPOSITORY_MODE)" "-n$(TESTPROVIDERNS)" GroupMethodProvider.mof
@ $(ECHO) +++++ Registering MethodTestProvider ...
@ cimmofl "-R$(REPOSITORY_DIR)" "-N$(REPOSITORY_NAME)" "-M$(REPOSITORY_MODE)" "-n$(INTEROPNS)" MethodTestProviderR.mof
-
@ $(ECHO) +++++ Loading CLITestProvider class definitions into $(TESTPROVIDERNS) namespace ...
@ cimmofl "-R$(REPOSITORY_DIR)" "-N$(REPOSITORY_NAME)" "-M$(REPOSITORY_MODE)" "-n$(TESTPROVIDERNS)" CLITestProvider.mof
@ $(ECHO) +++++ Registering CLITestProvider ...
@ $(ECHO) +++++ Loading MethodTestProvider class definitions into $(TESTPROVIDERNS) namespace ...
@ cimmof "-n$(TESTPROVIDERNS)" MethodTestProvider.mof
+ @ $(ECHO) +++++ Loading GroupMethodProvider class definitions into $(TESTPROVIDERNS) namespace ...
+ @ cimmof "-n$(TESTPROVIDERNS)" GroupMethodProvider.mof
@ $(ECHO) +++++ Registering MethodTestProvider ...
@ cimmof "-n$(INTEROPNS)" MethodTestProviderR.mof
LocalizedProvider/msg \
PerformanceTests \
EmbeddedInstanceProvider \
- EmbeddedInstanceProvider/testClient
+ EmbeddedInstanceProvider/testClient \
+ TestModuleGrouping
ifeq ($(PEGASUS_ENABLE_INTEROP_PROVIDER),true)
TEST_DIRS += \
--- /dev/null
+#//%LICENSE////////////////////////////////////////////////////////////////
+#//
+#// Licensed to The Open Group (TOG) under one or more contributor license
+#// agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
+#// this work for additional information regarding copyright ownership.
+#// Each contributor licenses this file to you under the OpenPegasus Open
+#// Source License; you may not use this file except in compliance with the
+#// License.
+#//
+#// Permission is hereby granted, free of charge, to any person obtaining a
+#// copy of this software and associated documentation files (the "Software"),
+#// to deal in the Software without restriction, including without limitation
+#// the rights to use, copy, modify, merge, publish, distribute, sublicense,
+#// and/or sell copies of the Software, and to permit persons to whom the
+#// Software is furnished to do so, subject to the following conditions:
+#//
+#// The above copyright notice and this permission notice shall be included
+#// in all copies or substantial portions of the Software.
+#//
+#// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+#// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+#// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+#// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+#// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+#// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+#// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#//
+#//////////////////////////////////////////////////////////////////////////
+ROOT = ../../../../..
+
+DIR = Providers/TestProviders/TestModuleGrouping/GroupProvider1
+
+include $(ROOT)/mak/config.mak
+
+LIBRARY = TestGroupingProvider1
+
+LIBRARIES = \
+ groupUtilLib \
+ pegprovider \
+ pegclient \
+ pegcommon
+
+SOURCES = \
+ TestGroupingProviderMain.cpp \
+ TestGroupingProvider.cpp
+
+include $(ROOT)/mak/dynamic-library.mak
--- /dev/null
+//%LICENSE////////////////////////////////////////////////////////////////
+//
+// Licensed to The Open Group (TOG) under one or more contributor license
+// agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
+// this work for additional information regarding copyright ownership.
+// Each contributor licenses this file to you under the OpenPegasus Open
+// Source License; you may not use this file except in compliance with the
+// License.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the "Software"),
+// to deal in the Software without restriction, including without limitation
+// the rights to use, copy, modify, merge, publish, distribute, sublicense,
+// and/or sell copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//////////////////////////////////////////////////////////////////////////
+//
+//%/////////////////////////////////////////////////////////////////////////////
+
+#include "TestGroupingProvider.h"
+#include "../GroupUtilLib/groupUtilLib.h"
+
+PEGASUS_NAMESPACE_BEGIN
+
+TestGroupingProvider1::TestGroupingProvider1()
+{
+}
+
+TestGroupingProvider1::~TestGroupingProvider1()
+{
+}
+
+void TestGroupingProvider1::initialize(CIMOMHandle& cimom)
+{
+ _cimom = cimom;
+}
+
+void TestGroupingProvider1::terminate()
+{
+ delete this;
+}
+
+void TestGroupingProvider1::invokeMethod(
+ const OperationContext& context,
+ const CIMObjectPath& objectReference,
+ const CIMName& methodName,
+ const Array<CIMParamValue>& inParameters,
+ MethodResultResponseHandler& handler)
+{
+ if (!objectReference.getClassName().equal("Test_GroupingClass1"))
+ {
+ throw CIMNotSupportedException(
+ objectReference.getClassName().getString());
+ }
+
+ handler.processing();
+ if (methodName.equal("getNextIdentifier"))
+ {
+ handler.deliver(CIMValue(getNextIdentifier()));
+ }
+ else if (methodName.equal("resetIdentifier"))
+ {
+ handler.deliver(CIMValue(resetIdentifier()));
+ }
+ else if (methodName.equal("testFail"))
+ {
+ exit(-1);
+ }
+ handler.complete();
+}
+
+void TestGroupingProvider1::enableIndications (
+ IndicationResponseHandler & handler)
+{
+}
+
+void TestGroupingProvider1::disableIndications ()
+{
+}
+
+void TestGroupingProvider1::createSubscription (
+ const OperationContext & context,
+ const CIMObjectPath & subscriptionName,
+ const Array <CIMObjectPath> & classNames,
+ const CIMPropertyList & propertyList,
+ const Uint16 repeatNotificationPolicy)
+{
+}
+
+void TestGroupingProvider1::modifySubscription (
+ const OperationContext & context,
+ const CIMObjectPath & subscriptionName,
+ const Array <CIMObjectPath> & classNames,
+ const CIMPropertyList & propertyList,
+ const Uint16 repeatNotificationPolicy)
+{
+}
+
+
+void TestGroupingProvider1::deleteSubscription (
+ const OperationContext & context,
+ const CIMObjectPath & subscriptionName,
+ const Array <CIMObjectPath> & classNames)
+{
+}
+
+PEGASUS_NAMESPACE_END
--- /dev/null
+//%LICENSE////////////////////////////////////////////////////////////////
+//
+// Licensed to The Open Group (TOG) under one or more contributor license
+// agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
+// this work for additional information regarding copyright ownership.
+// Each contributor licenses this file to you under the OpenPegasus Open
+// Source License; you may not use this file except in compliance with the
+// License.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the "Software"),
+// to deal in the Software without restriction, including without limitation
+// the rights to use, copy, modify, merge, publish, distribute, sublicense,
+// and/or sell copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//////////////////////////////////////////////////////////////////////////
+//
+//%/////////////////////////////////////////////////////////////////////////////
+
+#ifndef Pegasus_TestGroupingProvider1_h
+#define Pegasus_TestGroupingProvider1_h
+
+#include <Pegasus/Common/Config.h>
+#include <Pegasus/Provider/CIMMethodProvider.h>
+#include <Pegasus/Provider/CIMIndicationProvider.h>
+
+PEGASUS_NAMESPACE_BEGIN
+
+class TestGroupingProvider1 : public CIMIndicationProvider,
+ public CIMMethodProvider
+{
+public:
+ TestGroupingProvider1();
+ virtual ~TestGroupingProvider1();
+
+ virtual void initialize(CIMOMHandle& cimom);
+ virtual void terminate();
+
+ virtual void invokeMethod(
+ const OperationContext& context,
+ const CIMObjectPath& objectReference,
+ const CIMName& methodName,
+ const Array<CIMParamValue>& inParameters,
+ MethodResultResponseHandler& handler);
+
+ virtual void enableIndications (
+ IndicationResponseHandler & handler);
+
+ virtual void disableIndications ();
+
+ virtual void createSubscription (
+ const OperationContext & context,
+ const CIMObjectPath & subscriptionName,
+ const Array <CIMObjectPath> & classNames,
+ const CIMPropertyList & propertyList,
+ const Uint16 repeatNotificationPolicy);
+
+ virtual void modifySubscription (
+ const OperationContext & context,
+ const CIMObjectPath & subscriptionName,
+ const Array <CIMObjectPath> & classNames,
+ const CIMPropertyList & propertyList,
+ const Uint16 repeatNotificationPolicy);
+
+ virtual void deleteSubscription (
+ const OperationContext & context,
+ const CIMObjectPath & subscriptionName,
+ const Array <CIMObjectPath> & classNames);
+
+private:
+ CIMOMHandle _cimom;
+};
+
+PEGASUS_NAMESPACE_END
+
+#endif
--- /dev/null
+//%LICENSE////////////////////////////////////////////////////////////////
+//
+// Licensed to The Open Group (TOG) under one or more contributor license
+// agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
+// this work for additional information regarding copyright ownership.
+// Each contributor licenses this file to you under the OpenPegasus Open
+// Source License; you may not use this file except in compliance with the
+// License.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the "Software"),
+// to deal in the Software without restriction, including without limitation
+// the rights to use, copy, modify, merge, publish, distribute, sublicense,
+// and/or sell copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//////////////////////////////////////////////////////////////////////////
+//
+//%/////////////////////////////////////////////////////////////////////////////
+
+#include <Pegasus/Common/Config.h>
+#include <Pegasus/Common/String.h>
+
+#include "TestGroupingProvider.h"
+
+PEGASUS_USING_PEGASUS;
+PEGASUS_USING_STD;
+
+extern "C" PEGASUS_EXPORT CIMProvider* PegasusCreateProvider(
+ const String& providerName)
+{
+ if(String::equalNoCase(providerName, "TestGroupingProvider1"))
+ {
+ return(new TestGroupingProvider1());
+ }
+ return(0);
+}
--- /dev/null
+#//%LICENSE////////////////////////////////////////////////////////////////
+#//
+#// Licensed to The Open Group (TOG) under one or more contributor license
+#// agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
+#// this work for additional information regarding copyright ownership.
+#// Each contributor licenses this file to you under the OpenPegasus Open
+#// Source License; you may not use this file except in compliance with the
+#// License.
+#//
+#// Permission is hereby granted, free of charge, to any person obtaining a
+#// copy of this software and associated documentation files (the "Software"),
+#// to deal in the Software without restriction, including without limitation
+#// the rights to use, copy, modify, merge, publish, distribute, sublicense,
+#// and/or sell copies of the Software, and to permit persons to whom the
+#// Software is furnished to do so, subject to the following conditions:
+#//
+#// The above copyright notice and this permission notice shall be included
+#// in all copies or substantial portions of the Software.
+#//
+#// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+#// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+#// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+#// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+#// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+#// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+#// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#//
+#//////////////////////////////////////////////////////////////////////////
+ROOT = ../../../../..
+
+DIR = Providers/TestProviders/TestModuleGrouping/GroupProvider2
+
+include $(ROOT)/mak/config.mak
+
+LIBRARY = TestGroupingProvider2
+
+LIBRARIES = \
+ groupUtilLib \
+ pegprovider \
+ pegclient \
+ pegcommon
+
+SOURCES = \
+ TestGroupingProviderMain.cpp \
+ TestGroupingProvider.cpp
+
+include $(ROOT)/mak/dynamic-library.mak
--- /dev/null
+//%LICENSE////////////////////////////////////////////////////////////////
+//
+// Licensed to The Open Group (TOG) under one or more contributor license
+// agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
+// this work for additional information regarding copyright ownership.
+// Each contributor licenses this file to you under the OpenPegasus Open
+// Source License; you may not use this file except in compliance with the
+// License.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the "Software"),
+// to deal in the Software without restriction, including without limitation
+// the rights to use, copy, modify, merge, publish, distribute, sublicense,
+// and/or sell copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//////////////////////////////////////////////////////////////////////////
+//
+//%/////////////////////////////////////////////////////////////////////////////
+
+#include "TestGroupingProvider.h"
+#include "../GroupUtilLib/groupUtilLib.h"
+
+PEGASUS_NAMESPACE_BEGIN
+
+TestGroupingProvider2::TestGroupingProvider2()
+{
+}
+
+TestGroupingProvider2::~TestGroupingProvider2()
+{
+}
+
+void TestGroupingProvider2::initialize(CIMOMHandle& cimom)
+{
+ _cimom = cimom;
+}
+
+void TestGroupingProvider2::terminate()
+{
+ delete this;
+}
+
+void TestGroupingProvider2::invokeMethod(
+ const OperationContext& context,
+ const CIMObjectPath& objectReference,
+ const CIMName& methodName,
+ const Array<CIMParamValue>& inParameters,
+ MethodResultResponseHandler& handler)
+{
+ if (!objectReference.getClassName().equal("Test_GroupingClass2"))
+ {
+ throw CIMNotSupportedException(
+ objectReference.getClassName().getString());
+ }
+
+ handler.processing();
+ if (methodName.equal("getNextIdentifier"))
+ {
+ handler.deliver(CIMValue(getNextIdentifier()));
+ }
+
+ handler.complete();
+}
+
+void TestGroupingProvider2::enableIndications (
+ IndicationResponseHandler & handler)
+{
+}
+
+void TestGroupingProvider2::disableIndications ()
+{
+}
+
+void TestGroupingProvider2::createSubscription (
+ const OperationContext & context,
+ const CIMObjectPath & subscriptionName,
+ const Array <CIMObjectPath> & classNames,
+ const CIMPropertyList & propertyList,
+ const Uint16 repeatNotificationPolicy)
+{
+}
+
+void TestGroupingProvider2::modifySubscription (
+ const OperationContext & context,
+ const CIMObjectPath & subscriptionName,
+ const Array <CIMObjectPath> & classNames,
+ const CIMPropertyList & propertyList,
+ const Uint16 repeatNotificationPolicy)
+{
+}
+
+
+void TestGroupingProvider2::deleteSubscription (
+ const OperationContext & context,
+ const CIMObjectPath & subscriptionName,
+ const Array <CIMObjectPath> & classNames)
+{
+}
+
+PEGASUS_NAMESPACE_END
--- /dev/null
+//%LICENSE////////////////////////////////////////////////////////////////
+//
+// Licensed to The Open Group (TOG) under one or more contributor license
+// agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
+// this work for additional information regarding copyright ownership.
+// Each contributor licenses this file to you under the OpenPegasus Open
+// Source License; you may not use this file except in compliance with the
+// License.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the "Software"),
+// to deal in the Software without restriction, including without limitation
+// the rights to use, copy, modify, merge, publish, distribute, sublicense,
+// and/or sell copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//////////////////////////////////////////////////////////////////////////
+//
+//%/////////////////////////////////////////////////////////////////////////////
+
+#ifndef Pegasus_TestGroupingProvider2_h
+#define Pegasus_TestGroupingProvider2_h
+
+#include <Pegasus/Common/Config.h>
+#include <Pegasus/Provider/CIMMethodProvider.h>
+#include <Pegasus/Provider/CIMIndicationProvider.h>
+
+PEGASUS_NAMESPACE_BEGIN
+
+class TestGroupingProvider2 : public CIMMethodProvider,
+ public CIMIndicationProvider
+{
+public:
+ TestGroupingProvider2();
+ virtual ~TestGroupingProvider2();
+
+ // CIMProvider interface
+ virtual void initialize(CIMOMHandle& cimom);
+ virtual void terminate();
+
+ // CIMMethodProviderFacade
+ virtual void invokeMethod(
+ const OperationContext& context,
+ const CIMObjectPath& objectReference,
+ const CIMName& methodName,
+ const Array<CIMParamValue>& inParameters,
+ MethodResultResponseHandler& handler);
+
+ virtual void enableIndications (
+ IndicationResponseHandler & handler);
+
+ virtual void disableIndications ();
+
+ virtual void createSubscription (
+ const OperationContext & context,
+ const CIMObjectPath & subscriptionName,
+ const Array <CIMObjectPath> & classNames,
+ const CIMPropertyList & propertyList,
+ const Uint16 repeatNotificationPolicy);
+
+ virtual void modifySubscription (
+ const OperationContext & context,
+ const CIMObjectPath & subscriptionName,
+ const Array <CIMObjectPath> & classNames,
+ const CIMPropertyList & propertyList,
+ const Uint16 repeatNotificationPolicy);
+
+ virtual void deleteSubscription (
+ const OperationContext & context,
+ const CIMObjectPath & subscriptionName,
+ const Array <CIMObjectPath> & classNames);
+
+private:
+ CIMOMHandle _cimom;
+};
+
+PEGASUS_NAMESPACE_END
+
+#endif
--- /dev/null
+//%LICENSE////////////////////////////////////////////////////////////////
+//
+// Licensed to The Open Group (TOG) under one or more contributor license
+// agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
+// this work for additional information regarding copyright ownership.
+// Each contributor licenses this file to you under the OpenPegasus Open
+// Source License; you may not use this file except in compliance with the
+// License.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the "Software"),
+// to deal in the Software without restriction, including without limitation
+// the rights to use, copy, modify, merge, publish, distribute, sublicense,
+// and/or sell copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//////////////////////////////////////////////////////////////////////////
+//
+//%/////////////////////////////////////////////////////////////////////////////
+
+#include <Pegasus/Common/Config.h>
+#include <Pegasus/Common/String.h>
+
+#include "TestGroupingProvider.h"
+
+PEGASUS_USING_PEGASUS;
+
+extern "C" PEGASUS_EXPORT CIMProvider* PegasusCreateProvider(
+ const String& providerName)
+{
+ if(String::equalNoCase(providerName, "TestGroupingProvider2"))
+ {
+ return(new TestGroupingProvider2());
+ }
+
+ return(0);
+}
--- /dev/null
+#//%LICENSE////////////////////////////////////////////////////////////////
+#//
+#// Licensed to The Open Group (TOG) under one or more contributor license
+#// agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
+#// this work for additional information regarding copyright ownership.
+#// Each contributor licenses this file to you under the OpenPegasus Open
+#// Source License; you may not use this file except in compliance with the
+#// License.
+#//
+#// Permission is hereby granted, free of charge, to any person obtaining a
+#// copy of this software and associated documentation files (the "Software"),
+#// to deal in the Software without restriction, including without limitation
+#// the rights to use, copy, modify, merge, publish, distribute, sublicense,
+#// and/or sell copies of the Software, and to permit persons to whom the
+#// Software is furnished to do so, subject to the following conditions:
+#//
+#// The above copyright notice and this permission notice shall be included
+#// in all copies or substantial portions of the Software.
+#//
+#// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+#// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+#// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+#// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+#// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+#// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+#// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#//
+#//////////////////////////////////////////////////////////////////////////
+ROOT = ../../../../..
+
+DIR = Providers/TestProviders/TestModuleGrouping/GroupUtilLib
+
+include $(ROOT)/mak/config.mak
+
+ifeq ($(OS),VMS)
+LOCAL_DEFINES = -DPEGASUS_ROOT="""$(PEGASUS_ROOT)"""
+else
+LOCAL_DEFINES = -DPEGASUS_ROOT=\"$(ROOT)\"
+endif
+
+VMS_HAS_CC = yes
+
+LIBRARY = groupUtilLib
+
+SOURCES = \
+ groupUtilLib.cpp
+
+include $(ROOT)/mak/library.mak
+
+tests:
--- /dev/null
+//%LICENSE////////////////////////////////////////////////////////////////
+//
+// Licensed to The Open Group (TOG) under one or more contributor license
+// agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
+// this work for additional information regarding copyright ownership.
+// Each contributor licenses this file to you under the OpenPegasus Open
+// Source License; you may not use this file except in compliance with the
+// License.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the "Software"),
+// to deal in the Software without restriction, including without limitation
+// the rights to use, copy, modify, merge, publish, distribute, sublicense,
+// and/or sell copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//////////////////////////////////////////////////////////////////////////
+//
+//%/////////////////////////////////////////////////////////////////////////////
+
+#include "groupUtilLib.h"
+
+static int nextIdentifier = 0;
+
+int getNextIdentifier()
+{
+ return ++nextIdentifier;
+}
+
+int resetIdentifier()
+{
+ return nextIdentifier = 0;
+}
+
--- /dev/null
+//%LICENSE////////////////////////////////////////////////////////////////
+//
+// Licensed to The Open Group (TOG) under one or more contributor license
+// agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
+// this work for additional information regarding copyright ownership.
+// Each contributor licenses this file to you under the OpenPegasus Open
+// Source License; you may not use this file except in compliance with the
+// License.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the "Software"),
+// to deal in the Software without restriction, including without limitation
+// the rights to use, copy, modify, merge, publish, distribute, sublicense,
+// and/or sell copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//////////////////////////////////////////////////////////////////////////
+
+#ifndef Pegasus_GroupUtilLib_h
+#define Pegasus_GroupUtilLib_h
+
+#include <Pegasus/Common/Config.h>
+
+extern "C" PEGASUS_EXPORT int getNextIdentifier();
+extern "C" PEGASUS_EXPORT int resetIdentifier();
+
+#endif
+
--- /dev/null
+#//%LICENSE////////////////////////////////////////////////////////////////
+#//
+#// Licensed to The Open Group (TOG) under one or more contributor license
+#// agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
+#// this work for additional information regarding copyright ownership.
+#// Each contributor licenses this file to you under the OpenPegasus Open
+#// Source License; you may not use this file except in compliance with the
+#// License.
+#//
+#// Permission is hereby granted, free of charge, to any person obtaining a
+#// copy of this software and associated documentation files (the "Software"),
+#// to deal in the Software without restriction, including without limitation
+#// the rights to use, copy, modify, merge, publish, distribute, sublicense,
+#// and/or sell copies of the Software, and to permit persons to whom the
+#// Software is furnished to do so, subject to the following conditions:
+#//
+#// The above copyright notice and this permission notice shall be included
+#// in all copies or substantial portions of the Software.
+#//
+#// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+#// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+#// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+#// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+#// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+#// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+#// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#//
+#//////////////////////////////////////////////////////////////////////////
+
+ROOT = ../../../..
+
+include $(ROOT)/mak/config.mak
+
+TEST_DIRS = \
+ GroupUtilLib \
+ GroupProvider1 \
+ GroupProvider2 \
+ testclient
+
+include $(ROOT)/mak/recurse.mak
--- /dev/null
+#//%LICENSE////////////////////////////////////////////////////////////////
+#//
+#// Licensed to The Open Group (TOG) under one or more contributor license
+#// agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
+#// this work for additional information regarding copyright ownership.
+#// Each contributor licenses this file to you under the OpenPegasus Open
+#// Source License; you may not use this file except in compliance with the
+#// License.
+#//
+#// Permission is hereby granted, free of charge, to any person obtaining a
+#// copy of this software and associated documentation files (the "Software"),
+#// to deal in the Software without restriction, including without limitation
+#// the rights to use, copy, modify, merge, publish, distribute, sublicense,
+#// and/or sell copies of the Software, and to permit persons to whom the
+#// Software is furnished to do so, subject to the following conditions:
+#//
+#// The above copyright notice and this permission notice shall be included
+#// in all copies or substantial portions of the Software.
+#//
+#// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+#// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+#// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+#// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+#// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+#// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+#// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#//
+#//////////////////////////////////////////////////////////////////////////
+ROOT = ../../../../..
+
+PEGASUS_ZOS_PROGRAM_OBJECT = yes
+
+DIR = Providers/TestProviders/TestModuleGrouping/testclient
+
+include $(ROOT)/mak/config.mak
+
+LOCAL_DEFINES = -DPEGASUS_INTERNALONLY
+
+LIBRARIES = \
+ pegclient \
+ pegcommon
+
+EXTRA_INCLUDES = $(SYS_INCLUDES)
+
+PROGRAM = TestGroupMethodProvider
+
+SOURCES = TestGroupMethodProvider.cpp
+
+include $(ROOT)/mak/program.mak
+
+tests:
+
+poststarttests:
+ @$(ECHO) "Registering the providers ...."
+ @$(PROGRAM) registerProviders
+ @$(ECHO) "Testing the module grouping...."
+ @$(PROGRAM) testGrouping
+ @$(ECHO) "Deregistering the providers ...."
+ @$(PROGRAM) deregisterProviders
+ @$(ECHO) "Registering the providers ...."
+ @$(PROGRAM) registerProviders
+ @$(ECHO) "Testing the module grouping...."
+ @$(PROGRAM) testGrouping
+ @$(ECHO) "Disabling the provider module TestGroupingProviderModule2 ...."
+ @cimprovider -d -m TestGroupingProviderModule2
+ @$(ECHO) "Testing the module grouping with TestGroupingProviderModule2 disabled...."
+ @$(PROGRAM) testGroupingWithProviderDisabled
+ @$(ECHO) "Enabling the provider module TestGroupingProviderModule2 ...."
+ @cimprovider -e -m TestGroupingProviderModule2
+ @$(ECHO) "Testing the module grouping...."
+ @$(PROGRAM) testGrouping
+ @$(ECHO) "Setting the TestGroupingProviderModule2 group to none..."
+ @cimprovider -g "" -m TestGroupingProviderModule2
+ @$(ECHO) "Testing the module grouping with TestGroupingProviderModule2 removed from grouping...."
+ @$(PROGRAM) testGroupingWithProviderDisabled
+ @$(ECHO) "Setting the TestGroupingProviderModule2 group to TestGroup1..."
+ @cimprovider -g TestGroup1 -m TestGroupingProviderModule2
+ @$(ECHO) "Testing the module grouping...."
+ @$(PROGRAM) testGrouping
+ @$(ECHO) "Deregistering the providers ...."
+ @$(PROGRAM) deregisterProviders
+ @$(ECHO) "Testing the indication providers with grouping enabled...."
+ @$(PROGRAM) testIndications
--- /dev/null
+//%LICENSE////////////////////////////////////////////////////////////////
+//
+// Licensed to The Open Group (TOG) under one or more contributor license
+// agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
+// this work for additional information regarding copyright ownership.
+// Each contributor licenses this file to you under the OpenPegasus Open
+// Source License; you may not use this file except in compliance with the
+// License.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the "Software"),
+// to deal in the Software without restriction, including without limitation
+// the rights to use, copy, modify, merge, publish, distribute, sublicense,
+// and/or sell copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//////////////////////////////////////////////////////////////////////////
+//
+//%/////////////////////////////////////////////////////////////////////////////
+
+#include <Pegasus/Common/PegasusAssert.h>
+#include <Pegasus/Common/Config.h>
+#include <Pegasus/Client/CIMClient.h>
+#include <Pegasus/Common/Config.h>
+#include <Pegasus/Common/Constants.h>
+#include <Pegasus/Common/FileSystem.h>
+#include <Pegasus/Common/PegasusAssert.h>
+#include <Pegasus/Common/System.h>
+#include <Pegasus/Server/ProviderRegistrationManager/\
+ProviderRegistrationManager.h>
+
+PEGASUS_USING_PEGASUS;
+
+PEGASUS_USING_PEGASUS;
+PEGASUS_USING_STD;
+
+static const CIMNamespaceName NAMESPACE = CIMNamespaceName("test/TestProvider");
+
+static Boolean verbose;
+
+Boolean _validateStatus(
+ CIMClient& client,
+ const String& providerModuleName,
+ Uint16 expectedStatus)
+{
+ Boolean result = false;
+
+ try
+ {
+ //
+ // Get instance for module
+ //
+ CIMInstance moduleInstance;
+ CIMKeyBinding keyBinding(CIMName("Name"), providerModuleName,
+ CIMKeyBinding::STRING);
+ Array<CIMKeyBinding> kbArray;
+ kbArray.append(keyBinding);
+ CIMObjectPath modulePath("", PEGASUS_NAMESPACENAME_INTEROP,
+ PEGASUS_CLASSNAME_PROVIDERMODULE, kbArray);
+
+ moduleInstance = client.getInstance(PEGASUS_NAMESPACENAME_INTEROP,
+ modulePath);
+
+ //
+ // Get status from instance
+ //
+ Array<Uint16> operationalStatus;
+ Uint32 index = moduleInstance.findProperty(
+ CIMName("OperationalStatus"));
+ if (index != PEG_NOT_FOUND)
+ {
+ CIMValue statusValue =
+ moduleInstance.getProperty(index).getValue();
+ if (!statusValue.isNull())
+ {
+ statusValue.get(operationalStatus);
+ for (Uint32 i = 0; i < operationalStatus.size(); i++)
+ {
+ if (operationalStatus [i] == expectedStatus)
+ {
+ result = true;
+ break;
+ }
+ }
+ }
+ }
+ }
+ catch (...)
+ {
+ }
+
+ return result;
+}
+
+void _checkStatus(
+ CIMClient& client,
+ const String& providerModuleName,
+ Uint16 expectedStatus)
+{
+ Uint32 iteration = 0;
+ Boolean expectedStatusObserved = false;
+ while (iteration < 300)
+ {
+ iteration++;
+ if (_validateStatus(client, providerModuleName, expectedStatus))
+ {
+ expectedStatusObserved = true;
+ break;
+ }
+ else
+ {
+ System::sleep(1);
+ }
+ }
+
+ PEGASUS_TEST_ASSERT(expectedStatusObserved);
+}
+
+void _createModuleInstance(
+ CIMClient& client,
+ const String& name,
+ const String& location,
+ const String& groupName,
+ Uint16 userContext)
+{
+ CIMInstance moduleInstance(PEGASUS_CLASSNAME_PROVIDERMODULE);
+ moduleInstance.addProperty(CIMProperty(CIMName("Name"), name));
+ moduleInstance.addProperty(CIMProperty(CIMName("Vendor"),
+ String("OpenPegasus")));
+ moduleInstance.addProperty(CIMProperty(CIMName("Version"),
+ String("2.0")));
+ moduleInstance.addProperty(CIMProperty(CIMName("InterfaceType"),
+ String("C++Default")));
+ moduleInstance.addProperty(CIMProperty(CIMName("InterfaceVersion"),
+ String("2.5.0")));
+ moduleInstance.addProperty(CIMProperty(CIMName("Location"), location));
+
+ if (groupName.size())
+ {
+ moduleInstance.addProperty(
+ CIMProperty(CIMName("ModuleGroupName"), groupName));
+ }
+
+#ifndef PEGASUS_DISABLE_PROV_USERCTXT
+ if (userContext != 0)
+ {
+ moduleInstance.addProperty(CIMProperty(CIMName("UserContext"),
+ userContext));
+ }
+#endif
+
+ CIMObjectPath path = client.createInstance(PEGASUS_NAMESPACENAME_INTEROP,
+ moduleInstance);
+}
+
+void _createProviderInstance(
+ CIMClient& client,
+ const String& name,
+ const String& providerModuleName)
+{
+ CIMInstance providerInstance(PEGASUS_CLASSNAME_PROVIDER);
+ providerInstance.addProperty(CIMProperty(CIMName("Name"), name));
+ providerInstance.addProperty(CIMProperty(CIMName("ProviderModuleName"),
+ providerModuleName));
+
+ CIMObjectPath path = client.createInstance(PEGASUS_NAMESPACENAME_INTEROP,
+ providerInstance);
+}
+
+void _createCapabilityInstance(
+ CIMClient& client,
+ const String& providerModuleName,
+ const String& providerName,
+ const String& capabilityID,
+ const String& className,
+ const Array<String>& namespaces,
+ const Array<Uint16>& providerType,
+ const CIMPropertyList& supportedProperties,
+ const CIMPropertyList& supportedMethods)
+{
+ CIMInstance capabilityInstance(PEGASUS_CLASSNAME_PROVIDERCAPABILITIES);
+ capabilityInstance.addProperty(CIMProperty(CIMName("ProviderModuleName"),
+ providerModuleName));
+ capabilityInstance.addProperty(CIMProperty(CIMName("ProviderName"),
+ providerName));
+ capabilityInstance.addProperty(CIMProperty(CIMName("CapabilityID"),
+ capabilityID));
+ capabilityInstance.addProperty(CIMProperty(CIMName("ClassName"),
+ className));
+ capabilityInstance.addProperty(CIMProperty(CIMName("Namespaces"),
+ namespaces));
+ capabilityInstance.addProperty(CIMProperty(CIMName("ProviderType"),
+ CIMValue(providerType)));
+ if (!supportedProperties.isNull())
+ {
+ Array<String> propertyNameStrings;
+ for (Uint32 i = 0; i < supportedProperties.size(); i++)
+ {
+ propertyNameStrings.append(supportedProperties [i].getString());
+ }
+ capabilityInstance.addProperty(CIMProperty(
+ CIMName("supportedProperties"), CIMValue(propertyNameStrings)));
+ }
+ if (!supportedMethods.isNull())
+ {
+ Array<String> methodNameStrings;
+ for (Uint32 i = 0; i < supportedMethods.size(); i++)
+ {
+ methodNameStrings.append(supportedMethods [i].getString());
+ }
+ capabilityInstance.addProperty(CIMProperty(
+ CIMName("supportedMethods"), CIMValue(methodNameStrings)));
+ }
+
+ CIMObjectPath path = client.createInstance(PEGASUS_NAMESPACENAME_INTEROP,
+ capabilityInstance);
+}
+
+void _deleteCapabilityInstance(
+ CIMClient& client,
+ const String& providerModuleName,
+ const String& providerName,
+ const String& capabilityID)
+{
+ Array<CIMKeyBinding> keyBindings;
+ keyBindings.append(CIMKeyBinding("ProviderModuleName",
+ providerModuleName, CIMKeyBinding::STRING));
+ keyBindings.append(CIMKeyBinding("ProviderName",
+ providerName, CIMKeyBinding::STRING));
+ keyBindings.append(CIMKeyBinding("CapabilityID",
+ capabilityID, CIMKeyBinding::STRING));
+ CIMObjectPath path("", CIMNamespaceName(),
+ CIMName("PG_ProviderCapabilities"), keyBindings);
+ client.deleteInstance(PEGASUS_NAMESPACENAME_INTEROP, path);
+}
+
+void _deleteProviderInstance(
+ CIMClient& client,
+ const String& name,
+ const String& providerModuleName)
+{
+ Array<CIMKeyBinding> keyBindings;
+ keyBindings.append(CIMKeyBinding("Name",
+ name, CIMKeyBinding::STRING));
+ keyBindings.append(CIMKeyBinding("ProviderModuleName",
+ providerModuleName, CIMKeyBinding::STRING));
+ CIMObjectPath path("", CIMNamespaceName(),
+ CIMName("PG_Provider"), keyBindings);
+ client.deleteInstance(PEGASUS_NAMESPACENAME_INTEROP, path);
+}
+
+void _deleteModuleInstance(
+ CIMClient& client,
+ const String& name)
+{
+ Array<CIMKeyBinding> keyBindings;
+ keyBindings.append(CIMKeyBinding("Name",
+ name, CIMKeyBinding::STRING));
+ CIMObjectPath path("", CIMNamespaceName(),
+ CIMName("PG_ProviderModule"), keyBindings);
+ client.deleteInstance(PEGASUS_NAMESPACENAME_INTEROP, path);
+}
+
+void _createFilterInstance(
+ CIMClient& client,
+ const String& name,
+ const String& query,
+ const String& qlang)
+{
+ CIMInstance filterInstance(PEGASUS_CLASSNAME_INDFILTER);
+ filterInstance.addProperty(CIMProperty(CIMName
+ ("SystemCreationClassName"), System::getSystemCreationClassName()));
+ filterInstance.addProperty(CIMProperty(CIMName("SystemName"),
+ System::getFullyQualifiedHostName()));
+ filterInstance.addProperty(CIMProperty(CIMName("CreationClassName"),
+ PEGASUS_CLASSNAME_INDFILTER.getString()));
+ filterInstance.addProperty(CIMProperty(CIMName("Name"), name));
+ filterInstance.addProperty(CIMProperty(CIMName("Query"), query));
+ filterInstance.addProperty(CIMProperty(CIMName("QueryLanguage"),
+ String(qlang)));
+ filterInstance.addProperty(CIMProperty(CIMName("SourceNamespace"),
+ NAMESPACE.getString()));
+
+ CIMObjectPath path = client.createInstance(PEGASUS_NAMESPACENAME_INTEROP,
+ filterInstance);
+}
+
+void _createHandlerInstance(
+ CIMClient& client,
+ const String& name,
+ const String& destination)
+{
+ CIMInstance handlerInstance(PEGASUS_CLASSNAME_LSTNRDST_CIMXML);
+ handlerInstance.addProperty(CIMProperty(CIMName
+ ("SystemCreationClassName"), System::getSystemCreationClassName()));
+ handlerInstance.addProperty(CIMProperty(CIMName("SystemName"),
+ System::getFullyQualifiedHostName()));
+ handlerInstance.addProperty(CIMProperty(CIMName("CreationClassName"),
+ PEGASUS_CLASSNAME_LSTNRDST_CIMXML.getString()));
+ handlerInstance.addProperty(CIMProperty(CIMName("Name"), name));
+ handlerInstance.addProperty(CIMProperty(CIMName("Destination"),
+ destination));
+
+ CIMObjectPath path = client.createInstance(PEGASUS_NAMESPACENAME_INTEROP,
+ handlerInstance);
+}
+
+CIMObjectPath _buildFilterOrHandlerPath(
+ const CIMName& className,
+ const String& name,
+ const String& host,
+ const CIMNamespaceName& namespaceName = CIMNamespaceName())
+{
+ CIMObjectPath path;
+
+ Array<CIMKeyBinding> keyBindings;
+ keyBindings.append(CIMKeyBinding("SystemCreationClassName",
+ System::getSystemCreationClassName(), CIMKeyBinding::STRING));
+ keyBindings.append(CIMKeyBinding("SystemName",
+ System::getFullyQualifiedHostName(), CIMKeyBinding::STRING));
+ keyBindings.append(CIMKeyBinding("CreationClassName",
+ className.getString(), CIMKeyBinding::STRING));
+ keyBindings.append(CIMKeyBinding("Name", name, CIMKeyBinding::STRING));
+ path.setClassName(className);
+ path.setKeyBindings(keyBindings);
+ path.setNameSpace(namespaceName);
+ path.setHost(host);
+
+ return path;
+}
+
+void _createSubscriptionInstance(
+ CIMClient& client,
+ const CIMObjectPath& filterPath,
+ const CIMObjectPath& handlerPath,
+ Uint16 onFatalErrorPolicy)
+{
+ CIMInstance subscriptionInstance(PEGASUS_CLASSNAME_INDSUBSCRIPTION);
+ subscriptionInstance.addProperty(CIMProperty(CIMName("Filter"),
+ filterPath, 0, PEGASUS_CLASSNAME_INDFILTER));
+ subscriptionInstance.addProperty(CIMProperty(CIMName("Handler"),
+ handlerPath, 0, PEGASUS_CLASSNAME_LSTNRDST_CIMXML));
+ subscriptionInstance.addProperty(CIMProperty(
+ CIMName("SubscriptionState"), CIMValue((Uint16) 2)));
+ subscriptionInstance.addProperty(
+ CIMProperty(
+ CIMName("OnFatalErrorPolicy"),
+ CIMValue((Uint16) onFatalErrorPolicy)));
+ CIMObjectPath path = client.createInstance(PEGASUS_NAMESPACENAME_INTEROP,
+ subscriptionInstance);
+}
+
+void _createSubscription(
+ CIMClient& client,
+ const String& filterName,
+ Uint16 onFatalErrorPolicy = 2)
+{
+ CIMObjectPath filterPath;
+ CIMObjectPath handlerPath;
+ filterPath = _buildFilterOrHandlerPath(
+ PEGASUS_CLASSNAME_INDFILTER, filterName, String::EMPTY,
+ CIMNamespaceName());
+ handlerPath = _buildFilterOrHandlerPath(
+ PEGASUS_CLASSNAME_LSTNRDST_CIMXML, "OOPHandler01", String::EMPTY,
+ CIMNamespaceName());
+ _createSubscriptionInstance(
+ client,
+ filterPath,
+ handlerPath,
+ onFatalErrorPolicy);
+}
+
+CIMObjectPath _getSubscriptionPath(
+ const String& filterName,
+ const String& handlerName)
+{
+ Array<CIMKeyBinding> filterKeyBindings;
+ filterKeyBindings.append(CIMKeyBinding("SystemCreationClassName",
+ System::getSystemCreationClassName(), CIMKeyBinding::STRING));
+ filterKeyBindings.append(CIMKeyBinding("SystemName",
+ System::getFullyQualifiedHostName(), CIMKeyBinding::STRING));
+ filterKeyBindings.append(CIMKeyBinding("CreationClassName",
+ PEGASUS_CLASSNAME_INDFILTER.getString(), CIMKeyBinding::STRING));
+ filterKeyBindings.append(CIMKeyBinding("Name", filterName,
+ CIMKeyBinding::STRING));
+ CIMObjectPath filterPath("", CIMNamespaceName(),
+ PEGASUS_CLASSNAME_INDFILTER, filterKeyBindings);
+
+ Array<CIMKeyBinding> handlerKeyBindings;
+ handlerKeyBindings.append(CIMKeyBinding("SystemCreationClassName",
+ System::getSystemCreationClassName(), CIMKeyBinding::STRING));
+ handlerKeyBindings.append(CIMKeyBinding("SystemName",
+ System::getFullyQualifiedHostName(), CIMKeyBinding::STRING));
+ handlerKeyBindings.append(CIMKeyBinding("CreationClassName",
+ PEGASUS_CLASSNAME_LSTNRDST_CIMXML.getString(),
+ CIMKeyBinding::STRING));
+ handlerKeyBindings.append(CIMKeyBinding("Name", handlerName,
+ CIMKeyBinding::STRING));
+ CIMObjectPath handlerPath("", CIMNamespaceName(),
+ PEGASUS_CLASSNAME_LSTNRDST_CIMXML, handlerKeyBindings);
+
+ Array<CIMKeyBinding> subscriptionKeyBindings;
+ subscriptionKeyBindings.append(CIMKeyBinding("Filter",
+ filterPath.toString(), CIMKeyBinding::REFERENCE));
+ subscriptionKeyBindings.append(CIMKeyBinding("Handler",
+ handlerPath.toString(), CIMKeyBinding::REFERENCE));
+
+ return CIMObjectPath(
+ "",
+ CIMNamespaceName(),
+ PEGASUS_CLASSNAME_INDSUBSCRIPTION,
+ subscriptionKeyBindings);
+}
+
+void _deleteSubscriptionInstance(
+ CIMClient& client,
+ const String& filterName,
+ const String& handlerName)
+{
+ client.deleteInstance(
+ PEGASUS_NAMESPACENAME_INTEROP,
+ _getSubscriptionPath(filterName, handlerName));
+}
+
+void _deleteHandlerInstance(
+ CIMClient& client,
+ const String& name)
+{
+ Array<CIMKeyBinding> keyBindings;
+ keyBindings.append(CIMKeyBinding("SystemCreationClassName",
+ System::getSystemCreationClassName(), CIMKeyBinding::STRING));
+ keyBindings.append(CIMKeyBinding("SystemName",
+ System::getFullyQualifiedHostName(), CIMKeyBinding::STRING));
+ keyBindings.append(CIMKeyBinding("CreationClassName",
+ PEGASUS_CLASSNAME_LSTNRDST_CIMXML.getString(),
+ CIMKeyBinding::STRING));
+ keyBindings.append(CIMKeyBinding("Name", name,
+ CIMKeyBinding::STRING));
+ CIMObjectPath path("", CIMNamespaceName(),
+ PEGASUS_CLASSNAME_LSTNRDST_CIMXML, keyBindings);
+ client.deleteInstance(PEGASUS_NAMESPACENAME_INTEROP, path);
+}
+
+void _deleteFilterInstance(
+ CIMClient& client,
+ const String& name)
+{
+ Array<CIMKeyBinding> keyBindings;
+ keyBindings.append(CIMKeyBinding("SystemCreationClassName",
+ System::getSystemCreationClassName(), CIMKeyBinding::STRING));
+ keyBindings.append(CIMKeyBinding("SystemName",
+ System::getFullyQualifiedHostName(), CIMKeyBinding::STRING));
+ keyBindings.append(CIMKeyBinding("CreationClassName",
+ PEGASUS_CLASSNAME_INDFILTER.getString(), CIMKeyBinding::STRING));
+ keyBindings.append(CIMKeyBinding("Name", name,
+ CIMKeyBinding::STRING));
+ CIMObjectPath path("", CIMNamespaceName(),
+ PEGASUS_CLASSNAME_INDFILTER, keyBindings);
+ client.deleteInstance(PEGASUS_NAMESPACENAME_INTEROP, path);
+}
+
+Sint32 _getValue(
+ CIMClient &client,
+ const String &className,
+ const CIMName &methodName)
+{
+ Array<CIMParamValue> inParams;
+ Array<CIMParamValue> outParams;
+
+ CIMObjectPath instName =
+ CIMObjectPath(className);
+
+ CIMValue returnValue = client.invokeMethod(
+ NAMESPACE,
+ instName,
+ methodName,
+ inParams,
+ outParams);
+ Sint32 rc;
+ returnValue.get(rc);
+
+ return rc;
+}
+
+void _setup(CIMClient& client)
+{
+ //
+ // Create Filters and Handler for subscriptions
+ //
+ _createFilterInstance(client, String("OOPFilter01"),
+ String("SELECT * FROM Test_GroupingClass1"), "WQL");
+
+ _createFilterInstance(client, String("OOPFilter02"),
+ String("SELECT * FROM Test_GroupingClass2"), "WQL");
+
+ _createHandlerInstance(client, String("OOPHandler01"),
+ String("localhost/CIMListener/Pegasus_SimpleDisplayConsumer"));
+}
+
+void _cleanup(CIMClient& client)
+{
+ //
+ // Delete Filters and Handler for subscriptions
+ //
+ _deleteHandlerInstance(client, String("OOPHandler01"));
+ _deleteFilterInstance(client, String("OOPFilter01"));
+ _deleteFilterInstance(client, String("OOPFilter02"));
+}
+
+void _register(
+ CIMClient& client,
+ Uint16 userContext,
+ const String& providerModuleName,
+ const String& location,
+ const String& providerName,
+ const String& capabilityID,
+ const String& className,
+ const String& groupName,
+ const Array<String>& namespaces,
+ const Array<Uint16>& providerType,
+ const CIMPropertyList& supportedProperties,
+ const CIMPropertyList& supportedMethods)
+{
+ //
+ // Create provider module instance
+ //
+ _createModuleInstance(
+ client,
+ providerModuleName,
+ location,
+ groupName,
+ userContext);
+
+ //
+ // Create the provider and capability instances
+ //
+ _createProviderInstance(
+ client,
+ providerName,
+ providerModuleName);
+
+ _createCapabilityInstance(
+ client,
+ providerModuleName,
+ providerName,
+ capabilityID,
+ className,
+ namespaces,
+ providerType,
+ supportedProperties,
+ supportedMethods);
+}
+
+void _deregister(
+ CIMClient& client,
+ const String& providerModuleName,
+ const String& providerName,
+ const String& capabilityID)
+{
+ _deleteCapabilityInstance(
+ client,
+ providerModuleName,
+ providerName,
+ capabilityID);
+
+ _deleteProviderInstance(
+ client,
+ providerName,
+ providerModuleName);
+
+ _deleteModuleInstance(
+ client,
+ providerModuleName);
+}
+
+static void _registerProviders2(
+ CIMClient &client, const String &id, Uint32 userContext = 0)
+{
+ Array<String> namespaces;
+ namespaces.append("test/TestProvider");
+
+ if (verbose)
+ {
+ cout << "registering the providers..." << endl;
+ }
+
+ Array<Uint16> providerType;
+ providerType.append(_METHOD_PROVIDER);
+ providerType.append(_INDICATION_PROVIDER);
+
+ _register(
+ client, // client
+ userContext, // userContext
+ "TestGroupingProviderModule" + id, //providerModuleName
+ "TestGroupingProvider" + id, // location,
+ "TestGroupingProvider" + id, // providerName
+ "TestGroupingProviderCapability" + id, // capabilityID
+ "Test_GroupingClass" + id , // className
+ "TestGroup1", //groupName
+ namespaces,
+ providerType,
+ CIMPropertyList(),
+ CIMPropertyList());
+}
+
+static void _deregisterProviders2(CIMClient &client, const String &id)
+{
+ if (verbose)
+ {
+ cout << "deregistering the providers..." << endl;
+ }
+
+ _deregister(
+ client,
+ "TestGroupingProviderModule" + id,
+ "TestGroupingProvider" + id,
+ "TestGroupingProviderCapability" + id);
+}
+
+static void _registerProviders(CIMClient &client, Uint32 userContext = 0)
+{
+ _registerProviders2(client, "1", userContext);
+ _registerProviders2(client, "2", userContext);
+}
+
+static void _deregisterProviders(CIMClient &client)
+{
+ _deregisterProviders2(client, "1");
+ _deregisterProviders2(client, "2");
+}
+
+static void _testGrouping(CIMClient &client)
+{
+ try
+ {
+ if (verbose)
+ {
+ cout << "Testing module grouping..." << endl;
+ }
+
+ PEGASUS_TEST_ASSERT(
+ _getValue(client, "Test_GroupingClass1", "resetIdentifier") == 0);
+ PEGASUS_TEST_ASSERT(
+ _getValue(client, "Test_GroupingClass1", "getNextIdentifier") == 1);
+ PEGASUS_TEST_ASSERT(
+ _getValue(client, "Test_GroupingClass2", "getNextIdentifier") == 2);
+ PEGASUS_TEST_ASSERT(
+ _getValue(client, "Test_GroupingClass1", "getNextIdentifier") == 3);
+ PEGASUS_TEST_ASSERT(
+ _getValue(client, "Test_GroupingClass2", "getNextIdentifier") == 4);
+ PEGASUS_TEST_ASSERT(
+ _getValue(client, "Test_GroupingClass1", "resetIdentifier") == 0);
+ PEGASUS_TEST_ASSERT(
+ _getValue(client, "Test_GroupingClass2", "getNextIdentifier") == 1);
+
+ }
+ catch (Exception& e)
+ {
+ cerr << "Error: " << e.getMessage() << endl;
+ exit(1);
+ }
+}
+
+static void _testGroupingWithProviderDisabled(CIMClient &client)
+{
+ try
+ {
+ if (verbose)
+ {
+ cout << "Testing module grouping with provider disabled..." << endl;
+ }
+
+ PEGASUS_TEST_ASSERT(
+ _getValue(client, "Test_GroupingClass1", "getNextIdentifier") == 2);
+ PEGASUS_TEST_ASSERT(
+ _getValue(client, "Test_GroupingClass1", "getNextIdentifier") == 3);
+ PEGASUS_TEST_ASSERT(
+ _getValue(client, "Test_GroupingClass1", "resetIdentifier") == 0);
+ PEGASUS_TEST_ASSERT(
+ _getValue(client, "Test_GroupingClass1", "getNextIdentifier") == 1);
+ }
+ catch (Exception& e)
+ {
+ cerr << "Error: " << e.getMessage() << endl;
+ exit(1);
+ }
+}
+
+static void _testIndications(CIMClient &client)
+{
+ try
+ {
+ if (verbose)
+ {
+ cout << "Testing indication provider grouping failure..." << endl;
+ }
+ _setup(client);
+ _registerProviders(client, 2);
+ _createSubscription(client, String("OOPFilter01"));
+ _createSubscription(client, String("OOPFilter02"));
+ try
+ {
+ Array<CIMParamValue> outParams;
+ Array<CIMParamValue> inParams;
+ client.invokeMethod(
+ NAMESPACE,
+ CIMObjectPath("Test_GroupingClass1"),
+ "testFail",
+ inParams,
+ outParams);
+ }
+ catch(...)
+ {
+ }
+
+ _checkStatus(
+ client,
+ "TestGroupingProviderModule1",
+ CIM_MSE_OPSTATUS_VALUE_DEGRADED);
+
+ _checkStatus(
+ client,
+ "TestGroupingProviderModule2",
+ CIM_MSE_OPSTATUS_VALUE_DEGRADED);
+
+ _deleteSubscriptionInstance(client, String("OOPFilter01"),
+ String("OOPHandler01"));
+ _deleteSubscriptionInstance(client, String("OOPFilter02"),
+ String("OOPHandler01"));
+ _cleanup(client);
+ _deregisterProviders(client);
+ }
+ catch (Exception& e)
+ {
+ cerr << "Error: " << e.getMessage() << endl;
+ exit(1);
+ }
+}
+
+int main(int argc, char** argv)
+{
+ verbose = getenv("PEGASUS_TEST_VERBOSE") ? true : false;
+
+ try
+ {
+ CIMClient client;
+ client.connectLocal();
+
+ if (!strcmp(argv[1], "testGrouping"))
+ {
+ _testGrouping(client);
+ }
+ if (!strcmp(argv[1], "testGroupingWithProviderDisabled"))
+ {
+ _testGroupingWithProviderDisabled(client);
+ }
+ else if (!strcmp(argv[1], "registerProviders"))
+ {
+ _registerProviders(client);
+ }
+ else if (!strcmp(argv[1], "deregisterProviders"))
+ {
+ _deregisterProviders(client);
+ }
+ else if (!strcmp(argv[1], "testIndications"))
+ {
+#ifndef PEGASUS_DISABLE_PROV_USERCTXT
+ _testIndications(client);
+#else
+ cout << argv [0] <<
+ ": Grouping indication providers tests skipped because"
+ " PEGASUS_DISABLE_PROV_USERCTXT is defined" << endl;
+#endif
+
+ }
+ }
+ catch (Exception& e)
+ {
+ cerr << "Error: " << e.getMessage() << endl;
+ exit(1);
+ }
+
+ cout << argv[0] << " +++++ passed all tests" << endl;
+
+ return 0;
+}