rendsite.engine
Class PropertiesContext

java.lang.Object
  extended by rendsite.engine.Context
      extended by rendsite.engine.PropertiesContext
All Implemented Interfaces:
PropertiesFileContext, PropertiesGeneralContext, Resetable, RendsiteProperties

public class PropertiesContext
extends Context
implements RendsiteProperties, PropertiesGeneralContext, PropertiesFileContext

Context for the stored properties.

will have to redo this completely, since it won't scale and they are shitty slow. It's enough to get things going now.

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

Field Summary
protected  things.data.ThingsPropertyTree local
           
protected static things.data.ThingsPropertyTree localEmpty
           
protected  things.data.ThingsPropertyReaderToolkit localToolkit
           
protected  things.data.ThingsPropertyView localView
           
protected  Node_Directory scopedDirectory
           
protected  things.data.ThingsPropertyTree store
           
protected  things.data.ThingsPropertyReaderToolkit storeToolkit
           
protected  things.data.ThingsPropertyView storeView
           
 
Fields inherited from class rendsite.engine.Context
configuration, logger, si
 
Fields inherited from interface rendsite.RendsiteProperties
PROP_CATALOG_FILE_NAME, PROP_CATALOG_FILE_NAME__DEFAULT, PROP_COPYRIGHT_NOTICE, PROP_DIR_COPY_ONLY, PROP_DIR_EXCLUDE, PROP_DIR_IGNORE, PROP_DIRECTORY, PROP_DIRECTORY_CATALOG, PROP_DIRECTORY_DESCRIPTION, PROP_DIRECTORY_NAME, PROP_DIRECTORY_TYPE, PROP_FILE, PROP_FILE_CATEGORY, PROP_FILE_COPY_ONLY, PROP_FILE_DESCRIPTION, PROP_FILE_EXCLUDE, PROP_FILE_IGNORE, PROP_FILE_NAME, PROP_FILE_RENDERING_TYPE, PROP_FILE_TYPE, PROP_LOCAL_DESCRIPTION, PROP_PROJECT, PROP_RENDERER_NAME, PROP_TEMPLATE_PATH_CATALOG, PROP_TEMPLATE_PATH_FILE, PROP_WILDCARD
 
Constructor Summary
PropertiesContext(RendsiteConfiguration configuration, java.io.File sourceDirectory, java.io.File outputDirectory)
          Create a context.
 
Method Summary
 boolean COPY_ONLY(Node_Directory directory)
          Is the directory copy only?
 boolean COPY_ONLY(Node_File file)
          Is the file copy only?
 boolean EXCLUDED(java.io.File file)
          Is the file or directory excluded?
 boolean EXCLUDED(Node_Directory directory)
          Is the directory excluded?
 boolean EXCLUDED(Node_File file)
          Is the file excluded?
 java.lang.String GET_CATALOG_NAME(Node_Directory directory)
          Get the name of the catalog from the directory.
 java.lang.String GET_DEFAULT(java.lang.String name, java.lang.String theDefault)
          Get a property value or the given default, if the property is not set.
 java.lang.String GET_LOCAL_DEFAULT(java.lang.String name, java.lang.String theDefault)
          Get a property value or the given default, if the property is not set.
 java.lang.String[] GET_MULTIVALUE(java.lang.String name)
          Get a property multi-value.
 java.lang.String GET_REQUIRED(java.lang.String name)
          Get a property value.
 CategoryManager getCategoryManager()
          Get the category manager.
 boolean IGNORED(java.io.File file)
          Is the file or directory ignored?
 boolean IGNORED(Node_Directory directory)
          Is the directory ignored?
 boolean IGNORED(Node_File file)
          Is the file ignored?
 boolean MATCH(java.lang.String propname, java.lang.String token)
          Check to see if a token matches the value of a property.
 void reset()
          Reset the context.
 void scope(Node_Directory directory)
          Enter a scope.
 void unscope()
          Exit a scope.
 things.data.ThingsPropertyView viewLocalDirectoriesPly(int ply)
          Get a DIRECTORY ply from the local.
 things.data.ThingsPropertyView viewLocalFilesPly(int ply)
          Get a FILE ply from the local.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

store

protected things.data.ThingsPropertyTree store

storeView

protected things.data.ThingsPropertyView storeView

storeToolkit

protected things.data.ThingsPropertyReaderToolkit storeToolkit

local

protected things.data.ThingsPropertyTree local

localView

protected things.data.ThingsPropertyView localView

localEmpty

protected static things.data.ThingsPropertyTree localEmpty

localToolkit

protected things.data.ThingsPropertyReaderToolkit localToolkit

scopedDirectory

protected Node_Directory scopedDirectory
Constructor Detail

PropertiesContext

public PropertiesContext(RendsiteConfiguration configuration,
                         java.io.File sourceDirectory,
                         java.io.File outputDirectory)
                  throws java.lang.Throwable
Create a context.

Parameters:
configuration - the configuration for the system.
sourceDirectory - path to the source directory.
outputDirectory - path to the output directory.
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.

viewLocalFilesPly

public things.data.ThingsPropertyView viewLocalFilesPly(int ply)
                                                 throws java.lang.Throwable
Get a FILE ply from the local.

Parameters:
ply -
Returns:
the view to the ply. It may be empty, not not configured.
Throws:
java.lang.Throwable

viewLocalDirectoriesPly

public things.data.ThingsPropertyView viewLocalDirectoriesPly(int ply)
                                                       throws java.lang.Throwable
Get a DIRECTORY ply from the local.

Parameters:
ply -
Returns:
the view to the ply. It may be empty, not not configured.
Throws:
java.lang.Throwable

getCategoryManager

public CategoryManager getCategoryManager()
Get the category manager.

Returns:
the category manager

GET_DEFAULT

public java.lang.String GET_DEFAULT(java.lang.String name,
                                    java.lang.String theDefault)
Get a property value or the given default, if the property is not set. Both local and non-local properties will be checked.

Specified by:
GET_DEFAULT in interface PropertiesGeneralContext
Parameters:
name - the property name.
theDefault - the default value.
Returns:
the value property or the default value.

GET_REQUIRED

public java.lang.String GET_REQUIRED(java.lang.String name)
                              throws java.lang.Throwable
Get a property value. If it isn't set, it will throw an exception. Both local and non-local properties will be checked.

Parameters:
name - the property name.
Returns:
the value property or the default value.
Throws:
java.lang.Throwable - if the property isn't set.

GET_LOCAL_DEFAULT

public java.lang.String GET_LOCAL_DEFAULT(java.lang.String name,
                                          java.lang.String theDefault)
Get a property value or the given default, if the property is not set. Only LOCAL properties will be check.

Specified by:
GET_LOCAL_DEFAULT in interface PropertiesGeneralContext
Parameters:
name - the property name.
theDefault - the default value.
Returns:
the value property or the default value.

GET_MULTIVALUE

public java.lang.String[] GET_MULTIVALUE(java.lang.String name)
                                  throws java.lang.Throwable
Get a property multi-value. Both local and non-local properties will be checked.

Specified by:
GET_MULTIVALUE in interface PropertiesGeneralContext
Parameters:
name - the property name.
Returns:
an array of values for this property or null if the property isn't set.
Throws:
java.lang.Throwable - for severe platform problems only.

MATCH

public boolean MATCH(java.lang.String propname,
                     java.lang.String token)
              throws java.lang.Throwable
Check to see if a token matches the value of a property. It will work against a multi-value property. It allows filename wildcards (like *). It is case sensitive.

Specified by:
MATCH in interface PropertiesGeneralContext
Parameters:
propname - the property name.
token - the token to match.
Returns:
true if the property is set and the token matches any of its values, otherwise false.
Throws:
java.lang.Throwable - for severe platform problems only.

GET_CATALOG_NAME

public java.lang.String GET_CATALOG_NAME(Node_Directory directory)
                                  throws java.lang.Throwable
Get the name of the catalog from the directory. If it is not already set in the node, it will try to figure it out from properties. A copy only directory will yield a null, unless it has already been set.

Parameters:
directory - the directory
Returns:
the name of the catalog.
Throws:
java.lang.Throwable - for severe platform problems only.

EXCLUDED

public boolean EXCLUDED(Node_Directory directory)
                 throws java.lang.Throwable
Is the directory excluded?

Specified by:
EXCLUDED in interface PropertiesFileContext
Parameters:
directory - the directory.
Returns:
true if it is excluded, otherwise false.
Throws:
java.lang.Throwable - for severe platform problems only.

EXCLUDED

public boolean EXCLUDED(Node_File file)
                 throws java.lang.Throwable
Is the file excluded?

Specified by:
EXCLUDED in interface PropertiesFileContext
Parameters:
file - the file.
Returns:
true if it is excluded, otherwise false.
Throws:
java.lang.Throwable - for severe platform problems only.

EXCLUDED

public boolean EXCLUDED(java.io.File file)
                 throws java.lang.Throwable
Is the file or directory excluded?

Specified by:
EXCLUDED in interface PropertiesFileContext
Parameters:
file - the java File representing a directory or file.
Returns:
true if it is excluded, otherwise false.
Throws:
java.lang.Throwable - for severe platform problems only.

IGNORED

public boolean IGNORED(Node_Directory directory)
                throws java.lang.Throwable
Is the directory ignored?

Specified by:
IGNORED in interface PropertiesFileContext
Parameters:
directory - the directory.
Returns:
true if it is ignored, otherwise false.
Throws:
java.lang.Throwable - for severe platform problems only.

IGNORED

public boolean IGNORED(Node_File file)
                throws java.lang.Throwable
Is the file ignored?

Specified by:
IGNORED in interface PropertiesFileContext
Parameters:
file - the file.
Returns:
true if it is ignored, otherwise false.
Throws:
java.lang.Throwable - for severe platform problems only.

IGNORED

public boolean IGNORED(java.io.File file)
                throws java.lang.Throwable
Is the file or directory ignored?

Specified by:
IGNORED in interface PropertiesFileContext
Parameters:
file - the java File representing a directory or file.
Returns:
true if it is ignored, otherwise false.
Throws:
java.lang.Throwable - for severe platform problems only.

COPY_ONLY

public boolean COPY_ONLY(Node_File file)
                  throws java.lang.Throwable
Is the file copy only?

Specified by:
COPY_ONLY in interface PropertiesFileContext
Parameters:
file - the file.
Returns:
true if it is copy only, otherwise false.
Throws:
java.lang.Throwable - for severe platform problems only.

COPY_ONLY

public boolean COPY_ONLY(Node_Directory directory)
                  throws java.lang.Throwable
Is the directory copy only?

Specified by:
COPY_ONLY in interface PropertiesFileContext
Parameters:
directory - the directory.
Returns:
true if it is copy only, otherwise false.
Throws:
java.lang.Throwable - for severe platform problems only.

scope

public void scope(Node_Directory directory)
           throws java.lang.Throwable
Enter a scope. Load metafiles for a directory. Overlapping properties will defer to the last loaded. The metafiles will be sorted before the load.

Parameters:
directory -
Throws:
java.lang.Throwable - will cause ERRORs if they can't load, but the scope should be ok. Be sure to call unscope() even if you get an exception.

unscope

public void unscope()
             throws java.lang.Throwable
Exit a scope.

Throws:
java.lang.Throwable - Any problem unscoping is a PANIC, since the scope stack will be in an unknown state.


rendsite.