ponderToolkit.compiler.codeGen
Interface CodeAssemblerI

All Known Implementing Classes:
CodeAssembler

public interface CodeAssemblerI

Function: The Code Assembler Interface. The CodeGenerators get a reference to a CodeAssembler implementation of this Interface. The function of a CodeAssemblerPuts together the code build from the various existing code generators into a PolicyEntry object and communicates with the Coordinator (policy service) to store the entry in the directory service. The CodeAssembler acts as a coordinator for code generation and provides access to message reporting for code generators Code Generators can choose to bypass the default storing mechanism provided by the CodeAssembler


Method Summary
 void addCodeGenerator(CodeGeneratorI newCodeGenerator, int codeGenType)
          Add a new CodeGenerator
 void buildMessage(java.lang.String message)
          Ask to display a build-message
 void createCompPolInst(java.lang.String domain, java.lang.String name, int type, SubjectTargetI subjectDomain, java.lang.String sourceText)
          Create an Instance Entry in the Directory for a Composite Policy
 void createCompPolType(java.lang.String domain, java.lang.String name, int type, InstantiationsListI instList, TypesListI baseTypes, java.lang.String sourceText)
          Create a CompositePolicyType to the Entry of a composite policy
 void errorMessage(java.lang.String message)
          Ask to display an error-message
 void generateCode(PolicyListIteratorI codeIterator)
          It starts the code generation.
 ponderToolkit.compiler.syntax.node.Start getAST()
          Return a reference to the AST of the compiled code.
 java.util.Hashtable getCodeGenerators()
          Retutrns the code Generators that are going to be used to generate code.
 boolean getCodeStoreEnabled()
          Get the codeStore status of the compiler.
 java.lang.String getDestinationDirectory()
          Get the destination directory for the code generator.
 java.lang.String getFilename()
          Get the input file name
 boolean getOfflineCompile()
          Get the offline mode of the compiler.
 void infoMessage(java.lang.String message)
          Ask to display an info-message
 void instantiateCompPol(InstantiationObjectI instObj, SubjectTargetI subjectDomain, java.lang.String sourceText)
          Create an instance-entry for a composite policy, and copy the sub-entries of the type-entry (from which this is to be instatiated) to the instance-entry
 void setAlternateCode(java.lang.Object code, BasicPolicyICode policyObject, int type)
          Called by a CodeGenerator to set the generated code for the policyObject.
 void setAlternateCode(java.lang.Object code, InstantiationObjectI policyObject, int type)
          Called by a CodeGenerator to set the generated code for a policyObject instantiated from a Type.
 void setCodeGenerators(java.util.Hashtable newCodeGenerators)
          Set the code Generators that are going to be used to generate code.
 void setCodeText(java.lang.String text, int codeType)
          Displays the given code text in the default code-output stream
 void setJavaCode(byte[] classBytes, BasicPolicyICode policyObject)
          Called by a Java CodeGenerator to set the generated code for the policyObject.
 void setJavaCode(byte[] classBytes, java.lang.Object[] actualParams, InstantiationObjectI policyObject)
          Called by a Java CodeGenerator to set the generated code for the policyObject instantiated from a policy Type.
 void warningMessage(java.lang.String message)
          Ask to display a warning-message
 

Method Detail

addCodeGenerator

public void addCodeGenerator(CodeGeneratorI newCodeGenerator,
                             int codeGenType)
Add a new CodeGenerator

setCodeGenerators

public void setCodeGenerators(java.util.Hashtable newCodeGenerators)
Set the code Generators that are going to be used to generate code. This is a Hashtable of CodeGeneratorI's indexed by the integer code of the type of Code generated (constants specified in CodeGeneratorI)

getCodeGenerators

public java.util.Hashtable getCodeGenerators()
Retutrns the code Generators that are going to be used to generate code. This is a Hashtable of CodeGeneratorI's indexed by the integer code of the type of Code generated (constants specified in CodeGeneratorI)

getOfflineCompile

public boolean getOfflineCompile()
Get the offline mode of the compiler.

getCodeStoreEnabled

public boolean getCodeStoreEnabled()
Get the codeStore status of the compiler.

getAST

public ponderToolkit.compiler.syntax.node.Start getAST()
Return a reference to the AST of the compiled code.

getDestinationDirectory

public java.lang.String getDestinationDirectory()
Get the destination directory for the code generator.

getFilename

public java.lang.String getFilename()
Get the input file name

generateCode

public void generateCode(PolicyListIteratorI codeIterator)
It starts the code generation. Called by the main Compiler class

setJavaCode

public void setJavaCode(byte[] classBytes,
                        BasicPolicyICode policyObject)
Called by a Java CodeGenerator to set the generated code for the policyObject. This method is called if we wish to use the default mechanism for storing the generated code as a PolicyEntry in the underlying Directory Service.

setJavaCode

public void setJavaCode(byte[] classBytes,
                        java.lang.Object[] actualParams,
                        InstantiationObjectI policyObject)
Called by a Java CodeGenerator to set the generated code for the policyObject instantiated from a policy Type. This method is called if we wish to use the default mechanism for storing the generated code as a PolicyEntry in the underlying Directory Service.

setAlternateCode

public void setAlternateCode(java.lang.Object code,
                             BasicPolicyICode policyObject,
                             int type)
Called by a CodeGenerator to set the generated code for the policyObject. The type of the code generated (from the Compiler class) must also be indicated. This method is called if we wish to use the default mechanism for storing the generated code as an attribute of the appropriate PolicyEntry in the underlying Directory Service.

setAlternateCode

public void setAlternateCode(java.lang.Object code,
                             InstantiationObjectI policyObject,
                             int type)
Called by a CodeGenerator to set the generated code for a policyObject instantiated from a Type. The type of the code generated (from CodeGeneratorI) must also be indicated. This method is called if we wish to use the default mechanism for storing the generated code as an attribute of the appropriate PolicyEntry in the underlying Directory Service.

setCodeText

public void setCodeText(java.lang.String text,
                        int codeType)
Displays the given code text in the default code-output stream

createCompPolInst

public void createCompPolInst(java.lang.String domain,
                              java.lang.String name,
                              int type,
                              SubjectTargetI subjectDomain,
                              java.lang.String sourceText)
                       throws java.lang.Exception
Create an Instance Entry in the Directory for a Composite Policy
Parameters:
domain - The domain in which to create the entry
name - The name of the entry to create
type - The type of the entry to create (from ponderCompiler.codeGen.interfaces.CompositePolicyI)
subjectDomain - The Subject Domain if it is role. If not, this is null
sourceText - The source text of the composite policy

createCompPolType

public void createCompPolType(java.lang.String domain,
                              java.lang.String name,
                              int type,
                              InstantiationsListI instList,
                              TypesListI baseTypes,
                              java.lang.String sourceText)
                       throws java.lang.Exception
Create a CompositePolicyType to the Entry of a composite policy
Parameters:
domain - The domain in which to create the entry
name - The name of the entry to create
type - The type of the entry to create (from ponderCompiler.codeGen.interfaces.CompositePolicyI)
instList - The list of InstantiationObject s
baseTypes - The list of baseType names
sourceText - The source text of the composite policy

instantiateCompPol

public void instantiateCompPol(InstantiationObjectI instObj,
                               SubjectTargetI subjectDomain,
                               java.lang.String sourceText)
                        throws java.lang.Exception
Create an instance-entry for a composite policy, and copy the sub-entries of the type-entry (from which this is to be instatiated) to the instance-entry
Parameters:
instObj - The Instantiation object
subjectDomain - The Subject Domain if it is role. If not, this is null
sourceText - The source text of the composite policy

infoMessage

public void infoMessage(java.lang.String message)
Ask to display an info-message

warningMessage

public void warningMessage(java.lang.String message)
Ask to display a warning-message

errorMessage

public void errorMessage(java.lang.String message)
Ask to display an error-message

buildMessage

public void buildMessage(java.lang.String message)
Ask to display a build-message