net.sf.javadocbuilder.templatesources.filesystem
Class FilesystemTemplateSource

java.lang.Object
  |
  +--net.sf.javadocbuilder.templatesources.filesystem.FilesystemTemplateSource
All Implemented Interfaces:
ITemplateSource

public class FilesystemTemplateSource
extends java.lang.Object
implements ITemplateSource

Filename collision problem

This template source does not allow files with the same name in different directories.

Author:
mike

Field Summary
private  java.util.Vector directories
          holds the list of directories where to look for file templates
private  java.util.Vector extensions
          holds extensions accepted as templates
private static java.util.logging.Logger log
           
 
Constructor Summary
FilesystemTemplateSource()
           
 
Method Summary
private  void addTemplatesFrom(java.util.Vector ret, java.lang.String dirName)
          Reads the d directory and puts all velocity tempaltes (.vm) in the ret vector
private  boolean extensionAccepted(java.lang.String string)
           
 java.lang.String getDescription()
          A brief description of this template source.
 java.lang.String getId()
          A string that uniquely identifies the extension (suggested plugin id).
 java.lang.String getName()
          Gets the visible name of the template source
 net.sf.javadocbuilder.ITemplate getTemplateById(java.lang.String id)
          Gets the first template identified by the given name.
 net.sf.javadocbuilder.ITemplate[] getTemplates()
          Gets an array of all templates available at the template source.
private  void internalAddDirectories(java.util.Vector aDirectories, java.lang.String dir, boolean flag)
          Adds directory dir to aDirectories vector adding child dirs if flag is true.
private  void loadDirectories()
          Loads configured directories into the directories vector.
private  void setExtensions(java.lang.String extensionsString)
          Sets the extensions vector from the comma separated list in the extensionString.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

extensions

private java.util.Vector extensions
holds extensions accepted as templates


directories

private java.util.Vector directories
holds the list of directories where to look for file templates


log

private static java.util.logging.Logger log
Constructor Detail

FilesystemTemplateSource

public FilesystemTemplateSource()
Method Detail

getTemplates

public net.sf.javadocbuilder.ITemplate[] getTemplates()
Description copied from interface: ITemplateSource
Gets an array of all templates available at the template source.

Specified by:
getTemplates in interface ITemplateSource
Returns:
a non null array (may be zero sized if there are no templates available)

loadDirectories

private void loadDirectories()
Loads configured directories into the directories vector. previous content of the vector is removed.


setExtensions

private void setExtensions(java.lang.String extensionsString)
Sets the extensions vector from the comma separated list in the extensionString. values are trimmed.


internalAddDirectories

private void internalAddDirectories(java.util.Vector aDirectories,
                                    java.lang.String dir,
                                    boolean flag)
Adds directory dir to aDirectories vector adding child dirs if flag is true.


addTemplatesFrom

private void addTemplatesFrom(java.util.Vector ret,
                              java.lang.String dirName)
Reads the d directory and puts all velocity tempaltes (.vm) in the ret vector

Parameters:
ret - vector that will receive the ITemplateSources in the directory
dirName - directory to search

extensionAccepted

private boolean extensionAccepted(java.lang.String string)
Parameters:
string -
Returns:

getTemplateById

public net.sf.javadocbuilder.ITemplate getTemplateById(java.lang.String id)
Description copied from interface: ITemplateSource
Gets the first template identified by the given name.

Specified by:
getTemplateById in interface ITemplateSource
Returns:
a template with the given name or null if there's no tempalte with the given name in this source

getName

public java.lang.String getName()
Description copied from interface: ITemplateSource
Gets the visible name of the template source

Specified by:
getName in interface ITemplateSource
Returns:

getDescription

public java.lang.String getDescription()
Description copied from interface: ITemplateSource
A brief description of this template source.

Specified by:
getDescription in interface ITemplateSource
Returns:

getId

public java.lang.String getId()
Description copied from interface: ITemplateSource
A string that uniquely identifies the extension (suggested plugin id). The plugin id cannot be used one plugin provides more than one source, in this case the plugin id concateated with a number or a string identifying the source should be enough.

Specified by:
getId in interface ITemplateSource
Returns: