org.apache.wicket.protocol.http.pagestore
Class SimpleSynchronousFilePageStore

java.lang.Object
  extended by org.apache.wicket.protocol.http.pagestore.AbstractPageStore
      extended by org.apache.wicket.protocol.http.pagestore.SimpleSynchronousFilePageStore
All Implemented Interfaces:
SecondLevelCacheSessionStore.IPageStore

public class SimpleSynchronousFilePageStore
extends AbstractPageStore

Very simple page store that uses separate file for each serialized page instance. Also this store doesn't use any worker threads.

This store is for demonstration purposes only and will perform badly in production.

Author:
Matej Knopp

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.wicket.protocol.http.pagestore.AbstractPageStore
AbstractPageStore.SerializedPage
 
Constructor Summary
SimpleSynchronousFilePageStore()
          Construct.
SimpleSynchronousFilePageStore(File workDir)
          Construct.
 
Method Summary
 boolean containsPage(String sessionId, String pageMapName, int pageId, int pageVersion)
          Returns whether the PageStore contains given page.
 void destroy()
          Destroy the store.
 Page getPage(String sessionId, String pageMapName, int pageId, int versionNumber, int ajaxVersionNumber)
          Restores a page version from the persistent layer.
protected  byte[] loadPageData(File workDir, String sessionId, String pageMapName, int pageId, int versionNumber, int ajaxVersionNumber)
           
 void pageAccessed(String sessionId, Page page)
          This method is called when the page is accessed.
 void removePage(String sessionId, String pageMapName, int pageId)
          Removes a page from the persistent layer.
protected  long savePageData(String sessionId, AbstractPageStore.SerializedPage page)
           
 void storePage(String sessionId, Page page)
          Stores the page to a persistent layer.
 void unbind(String sessionId)
          The pagestore should cleanup all the pages for that sessionid.
 
Methods inherited from class org.apache.wicket.protocol.http.pagestore.AbstractPageStore
deserializePage, serializePage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleSynchronousFilePageStore

public SimpleSynchronousFilePageStore(File workDir)
Construct.

Parameters:
workDir -

SimpleSynchronousFilePageStore

public SimpleSynchronousFilePageStore()
Construct.

Method Detail

destroy

public void destroy()
Description copied from interface: SecondLevelCacheSessionStore.IPageStore
Destroy the store.


loadPageData

protected byte[] loadPageData(File workDir,
                              String sessionId,
                              String pageMapName,
                              int pageId,
                              int versionNumber,
                              int ajaxVersionNumber)

getPage

public Page getPage(String sessionId,
                    String pageMapName,
                    int pageId,
                    int versionNumber,
                    int ajaxVersionNumber)
Description copied from interface: SecondLevelCacheSessionStore.IPageStore
Restores a page version from the persistent layer.

Note that the versionNumber and ajaxVersionNumber parameters may be -1.

Returns:
The page

pageAccessed

public void pageAccessed(String sessionId,
                         Page page)
Description copied from interface: SecondLevelCacheSessionStore.IPageStore
This method is called when the page is accessed. A IPageStore implementation can block until a save of that page version is done. So that a specific page version is always restore able.


savePageData

protected long savePageData(String sessionId,
                            AbstractPageStore.SerializedPage page)

removePage

public void removePage(String sessionId,
                       String pageMapName,
                       int pageId)
Description copied from interface: SecondLevelCacheSessionStore.IPageStore
Removes a page from the persistent layer.

Parameters:
sessionId - The session of the page that must be removed
pageMapName - The pagemap of the page that must be removed
pageId - The id of the page.

storePage

public void storePage(String sessionId,
                      Page page)
Description copied from interface: SecondLevelCacheSessionStore.IPageStore
Stores the page to a persistent layer. The page should be stored under the id and the version number.


unbind

public void unbind(String sessionId)
Description copied from interface: SecondLevelCacheSessionStore.IPageStore
The pagestore should cleanup all the pages for that sessionid.


containsPage

public boolean containsPage(String sessionId,
                            String pageMapName,
                            int pageId,
                            int pageVersion)
Description copied from interface: SecondLevelCacheSessionStore.IPageStore
Returns whether the PageStore contains given page.

Returns:
boolean If the page was found


Copyright © 2004-2011 Apache Software Foundation. All Rights Reserved.