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

java.lang.Object
  |
  +--org.apache.avalon.framework.logger.AbstractLoggable
        |
        +--org.apache.cocoon.components.language.generator.ProgramGeneratorImpl
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.logger.Loggable, org.apache.avalon.framework.parameters.Parameterizable, ProgramGenerator, org.apache.avalon.framework.thread.ThreadSafe

public class ProgramGeneratorImpl
extends org.apache.avalon.framework.logger.AbstractLoggable
implements ProgramGenerator, org.apache.avalon.framework.context.Contextualizable, org.apache.avalon.framework.component.Composable, org.apache.avalon.framework.parameters.Parameterizable, org.apache.avalon.framework.activity.Disposable, org.apache.avalon.framework.thread.ThreadSafe

The default implementation of ProgramGenerator

Version:
CVS $Id: ProgramGeneratorImpl.java,v 1.15.2.4 2002/09/21 02:13:20 vgritsenko Exp $
Author:
Ricardo Rocha
, Vadim Gritsenko

Field Summary
protected  boolean autoReload
          The auto-reloading option
protected  GeneratorSelector cache
          The ComponentSelector for programs.
protected  ClassLoaderManager classManager
          The ClassLoaderManager
protected  java.lang.String contextDir
          Servlet Context Directory
protected  org.apache.avalon.framework.component.ComponentSelector languageSelector
          The programming language component selector
protected  org.apache.avalon.framework.component.ComponentManager manager
          The component manager
protected  org.apache.avalon.framework.component.ComponentSelector markupSelector
          The markup language component selector
protected  boolean preload
          The pre-loading option
protected  java.lang.String rootPackage
          The root package
protected  java.io.File workDir
          The working directory
 
Fields inherited from interface org.apache.cocoon.components.language.generator.ProgramGenerator
ROLE
 
Constructor Summary
ProgramGeneratorImpl()
           
 
Method Summary
 void compose(org.apache.avalon.framework.component.ComponentManager manager)
          Set the global component manager.
 void contextualize(org.apache.avalon.framework.context.Context context)
          Contextualize this class
 void dispose()
          dispose
 CompiledComponent load(org.apache.avalon.framework.component.ComponentManager newManager, Source source, java.lang.String markupLanguageName, java.lang.String programmingLanguageName, SourceResolver resolver)
          Load a program built from an XML document written in a MarkupLanguage
 CompiledComponent load(org.apache.avalon.framework.component.ComponentManager newManager, java.lang.String fileName, java.lang.String markupLanguageName, java.lang.String programmingLanguageName, SourceResolver resolver)
          Load a program built from an XML document written in a MarkupLanguage
 void parameterize(org.apache.avalon.framework.parameters.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.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

autoReload

protected boolean autoReload
The auto-reloading option


preload

protected boolean preload
The pre-loading option


cache

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


manager

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


markupSelector

protected org.apache.avalon.framework.component.ComponentSelector markupSelector
The markup language component selector


languageSelector

protected org.apache.avalon.framework.component.ComponentSelector languageSelector
The programming language component selector


workDir

protected java.io.File workDir
The working directory


classManager

protected ClassLoaderManager classManager
The ClassLoaderManager


rootPackage

protected java.lang.String rootPackage
The root package


contextDir

protected java.lang.String contextDir
Servlet Context Directory

Constructor Detail

ProgramGeneratorImpl

public ProgramGeneratorImpl()
Method Detail

contextualize

public void contextualize(org.apache.avalon.framework.context.Context context)
                   throws org.apache.avalon.framework.context.ContextException
Contextualize this class

Specified by:
contextualize in interface org.apache.avalon.framework.context.Contextualizable
org.apache.avalon.framework.context.ContextException

compose

public void compose(org.apache.avalon.framework.component.ComponentManager manager)
             throws org.apache.avalon.framework.component.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 org.apache.avalon.framework.component.Composable
Parameters:
manager - The global component manager
org.apache.avalon.framework.component.ComponentException

parameterize

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

Specified by:
parameterize in interface org.apache.avalon.framework.parameters.Parameterizable
Parameters:
params - The configuration information
Throws:
org.apache.avalon.framework.parameters.ParameterException - Not thrown here

load

public CompiledComponent load(org.apache.avalon.framework.component.ComponentManager newManager,
                              java.lang.String fileName,
                              java.lang.String markupLanguageName,
                              java.lang.String programmingLanguageName,
                              SourceResolver resolver)
                       throws java.lang.Exception
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:
java.lang.Exception - If an error occurs during generation or loading

load

public CompiledComponent load(org.apache.avalon.framework.component.ComponentManager newManager,
                              Source source,
                              java.lang.String markupLanguageName,
                              java.lang.String programmingLanguageName,
                              SourceResolver resolver)
                       throws java.lang.Exception
Load a program built from an XML document written in a MarkupLanguage

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:
java.lang.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 org.apache.avalon.framework.activity.Disposable


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