org.apache.wicket.pageStore
Class DiskDataStore

java.lang.Object
  extended by org.apache.wicket.pageStore.DiskDataStore
All Implemented Interfaces:
IDataStore
Direct Known Subclasses:
DebugDiskDataStore

public class DiskDataStore
extends java.lang.Object
implements IDataStore

A data store implementation which stores the data on disk (in a file system)


Nested Class Summary
protected static class DiskDataStore.SessionEntry
           
 
Constructor Summary
DiskDataStore(java.lang.String applicationName, java.io.File fileStoreFolder, Bytes maxSizePerSession)
          Construct.
 
Method Summary
 void destroy()
          Properly close the data store and possibly open resource handles
 byte[] getData(java.lang.String sessionId, int id)
          Get data associated with the session id and page id.
protected  DiskDataStore.SessionEntry getSessionEntry(java.lang.String sessionId, boolean create)
           
protected  java.io.File getSessionFolder(java.lang.String sessionId, boolean create)
          Returns the folder for the specified sessions.
protected  java.io.File getStoreFolder()
          This folder contains sub-folders named as the session id for which they hold the data.
 boolean isReplicated()
           
 void removeData(java.lang.String sessionId)
          Remove all page data for the session id
 void removeData(java.lang.String sessionId, int id)
          Remove all persisted data related to the session id and page id
 void storeData(java.lang.String sessionId, int id, byte[] data)
          Store the page data
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DiskDataStore

public DiskDataStore(java.lang.String applicationName,
                     java.io.File fileStoreFolder,
                     Bytes maxSizePerSession)
Construct.

Parameters:
applicationName -
fileStoreFolder -
maxSizePerSession -
fileChannelPoolCapacity -
Method Detail

destroy

public void destroy()
Description copied from interface: IDataStore
Properly close the data store and possibly open resource handles

Specified by:
destroy in interface IDataStore
See Also:
IDataStore.destroy()

getData

public byte[] getData(java.lang.String sessionId,
                      int id)
Description copied from interface: IDataStore
Get data associated with the session id and page id.

Specified by:
getData in interface IDataStore
Parameters:
sessionId - Session ID
id - Page ID
Returns:
All the page data persisted
See Also:
IDataStore.getData(java.lang.String, int)

isReplicated

public boolean isReplicated()
Specified by:
isReplicated in interface IDataStore
Returns:
whether the data store is replicated
See Also:
IDataStore.isReplicated()

removeData

public void removeData(java.lang.String sessionId,
                       int id)
Description copied from interface: IDataStore
Remove all persisted data related to the session id and page id

Specified by:
removeData in interface IDataStore
Parameters:
sessionId - Session ID
id - Page ID
See Also:
IDataStore.removeData(java.lang.String, int)

removeData

public void removeData(java.lang.String sessionId)
Description copied from interface: IDataStore
Remove all page data for the session id

Specified by:
removeData in interface IDataStore
Parameters:
sessionId - Session ID
See Also:
IDataStore.removeData(java.lang.String)

storeData

public void storeData(java.lang.String sessionId,
                      int id,
                      byte[] data)
Description copied from interface: IDataStore
Store the page data

Specified by:
storeData in interface IDataStore
Parameters:
sessionId - Session ID
id - Page ID
data - Page data
See Also:
IDataStore.storeData(java.lang.String, int, byte[])

getSessionEntry

protected DiskDataStore.SessionEntry getSessionEntry(java.lang.String sessionId,
                                                     boolean create)
Parameters:
sessionId -
create -
Returns:
the session entry

getStoreFolder

protected java.io.File getStoreFolder()
This folder contains sub-folders named as the session id for which they hold the data.

Returns:
the folder where the pages are stored

getSessionFolder

protected java.io.File getSessionFolder(java.lang.String sessionId,
                                        boolean create)
Returns the folder for the specified sessions. If the folder doesn't exist and the create flag is set, the folder will be created.

Parameters:
sessionId -
create -
Returns:
folder used to store session data


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