Package com.sleepycat.je

Examples of com.sleepycat.je.DatabaseEntry


  boolean readOnly = true; boolean dupFlag = false; Cursor cursor = null;
  HashMap<String, String> hash = new HashMap<String, String> (size, (float) 0.95);
  try
  { openDB(dbName, readOnly, dupFlag);
    cursor = getCurrentDB().openCursor(null, null);
    DatabaseEntry key = new DatabaseEntry(); DatabaseEntry data = new DatabaseEntry();
    while (cursor.getNext(key, data, LockMode.DEFAULT) == OperationStatus.SUCCESS)
     { String skey = new String(key.getData(), "UTF-8");
       String sdata = tpb.entryToObject(data).toString();
       hash.put( skey, sdata );
     }
View Full Code Here


  try
  {
   pw = new PrintWriter( new BufferedOutputStream( new FileOutputStream(filename) ) );
   openDB(dbName, readOnly, dupFlag);
   cursor = getCurrentDB().openCursor(null, null);
   DatabaseEntry key = new DatabaseEntry(); DatabaseEntry data = new DatabaseEntry();
   while (cursor.getNext(key, data, LockMode.DEFAULT) == OperationStatus.SUCCESS)
   { String sdata = tpb.entryToObject(data).toString();
   pw.println(sdata);
   }
  }
View Full Code Here

private boolean checkIndexed(String iDocument)
{
  dbTime -= new Date().getTime();
  boolean indexedEarlier = false; boolean noCreateflag = false; boolean dupFlag = false;
  dbt.openDB(Constants.EXT_FILES_DB, noCreateflag, dupFlag);
  DatabaseEntry dbData = new DatabaseEntry();
  if (dbt.fetch(iDocument, dbData) )
  { long lastModified = new File(iDocument).lastModified();   //*-- get the last modified date 
  tempDoc = (IndexableDoc) tempBinding.entryToObject(dbData);

  //*-- if indexed earlier skip
View Full Code Here

  boolean duplicateDoc = false; boolean noCreateflag = false; boolean dupFlag = false;
  if (!crawlConfig.isKeepDups())
   { 
    dbt.openDB(Constants.EXT_FILES_DB, noCreateflag, dupFlag);
    dbt.openSecDB(Constants.EXT_FILES_SECDB, false, new SecKeyDoc( tempBinding ) )
    DatabaseEntry data = dbt.fetchSec(signatureKey);
    if (data != null)
    {
     IndexableDoc tDoc =  (IndexableDoc) tempBinding.entryToObject(data);
     String filename = tDoc.getFileName();
View Full Code Here

  ArrayList<String> delFiles = new ArrayList<String>();
  IndexableDoc idoc = new IndexableDoc();
  try
  {
   cursor = dbt.getCurrentDB().openCursor(null, null);
   DatabaseEntry key = new DatabaseEntry();
   DatabaseEntry data = new DatabaseEntry();
   LOOP: while (cursor.getNext(key, data, LockMode.DEFAULT) == OperationStatus.SUCCESS)
   {
    //*-- check if the file name exists in the filesystem
    if (!running) break LOOP;
    String filename = new String( key.getData(), "UTF-8");
View Full Code Here

  dbt.openDB(Constants.EXT_FILES_DB, true, false);
  Cursor cursor = null; IndexableDoc idoc = new IndexableDoc();
  try
  {
   cursor = dbt.getCurrentDB().openCursor(null, null);
   DatabaseEntry key = new DatabaseEntry();
   DatabaseEntry data = new DatabaseEntry(); int i = 0;
   LOOP: while (cursor.getNext(key, data, LockMode.DEFAULT) == OperationStatus.SUCCESS)
   {
    if (!running) break LOOP;
    idoc = (IndexableDoc) idoc.getBdbBinding().entryToObject(data);
    String docType = idoc.getFileType();
View Full Code Here

        Cursor cursor = null;
        List<String> list = new ArrayList<String>();

        try {
            try {
                DatabaseEntry key = new DatabaseEntry(new byte[0]);
                DatabaseEntry data = new DatabaseEntry(null);

                data.setPartial(true);
                // TODO see if cursor needs configuration
                cursor = files.openCursor(txn, null);
                // TODO see if LockMode should be set
                if (cursor.getNext(key, data, null) != OperationStatus.NOTFOUND) {
                    ByteArrayInputStream buffer = new ByteArrayInputStream(key
View Full Code Here

        Cursor cursor = null;
        try {
            cursor = index.openCursor(null, null);

            DatabaseEntry foundKey = new DatabaseEntry();
            DatabaseEntry foundData = new DatabaseEntry();

            if (cursor.getNext(foundKey, foundData, LockMode.DEFAULT) == OperationStatus.SUCCESS) {
                fail("index database is not empty");
            }
        } catch (DatabaseException e) {
            throw e;
        } finally {
            if (cursor != null)
                cursor.close();
        }

        cursor = null;
        try {
            cursor = blocks.openCursor(null, null);

            DatabaseEntry foundKey = new DatabaseEntry();
            DatabaseEntry foundData = new DatabaseEntry();

            if (cursor.getNext(foundKey, foundData, LockMode.DEFAULT) == OperationStatus.SUCCESS) {
                fail("blocks database is not empty");
            }
        } catch (DatabaseException e) {
View Full Code Here

                @Override
                public void processEntry(final Database sourceDatabase, final Database targetDatabase,
                        final Transaction transaction, final DatabaseEntry key, final DatabaseEntry value)
                {
                    QueueRecord record = binding.entryToObject(value);
                    DatabaseEntry newValue = new DatabaseEntry();
                    binding.objectToEntry(record, newValue);
                    targetDatabase.put(transaction, key, newValue);
                    existingQueues.add(record.getNameShortString().asString());
                    sourceDatabase.delete(transaction, key);
                }
View Full Code Here

                    }
                }

                if (!messagesToDiscard.contains(messageId))
                {
                    DatabaseEntry newKey = new DatabaseEntry();
                    queueEntryKeyBinding.objectToEntry(entryKey, newKey);
                    targetDatabase.put(transaction, newKey, value);

                }
            }
View Full Code Here

TOP

Related Classes of com.sleepycat.je.DatabaseEntry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.