version 1.4, 2001/07/10 22:31:20
|
version 1.5, 2001/07/16 22:00:00
|
|
|
//%///////////////////////////////////////////////////////////////////////////// |
//%//////////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000 The Open Group, BMC Software, Tivoli Systems, IBM | // Copyright (c) 2000 The Open Group, BMC Software, Tivoli Systems, IBM |
// | // |
|
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
// DEALINGS IN THE SOFTWARE. | // DEALINGS IN THE SOFTWARE. |
// | // |
//============================================================================== |
//============================================================================= |
// | // |
// Author: Mike Brasher (mbrasher@bmc.com) | // Author: Mike Brasher (mbrasher@bmc.com) |
// | // |
// Modified By: Bob Blair (bblair@bmc.com) | // Modified By: Bob Blair (bblair@bmc.com) |
// | // |
//%///////////////////////////////////////////////////////////////////////////// |
//%//////////////////////////////////////////////////////////////////////////// |
| |
| |
#include "compilerDeclContext.h" | #include "compilerDeclContext.h" |
| |
compilerDeclContext::compilerDeclContext(cimmofRepository *repository, |
compilerDeclContext::compilerDeclContext(CIMRepository *repository, |
cimmofRepository::operationType ot) : |
compilerCommonDefs::operationType ot) : |
RepositoryDeclContext(repository), _cimmofRepository(repository), _ot(ot) |
RepositoryDeclContext(repository), _cimRepository(repository), _ot(ot) |
{ |
{ |
|
if (!repository && ot != compilerCommonDefs::IGNORE_REPOSITORY) |
|
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_FAILED, |
|
"attempt to initialize repository with " |
|
"invalid data"); |
} | } |
| |
compilerDeclContext::~compilerDeclContext() {} | compilerDeclContext::~compilerDeclContext() {} |
|
|
const String &qualifierName) const | const String &qualifierName) const |
{ | { |
const CIMQualifierDecl *pTheQualifier = 0; | const CIMQualifierDecl *pTheQualifier = 0; |
if (_ot != cimmofRepository::USE_REPOSITORY) { |
if (_ot != compilerCommonDefs::USE_REPOSITORY) { |
if ( (pTheQualifier = | if ( (pTheQualifier = |
_findQualifierInMemory(qualifierName)) ) | _findQualifierInMemory(qualifierName)) ) |
return *pTheQualifier; | return *pTheQualifier; |
} | } |
if (_repository && (_ot != cimmofRepository::IGNORE_REPOSITORY)) { |
if (_repository && (_ot != compilerCommonDefs::IGNORE_REPOSITORY)) { |
try { | try { |
return _repository->getQualifier(nameSpace, qualifierName); | return _repository->getQualifier(nameSpace, qualifierName); |
} catch (Exception &) { |
} catch (Exception &e) { |
// FIXME: catch the CIM_ERR_NOT_FOUND condition. Don't catch others. |
// FIXME: catch the NOT_FOUND condition. Don't catch others. |
// ignore. It either isn't there or something's broken. | // ignore. It either isn't there or something's broken. |
} | } |
} | } |
|
|
const String &className) const | const String &className) const |
{ | { |
const CIMClass *pTheClass; | const CIMClass *pTheClass; |
if (_ot != cimmofRepository::USE_REPOSITORY) { |
if (_ot != compilerCommonDefs::USE_REPOSITORY) { |
if ( (pTheClass =_findClassInMemory(className)) ) | if ( (pTheClass =_findClassInMemory(className)) ) |
return *pTheClass; | return *pTheClass; |
} | } |
if (_repository && _ot != cimmofRepository::IGNORE_REPOSITORY) { |
if (_repository && _ot != compilerCommonDefs::IGNORE_REPOSITORY) { |
try { | try { |
return _repository->getClass(nameSpace, className); | return _repository->getClass(nameSpace, className); |
} catch(Exception &) { |
} catch(Exception &e) { |
// ignore failure to find. FIXME: pass others on. | // ignore failure to find. FIXME: pass others on. |
} | } |
} | } |
|
|
compilerDeclContext::addQualifierDecl(const String &nameSpace, | compilerDeclContext::addQualifierDecl(const String &nameSpace, |
const CIMQualifierDecl &x) | const CIMQualifierDecl &x) |
{ | { |
if (_ot != cimmofRepository::USE_REPOSITORY) |
if (_ot != compilerCommonDefs::USE_REPOSITORY) |
_qualifiers.append(x); | _qualifiers.append(x); |
else | else |
_repository->setQualifier(nameSpace, x); | _repository->setQualifier(nameSpace, x); |
|
|
void | void |
compilerDeclContext::addClass(const String &nameSpace, CIMClass &x) | compilerDeclContext::addClass(const String &nameSpace, CIMClass &x) |
{ | { |
if (_ot != cimmofRepository::USE_REPOSITORY) |
if (_ot != compilerCommonDefs::USE_REPOSITORY) |
_classes.append(x); | _classes.append(x); |
else | else |
_repository->createClass(nameSpace, x); | _repository->createClass(nameSpace, x); |
} | } |
| |
|
void |
|
compilerDeclContext::addInstance(const String &nameSpace, CIMInstance &x) |
|
{ |
|
if (_ot == compilerCommonDefs::USE_REPOSITORY) |
|
_repository->createInstance(nameSpace, x); |
|
} |
|
|
const CIMClass * | const CIMClass * |
compilerDeclContext::_findClassInMemory(const String &classname) const | compilerDeclContext::_findClassInMemory(const String &classname) const |
{ | { |