version 1.28, 2005/02/05 23:00:38
|
version 1.33, 2008/08/19 17:19:20
|
|
|
//%2005//////////////////////////////////////////////////////////////////////// |
//%2006//////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development | // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development |
// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. | // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. |
|
|
// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. | // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. |
// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.; | // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
// EMC Corporation; VERITAS Software Corporation; The Open Group. | // 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 copy |
// of this software and associated documentation files (the "Software"), to | // of this software and associated documentation files (the "Software"), to |
|
|
// | // |
//============================================================================== | //============================================================================== |
// | // |
// Author: Mike Brasher (mbrasher@bmc.com) |
|
// |
|
// Modified By: Carol Ann Krug Graves, Hewlett-Packard Company |
|
// (carolann_graves@hp.com) |
|
// |
|
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
#ifndef Pegasus_InheritanceTree_h | #ifndef Pegasus_InheritanceTree_h |
|
|
#include <Pegasus/Common/String.h> | #include <Pegasus/Common/String.h> |
#include <Pegasus/Common/InternalException.h> | #include <Pegasus/Common/InternalException.h> |
#include <Pegasus/Repository/Linkage.h> | #include <Pegasus/Repository/Linkage.h> |
#include <Pegasus/Common/MessageLoader.h> //l10n |
#include <Pegasus/Common/MessageLoader.h> |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
|
|
In this case, check() throws an InvalidInheritanceTree exception. | In this case, check() throws an InvalidInheritanceTree exception. |
| |
The InheritanceTree may be printed by calling the print() method. | The InheritanceTree may be printed by calling the print() method. |
|
|
The insertFromPath() method is used to build up an InheritanceTree from |
|
the file names in a certain directory as used by the CIMRepository. The |
|
CIMRepository contains a disk file per class and the name has this form: |
|
|
|
<pre> |
|
<ClassName>.<SuperClassName> |
|
</pre> |
|
|
|
For example, a class called "ThisClass" with super class "ThatClass" |
|
has this name: |
|
|
|
<pre> |
|
ThisClass.ThisClass |
|
</pre> |
|
|
|
The file or course contains the XML encoding of the ThisClass class (which |
|
is irrelevant for the InheritanceTree). A root class (with no superclass |
|
has the following form): |
|
|
|
<pre> |
|
<ClassName>.# |
|
</pre> |
|
|
|
Suppose that ThatClass is a root class; then its file name is: |
|
|
|
<pre> |
|
ThatClass.# |
|
</pre> |
|
|
|
It must be obvious by now that the insertFromPath() method just scans |
|
the file names in a directory and calls insert() for each one (splitting |
|
the class name from superclass name and translating '#' to an empty string). |
|
|
|
The insertFromPath() method does NOT call check(), so it still must be |
|
called to verify the InheritanceTree. |
|
*/ | */ |
class PEGASUS_REPOSITORY_LINKAGE InheritanceTree | class PEGASUS_REPOSITORY_LINKAGE InheritanceTree |
{ | { |
|
|
@param superClassName - name of super class of class. | @param superClassName - name of super class of class. |
*/ | */ |
void insert(const String& className, const String& superClassName); | void insert(const String& className, const String& superClassName); |
void insert(const String& className, const String& superClassName, |
void insert( |
InheritanceTree &parentTree, NameSpace *parent); |
const String& className, |
|
const String& superClassName, |
/** Scan directory for file names of the form <ClassName>.<SuperClass> and |
InheritanceTree& parentTree, |
call insert on insert for each one. Note that root classes (classes with |
NameSpace* parent); |
no superclass) will use "#" for a SuperClass name. |
|
@param path - directory that contains files describing inheritance |
|
infoformation. |
|
@exception throws CannotOpenDirectory is invalid path specifies an |
|
invalid directory. |
|
*/ |
|
void insertFromPath(const String& path, |
|
InheritanceTree* parentTree=NULL, |
|
NameSpace *ns=NULL); |
|
| |
/** Checks that every superClassName passed to insert() was also passed | /** Checks that every superClassName passed to insert() was also passed |
as a className argument to insert(). In other words, it checks that | as a className argument to insert(). In other words, it checks that |
|
|
was not fully specified (when any class was passed as a superClassName | was not fully specified (when any class was passed as a superClassName |
argument to insert() but never as a className argument. | argument to insert() but never as a className argument. |
*/ | */ |
class InvalidInheritanceTree : public Exception |
class PEGASUS_REPOSITORY_LINKAGE InvalidInheritanceTree : public Exception |
{ | { |
public: | public: |
//l10n start |
|
//InvalidInheritanceTree(const String& className) |
|
//: Exception("Invalid inheritance tree: unknown class: " + className) { } |
|
InvalidInheritanceTree(const String& className) | InvalidInheritanceTree(const String& className) |
: Exception(MessageLoaderParms("Repository.InheritanceTree.INVALID_INHERITANCE_TREE", |
: Exception(MessageLoaderParms( |
"Invalid inheritance tree: unknown class: $0", className)) { } |
"Repository.InheritanceTree.INVALID_INHERITANCE_TREE", |
//l10n end |
"Invalid inheritance tree: unknown class: $0", className)) |
|
{ |
|
} |
}; | }; |
| |
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |