org.patterncoder.source
Class XMLSourceHandler

java.lang.Object
  extended by org.patterncoder.source.XMLSourceHandler
All Implemented Interfaces:
PatternSourceManager

public class XMLSourceHandler
extends java.lang.Object
implements PatternSourceManager

Deals with the directories required by the extension. Any objects requireing directory information, should declare an instance of this class.


Method Summary
 java.io.File getClassTemplate(java.lang.String template)
          Returns the template file of a given template name.
 java.io.File getImage(java.lang.String image)
          Returns the image file of the associated image name.
static XMLSourceHandler getInstance()
          Controls the creation of the singleton object.
 java.util.ArrayList<java.lang.String> getSourceFiles()
          Returns an ArrayList of File objects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static XMLSourceHandler getInstance()
Controls the creation of the singleton object.

Returns:
the single instance of XMLSourceHandler.

getImage

public java.io.File getImage(java.lang.String image)
                      throws java.io.FileNotFoundException
Returns the image file of the associated image name. The image returned will be located in the extension directory.

Specified by:
getImage in interface PatternSourceManager
Parameters:
image - the name of the image required.
Returns:
the pattern image.
Throws:
java.io.FileNotFoundException - thrown if the image file cannot be found.

getSourceFiles

public java.util.ArrayList<java.lang.String> getSourceFiles()
                                                     throws java.io.FileNotFoundException,
                                                            java.lang.Exception
Returns an ArrayList of File objects. The File objects refer to the source files of each of the design patterns. The source files are located in the PatternFiles directory in the extension directory.

Specified by:
getSourceFiles in interface PatternSourceManager
Returns:
a list of source files.
Throws:
java.lang.Exception - thrown if a general exception occurs.
java.io.FileNotFoundException - thrown if the source file can not be found.

getClassTemplate

public java.io.File getClassTemplate(java.lang.String template)
                              throws java.io.FileNotFoundException
Returns the template file of a given template name. Searches the template directory for a template with the given name.

Specified by:
getClassTemplate in interface PatternSourceManager
Parameters:
template - the name of the template file.
Returns:
the template file.
Throws:
java.io.FileNotFoundException - thrown if the template file can not be found.