fr.opensagres.xdocreport.document.registry
Class XDocReportRegistry

java.lang.Object
  extended by fr.opensagres.xdocreport.core.registry.AbstractRegistry<IXDocReportFactoryDiscovery>
      extended by fr.opensagres.xdocreport.document.registry.XDocReportRegistry
All Implemented Interfaces:
ITemplateCacheInfoProvider, Serializable

public class XDocReportRegistry
extends AbstractRegistry<IXDocReportFactoryDiscovery>
implements ITemplateCacheInfoProvider, Serializable

Registry for loading and cahing IXDocReport instances.

See Also:
Serialized Form

Constructor Summary
XDocReportRegistry()
           
 
Method Summary
 void checkReportId(String reportId)
          Check if registry can register the report with this id.
 void clear()
          Clear the cached reports.
protected  ICacheStorage<String,IXDocReport> createCache()
          Create the storage cache to store instances of IXDocReport.
 IXDocReport createReport(InputStream sourceStream)
           
 IXDocReport createReport(XDocArchive documentArchive)
           
protected  void doDispose()
           
 boolean existsReport(String reportId)
          Returns true if report identified with the given id exists in the registry and false otherwise.
 String generateUniqueReportId(String reportId)
          Generate unique report id.
 Collection<IXDocReport> getCachedReports()
          Returns cached report IXDocReport;
 MimeMapping getMimeMapping(String fileExtension)
          Returns mime mapping for the file extension.
static XDocReportRegistry getRegistry()
           
 IXDocReport getReport(String reportId)
          Returns the report identified with the given id.
 Collection<IXDocReportFactoryDiscovery> getReportFactoryDiscoveries()
          Returns list of report factory discoveries.
 IEntryInfo getTemplateCacheInfo(String reportId, String entryName)
           
 IXDocReport loadReport(InputStream sourceStream)
          Load report.
 IXDocReport loadReport(InputStream sourceStream, boolean cacheReport)
          Load report.
 IXDocReport loadReport(InputStream sourceStream, ITemplateEngine templateEngine)
          Load report.
 IXDocReport loadReport(InputStream sourceStream, ITemplateEngine templateEngine, boolean cacheReport)
          Load report.
 IXDocReport loadReport(InputStream sourceStream, String reportId)
          Load report.
 IXDocReport loadReport(InputStream sourceStream, String reportId, boolean cacheReport)
          Load report.
 IXDocReport loadReport(InputStream sourceStream, String reportId, ITemplateEngine templateEngine)
          Load report.
 IXDocReport loadReport(InputStream sourceStream, String reportId, ITemplateEngine templateEngine, boolean cacheReport)
          Load report.
 IXDocReport loadReport(InputStream sourceStream, String reportId, String templateEngineKind)
          Load report.
 IXDocReport loadReport(InputStream sourceStream, String reportId, String templateEngineKind, boolean cacheReport)
          Load report.
 IXDocReport loadReport(InputStream sourceStream, String reportId, TemplateEngineKind templateEngineKind)
          Load report.
 IXDocReport loadReport(InputStream sourceStream, String reportId, TemplateEngineKind templateEngineKind, boolean cacheReport)
          Load report.
 IXDocReport loadReport(InputStream sourceStream, TemplateEngineKind templateEngineKind)
          Load report.
 IXDocReport loadReport(InputStream sourceStream, TemplateEngineKind templateEngineKind, boolean cacheReport)
          Load report.
protected  boolean registerInstance(IXDocReportFactoryDiscovery instance)
          Register the instance in the registry.
 void registerReport(IXDocReport report)
          Register report and throws XDocReportException if it already exists a report in the registry with the same id .
 void registerReport(IXDocReport report, boolean force)
          Register report.
 void setClearTimeout(long timeout)
           
 void unregisterReport(IXDocReport report)
          Unregister report.
 void unregisterReport(String reportId)
          Unregister report identified with the given id.
 
Methods inherited from class fr.opensagres.xdocreport.core.registry.AbstractRegistry
dispose, initialize, initializeIfNeeded, onEndInitialization, onStartInitialization
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XDocReportRegistry

public XDocReportRegistry()
Method Detail

createCache

protected 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,
                              XDocReportException
Load report.

Parameters:
sourceStream -
reportId -
Returns:
Throws:
IOException
XDocReportException

loadReport

public IXDocReport loadReport(InputStream sourceStream,
                              boolean cacheReport)
                       throws IOException,
                              XDocReportException
Load report.

Parameters:
sourceStream -
reportId -
Returns:
Throws:
IOException
XDocReportException

loadReport

public IXDocReport loadReport(InputStream sourceStream,
                              String reportId)
                       throws IOException,
                              XDocReportException
Load report.

Parameters:
sourceStream -
reportId -
Returns:
Throws:
IOException
XDocReportException

loadReport

public IXDocReport loadReport(InputStream sourceStream,
                              String reportId,
                              boolean cacheReport)
                       throws IOException,
                              XDocReportException
Load report.

Parameters:
sourceStream -
reportId -
Returns:
Throws:
IOException
XDocReportException

loadReport

public IXDocReport loadReport(InputStream sourceStream,
                              String reportId,
                              ITemplateEngine templateEngine)
                       throws IOException,
                              XDocReportException
Load report.

Parameters:
sourceStream -
reportId -
Returns:
Throws:
IOException
XDocReportException

loadReport

public IXDocReport loadReport(InputStream sourceStream,
                              String reportId,
                              ITemplateEngine templateEngine,
                              boolean cacheReport)
                       throws IOException,
                              XDocReportException
Load report.

Parameters:
sourceStream -
reportId -
Returns:
Throws:
IOException
XDocReportException

loadReport

public IXDocReport loadReport(InputStream sourceStream,
                              String reportId,
                              String templateEngineKind)
                       throws IOException,
                              XDocReportException
Load report.

Parameters:
sourceStream -
reportId -
Returns:
Throws:
IOException
XDocReportException

loadReport

public IXDocReport loadReport(InputStream sourceStream,
                              String reportId,
                              String templateEngineKind,
                              boolean cacheReport)
                       throws IOException,
                              XDocReportException
Load report.

Parameters:
sourceStream -
reportId -
Returns:
Throws:
IOException
XDocReportException

loadReport

public IXDocReport loadReport(InputStream sourceStream,
                              String reportId,
                              TemplateEngineKind templateEngineKind)
                       throws IOException,
                              XDocReportException
Load report.

Parameters:
sourceStream -
reportId -
Returns:
Throws:
IOException
XDocReportException

loadReport

public IXDocReport loadReport(InputStream sourceStream,
                              String reportId,
                              TemplateEngineKind templateEngineKind,
                              boolean cacheReport)
                       throws IOException,
                              XDocReportException
Load report.

Parameters:
sourceStream -
reportId -
Returns:
Throws:
IOException
XDocReportException

loadReport

public IXDocReport loadReport(InputStream sourceStream,
                              ITemplateEngine templateEngine)
                       throws IOException,
                              XDocReportException
Load report.

Parameters:
sourceStream -
templateEngine -
Returns:
Throws:
IOException
XDocReportException

loadReport

public IXDocReport loadReport(InputStream sourceStream,
                              ITemplateEngine templateEngine,
                              boolean cacheReport)
                       throws IOException,
                              XDocReportException
Load report.

Parameters:
sourceStream -
templateEngine -
Returns:
Throws:
IOException
XDocReportException

loadReport

public IXDocReport loadReport(InputStream sourceStream,
                              TemplateEngineKind templateEngineKind)
                       throws IOException,
                              XDocReportException
Load report.

Parameters:
sourceStream -
templateEngine -
Returns:
Throws:
IOException
XDocReportException

loadReport

public IXDocReport loadReport(InputStream sourceStream,
                              TemplateEngineKind templateEngineKind,
                              boolean cacheReport)
                       throws IOException,
                              XDocReportException
Load report.

Parameters:
sourceStream -
templateEngine -
Returns:
Throws:
IOException
XDocReportException

createReport

public IXDocReport createReport(InputStream sourceStream)
                         throws IOException,
                                XDocReportException
Throws:
IOException
XDocReportException

createReport

public IXDocReport createReport(XDocArchive documentArchive)
                         throws IOException,
                                XDocReportException
Throws:
IOException
XDocReportException

registerReport

public void registerReport(IXDocReport report)
                    throws XDocReportException
Register report and throws XDocReportException if it already exists a report in the registry with the same id .

Parameters:
report -
Throws:
XDocReportException

registerReport

public void registerReport(IXDocReport report,
                           boolean force)
                    throws 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:
XDocReportException

checkReportId

public void checkReportId(String reportId)
                   throws XDocReportException
Check if registry can register the report with this id.

Parameters:
reportId -
Throws:
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 ITemplateCacheInfoProvider
Parameters:
id -
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

public void clear()
Clear the cached reports.


getMimeMapping

public MimeMapping getMimeMapping(String fileExtension)
                           throws IOException,
                                  XDocReportException
Returns mime mapping for the file extension.

Parameters:
fileExtension -
Returns:
Throws:
IOException
XDocReportException

generateUniqueReportId

public String generateUniqueReportId(String reportId)
Generate unique report id.

Parameters:
reportId -
Returns:

getTemplateCacheInfo

public IEntryInfo getTemplateCacheInfo(String reportId,
                                       String entryName)
Specified by:
getTemplateCacheInfo in interface ITemplateCacheInfoProvider

doDispose

protected void doDispose()
Specified by:
doDispose in class AbstractRegistry<IXDocReportFactoryDiscovery>

registerInstance

protected boolean registerInstance(IXDocReportFactoryDiscovery instance)
Description copied from class: AbstractRegistry
Register the instance in the registry.

Specified by:
registerInstance in class AbstractRegistry<IXDocReportFactoryDiscovery>
Returns:
true if instance cannot be registered and false otherwise.


Copyright © 2013. All rights reserved.