version 1.13, 2008/10/17 12:47:16
|
version 1.23, 2011/05/04 07:32:45
|
|
|
//%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. |
|
// | // |
//============================================================================= |
////////////////////////////////////////////////////////////////////////// |
| |
| |
/////////////////////////////////////////////////////////////////////////////// | /////////////////////////////////////////////////////////////////////////////// |
|
|
#include "InteropProvider.h" | #include "InteropProvider.h" |
#include "InteropProviderUtils.h" | #include "InteropProviderUtils.h" |
#include "InteropConstants.h" | #include "InteropConstants.h" |
#include "Guid.h" |
|
| |
#include <Pegasus/Common/StatisticalData.h> | #include <Pegasus/Common/StatisticalData.h> |
|
#include <Pegasus/General/Guid.h> |
| |
PEGASUS_USING_STD; | PEGASUS_USING_STD; |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
|
|
profileDescriptions.append("Instance Manipulation"); | profileDescriptions.append("Instance Manipulation"); |
| |
ConfigManager* configManager = ConfigManager::getInstance(); | ConfigManager* configManager = ConfigManager::getInstance(); |
if (String::equal(configManager->getCurrentValue( |
if (ConfigManager::parseBooleanValue( |
"enableAssociationTraversal"), "true")) |
configManager->getCurrentValue("enableAssociationTraversal"))) |
{ | { |
profiles.append(6); | profiles.append(6); |
profileDescriptions.append("Association Traversal"); | profileDescriptions.append("Association Traversal"); |
|
|
profiles.append(8); | profiles.append(8); |
profileDescriptions.append("Qualifier Declaration"); | profileDescriptions.append("Qualifier Declaration"); |
| |
if (String::equal(configManager->getCurrentValue( |
if (ConfigManager::parseBooleanValue( |
"enableIndicationService"), "true")) |
configManager->getCurrentValue("enableIndicationService"))) |
{ | { |
profiles.append(9); | profiles.append(9); |
profileDescriptions.append("Indications"); | profileDescriptions.append("Indications"); |
|
|
"InteropProvider::enumCIMXMLCommunicationMechanismInstances"); | "InteropProvider::enumCIMXMLCommunicationMechanismInstances"); |
| |
ConfigManager* configManager = ConfigManager::getInstance(); | ConfigManager* configManager = ConfigManager::getInstance(); |
Boolean enableHttpConnection = String::equal( |
Boolean enableHttpConnection = ConfigManager::parseBooleanValue( |
configManager->getCurrentValue("enableHttpConnection"), "true"); |
configManager->getCurrentValue("enableHttpConnection")); |
Boolean enableHttpsConnection = String::equal( |
Boolean enableHttpsConnection = ConfigManager::parseBooleanValue( |
configManager->getCurrentValue("enableHttpsConnection"), "true"); |
configManager->getCurrentValue("enableHttpsConnection")); |
| |
Array<CIMInstance> instances; | Array<CIMInstance> instances; |
Uint32 namespaceAccessProtocol; | Uint32 namespaceAccessProtocol; |
|
|
bool found = false; | bool found = false; |
Array<CIMInstance> tmpInstances = repository->enumerateInstancesForClass( | Array<CIMInstance> tmpInstances = repository->enumerateInstancesForClass( |
PEGASUS_NAMESPACENAME_INTEROP, | PEGASUS_NAMESPACENAME_INTEROP, |
PEGASUS_CLASSNAME_PG_OBJECTMANAGER, false, false, false, |
PEGASUS_CLASSNAME_PG_OBJECTMANAGER, false, false, |
CIMPropertyList()); | CIMPropertyList()); |
Uint32 numInstances = tmpInstances.size(); | Uint32 numInstances = tmpInstances.size(); |
if(numInstances == 1) | if(numInstances == 1) |
|
|
// | // |
CIMClass omClass; | CIMClass omClass; |
instance = buildInstanceSkeleton(PEGASUS_NAMESPACENAME_INTEROP, | instance = buildInstanceSkeleton(PEGASUS_NAMESPACENAME_INTEROP, |
PEGASUS_CLASSNAME_PG_OBJECTMANAGER, omClass); |
PEGASUS_CLASSNAME_PG_OBJECTMANAGER, false, omClass); |
| |
// Set the common key properties | // Set the common key properties |
setCommonKeys(instance); | setCommonKeys(instance); |
|
|
PEGASUS_CLASSNAME_PG_OBJECTMANAGER.getString()); | PEGASUS_CLASSNAME_PG_OBJECTMANAGER.getString()); |
setPropertyValue(instance, OM_PROPERTY_NAME, | setPropertyValue(instance, OM_PROPERTY_NAME, |
String(PEGASUS_INSTANCEID_GLOBAL_PREFIX) + ":" + Guid::getGuid()); | String(PEGASUS_INSTANCEID_GLOBAL_PREFIX) + ":" + Guid::getGuid()); |
setPropertyValue(instance, OM_PROPERTY_ELEMENTNAME, String("Pegasus")); |
setPropertyValue( |
|
instance, |
|
OM_PROPERTY_ELEMENTNAME, |
|
String(PEGASUS_PG_OBJECTMANAGER_ELEMENTNAME)); |
|
|
Array<Uint16> operationalStatus; | Array<Uint16> operationalStatus; |
operationalStatus.append(2); | operationalStatus.append(2); |
setPropertyValue(instance, OM_PROPERTY_OPERATIONALSTATUS, | setPropertyValue(instance, OM_PROPERTY_OPERATIONALSTATUS, |
|
|
// write instance to the repository | // write instance to the repository |
CIMObjectPath instancePath = repository->createInstance( | CIMObjectPath instancePath = repository->createInstance( |
PEGASUS_NAMESPACENAME_INTEROP, instance); | PEGASUS_NAMESPACENAME_INTEROP, instance); |
|
// Get an updated copy of the instance that was saved |
|
instance = repository->getInstance( |
|
PEGASUS_NAMESPACENAME_INTEROP, instancePath); |
instance.setPath(instancePath); | instance.setPath(instancePath); |
} | } |
| |
|
|
// Get an instance of the PG_ComputerSystem class produced by the | // Get an instance of the PG_ComputerSystem class produced by the |
// ComputerSystem provider in the root/cimv2 namespace. | // ComputerSystem provider in the root/cimv2 namespace. |
// | // |
// @param includeQualifiers Boolean |
// @param opContext Operation context. |
// @param includeClassOrigin Boolean |
|
// @param propertylist CIMPropertyList |
|
// | // |
// @return CIMInstance of PG_ComputerSystem class. | // @return CIMInstance of PG_ComputerSystem class. |
// | // |
// @exception ObjectNotFound exception if a ComputerSystem instance cannot | // @exception ObjectNotFound exception if a ComputerSystem instance cannot |
// be retrieved. | // be retrieved. |
// | // |
CIMInstance InteropProvider::getComputerSystemInstance() |
CIMInstance InteropProvider::getComputerSystemInstance( |
|
const OperationContext &opContext) |
{ | { |
PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, | PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, |
"InteropProvider::getComputerSystemInstance"); | "InteropProvider::getComputerSystemInstance"); |
|
|
CIMInstance instance; | CIMInstance instance; |
AutoMutex mut(interopMut); | AutoMutex mut(interopMut); |
Array<CIMInstance> tmpInstances = cimomHandle.enumerateInstances( | Array<CIMInstance> tmpInstances = cimomHandle.enumerateInstances( |
OperationContext(), |
opContext, |
PEGASUS_NAMESPACENAME_CIMV2, | PEGASUS_NAMESPACENAME_CIMV2, |
PEGASUS_CLASSNAME_PG_COMPUTERSYSTEM, true, false, false, false, | PEGASUS_CLASSNAME_PG_COMPUTERSYSTEM, true, false, false, false, |
CIMPropertyList()); | CIMPropertyList()); |
|
|
// Returns an instance of the HostedObjectManager association linking the | // Returns an instance of the HostedObjectManager association linking the |
// ObjectManager and ComputerSystem instances managed by this provider. | // ObjectManager and ComputerSystem instances managed by this provider. |
// | // |
CIMInstance InteropProvider::getHostedObjectManagerInstance() |
CIMInstance InteropProvider::getHostedObjectManagerInstance( |
|
const OperationContext &opContext) |
{ | { |
PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, | PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, |
"InteropProvider::getHostedObjectManagerInstance"); | "InteropProvider::getHostedObjectManagerInstance"); |
|
|
CIMInstance instance; | CIMInstance instance; |
bool found = false; | bool found = false; |
| |
CIMObjectPath csPath = getComputerSystemInstance().getPath(); |
CIMObjectPath csPath = getComputerSystemInstance(opContext).getPath(); |
CIMObjectPath omPath = getObjectManagerInstance().getPath(); | CIMObjectPath omPath = getObjectManagerInstance().getPath(); |
String csPathString = csPath.toString(); | String csPathString = csPath.toString(); |
String omPathString = omPath.toString(); | String omPathString = omPath.toString(); |
|
|
// instances for this CIMOM. One will be produced for every instance of | // instances for this CIMOM. One will be produced for every instance of |
// CIMXMLCommunicatiomMechanism managed by this provider. | // CIMXMLCommunicatiomMechanism managed by this provider. |
// | // |
Array<CIMInstance> InteropProvider::enumHostedAccessPointInstances() |
Array<CIMInstance> InteropProvider::enumHostedAccessPointInstances( |
|
const OperationContext &opContext) |
{ | { |
PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, | PEG_METHOD_ENTER(TRC_CONTROLPROVIDER, |
"InteropProvider::enumHostedAccessPointInstance"); | "InteropProvider::enumHostedAccessPointInstance"); |
Array<CIMInstance> instances; | Array<CIMInstance> instances; |
| |
CIMObjectPath csPath = getComputerSystemInstance().getPath(); |
CIMObjectPath csPath = getComputerSystemInstance(opContext).getPath(); |
Array<CIMInstance> commMechs = enumCIMXMLCommunicationMechanismInstances(); | Array<CIMInstance> commMechs = enumCIMXMLCommunicationMechanismInstances(); |
CIMClass hapClass = repository->getClass(PEGASUS_NAMESPACENAME_INTEROP, | CIMClass hapClass = repository->getClass(PEGASUS_NAMESPACENAME_INTEROP, |
PEGASUS_CLASSNAME_PG_HOSTEDACCESSPOINT, false, true, false); | PEGASUS_CLASSNAME_PG_HOSTEDACCESSPOINT, false, true, false); |
|
|
CIMClass targetClass; | CIMClass targetClass; |
CIMInstance instanceskel = buildInstanceSkeleton( | CIMInstance instanceskel = buildInstanceSkeleton( |
PEGASUS_NAMESPACENAME_INTEROP, | PEGASUS_NAMESPACENAME_INTEROP, |
PEGASUS_CLASSNAME_PG_COMMMECHANISMFORMANAGER, targetClass); |
PEGASUS_CLASSNAME_PG_COMMMECHANISMFORMANAGER, true, targetClass); |
for (Uint32 i = 0, n = commInstances.size(); i < n; ++i) | for (Uint32 i = 0, n = commInstances.size(); i < n; ++i) |
{ | { |
CIMInstance instance = instanceskel.clone(); | CIMInstance instance = instanceskel.clone(); |
|
|
const OperationContext &opContext) | const OperationContext &opContext) |
{ | { |
Array<CIMInstance> instances; | Array<CIMInstance> instances; |
CIMInstance cInst = getComputerSystemInstance(); |
CIMInstance cInst = getComputerSystemInstance(opContext); |
| |
// Get CIM_IndicationService instance | // Get CIM_IndicationService instance |
Array<CIMObjectPath> servicePaths = cimomHandle.enumerateInstanceNames( | Array<CIMObjectPath> servicePaths = cimomHandle.enumerateInstanceNames( |