org.objectweb.jorm.comp.compiler.lib
Class BasicCompilerParameter

java.lang.Object
  |
  +--org.objectweb.jorm.comp.compiler.lib.BasicCompilerParameter
All Implemented Interfaces:
CompilerParameter, Loggable

public class BasicCompilerParameter
extends java.lang.Object
implements CompilerParameter, Loggable

A BasicCompilerParameter object is an object which manages informations read by the command line parser. These informations are needed to the compiler system to parse, generate, and compile.

Author:
X. Spengler

Fields inherited from interface org.objectweb.jorm.comp.compiler.api.CompilerParameter
INHERITANCECNPATTERN
 
Constructor Summary
BasicCompilerParameter()
          Default constructor
BasicCompilerParameter(BasicClassLoader classLoader)
          Deprecated. BasicClassloader is not a class loader! Use default constructor (Christophe Ney)
 
Method Summary
 void addCPExtension(java.lang.String name, java.lang.Object ext)
          Allows to add into the hashtable object, the CommandLineParser extension objects which is identified by the @parameter name.
 boolean addInputFileName(java.lang.String fileName)
          Adds a file name to the list of the input file names.
 void clearInputFileNames()
           
 java.lang.String computePBindingInheritance(java.lang.String cn)
          Computes the actual class name which the generated PBinding class must extend.
 java.lang.String computePClassMappingInheritance(java.lang.String cn)
          Computes the actual class name which the generated PClassMapping class must extend.
 boolean existInputFileNames()
          Allows to know if the input file names list is empty or not.
 boolean existTargetPath()
          Allows to know if a target path name is defined to generate source files.
 org.objectweb.util.io.api.PathExplorer getClasspath()
          Returns the classpath used to search files or to compile.
 java.util.Hashtable getCPExtension()
          Allows to get the hashtable object which contains the CommandLineParser extension objects.
 java.lang.Object getCPExtension(java.lang.String name)
          Returns an object, in most cases, it should be a com.mypackage.myobjects.CmdLineParser object.
 java.util.ArrayList getDtdLocations()
          Returns the list of DTD locations that are specified.
 java.util.Collection getInputFileNames()
          Allows to get a list of input file names (.pd files)
 java.lang.String getJavaCompiler()
          Returns the java compiler sets by the programmer on the command line.
 org.objectweb.util.monolog.api.Logger getLogger()
          Returns a logger to an component that wants to log things.
 org.objectweb.util.monolog.api.LoggerFactory getLoggerFactory()
          Returns a logger factory that allows the creation of new loggers.
 java.lang.String getMapperName()
          Returns the class of the mapper specified by the user.
 java.lang.String getMappingFactory()
          Returns the name of the mapping factory used by the meta information to build mapping information.
 java.lang.String getMappingName()
          Returns the class of the mapping specified by the user.
 Manager getMetaInfoManager()
           
 java.lang.String getMetaInfoName()
          Returns the class name of the meta information system.
 java.lang.String getOutputDirectory()
          Returns the directory where files must be generated.
 java.lang.String getParserName()
          Returns the class of the xml parser specified by the user.
 java.lang.String getPBindingInheritance()
          Returns the class name which the generated PBinding classes must be extended.
 java.lang.String getPClassMappingInheritance()
          Returns the class name which the generated PClassMapping classes must be extended.
 java.lang.String getVerifierName()
          Returns the name of the class which makes the verification of the specific part of the meta-information.
 boolean isBindingAbstract()
          Allows to know if the Binding object is abstract or not.
 boolean isDtdVerify()
          Allows to know if the dtd is used or not to validate the xml files.
 boolean isGenDep()
          Allows to know if the dependances must be generated or not.
 boolean isKeepSrc()
          Allows to know if the programmer wants to keep the sources files or not.
 boolean isNoBuild()
          Returns true if the user doesn't want to generate files.
 boolean isNoCompile()
          Returns true if the user doesn't want that the genrated files must be compiled.
 boolean isVerbose()
          Allows to know if the user want to know verbose informations.
 boolean isVerifyContext()
          Verifies environment context before the parsing must be launched.
 boolean isVerifyMetaInfo()
          Returns if the user wants or not the verification of the meta information.
 void loadConfFile(java.lang.String file)
          Load a jorm configuration file.
 java.util.Collection parsePath(java.lang.String path)
          Parses a path, and returns a vector of entries.
 void print()
          Prints informations managed by the current object.
 void setBindingAbstract(boolean bindingAbstract)
          Defines if the Binding object is defined abstract or not.
 void setClasspath(org.objectweb.util.io.api.PathExplorer path)
          Defines the classpath for the current jorm compilation.
 void setDtdLocations(java.util.ArrayList al)
          Assigns the list of DTD locations that are specified.
 void setDtdVerify(boolean verif)
          Allows to set if the dtd must be used or not to validate the xml files.
 void setGenDep(boolean gendep)
          Enables or disables the generation of the dependances.
 void setJavaCompiler(java.lang.String jc)
          Sets the java compiler used to compile files when the generation process will be finished.
 void setKeepSrc(boolean keepSrc)
          Sets the keep source flag.
 void setLogConfFile(java.lang.String filename)
          It initializes the logging system with the specified logging configuration file.
 void setLogger(org.objectweb.util.monolog.api.Logger logger)
          Defines a logger object.
 void setLoggerFactory(org.objectweb.util.monolog.api.LoggerFactory lf)
          Defines the logger factory to obtain new logger.
 void setMapperName(java.lang.String mapperName)
          Defines the name of the mapper used for the meta information.
 void setMappingFactory(java.lang.String mappingFactory)
          Defines the name of the mapping factory used by the meta information to build mapping information.
 void setMappingName(java.lang.String mappingName)
          Defines the name of the mapping.
 void setMetaInfoManager(Manager mngr)
          Sets the class name of the meta information system.
 void setMetaInfoName(java.lang.String metainfo)
          Sets the class name of the meta information system.
 void setNoBuild(boolean noBuild)
          Sets if the user does not want to generate files.
 void setNoCompile(boolean noCompile)
          Dets if the user does not want to compile generated files.
 void setOutputDirectory(java.lang.String outputdir)
          Defines the directory where files are generated.
 void setParserName(java.lang.String parser)
          Defines the name of the parser class which is able to parse the meta information related to a given mapping.
 void setPBindingInheritance(java.lang.String binding)
          Defines the class name which the generated PBinding classes must be extended.
 void setPClassMappingInheritance(java.lang.String classmapping)
          Sets the name of the generated PBinder class name.
 void setVerbose(boolean mode)
          Sets the verbose mode.
 void setVerifierName(java.lang.String verifier)
          Sets the name of the class which makes the verification of the specific part of the meta-information.
 void setVerifyContext(boolean verifyContext)
          Defines if the environment context must be verified before the parsing must be launched.
 void setVerifyMetaInfo(boolean verify)
          Sets if the user wants or not the verification of the meta information.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicCompilerParameter

public BasicCompilerParameter(BasicClassLoader classLoader)
Deprecated. BasicClassloader is not a class loader! Use default constructor (Christophe Ney)

builds a new instance of a BasicCompilerParameter object. All attributes are initialized here.
Parameters:
classLader - the classloader to use to load dynamicaly classes

BasicCompilerParameter

public BasicCompilerParameter()
Default constructor
Method Detail

getDtdLocations

public java.util.ArrayList getDtdLocations()
Returns the list of DTD locations that are specified.
Specified by:
getDtdLocations in interface CompilerParameter

setKeepSrc

public void setKeepSrc(boolean keepSrc)
Sets the keep source flag.
Specified by:
setKeepSrc in interface CompilerParameter
Parameters:
keepSrc - true, the sources will not be destroyed, else false, the sources will be removed

setLogConfFile

public void setLogConfFile(java.lang.String filename)
                    throws PException
Description copied from interface: CompilerParameter
It initializes the logging system with the specified logging configuration file.
Specified by:
setLogConfFile in interface CompilerParameter
Following copied from interface: org.objectweb.jorm.comp.compiler.api.CompilerParameter
Parameters:
filename - is the file name of the configuration file.

isKeepSrc

public boolean isKeepSrc()
Allows to know if the programmer wants to keep the sources files or not.
Specified by:
isKeepSrc in interface CompilerParameter
Returns:
true, the source files are not removed, else false, the source files are removed

setJavaCompiler

public void setJavaCompiler(java.lang.String jc)
Sets the java compiler used to compile files when the generation process will be finished.
Specified by:
setJavaCompiler in interface CompilerParameter
Parameters:
jc - the Java compiler

getJavaCompiler

public java.lang.String getJavaCompiler()
Returns the java compiler sets by the programmer on the command line.
Specified by:
getJavaCompiler in interface CompilerParameter
Returns:
the string representation of the java compiler name

setVerbose

public void setVerbose(boolean mode)
Sets the verbose mode.
Specified by:
setVerbose in interface CompilerParameter
Parameters:
mode - true, verbose informations will be furnished, else false, no informations are sent to the programmer

isVerbose

public boolean isVerbose()
Allows to know if the user want to know verbose informations.
Specified by:
isVerbose in interface CompilerParameter
Returns:
true, the verbose informations will be furnished, else false, no informations are sent to the programmer

addInputFileName

public boolean addInputFileName(java.lang.String fileName)
Adds a file name to the list of the input file names.
Specified by:
addInputFileName in interface CompilerParameter
Parameters:
fileName - the name of the file to add to the list
Returns:
true, if the file is added to the list (was not yet present), else false, if the file is already in the list (and has not been added)

clearInputFileNames

public void clearInputFileNames()
Specified by:
clearInputFileNames in interface CompilerParameter

getInputFileNames

public java.util.Collection getInputFileNames()
Allows to get a list of input file names (.pd files)
Specified by:
getInputFileNames in interface CompilerParameter
Returns:
a vector representation of the input file names

existInputFileNames

public boolean existInputFileNames()
Allows to know if the input file names list is empty or not.
Returns:
true, if the input file names list is not empty, else false, if the input file names list is empty

existTargetPath

public boolean existTargetPath()
Allows to know if a target path name is defined to generate source files.
Returns:
true, if a target path name is defined, else false, if a target path name is yet defined

parsePath

public java.util.Collection parsePath(java.lang.String path)
Parses a path, and returns a vector of entries. Entries are files, directories, etc...
Parameters:
path - the path to parse
Returns:
a vector of entry

print

public void print()
Prints informations managed by the current object.
Specified by:
print in interface CompilerParameter

getOutputDirectory

public java.lang.String getOutputDirectory()
Returns the directory where files must be generated.
Specified by:
getOutputDirectory in interface CompilerParameter
Returns:
null if the directory is not specified or a path with system separator

setOutputDirectory

public void setOutputDirectory(java.lang.String outputdir)
Defines the directory where files are generated.
Specified by:
setOutputDirectory in interface CompilerParameter
Parameters:
outputdir - the string representation of the directory

getPClassMappingInheritance

public java.lang.String getPClassMappingInheritance()
Returns the class name which the generated PClassMapping classes must be extended.
Specified by:
getPClassMappingInheritance in interface CompilerParameter
Returns:
null if the generated PClassMapping classes do not inherit of any class or the full class name (with package name) using dot as package separator

computePClassMappingInheritance

public java.lang.String computePClassMappingInheritance(java.lang.String cn)
Computes the actual class name which the generated PClassMapping class must extend.
Specified by:
computePClassMappingInheritance in interface CompilerParameter
Parameters:
cn - The class name of the persistent class for which the code is generated.
Returns:
The computed class name.

setPClassMappingInheritance

public void setPClassMappingInheritance(java.lang.String classmapping)
Description copied from interface: CompilerParameter
Sets the name of the generated PBinder class name.
Specified by:
setPClassMappingInheritance in interface CompilerParameter
Following copied from interface: org.objectweb.jorm.comp.compiler.api.CompilerParameter
Parameters:
v - the class name which must be extended by the generated PBinder. If the parameter is null, then the generated PBinder does not inherit any class.

getPBindingInheritance

public java.lang.String getPBindingInheritance()
Returns the class name which the generated PBinding classes must be extended.
Specified by:
getPBindingInheritance in interface CompilerParameter
Returns:
null if the generated PBinding classes do not inherit of any class or the full class name (with package name) using dot as package separator

computePBindingInheritance

public java.lang.String computePBindingInheritance(java.lang.String cn)
Computes the actual class name which the generated PBinding class must extend.
Specified by:
computePBindingInheritance in interface CompilerParameter
Parameters:
cn - The class name of the persistent class for which the code is generated.
Returns:
The computed class name.

setPBindingInheritance

public void setPBindingInheritance(java.lang.String binding)
Defines the class name which the generated PBinding classes must be extended.
Specified by:
setPBindingInheritance in interface CompilerParameter
Parameters:
binding - the string representation of the super class

isNoCompile

public boolean isNoCompile()
Returns true if the user doesn't want that the genrated files must be compiled.
Specified by:
isNoCompile in interface CompilerParameter
Following copied from interface: org.objectweb.jorm.comp.compiler.api.CompilerParameter
Returns:
true, if the user does not want that the generated files must be compiled, else false

getParserName

public java.lang.String getParserName()
Returns the class of the xml parser specified by the user.
Specified by:
getParserName in interface CompilerParameter
Returns:
the string representation of the parser class name

setParserName

public void setParserName(java.lang.String parser)
Defines the name of the parser class which is able to parse the meta information related to a given mapping.
Specified by:
setParserName in interface CompilerParameter
Parameters:
parser - the name of the parser class name

getMapperName

public java.lang.String getMapperName()
Returns the class of the mapper specified by the user.
Specified by:
getMapperName in interface CompilerParameter
Returns:
the name of the mapper

setMapperName

public void setMapperName(java.lang.String mapperName)
Defines the name of the mapper used for the meta information.
Specified by:
setMapperName in interface CompilerParameter
Parameters:
map - the name of the mapper

setMappingName

public void setMappingName(java.lang.String mappingName)
Defines the name of the mapping.
Specified by:
setMappingName in interface CompilerParameter
Parameters:
mappingName - the name of the mapping

getMappingName

public java.lang.String getMappingName()
Returns the class of the mapping specified by the user.
Specified by:
getMappingName in interface CompilerParameter
Returns:
the name of the mapping

setClasspath

public void setClasspath(org.objectweb.util.io.api.PathExplorer path)
Defines the classpath for the current jorm compilation.
Specified by:
setClasspath in interface CompilerParameter
Parameters:
classpath - the string representation of the classpath

setMappingFactory

public void setMappingFactory(java.lang.String mappingFactory)
Defines the name of the mapping factory used by the meta information to build mapping information.
Specified by:
setMappingFactory in interface CompilerParameter
Parameters:
mappingFactory - the class name of the mapping factory

getMappingFactory

public java.lang.String getMappingFactory()
Returns the name of the mapping factory used by the meta information to build mapping information.
Specified by:
getMappingFactory in interface CompilerParameter
Returns:
the name of the mapping factory class

getClasspath

public org.objectweb.util.io.api.PathExplorer getClasspath()
Returns the classpath used to search files or to compile.
Specified by:
getClasspath in interface CompilerParameter
Returns:
the string representation of the classpath

setNoCompile

public void setNoCompile(boolean noCompile)
Dets if the user does not want to compile generated files.
Specified by:
setNoCompile in interface CompilerParameter
Parameters:
noCompile - true, no files are compiled, else false

setNoBuild

public void setNoBuild(boolean noBuild)
Sets if the user does not want to generate files.
Specified by:
setNoBuild in interface CompilerParameter
Parameters:
noBuild - true, no files are generated, else false

isNoBuild

public boolean isNoBuild()
Returns true if the user doesn't want to generate files.
Specified by:
isNoBuild in interface CompilerParameter
Returns:
true, if the user does not want to generate files

setVerifyMetaInfo

public void setVerifyMetaInfo(boolean verify)
Sets if the user wants or not the verification of the meta information.
Specified by:
setVerifyMetaInfo in interface CompilerParameter
Parameters:
verify - if true, the global check is made, else false

isVerifyMetaInfo

public boolean isVerifyMetaInfo()
Returns if the user wants or not the verification of the meta information.
Specified by:
isVerifyMetaInfo in interface CompilerParameter
Returns:
true, the user want the verification of the meta information, else false

setVerifierName

public void setVerifierName(java.lang.String verifier)
Sets the name of the class which makes the verification of the specific part of the meta-information.
Specified by:
setVerifierName in interface CompilerParameter
Parameters:
verifier - the name of the class verifier

getVerifierName

public java.lang.String getVerifierName()
Returns the name of the class which makes the verification of the specific part of the meta-information.
Specified by:
getVerifierName in interface CompilerParameter
Returns:
the name of the class verifier

loadConfFile

public void loadConfFile(java.lang.String file)
                  throws PException
Load a jorm configuration file.
Specified by:
loadConfFile in interface CompilerParameter
Parameters:
file - the name of the jorm configuration file
Returns:
true, if everything is ok, else false

getCPExtension

public java.lang.Object getCPExtension(java.lang.String name)
Returns an object, in most cases, it should be a com.mypackage.myobjects.CmdLineParser object. This object is created by the CommandLineParser to parse specific option on the command line. The returned object is composed by a list of getter, to obtain object values.

example: if a -myoption is parsed by the a MyCmdLineParser object wich is an implementation of CmdLineParser. This object is returned by the getCPExtension method when it calls with "MyCmdLineParser" as argument.

Specified by:
getCPExtension in interface CompilerParameter
Parameters:
name - the name of the class with makes the extension of the command line

addCPExtension

public void addCPExtension(java.lang.String name,
                           java.lang.Object ext)
Allows to add into the hashtable object, the CommandLineParser extension objects which is identified by the @parameter name.
Specified by:
addCPExtension in interface CompilerParameter

getCPExtension

public java.util.Hashtable getCPExtension()
Allows to get the hashtable object which contains the CommandLineParser extension objects. The key of the hashtable is the name of the extension class, and the value, the Class itself.
Specified by:
getCPExtension in interface CompilerParameter
Parameters:
exts_ - the Hashtable object which contains the CommandLineParser extension.

setMetaInfoName

public void setMetaInfoName(java.lang.String metainfo)
Sets the class name of the meta information system. The Class must be an implementation of the Manager api.
Specified by:
setMetaInfoName in interface CompilerParameter
Parameters:
metainfo - the class name of the meta information manager implementation

getMetaInfoName

public java.lang.String getMetaInfoName()
Returns the class name of the meta information system. The Class is an implementation of the Manager api.
Specified by:
getMetaInfoName in interface CompilerParameter
Returns:
the String representation of the meta information manager implementation

setMetaInfoManager

public void setMetaInfoManager(Manager mngr)
Description copied from interface: CompilerParameter
Sets the class name of the meta information system. The Class must be an implementation of the Manager api.
Specified by:
setMetaInfoManager in interface CompilerParameter
Following copied from interface: org.objectweb.jorm.comp.compiler.api.CompilerParameter
Parameters:
metainfo - the class name of the meta information manager implementation

getMetaInfoManager

public Manager getMetaInfoManager()
Specified by:
getMetaInfoManager in interface CompilerParameter

setDtdVerify

public void setDtdVerify(boolean verif)
Allows to set if the dtd must be used or not to validate the xml files.
Specified by:
setDtdVerify in interface CompilerParameter
Parameters:
verif - if true, the dtd is used to verify the xml files, else false

isDtdVerify

public boolean isDtdVerify()
Allows to know if the dtd is used or not to validate the xml files.
Specified by:
isDtdVerify in interface CompilerParameter
Returns:
true, if the dtd must be used to validate xml files,

false, if the dtd is not used.


setGenDep

public void setGenDep(boolean gendep)
Enables or disables the generation of the dependances.
Specified by:
setGenDep in interface CompilerParameter
Parameters:
gendep - true, the dependances are generated, else false

isGenDep

public boolean isGenDep()
Allows to know if the dependances must be generated or not.
Specified by:
isGenDep in interface CompilerParameter
Returns:
true, if the dependances are generated, else false

setBindingAbstract

public void setBindingAbstract(boolean bindingAbstract)
Defines if the Binding object is defined abstract or not.
Specified by:
setBindingAbstract in interface CompilerParameter
Parameters:
bindingAbstract - true, the Binding object is abstract, else false

isBindingAbstract

public boolean isBindingAbstract()
Allows to know if the Binding object is abstract or not.
Specified by:
isBindingAbstract in interface CompilerParameter
Returns:
true, the Binding object is abstract, else false

isVerifyContext

public boolean isVerifyContext()
Verifies environment context before the parsing must be launched.
Specified by:
isVerifyContext in interface CompilerParameter
Returns:
true, if the context must be checked before using the parser, else false

setVerifyContext

public void setVerifyContext(boolean verifyContext)
Defines if the environment context must be verified before the parsing must be launched.
Specified by:
setVerifyContext in interface CompilerParameter
Parameters:
verifyContext - if true, the context will be checked before to use the parser, else false

setDtdLocations

public void setDtdLocations(java.util.ArrayList al)
Description copied from interface: CompilerParameter
Assigns the list of DTD locations that are specified.
Specified by:
setDtdLocations in interface CompilerParameter

setLogger

public void setLogger(org.objectweb.util.monolog.api.Logger logger)
Defines a logger object.
Specified by:
setLogger in interface Loggable
Parameters:
logger - the logger object

setLoggerFactory

public void setLoggerFactory(org.objectweb.util.monolog.api.LoggerFactory lf)
Defines the logger factory to obtain new logger.
Specified by:
setLoggerFactory in interface Loggable
Parameters:
loggerFactory - the LoggerFactory object to obtain a logger object

getLogger

public org.objectweb.util.monolog.api.Logger getLogger()
Description copied from interface: Loggable
Returns a logger to an component that wants to log things.
Specified by:
getLogger in interface Loggable
Following copied from interface: org.objectweb.jorm.util.api.Loggable
Parameters:
logger - the logger object

getLoggerFactory

public org.objectweb.util.monolog.api.LoggerFactory getLoggerFactory()
Description copied from interface: Loggable
Returns a logger factory that allows the creation of new loggers.
Specified by:
getLoggerFactory in interface Loggable
Following copied from interface: org.objectweb.jorm.util.api.Loggable
Parameters:
loggerfactory - the LoggerFactory object to obtain new loggers