org.apache.cocoon.components.language.programming.javascript
Class JavascriptLanguage

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.components.language.programming.AbstractProgrammingLanguage
          extended by org.apache.cocoon.components.language.programming.javascript.JavascriptLanguage
All Implemented Interfaces:
Component, LogEnabled, Parameterizable, ProgrammingLanguage

public class JavascriptLanguage
extends AbstractProgrammingLanguage

The interpreted Javascript programming language. Program in Javascript must have comment line as first line of file:

 // $Cocoon extends: org.apache.cocoon.components.language.xsp.JSGenerator$
 
The class specified will be used as a Java wrapper interpreting javascript program.

Version:
$Id: JavascriptLanguage.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Vadim Gritsenko

Field Summary
 
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
JavascriptLanguage()
           
 
Method Summary
protected  void doUnload(Object program, String filename, File baseDir)
          Unload a previously loaded program
 String getSourceExtension()
          Return the language's canonical source file extension.
 Program load(String filename, File baseDirectory, String encoding)
          Load a program from a file
 Program preload(String filename, File baseDirectory, String encoding)
          Preload a program from a file
 String quoteString(String constant)
          Escape a String according to the programming language's string constant encoding rules.
 
Methods inherited from class org.apache.cocoon.components.language.programming.AbstractProgrammingLanguage
getCodeFormatter, getLanguageName, instantiate, parameterize, setLanguageName, unload
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavascriptLanguage

public JavascriptLanguage()
Method Detail

preload

public Program preload(String filename,
                       File baseDirectory,
                       String encoding)
                throws LanguageException
Description copied from interface: ProgrammingLanguage
Preload a program from a file

Parameters:
filename - The program base file name
baseDirectory - The directory containing the program file
encoding - The encoding expected in the source file or null if it is the platform's default encoding
Returns:
The loaded program
Throws:
LanguageException - If an error occurs during loading

load

public Program load(String filename,
                    File baseDirectory,
                    String encoding)
             throws LanguageException
Description copied from interface: ProgrammingLanguage
Load a program from a file

Parameters:
filename - The program base file name
baseDirectory - The directory containing the program file
encoding - The encoding expected in the source file or null if it is the platform's default encoding
Returns:
The loaded program
Throws:
LanguageException - If an error occurs during loading

doUnload

protected void doUnload(Object program,
                        String filename,
                        File baseDir)
                 throws LanguageException
Description copied from class: AbstractProgrammingLanguage
Unload a previously loaded program

Specified by:
doUnload in class AbstractProgrammingLanguage
Parameters:
program - A previously loaded object program
Throws:
LanguageException - If an error occurs during unloading

quoteString

public String quoteString(String constant)
Description copied from interface: ProgrammingLanguage
Escape a String according to the programming language's string constant encoding rules.

Parameters:
constant - The string to be escaped
Returns:
The escaped string

getSourceExtension

public String getSourceExtension()
Return the language's canonical source file extension.

Returns:
The source file extension


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.