|
Docmosis API 4.5.0 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.docmosis.template.store.StoreHelper
This class provides methods to register templates into the template store. The Template Store should be thought of as a cache of templates. Your original templates are analysed and optimised when you register them into the template store. It is these optimised versions of your templates that are then used for document production. Some methods in the DocumentProcessor class rely on the templates having been previously registered, and other methods will register templates automatically.
Constructor Summary | |
StoreHelper()
|
Method Summary | |
static TemplateDetails |
storeTemplate(String templateName,
File templateFile,
boolean overwrite,
TemplateStore store)
Store a template in the given template store (this process is known as template registration) specifying whether to overwrite any existing registrations or not. |
static TemplateDetails |
storeTemplate(String templateName,
File templateFile,
TemplateStore store)
Store a template in the given template store. |
static TemplateDetails |
storeTemplate(TemplateIdentifier templateId,
File templateFile,
boolean overwrite,
boolean waitForConverter,
TemplateStore store)
Store a template in the given template store (this process is known as template registration). |
static TemplateDetails |
storeTemplate(TemplateIdentifier templateId,
File templateFile,
TemplateStore store)
Store a template in the given template store (this process is known as template registration). |
static TemplateDetails |
storeTemplate(TemplateIdentifier templateId,
InputStream origTemplateStream,
boolean overwrite,
boolean waitForConverter,
TemplateStore store)
Store the given template stream against the given templateId in the given store. |
static boolean |
templateExists(TemplateIdentifier templateId,
TemplateStore store)
Determines whether the given template exists in the store. |
static TemplateValidationResult |
validateTemplate(InputStream templateStream)
Process the given stream as a template and return a TemplateValidationResult. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public StoreHelper()
Method Detail |
public static TemplateDetails storeTemplate(String templateName, File templateFile, TemplateStore store) throws IOException, ConversionException, TemplateStoreException, NoConvertersRunningException
// register a template StoreHelper.storeTemplate("account", accountTemplateFile, TemplateStoreFactory.getStore()); .... // later, refer to the template for rendering TemplateIdentifier tid = new TemplateIdentifier("account"); DocumentProcessor.renderDoc(tid, ...);
templateName
- the name of the template that will reside in the store.templateFile
- the template to storestore
- the store to use.
IOException
- if an IO problem occurs
ConversionException
- if the template is not valid
TemplateStoreException
- if there is a problem with the template store
NoConvertersRunningException
- if a converter cannot be obtained
to support the analysis of the template.public static TemplateDetails storeTemplate(String templateName, File templateFile, boolean overwrite, TemplateStore store) throws IOException, ConversionException, TemplateStoreException, NoConvertersRunningException
templateName
- the name of the template that will reside in the store.templateFile
- the template to store.overwrite
- true to overwrite existing objects in the store;
false to not overwrite.store
- the store to use.
IOException
- if an IO problem occurs
ConversionException
- if the template is not valid
TemplateStoreException
- if there is a problem with the template store
NoConvertersRunningException
- if a converter cannot be obtained
to support the analysis of the template.public static TemplateDetails storeTemplate(TemplateIdentifier templateId, File templateFile, TemplateStore store) throws IOException, ConversionException, TemplateStoreException, NoConvertersRunningException
templateId
- the identifier for the templatetemplateFile
- the template to store.store
- the store to use.
IOException
- if an IO problem occurs
ConversionException
- if the template is not valid
TemplateStoreException
- if there is a problem with the template store
NoConvertersRunningException
- if a converter cannot be obtained
to support the analysis of the template.public static TemplateDetails storeTemplate(TemplateIdentifier templateId, InputStream origTemplateStream, boolean overwrite, boolean waitForConverter, TemplateStore store) throws IOException, ConversionException, TemplateStoreException, NoConvertersRunningException
templateId
- the identifier for the template (name and or path) to use for the stored templateorigTemplateStream
- an InputStream over the templateoverwrite
- true to overwrite existing objects in the store;
false to not overwrite (an exception will be thrown if attempted).waitForConverter
- true will force this method to wait for a converter
to become available if there are none; false will force this method to
throw an exception if there are no converters.store
- the template store to use
IOException
- if an IO problem occurs
ConversionException
- if the template is not valid
TemplateStoreException
- if there is a problem with the template store
NoConvertersRunningException
- if there are no converters running and the
waitForConverter parameter has been set to false.public static TemplateDetails storeTemplate(TemplateIdentifier templateId, File templateFile, boolean overwrite, boolean waitForConverter, TemplateStore store) throws IOException, ConversionException, TemplateStoreException, NoConvertersRunningException
templateId
- the identifier for the templatetemplateFile
- the template to store.overwrite
- true to overwrite existing objects in the store;
false to not overwrite.waitForConverter
- true will force this method to wait for a converter
to become available if there are none; false will force this method to
throw an exception if there are no converters.store
- the store to use.
IOException
- if an IO problem occurs
ConversionException
- if the template is not valid
TemplateStoreException
- if there is a problem with the template store
NoConvertersRunningException
- if there are no converters running and the
waitForConverter parameter has been set to false.public static boolean templateExists(TemplateIdentifier templateId, TemplateStore store) throws IOException, TemplateStoreException
templateId
- the identifier of the template to look for.store
- the store to look inside.
IOException
- if an IO problem occurs
TemplateStoreException
- if there is a problem with the template storepublic static TemplateValidationResult validateTemplate(InputStream templateStream) throws TemplateStoreException
templateStream
- a stream for the template to validate
TemplateStoreException
- if a problem occurs trying to validateTemplateValidationResult
|
Docmosis API 4.5.0 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |