version 1.30, 2005/03/30 12:57:57
|
version 1.36, 2005/05/24 10:42:51
|
|
|
// 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 | // Josephine Eskaline Joyce, IBM (jojustin@in.ibm.com) for Bug#3194 |
|
// David Dillard, VERITAS Software Corp. |
|
// (david.dillard@veritas.com) |
|
// Aruran, IBM (ashanmug@in.ibm.com) for Bug# 3659 |
// | // |
//%//////////////////////////////////////////////////////////////////////////// | //%//////////////////////////////////////////////////////////////////////////// |
| |
|
|
#define CDEBUG(X) | #define CDEBUG(X) |
#define LDEBUG() | #define LDEBUG() |
//#define CDEBUG(X) PEGASUS_STD(cout) << "InteropProvider " << X << PEGASUS_STD(endl) | //#define CDEBUG(X) PEGASUS_STD(cout) << "InteropProvider " << X << PEGASUS_STD(endl) |
//#define LDEBUG(X) Logger::put (Logger::DEBUG_LOG, "InteropProvider", Logger::INFORMATION, "$0", X) |
//#define LDEBUG(X) Logger::put (Logger::DEBUG_LOG, "InteropProvider", Logger::TRACE, "$0", X) |
| |
//************************************************************************** | //************************************************************************** |
// | // |
|
|
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 |
//*************************************************************** | //*************************************************************** |
|
|
| |
_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); |
} | } |
|
|
{ | { |
CIMInstance instance = _buildInstanceSkeleton(CIM_NAMESPACEINMANAGER_CLASSNAME); | CIMInstance instance = _buildInstanceSkeleton(CIM_NAMESPACEINMANAGER_CLASSNAME); |
| |
_setPropertyValue(instance, CIMName("Antecdent"), refObjMgr); |
_setPropertyValue(instance, CIMName("Antecedent"), refObjMgr); |
//ATTNATTN: this is weak qualifier. | //ATTNATTN: this is weak qualifier. |
_setPropertyValue(instance, CIMName("Dependent"), _buildReference(namespaceInstances[i], | _setPropertyValue(instance, CIMName("Dependent"), _buildReference(namespaceInstances[i], |
CIM_NAMESPACEINMANAGER_CLASSNAME)); | CIM_NAMESPACEINMANAGER_CLASSNAME)); |
|
|
| |
CIMInstance instance = _buildInstanceSkeleton(CIM_COMMMECHANISMFORMANAGER_CLASSNAME); | CIMInstance instance = _buildInstanceSkeleton(CIM_COMMMECHANISMFORMANAGER_CLASSNAME); |
| |
_setPropertyValue(instance,CIMName("Antecdent"), refObjMgr); |
_setPropertyValue(instance,CIMName("Antecedent"), refObjMgr); |
//ATTNATTN: this is weak qualifier. | //ATTNATTN: this is weak qualifier. |
_setPropertyValue(instance,CIMName("Dependent"), _buildReference(commInstances[i],CIM_COMMMECHANISMFORMANAGER_CLASSNAME)); | _setPropertyValue(instance,CIMName("Dependent"), _buildReference(commInstances[i],CIM_COMMMECHANISMFORMANAGER_CLASSNAME)); |
assocInstances.append(instance); | assocInstances.append(instance); |
|
|
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 |
//************************************************************** | //************************************************************** |
|
|
PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4, | PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4, |
"Namespace = " + newNamespaceName.getString() + | "Namespace = " + newNamespaceName.getString() + |
" successfully created."); | " successfully created."); |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION, |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
"Create Namespace: Shareable = $0, Updates allows: $1, Parent: $2", | "Create Namespace: Shareable = $0, Updates allows: $1, Parent: $2", |
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) |
|
|
"Namespace = " + deleteNamespaceName.getString() + | "Namespace = " + deleteNamespaceName.getString() + |
" successfully deleted."); | " successfully deleted."); |
| |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION, |
Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE, |
"Interop Provider Delete Namespace: $0", | "Interop Provider Delete Namespace: $0", |
deleteNamespaceName.getString()); | deleteNamespaceName.getString()); |
} | } |
|
|
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::TRACE, |
"Interop Provider Set Statistics gathering in CIM_ObjectManager: $0", | "Interop Provider Set Statistics gathering in CIM_ObjectManager: $0", |
(statisticsFlag? "true" : "false")); | (statisticsFlag? "true" : "false")); |
StatisticalData* sd = StatisticalData::current(); | StatisticalData* sd = StatisticalData::current(); |