[jboss-cvs] JBossCache/src/org/jboss/cache/loader/bdbje ...
Vladmir Blagojevic
vladimir.blagojevic at jboss.com
Tue Sep 12 16:16:55 EDT 2006
User: vblagojevic
Date: 06/09/12 16:16:55
Modified: src/org/jboss/cache/loader/bdbje BdbjeCacheLoader.java
Log:
store/load moved to AbstractCacheLoader
Revision Changes Path
1.14 +1 -149 JBossCache/src/org/jboss/cache/loader/bdbje/BdbjeCacheLoader.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: BdbjeCacheLoader.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/loader/bdbje/BdbjeCacheLoader.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- BdbjeCacheLoader.java 31 Aug 2006 14:56:47 -0000 1.13
+++ BdbjeCacheLoader.java 12 Sep 2006 20:16:55 -0000 1.14
@@ -49,7 +49,7 @@
*
* @author Mark Hayes May 16, 2004
* @author Bela Ban
- * @version $Id: BdbjeCacheLoader.java,v 1.13 2006/08/31 14:56:47 vblagojevic Exp $
+ * @version $Id: BdbjeCacheLoader.java,v 1.14 2006/09/12 20:16:55 vblagojevic Exp $
*/
public class BdbjeCacheLoader extends AbstractCacheLoader
{
@@ -822,154 +822,6 @@
}
/**
- * Export the contents of the databases as a byte array.
- * If the databases are empty a zero-lenth array is returned.
- * The export format is two consecutive DbDumps.
- */
-
- /*
- * kept as a reference until
- * http://jira.jboss.com/jira/browse/JBCACHE-749
- * is fixed
- *
- * public byte[] loadEntireState()
- throws Exception {
-
- checkOpen();
-
- boolean isEmpty;
- Cursor cursor = cacheDb.openCursor(null, null);
- try {
- isEmpty = cursor.getFirst(new DatabaseEntry(),
- new DatabaseEntry(),
- null) != OperationStatus.SUCCESS;
- } finally {
- cursor.close();
- }
- if (isEmpty) {
- return new byte[0];
- } else {
- ByteArrayOutputStream baos = new ByteArrayOutputStream(4096);
- PrintStream ps = new PrintStream(baos, false, "US-ASCII");
- dumpDatabase(cacheDbName, ps);
- dumpDatabase(catalogDbName, ps);
- ps.flush();
- return baos.toByteArray();
- }
- }*/
-
- /**
- * Dumps one database in ASCII format and adds a DATA=END marker line.
- */
- private void dumpDatabase(String dbName, PrintStream ps)
- throws Exception {
-
- DbDump dumper = new DbDump(env, dbName, ps, false);
- dumper.dump();
- }
-
- /**
- * Replace the contents of the databases with the given exported data.
- * If state is null or zero-length, the databases will be cleared.
- * The export format is two consecutive DbDumps.
- *
- * kept as a reference until
- * http://jira.jboss.com/jira/browse/JBCACHE-749
- * is fixed
- */
- /*public void storeEntireState(byte[] state)
- throws Exception {
-
- checkOpen();
-
- closeDatabases();
- env.removeDatabase(null, cacheDbName);
- env.removeDatabase(null, catalogDbName);
- if (state != null && state.length > 0) {
- BufferedReader reader = new BufferedReader
- (new InputStreamReader(new ByteArrayInputStream(state)));
- loadDatabase(cacheDbName, reader);
- loadDatabase(catalogDbName, reader);
- }
- openDatabases();
- }*/
-
- /*
- * http://jira.jboss.com/jira/browse/JBCACHE-749
- *
- *
- * */
- public void loadEntireState(ObjectOutputStream os) throws Exception
- {
- checkOpen();
-
- boolean isEmpty;
- Cursor cursor = cacheDb.openCursor(null, null);
- try {
- isEmpty = cursor.getFirst(new DatabaseEntry(),
- new DatabaseEntry(),
- null) != OperationStatus.SUCCESS;
- } finally {
- cursor.close();
- }
- if (!isEmpty) {
- PrintStream ps = new PrintStream(os, false, "US-ASCII");
- dumpDatabase(cacheDbName, ps);
- dumpDatabase(catalogDbName, ps);
- ps.flush();
- }
- }
-
- public void loadState(Fqn subtree, ObjectOutputStream os) throws Exception
- {
- throw new UnsupportedOperationException("setting and loading state for specific Fqns not supported");
- }
-
- /*
- * http://jira.jboss.com/jira/browse/JBCACHE-749
- *
- *
- * */
- public void storeEntireState(ObjectInputStream is) throws Exception
- {
- checkOpen();
-
- closeDatabases();
- env.removeDatabase(null, cacheDbName);
- env.removeDatabase(null, catalogDbName);
- if(is.available()>0)
- {
- BufferedReader reader = new BufferedReader(new InputStreamReader(is));
- loadDatabase(cacheDbName, reader);
- loadDatabase(catalogDbName, reader);
- }
- openDatabases();
-
- }
-
- public void storeState(Fqn subtree, ObjectInputStream is) throws Exception
- {
- throw new UnsupportedOperationException("setting and loading state for specific Fqns not supported");
- }
-
- /**
- * Loads one database in ASCII format, stopping at the DATA=END marker line
- * or EOF.
- */
- private void loadDatabase(String dbName, BufferedReader reader)
- throws Exception {
-
- DbLoad loader = new DbLoad();
- loader.setEnv(env);
- loader.setDbName(dbName);
- loader.setInputReader(reader);
- loader.setNoOverwrite(false);
- loader.setTextFileMode(false);
- loader.setIgnoreUnknownConfig(true);
- loader.load();
- }
-
- /**
* Returns whether the given entry starts with the given prefix bytes.
* Used to determine whether a database key starts with a given FQN.
*/
More information about the jboss-cvs-commits
mailing list