it.eng.spago.paginator.smart.impl
Class CacheablePageProvider

java.lang.Object
  extended byit.eng.spago.dispatching.service.DefaultRequestContext
      extended byit.eng.spago.paginator.smart.AbstractPageProvider
          extended byit.eng.spago.paginator.smart.impl.CacheablePageProvider
All Implemented Interfaces:
IFacePageProvider, InitializerIFace, RequestContextIFace, java.io.Serializable

public class CacheablePageProvider
extends AbstractPageProvider

La classe CacheablePageProvider è l'implementazione di default di AbstractPageProvider. Questa implementazione memorizza in anticipo le pagine per accelerare la navigazione della lista.

See Also:
AbstractListProvider, Serialized Form

Field Summary
 
Fields inherited from interface it.eng.spago.paginator.smart.IFacePageProvider
LAST
 
Constructor Summary
CacheablePageProvider()
          Costruisce un CacheablePageProvider.
 
Method Summary
 java.util.Collection getPage(int page)
          Ritorna un vettore con tutte le righe che formano la pagina di indice page richiesto.
 void init(SourceBean config)
          Questo metodo viene chiamato dal framework per inizializzare il componente.
protected  void retrievingPages(int page)
          Carica nella cache la pagina richiesta e quelle ad essa prossime fino a riempire la cache.
 
Methods inherited from class it.eng.spago.paginator.smart.AbstractPageProvider
getConfig, getCurrentPage, getPageSize, getRowProvider, hasToBeReloaded, pages, reload, setCurrentPage, setPages, setPageSize, setRequestContext, setRowProvider, toBeReloaded
 
Methods inherited from class it.eng.spago.dispatching.service.DefaultRequestContext
getErrorHandler, getRequestContainer, getResponseContainer, getServiceRequest, getServiceResponse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheablePageProvider

public CacheablePageProvider()
Costruisce un CacheablePageProvider. Ogni azione di inizializzazione è demandata al metodo init(SourceBean config) .

See Also:
AbstractPageProvider.init(SourceBean)
Method Detail

init

public void init(SourceBean config)
Questo metodo viene chiamato dal framework per inizializzare il componente. L'argomento passato è il SourceBean costruito a partire dal XML contenuto nell'eventuale sezione config relativa allo specifico page provider nel file /WEB-INF/conf/page_providers.xml. La sezione config è accessibile anche via
 ConfigSingleton configure = ConfigSingleton.getInstance();
 SourceBean config = (SourceBean) configure.getAttribute("PAGE_PROVIDERS.PAGE_PROVIDER.CONFIG");
 
I parametri attesi nella sezione config sono il numero di riche per pagina (ROWS) ed il numero di pagine da mantenere in cache (CACHESIZE). Di seguito è riportato un esempio di file di configurazione
 <?xml version="1.0" encoding="ISO-8859-1"?>
 <PAGE_PROVIDERS>
 <PAGE_PROVIDER
 name="CacheablePageProvider"
 class="it.eng.spago.paginator.CacheablePageProvider">
 <CONFIG rows="5" cacheSize="5"/>
 </PAGE_PROVIDER>
 </PAGE_PROVIDERS>
 

Specified by:
init in interface InitializerIFace
Overrides:
init in class AbstractPageProvider
Parameters:
config - SourceBean la configurazione del componente.

getPage

public java.util.Collection getPage(int page)
Ritorna un vettore con tutte le righe che formano la pagina di indice page richiesto. Se la pagina richiesta non è in cache provvede a caricare tanto la pagina quanto le pagine a questa vicine in modo da anticipare le richieste dell'utente.

Specified by:
getPage in interface IFacePageProvider
Specified by:
getPage in class AbstractPageProvider
Parameters:
page - int
Returns:
Collection

retrievingPages

protected void retrievingPages(int page)
Carica nella cache la pagina richiesta e quelle ad essa prossime fino a riempire la cache. Questo metodo viene invocato da getPage(int page)

Parameters:
page - int