version 1.28, 2005/03/16 00:45:47
|
version 1.34, 2005/05/19 13:56:13
|
|
|
// (carolann_graves@hp.com) | // (carolann_graves@hp.com) |
// Karl Schopmeyer - Created Cim_Namespace capabilities. | // Karl Schopmeyer - Created Cim_Namespace capabilities. |
// Karl Schopmeyer - added objectmanager and communication classes | // Karl Schopmeyer - added objectmanager and communication classes |
|
// Josephine Eskaline Joyce, IBM (jojustin@in.ibm.com) for Bug#3194 |
|
// David Dillard, VERITAS Software Corp. |
|
// (david.dillard@veritas.com) |
// | // |
//%//////////////////////////////////////////////////////////////////////////// | //%//////////////////////////////////////////////////////////////////////////// |
| |
|
|
CIM_COMMMECHANISMFORMANAGERASSOC=2 | CIM_COMMMECHANISMFORMANAGERASSOC=2 |
}; | }; |
| |
|
|
|
//************************************************************* |
|
// Constructor |
|
//********************************************************** |
|
InteropProvider::InteropProvider(CIMRepository* repository) |
|
{ |
|
PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,"InteropProvider::InteropProvider"); |
|
_repository = repository; |
|
|
|
//*********************************************** |
|
// This is a tempory fix untill there is a method created for the InteropProvider to |
|
// do it's inaliaztion work. This fix sets StatisticalData::CopyGSD, enabling the |
|
//statistical gathering function. |
|
Array<CIMInstance> instance = repository->enumerateInstances(CIMNamespaceName("root/cimv2"), CIMName ("CIM_ObjectManager")); |
|
|
|
if(instance.size() > 0) |
|
{ |
|
Boolean output = false; |
|
Uint32 pos; |
|
if ((pos = instance[0].findProperty(CIMName("GatherStatisticalData"))) != PEG_NOT_FOUND) |
|
{ |
|
CIMConstProperty p1 = instance[0].getProperty(pos); |
|
if (p1.getType() == CIMTYPE_BOOLEAN) |
|
{ |
|
CIMValue v1 = p1.getValue(); |
|
if (!v1.isNull()) |
|
{ |
|
v1.get(output); |
|
if (v1 == true) |
|
{ |
|
StatisticalData* sd = StatisticalData::current(); |
|
sd->setCopyGSD(true); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
//******************************************* end of temporary fix |
|
PEG_METHOD_EXIT(); |
|
} |
|
|
|
|
|
|
//*************************************************************** | //*************************************************************** |
// Provider Utility Functions | // Provider Utility Functions |
//*************************************************************** | //*************************************************************** |
|
|
return(x? "true" : "false"); | return(x? "true" : "false"); |
} | } |
| |
String _toStringPropertyList(const CIMPropertyList& pl) |
static String _toStringPropertyList(const CIMPropertyList& pl) |
{ | { |
String tmp; | String tmp; |
for (Uint32 i = 0; i < pl.size() ; i++) | for (Uint32 i = 0; i < pl.size() ; i++) |
|
|
return(tmp); | return(tmp); |
} | } |
| |
String _showPropertyList(const CIMPropertyList& pl) |
static String _showPropertyList(const CIMPropertyList& pl) |
{ | { |
if (pl.isNull()) | if (pl.isNull()) |
return("NULL"); | return("NULL"); |
|
|
PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, | PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, |
"InteropProvider::_fixInstanceCommonKeys()"); | "InteropProvider::_fixInstanceCommonKeys()"); |
String SystemCreationClassName = System::getSystemCreationClassName (); | String SystemCreationClassName = System::getSystemCreationClassName (); |
if (SystemCreationClassName == String::EMPTY) |
|
{ |
|
//Attn: Get this globally. For now This in place because global is often Empty |
|
SystemCreationClassName = "CIM_ComputerSystem"; |
|
} |
|
| |
_setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME,SystemCreationClassName); | _setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_SYSTEMCREATIONCLASSNAME,SystemCreationClassName); |
| |
// Add property SystemName | // Add property SystemName |
| |
_setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_SYSTEMNAME,System::getHostName()); |
_setPropertyValue(instance, CIM_NAMESPACE_PROPERTY_SYSTEMNAME,System::getFullyQualifiedHostName()); |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
} | } |
| |
|
|
| |
_setPropertyValue(instance, OM_VERSION, CIMXMLProtocolVersion); | _setPropertyValue(instance, OM_VERSION, CIMXMLProtocolVersion); |
| |
// Obsolete function _setPropertyValue(instance, "namespaceType", namespaceType); |
// Obsolete function |
|
_setPropertyValue(instance, "namespaceType", namespaceType); |
| |
_setPropertyValue(instance, "IPAddress", IPAddress); | _setPropertyValue(instance, "IPAddress", IPAddress); |
| |
|
|
return(false); | return(false); |
} | } |
} | } |
catch(CIMException& e) |
catch(const CIMException&) |
{ | { |
Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::INFORMATION, | Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::INFORMATION, |
"Error. Cannot access $0 in repository", CIM_OBJECTMANAGER_CLASSNAME.getString()); | "Error. Cannot access $0 in repository", CIM_OBJECTMANAGER_CLASSNAME.getString()); |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
throw e; |
throw; |
} | } |
catch(Exception& e) |
catch(const Exception&) |
{ | { |
Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::INFORMATION, | Logger::put(Logger::ERROR_LOG, System::CIMSERVER, Logger::INFORMATION, |
"Error. Cannot access $0 in repository", CIM_OBJECTMANAGER_CLASSNAME.getString()); | "Error. Cannot access $0 in repository", CIM_OBJECTMANAGER_CLASSNAME.getString()); |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
throw e; |
throw; |
} | } |
} | } |
| |
|
|
instancePath = _repository->createInstance(_operationNamespace, | instancePath = _repository->createInstance(_operationNamespace, |
instance ); | instance ); |
} | } |
catch(CIMException& e) |
catch(const CIMException&) |
{ | { |
// ATTN: KS generate log error if this not possible | // ATTN: KS generate log error if this not possible |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
throw e; |
throw; |
} | } |
catch(Exception& e) |
catch(const Exception&) |
{ | { |
// ATTN: Generate log error. | // ATTN: Generate log error. |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
throw e; |
throw; |
} | } |
instance.setPath(instancePath); | instance.setPath(instancePath); |
} | } |
|
|
} | } |
if (!_validateRequiredProperty(objectPath, | if (!_validateRequiredProperty(objectPath, |
CIM_NAMESPACE_PROPERTY_SYSTEMNAME, | CIM_NAMESPACE_PROPERTY_SYSTEMNAME, |
System::getHostName())) |
System::getFullyQualifiedHostName())) |
{ | { |
propertyName = CIM_NAMESPACE_PROPERTY_SYSTEMNAME; | propertyName = CIM_NAMESPACE_PROPERTY_SYSTEMNAME; |
valid = false; | valid = false; |
|
|
| |
if (!_completeProperty(instance, | if (!_completeProperty(instance, |
CIM_NAMESPACE_PROPERTY_SYSTEMNAME, | CIM_NAMESPACE_PROPERTY_SYSTEMNAME, |
System::getHostName())) |
System::getFullyQualifiedHostName())) |
{ | { |
propertyName = CIM_NAMESPACE_PROPERTY_SYSTEMNAME; | propertyName = CIM_NAMESPACE_PROPERTY_SYSTEMNAME; |
valid = false; | valid = false; |
|
|
| |
if (!_validateRequiredProperty(instance, | if (!_validateRequiredProperty(instance, |
CIM_NAMESPACE_PROPERTY_SYSTEMNAME, | CIM_NAMESPACE_PROPERTY_SYSTEMNAME, |
System::getHostName())) |
System::getFullyQualifiedHostName ())) |
{ | { |
propertyName = CIM_NAMESPACE_PROPERTY_SYSTEMNAME; | propertyName = CIM_NAMESPACE_PROPERTY_SYSTEMNAME; |
valid = false; | valid = false; |
|
|
return(ref); | return(ref); |
} | } |
| |
/* _isNamespace determines if the namespace in the second |
|
parameter is in the array in the first parameter. |
|
@param array of possible namespaces |
|
@param canidate namespace |
|
@return - true if found |
|
*/ |
|
static Boolean _isNamespace( |
|
Array<CIMNamespaceName>& namespaceNames, |
|
CIMNamespaceName& namespaceName) |
|
{ |
|
PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, |
|
"InteropProvider::_isNamespace"); |
|
|
|
Boolean found = false; |
|
for(Uint32 i = 0; i < namespaceNames.size(); i++) |
|
{ |
|
if(namespaceNames[i].equal ( namespaceName )) |
|
return true; |
|
} |
|
|
|
PEG_METHOD_EXIT(); |
|
return false; |
|
} |
|
|
|
//************************************************************** | //************************************************************** |
// Overloaded functions to get key value with different params | // Overloaded functions to get key value with different params |
//************************************************************** | //************************************************************** |
|
|
newNamespaceName.getString(), shareable? "true" : "false", shareable? "true" : "false", parent ); | newNamespaceName.getString(), shareable? "true" : "false", shareable? "true" : "false", parent ); |
| |
} | } |
catch(CIMException& e) |
catch(const CIMException&) |
{ | { |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
throw e; |
throw; |
} | } |
catch(Exception& e) |
catch(const Exception&) |
{ | { |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
throw e; |
throw; |
} | } |
| |
// begin processing the request | // begin processing the request |
|
|
{ | { |
_repository->deleteInstance(_operationNamespace,instanceName); | _repository->deleteInstance(_operationNamespace,instanceName); |
} | } |
catch(CIMException& e) |
catch(const CIMException&) |
{ | { |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
throw e; |
throw; |
} | } |
} | } |
else if (classEnum == PG_NAMESPACE) | else if (classEnum == PG_NAMESPACE) |
|
|
namespaceName = _getKeyValue(instanceName, CIM_NAMESPACE_PROPERTY_NAME); | namespaceName = _getKeyValue(instanceName, CIM_NAMESPACE_PROPERTY_NAME); |
| |
// ATTN: Why this CIMNamespaceName parentNamespaceName = instanceName.getNameSpace(); | // ATTN: Why this CIMNamespaceName parentNamespaceName = instanceName.getNameSpace(); |
if (!_isNamespace(namespaceNames, namespaceName)) |
if (!Contains(namespaceNames, namespaceName)) |
{ | { |
throw CIMObjectNotFoundException("Namespace does not exist: " | throw CIMObjectNotFoundException("Namespace does not exist: " |
+ namespaceName.getString()); | + namespaceName.getString()); |
|
|
_repository->modifyInstance(_operationNamespace, | _repository->modifyInstance(_operationNamespace, |
instance ); | instance ); |
} | } |
catch(CIMException& e) |
catch(const CIMException&) |
{ | { |
// ATTN: KS generate log error if this not possible | // ATTN: KS generate log error if this not possible |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
throw e; |
throw; |
} | } |
catch(Exception& e) |
catch(const Exception&) |
{ | { |
// ATTN: Generate log error. | // ATTN: Generate log error. |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
throw e; |
throw; |
} | } |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION, | Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION, |
"Interop Provider Set Statistics gathering in CIM_ObjectManager: $0", | "Interop Provider Set Statistics gathering in CIM_ObjectManager: $0", |