org.apache.cocoon.components.language.programming.javascript
Class JavascriptLanguage
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.cocoon.components.language.programming.AbstractProgrammingLanguage
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
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JavascriptLanguage
public JavascriptLanguage()
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 namebaseDirectory
- The directory containing the program fileencoding
- 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 namebaseDirectory
- The directory containing the program fileencoding
- 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.