org.apache.cocoon.components.language.programming
Class CompiledProgrammingLanguage
java.lang.Object
|
+--org.apache.avalon.framework.logger.AbstractLoggable
|
+--org.apache.cocoon.components.language.programming.AbstractProgrammingLanguage
|
+--org.apache.cocoon.components.language.programming.CompiledProgrammingLanguage
- All Implemented Interfaces:
- org.apache.avalon.framework.component.Component, org.apache.avalon.framework.context.Contextualizable, org.apache.avalon.framework.logger.Loggable, org.apache.avalon.framework.parameters.Parameterizable, ProgrammingLanguage
- Direct Known Subclasses:
- JavaLanguage
- public abstract class CompiledProgrammingLanguage
- extends AbstractProgrammingLanguage
- implements org.apache.avalon.framework.context.Contextualizable
A compiled programming language. This class extends AbstractProgrammingLanguage
adding support for compilation
and object program files
- Version:
- CVS $Id: CompiledProgrammingLanguage.java,v 1.10 2002/03/29 20:32:01 vgritsenko Exp $
- Author:
- Ricardo Rocha
Field Summary |
protected java.lang.String |
classpath
The local classpath |
protected java.lang.Class |
compilerClass
The compiler |
protected boolean |
deleteSources
The source deletion option |
Method Summary |
protected abstract void |
compile(java.lang.String filename,
java.io.File baseDirectory,
java.lang.String encoding)
Compile a source file yielding a loadable object file. |
void |
contextualize(org.apache.avalon.framework.context.Context context)
Set the context |
abstract void |
doUnload(java.lang.Object program)
Unload a previously loaded program |
protected void |
doUnload(java.lang.Object program,
java.lang.String filename,
java.io.File baseDirectory)
Unload a previously loaded program given its original filesystem location |
abstract java.lang.String |
getObjectExtension()
Return the language's canonical object file extension. |
Program |
load(java.lang.String filename,
java.io.File baseDirectory,
java.lang.String encoding)
Load an object program from a file.
|
protected abstract java.lang.Class |
loadProgram(java.lang.String filename,
java.io.File baseDirectory)
Actually load an object program from a file. |
void |
parameterize(org.apache.avalon.framework.parameters.Parameters params)
Set the configuration parameters. |
Program |
preload(java.lang.String filename,
java.io.File baseDirectory,
java.lang.String encoding)
Preload an object program from a file.
|
Methods inherited from class org.apache.avalon.framework.logger.AbstractLoggable |
getLogger, setLogger, setupLogger, setupLogger, setupLogger |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
compilerClass
protected java.lang.Class compilerClass
- The compiler
classpath
protected java.lang.String classpath
- The local classpath
deleteSources
protected boolean deleteSources
- The source deletion option
CompiledProgrammingLanguage
public CompiledProgrammingLanguage()
parameterize
public void parameterize(org.apache.avalon.framework.parameters.Parameters params)
throws org.apache.avalon.framework.parameters.ParameterException
- Set the configuration parameters. This method instantiates the sitemap-specified language compiler
- Overrides:
parameterize
in class AbstractProgrammingLanguage
- Parameters:
params
- The configuration parameters- Throws:
org.apache.avalon.framework.parameters.ParameterException
- If the language compiler cannot be loaded
contextualize
public void contextualize(org.apache.avalon.framework.context.Context context)
throws org.apache.avalon.framework.context.ContextException
- Set the context
- Specified by:
contextualize
in interface org.apache.avalon.framework.context.Contextualizable
- Parameters:
context
- The context
getObjectExtension
public abstract java.lang.String getObjectExtension()
- Return the language's canonical object file extension.
- Returns:
- The object file extension
doUnload
public abstract void doUnload(java.lang.Object program)
throws LanguageException
- Unload a previously loaded program
- Parameters:
program
- A previously loaded object program- Throws:
LanguageException
- If an error occurs during unloading
doUnload
protected final void doUnload(java.lang.Object program,
java.lang.String filename,
java.io.File baseDirectory)
throws LanguageException
- Unload a previously loaded program given its original filesystem location
- Overrides:
doUnload
in class AbstractProgrammingLanguage
- Parameters:
program
- The previously loaded object programfilename
- The base filename of the object programbaseDirectory
- The directory contaning the object program file- Throws:
LanguageException
- If an error occurs
loadProgram
protected abstract java.lang.Class loadProgram(java.lang.String filename,
java.io.File baseDirectory)
throws LanguageException
- Actually load an object program from a file.
- Parameters:
filename
- The object program base file namebaseDirectory
- The directory containing the object program file- Returns:
- The loaded object program
- Throws:
LanguageException
- If an error occurs during loading
compile
protected abstract void compile(java.lang.String filename,
java.io.File baseDirectory,
java.lang.String encoding)
throws LanguageException
- Compile a source file yielding a loadable object file.
- Parameters:
filename
- The object program base file namebaseDirectory
- The directory containing the object program fileencoding
- The encoding expected in the source file or null
if it is the platform's default encoding- Throws:
LanguageException
- If an error occurs during compilation
preload
public Program preload(java.lang.String filename,
java.io.File baseDirectory,
java.lang.String encoding)
throws LanguageException
- Preload an object program from a file.
This method does not compiles the corresponding source file.
- Parameters:
filename
- The object program base file namebaseDirectory
- The directory containing the object program fileencoding
- The encoding expected in the source file or null
if it is the platform's default encoding- Returns:
- The loaded object program
- Throws:
LanguageException
- If an error occurs during compilation
load
public Program load(java.lang.String filename,
java.io.File baseDirectory,
java.lang.String encoding)
throws LanguageException
- Load an object program from a file.
This method compiles the corresponding source file if necessary.
- Parameters:
filename
- The object program base file namebaseDirectory
- The directory containing the object program fileencoding
- The encoding expected in the source file or null
if it is the platform's default encoding- Returns:
- The loaded object program
- Throws:
LanguageException
- If an error occurs during compilation
Copyright � 1999-2002 Apache Software Foundation. All Rights Reserved.