version 1.56, 2006/05/02 20:26:58
|
version 1.57, 2006/11/07 21:30:36
|
|
|
// | // |
//============================================================================== | //============================================================================== |
// | // |
// Author: Mike Brasher (mbrasher@bmc.com) |
|
// |
|
// Modified By: Karl Schopmeyer (k.schopmeyer@opengroup.org) |
|
// Carol Ann Krug Graves, Hewlett-Packard Company |
|
// (carolann_graves@hp.com) |
|
// David Dillard, VERITAS Software Corp. |
|
// (david.dillard@veritas.com) |
|
// |
|
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
#include "CIMQualifierList.h" | #include "CIMQualifierList.h" |
|
|
throw UninitializedObjectException(); | throw UninitializedObjectException(); |
| |
if (find(qualifier.getName()) != PEG_NOT_FOUND){ | if (find(qualifier.getName()) != PEG_NOT_FOUND){ |
//l10n |
|
//throw AlreadyExistsException |
|
//("qualifier \"" + qualifier.getName().getString () + "\""); |
|
MessageLoaderParms parms("Common.CIMQualifierList.QUALIFIER", | MessageLoaderParms parms("Common.CIMQualifierList.QUALIFIER", |
"qualifier \"$0\"", | "qualifier \"$0\"", |
qualifier.getName().getString()); | qualifier.getName().getString()); |
|
|
//---------------------------------------------------------------------- | //---------------------------------------------------------------------- |
// 4. Check the scope: Must be legal for this qualifier | // 4. Check the scope: Must be legal for this qualifier |
//---------------------------------------------------------------------- | //---------------------------------------------------------------------- |
//#if 0 |
|
// ATTN: These lines throw a bogus exception if the qualifier has | // ATTN: These lines throw a bogus exception if the qualifier has |
// a valid scope (such as Scope::ASSOCIATION) which is not Scope::CLASS | // a valid scope (such as Scope::ASSOCIATION) which is not Scope::CLASS |
// ks Mar 2002. Reinstalled 23 March 2002 to test. | // ks Mar 2002. Reinstalled 23 March 2002 to test. |
|
|
if (!(qd.getScope().hasScope (scope))) | if (!(qd.getScope().hasScope (scope))) |
throw BadQualifierScope | throw BadQualifierScope |
(qd.getName().getString (), scope.toString ()); | (qd.getName().getString (), scope.toString ()); |
//#endif |
|
//---------------------------------------------------------------------- | //---------------------------------------------------------------------- |
// Resolve the qualifierflavor. Since Flavors are a combination of inheritance |
// Resolve the qualifierflavor. Since Flavors are a combination of |
// and input characteristics, resolve the inherited characteristics |
// inheritance and input characteristics, resolve the inherited |
// against those provided with the creation. If there is a superclass |
// characteristics against those provided with the creation. If |
// the flavor is resolved against that superclass. If not, it is resolved |
// there is a superclass the flavor is resolved against that |
// against the declaration. If the flavor is disableoverride and tosubclass |
// superclass. If not, it is resolved against the declaration. If |
// the resolved qualifier value must be identical to the original |
// the flavor is disableoverride and tosubclass the resolved |
|
// qualifier value must be identical to the original |
//---------------------------------------------------------------------- | //---------------------------------------------------------------------- |
// Test for Qualifier found in SuperClass. If found and qualifier | // Test for Qualifier found in SuperClass. If found and qualifier |
// is not overridable. | // is not overridable. |
// Abstract (not Overridable and restricted) can be found in subclasses | // Abstract (not Overridable and restricted) can be found in subclasses |
// Can have nonabstracts below abstracts. That is function of nottosubclass |
// Can have nonabstracts below abstracts. That is function of |
// Association (notOverridable and tosubclass) can be found in subclasses but |
// nottosubclass Association (notOverridable and tosubclass) can be |
// cannot be changed. No non-associatons below associations. In other words |
// found in subclasses but cannot be changed. No non-associatons below |
// once a class becomes an association, no subclass can override that definition |
// associations. In other words once a class becomes an association, |
// apparently |
// no subclass can override that definition apparently |
// Throw exception if DisableOverride and tosubclass and different value. |
// Throw exception if DisableOverride and tosubclass and different |
// Gets the source from superclass if qualifier exists or from declaraction |
// value. Gets the source from superclass if qualifier exists or from |
// If we do not throw the exception, resolve the flavor from the inheritance |
// declaraction. |
// point and resolve against current input. |
// If we do not throw the exception, resolve the flavor from the |
// Diableoverride is defined in the CIM Spec to mean that the value cannot change |
// inheritance point and resolve against current input. |
// The other characteristics including the flavor can change apparently. Thus, we |
// Diableoverride is defined in the CIM Spec to mean that the value |
// need only confirm that the value is the same (2.2 pp 33). Strange since we |
// cannot change. |
// would think that override implies that you cannot override any of the |
// The other characteristics including the flavor can change |
// characteristics (value, type, flavor, etc.) This also leaves the question |
// apparently. Thus, we need only confirm that the value is the same |
// of NULL or no values. The implication is that we must move the value |
// (2.2 pp 33). Strange since we would think that override implies |
// from the superclass or declaration. |
// that you cannot override any of the characteristics (value, type, |
|
// flavor, etc.) This also leaves the question of NULL or no values. |
|
// The implication is that we must move the value from the superclass |
|
// or declaration. |
| |
Uint32 index = inheritedQualifiers.find(q.getName()); | Uint32 index = inheritedQualifiers.find(q.getName()); |
| |
//cout << "KSTEST Qualifier resolve inherit test " << q.getName() |
|
//<< " Inherited From " << ((index == PEG_NOT_FOUND) ? "Declaration" : "superclass") |
|
//<< " Flavor " << q.getFlavor() |
|
//<< " inherited Flavor "; |
|
|
|
if (index == PEG_NOT_FOUND) | if (index == PEG_NOT_FOUND) |
{ // Qualifier does not exist in superclass | { // Qualifier does not exist in superclass |
/* If from declaration, we can override the default value. | /* If from declaration, we can override the default value. |
|
|
&& qd.getFlavor ().hasFlavor | && qd.getFlavor ().hasFlavor |
(CIMFlavor::TOSUBCLASS)) | (CIMFlavor::TOSUBCLASS)) |
{ | { |
if(!(q.getValue() == qd.getValue())) |
|
cout << "KSTEST QL err NSCL " << q.getName() |
|
<< " decl flavor " << qd.getFlavor() << " Flavor " << q.getFlavor() |
|
<< " Not override " |
|
<< !(qd.getFlavor ().hasFlavor |
|
(CIMFlavor::OVERRIDABLE)) |
|
<< " tosubclass " |
|
<< qd.getFlavor ().hasFlavor |
|
(CIMFlavor::TOSUBCLASS) << endl; |
|
XmlWriter::printQualifierDeclElement(qd); |
|
XmlWriter::printQualifierElement(q); |
|
//throw BadQualifierOverride(q.getName()); | //throw BadQualifierOverride(q.getName()); |
} | } |
//cout << qd.getFlavor() << endl;*/ |
|
// Do not allow change from disable override to enable override. | // Do not allow change from disable override to enable override. |
if ((!qd.getFlavor ().hasFlavor(CIMFlavor::OVERRIDABLE)) | if ((!qd.getFlavor ().hasFlavor(CIMFlavor::OVERRIDABLE)) |
&& (q.getFlavor ().hasFlavor(CIMFlavor::OVERRIDABLE))) | && (q.getFlavor ().hasFlavor(CIMFlavor::OVERRIDABLE))) |
throw BadQualifierOverride(q.getName().getString ()); | throw BadQualifierOverride(q.getName().getString ()); |
|
*/ |
| |
Resolver::resolveQualifierFlavor |
Resolver::resolveQualifierFlavor( |
(q, CIMFlavor (qd.getFlavor ()), false); |
q, CIMFlavor (qd.getFlavor ()), false); |
/*if(!(q.getValue() == qd.getValue())) |
|
cout << "KSTEST Flavor resolved from decl. " << q.getName() |
|
<< " decl flavor " << qd.getFlavor().toString () |
|
<< " Flavor " << q.getFlavor().toString () |
|
<< " Not override " |
|
<< !(qd.getFlavor ().hasFlavor |
|
(CIMFlavor::OVERRIDABLE)) |
|
<< " tosubclass " << qd.getFlavor ().hasFlavor |
|
(CIMFlavor::TOSUBCLASS) << endl; |
|
XmlWriter::printQualifierDeclElement(qd); |
|
XmlWriter::printQualifierElement(q); */ |
|
} | } |
else // qualifier exists in superclass | else // qualifier exists in superclass |
{ ////// Make Const again | { ////// Make Const again |
|
|
if (!(iq.getFlavor ().hasFlavor(CIMFlavor::OVERRIDABLE)) | if (!(iq.getFlavor ().hasFlavor(CIMFlavor::OVERRIDABLE)) |
&& iq.getFlavor ().hasFlavor(CIMFlavor::TOSUBCLASS)) | && iq.getFlavor ().hasFlavor(CIMFlavor::TOSUBCLASS)) |
{ | { |
/*if(!(q.getValue() == iq.getvalue())) |
|
cout << "KSTEST QL err inherit " << q.getName() |
|
<< " from superclass " << iq.getName() |
|
<< " Superclass flavor " << iq.getFlavor().toString () |
|
<< " Flavor " << q.getFlavor().toString () |
|
<< endl; |
|
XmlWriter::printQualifierElement(iq); |
|
XmlWriter::printQualifierElement(q); */ |
|
// test if values the same. | // test if values the same. |
CIMValue qv = q.getValue(); | CIMValue qv = q.getValue(); |
CIMValue iqv = iq.getValue(); | CIMValue iqv = iq.getValue(); |
if(!(qv == iqv)) { |
if (!(qv == iqv)) |
|
{ |
throw BadQualifierOverride(q.getName().getString()); | throw BadQualifierOverride(q.getName().getString()); |
} | } |
} | } |
//cout << iq.getFlavor() << endl; |
|
Resolver::resolveQualifierFlavor |
Resolver::resolveQualifierFlavor( |
(q, CIMFlavor (iq.getFlavor ()), true); |
q, CIMFlavor(iq.getFlavor()), true); |
} | } |
} // end of this objects qualifier loop | } // end of this objects qualifier loop |
| |
|
|
// Propagate qualifiers to subclass or to instance that do not have | // Propagate qualifiers to subclass or to instance that do not have |
// already have those qualifiers: | // already have those qualifiers: |
//-------------------------------------------------------------------------- | //-------------------------------------------------------------------------- |
//cout << "KSTEST. Inherited qualifiers ct = " << inheritedQualifiers.getCount() << endl; |
|
| |
for (Uint32 i = 0, n = inheritedQualifiers.getCount(); i < n; i++) | for (Uint32 i = 0, n = inheritedQualifiers.getCount(); i < n; i++) |
{ | { |
CIMQualifier iq = inheritedQualifiers.getQualifier(i); | CIMQualifier iq = inheritedQualifiers.getQualifier(i); |
//cout << "KSTEST inherited qualifier propagate loop " << iq.getName() |
|
//<< " flavor " << iq.getFlavor << " count " << i << endl; |
|
| |
if (isInstancePart) | if (isInstancePart) |
{ | { |
|
|
| |
// If the qualifiers list does not already contain this qualifier, | // If the qualifiers list does not already contain this qualifier, |
// then propagate it (and set the propagated flag to true). Else we | // then propagate it (and set the propagated flag to true). Else we |
// keep current value. Note we have already eliminated any possibity that |
// keep current value. Note we have already eliminated any possibity |
// a nonoverridable qualifier can be in the list. |
// that a nonoverridable qualifier can be in the list. |
// Note that there is no exists() function ATTN:KS 25 Mar 2002 | // Note that there is no exists() function ATTN:KS 25 Mar 2002 |
if(find(iq.getName()) != PEG_NOT_FOUND) | if(find(iq.getName()) != PEG_NOT_FOUND) |
continue; | continue; |