org.objectweb.jorm.compiler.lib
Class JormCompiler

java.lang.Object
  extended byorg.objectweb.jorm.compiler.lib.JormCompiler

public class JormCompiler
extends java.lang.Object

Author:
Sebastien Chassande-Barrioz

Field Summary
protected  JormCompilerConfigurator compilerConfigurator
          The compiler configurator
protected  JormCompilerParameter compilerParameter
          The compiler parameters
protected  Generator generator
          generator is a simple JormGenerator object, which is able to generate java file.
protected  Logger logger
          The logger used by the compiler to log messages
protected  LoggerFactory loggerFactory
          The logger factory used by the compiler to log messages
protected  Manager manager
          The manager is in charge of the meta information management.
protected  Parser parser
          The parser object is able to parse XML files and build an internal representation of its content.
protected  Verifier verifier
          The verifier is in charge to check the semantical validity of the meta information.
protected  Writer writer
          domWriter is a DomWriter object that generates .pd files from org.w3c.dom.Document objects representing Class and CompositeName objects.
 
Constructor Summary
JormCompiler()
          It builds a JormCompiler with the default JormCompilerParameter and JormCompilerParameter.
JormCompiler(JormCompilerParameter cp, JormCompilerConfigurator cc)
          It builds a JormCompiler with the specified JormCompilerParameter instance.
 
Method Summary
 void compileFiles(java.util.Collection javafiles)
          Compiles with javac the java files generated by the generator system.
 java.util.Collection generateFiles(java.util.Collection c)
          Generates java files for all meta object specified in the Collection parameter.
 java.util.Collection generateJormFiles(java.util.Collection c)
          Generates .files for all meta object specified in the Collection parameter.
 JormCompilerConfigurator getCompilerConfigurator()
          It retrieves the CompilerParameter associated to the compiler
 JormCompilerParameter getCompilerParameter()
          It retrieves the CompilerParameter associated to the compiler
 Manager getMIManager()
          Retrieves the MIanager instance.
 java.util.Collection parseFiles(java.util.Collection fns)
          Parses the input files and build the meta information.
 void process()
          Creates class instances for the XML parser, the Meta Information Manager and manages the JormGenerator system.
 void setMIManager(Manager manager)
          Assignes the Meta info manager
 void setupGenerator()
           
 void setupLogger()
          It assigns a LoggerFactory and a Logger if it is not already done.
 void setupMIManager()
           
 void setupParser()
           
 void setupVerifier()
           
 void setupWriter()
           
 void verifyMetaInfo(java.util.Collection mos)
          Verifies if the metainformation is in a clean state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected Logger logger
The logger used by the compiler to log messages


loggerFactory

protected LoggerFactory loggerFactory
The logger factory used by the compiler to log messages


manager

protected Manager manager
The manager is in charge of the meta information management.


parser

protected Parser parser
The parser object is able to parse XML files and build an internal representation of its content.


verifier

protected Verifier verifier
The verifier is in charge to check the semantical validity of the meta information.


generator

protected Generator generator
generator is a simple JormGenerator object, which is able to generate java file.


writer

protected Writer writer
domWriter is a DomWriter object that generates .pd files from org.w3c.dom.Document objects representing Class and CompositeName objects.


compilerParameter

protected JormCompilerParameter compilerParameter
The compiler parameters


compilerConfigurator

protected JormCompilerConfigurator compilerConfigurator
The compiler configurator

Constructor Detail

JormCompiler

public JormCompiler()
It builds a JormCompiler with the default JormCompilerParameter and JormCompilerParameter.


JormCompiler

public JormCompiler(JormCompilerParameter cp,
                    JormCompilerConfigurator cc)
It builds a JormCompiler with the specified JormCompilerParameter instance.

Method Detail

getCompilerParameter

public JormCompilerParameter getCompilerParameter()
It retrieves the CompilerParameter associated to the compiler

Returns:
the compiler parameter

getCompilerConfigurator

public JormCompilerConfigurator getCompilerConfigurator()
It retrieves the CompilerParameter associated to the compiler

Returns:
the compiler parameter

setupLogger

public void setupLogger()
                 throws PException
It assigns a LoggerFactory and a Logger if it is not already done.

Throws:
PException

setupMIManager

public void setupMIManager()
                    throws PException
Throws:
PException

setupParser

public void setupParser()
                 throws PException
Throws:
PException

setupVerifier

public void setupVerifier()
                   throws PException
Throws:
PException

setupGenerator

public void setupGenerator()
                    throws PException
Throws:
PException

process

public void process()
             throws PException
Creates class instances for the XML parser, the Meta Information Manager and manages the JormGenerator system.

Throws:
PException

parseFiles

public java.util.Collection parseFiles(java.util.Collection fns)
                                throws PException
Parses the input files and build the meta information.

Throws:
PException

verifyMetaInfo

public void verifyMetaInfo(java.util.Collection mos)
                    throws PException
Verifies if the metainformation is in a clean state.

Throws:
PException

generateFiles

public java.util.Collection generateFiles(java.util.Collection c)
                                   throws PException
Generates java files for all meta object specified in the Collection parameter. If the parameter is null, all classes described in the meta information manager are generated.

Parameters:
c - is the collection of meta objects
Returns:
a Collection of String. The elements are the file names of the generated files
Throws:
PException

compileFiles

public void compileFiles(java.util.Collection javafiles)
                  throws PException
Compiles with javac the java files generated by the generator system.

Parameters:
javafiles - All java files to be compiled with javac.
Throws:
PException

getMIManager

public Manager getMIManager()
Retrieves the MIanager instance. It can be null.


setMIManager

public void setMIManager(Manager manager)
Assignes the Meta info manager


setupWriter

public void setupWriter()
                 throws PException
Throws:
PException

generateJormFiles

public java.util.Collection generateJormFiles(java.util.Collection c)
                                       throws PException
Generates .files for all meta object specified in the Collection parameter. If the parameter is null, all classes described in the meta information manager are generated.

Parameters:
c - is the collection of meta objects
Returns:
a Collection of String. The elements are the file names of the generated files
Throws:
PException