version 1.1, 2008/05/19 18:53:38
|
version 1.6, 2014/02/25 20:04:22
|
|
|
//%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. |
|
// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
|
// EMC Corporation; Symantec Corporation; The Open Group. |
|
// | // |
// Permission is hereby granted, free of charge, to any person obtaining a copy |
// Permission is hereby granted, free of charge, to any person obtaining a |
// of this software and associated documentation files (the "Software"), to |
// copy of this software and associated documentation files (the "Software"), |
// deal in the Software without restriction, including without limitation the |
// to deal in the Software without restriction, including without limitation |
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
// the rights to use, copy, modify, merge, publish, distribute, sublicense, |
// sell copies of the Software, and to permit persons to whom the Software is |
// and/or sell copies of the Software, and to permit persons to whom the |
// furnished to do so, subject to the following conditions: |
// Software is furnished to do so, subject to the following conditions: |
// | // |
// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN |
// The above copyright notice and this permission notice shall be included |
// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED |
// in all copies or substantial portions of the Software. |
// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT |
|
// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR |
|
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
|
// 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. |
|
// | // |
//============================================================================== |
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
|
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
|
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
|
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 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. |
|
// |
|
////////////////////////////////////////////////////////////////////////// |
// | // |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
|
|
if (value == 0) | if (value == 0) |
{ | { |
if (subscript == -1) | if (subscript == -1) |
|
{ |
cv.setNullValue(CIMType(type), false); | cv.setNullValue(CIMType(type), false); |
|
} |
else | else |
|
{ |
cv.setNullValue(CIMType(type), true, subscript); | cv.setNullValue(CIMType(type), true, subscript); |
|
} |
| |
return 0; | return 0; |
} | } |
|
|
const MRRFeature* sf = sc->features[i]; | const MRRFeature* sf = sc->features[i]; |
| |
if (!(sf->flags & flags)) | if (!(sf->flags & flags)) |
|
{ |
continue; | continue; |
|
} |
| |
// Override feature if defined by ancestor class: | // Override feature if defined by ancestor class: |
| |
|
|
const MRRFeature* sf = sc->features[i]; | const MRRFeature* sf = sc->features[i]; |
| |
if (_eqi(sf->name, name)) | if (_eqi(sf->name, name)) |
|
{ |
return sf; | return sf; |
} | } |
|
} |
| |
// Not found! | // Not found! |
return 0; | return 0; |
|
|
const MRRFeature* sf = sm->parameters[i]; | const MRRFeature* sf = sm->parameters[i]; |
| |
if (_eqi(sm->name, name)) | if (_eqi(sm->name, name)) |
|
{ |
return sf; | return sf; |
} | } |
|
} |
| |
// Not found! | // Not found! |
return 0; | return 0; |
|
|
const MRRFeature* sf = _findFeature(sc, featureName); | const MRRFeature* sf = _findFeature(sc, featureName); |
| |
if (sf) | if (sf) |
|
{ |
quals = sf->qualifiers; | quals = sf->qualifiers; |
} | } |
|
} |
else if (featureName && parameterName) | else if (featureName && parameterName) |
{ | { |
// Case 3: get parameter qualifiers: | // Case 3: get parameter qualifiers: |
|
|
const MRRFeature* p = _findParameter(sm, parameterName); | const MRRFeature* p = _findParameter(sm, parameterName); |
| |
if (p) | if (p) |
|
{ |
quals = p->qualifiers; | quals = p->qualifiers; |
} | } |
} | } |
|
} |
| |
// Merge quals into the qualifiers array: | // Merge quals into the qualifiers array: |
| |
if (!quals) | if (!quals) |
|
{ |
return 0; | return 0; |
|
} |
| |
for (size_t i = 0; quals[i]; i++) | for (size_t i = 0; quals[i]; i++) |
{ | { |
|
|
CIMProperty cp(sp->name, cv); | CIMProperty cp(sp->name, cv); |
| |
if (includeClassOrigin) | if (includeClassOrigin) |
|
{ |
cp.setClassOrigin(classOrigin); | cp.setClassOrigin(classOrigin); |
|
} |
| |
cp.setPropagated(propagated); | cp.setPropagated(propagated); |
| |
|
|
CIMProperty cp(sr->name, cv, arraySize, rcn); | CIMProperty cp(sr->name, cv, arraySize, rcn); |
| |
if (includeClassOrigin) | if (includeClassOrigin) |
|
{ |
cp.setClassOrigin(classOrigin); | cp.setClassOrigin(classOrigin); |
|
} |
| |
cp.setPropagated(propagated); | cp.setPropagated(propagated); |
| |
|
|
CIMMethod cm(sm->name, CIMType(sm->type)); | CIMMethod cm(sm->name, CIMType(sm->type)); |
| |
if (includeClassOrigin) | if (includeClassOrigin) |
|
{ |
cm.setClassOrigin(classOrigin); | cm.setClassOrigin(classOrigin); |
|
} |
| |
cm.setPropagated(propagated); | cm.setPropagated(propagated); |
| |
|
|
| |
if (includeQualifiers) | if (includeQualifiers) |
{ | { |
if (_addQualifiers(ns, sc, 0, 0, cc) != 0) |
if (_addQualifiers(ns, sc, NULL, NULL, cc) != 0) |
{ | { |
return -1; | return -1; |
} | } |
|
|
flavor.addFlavor(CIMFlavor::OVERRIDABLE); | flavor.addFlavor(CIMFlavor::OVERRIDABLE); |
if (mqd->flavor & MRR_FLAVOR_TOSUBCLASS) | if (mqd->flavor & MRR_FLAVOR_TOSUBCLASS) |
flavor.addFlavor(CIMFlavor::TOSUBCLASS); | flavor.addFlavor(CIMFlavor::TOSUBCLASS); |
if (mqd->flavor & MRR_FLAVOR_TOINSTANCE) |
//if (mqd->flavor & MRR_FLAVOR_TOINSTANCE) |
flavor.addFlavor(CIMFlavor::TOINSTANCE); |
// flavor.addFlavor(CIMFlavor::TOINSTANCE); |
if (mqd->flavor & MRR_FLAVOR_TRANSLATABLE) | if (mqd->flavor & MRR_FLAVOR_TRANSLATABLE) |
flavor.addFlavor(CIMFlavor::TRANSLATABLE); | flavor.addFlavor(CIMFlavor::TRANSLATABLE); |
if (mqd->flavor & MRR_FLAVOR_DISABLEOVERRIDE) | if (mqd->flavor & MRR_FLAVOR_DISABLEOVERRIDE) |
|
|
Uint32 arraySize; | Uint32 arraySize; |
| |
if (mqd->subscript == -1) | if (mqd->subscript == -1) |
|
{ |
arraySize = 0; | arraySize = 0; |
|
} |
else | else |
|
{ |
arraySize = mqd->subscript; | arraySize = mqd->subscript; |
|
} |
| |
cqd = CIMQualifierDecl(mqd->name, cv, scope, flavor, arraySize); | cqd = CIMQualifierDecl(mqd->name, cv, scope, flavor, arraySize); |
| |
|
|
const MRRClass* sc = ns->classes[i]; | const MRRClass* sc = ns->classes[i]; |
| |
if (_eqi(sc->name, name)) | if (_eqi(sc->name, name)) |
|
{ |
return sc; | return sc; |
} | } |
|
} |
| |
// Not found! | // Not found! |
return 0; | return 0; |
|
|
const MRRQualifierDecl* mqd = ns->qualifiers[i]; | const MRRQualifierDecl* mqd = ns->qualifiers[i]; |
| |
if (_eqi(mqd->name, name)) | if (_eqi(mqd->name, name)) |
|
{ |
return mqd; | return mqd; |
} | } |
|
} |
| |
// Not found! | // Not found! |
return 0; | return 0; |
|
|
bool IsSubClass(const MRRClass* super, const MRRClass* sub) | bool IsSubClass(const MRRClass* super, const MRRClass* sub) |
{ | { |
if (!super) | if (!super) |
|
{ |
return true; | return true; |
|
} |
| |
for (MRRClass* p = sub->super; p; p = p->super) | for (MRRClass* p = sub->super; p; p = p->super) |
{ | { |
if (p == super) | if (p == super) |
|
{ |
return true; | return true; |
} | } |
|
} |
| |
return false; | return false; |
} | } |
|
|
const MRRFeature* sf = sc->features[i]; | const MRRFeature* sf = sc->features[i]; |
| |
if (sf->flags & flags && _eqi(sf->name, name)) | if (sf->flags & flags && _eqi(sf->name, name)) |
|
{ |
return sf; | return sf; |
} | } |
|
} |
| |
// Not found! | // Not found! |
return 0; | return 0; |