version 1.81.2.1, 2009/08/18 16:58:50
|
version 1.88.2.1, 2011/10/11 18:18:16
|
|
|
| |
#include <Pegasus/Common/StatisticalData.h> | #include <Pegasus/Common/StatisticalData.h> |
#include <Pegasus/Common/StringConversion.h> | #include <Pegasus/Common/StringConversion.h> |
|
#include <Pegasus/Common/ArrayIterator.h> |
| |
PEGASUS_USING_STD; | PEGASUS_USING_STD; |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
|
|
// through the PG_ElementConformsToProfile association | // through the PG_ElementConformsToProfile association |
CIMNamespaceName opNamespace = instanceName.getNameSpace(); | CIMNamespaceName opNamespace = instanceName.getNameSpace(); |
CIMName opClass = instanceName.getClassName(); | CIMName opClass = instanceName.getClassName(); |
if(opNamespace != PEGASUS_NAMESPACENAME_INTEROP && |
if((opNamespace != PEGASUS_NAMESPACENAME_INTEROP && |
opClass != PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE |
opClass != PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE) |
// Get CIM_IndicationService instance from IndicationService. | // Get CIM_IndicationService instance from IndicationService. |
#ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT | #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT |
|| opClass == PEGASUS_CLASSNAME_CIM_INDICATIONSERVICE | || opClass == PEGASUS_CLASSNAME_CIM_INDICATIONSERVICE |
|
|
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
return gotInstance; | return gotInstance; |
} | } |
|
|
TARGET_CLASS classEnum = translateClassInput(opClass); | TARGET_CLASS classEnum = translateClassInput(opClass); |
CIMInstance retInstance; | CIMInstance retInstance; |
switch(classEnum) | switch(classEnum) |
|
|
retInstance, instanceName, false, false, propertyList); | retInstance, instanceName, false, false, propertyList); |
} | } |
break; | break; |
|
case PG_NAMESPACE: |
|
{ |
|
retInstance = getNameSpaceInstance(instanceName); |
|
normalizeInstance( |
|
retInstance, instanceName, false, false, propertyList); |
|
} |
|
break; |
// ATTN: Implement getIntstance for all other classes. Currently | // ATTN: Implement getIntstance for all other classes. Currently |
// this method calls localEnumerateInstances() to select instance | // this method calls localEnumerateInstances() to select instance |
// which is too expensive. | // which is too expensive. |
|
|
context, | context, |
ref, | ref, |
propertyList); | propertyList); |
|
ConstArrayIterator<CIMInstance> instancesIter(instances); |
| |
// deliver a single instance if found. | // deliver a single instance if found. |
bool found = false; | bool found = false; |
for(Uint32 i = 0, n = instances.size(); i < n; i++) |
for(Uint32 i = 0; i < instancesIter.size(); i++) |
{ | { |
CIMObjectPath currentInstRef = instances[i].getPath(); |
CIMObjectPath currentInstRef = instancesIter[i].getPath(); |
currentInstRef.setHost(instanceName.getHost()); | currentInstRef.setHost(instanceName.getHost()); |
currentInstRef.setNameSpace(instanceName.getNameSpace()); | currentInstRef.setNameSpace(instanceName.getNameSpace()); |
if(instanceName == currentInstRef) | if(instanceName == currentInstRef) |
{ | { |
retInstance = instances[i]; |
retInstance = instancesIter[i]; |
found = true; | found = true; |
break; | break; |
} | } |
} | } |
|
|
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
if (!found) | if (!found) |
{ | { |
|
|
} | } |
} | } |
} | } |
|
|
return retInstance; | return retInstance; |
} | } |
| |
|
Array<CIMInstance> InteropProvider::getReferencedInstances( |
|
const Array<CIMInstance> &refs, |
|
const String targetRole, |
|
const OperationContext & context, |
|
const CIMPropertyList & propertyList) |
|
{ |
|
PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, |
|
"InteropProvider::getReferencedObjects"); |
|
|
|
Array<CIMInstance> referencedInstances; |
|
Array<CIMInstance> classInstances; |
|
CIMName prevClassName; |
|
|
|
ConstArrayIterator<CIMInstance> refsIter(refs); |
|
for(Uint32 i = 0; i < refsIter.size(); i++) |
|
{ |
|
CIMInstance thisRef = refsIter[i]; |
|
CIMObjectPath thisTarget = getRequiredValue<CIMObjectPath>( |
|
thisRef, |
|
targetRole); |
|
|
|
// Test if we're looking for something outside of our namespace. This |
|
// will happen during associators calls from PG_RegisteredProfile |
|
// instances through the PG_ElementConformsToProfile association |
|
CIMNamespaceName opNamespace = thisTarget.getNameSpace(); |
|
CIMName opClass = thisTarget.getClassName(); |
|
|
|
if((opNamespace != PEGASUS_NAMESPACENAME_INTEROP && |
|
opClass != PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE) |
|
// Get CIM_IndicationService instance from IndicationService. |
|
#ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT |
|
|| opClass == PEGASUS_CLASSNAME_CIM_INDICATIONSERVICE |
|
#endif |
|
) |
|
{ |
|
AutoMutex mut(interopMut); |
|
CIMInstance gotInstance = cimomHandle.getInstance( |
|
context, |
|
opNamespace, |
|
thisTarget, |
|
false, |
|
false, |
|
false, |
|
propertyList); |
|
referencedInstances.append(gotInstance); |
|
continue; |
|
} |
|
|
|
TARGET_CLASS classEnum = translateClassInput(opClass); |
|
CIMInstance retInstance; |
|
switch(classEnum) |
|
{ |
|
case PG_SOFTWAREIDENTITY: |
|
{ |
|
CIMInstance retInstance = |
|
getSoftwareIdentityInstance(thisTarget); |
|
normalizeInstance( |
|
retInstance, thisTarget, false, false, propertyList); |
|
retInstance.setPath(thisTarget); |
|
referencedInstances.append(retInstance); |
|
} |
|
break; |
|
case PG_NAMESPACE: |
|
{ |
|
CIMInstance retInstance = getNameSpaceInstance(thisTarget); |
|
normalizeInstance( |
|
retInstance, thisTarget, false, false, propertyList); |
|
retInstance.setPath(thisTarget); |
|
referencedInstances.append(retInstance); |
|
} |
|
break; |
|
default: |
|
{ |
|
if( opClass != prevClassName ) |
|
{ |
|
CIMObjectPath ref; |
|
ref.setHost(thisTarget.getHost()); |
|
ref.setClassName(thisTarget.getClassName()); |
|
ref.setNameSpace(thisTarget.getNameSpace()); |
|
classInstances = localEnumerateInstances( |
|
context, |
|
ref, |
|
propertyList); |
|
ArrayIterator<CIMInstance> instsIter(classInstances); |
|
for(Uint32 n = 0; n < instsIter.size(); n++) |
|
{ |
|
CIMObjectPath tmpInst = instsIter[n].getPath(); |
|
tmpInst.setHost(thisTarget.getHost()); |
|
tmpInst.setNameSpace(thisTarget.getNameSpace()); |
|
instsIter[n].setPath(tmpInst); |
|
} |
|
prevClassName = opClass; |
|
} |
|
ConstArrayIterator<CIMInstance> instsConstIter(classInstances); |
|
for(Uint32 j = 0; j < instsConstIter.size(); j++) |
|
{ |
|
if(thisTarget == instsConstIter[j].getPath()) |
|
{ |
|
referencedInstances.append(instsConstIter[j]); |
|
break; |
|
} |
|
} |
|
} |
|
break; |
|
} |
|
} |
|
PEG_METHOD_EXIT(); |
|
return referencedInstances; |
|
} |
| |
// | // |
// Local version of enumerateInstances to be used by other functions in the | // Local version of enumerateInstances to be used by other functions in the |
|
|
} | } |
case PG_INSTALLEDSOFTWAREIDENTITY: | case PG_INSTALLEDSOFTWAREIDENTITY: |
{ | { |
instances = enumInstalledSoftwareIdentityInstances(); |
instances = enumInstalledSoftwareIdentityInstances(context); |
break; | break; |
} | } |
case PG_COMPUTERSYSTEM: | case PG_COMPUTERSYSTEM: |
{ | { |
instances.append(getComputerSystemInstance()); |
instances.append(getComputerSystemInstance(context)); |
break; | break; |
} | } |
case PG_HOSTEDOBJECTMANAGER: | case PG_HOSTEDOBJECTMANAGER: |
{ | { |
instances.append(getHostedObjectManagerInstance()); |
instances.append(getHostedObjectManagerInstance(context)); |
break; | break; |
} | } |
case PG_HOSTEDACCESSPOINT: | case PG_HOSTEDACCESSPOINT: |
{ | { |
instances = enumHostedAccessPointInstances(); |
instances = enumHostedAccessPointInstances(context); |
break; | break; |
} | } |
//We don't support enumerate CIM_Namespace instances. PG_Namespace is | //We don't support enumerate CIM_Namespace instances. PG_Namespace is |
|
|
} | } |
case PG_PROVIDERPROFILECAPABILITIES: | case PG_PROVIDERPROFILECAPABILITIES: |
{ | { |
instances = enumProviderProfileCapabilityInstances(false, false); |
instances = enumProviderProfileCapabilityInstances(false); |
break; | break; |
} | } |
| |
|
|
PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, | PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, |
"InteropProvider::validAssocClassForObject()"); | "InteropProvider::validAssocClassForObject()"); |
TARGET_CLASS assocClassEnum = translateClassInput(assocClass); | TARGET_CLASS assocClassEnum = translateClassInput(assocClass); |
TARGET_CLASS originClassEnum; |
TARGET_CLASS originClassEnum = NOCLASS; |
CIMName originClass = objectName.getClassName(); | CIMName originClass = objectName.getClassName(); |
// If the association class is PG_ElementConformsToProfile, we'll have to | // If the association class is PG_ElementConformsToProfile, we'll have to |
// do some special processing in case the origin instance for the operation | // do some special processing in case the origin instance for the operation |
|
|
case PG_ELEMENTCONFORMSTOPROFILE_RP_RP: | case PG_ELEMENTCONFORMSTOPROFILE_RP_RP: |
propNames.append(CIMName("RegisteredName")); | propNames.append(CIMName("RegisteredName")); |
propertyList = CIMPropertyList(propNames); | propertyList = CIMPropertyList(propNames); |
|
try |
|
{ |
tmpInstance = localGetInstance( | tmpInstance = localGetInstance( |
context, | context, |
objectName, | objectName, |
propertyList); | propertyList); |
|
} |
|
catch (CIMException &e) |
|
{ |
|
PEG_TRACE((TRC_CONTROLPROVIDER, Tracer::LEVEL2, |
|
"CIMException while getting instance of Registered Profile " |
|
": %s", |
|
(const char*)e.getMessage().getCString())); |
|
} |
if (!tmpInstance.isUninitialized()) | if (!tmpInstance.isUninitialized()) |
{ | { |
index = tmpInstance.findProperty("RegisteredName"); | index = tmpInstance.findProperty("RegisteredName"); |