|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gov.llnl.babel.backend.FileManager
FileManager
is a singleton class that manages the files
generated by the backend code generators. This class tracks what files
were generated and their "file group" for use in makefile generation.
Constructor Summary | |
protected |
FileManager()
Create a new instance of the backend file manager object. |
Method Summary | |
void |
addListener(FileListener listener)
Add a listener to the file manager. |
java.io.PrintWriter |
createFile(Symbol symbol,
java.lang.String groupname,
java.lang.String filename)
Create a file given a symbol, file group, and file name. |
java.io.FileWriter |
createFileWriter(Symbol symbol,
java.lang.String groupname,
java.lang.String filename)
Create a file given a symbol, file group, and file name. |
java.io.File |
expandDirectory(Symbol symbol)
Generate the relative file name from the symbol. |
java.io.File |
expandVPathDirectory(Symbol symbol)
Generate the VPATH for the symbol. |
CodeSplicer |
getCodeSplicer(Symbol symbol,
java.lang.String file)
Read the specified file and return a code splicer object representing code splices from the file that should be preserved in the next file. |
static FileManager |
getInstance()
Return the singleton instance of the file manager. |
boolean |
getJavaStylePackageGeneration()
Get the current style of file generation, either all in one directory or Java-style package directories. |
void |
removeListener(FileListener listener)
Remove a listener from this file manager. |
void |
setFileGenerationRootDirectory(java.lang.String directory)
Change the root directory where files will be generated to something other than the current working directory |
static void |
setInstance(FileManager instance)
Set the singleton instance of the configuration. |
void |
setJavaStylePackageGeneration(boolean java_style)
Set the style of file generation, either all in one directory or Java-style package directories. |
void |
setVPathDirectory(java.lang.String directory)
Set the VPATH directory where files can be found (notably IMPLS for CodeSplicers). |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected FileManager()
getInstance
method to retrieve
a copy of the file manager.
Method Detail |
public static FileManager getInstance()
public void addListener(FileListener listener)
listener
- a new listener to be added.public void removeListener(FileListener listener)
listener
- the listener to remove.public static void setInstance(FileManager instance)
getInstance
will automatically create the configuration
for you.
public boolean getJavaStylePackageGeneration()
public void setJavaStylePackageGeneration(boolean java_style)
public void setVPathDirectory(java.lang.String directory) throws CodeGenerationException
directory
- String name of directory ( relative or absolute).
If it's null, "", or "." then VPATH is disabled.
CodeGenerationException
public void setFileGenerationRootDirectory(java.lang.String directory) throws CodeGenerationException
directory
- String name of directory (relative or absolute)
if it's null, empty, or "." then current directory
is assumed.
CodeGenerationException
public java.io.PrintWriter createFile(Symbol symbol, java.lang.String groupname, java.lang.String filename) throws CodeGenerationException
FileWriter
that will typically be used to
create a PrintWriter
stream that must be closed by the
caller when the file handle is no longer needed. The symbol is used
to expand the file path; it may be null if no expansion is desired.
CodeGenerationException
public java.io.FileWriter createFileWriter(Symbol symbol, java.lang.String groupname, java.lang.String filename) throws CodeGenerationException
FileWriter
that will typically be used to
create a PrintWriter
stream that must be closed by the
caller when the file handle is no longer needed. The symbol is used
to expand the file path; it may be null if no expansion is desired.
CodeGenerationException
public CodeSplicer getCodeSplicer(Symbol symbol, java.lang.String file) throws java.io.IOException
java.io.IOException
public java.io.File expandDirectory(Symbol symbol)
symbol
- The symbol to generate files for
java.io.File
representation for
the directory to generate the code. Can be null
if
setJavaStylePackageGeneration(false)
, andsetFileGenerationRootDirectory(null)
, andsetJavaStylePackageGeneration(boolean)
,
setFileGenerationRootDirectory(java.lang.String)
public java.io.File expandVPathDirectory(Symbol symbol)
symbol
- The symbol to generate files for
java.io.File
representation for
the directory to generate the code. Can be null
if
setVPathDirectory(null)
, or
setJavaStylePackageGeneration(boolean)
,
setFileGenerationRootDirectory(java.lang.String)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |