Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## rendsite.engine
Class FileContext

    java.lang.Object
      rendsite.engine.Context
          rendsite.engine.FileContext

All Implemented Interfaces:
  Resetable

    public class FileContext

extends Context

Context for files in a run. It keeps track of file changes.

Author:
  erich Version History

       10NOV09 - EPG - First package release.

Field Summary

Fields inherited from class rendsite.engine.Context
`configuration, logger, si`

Constructor Summary
`FileContext(RendsiteConfiguration configuration, java.io.File sourceDirectory, java.io.File outputDirectory)` Create a context.

Method Summary
`java.io.File` | `getOutputDirectory(java.lang.String source)` Get the output file for the given directory node.
`java.io.File` | `getOutputFile(java.lang.String sourcePath)` Get the output file for the given node.
`Node_Directory` | `getRoot()` Get the root directory.
`java.io.File` | `getSourceFile(java.lang.String pathOffset)` Get a source file.
`java.lang.String` | `getURL(Node_Directory source, Node_Directory target, boolean encode)` Get the URL for this directory based on the path which will be pointed at by the source directory.
`java.lang.String` | `getURL(Node_Directory source, Node_Directory target, java.lang.String fileName, boolean encode)` Get a URL for this file in the target directory which will be pointed at by the source directory.
`java.lang.String` | `getUrl(java.lang.String base, java.lang.String target, boolean encode)` Get a url from a path within the root.
`java.lang.String` | `getURLAbsolute(Node_Directory target, boolean encode)` Get absolute URL for the directory.
`java.lang.String` | `getURLAbsolute(Node_Directory target, java.lang.String fileName, boolean encode)` Get absolute URL for the file.
`java.lang.String` | `getURLFromRoot(Node_Directory source, java.lang.String url, boolean encode)` Get related URL for the directory from the root.
`java.lang.String` | `getURLToRoot(Node_Directory source, boolean encode)` Get related URL to the root from the directory.
`boolean` | `isExempt(java.io.File theFile)` If the file is exempt, return true.
`void` | `notifyChange(java.lang.String path, Node_File theFile)` Notify the context that the file changed.
`void` | `notifyChangeDelete(java.lang.String path, Node_File theFile)` Notify the context that the file changed because it was deleted.
`void` | `notifyChangeFailed(java.lang.String path, Node_File theFile)` Notify the context that the file changed failed.
`void` | `register(FileNotice_Notifier fileNotifier)` Register notifier.
`void` | `registerExemptFile(java.io.File theFile)` The file will be exempt from certain system functions, such as cleaning.
`void` | `reset()` Reset the context.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### FileContext

    public FileContext(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.

### register

    public void register(FileNotice_Notifier fileNotifier)

  Register notifier. For now, we just allow one notifier.

  Parameters:
    `fileNotifier` - the notifier. If null, it'll not notify anyone. You can turn off a previously registered notifier by calling with a null.

### notifyChange

    public void notifyChange(java.lang.String path,
                             Node_File theFile)
                      throws java.lang.Throwable

  Notify the context that the file changed.

  Parameters:
    `path` - absolute source path. (Destination is ok too, but it best to be consistent).
    `theFile` - the file that changed.
  Throws:
    `java.lang.Throwable`

### notifyChangeFailed

    public void notifyChangeFailed(java.lang.String path,
                                   Node_File theFile)
                            throws java.lang.Throwable

  Notify the context that the file changed failed.

  Parameters:
    `path` - absolute source path. (Destination is ok too, but it best to be consistent).
    `theFile` - the file where the change failed.
  Throws:
    `java.lang.Throwable`

### notifyChangeDelete

    public void notifyChangeDelete(java.lang.String path,
                                   Node_File theFile)
                            throws java.lang.Throwable

  Notify the context that the file changed because it was deleted.

  Parameters:
    `path` - absolute source path. (Destination is ok too, but it best to be consistent).
    `theFile` - the file where it was deleted.
  Throws:
    `java.lang.Throwable`

### registerExemptFile

    public void registerExemptFile(java.io.File theFile)
                            throws java.lang.Throwable

  The file will be exempt from certain system functions, such as cleaning.

  Parameters:
    `theFile` -
  Throws:
    `java.lang.Throwable`

### isExempt

    public boolean isExempt(java.io.File theFile)
                     throws java.lang.Throwable

  If the file is exempt, return true.

  Parameters:
    `theFile` - the file to check for exemption.
  Returns:
    true if it is, otherwise false.
  Throws:
    `java.lang.Throwable`

### getRoot

    public Node_Directory getRoot()

  Get the root directory.

  Returns:
    the Node_Directory for the root.

### getSourceFile

    public java.io.File getSourceFile(java.lang.String pathOffset)
                               throws java.lang.Throwable

  Get a source file. These must be for read-only access! (Don't force me to abstract this further.)

  Parameters:
    `pathOffset` - path from the source root to the file.
  Returns:
    the File. It does not check to see if the file is really there.
  Throws:
    `java.lang.Throwable` - if the pathOffset is null or empty.

### getOutputFile

    public java.io.File getOutputFile(java.lang.String sourcePath)
                               throws java.lang.Throwable

  Get the output file for the given node.

  Parameters:
    `sourcePath` - absolute path to source file.
  Returns:
    a File pointing to the target output destination.
  Throws:
    `java.lang.Throwable`

### getOutputDirectory

    public java.io.File getOutputDirectory(java.lang.String source)
                                    throws java.lang.Throwable

  Get the output file for the given directory node.

  Parameters:
    `source` -
  Returns:
    a File pointing to the target output destination.
  Throws:
    `java.lang.Throwable`

### getURLFromRoot

    public java.lang.String getURLFromRoot(Node_Directory source,
                                           java.lang.String url,
                                           boolean encode)
                                    throws java.lang.Throwable

  Get related URL for the directory from the root. These should be ok for links.

  Parameters:
    `source` - where we are starting from.
    `url` - the url. Do not start with a 'slash' (will cause an exception).
    `encode` - encode the URL properly. Set to false for it to be display worthy.
  Returns:
    the URL
  Throws:
    `java.lang.Throwable`

### getURLToRoot

    public java.lang.String getURLToRoot(Node_Directory source,
                                         boolean encode)
                                  throws java.lang.Throwable

  Get related URL to the root from the directory. These should be ok for links.

  Parameters:
    `source` - where we are starting from.
    `encode` - encode the URL properly. Set to false for it to be display worthy.
  Returns:
    the URL
  Throws:
    `java.lang.Throwable`

### getURL

    public java.lang.String getURL(Node_Directory source,
                                   Node_Directory target,
                                   boolean encode)
                            throws java.lang.Throwable

  Get the URL for this directory based on the path which will be pointed at by the source directory.

  Parameters:
    `source` - from where this will be pointed at. It is useful for relative paths (if needed). If set to null, it will always be treated as the same directory.
    `target` - the target from which to get the URL.
    `encode` - encode the URL properly. Set to false for it to be display worthy.
  Returns:
    the base
  Throws:
    `java.lang.Throwable`

### getURL

    public java.lang.String getURL(Node_Directory source,
                                   Node_Directory target,
                                   java.lang.String fileName,
                                   boolean encode)
                            throws java.lang.Throwable

  Get a URL for this file in the target directory which will be pointed at by the source directory.

  Parameters:
    `source` - from where this will be pointed at. It is useful for relative paths (if needed). If set to null, it will always be treated as the same directory.
    `target` - the target from which to get the URL.
    `fileName` - the filename for the file.
    `encode` - encode the URL properly. Set to false for it to be display worthy.
  Returns:
    the base
  Throws:
    `java.lang.Throwable`

### getUrl

    public java.lang.String getUrl(java.lang.String base,
                                   java.lang.String target,
                                   boolean encode)
                            throws java.lang.Throwable

  Get a url from a path within the root. Process it for filesystem mode if necessary.

  Parameters:
    `base` - from where this will be pointed (useful if the context needs to make relative paths).
    `encode` - encode the URL properly.
  Returns:
    target the target path from which to get the url
  Throws:
    `java.lang.Throwable`

### getURLAbsolute

    public java.lang.String getURLAbsolute(Node_Directory target,
                                           boolean encode)
                                    throws java.lang.Throwable

  Get absolute URL for the directory. Never use these for links--only display.

  Parameters:
    `target` - the target from which to get the URL.
    `encode` - encode the URL properly. Set to false for it to be display worthy.
  Returns:
    the base
  Throws:
    `java.lang.Throwable`

### getURLAbsolute

    public java.lang.String getURLAbsolute(Node_Directory target,
                                           java.lang.String fileName,
                                           boolean encode)
                                    throws java.lang.Throwable

  Get absolute URL for the file. Never use these for links--only display.

  Parameters:
    `target` - the directory containing the file.
    `fileName` - the filename for the file.
    `encode` - encode the URL properly. Set to false for it to be display worthy.
  Returns:
    the base
  Throws:
    `java.lang.Throwable`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

rendsite.