version 1.2, 2003/10/08 16:31:16
|
version 1.8, 2004/01/27 13:48:11
|
|
|
//%///////////////////////////////////////////////////////////////////////////// |
//%2003//////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000 - 2003 BMC Software, Hewlett-Packard Company, IBM, |
// Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Development |
// The Open Group, Tivoli Systems |
// Company, L. P., IBM Corp., The Open Group, Tivoli Systems. |
|
// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L. P.; |
|
// IBM Corp.; EMC Corporation, The Open Group. |
// | // |
// Permission is hereby granted, free of charge, to any person obtaining a copy | // Permission is hereby granted, free of charge, to any person obtaining a copy |
// of this software and associated documentation files (the "Software"), to | // of this software and associated documentation files (the "Software"), to |
|
|
#include <Pegasus/Common/Pair.h> | #include <Pegasus/Common/Pair.h> |
| |
#include <Pegasus/Server/ProviderRegistrationManager/ProviderRegistrationManager.h> | #include <Pegasus/Server/ProviderRegistrationManager/ProviderRegistrationManager.h> |
|
#include <Pegasus/ProviderManager2/ProviderType.h> |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
|
|
// get the PG_ProviderCapabilities instances for the specified namespace:class_name. use the matching | // get the PG_ProviderCapabilities instances for the specified namespace:class_name. use the matching |
// instance to gather the PG_Provider instance name (logical name). | // instance to gather the PG_Provider instance name (logical name). |
| |
Array<CIMInstance> cimInstances = _prm->enumerateInstances(CIMObjectPath(String::EMPTY, "root/PG_Interop", "PG_ProviderCapabilities")); |
Array<CIMObjectPath> cimInstanceNames = _prm->enumerateInstanceNames(CIMObjectPath(String::EMPTY, "root/PG_Interop", "PG_ProviderCapabilities")); |
| |
for(Uint32 i = 0, n = cimInstances.size(); i < n; i++) |
for(Uint32 i = 0, n = cimInstanceNames.size(); i < n; i++) |
{ | { |
CIMInstance cimInstance = cimInstances[i]; |
CIMInstance cimInstance = _prm->getInstance(cimInstanceNames[i]); |
| |
// check ClassName property value | // check ClassName property value |
if(String::equalNoCase(cimObjectPath.getClassName().getString(), _getPropertyValue(cimInstance, "ClassName").toString())) | if(String::equalNoCase(cimObjectPath.getClassName().getString(), _getPropertyValue(cimInstance, "ClassName").toString())) |
|
|
| |
_getPropertyValue(cimInstance, "Namespaces").get(nameSpaces); | _getPropertyValue(cimInstance, "Namespaces").get(nameSpaces); |
| |
for(Uint32 i = 0, n = nameSpaces.size(); i < n; i++) |
// ATTN: need to walk the array |
{ |
if(String::equalNoCase(cimObjectPath.getNameSpace().getString(), nameSpaces[0])) |
if(String::equalNoCase(cimObjectPath.getNameSpace().getString(), nameSpaces[i])) |
|
{ | { |
providerName = _getPropertyValue(cimInstance, "ProviderName").toString(); | providerName = _getPropertyValue(cimInstance, "ProviderName").toString(); |
| |
|
|
} | } |
} | } |
} | } |
} |
|
catch(...) | catch(...) |
{ | { |
} | } |
|
|
// get the PG_Provider instances associated with the specified namespace:class_name. use the matching | // get the PG_Provider instances associated with the specified namespace:class_name. use the matching |
// instance to gather the PG_ProviderModule instance name. | // instance to gather the PG_ProviderModule instance name. |
| |
Array<CIMInstance> cimInstances = _prm->enumerateInstances(CIMObjectPath(String::EMPTY, "root/PG_Interop", "PG_Provider")); |
Array<CIMObjectPath> cimInstanceNames = _prm->enumerateInstanceNames(CIMObjectPath(String::EMPTY, "root/PG_Interop", "PG_Provider")); |
| |
for(Uint32 i = 0, n = cimInstances.size(); i < n; i++) |
for(Uint32 i = 0, n = cimInstanceNames.size(); i < n; i++) |
{ | { |
CIMInstance cimInstance = cimInstances[i]; |
CIMInstance cimInstance = _prm->getInstance(cimInstanceNames[i]); |
| |
if(String::equalNoCase(providerName, _getPropertyValue(cimInstance, "Name").toString())) | if(String::equalNoCase(providerName, _getPropertyValue(cimInstance, "Name").toString())) |
{ | { |
|
|
// get the PG_ProviderModule instances associated with the specified namespace:class_name. use the matching | // get the PG_ProviderModule instances associated with the specified namespace:class_name. use the matching |
// instance to gather the module status and location (physical name). | // instance to gather the module status and location (physical name). |
| |
Array<CIMInstance> cimInstances = _prm->enumerateInstances(CIMObjectPath(String::EMPTY, "root/PG_Interop", "PG_ProviderModule")); |
Array<CIMObjectPath> cimInstanceNames = _prm->enumerateInstanceNames(CIMObjectPath(String::EMPTY, "root/PG_Interop", "PG_ProviderModule")); |
| |
for(Uint32 i = 0, n = cimInstances.size(); i < n; i++) |
for(Uint32 i = 0, n = cimInstanceNames.size(); i < n; i++) |
{ | { |
CIMInstance cimInstance = cimInstances[i]; |
CIMInstance cimInstance = _prm->getInstance(cimInstanceNames[i]); |
| |
if(String::equalNoCase(moduleName, _getPropertyValue(cimInstance, "Name").toString())) | if(String::equalNoCase(moduleName, _getPropertyValue(cimInstance, "Name").toString())) |
{ | { |
// check status |
// ATTN: check operational status |
if(String::equalNoCase("2", _getPropertyValue(cimInstance, "OperationalStatus").toString())) |
|
{ |
|
// get interface | // get interface |
interfaceType = _getPropertyValue(cimInstance, "InterfaceType").toString(); | interfaceType = _getPropertyValue(cimInstance, "InterfaceType").toString(); |
| |
|
|
} | } |
} | } |
} | } |
} |
|
catch(...) | catch(...) |
{ | { |
} | } |
|
|
throw Exception("Could not determine PG_ProviderModule.InterfaceType or PG_ProviderModule.Location or module is disabled."); | throw Exception("Could not determine PG_ProviderModule.InterfaceType or PG_ProviderModule.Location or module is disabled."); |
} | } |
| |
// fully qualify physical provider name (module), if not already done so. |
// DEBUG |
#if defined(PEGASUS_PLATFORM_WIN32_IX86_MSVC) |
CString s1 = interfaceType.getCString(); |
moduleLocation = moduleLocation + String(".dll"); |
const char * p1 = s1; |
#elif defined(PEGASUS_PLATFORM_LINUX_IX86_GNU) || defined(PEGASUS_PLATFORM_LINUX_IA86_GNU) |
|
String temp = ConfigManager::getHomedPath(ConfigManager::getInstance()->getCurrentValue("providerDir")); |
CString s2 = moduleLocation.getCString(); |
|
const char * p2 = s2; |
moduleLocation = temp + String("/lib") + moduleLocation + String(".so")); |
|
#elif defined(PEGASUS_OS_HPUX) |
|
String temp = ConfigManager::getHomedPath(ConfigManager::getInstance()->getCurrentValue("providerDir")); |
|
|
|
moduleLocation = temp + String("/lib") + moduleLocation + String(".sl")); |
|
#elif defined(PEGASUS_OS_OS400) |
|
// do nothing |
|
#else |
|
foo // needs code |
|
#endif |
|
| |
ProviderName temp( | ProviderName temp( |
cimObjectPath.toString(), | cimObjectPath.toString(), |
|
|
Uint32 flags = providerName.getCapabilitiesMask(); | Uint32 flags = providerName.getCapabilitiesMask(); |
| |
// validate arguments | // validate arguments |
if(objectName.getNameSpace().isNull() || objectName.getClassName().isNull() || (flags == 0)) |
if(objectName.getNameSpace().isNull() || objectName.getClassName().isNull()) |
{ | { |
throw Exception("Invalid argument."); | throw Exception("Invalid argument."); |
} | } |
| |
ProviderName temp = _lookupProvider(objectName); |
CIMInstance provider; |
|
CIMInstance providerModule; |
|
ProviderName temp; |
|
Boolean hasNoQuery; |
|
|
|
switch (flags) { |
|
case 2: //ProviderType::INSTANCE |
|
if (_prm->lookupInstanceProvider(objectName.getNameSpace(),objectName.getClassName(), |
|
provider,providerModule,0)) { |
|
return ProviderName(providerName.getObjectName(), |
|
provider.getProperty(providerModule.findProperty |
|
("Name")).getValue ().toString (), |
|
providerModule.getProperty(providerModule.findProperty |
|
("Location")).getValue().toString(), |
|
providerModule.getProperty(providerModule.findProperty |
|
("InterfaceType")).getValue().toString(), |
|
ProviderType::INSTANCE); |
|
} |
|
break; |
|
case 5: //ProviderType::ASSOCIATION |
|
if (_prm->lookupInstanceProvider(objectName.getNameSpace(),objectName.getClassName(), |
|
provider,providerModule,1)) { |
|
return ProviderName(providerName.getObjectName(), |
|
provider.getProperty(providerModule.findProperty |
|
("Name")).getValue ().toString (), |
|
providerModule.getProperty(providerModule.findProperty |
|
("Location")).getValue().toString(), |
|
providerModule.getProperty(providerModule.findProperty |
|
("InterfaceType")).getValue().toString(), |
|
ProviderType::ASSOCIATION); |
|
} |
|
break; |
|
case 7: //ProviderType::QUERY |
|
if (_prm->lookupInstanceProvider(objectName.getNameSpace(),objectName.getClassName(), |
|
provider,providerModule,0,&hasNoQuery)) { |
|
return ProviderName(providerName.getObjectName(), |
|
provider.getProperty(providerModule.findProperty |
|
("Name")).getValue ().toString (), |
|
providerModule.getProperty(providerModule.findProperty |
|
("Location")).getValue().toString(), |
|
providerModule.getProperty(providerModule.findProperty |
|
("InterfaceType")).getValue().toString(), |
|
ProviderType::INSTANCE); |
|
} |
|
break; |
|
default: |
|
temp = _lookupProvider(objectName); |
|
} |
| |
return(temp); | return(temp); |
} | } |
|
|
return(false); | return(false); |
} | } |
| |
// resolve a partial internal name into a fully qualified (as much as possible) internal |
|
// provider name. for example, given a namespace and class name (embedded in the object |
|
// name component), this method will determine the physical provider name, the logical |
|
// provider name, and the provider capabilities for the specific object name |
|
// |
|
// given X, this method will provide O. |
|
// |
|
// physical_name logical_name object_name capabilities |
|
// ============================================================= |
|
// X |
|
// O X |
|
// O O X O |
|
// |
|
|
|
void SetProviderRegistrationManager(ProviderRegistrationManager * p) | void SetProviderRegistrationManager(ProviderRegistrationManager * p) |
{ | { |
_prm = p; | _prm = p; |