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 Details

    • XDocReportRegistry

      public XDocReportRegistry()
  • Method Details

    • createCache

      protected fr.opensagres.xdocreport.core.cache.ICacheStorage<String,IXDocReport> createCache()
      Create the storage cache to store instances of IXDocReport.
      Returns:
    • getRegistry

      public static XDocReportRegistry 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:
      IOException
      fr.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:
      IOException
      fr.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:
      IOException
      fr.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:
      IOException
      fr.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:
      IOException
      fr.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:
      IOException
      fr.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:
      IOException
      fr.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:
      IOException
      fr.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:
      IOException
      fr.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:
      IOException
      fr.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:
      IOException
      fr.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:
      IOException
      fr.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:
      IOException
      fr.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:
      IOException
      fr.opensagres.xdocreport.core.XDocReportException
    • createReport

      public IXDocReport createReport(InputStream sourceStream) throws IOException, fr.opensagres.xdocreport.core.XDocReportException
      Throws:
      IOException
      fr.opensagres.xdocreport.core.XDocReportException
    • createReport

      public IXDocReport createReport(fr.opensagres.xdocreport.core.io.XDocArchive documentArchive) throws IOException, fr.opensagres.xdocreport.core.XDocReportException
      Throws:
      IOException
      fr.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 register
      force - 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

      public void checkReportId(String reportId) throws fr.opensagres.xdocreport.core.XDocReportException
      Check if registry can register the report with this id.
      Parameters:
      reportId -
      Throws:
      fr.opensagres.xdocreport.core.XDocReportException
    • getReport

      public IXDocReport getReport(String reportId)
      Returns the report identified with the given id.
      Parameters:
      reportId -
      Returns:
    • existsReport

      public boolean existsReport(String reportId)
      Returns true if report identified with the given id exists in the registry and false otherwise.
      Specified by:
      existsReport in interface fr.opensagres.xdocreport.template.cache.ITemplateCacheInfoProvider
      Parameters:
      reportId -
      Returns:
    • unregisterReport

      public void unregisterReport(String reportId)
      Unregister report identified with the given id.
      Parameters:
      reportId -
    • unregisterReport

      public void unregisterReport(IXDocReport report)
      Unregister report.
      Parameters:
      report -
    • getReportFactoryDiscoveries

      public Collection<IXDocReportFactoryDiscovery> getReportFactoryDiscoveries()
      Returns list of report factory discoveries.
      Returns:
    • getCachedReports

      public Collection<IXDocReport> getCachedReports()
      Returns cached report IXDocReport;
      Returns:
    • setClearTimeout

      public void setClearTimeout(long timeout)
      Clear cache with timeout. If this method is called, you must call AbstractRegistry.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:
      IOException
      fr.opensagres.xdocreport.core.XDocReportException
    • generateUniqueReportId

      public String generateUniqueReportId(String reportId)
      Generate unique report id.
      Parameters:
      reportId -
      Returns:
    • getTemplateCacheInfo

      public fr.opensagres.xdocreport.core.io.IEntryInfo getTemplateCacheInfo(String reportId, String entryName)
      Specified by:
      getTemplateCacheInfo in interface fr.opensagres.xdocreport.template.cache.ITemplateCacheInfoProvider
    • doDispose

      protected void doDispose()
      Specified by:
      doDispose in class fr.opensagres.xdocreport.core.registry.AbstractRegistry<IXDocReportFactoryDiscovery>
    • registerInstance

      protected boolean registerInstance(IXDocReportFactoryDiscovery instance)
      Specified by:
      registerInstance in class fr.opensagres.xdocreport.core.registry.AbstractRegistry<IXDocReportFactoryDiscovery>