version 1.40, 2005/06/01 12:02:27
|
version 1.41, 2005/06/02 11:47:04
|
|
|
used for localhost (127.0.0.1). | used for localhost (127.0.0.1). |
| |
@param hostName String with the name of the host | @param hostName String with the name of the host |
@return String with the IP address to be used |
@param namespaceType - Uint32 representing the |
NOTE: This code should not be in slpprovider. This |
access protocol for this request. This is exactly |
should be in the Interop classes but for the moment |
the definition in the PG_CIMXMLCommunicationMechanism |
it is not. |
mof for the property namespaceAccessProtocol. |
|
@return String with the IP address to be used. This must |
|
be the complete address sufficient to access the |
|
IP address. Therefore, it includes the port number. |
*/ | */ |
String _getHostAddress(String hostName) |
String _getHostAddress(String & hostName, Uint32 namespaceType) |
{ | { |
String ipAddress; | String ipAddress; |
| |
|
|
// set default address if everything else failed | // set default address if everything else failed |
ipAddress = String("127.0.0.1"); | ipAddress = String("127.0.0.1"); |
} | } |
|
// Question: is there a case where we leave off the port number. |
|
// Code to get the property service_location_tcp ( which is equivalent to "IP address:5988") |
|
// Need to tie these two together. |
|
Uint32 portNumber; |
|
|
|
/********************** Drop this |
|
ConfigManager* configManager = ConfigManager::getInstance(); |
|
Boolean enableHttpConnection = String::equal( |
|
configManager->getCurrentValue("enableHttpConnection"), "true"); |
|
Boolean enableHttpsConnection = String::equal( |
|
configManager->getCurrentValue("enableHttpsConnection"), "true"); |
|
***********************/ |
|
|
|
// ATTN: The following is incorrect and must be modified as part |
|
// of bug 1857 and possibly other bug reports. KS. This is 2.5 mustfix. |
|
|
|
// Match the protocol and port number from internal information. |
|
if (namespaceType == 3) |
|
portNumber = System::lookupPort(WBEM_HTTPS_SERVICE_NAME, |
|
WBEM_DEFAULT_HTTPS_PORT); |
|
else if (namespaceType == 2) |
|
{ |
|
portNumber = System::lookupPort(WBEM_HTTP_SERVICE_NAME, |
|
WBEM_DEFAULT_HTTP_PORT); |
|
} |
|
else |
|
portNumber = 0; |
|
// convert portNumber to ascii |
|
char buffer[32]; |
|
sprintf(buffer, ":%u", portNumber); |
|
if (portNumber != 0) |
|
ipAddress.append(buffer); |
|
|
|
// now fillout the serviceIDAttribute from the object manager instance name property. |
|
// This is a key field so must have a value. |
|
//String strUUID = _getPropertyValue( instance_ObjMgr, namePropertyName, "DefaultEmptyUUID"); |
|
|
return ipAddress; | return ipAddress; |
} | } |
| |
|
|
CIMInstance InteropProvider::_buildInstancePGCIMXMLCommunicationMechanism( | CIMInstance InteropProvider::_buildInstancePGCIMXMLCommunicationMechanism( |
const CIMObjectPath& objectPath, | const CIMObjectPath& objectPath, |
const String& namespaceType, | const String& namespaceType, |
|
const Uint16& accessProtocol, |
const String& IPAddress, | const String& IPAddress, |
const Boolean& includeQualifiers, | const Boolean& includeQualifiers, |
const Boolean& includeClassOrigin, | const Boolean& includeClassOrigin, |
|
|
// Obsolete function | // Obsolete function |
_setPropertyValue(instance, "namespaceType", namespaceType); | _setPropertyValue(instance, "namespaceType", namespaceType); |
| |
_setPropertyValue(instance, "IPAddress", IPAddress); |
_setPropertyValue(instance, "namespaceAccessProtocol", accessProtocol); |
|
|
CDEBUG("Set IP Address: " << " instance " << (( CIMObject ) instance).toString()); |
|
| |
Tracer::trace(TRC_CONTROLPROVIDER, Tracer::LEVEL4, |
_setPropertyValue(instance, "IPAddress", IPAddress); |
"%s CIMXMLInstanceBuild returns IPAddress %s\n%s", thisProvider, IPAddress.getCString(), |
|
( ( CIMObject) instance).toString().getCString()); |
|
|
|
// add the path to this instance. |
|
instance.setPath(instance.buildPath(targetClass)); |
|
| |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
return(instance); | return(instance); |
|
|
"InteropProvider::_buildInstancesPGCIMXMLCommunicationMechanism"); | "InteropProvider::_buildInstancesPGCIMXMLCommunicationMechanism"); |
| |
// This is a temporary hack to get the multiple connections. | // This is a temporary hack to get the multiple connections. |
|
// This is based on the configmanager being the source of what |
|
// protocols are available, http and https. |
|
|
ConfigManager* configManager = ConfigManager::getInstance(); | ConfigManager* configManager = ConfigManager::getInstance(); |
Boolean enableHttpConnection = String::equal( | Boolean enableHttpConnection = String::equal( |
configManager->getCurrentValue("enableHttpConnection"), "true"); | configManager->getCurrentValue("enableHttpConnection"), "true"); |
Boolean enableHttpsConnection = String::equal( | Boolean enableHttpsConnection = String::equal( |
configManager->getCurrentValue("enableHttpsConnection"), "true"); | configManager->getCurrentValue("enableHttpsConnection"), "true"); |
| |
String IPAddress = _getHostAddress(System::getHostName()); |
|
Array<CIMInstance> instances; | Array<CIMInstance> instances; |
|
Uint32 namespaceAccessProtocol; |
|
String namespaceType; |
| |
|
// for each type, create the instance if that type is defined. |
if (enableHttpConnection) | if (enableHttpConnection) |
{ | { |
CIMInstance instance = _buildInstancePGCIMXMLCommunicationMechanism( |
namespaceAccessProtocol = 2; |
|
namespaceType = "http"; |
|
CIMInstance instance = |
|
_buildInstancePGCIMXMLCommunicationMechanism( |
objectPath, | objectPath, |
"http", IPAddress, |
namespaceType, |
|
namespaceAccessProtocol, |
|
_getHostAddress(System::getHostName(), namespaceAccessProtocol), |
includeQualifiers, | includeQualifiers, |
includeClassOrigin, | includeClassOrigin, |
propertyList); | propertyList); |
|
|
| |
if (enableHttpsConnection) | if (enableHttpsConnection) |
{ | { |
CIMInstance instance = _buildInstancePGCIMXMLCommunicationMechanism( |
namespaceAccessProtocol = 3; |
|
namespaceType = "https"; |
|
CIMInstance instance = |
|
_buildInstancePGCIMXMLCommunicationMechanism( |
objectPath, | objectPath, |
"https", IPAddress, |
namespaceType, |
|
namespaceAccessProtocol, |
|
_getHostAddress(System::getHostName(), namespaceAccessProtocol), |
includeQualifiers, | includeQualifiers, |
includeClassOrigin, | includeClassOrigin, |
propertyList); | propertyList); |
instances.append(instance); | instances.append(instance); |
} | } |
| |
|
|
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
return(instances); | return(instances); |
} | } |
|
|
{ | { |
PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, | PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, |
"InteropProvider::_getInstanceCIMObjectManager"); | "InteropProvider::_getInstanceCIMObjectManager"); |
|
|
// Try to get persistent instance from repository | // Try to get persistent instance from repository |
Array<CIMInstance> instances; | Array<CIMInstance> instances; |
try | try |
|
|
"Error. Multiple definitons of : $0", | "Error. Multiple definitons of : $0", |
CIM_OBJECTMANAGER_CLASSNAME.getString()); | CIM_OBJECTMANAGER_CLASSNAME.getString()); |
} | } |
CDEBUG("getInstanceFromRepository returning true"); |
|
return(true); | return(true); |
} | } |
else | else |
{ | { |
CDEBUG("getInstanceFromRepository returning false"); |
|
return(false); | return(false); |
} | } |
} | } |
|
|
// | // |
// No instance in the repository. Build new instance and save it. | // No instance in the repository. Build new instance and save it. |
// | // |
CDEBUG("Creating New instance of CIMOBjectManager"); |
|
|
|
CIMClass targetClass; | CIMClass targetClass; |
instance = _buildInstanceSkeleton(objectPath, CIM_OBJECTMANAGER_CLASSNAME, | instance = _buildInstanceSkeleton(objectPath, CIM_OBJECTMANAGER_CLASSNAME, |
targetClass); | targetClass); |