org.apache.cocoon.components.language.programming.java
Class JavaLanguage

java.lang.Object
  |
  +--org.apache.avalon.framework.logger.AbstractLoggable
        |
        +--org.apache.cocoon.components.language.programming.AbstractProgrammingLanguage
              |
              +--org.apache.cocoon.components.language.programming.CompiledProgrammingLanguage
                    |
                    +--org.apache.cocoon.components.language.programming.java.JavaLanguage
All Implemented Interfaces:
org.apache.avalon.framework.component.Component, org.apache.avalon.framework.component.Composable, org.apache.avalon.framework.context.Contextualizable, org.apache.avalon.framework.activity.Disposable, org.apache.avalon.framework.activity.Initializable, org.apache.avalon.framework.logger.Loggable, org.apache.avalon.framework.parameters.Parameterizable, ProgrammingLanguage, org.apache.avalon.framework.thread.ThreadSafe
Direct Known Subclasses:
CompiledJavascriptLanguage

public class JavaLanguage
extends CompiledProgrammingLanguage
implements org.apache.avalon.framework.activity.Initializable, org.apache.avalon.framework.thread.ThreadSafe, org.apache.avalon.framework.component.Composable, org.apache.avalon.framework.activity.Disposable

The Java programming language processor

Version:
CVS $Id: JavaLanguage.java,v 1.10 2002/03/08 04:08:53 vgritsenko Exp $
Author:
Ricardo Rocha

Field Summary
protected  org.apache.avalon.framework.component.ComponentManager manager
          The component manager
 
Fields inherited from class org.apache.cocoon.components.language.programming.CompiledProgrammingLanguage
classpath, compilerClass, deleteSources
 
Fields inherited from class org.apache.cocoon.components.language.programming.AbstractProgrammingLanguage
codeFormatter, languageName
 
Fields inherited from interface org.apache.cocoon.components.language.programming.ProgrammingLanguage
ROLE
 
Constructor Summary
JavaLanguage()
           
 
Method Summary
protected  void compile(java.lang.String name, java.io.File baseDirectory, java.lang.String encoding)
          Compile a source file yielding a loadable class file.
 void compose(org.apache.avalon.framework.component.ComponentManager manager)
          Set the global component manager.
 void dispose()
          dispose
 void doUnload(java.lang.Object program)
          Unload a previously loaded class.
 java.lang.String getObjectExtension()
          Return the language's canonical object file extension.
 java.lang.String getSourceExtension()
          Return the language's canonical source file extension.
 void initialize()
           
protected  java.lang.Class loadProgram(java.lang.String name, java.io.File baseDirectory)
          Actually load an object program from a class file.
 void parameterize(org.apache.avalon.framework.parameters.Parameters params)
          Set the configuration parameters.
 java.lang.String quoteString(java.lang.String constant)
          Escape a String according to the Java string constant encoding rules.
 
Methods inherited from class org.apache.cocoon.components.language.programming.CompiledProgrammingLanguage
contextualize, doUnload, load
 
Methods inherited from class org.apache.cocoon.components.language.programming.AbstractProgrammingLanguage
getCodeFormatter, getLanguageName, instantiate, setLanguageName, unload
 
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
 

Field Detail

manager

protected org.apache.avalon.framework.component.ComponentManager manager
The component manager
Constructor Detail

JavaLanguage

public JavaLanguage()
Method Detail

getSourceExtension

public java.lang.String getSourceExtension()
Return the language's canonical source file extension.
Returns:
The source file extension

getObjectExtension

public java.lang.String getObjectExtension()
Return the language's canonical object file extension.
Overrides:
getObjectExtension in class CompiledProgrammingLanguage
Returns:
The object file extension

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 ClassLoaderManager
Overrides:
parameterize in class CompiledProgrammingLanguage
Parameters:
params - The configuration parameters
Throws:
org.apache.avalon.framework.parameters.ParameterException - If the class loader manager cannot be instantiated

compose

public void compose(org.apache.avalon.framework.component.ComponentManager manager)
Set the global component manager. This methods initializes the class loader manager if it was not (successfully) specified in the language parameters
Specified by:
compose in interface org.apache.avalon.framework.component.Composable
Parameters:
manager - The global component manager

initialize

public void initialize()
                throws java.lang.Exception
Specified by:
initialize in interface org.apache.avalon.framework.activity.Initializable

loadProgram

protected java.lang.Class loadProgram(java.lang.String name,
                                      java.io.File baseDirectory)
                               throws LanguageException
Actually load an object program from a class file.
Overrides:
loadProgram in class CompiledProgrammingLanguage
Parameters:
name - The object program base file name
baseDirectory - The directory containing the object program file
Returns:
The loaded object program
Throws:
LanguageException - If an error occurs during loading

compile

protected void compile(java.lang.String name,
                       java.io.File baseDirectory,
                       java.lang.String encoding)
                throws LanguageException
Compile a source file yielding a loadable class file.
Overrides:
compile in class CompiledProgrammingLanguage
Parameters:
name - The object program base file name
baseDirectory - The directory containing the object program file
encoding - 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

doUnload

public void doUnload(java.lang.Object program)
              throws LanguageException
Unload a previously loaded class. This method simply reinstantiates the class loader to ensure that a new version of the same class will be correctly loaded in a future loading operation
Overrides:
doUnload in class CompiledProgrammingLanguage
Parameters:
program - A previously loaded class
Throws:
LanguageException - If an error occurs during unloading

quoteString

public java.lang.String quoteString(java.lang.String constant)
Escape a String according to the Java string constant encoding rules.
Parameters:
constant - The string to be escaped
Returns:
The escaped string

dispose

public void dispose()
dispose
Specified by:
dispose in interface org.apache.avalon.framework.activity.Disposable


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