|
Docmosis API 3.0.1 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.docmosis.template.store.DropStoreHelper
This class makes it easier to pick up documents in a directory and register them into the (configured) store. Only templates that have changed or are new will be uploaded into the store, replacing any previously registered counterparts. Any errors that occur will result in the template causing the error to not be stored, and a log error message. Templates not causing any errors will still be processed. The templates are located in the store under a context that is based on the path that the original template resides in. Several methods throw NoConvertersRunningException if there are no converters online at the time of the render. If all converters are busy, these methods will still wait up to the configured max wait. This exception is only thrown if there are no operating converters in the pool.
Constructor Summary | |
DropStoreHelper(TemplateStore store)
Create a new DropStoreHelper object. |
Method Summary | |
void |
process(File dropDirectory)
Drop a whole directory of templates into the store processing sub-directories. |
void |
process(File dropDirectory,
boolean isRecursive)
Drop a whole directory of templates into the store optionally processing sub-directories. |
void |
process(File dropDirectory,
boolean isRecursive,
boolean deleteUnknownTemplates)
Deprecated. Deletion of unknown templates is no longer supported. The deletion flag is ignored. |
void |
process(File dropDirectory,
TemplateContext storeContext)
Drop a whole directory of templates into the store optionally processing sub-directories. |
void |
process(File dropDirectory,
TemplateContext storeContext,
boolean isRecursive)
Drop a whole directory of templates into the store optionally processing sub-directories. |
void |
process(File dropDirectory,
TemplateContext storeContext,
boolean isRecursive,
boolean deleteUnknownTemplates)
Deprecated. Deletion of unknown templates is no longer supported. The deletion flag is ignored. |
void |
processJarOrZipFile(File file,
TemplateContext storeContext,
boolean logErrors)
Process the contents of a Jar or Zip file as it if was a directory. |
void |
processResource(URL url,
TemplateContext baseContext,
boolean logErrors)
Process templates from the specified URL. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DropStoreHelper(TemplateStore store)
store
- the store to use.Method Detail |
public void process(File dropDirectory) throws IOException, ConversionException, ConverterPoolException, TemplateStoreException, NoConvertersRunningException
dropDirectory
- the directory to pick up documents from.
ConversionException
- if a template cannot be processed
ConverterPoolException
- if the converter pool is not working
TemplateStoreException
- if the underlying template store has an error
IOException
- if an IO error occurs
NoConvertersRunningException
- if there are no converters runningpublic void process(File dropDirectory, TemplateContext storeContext) throws TemplateStoreException, IOException, NoConvertersRunningException
dropDirectory
- the directory to pick up documents from.storeContext
- the context within the store to use.
TemplateStoreException
- if the underlying template store has an error
IOException
- if an IO error occurs
NoConvertersRunningException
- if there are no converters runningpublic void process(File dropDirectory, TemplateContext storeContext, boolean isRecursive) throws TemplateStoreException, IOException, NoConvertersRunningException
dropDirectory
- the directory to pick up documents from.storeContext
- the context within the store to use.isRecursive
- true to recursively drop sub-directories; false
to only process the given directory.
TemplateStoreException
- if the underlying template store has an error
IOException
- if an IO error occurs
NoConvertersRunningException
- if there are no converters runningpublic void process(File dropDirectory, boolean isRecursive) throws TemplateStoreException, IOException, NoConvertersRunningException
dropDirectory
- the directory to pick up documents from.isRecursive
- true to recursively drop sub-directories; false
to only process the given directory.
TemplateStoreException
- if the underlying template store has an error
IOException
- if an IO error occurs
NoConvertersRunningException
- if there are no converters runningpublic void process(File dropDirectory, boolean isRecursive, boolean deleteUnknownTemplates) throws TemplateStoreException, IOException, NoConvertersRunningException
dropDirectory
- the directory to pick up documents from.isRecursive
- true to recursively drop sub-directories; false
to only process the given directory.deleteUnknownTemplates
- true to delete templates that are
in the store but not in the source ; false to leave them alone.
TemplateStoreException
- if the underlying template store has an error
IOException
- if an IO error occurs
NoConvertersRunningException
- if there are no converters runningpublic void process(File dropDirectory, TemplateContext storeContext, boolean isRecursive, boolean deleteUnknownTemplates) throws TemplateStoreException, IOException, NoConvertersRunningException
dropDirectory
- the directory to pick up documents from.storeContext
- the context within the store to use.isRecursive
- true to recursively drop sub-directories; false
to only process the given directory.deleteUnknownTemplates
- true to delete templates that are
in the store but not in the source ; false to leave them alone.
TemplateStoreException
- if the underlying template store has an error
or the given dropDirectory is not valid
IOException
- if an IO error occurs
NoConvertersRunningException
- if there are no converters runningpublic void processJarOrZipFile(File file, TemplateContext storeContext, boolean logErrors) throws NoConvertersRunningException, IOException, ConversionException, ConverterPoolException, TemplateStoreException
file
- the file to processstoreContext
- the context under which the templates are storedlogErrors
- if true, errors are logged but not thrown so that as much processing
as possible is done.
IOException
- if an IO error occurs
NoConvertersRunningException
- if there are no converters running
ConversionException
- if a template cannot be processed
ConverterPoolException
- if the converter pool is not working
TemplateStoreException
- if the underlying template store has an errorpublic void processResource(URL url, TemplateContext baseContext, boolean logErrors) throws IOException, TemplateStoreException, NoConvertersRunningException, ConversionException
URL myTemplates = getClass().getClassLoader().getResource("my/company/project/templates");
new DropStoreHelper(mystore).processResource(myTemplates, null);
url
- the URL to thebaseContext
- an optional context under which to store these templates. null means
store the templates starting in the root of the store.logErrors
- if true errors will be logged and processing will do its best effort to
process all templates found. If false, an exception will be thrown on first problem encountered.
TemplateStoreException
- if there is a problem storing the template
IOException
- if an IO error occurs
NoConvertersRunningException
- if there are no converters running
ConversionException
- if the template cannot be analyzed and stored
|
Docmosis API 3.0.1 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |