Class XDocReportRegistry
java.lang.Object
fr.opensagres.xdocreport.core.registry.AbstractRegistry<IXDocReportFactoryDiscovery>
fr.opensagres.xdocreport.document.registry.XDocReportRegistry
- All Implemented Interfaces:
fr.opensagres.xdocreport.template.cache.ITemplateCacheInfoProvider,Serializable
public class XDocReportRegistry
extends fr.opensagres.xdocreport.core.registry.AbstractRegistry<IXDocReportFactoryDiscovery>
implements fr.opensagres.xdocreport.template.cache.ITemplateCacheInfoProvider, Serializable
Registry for loading and caching
IXDocReport instances.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckReportId(String reportId) Check if registry can register the report with this id.voidclear()Clear the cached reports.protected fr.opensagres.xdocreport.core.cache.ICacheStorage<String,IXDocReport> Create the storage cache to store instances of IXDocReport.createReport(fr.opensagres.xdocreport.core.io.XDocArchive documentArchive) createReport(InputStream sourceStream) protected voidbooleanexistsReport(String reportId) Returns true if report identified with the given id exists in the registry and false otherwise.generateUniqueReportId(String reportId) Generate unique report id.Returns cached reportIXDocReport;fr.opensagres.xdocreport.converter.MimeMappinggetMimeMapping(String fileExtension) Returns mime mapping for the file extension.static XDocReportRegistryReturns the report identified with the given id.Returns list of report factory discoveries.fr.opensagres.xdocreport.core.io.IEntryInfogetTemplateCacheInfo(String reportId, String entryName) loadReport(InputStream sourceStream) Load report.loadReport(InputStream sourceStream, boolean cacheReport) Load report.loadReport(InputStream sourceStream, fr.opensagres.xdocreport.template.ITemplateEngine templateEngine) Load report.loadReport(InputStream sourceStream, fr.opensagres.xdocreport.template.ITemplateEngine templateEngine, boolean cacheReport) Load report.loadReport(InputStream sourceStream, fr.opensagres.xdocreport.template.TemplateEngineKind templateEngineKind) Load report.loadReport(InputStream sourceStream, fr.opensagres.xdocreport.template.TemplateEngineKind templateEngineKind, boolean cacheReport) Load report.loadReport(InputStream sourceStream, String reportId) Load report.loadReport(InputStream sourceStream, String reportId, boolean cacheReport) Load report.loadReport(InputStream sourceStream, String reportId, fr.opensagres.xdocreport.template.ITemplateEngine templateEngine) Load report.loadReport(InputStream sourceStream, String reportId, fr.opensagres.xdocreport.template.ITemplateEngine templateEngine, boolean cacheReport) Load report.loadReport(InputStream sourceStream, String reportId, fr.opensagres.xdocreport.template.TemplateEngineKind templateEngineKind) Load report.loadReport(InputStream sourceStream, String reportId, fr.opensagres.xdocreport.template.TemplateEngineKind templateEngineKind, boolean cacheReport) Load report.loadReport(InputStream sourceStream, String reportId, String templateEngineKind) Load report.loadReport(InputStream sourceStream, String reportId, String templateEngineKind, boolean cacheReport) Load report.protected booleanregisterInstance(IXDocReportFactoryDiscovery instance) voidregisterReport(IXDocReport report) Register report and throws XDocReportException if it already exists a report in the registry with the same id .voidregisterReport(IXDocReport report, boolean force) Register report.voidsetClearTimeout(long timeout) Clear cache with timeout.voidunregisterReport(IXDocReport report) Unregister report.voidunregisterReport(String reportId) Unregister report identified with the given id.Methods inherited from class fr.opensagres.xdocreport.core.registry.AbstractRegistry
dispose, initialize, initializeIfNeeded, onEndInitialization, onStartInitialization
-
Constructor Details
-
XDocReportRegistry
public XDocReportRegistry()
-
-
Method Details
-
createCache
Create the storage cache to store instances of IXDocReport.- Returns:
-
getRegistry
-
loadReport
public IXDocReport loadReport(InputStream sourceStream) throws IOException, fr.opensagres.xdocreport.core.XDocReportException Load report. Note : this function does't cache the report.- Parameters:
sourceStream-- Returns:
- Throws:
IOExceptionfr.opensagres.xdocreport.core.XDocReportException
-
loadReport
public IXDocReport loadReport(InputStream sourceStream, boolean cacheReport) throws IOException, fr.opensagres.xdocreport.core.XDocReportException Load report.- Parameters:
sourceStream-cacheReport-- Returns:
- Throws:
IOExceptionfr.opensagres.xdocreport.core.XDocReportException
-
loadReport
public IXDocReport loadReport(InputStream sourceStream, String reportId) throws IOException, fr.opensagres.xdocreport.core.XDocReportException Load report. Note : this function cache the report.- Parameters:
sourceStream-reportId-- Returns:
- Throws:
IOExceptionfr.opensagres.xdocreport.core.XDocReportException
-
loadReport
public IXDocReport loadReport(InputStream sourceStream, String reportId, boolean cacheReport) throws IOException, fr.opensagres.xdocreport.core.XDocReportException Load report.- Parameters:
sourceStream-reportId-- Returns:
- Throws:
IOExceptionfr.opensagres.xdocreport.core.XDocReportException
-
loadReport
public IXDocReport loadReport(InputStream sourceStream, String reportId, fr.opensagres.xdocreport.template.ITemplateEngine templateEngine) throws IOException, fr.opensagres.xdocreport.core.XDocReportException Load report. Note : this function cache the report.- Parameters:
sourceStream-reportId-- Returns:
- Throws:
IOExceptionfr.opensagres.xdocreport.core.XDocReportException
-
loadReport
public IXDocReport loadReport(InputStream sourceStream, String reportId, fr.opensagres.xdocreport.template.ITemplateEngine templateEngine, boolean cacheReport) throws IOException, fr.opensagres.xdocreport.core.XDocReportException Load report.- Parameters:
sourceStream-reportId-- Returns:
- Throws:
IOExceptionfr.opensagres.xdocreport.core.XDocReportException
-
loadReport
public IXDocReport loadReport(InputStream sourceStream, String reportId, String templateEngineKind) throws IOException, fr.opensagres.xdocreport.core.XDocReportException Load report. Note : this function cache the report.- Parameters:
sourceStream-reportId-- Returns:
- Throws:
IOExceptionfr.opensagres.xdocreport.core.XDocReportException
-
loadReport
public IXDocReport loadReport(InputStream sourceStream, String reportId, String templateEngineKind, boolean cacheReport) throws IOException, fr.opensagres.xdocreport.core.XDocReportException Load report.- Parameters:
sourceStream-reportId-- Returns:
- Throws:
IOExceptionfr.opensagres.xdocreport.core.XDocReportException
-
loadReport
public IXDocReport loadReport(InputStream sourceStream, String reportId, fr.opensagres.xdocreport.template.TemplateEngineKind templateEngineKind) throws IOException, fr.opensagres.xdocreport.core.XDocReportException Load report. Note : this function cache the report.- Parameters:
sourceStream-reportId-- Returns:
- Throws:
IOExceptionfr.opensagres.xdocreport.core.XDocReportException
-
loadReport
public IXDocReport loadReport(InputStream sourceStream, String reportId, fr.opensagres.xdocreport.template.TemplateEngineKind templateEngineKind, boolean cacheReport) throws IOException, fr.opensagres.xdocreport.core.XDocReportException Load report.- Parameters:
sourceStream-reportId-- Returns:
- Throws:
IOExceptionfr.opensagres.xdocreport.core.XDocReportException
-
loadReport
public IXDocReport loadReport(InputStream sourceStream, fr.opensagres.xdocreport.template.ITemplateEngine templateEngine) throws IOException, fr.opensagres.xdocreport.core.XDocReportException Load report. Note : this function does't cache the report.- Parameters:
sourceStream-templateEngine-- Returns:
- Throws:
IOExceptionfr.opensagres.xdocreport.core.XDocReportException
-
loadReport
public IXDocReport loadReport(InputStream sourceStream, fr.opensagres.xdocreport.template.ITemplateEngine templateEngine, boolean cacheReport) throws IOException, fr.opensagres.xdocreport.core.XDocReportException Load report.- Parameters:
sourceStream-templateEngine-- Returns:
- Throws:
IOExceptionfr.opensagres.xdocreport.core.XDocReportException
-
loadReport
public IXDocReport loadReport(InputStream sourceStream, fr.opensagres.xdocreport.template.TemplateEngineKind templateEngineKind) throws IOException, fr.opensagres.xdocreport.core.XDocReportException Load report. Note : this function does't cache the report.- Parameters:
sourceStream-templateEngineKind-- Returns:
- Throws:
IOExceptionfr.opensagres.xdocreport.core.XDocReportException
-
loadReport
public IXDocReport loadReport(InputStream sourceStream, fr.opensagres.xdocreport.template.TemplateEngineKind templateEngineKind, boolean cacheReport) throws IOException, fr.opensagres.xdocreport.core.XDocReportException Load report.- Parameters:
sourceStream-templateEngineKind-- Returns:
- Throws:
IOExceptionfr.opensagres.xdocreport.core.XDocReportException
-
createReport
public IXDocReport createReport(InputStream sourceStream) throws IOException, fr.opensagres.xdocreport.core.XDocReportException - Throws:
IOExceptionfr.opensagres.xdocreport.core.XDocReportException
-
createReport
public IXDocReport createReport(fr.opensagres.xdocreport.core.io.XDocArchive documentArchive) throws IOException, fr.opensagres.xdocreport.core.XDocReportException - Throws:
IOExceptionfr.opensagres.xdocreport.core.XDocReportException
-
registerReport
public void registerReport(IXDocReport report) throws fr.opensagres.xdocreport.core.XDocReportException Register report and throws XDocReportException if it already exists a report in the registry with the same id .- Parameters:
report-- Throws:
fr.opensagres.xdocreport.core.XDocReportException
-
registerReport
public void registerReport(IXDocReport report, boolean force) throws fr.opensagres.xdocreport.core.XDocReportException Register report.- Parameters:
report- the report to registerforce- true if report must be forced (if report already exists with the same id) and false otherwise (throw XDocReportException if report exists with the same id).- Throws:
fr.opensagres.xdocreport.core.XDocReportException
-
checkReportId
Check if registry can register the report with this id.- Parameters:
reportId-- Throws:
fr.opensagres.xdocreport.core.XDocReportException
-
getReport
Returns the report identified with the given id.- Parameters:
reportId-- Returns:
-
existsReport
Returns true if report identified with the given id exists in the registry and false otherwise.- Specified by:
existsReportin interfacefr.opensagres.xdocreport.template.cache.ITemplateCacheInfoProvider- Parameters:
reportId-- Returns:
-
unregisterReport
Unregister report identified with the given id.- Parameters:
reportId-
-
unregisterReport
Unregister report.- Parameters:
report-
-
getReportFactoryDiscoveries
Returns list of report factory discoveries.- Returns:
-
getCachedReports
Returns cached reportIXDocReport;- Returns:
-
setClearTimeout
public void setClearTimeout(long timeout) Clear cache with timeout. If this method is called, you must callAbstractRegistry.dispose()method at the end of your program to stop the timer Thread.- Parameters:
timeout-
-
clear
public void clear()Clear the cached reports. -
getMimeMapping
public fr.opensagres.xdocreport.converter.MimeMapping getMimeMapping(String fileExtension) throws IOException, fr.opensagres.xdocreport.core.XDocReportException Returns mime mapping for the file extension.- Parameters:
fileExtension-- Returns:
- Throws:
IOExceptionfr.opensagres.xdocreport.core.XDocReportException
-
generateUniqueReportId
Generate unique report id.- Parameters:
reportId-- Returns:
-
getTemplateCacheInfo
public fr.opensagres.xdocreport.core.io.IEntryInfo getTemplateCacheInfo(String reportId, String entryName) - Specified by:
getTemplateCacheInfoin interfacefr.opensagres.xdocreport.template.cache.ITemplateCacheInfoProvider
-
doDispose
protected void doDispose()- Specified by:
doDisposein classfr.opensagres.xdocreport.core.registry.AbstractRegistry<IXDocReportFactoryDiscovery>
-
registerInstance
- Specified by:
registerInstancein classfr.opensagres.xdocreport.core.registry.AbstractRegistry<IXDocReportFactoryDiscovery>
-