org.apache.cocoon.components.language.programming.python
Class PythonLanguage
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.cocoon.components.language.programming.AbstractProgrammingLanguage
org.apache.cocoon.components.language.programming.python.PythonLanguage
- All Implemented Interfaces:
- Component, LogEnabled, Parameterizable, ProgrammingLanguage
public class PythonLanguage
- extends AbstractProgrammingLanguage
- implements ProgrammingLanguage
The interpreted Python programming language.
Program in Python 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:
- CVS $Id: PythonLanguage.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 |
PythonLanguage
public PythonLanguage()
preload
public Program preload(String filename,
File baseDirectory,
String encoding)
throws LanguageException
- Description copied from interface:
ProgrammingLanguage
- Preload a program from a file
- Specified by:
preload
in interface ProgrammingLanguage
- 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
- Specified by:
load
in interface ProgrammingLanguage
- 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.
- Specified by:
quoteString
in interface ProgrammingLanguage
- Parameters:
constant
- The string to be escaped
- Returns:
- The escaped string
getSourceExtension
public String getSourceExtension()
- Return the language's canonical source file extension.
- Specified by:
getSourceExtension
in interface ProgrammingLanguage
- Returns:
- The source file extension
Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.