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

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

public abstract class AbstractPageStore
extends Object
implements SecondLevelCacheSessionStore.IPageStore

Abstract page store that implements the serialization logic so that the subclasses can concentrate on actual storing of serialized page instances.

Author:
Matej Knopp

Nested Class Summary
protected static class AbstractPageStore.SerializedPage
          Immutable class that contains a serialized page instance.
 
Constructor Summary
AbstractPageStore()
           
 
Method Summary
protected  Page deserializePage(byte[] data, int versionNumber)
          Creates a page instance from given byte array.
protected  List<AbstractPageStore.SerializedPage> serializePage(Page page)
          Creates a list of AbstractPageStore.SerializedPage instances obtained from serializing the provided page.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.wicket.protocol.http.SecondLevelCacheSessionStore.IPageStore
containsPage, destroy, getPage, pageAccessed, removePage, storePage, unbind
 

Constructor Detail

AbstractPageStore

public AbstractPageStore()
Method Detail

serializePage

protected List<AbstractPageStore.SerializedPage> serializePage(Page page)
Creates a list of AbstractPageStore.SerializedPage instances obtained from serializing the provided page.

One page instance can be serialized to multiple AbstractPageStore.SerializedPage instances, because each referenced page is serialized separately and should also be separately saved On deserialization wicket detects a page instance placeholder and loads the appropriate page.

As an example, when there is PageA that has a member variable of type PageB, serializing instanceof PageA will result in a list of two AbstractPageStore.SerializedPage instances, one for PageA and another one for the referenced PageB.

Parameters:
page - page to be serialized
Returns:
list of AbstractPageStore.SerializedPages

deserializePage

protected Page deserializePage(byte[] data,
                               int versionNumber)
Creates a page instance from given byte array. Optionally gets the specified version of the page.

Parameters:
data - Serialized page instance data as byte array
versionNumber - Requested page version or -1 if original version (the one serialized) should be kept
Returns:
page instance


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