org.apache.cocoon.components.language.generator
Class ProgramGeneratorImpl

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.components.language.generator.ProgramGeneratorImpl
All Implemented Interfaces:
Disposable, Component, Composable, Contextualizable, LogEnabled, Parameterizable, ThreadSafe, ProgramGenerator

public class ProgramGeneratorImpl
extends AbstractLogEnabled
implements ProgramGenerator, Contextualizable, Composable, Parameterizable, Disposable, ThreadSafe

The default implementation of ProgramGenerator

Version:
CVS $Id: ProgramGeneratorImpl.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Ricardo Rocha, Vadim Gritsenko, Torsten Curdt

Field Summary
protected  boolean autoReload
          The auto-reloading option
protected  GeneratorSelector cache
          The ComponentSelector for programs.
protected  ClassLoaderManager classManager
          The ClassLoaderManager
protected  String contextDir
          Servlet Context Directory
protected  ComponentSelector languageSelector
          The programming language component selector
protected  ComponentManager manager
          The component manager
protected  ComponentSelector markupSelector
          The markup language component selector
protected  boolean preload
          The pre-loading option
protected  String rootPackage
          The root package
protected  boolean watchSource
          The check for manual source changes in the repository
protected  File workDir
          The working directory
 
Fields inherited from interface org.apache.cocoon.components.language.generator.ProgramGenerator
ROLE
 
Constructor Summary
ProgramGeneratorImpl()
           
 
Method Summary
 void compose(ComponentManager manager)
          Set the global component manager.
 void contextualize(Context context)
          Contextualize this class
 void dispose()
          dispose
 CompiledComponent load(ComponentManager newManager, Source source, String markupLanguageName, String programmingLanguageName, SourceResolver resolver)
          Load a program built from an XML document written in a MarkupLanguage.
 CompiledComponent load(ComponentManager newManager, String fileName, String markupLanguageName, String programmingLanguageName, SourceResolver resolver)
          Deprecated. Pass Source object instead of file name.
 void parameterize(Parameters params)
          Set the sitemap-provided configuration.
 void release(CompiledComponent component)
          Releases the program instance.
 void remove(Source source)
          Removes named program from the program generator's cache.
 
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
 

Field Detail

autoReload

protected boolean autoReload
The auto-reloading option


preload

protected boolean preload
The pre-loading option


watchSource

protected boolean watchSource
The check for manual source changes in the repository


cache

protected GeneratorSelector cache
The ComponentSelector for programs. Caches Program by program source file.


manager

protected ComponentManager manager
The component manager


markupSelector

protected ComponentSelector markupSelector
The markup language component selector


languageSelector

protected ComponentSelector languageSelector
The programming language component selector


workDir

protected File workDir
The working directory


classManager

protected ClassLoaderManager classManager
The ClassLoaderManager


rootPackage

protected String rootPackage
The root package


contextDir

protected String contextDir
Servlet Context Directory

Constructor Detail

ProgramGeneratorImpl

public ProgramGeneratorImpl()
Method Detail

contextualize

public void contextualize(Context context)
                   throws ContextException
Contextualize this class

Specified by:
contextualize in interface Contextualizable
Throws:
ContextException

compose

public void compose(ComponentManager manager)
             throws ComponentException
Set the global component manager. This method also sets the ComponentSelector used as language factory for both markup and programming languages.

Specified by:
compose in interface Composable
Parameters:
manager - The global component manager
Throws:
ComponentException

parameterize

public void parameterize(Parameters params)
                  throws ParameterException
Set the sitemap-provided configuration. This method sets the persistent code repository and the auto-reload option

Specified by:
parameterize in interface Parameterizable
Parameters:
params - The configuration information
Throws:
ParameterException - Not thrown here

load

public CompiledComponent load(ComponentManager newManager,
                              String fileName,
                              String markupLanguageName,
                              String programmingLanguageName,
                              SourceResolver resolver)
                       throws Exception
Deprecated. Pass Source object instead of file name.

Load a program built from an XML document written in a MarkupLanguage

Specified by:
load in interface ProgramGenerator
Parameters:
fileName - The input document's File
markupLanguageName - The MarkupLanguage in which the input document is written
programmingLanguageName - The ProgrammingLanguage in which the program must be written
newManager - The ComponentManager that it will be loaded with
Returns:
The loaded program instance
Throws:
Exception - If an error occurs during generation or loading

load

public CompiledComponent load(ComponentManager newManager,
                              Source source,
                              String markupLanguageName,
                              String programmingLanguageName,
                              SourceResolver resolver)
                       throws Exception
Load a program built from an XML document written in a MarkupLanguage. This method does not releases passed source object. Caller of the method must release source when needed.

Specified by:
load in interface ProgramGenerator
Parameters:
source - The input document's File
markupLanguageName - The MarkupLanguage in which the input document is written
programmingLanguageName - The ProgrammingLanguage in which the program must be written
newManager - The ComponentManager that it will be loaded with
Returns:
The loaded program instance
Throws:
Exception - If an error occurs during generation or loading

release

public void release(CompiledComponent component)
Releases the program instance.

Specified by:
release in interface ProgramGenerator
Parameters:
component - program instance to be released

remove

public void remove(Source source)
Removes named program from the program generator's cache. Disposes all created instances of the program.

Specified by:
remove in interface ProgramGenerator
Parameters:
source - of the program to be removed

dispose

public void dispose()
dispose

Specified by:
dispose in interface Disposable


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