Docmosis API 4.5.0

com.docmosis.template.store
Class TemplateStoreFactory

java.lang.Object
  extended bycom.docmosis.template.store.TemplateStoreFactory

public class TemplateStoreFactory
extends Object

This factory provides TemplateStore instances. Currently only one store implementation is provided (a FileTemplateStore) and only one instance is created and shared by all users.


Nested Class Summary
static class TemplateStoreFactory.PresetTemplateStore
          This class facades a real TemplateStore providing values for typical settings that one might use across lots of store requests.
 
Field Summary
static String PROPERTY_FIELD_ALLOW_PADDED
           
static String PROPERTY_PLAINTEXT_FIELD_PREFIX
           
static String PROPERTY_PLAINTEXT_FIELD_SUFFIX
           
static String PROPERTY_STORE_LOCATION
           
 
Constructor Summary
TemplateStoreFactory()
           
 
Method Summary
static TemplateStore getStore()
          Get the current Template Store with default settings.
static TemplateStore getStore(boolean templateErrorsFatal)
          Get an instance of a TemplateStore which has default settings for the plain text field delimiters, specifying whether errors in the template are fatal.
static TemplateStore getStore(boolean templateErrorsFatal, String plainTextFieldPrefix, String plainTextFieldSuffix, boolean allowPaddedFields)
          Get an instance of a TemplateStore which has default settings for the plain text field delimiters and whether errors in the template are fatal.
static void initialise()
          Initialise the Template Store factory.
static void release()
          Release the template store from memory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_PLAINTEXT_FIELD_PREFIX

public static final String PROPERTY_PLAINTEXT_FIELD_PREFIX
See Also:
Constant Field Values

PROPERTY_PLAINTEXT_FIELD_SUFFIX

public static final String PROPERTY_PLAINTEXT_FIELD_SUFFIX
See Also:
Constant Field Values

PROPERTY_FIELD_ALLOW_PADDED

public static final String PROPERTY_FIELD_ALLOW_PADDED
See Also:
Constant Field Values

PROPERTY_STORE_LOCATION

public static final String PROPERTY_STORE_LOCATION
See Also:
Constant Field Values
Constructor Detail

TemplateStoreFactory

public TemplateStoreFactory()
Method Detail

getStore

public static TemplateStore getStore()
Get the current Template Store with default settings.

Returns:
the current template store.
Throws:
IllegalStateException - if initialise() hasn't been called

getStore

public static TemplateStore getStore(boolean templateErrorsFatal,
                                     String plainTextFieldPrefix,
                                     String plainTextFieldSuffix,
                                     boolean allowPaddedFields)
Get an instance of a TemplateStore which has default settings for the plain text field delimiters and whether errors in the template are fatal. When this store is used with the StoreHelper or DropStoreHelper, these settings will be used unless overridden by the specific store methods used.

Parameters:
templateErrorsFatal - if true template errors will be treated as fatal and an exception will be thrown (when invalid templates are uploaded). If false, wherever possible Docmosis will write templates errors into the rendered document when rendering to assist with development and debugging.
plainTextFieldPrefix - if not null, the template may contain plain text markup and this parameter is the opening delimiter
plainTextFieldSuffix - this is the closing delimiter to plainTextFieldPrefix.
allowPaddedFields - if true fields that are padded with spaces (eg << name >>) are recognised as fields. Otherwise the spaces mean it is not recognised as a field.
Returns:
a template store with defaults for the specified parameters.
Throws:
IllegalStateException - if initialise() hasn't been called

getStore

public static TemplateStore getStore(boolean templateErrorsFatal)
Get an instance of a TemplateStore which has default settings for the plain text field delimiters, specifying whether errors in the template are fatal. When this store is used with the StoreHelper or DropStoreHelper, these settings will be used unless overridden by the specific store methods used.

Parameters:
templateErrorsFatal - if true template errors will be treated as fatal and an exception will be thrown (when invalid templates are uploaded). If false, wherever possible Docmosis will write templates errors into the rendered document when rendering to assist with development and debugging.
Returns:
a template store with defaults for the specified parameters.
Throws:
IllegalStateException - if initialise() hasn't been called

initialise

public static void initialise()
                       throws TemplateStoreException
Initialise the Template Store factory.

Throws:
TemplateStoreException - if a start problem occurs

release

public static void release()
Release the template store from memory. To be able to use it again, call initialise().


Docmosis API 4.5.0

Copyright © 2014 Docmosis Pty Ltd. All Rights Reserved.