rendsite.engine
Class RenderingContext

java.lang.Object
  extended by rendsite.engine.Context
      extended by rendsite.engine.RenderingContext
All Implemented Interfaces:
Resetable

public class RenderingContext
extends Context

Context for rendering.

Author:
erich Version History
 10NOV09 - EPG - First package release.
 

Field Summary
 RendererCatalog renderers
           
 
Fields inherited from class rendsite.engine.Context
configuration, logger, si
 
Constructor Summary
RenderingContext(RendsiteConfiguration configuration, FileContext fcontext, CategoryManager categoryManager)
          Create a context.
 
Method Summary
 Category CATEGORY_LOOKUP_EXTENSION(java.lang.String extension)
          It'll give you whatever the Category manager finds for that extension.
 java.util.List<Node_File> GET_CATALOGABLE_FILES(Node_Directory directory)
          Get the files for the catalog that have been filtered for ignores and excludes.
 java.util.List<Node_Directory> GET_CATALOGABLE_SUBDIRECTORIES(Node_Directory directory)
          Get the subdirectories for the catalog that have been filtered for ignores, excludes, and no catalog name (which will happen if the subdirectory was marked as copy only, but no catalog was explicitely configured.
 java.lang.String GET_TEMPLATE(java.lang.String pathOffset)
          Get a template.
 things.thinger.io.Logger getLogger()
          Get the logger for rendering.
 java.lang.String RENDER_TYPE(Node_File theFile)
          Render a 'type' text.
 void reset()
          Reset the context.
 RenderingType RESOLVE_RENDERING_TYPE(Node_File theFile)
          Get the rendering type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

renderers

public RendererCatalog renderers
Constructor Detail

RenderingContext

public RenderingContext(RendsiteConfiguration configuration,
                        FileContext fcontext,
                        CategoryManager categoryManager)
                 throws java.lang.Throwable
Create a context.

Parameters:
configuration - the configuration for the system.
fcontext - the file context.
categoryManager - the category manager.
Throws:
java.lang.Throwable - normally this will only happen if you pass a null or bad SystemInterface.
Method Detail

reset

public void reset()
           throws java.lang.Throwable
Reset the context. It should lose all state except what was set during construction;

Specified by:
reset in interface Resetable
Specified by:
reset in class Context
Throws:
java.lang.Throwable - if it could not completely reset state.

getLogger

public things.thinger.io.Logger getLogger()
Get the logger for rendering.

Returns:
the logger.

GET_TEMPLATE

public java.lang.String GET_TEMPLATE(java.lang.String pathOffset)
                              throws java.lang.Throwable
Get a template.

Parameters:
pathOffset - path from the source root to the template file.
Returns:
the template in a string. It will have been cached.
Throws:
java.lang.Throwable

GET_CATALOGABLE_SUBDIRECTORIES

public java.util.List<Node_Directory> GET_CATALOGABLE_SUBDIRECTORIES(Node_Directory directory)
                                                              throws java.lang.Throwable
Get the subdirectories for the catalog that have been filtered for ignores, excludes, and no catalog name (which will happen if the subdirectory was marked as copy only, but no catalog was explicitely configured.

Parameters:
directory - the directory from which to get the subs.
Returns:
a list. It may be empty.
Throws:
java.lang.Throwable

GET_CATALOGABLE_FILES

public java.util.List<Node_File> GET_CATALOGABLE_FILES(Node_Directory directory)
                                                throws java.lang.Throwable
Get the files for the catalog that have been filtered for ignores and excludes. TODO this doesn't handle neighbors at all.

Parameters:
directory - the directory from which to get the files.
Returns:
a list. It may be empty. Note that you should getCatalogedFile for each element to see if it has a neighbor cataloged for it.
Throws:
java.lang.Throwable

CATEGORY_LOOKUP_EXTENSION

public Category CATEGORY_LOOKUP_EXTENSION(java.lang.String extension)
                                   throws java.lang.Throwable
It'll give you whatever the Category manager finds for that extension.

Parameters:
extension - the file extension
Returns:
a category or a null.
Throws:
java.lang.Throwable

RENDER_TYPE

public java.lang.String RENDER_TYPE(Node_File theFile)
                             throws java.lang.Throwable
Render a 'type' text. First check the type field. If null, try to infer it from the category. If there is no category, yield an empty.

Parameters:
theFile -
Returns:
the type text
Throws:
java.lang.Throwable

RESOLVE_RENDERING_TYPE

public RenderingType RESOLVE_RENDERING_TYPE(Node_File theFile)
                                     throws java.lang.Throwable
Get the rendering type. If not set or inferred by category, it'll return OTHER.

Parameters:
theFile -
Returns:
the rendering type.
Throws:
java.lang.Throwable


rendsite.