org.argoprint.persistence
Class TemplateMetaFileSerializer

java.lang.Object
  extended by org.argoprint.persistence.TemplateMetaFileSerializer

public class TemplateMetaFileSerializer
extends java.lang.Object

This class is used to serialize (read/write) TemplateMetaFile objects.

Author:
mfortner

Constructor Summary
TemplateMetaFileSerializer()
           
 
Method Summary
static java.util.List<TemplateMetaFile> getAllTemplates()
          This method returns all template metafiles found in the classpath and in the user's home directory.
static java.util.List<TemplateMetaFile> getTemplates()
          This method gets the default templates.
static java.util.List<TemplateMetaFile> getTemplates(java.lang.String rootdir)
          This method gets all of the templates.
static TemplateMetaFile read(java.io.File file)
          This method reads a template metadata XML file and returns a TemplateMetaFile object.
static TemplateMetaFile read(java.lang.String file)
          This method reads a template metadata XML file and returns a TemplateMetaFile object.
static TemplateMetaFile readTemplate(org.xml.sax.InputSource source)
           
static TemplateMetaFile readTemplate(java.io.InputStream is)
           
static TemplateMetaFile readTemplateFromClassPath(java.lang.String file)
          This method reads TemplateMetaFiles from the classpath.
static void write(java.io.File file, TemplateMetaFile metaFile)
          This method writes a template metadata XML file out to disk.
static void write(java.lang.String file, TemplateMetaFile metafile)
          This method writes a template metadata XML file out to disk.
static void write(TemplateMetaFile template)
          This method writes an XML version of the TemplateMetaFile into the .argouml/templates directory.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TemplateMetaFileSerializer

public TemplateMetaFileSerializer()
Method Detail

read

public static TemplateMetaFile read(java.lang.String file)
                             throws java.io.IOException
This method reads a template metadata XML file and returns a TemplateMetaFile object.

Parameters:
file - The template metadata file.
Returns:
A TemplateMetaFile object.
Throws:
java.io.IOException - If there is a problem reading the file.

read

public static TemplateMetaFile read(java.io.File file)
                             throws java.io.IOException
This method reads a template metadata XML file and returns a TemplateMetaFile object.

Parameters:
file - The template metadata file.
Returns:
A TemplateMetaFile object.
Throws:
java.io.IOException - If there is a problem reading the file.

readTemplateFromClassPath

public static TemplateMetaFile readTemplateFromClassPath(java.lang.String file)
                                                  throws java.io.IOException
This method reads TemplateMetaFiles from the classpath.

Parameters:
file - The TemplateMetaFile xml file.
Returns:
Throws:
java.io.IOException - If there is a problem reading the file.

readTemplate

public static TemplateMetaFile readTemplate(java.io.InputStream is)

readTemplate

public static TemplateMetaFile readTemplate(org.xml.sax.InputSource source)

write

public static void write(java.lang.String file,
                         TemplateMetaFile metafile)
                  throws java.io.IOException
This method writes a template metadata XML file out to disk.

Parameters:
file - The template metadata file.
metafile - The template metafile object.
Throws:
java.io.IOException - If there is a problem writing the file.

write

public static void write(java.io.File file,
                         TemplateMetaFile metaFile)
                  throws java.io.IOException
This method writes a template metadata XML file out to disk.

Parameters:
file - The template metadata file.
metaFile - The template metafile object.
Throws:
java.io.IOException - If there is a problem writing the file.

write

public static void write(TemplateMetaFile template)
                  throws java.io.IOException
This method writes an XML version of the TemplateMetaFile into the .argouml/templates directory.

Parameters:
template - The templateMetaFile to be written
Throws:
java.io.IOException - If there is a problem writing the file out.

getTemplates

public static java.util.List<TemplateMetaFile> getTemplates(java.lang.String rootdir)
This method gets all of the templates.

Parameters:
rootdir - The root directory where all template files are located.
Returns:

getTemplates

public static java.util.List<TemplateMetaFile> getTemplates()
This method gets the default templates.

Returns:

getAllTemplates

public static java.util.List<TemplateMetaFile> getAllTemplates()
This method returns all template metafiles found in the classpath and in the user's home directory.

Returns: