org.apache.cocoon.components.language.programming
Class AbstractProgrammingLanguage

java.lang.Object
  |
  +--org.apache.avalon.framework.logger.AbstractLoggable
        |
        +--org.apache.cocoon.components.language.programming.AbstractProgrammingLanguage
All Implemented Interfaces:
org.apache.avalon.framework.component.Component, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.logger.Loggable, ProgrammingLanguage
Direct Known Subclasses:
CompiledProgrammingLanguage

public abstract class AbstractProgrammingLanguage
extends org.apache.avalon.framework.logger.AbstractLoggable
implements ProgrammingLanguage, org.apache.avalon.framework.configuration.Configurable

Base implementation of ProgrammingLanguage. This class sets the CodeFormatter instance and deletes source program files after unloading.

Version:
CVS $Revision: 1.1 $ $Date: 2002/01/03 12:31:11 $
Author:
Ricardo Rocha

Field Summary
protected  java.lang.Class codeFormatter
          The source code formatter
protected  java.lang.String languageName
           
 
Fields inherited from interface org.apache.cocoon.components.language.programming.ProgrammingLanguage
ROLE
 
Constructor Summary
AbstractProgrammingLanguage()
           
 
Method Summary
 void configure(org.apache.avalon.framework.configuration.Configuration conf)
          Configure the language
protected abstract  void doUnload(java.lang.Object program, java.lang.String filename, java.io.File baseDirectory)
          Unload a previously loaded program
 CodeFormatter getCodeFormatter()
          Return this language's source code formatter.
 java.lang.String getLanguageName()
          Get Language Name
 void setLanguageName(java.lang.String name)
          Set Language Name
protected  void setParameters(org.apache.avalon.framework.parameters.Parameters params)
          Set the configuration parameters.
 void unload(java.lang.Object program, java.lang.String filename, java.io.File baseDirectory)
          Unload from memory and invalidate a given program
 
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
 
Methods inherited from interface org.apache.cocoon.components.language.programming.ProgrammingLanguage
getSourceExtension, instantiate, load, quoteString
 

Field Detail

codeFormatter

protected java.lang.Class codeFormatter
The source code formatter

languageName

protected java.lang.String languageName
Constructor Detail

AbstractProgrammingLanguage

public AbstractProgrammingLanguage()
Method Detail

configure

public void configure(org.apache.avalon.framework.configuration.Configuration conf)
               throws org.apache.avalon.framework.configuration.ConfigurationException
Configure the language
Specified by:
configure in interface org.apache.avalon.framework.configuration.Configurable

setParameters

protected void setParameters(org.apache.avalon.framework.parameters.Parameters params)
                      throws java.lang.Exception
Set the configuration parameters. This method instantiates the sitemap-specified source code formatter
Parameters:
params - The configuration parameters
Throws:
java.lang.Exception - If the language compiler cannot be loaded

getCodeFormatter

public CodeFormatter getCodeFormatter()
Return this language's source code formatter. A new formatter instance is created on each invocation.
Specified by:
getCodeFormatter in interface ProgrammingLanguage
Returns:
The language source code formatter

doUnload

protected abstract void doUnload(java.lang.Object program,
                                 java.lang.String filename,
                                 java.io.File baseDirectory)
                          throws LanguageException
Unload a previously loaded program
Parameters:
program - A previously loaded object program
Throws:
LanguageException - If an error occurs during unloading

unload

public final void unload(java.lang.Object program,
                         java.lang.String filename,
                         java.io.File baseDirectory)
                  throws LanguageException
Description copied from interface: ProgrammingLanguage
Unload from memory and invalidate a given program
Specified by:
unload in interface ProgrammingLanguage
Following copied from interface: org.apache.cocoon.components.language.programming.ProgrammingLanguage
Parameters:
program - The program
filename - The name of the file this program was loaded from
baseDirectory - The directory containing the program file
Throws:
LanguageException - If an error occurs

setLanguageName

public final void setLanguageName(java.lang.String name)
Description copied from interface: ProgrammingLanguage
Set Language Name
Specified by:
setLanguageName in interface ProgrammingLanguage
Following copied from interface: org.apache.cocoon.components.language.programming.ProgrammingLanguage
Parameters:
name - The name of the language

getLanguageName

public final java.lang.String getLanguageName()
Description copied from interface: ProgrammingLanguage
Get Language Name
Specified by:
getLanguageName in interface ProgrammingLanguage
Following copied from interface: org.apache.cocoon.components.language.programming.ProgrammingLanguage
Returns:
The name of the language


Copyright © 1999-2002 Apache Software Foundation. All Rights Reserved.