version 1.66.4.1, 2007/04/04 11:04:46
|
version 1.88, 2010/06/06 17:04:16
|
|
|
//%2006//////////////////////////////////////////////////////////////////////// |
//%LICENSE//////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development |
// Licensed to The Open Group (TOG) under one or more contributor license |
// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. |
// agreements. Refer to the OpenPegasusNOTICE.txt file distributed with |
// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.; |
// this work for additional information regarding copyright ownership. |
// IBM Corp.; EMC Corporation, The Open Group. |
// Each contributor licenses this file to you under the OpenPegasus Open |
// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.; |
// Source License; you may not use this file except in compliance with the |
// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. |
// License. |
// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
// |
// EMC Corporation; VERITAS Software Corporation; The Open Group. |
// Permission is hereby granted, free of charge, to any person obtaining a |
// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
// copy of this software and associated documentation files (the "Software"), |
// EMC Corporation; Symantec Corporation; The Open Group. |
// to deal in the Software without restriction, including without limitation |
// |
// the rights to use, copy, modify, merge, publish, distribute, sublicense, |
// Permission is hereby granted, free of charge, to any person obtaining a copy |
// and/or sell copies of the Software, and to permit persons to whom the |
// of this software and associated documentation files (the "Software"), to |
// Software is furnished to do so, subject to the following conditions: |
// deal in the Software without restriction, including without limitation the |
// |
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
// The above copyright notice and this permission notice shall be included |
// sell copies of the Software, and to permit persons to whom the Software is |
// in all copies or substantial portions of the Software. |
// furnished to do so, subject to the following conditions: |
// |
// |
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN |
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED |
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT |
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR |
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
|
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
|
// | // |
//============================================================================== |
////////////////////////////////////////////////////////////////////////// |
|
// |
|
//%//////////////////////////////////////////////////////////////////////////// |
| |
/////////////////////////////////////////////////////////////////////////////// | /////////////////////////////////////////////////////////////////////////////// |
// Interop Provider - This provider services those classes from the | // Interop Provider - This provider services those classes from the |
|
|
#include "InteropConstants.h" | #include "InteropConstants.h" |
| |
#include <Pegasus/Common/StatisticalData.h> | #include <Pegasus/Common/StatisticalData.h> |
|
#include <Pegasus/Common/StringConversion.h> |
|
#include <Pegasus/Common/ArrayIterator.h> |
| |
PEGASUS_USING_STD; | PEGASUS_USING_STD; |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
|
|
// | // |
// Constructor for the InteropProvider control provider | // Constructor for the InteropProvider control provider |
// | // |
InteropProvider::InteropProvider(CIMRepository * rep) : repository(rep), |
InteropProvider::InteropProvider( |
hostName(System::getHostName()), providerInitialized(false), |
CIMRepository * rep, |
profileIds(Array<String>()), conformingElements(Array<CIMNameArray>()), |
ProviderRegistrationManager *provRegManager): |
|
repository(rep), |
|
providerRegistrationManager(provRegManager), |
|
hostName(System::getHostName()), |
|
providerInitialized(false), |
|
updateProfileCache(0), |
|
profileIds(Array<String>()), |
|
conformingElements(Array<CIMNameArray>()), |
elementNamespaces(Array<CIMNamespaceArray>()) | elementNamespaces(Array<CIMNamespaceArray>()) |
{ | { |
PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,"InteropProvider::InteropProvider"); | PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,"InteropProvider::InteropProvider"); |
| |
|
ConfigManager *configManager = ConfigManager::getInstance(); |
|
#ifdef PEGASUS_ENABLE_SLP |
|
enableSLP = ConfigManager::parseBooleanValue( |
|
configManager->getCurrentValue("slp")); |
|
#else |
|
enableSLP = false; |
|
#endif |
|
|
|
httpPort = configManager->getCurrentValue("httpPort"); |
|
if (httpPort.size() == 0) |
|
{ |
|
Uint32 portNumberHttp = System::lookupPort( |
|
WBEM_HTTP_SERVICE_NAME, WBEM_DEFAULT_HTTP_PORT); |
|
char buffer[32]; |
|
Uint32 n; |
|
const char *output = Uint32ToString(buffer, portNumberHttp, n); |
|
httpPort.assign(output, n); |
|
} |
|
|
|
httpsPort = configManager->getCurrentValue("httpsPort"); |
|
if (httpsPort.size() == 0) |
|
{ |
|
Uint32 portNumberHttps = System::lookupPort( |
|
WBEM_HTTPS_SERVICE_NAME, WBEM_DEFAULT_HTTPS_PORT); |
|
char buffer[32]; |
|
Uint32 n; |
|
const char *output = Uint32ToString(buffer, portNumberHttps, n); |
|
httpsPort.assign(output, n); |
|
} |
|
|
|
|
#ifndef PEGASUS_DISABLE_PERFINST | #ifndef PEGASUS_DISABLE_PERFINST |
try | try |
{ | { |
initProvider(); | initProvider(); |
} | } |
catch(const Exception & e) |
catch(const Exception &) |
{ | { |
// Provider initialization may fail if the repository is not | // Provider initialization may fail if the repository is not |
// populated | // populated |
|
|
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. |
|
#ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT |
|
|| opClass == PEGASUS_CLASSNAME_CIM_INDICATIONSERVICE |
|
#endif |
|
) |
{ | { |
AutoMutex mut(interopMut); | AutoMutex mut(interopMut); |
return cimomHandle.getInstance(context, opNamespace, |
CIMInstance gotInstance = cimomHandle.getInstance( |
instanceName, false, false, false, propertyList); |
context, |
|
opNamespace, |
|
instanceName, |
|
false, |
|
false, |
|
false, |
|
propertyList); |
|
PEG_METHOD_EXIT(); |
|
return gotInstance; |
} | } |
| |
|
TARGET_CLASS classEnum = translateClassInput(opClass); |
|
CIMInstance retInstance; |
|
switch(classEnum) |
|
{ |
|
case PG_SOFTWAREIDENTITY: |
|
{ |
|
retInstance = getSoftwareIdentityInstance(instanceName); |
|
normalizeInstance( |
|
retInstance, instanceName, false, false, propertyList); |
|
} |
|
break; |
|
case PG_NAMESPACE: |
|
{ |
|
retInstance = getNameSpaceInstance(instanceName); |
|
normalizeInstance( |
|
retInstance, instanceName, false, false, propertyList); |
|
} |
|
break; |
|
// ATTN: Implement getIntstance for all other classes. Currently |
|
// this method calls localEnumerateInstances() to select instance |
|
// which is too expensive. |
|
default: |
|
{ |
// Create reference from host, namespace, class components of | // Create reference from host, namespace, class components of |
// instance name | // instance name |
CIMObjectPath ref; | CIMObjectPath ref; |
|
|
context, | context, |
ref, | ref, |
propertyList); | propertyList); |
|
ConstArrayIterator<CIMInstance> instancesIter(instances); |
| |
// deliver a single instance if found. | // deliver a single instance if found. |
CIMInstance retInstance; |
|
|
|
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(); |
if(!found) | if(!found) |
{ | { |
cout << "Coule not find instance: " << instanceName.toString() << endl; |
throw CIMObjectNotFoundException(instanceName.toString()); |
} | } |
PEG_METHOD_EXIT(); |
} |
|
} |
|
|
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 |
|
|
ref.getNameSpace()); | ref.getNameSpace()); |
break; | break; |
} | } |
|
case PG_ELEMENTCONFORMSTOPROFILE_RP_RP: |
|
{ |
|
instances = enumElementConformsToProfileRPRPInstances( |
|
context, |
|
ref.getNameSpace()); |
|
break; |
|
} |
case PG_SUBPROFILEREQUIRESPROFILE: | case PG_SUBPROFILEREQUIRESPROFILE: |
{ | { |
instances = enumSubProfileRequiresProfileInstances(); | instances = enumSubProfileRequiresProfileInstances(); |
|
|
} | } |
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; |
|
} |
|
//We don't support enumerate CIM_Namespace instances. PG_Namespace is |
|
//supported. |
|
case CIM_NAMESPACE: |
|
{ |
|
break; |
|
} |
|
case PG_PROVIDERPROFILECAPABILITIES: |
|
{ |
|
instances = enumProviderProfileCapabilityInstances(false); |
|
break; |
|
} |
|
|
|
#ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT |
|
case PG_ELEMENTCAPABILITIES: |
|
{ |
|
instances = enumElementCapabilityInstances(context); |
|
break; |
|
} |
|
case PG_HOSTEDINDICATIONSERVICE: |
|
{ |
|
instances = enumHostedIndicationServiceInstances(context); |
|
break; |
|
} |
|
case PG_SERVICEAFFECTSELEMENT: |
|
{ |
|
instances = enumServiceAffectsElementInstances(context); |
break; | break; |
} | } |
|
#endif |
default: | default: |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
throw CIMNotSupportedException(className.getString() + | throw CIMNotSupportedException(className.getString() + |
|
|
// role and resultRole parameter of an associators/associatorNames operation. | // role and resultRole parameter of an associators/associatorNames operation. |
// | // |
bool InteropProvider::validAssocClassForObject( | bool InteropProvider::validAssocClassForObject( |
const CIMName & assocClass, const CIMName & originClass, |
const OperationContext & context, |
|
const CIMName & assocClass, |
|
const CIMObjectPath & objectName, |
const CIMNamespaceName & opNamespace, | const CIMNamespaceName & opNamespace, |
String & originProperty, String & targetProperty) |
String & originProperty, |
|
String & targetProperty) |
{ | { |
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(); |
// 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 |
// is managed by another provider. | // is managed by another provider. |
|
|
} | } |
| |
if(!found) | if(!found) |
|
{ |
|
PEG_METHOD_EXIT(); |
return false; | return false; |
} | } |
} | } |
|
} |
else | else |
{ | { |
// Otherwise, just get the enum value representing the origin class | // Otherwise, just get the enum value representing the origin class |
|
|
CIMName expectedTargetRole; | CIMName expectedTargetRole; |
CIMName expectedOriginRole; | CIMName expectedOriginRole; |
| |
|
Array<CIMName> propNames; |
|
String profileName; |
|
CIMPropertyList propertyList; |
|
CIMInstance tmpInstance; |
|
Uint32 index; |
|
propNames.clear(); |
|
|
// | // |
// Set the target and origin role values. Note that if these values are | // Set the target and origin role values. Note that if these values are |
// not set following the switch block, that implies that the origin class | // not set following the switch block, that implies that the origin class |
|
|
ELEMENTCONFORMSTOPROFILE_PROPERTY_MANAGEDELEMENT; | ELEMENTCONFORMSTOPROFILE_PROPERTY_MANAGEDELEMENT; |
} | } |
break; | break; |
|
case PG_ELEMENTCONFORMSTOPROFILE_RP_RP: |
|
propNames.append(CIMName("RegisteredName")); |
|
propertyList = CIMPropertyList(propNames); |
|
try |
|
{ |
|
tmpInstance = localGetInstance( |
|
context, |
|
objectName, |
|
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()) |
|
{ |
|
index = tmpInstance.findProperty("RegisteredName"); |
|
if (index != PEG_NOT_FOUND) |
|
{ |
|
const CIMValue &tmpVal = |
|
tmpInstance.getProperty(index).getValue(); |
|
if (!tmpVal.isNull()) |
|
{ |
|
tmpVal.get(profileName); |
|
} |
|
} |
|
} |
|
if (String::compareNoCase(profileName, String("SMI-S")) == 0) |
|
{ |
|
expectedTargetRole = |
|
ELEMENTCONFORMSTOPROFILE_PROPERTY_MANAGEDELEMENT; |
|
expectedOriginRole = |
|
ELEMENTCONFORMSTOPROFILE_PROPERTY_CONFORMANTSTANDARD; |
|
} |
|
else |
|
{ |
|
expectedTargetRole = |
|
ELEMENTCONFORMSTOPROFILE_PROPERTY_CONFORMANTSTANDARD; |
|
expectedOriginRole = |
|
ELEMENTCONFORMSTOPROFILE_PROPERTY_MANAGEDELEMENT; |
|
} |
|
break; |
case PG_SUBPROFILEREQUIRESPROFILE: | case PG_SUBPROFILEREQUIRESPROFILE: |
if(originClassEnum == PG_REGISTEREDPROFILE) | if(originClassEnum == PG_REGISTEREDPROFILE) |
{ | { |
|
|
expectedOriginRole = PROPERTY_DEPENDENT; | expectedOriginRole = PROPERTY_DEPENDENT; |
} | } |
break; | break; |
|
case PG_REFERENCEDPROFILE: |
|
if (originClassEnum == PG_REGISTEREDSUBPROFILE) |
|
{ |
|
expectedTargetRole = PROPERTY_ANTECEDENT; |
|
expectedOriginRole = PROPERTY_DEPENDENT; |
|
} |
|
else if (originClassEnum == PG_REGISTEREDPROFILE) |
|
{ |
|
if ((targetProperty.size() != 0) && |
|
(originProperty.size() != 0) && |
|
String::equalNoCase(targetProperty, originProperty)) |
|
{ |
|
return false; |
|
} |
|
if (targetProperty.size() != 0) |
|
{ |
|
if (!(String::equalNoCase(targetProperty, "Antecedent") || |
|
String::equalNoCase(targetProperty, "Dependent") )) |
|
{ |
|
return false; |
|
} |
|
} |
|
if (originProperty.size() != 0) |
|
{ |
|
if (!(String::equalNoCase(originProperty, "Antecedent") || |
|
String::equalNoCase(originProperty, "Dependent") )) |
|
{ |
|
return false; |
|
} |
|
} |
|
if (String::equalNoCase(originProperty, "Antecedent") && |
|
targetProperty.size() == 0) |
|
{ |
|
targetProperty = String("Dependent"); |
|
} |
|
if (String::equalNoCase(originProperty, "Dependent") && |
|
targetProperty.size() == 0) |
|
{ |
|
targetProperty = String("Antecedent"); |
|
} |
|
if (String::equalNoCase(targetProperty, "Antecedent") && |
|
originProperty.size() == 0) |
|
{ |
|
originProperty = String("Dependent"); |
|
} |
|
if (String::equalNoCase(targetProperty, "Dependent") && |
|
originProperty.size() == 0) |
|
{ |
|
originProperty = String("Antecedent"); |
|
} |
|
return true; |
|
} |
|
break; |
case PG_ELEMENTSOFTWAREIDENTITY: | case PG_ELEMENTSOFTWAREIDENTITY: |
if(originClassEnum == PG_SOFTWAREIDENTITY) | if(originClassEnum == PG_SOFTWAREIDENTITY) |
{ | { |
|
|
expectedOriginRole = PROPERTY_DEPENDENT; | expectedOriginRole = PROPERTY_DEPENDENT; |
} | } |
break; | break; |
|
#ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT |
|
case PG_HOSTEDINDICATIONSERVICE: |
|
if(originClassEnum == PG_COMPUTERSYSTEM) |
|
{ |
|
expectedTargetRole = PROPERTY_DEPENDENT; |
|
expectedOriginRole = PROPERTY_ANTECEDENT; |
|
} |
|
break; |
|
#endif |
default: | default: |
break; | break; |
} | } |
|
|
CIMNamespaceName originNamespace(objectName.getNameSpace()); | CIMNamespaceName originNamespace(objectName.getNameSpace()); |
| |
// Check that the association traversal request is valid | // Check that the association traversal request is valid |
if(validAssocClassForObject(assocClass, objectName.getClassName(), |
if (validAssocClassForObject( |
originNamespace, originProperty, targetProperty)) |
context, |
|
assocClass, |
|
objectName, |
|
originNamespace, |
|
originProperty, |
|
targetProperty)) |
{ | { |
// retrieve all of the association class instances | // retrieve all of the association class instances |
Array<CIMInstance> localInstances = localEnumerateInstances(context, | Array<CIMInstance> localInstances = localEnumerateInstances(context, |
|
|
CIMInstance InteropProvider::buildInstanceSkeleton( | CIMInstance InteropProvider::buildInstanceSkeleton( |
const CIMNamespaceName & nameSpace, | const CIMNamespaceName & nameSpace, |
const CIMName& className, | const CIMName& className, |
|
Boolean includeQualifiers, |
CIMClass& returnedClass) | CIMClass& returnedClass) |
{ | { |
PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, | PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, |
|
|
// get class with lo = false, qualifier = true classorig = true | // get class with lo = false, qualifier = true classorig = true |
returnedClass = repository->getClass(nameSpace, | returnedClass = repository->getClass(nameSpace, |
className, false, true, true); | className, false, true, true); |
CIMInstance skeleton = returnedClass.buildInstance(true,true, |
CIMInstance skeleton = returnedClass.buildInstance( |
CIMPropertyList()); |
includeQualifiers, true, CIMPropertyList()); |
| |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
return skeleton; | return skeleton; |
|
|
profileCapabilitiesClass = repository->getClass( | profileCapabilitiesClass = repository->getClass( |
PEGASUS_NAMESPACENAME_INTEROP, | PEGASUS_NAMESPACENAME_INTEROP, |
PEGASUS_CLASSNAME_PG_PROVIDERPROFILECAPABILITIES, | PEGASUS_CLASSNAME_PG_PROVIDERPROFILECAPABILITIES, |
false, true, false); |
false, |
|
true, |
|
false); |
| |
providerClassifications.append(Uint16(5)); // "Instrumentation" | providerClassifications.append(Uint16(5)); // "Instrumentation" |
| |
|
// initialize namespaces. |
|
initializeNamespaces(); |
|
|
|
// Now cache the Registration info used for ElementConformsToProfile |
|
cacheProfileRegistrationInfo(); |
|
|
|
providerInitialized = true; |
|
} |
|
PEG_METHOD_EXIT(); |
|
} |
|
|
// | // |
// Initialize the namespaces so that all namespaces with the | // Initialize the namespaces so that all namespaces with the |
// CIM_ElementConformsToProfile class also have the | // CIM_ElementConformsToProfile class also have the |
|
|
// the cross-namespace ElementConformsToProfile association in both | // the cross-namespace ElementConformsToProfile association in both |
// directions. | // directions. |
// | // |
Array<CIMNamespaceName> namespaceNames = |
void InteropProvider::initializeNamespaces() |
repository->enumerateNameSpaces(); |
{ |
|
Array<CIMNamespaceName> namespaceNames = repository->enumerateNameSpaces(); |
|
// get the PG_ElementConformstoProfile class without the qualifiers |
|
// and then add just the required ASSOCIATION qualifier, so that |
|
// resolveclass doesn't fail for the test/EmbeddedInstance/Dynamic |
|
// namespace, which uses the CIM25 schema that doesn't include any |
|
// of the new qualifiers added to this class in later versions of |
|
// the CIMSchema. |
CIMClass conformsClass = repository->getClass( | CIMClass conformsClass = repository->getClass( |
PEGASUS_NAMESPACENAME_INTEROP, | PEGASUS_NAMESPACENAME_INTEROP, |
PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE); |
PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE, |
|
true, |
|
false); |
|
conformsClass.addQualifier( |
|
CIMQualifier(CIMName("ASSOCIATION"), CIMValue(true))); |
CIMClass profileClass = repository->getClass( | CIMClass profileClass = repository->getClass( |
PEGASUS_NAMESPACENAME_INTEROP, | PEGASUS_NAMESPACENAME_INTEROP, |
PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE); |
PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE, |
|
true, |
|
false); |
for(Uint32 i = 0, n = namespaceNames.size(); i < n; ++i) | for(Uint32 i = 0, n = namespaceNames.size(); i < n; ++i) |
{ | { |
// Check if the PG_ElementConformsToProfile class is present | // Check if the PG_ElementConformsToProfile class is present |
CIMNamespaceName & currentNamespace = namespaceNames[i]; | CIMNamespaceName & currentNamespace = namespaceNames[i]; |
|
|
CIMClass tmpCimClass; | CIMClass tmpCimClass; |
CIMClass tmpPgClass; | CIMClass tmpPgClass; |
CIMClass tmpPgProfileClass; | CIMClass tmpPgProfileClass; |
|
|
{ | { |
// Look for these classes in the same try-block since the | // Look for these classes in the same try-block since the |
// second depends on the first | // second depends on the first |
tmpCimClass = repository->getClass(currentNamespace, |
tmpCimClass = repository->getClass( |
|
currentNamespace, |
PEGASUS_CLASSNAME_CIM_ELEMENTCONFORMSTOPROFILE); | PEGASUS_CLASSNAME_CIM_ELEMENTCONFORMSTOPROFILE); |
tmpPgClass = repository->getClass(currentNamespace, |
tmpPgClass = repository->getClass( |
|
currentNamespace, |
PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE); | PEGASUS_CLASSNAME_PG_ELEMENTCONFORMSTOPROFILE); |
} | } |
catch(const Exception &) | catch(const Exception &) |
|
|
} | } |
try | try |
{ | { |
tmpPgProfileClass = repository->getClass(currentNamespace, |
tmpPgProfileClass = repository->getClass( |
|
currentNamespace, |
PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE); | PEGASUS_CLASSNAME_PG_REGISTEREDPROFILE); |
} | } |
catch(const Exception &) | catch(const Exception &) |
|
|
{ | { |
if(tmpPgClass.isUninitialized()) | if(tmpPgClass.isUninitialized()) |
{ | { |
|
CIMClass newclass = conformsClass.clone(); |
CIMObjectPath newPath = conformsClass.getPath(); | CIMObjectPath newPath = conformsClass.getPath(); |
newPath.setNameSpace(currentNamespace); | newPath.setNameSpace(currentNamespace); |
conformsClass.setPath(newPath); |
newclass.setPath(newPath); |
repository->createClass(currentNamespace, |
repository->createClass( |
conformsClass); |
currentNamespace, |
|
newclass); |
} | } |
if(tmpPgProfileClass.isUninitialized()) | if(tmpPgProfileClass.isUninitialized()) |
{ | { |
CIMObjectPath newPath = conformsClass.getPath(); |
CIMClass newclass = profileClass.clone(); |
|
CIMObjectPath newPath = profileClass.getPath(); |
newPath.setNameSpace(currentNamespace); | newPath.setNameSpace(currentNamespace); |
conformsClass.setPath(newPath); |
newclass.setPath(newPath); |
repository->createClass(currentNamespace, |
repository->createClass( |
profileClass); |
currentNamespace, |
|
newclass); |
} | } |
} | } |
} | } |
|
|
// Now cache the Registration info used for ElementConformsToProfile |
|
cacheProfileRegistrationInfo(); |
|
|
|
providerInitialized = true; |
|
} |
|
|
|
PEG_METHOD_EXIT(); |
|
} | } |
| |
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |
|
|
// END OF FILE | // END OF FILE |