pl.edu.agh.cast.importer.base.template
Interface ITemplateProvider

All Known Implementing Classes:
XmlTemplateProvider

public interface ITemplateProvider

Template provider which provides access to import templates and groups.

Author:
AGH CAST Team

Method Summary
 void exportTemplateToFile(IImportTemplate template, File file)
          Writes given template to the file.
 IImportTemplate importTemplateFromFile(File file)
          Imports template from a given file.
 Collection<ImportTemplateGroup> readTemplateGroups()
          Reads all template groups.
 Collection<IImportTemplate> readTemplates()
          Reads import templates.
 void removeTemplate(UUID templateId)
          Removes template with given id.
 void removeTemplateGroup(UUID groupId)
          Removes templates group with given id.
 void saveTemplate(IImportTemplate template)
          Saves given template.
 void saveTemplateGroup(ImportTemplateGroup group)
          Saves given template group.
 

Method Detail

saveTemplate

void saveTemplate(IImportTemplate template)
                  throws TemplateException
Saves given template. If templates with given UUID already exists it will be overridden.

Parameters:
template - template to save
Throws:
TemplateException - when template cannot be saved as a result of core eclipse exceptions

removeTemplate

void removeTemplate(UUID templateId)
                    throws TemplateException
Removes template with given id.

Parameters:
templateId - id of template to remove
Throws:
TemplateException - when Eclipse core error occurs

readTemplates

Collection<IImportTemplate> readTemplates()
                                          throws TemplateException
Reads import templates.

Returns:
collection of import templates; if no templates are defined an empty collection is returned
Throws:
TemplateException - when any error occurs during reading template

exportTemplateToFile

void exportTemplateToFile(IImportTemplate template,
                          File file)
                          throws TemplateException
Writes given template to the file.

Parameters:
template - template to write
file - destination file
Throws:
TemplateException - when any I/O exception occurs during exporting template

importTemplateFromFile

IImportTemplate importTemplateFromFile(File file)
                                       throws TemplateException
Imports template from a given file.

Parameters:
file - file which contains an import template
Returns:
a template written in the file
Throws:
TemplateException - when the file does not exists or it not contains import template or any IOException occurred during reading the file

saveTemplateGroup

void saveTemplateGroup(ImportTemplateGroup group)
                       throws TemplateException
Saves given template group. If group with given UUID already exists it will be overridden.

Parameters:
group - group to save
Throws:
TemplateException

removeTemplateGroup

void removeTemplateGroup(UUID groupId)
                         throws TemplateException
Removes templates group with given id.

Parameters:
groupId - group id
Throws:
TemplateException - when Eclipse core error occurs

readTemplateGroups

Collection<ImportTemplateGroup> readTemplateGroups()
                                                   throws TemplateException
Reads all template groups. Groups are not verified if they contain existing templates.

Returns:
collection of template groups, if no templates groups are defined an empty collection is returned
Throws:
TemplateException - when any error occurs during reading template groups


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