pl.edu.agh.cast.data.template
Class AbstractTemplateUtil

java.lang.Object
  extended by pl.edu.agh.cast.data.template.AbstractTemplateUtil

public abstract class AbstractTemplateUtil
extends Object

Utility methods for the import templates.

Author:
AGH CAST Team

Constructor Summary
AbstractTemplateUtil()
           
 
Method Summary
static void exportTemplate(Template template, File target)
          Exports specified template to target file.
static HashSet<String> getTemplateLowerCaseNames()
          Returns templates names converted to lower case.
static Collection<Template> getTemplates()
          Retrieves a collection of valid templates.
static org.eclipse.core.resources.IProject getTemplatesProject()
          Returns template's project.
static Template loadTemplateFromFile(String path)
          Imports and loads a new template from an XML file.
static Template registerTemplate(String path)
          Registers a new template from a given template file.
static Template registerTemplate(Template template)
          Registers a new given template.
static void saveToXmlFile(Template template)
          Exports and saves a given template to an XML file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractTemplateUtil

public AbstractTemplateUtil()
Method Detail

getTemplatesProject

public static org.eclipse.core.resources.IProject getTemplatesProject()
                                                               throws org.eclipse.core.runtime.CoreException
Returns template's project.

Returns:
the template's project.
Throws:
org.eclipse.core.runtime.CoreException

getTemplateLowerCaseNames

public static HashSet<String> getTemplateLowerCaseNames()
Returns templates names converted to lower case.

Returns:
lower case template names.

getTemplates

public static Collection<Template> getTemplates()
Retrieves a collection of valid templates.

Returns:
collection of valid templates

saveToXmlFile

public static void saveToXmlFile(Template template)
                          throws org.eclipse.core.runtime.CoreException,
                                 IOException
Exports and saves a given template to an XML file.

Parameters:
template - the template to be saved
Throws:
org.eclipse.core.runtime.CoreException
IOException

registerTemplate

public static Template registerTemplate(String path)
                                 throws IOException,
                                        org.eclipse.core.runtime.CoreException,
                                        TemplateXmlException,
                                        ParserConfigurationException,
                                        SAXException
Registers a new template from a given template file.

Parameters:
path - the path to file containing a template to register
Returns:
the registered template
Throws:
IOException
org.eclipse.core.runtime.CoreException
TemplateXmlException
ParserConfigurationException
SAXException

registerTemplate

public static Template registerTemplate(Template template)
                                 throws org.eclipse.core.runtime.CoreException,
                                        IOException
Registers a new given template.

Parameters:
template - the template to register
Returns:
the registered template
Throws:
org.eclipse.core.runtime.CoreException
IOException

loadTemplateFromFile

public static Template loadTemplateFromFile(String path)
                                     throws SAXException,
                                            ParserConfigurationException,
                                            IOException
Imports and loads a new template from an XML file.

Parameters:
path - the path to file containing a template to be loaded
Returns:
the loaded template
Throws:
SAXException
ParserConfigurationException
IOException

exportTemplate

public static void exportTemplate(Template template,
                                  File target)
                           throws IOException,
                                  org.eclipse.core.runtime.CoreException
Exports specified template to target file. It overrides target file by default.

Parameters:
template - the template to export
target - the file where new template will be exported
Throws:
IOException
org.eclipse.core.runtime.CoreException


Copyright © 2007-2009 IISG AGH-UST Krakow, Poland. All Rights Reserved.