|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.quattor.pan.template.CompileTimeContext
public class CompileTimeContext
Contains the global context for the evaluation of a machine profile. Separate hashes are kept for functions, types, and variables allowing them to have identical names. The root element allows properties or resources to be found in the tree of configuration information.
| Field Summary | |
|---|---|
int |
deprecationLevel
|
| Constructor Summary | |
|---|---|
CompileTimeContext()
Constructs a new context for the given root element. |
|
| Method Summary | |
|---|---|
void |
clearSelf()
|
IteratorMap |
createIteratorMap()
|
LocalVariableMap |
createLocalVariableMap(ListResource argv)
|
HashResource |
createRelativeRoot()
Initializes the relative root for this context and returns the old relative root. |
Element |
dereferenceVariable(java.lang.String name,
boolean lookupOnly,
Term[] terms)
Return the Element which corresponds to the given variable name. |
Element |
executeDmlBlock(Operation dml)
|
boolean |
executeDmlValidationBlock(Operation dml,
Element self)
|
java.util.Map<Path,java.util.List<FullType>> |
getBindings()
This method returns an unmodifiable, ordered map of the type bindings. |
int |
getCallLimit()
|
Template |
getCurrentTemplate()
|
java.util.Set<SourceFile> |
getDependencies()
Returns an unmodifiable copy of the dependencies. |
int |
getDeprecationLevel()
|
Element |
getElement(Path path)
Pull the value of an element from a configuration tree. |
Element |
getElement(Path path,
boolean errorIfNotFound)
Pull the value of an element from a configuration tree. |
boolean |
getFailOnWarn()
|
java.lang.String |
getFinalReason(Path p)
|
FullType |
getFullType(java.lang.String name)
Return the type associated with the given name or null if it doesn't exist. |
FunctionDefinition |
getFunction(java.lang.String name)
Return the function definition associated with the given name or null if it doesn't exist. |
Element |
getGlobalVariable(java.lang.String name)
Return the Element which corresponds to the given variable name without duplicating the value. |
int |
getIterationLimit()
|
Resource.Iterator |
getIterator(Resource resource)
Get the iterator for the given resource or null if the iterator has not been registered. |
Element |
getLocalVariable(java.lang.String name)
Return the value associated with a local variable. |
java.util.Set<java.lang.String> |
getObjectDependencies()
Returns an unmodifiable copy of the object dependencies. |
Template |
getObjectTemplate()
Returns the object Template which is the basis of this ObjectContext. |
java.util.List<java.lang.String> |
getRelativeLoadpaths()
|
HashResource |
getRoot()
Returns the root element for this context. |
Element |
getSelf()
|
java.lang.String |
getTraceback(SourceRange sourceRange)
|
Element |
getVariable(java.lang.String name)
Return the Element which corresponds to the given variable name. |
Template |
globalLoad(java.lang.String name)
A method to load a template from the global cache. |
Template |
globalLoad(java.lang.String name,
boolean lookupOnly)
A method to load a template from the global cache. |
void |
initializeSelfHolder(SelfHolder selfHolder)
|
boolean |
isCompileTimeContext()
This flag indicates if this context is a special one used for the compile-time evaluation of DML blocks. |
boolean |
isFinal(Path p)
|
boolean |
isSelfFinal()
|
Template |
localAndGlobalLoad(java.lang.String name,
boolean lookupOnly)
|
Template |
localLoad(java.lang.String name)
A method to load a template from the local cache. |
SourceFile |
lookupFile(java.lang.String name)
|
void |
popTemplate(java.util.logging.Level logLevel,
java.lang.String logMessage)
|
void |
printTraceback(SourceRange sourceRange)
|
void |
pushTemplate(Template template,
SourceRange sourceRange,
java.util.logging.Level logLevel,
java.lang.String logMessage)
|
void |
putElement(Path path,
Element value)
|
void |
removeGlobalVariable(java.lang.String name)
Unconditionally remove a global variable. |
GlobalVariable |
replaceGlobalVariable(java.lang.String name,
Element value,
boolean finalFlag)
Replaces the given global variable with the given value. |
void |
resetSelf(Element newValue)
|
void |
restoreIteratorMap(IteratorMap iteratorMap)
|
void |
restoreLocalVariableMap(LocalVariableMap localVariableHolder)
|
HashResource |
restoreRelativeRoot(HashResource previousValue)
Retrieve and clear the relative root for this context. |
void |
restoreSelf(SelfHolder self)
|
GlobalVariable |
retrieveGlobalVariable(java.lang.String name)
|
SelfHolder |
saveSelf()
|
void |
setBinding(Path path,
FullType fullType,
Template template,
SourceRange sourceRange)
This method associates a type definition to a path. |
void |
setCurrentTemplate(Template template)
|
void |
setFinal(Path p)
|
void |
setFullType(java.lang.String name,
FullType fullType,
Template template,
SourceRange sourceRange)
Associate the given type with the given name within this ObjectContext. |
void |
setFunction(java.lang.String name,
Operation function,
Template template,
SourceRange sourceRange)
Define the given DML block as a function with the given name in this context. |
void |
setGlobalVariable(java.lang.String name,
Element value)
Set the variable to the given value, preserving the status of the final flag. |
void |
setGlobalVariable(java.lang.String name,
Element value,
boolean finalFlag)
Set the variable to the given value. |
void |
setGlobalVariable(java.lang.String name,
GlobalVariable variable)
Set the variable to the given GlobalVariable. |
void |
setIterator(Resource resource,
Resource.Iterator iterator)
Register a Resource iterator in the context. |
void |
setLocalVariable(java.lang.String name,
Element value)
Set the local variable to the given value. |
void |
setLocalVariable(java.lang.String name,
Term[] terms,
Element value)
Set the local variable to the given value. |
void |
setObjectAndLoadpath()
Set the name of the object template. |
void |
setRelativeLoadpaths(java.util.List<java.lang.String> rpaths)
|
void |
turnOffObjectDependencyChecking()
Turn off the object dependency checking. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public final int deprecationLevel
| Constructor Detail |
|---|
public CompileTimeContext()
| Method Detail |
|---|
public Template getObjectTemplate()
getObjectTemplate in interface Contextpublic HashResource getRoot()
getRoot in interface Contextpublic HashResource restoreRelativeRoot(HashResource previousValue)
restoreRelativeRoot in interface ContextpreviousValue - previous value of the relative root to restore
public HashResource createRelativeRoot()
createRelativeRoot in interface Contextpublic java.util.Set<SourceFile> getDependencies()
getDependencies in interface Contextpublic java.util.Set<java.lang.String> getObjectDependencies()
getObjectDependencies in interface Contextpublic void turnOffObjectDependencyChecking()
turnOffObjectDependencyChecking in interface Contextpublic Template localLoad(java.lang.String name)
localLoad in interface Context
public Template localAndGlobalLoad(java.lang.String name,
boolean lookupOnly)
localAndGlobalLoad in interface Contextpublic Template globalLoad(java.lang.String name)
globalLoad in interface Context
public Template globalLoad(java.lang.String name,
boolean lookupOnly)
globalLoad in interface Contextpublic SourceFile lookupFile(java.lang.String name)
lookupFile in interface Contextpublic LocalVariableMap createLocalVariableMap(ListResource argv)
createLocalVariableMap in interface Contextpublic void restoreLocalVariableMap(LocalVariableMap localVariableHolder)
restoreLocalVariableMap in interface Contextpublic IteratorMap createIteratorMap()
createIteratorMap in interface Contextpublic void restoreIteratorMap(IteratorMap iteratorMap)
restoreIteratorMap in interface Contextpublic void setObjectAndLoadpath()
setObjectAndLoadpath in interface Contextpublic FunctionDefinition getFunction(java.lang.String name)
getFunction in interface Contextname - name of the function to retrieve
public void setFunction(java.lang.String name,
Operation function,
Template template,
SourceRange sourceRange)
throws EvaluationException
setFunction in interface Contextname - name for the functionfunction - code for the function as a DML blocktemplate - template in which this function is defined (used for error
handling)sourceRange - location in the template where this function is defined (used
for error handling)
EvaluationException - if a function with the given name already existspublic java.util.Map<Path,java.util.List<FullType>> getBindings()
getBindings in interface Context
public void setBinding(Path path,
FullType fullType,
Template template,
SourceRange sourceRange)
setBinding in interface Contextpath - absolute path to bind to the typefullType - data type to usetemplate - template where the binding was defined (used for error
handling)sourceRange - location in the template where the binding was defined (used
for error handling)public FullType getFullType(java.lang.String name)
getFullType in interface Contextname - name of the type to retrieve
public void setFullType(java.lang.String name,
FullType fullType,
Template template,
SourceRange sourceRange)
throws EvaluationException
setFullType in interface Contextname - name to associate to the typefullType - data type to use for the definitiontemplate - template where the type is defined (used for error handling)sourceRange - location in the template where the type is defined (used for
error handling)
EvaluationException - if there is already a type associated with the given name
public void setGlobalVariable(java.lang.String name,
Element value)
setGlobalVariable in interface Context
public void setGlobalVariable(java.lang.String name,
GlobalVariable variable)
setGlobalVariable in interface Contextname - global variable namevariable - GlobalVariable to associate with name
public GlobalVariable replaceGlobalVariable(java.lang.String name,
Element value,
boolean finalFlag)
replaceGlobalVariable in interface Context
public void setGlobalVariable(java.lang.String name,
Element value,
boolean finalFlag)
setGlobalVariable in interface Context
public void setIterator(Resource resource,
Resource.Iterator iterator)
setIterator in interface Contextpublic Resource.Iterator getIterator(Resource resource)
getIterator in interface Contextpublic void removeGlobalVariable(java.lang.String name)
removeGlobalVariable in interface Contextpublic Element getGlobalVariable(java.lang.String name)
getGlobalVariable in interface Contextpublic GlobalVariable retrieveGlobalVariable(java.lang.String name)
retrieveGlobalVariable in interface Context
public void pushTemplate(Template template,
SourceRange sourceRange,
java.util.logging.Level logLevel,
java.lang.String logMessage)
pushTemplate in interface Context
public void popTemplate(java.util.logging.Level logLevel,
java.lang.String logMessage)
popTemplate in interface Contextpublic void printTraceback(SourceRange sourceRange)
printTraceback in interface Contextpublic java.lang.String getTraceback(SourceRange sourceRange)
getTraceback in interface Contextpublic void setCurrentTemplate(Template template)
setCurrentTemplate in interface Contextpublic Template getCurrentTemplate()
getCurrentTemplate in interface Context
public Element getElement(Path path)
throws EvaluationException,
ValidationException
getElement in interface Contextpath - absolute or external path to lookup
EvaluationException - if the path cannot be found or the path is relative
ValidationException
public Element getElement(Path path,
boolean errorIfNotFound)
throws EvaluationException
getElement in interface Contextpath - path to lookuperrorIfNotFound - if true an EvaluationException will be thrown if the path
can't be found
EvaluationException - if the path can't be found and errorIfNotFound is set, or if
the path is relative and relativeRoot isn't set
public void putElement(Path path,
Element value)
putElement in interface Contextpublic Element executeDmlBlock(Operation dml)
executeDmlBlock in interface Context
public boolean executeDmlValidationBlock(Operation dml,
Element self)
throws ValidationException
executeDmlValidationBlock in interface ContextValidationExceptionpublic Element getLocalVariable(java.lang.String name)
getLocalVariable in interface Contextname - name of the variable to lookup
public Element getVariable(java.lang.String name)
getVariable in interface Contextname - name of the variable to lookup
public Element dereferenceVariable(java.lang.String name,
boolean lookupOnly,
Term[] terms)
throws InvalidTermException
dereferenceVariable in interface Contextname - name of the variable to lookuplookupOnly - flag indicating if only a lookup should be doneterms - values for dereferencing the given variable
InvalidTermException
public void setLocalVariable(java.lang.String name,
Element value)
throws EvaluationException
setLocalVariable in interface Contextname - name of the local variablevalue - value to use or null to remove the variable
EvaluationException - if there is a global variable with the same name as the local
variable
public void setLocalVariable(java.lang.String name,
Term[] terms,
Element value)
throws EvaluationException
setLocalVariable in interface Contextname - name of the local variableterms - terms used to dereference the variable, or null if the
variable is to be used directlyvalue - value to use or null to remove the variable
EvaluationException - if there is a global variable with the same name as the local
variablepublic int getCallLimit()
getCallLimit in interface Contextpublic int getIterationLimit()
getIterationLimit in interface Contextpublic boolean isFinal(Path p)
isFinal in interface Contextpublic java.lang.String getFinalReason(Path p)
getFinalReason in interface Contextpublic void setFinal(Path p)
setFinal in interface Contextpublic boolean isCompileTimeContext()
isCompileTimeContext in interface Contextpublic void initializeSelfHolder(SelfHolder selfHolder)
initializeSelfHolder in interface Contextpublic boolean isSelfFinal()
isSelfFinal in interface Contextpublic Element getSelf()
getSelf in interface Contextpublic void clearSelf()
clearSelf in interface Contextpublic SelfHolder saveSelf()
saveSelf in interface Contextpublic void restoreSelf(SelfHolder self)
restoreSelf in interface Contextpublic void resetSelf(Element newValue)
resetSelf in interface Contextpublic void setRelativeLoadpaths(java.util.List<java.lang.String> rpaths)
setRelativeLoadpaths in interface Contextpublic java.util.List<java.lang.String> getRelativeLoadpaths()
getRelativeLoadpaths in interface Contextpublic int getDeprecationLevel()
getDeprecationLevel in interface Contextpublic boolean getFailOnWarn()
getFailOnWarn in interface Context
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||