org.apache.wicket.protocol.http
Class TestFilePageStore

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

public class TestFilePageStore
extends Object
implements SecondLevelCacheSessionStore.IPageStore

Stores pages on disk.

Override getWorkDir() to change the default directory for pages, which is configured from the javax.servlet.context.tempdir attribute in the servlet context.

Author:
jcompagner

Field Summary
protected static org.slf4j.Logger log
          log.
 
Constructor Summary
TestFilePageStore()
          Construct.
TestFilePageStore(File dir)
          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.
<T> Page
getPage(String sessionId, String pagemap, int id, int versionNumber, int ajaxVersionNumber)
          Restores a page version from the persistent layer.
 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.
 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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.slf4j.Logger log
log.

Constructor Detail

TestFilePageStore

public TestFilePageStore()
Construct.


TestFilePageStore

public TestFilePageStore(File dir)
Construct.

Parameters:
dir - The directory to save to.
Method Detail

destroy

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

Specified by:
destroy in interface SecondLevelCacheSessionStore.IPageStore

getPage

public <T> Page getPage(String sessionId,
                        String pagemap,
                        int id,
                        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.

Specified by:
getPage in interface SecondLevelCacheSessionStore.IPageStore
Type Parameters:
T - type of page
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.

Specified by:
pageAccessed in interface SecondLevelCacheSessionStore.IPageStore

removePage

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

Specified by:
removePage in interface SecondLevelCacheSessionStore.IPageStore
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.

Specified by:
storePage in interface SecondLevelCacheSessionStore.IPageStore

unbind

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

Specified by:
unbind in interface SecondLevelCacheSessionStore.IPageStore

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.

Specified by:
containsPage in interface SecondLevelCacheSessionStore.IPageStore
Returns:
boolean If the page was found


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