|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.docmosis.template.store.StoreHelper
public class 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. Notes onExternalResourcePermission
:
ExternalResourcePermissions
,
#storeTemplate(TemplateIdentifier,File,boolean,waitForConverter,TemplateStore,ExternalResourcePermissions)
Field Summary | |
---|---|
static String |
PROP_EXTERNAL_RESOURCES_COMPARE_CASE_INSENSITIVE
|
static String |
PROP_EXTERNAL_RESOURCES_COMPARE_DECODE_URLS
|
static String |
PROP_EXTERNAL_RESOURCES_DEFAULT_PERMISSION
|
static String |
PROP_EXTERNAL_RESOURCES_EXTRACT_ENABLED
|
Constructor Summary | |
---|---|
StoreHelper()
|
Method Summary | |
---|---|
static ExternalResourcePermissions |
getDefaultExternalResourcePermission()
|
static TemplateDetails |
storeTemplate(String templateName,
File templateFile,
boolean overwrite,
TemplateStore store,
ExternalResourcePermissions externalResourcePermissions)
As above, but with explicit permissions regarding external links. |
static TemplateDetails |
storeTemplate(String templateName,
File templateFile,
TemplateStore store)
Store a template in the given template store. |
static TemplateDetails |
storeTemplate(String templateName,
File templateFile,
TemplateStore store,
ExternalResourcePermissions externalResourcePermissions)
As above, but with explicit permissions regarding external links. |
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,
boolean overwrite,
boolean waitForConverter,
TemplateStore store,
ExternalResourcePermissions externalResourcePermissions)
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,
File templateFile,
TemplateStore store,
ExternalResourcePermissions externalResourcePermissions)
As above, but with explicit permissions regarding external links. |
static TemplateDetails |
storeTemplate(TemplateIdentifier templateId,
InputStream origTemplateStream,
Long origTemplateLastModified,
boolean overwrite,
boolean waitForConverter,
TemplateStore store,
ExternalResourcePermissions externalResourcePermissions)
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. |
static TemplateValidationResult |
validateTemplate(InputStream templateStream,
ExternalResourcePermissions externalResourcePermissions)
As above, but with the specified permissions. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String PROP_EXTERNAL_RESOURCES_EXTRACT_ENABLED
public static final String PROP_EXTERNAL_RESOURCES_DEFAULT_PERMISSION
public static final String PROP_EXTERNAL_RESOURCES_COMPARE_CASE_INSENSITIVE
public static final String PROP_EXTERNAL_RESOURCES_COMPARE_DECODE_URLS
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, TemplateStore store, ExternalResourcePermissions externalResourcePermissions) throws IOException, ConversionException, TemplateStoreException, NoConvertersRunningException
externalResourcePermission
- the permissions specifying what external links may be
present in the template (ALL, NONE or a white-list). null means use the system default.
IOException
ConversionException
TemplateStoreException
NoConvertersRunningException
public static TemplateDetails storeTemplate(String templateName, File templateFile, boolean overwrite, TemplateStore store, ExternalResourcePermissions externalResourcePermissions) throws IOException, ConversionException, TemplateStoreException, NoConvertersRunningException
overwrite
- true to overwrite existing objects in the store;
false to not overwrite (an exception will be thrown if attempted).externalResourcePermission
- the permissions specifying what external links may be
present in the template (ALL, NONE or a white-list). null means use the system default.
IOException
ConversionException
TemplateStoreException
NoConvertersRunningException
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, File templateFile, TemplateStore store, ExternalResourcePermissions externalResourcePermissions) throws IOException, ConversionException, TemplateStoreException, NoConvertersRunningException
externalResourcePermission
- the permissions specifying what external links may be
present in the template (ALL, NONE or a white-list). null means use the system default.
IOException
ConversionException
TemplateStoreException
NoConvertersRunningException
public static TemplateDetails storeTemplate(TemplateIdentifier templateId, InputStream origTemplateStream, Long origTemplateLastModified, boolean overwrite, boolean waitForConverter, TemplateStore store, ExternalResourcePermissions externalResourcePermissions) 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 templateorigTemplateLastModified
- last modified time of the original template stream. If null it is not used.overwrite
- 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 TemplateDetails storeTemplate(TemplateIdentifier templateId, File templateFile, boolean overwrite, boolean waitForConverter, TemplateStore store, ExternalResourcePermissions externalResourcePermissions) 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.externalResourcePermission
- the permissions specifying what external links may be
present in the template (ALL, NONE or a white-list). null means use the system default.
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
public static TemplateValidationResult validateTemplate(InputStream templateStream, ExternalResourcePermissions externalResourcePermissions) throws TemplateStoreException
externalResourcePermission
- the permissions specifying what external links may be
present in the template (ALL, NONE or a white-list). null means use the system default.
TemplateStoreException
public static ExternalResourcePermissions getDefaultExternalResourcePermission()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |