Class CassandraDataStore
- java.lang.Object
-
- org.apache.wicket.pageStore.AbstractPersistentPageStore
-
- org.wicketstuff.datastores.cassandra.CassandraDataStore
-
- All Implemented Interfaces:
IPageStore,IPersistentPageStore
public class CassandraDataStore extends AbstractPersistentPageStore implements IPersistentPageStore
A store that saves serialiazed pages in Apache Cassandra.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.wicket.pageStore.AbstractPersistentPageStore
AbstractPersistentPageStore.PersistedPage
-
-
Constructor Summary
Constructors Constructor Description CassandraDataStore(String applicationName, com.datastax.driver.core.Cluster cluster, ICassandraSettings settings)Constructor.CassandraDataStore(String applicationName, ICassandraSettings settings)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddPersistedPage(String identifier, IManageablePage page)protected com.datastax.driver.core.KeyspaceMetadatacreateKeyspaceIfNecessary(String keyspaceName, com.datastax.driver.core.Metadata metadata)Creates the Cassandra keyspace where the data will be stored if it doesn't exists alreadyprotected voidcreateTableIfNecessary(String keyspaceName, com.datastax.driver.core.KeyspaceMetadata keyspaceMetadata)Creates the table where the data will be stored if it doesn't exists alreadyvoiddestroy()protected IManageablePagegetPersistedPage(String sessionIdentifier, int pageId)List<IPersistedPage>getPersistedPages(String contextIdentifier)Set<String>getSessionIdentifiers()BytesgetTotalSize()protected voidremoveAllPersistedPages(String identifier)protected voidremovePersistedPage(String identifier, IManageablePage page)booleansupportsVersioning()Pages are always serialized, so versioning is supported.-
Methods inherited from class org.apache.wicket.pageStore.AbstractPersistentPageStore
addPage, canBeAsynchronous, createSessionIdentifier, getPage, getSessionIdentifier, removeAllPages, removePage
-
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.pageStore.IPageStore
addPage, canBeAsynchronous, detach, end, getPage, removeAllPages, removePage, revertPage
-
Methods inherited from interface org.apache.wicket.pageStore.IPersistentPageStore
getSessionIdentifier
-
-
-
-
Constructor Detail
-
CassandraDataStore
public CassandraDataStore(String applicationName, ICassandraSettings settings)
Constructor. Creates a Cluster based on the contact points provided by the passed settings- Parameters:
settings- The various settings
-
CassandraDataStore
public CassandraDataStore(String applicationName, com.datastax.driver.core.Cluster cluster, ICassandraSettings settings)
Constructor. Initializes the connection to the Cassandra cluster and creates the keyspace and/or table if necessary.- Parameters:
cluster- The Cassandra clustersettings- The various settings
-
-
Method Detail
-
getPersistedPage
protected IManageablePage getPersistedPage(String sessionIdentifier, int pageId)
- Specified by:
getPersistedPagein classAbstractPersistentPageStore
-
removePersistedPage
protected void removePersistedPage(String identifier, IManageablePage page)
- Specified by:
removePersistedPagein classAbstractPersistentPageStore
-
removeAllPersistedPages
protected void removeAllPersistedPages(String identifier)
- Specified by:
removeAllPersistedPagesin classAbstractPersistentPageStore
-
addPersistedPage
protected void addPersistedPage(String identifier, IManageablePage page)
- Specified by:
addPersistedPagein classAbstractPersistentPageStore
-
destroy
public void destroy()
- Specified by:
destroyin interfaceIPageStore- Overrides:
destroyin classAbstractPersistentPageStore
-
supportsVersioning
public boolean supportsVersioning()
Pages are always serialized, so versioning is supported.- Specified by:
supportsVersioningin interfaceIPageStore
-
createTableIfNecessary
protected void createTableIfNecessary(String keyspaceName, com.datastax.driver.core.KeyspaceMetadata keyspaceMetadata)
Creates the table where the data will be stored if it doesn't exists already- Parameters:
keyspaceName- The name of the keyspace where to create the tablekeyspaceMetadata- The keyspace metadata. May benullif this is the first usage of this store with these settings
-
createKeyspaceIfNecessary
protected com.datastax.driver.core.KeyspaceMetadata createKeyspaceIfNecessary(String keyspaceName, com.datastax.driver.core.Metadata metadata)
Creates the Cassandra keyspace where the data will be stored if it doesn't exists already- Parameters:
keyspaceName- The name of the keyspacemetadata- The cluster metadata- Returns:
- The keyspace metadata. May be
nullif the the metadata doesn't exists yet.
-
getSessionIdentifiers
public Set<String> getSessionIdentifiers()
- Specified by:
getSessionIdentifiersin interfaceIPersistentPageStore
-
getTotalSize
public Bytes getTotalSize()
- Specified by:
getTotalSizein interfaceIPersistentPageStore
-
getPersistedPages
public List<IPersistedPage> getPersistedPages(String contextIdentifier)
- Specified by:
getPersistedPagesin interfaceIPersistentPageStore
-
-