Author: jason.greene(a)jboss.com
Date: 2008-10-14 21:11:16 -0400 (Tue, 14 Oct 2008)
New Revision: 6954
Modified:
core/branches/flat/src/main/java/org/jboss/starobrno/CacheSPI.java
core/branches/flat/src/main/java/org/jboss/starobrno/loader/CacheLoader.java
Log:
start of cache loader port
Modified: core/branches/flat/src/main/java/org/jboss/starobrno/CacheSPI.java
===================================================================
--- core/branches/flat/src/main/java/org/jboss/starobrno/CacheSPI.java 2008-10-15 01:02:20
UTC (rev 6953)
+++ core/branches/flat/src/main/java/org/jboss/starobrno/CacheSPI.java 2008-10-15 01:11:16
UTC (rev 6954)
@@ -21,23 +21,28 @@
*/
package org.jboss.starobrno;
+import java.util.List;
+
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+
import net.jcip.annotations.ThreadSafe;
+
+import org.jboss.cache.Node;
+import org.jboss.cache.NodeSPI;
import org.jboss.cache.buddyreplication.BuddyManager;
import org.jboss.cache.buddyreplication.GravitateResult;
import org.jboss.cache.loader.CacheLoaderManager;
import org.jboss.cache.marshall.Marshaller;
-import org.jboss.starobrno.statetransfer.StateTransferManager;
import org.jboss.starobrno.context.InvocationContext;
import org.jboss.starobrno.factories.ComponentRegistry;
import org.jboss.starobrno.interceptors.base.CommandInterceptor;
+import org.jboss.starobrno.loader.CacheLoader;
import org.jboss.starobrno.notifications.Notifier;
+import org.jboss.starobrno.statetransfer.StateTransferManager;
import org.jboss.starobrno.transaction.GlobalTransaction;
import org.jboss.starobrno.transaction.TransactionTable;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-import java.util.List;
-
/**
* A more detailed interface to {@link Cache}, which is used when writing plugins for or
extending JBoss Cache. A reference
* to this interface should only be obtained when it is passed in to your code, for
example when you write an
Modified: core/branches/flat/src/main/java/org/jboss/starobrno/loader/CacheLoader.java
===================================================================
---
core/branches/flat/src/main/java/org/jboss/starobrno/loader/CacheLoader.java 2008-10-15
01:02:20 UTC (rev 6953)
+++
core/branches/flat/src/main/java/org/jboss/starobrno/loader/CacheLoader.java 2008-10-15
01:11:16 UTC (rev 6954)
@@ -21,18 +21,19 @@
*/
package org.jboss.starobrno.loader;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.List;
+import java.util.Map;
+
import net.jcip.annotations.ThreadSafe;
+
import org.jboss.cache.Fqn;
-import org.jboss.cache.Modification;
import org.jboss.cache.loader.AbstractCacheLoader;
import org.jboss.starobrno.CacheSPI;
import org.jboss.starobrno.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
+import org.jboss.starobrno.marshall.EntryData;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.util.List;
-import java.util.Map;
-
/**
* A {@link org.jboss.cache.loader.CacheLoader} implementation persists and load keys to
and from
* secondary storage, such as a database or filesystem. Typically,
@@ -99,7 +100,7 @@
* null if the node is not found. If the node is found but has no
* attributes, this method returns an empty Map.
*/
- V get(Object key) throws Exception;
+ V get(Object key);
/**
@@ -107,30 +108,43 @@
*
* @return true if node exists, false otherwise
*/
- boolean exists(Object key) throws Exception;
+ boolean exists(Object key);
/**
* Puts a key and value into the attribute map of a given node. If the
* node does not exist, all parent nodes from the root down are created
* automatically. Returns the old value.
*/
- V put(Object key, V value) throws Exception;
+ V put(Object key, V value) ;
/**
* Removes the given key and value from the attributes of the given node.
* Does nothing if the node doesn't exist
* Returns the removed value.
*/
- V remove(Object key, V value) throws Exception;
+ V remove(Object key, V value);
/**
+ * Removes everything from this cache-loader
+ */
+ void clear();
+
+ /**
* Removes the given node and all its subnodes, does nothing if the node does not
exist.
*
* @param fqn the {@link Fqn} of the node
*/
- void remove(Object key) throws Exception;
+ void remove(Object key);
+ /**
+ * Retrieves all entries stored in this cache loader
+ *
+ * @return All entries
+ * @throws Exception on error
+ */
+ List<EntryData<K, V>> getAllEntries();
+
/**
* Prepares a list of modifications. For example, for a DB-based CacheLoader:
* <ol>
@@ -147,7 +161,7 @@
* we won't get a {@link #commit(Object)} or {@link
#rollback(Object)} method call later
* @throws Exception
*/
- void prepare(Object tx, List<Modification> modifications, boolean one_phase)
throws Exception;
+ void prepare(Object tx, List<Modification> modifications, boolean one_phase);
/**
* Commits the transaction. A DB-based CacheLoader would look up the local
@@ -160,7 +174,7 @@
*
* @param tx transaction to commit
*/
- void commit(Object tx) throws Exception;
+ void commit(Object tx);
/**
* Rolls the transaction back. A DB-based CacheLoader would look up the
@@ -191,7 +205,7 @@
* @see AbstractCacheLoader#loadEntireState(ObjectOutputStream)
* @see org.jboss.starobrno.marshall.NodeData
*/
- void loadEntireState(ObjectOutputStream os) throws Exception;
+ void loadEntireState(ObjectOutputStream os);
/**
* Stores the entire state for this cache by reading it from a provided
ObjectInputStream.
@@ -211,21 +225,21 @@
* @see AbstractCacheLoader#storeEntireState(ObjectInputStream)
* @see org.jboss.starobrno.marshall.NodeData
*/
- void storeEntireState(ObjectInputStream is) throws Exception;
+ void storeEntireState(ObjectInputStream is);
/**
* Lifecycle method, called when the cache loader is created.
*
* @throws java.lang.Exception
*/
- void create() throws java.lang.Exception;
+ void create();
/**
* Lifecycle method, called when the cache loader is started.
*
* @throws java.lang.Exception
*/
- void start() throws java.lang.Exception;
+ void start();
/**
* Lifecycle method, called when the cache loader is stopped.
Show replies by date