Examples of Storage


Examples of org.garret.perst.Storage

    new XStreamFile(xstreamFile).write((Set) db.getRoot());
    db.close();
  }

  public void fromXML() {
    Storage db = StorageFactory.getInstance().createStorage();
    db.open(databaseFile);
    db.setRoot(db.createSet());
    for (Object obj : new XStreamFile(xstreamFile).read()) {
      ((Set) db.getRoot()).add(obj);
      db.store(obj);
    }
    db.commit();
    db.close();
  }
View Full Code Here

Examples of org.geotools.caching.spatialindex.Storage

        return new TestSuite(DiskStorageTest.class);
    }

    @Override
    Storage createStorage() {
        Storage storage = DiskStorage.createInstance();

        return storage;
    }
View Full Code Here

Examples of org.hsqldb.lib.Storage

        HsqlArrayList allTables = database.schemaManager.getAllTables();

        rootsList = new int[allTables.size()][];

        Storage dest = null;

        try {
            OutputStream fos =
                database.logger.getFileAccess().openOutputStreamElement(
                    dataFileName + ".new");

            fileStreamOut = new BufferedOutputStream(fos, 1 << 12);

            for (int i = 0; i < cache.initialFreePos; i++) {
                fileStreamOut.write(0);
            }

            fileOffset = cache.initialFreePos;

            for (int i = 0, tSize = allTables.size(); i < tSize; i++) {
                Table t = (Table) allTables.get(i);

                if (t.getTableType() == TableBase.CACHED_TABLE) {
                    int[] rootsArray = writeTableToDataFile(t);

                    rootsList[i] = rootsArray;
                } else {
                    rootsList[i] = null;
                }

                Error.printSystemOut("table: " + t.getName().name
                                     + " complete");
            }

            fileStreamOut.flush();
            fileStreamOut.close();

            fileStreamOut = null;

            // write out the end of file position
            int type = database.logger.isStoredFileAccess()
                       ? ScaledRAFile.DATA_FILE_STORED
                       : ScaledRAFile.DATA_FILE_RAF;

            dest = ScaledRAFile.newScaledRAFile(database,
                                                dataFileName + ".new", false,
                                                type);

            dest.seek(DataFileCache.LONG_FREE_POS_POS);
            dest.writeLong(fileOffset);

            // set shadowed flag;
            int flags = 0;

            if (database.logger.propIncrementBackup) {
                flags = BitMap.set(flags, DataFileCache.FLAG_ISSHADOWED);
            }

            flags = BitMap.set(flags, DataFileCache.FLAG_190);
            flags = BitMap.set(flags, DataFileCache.FLAG_ISSAVED);

            dest.seek(DataFileCache.FLAGS_POS);
            dest.writeInt(flags);
            dest.close();

            dest = null;

            for (int i = 0, size = rootsList.length; i < size; i++) {
                int[] roots = rootsList[i];

                if (roots != null) {
                    Error.printSystemOut(
                        "roots: "
                        + org.hsqldb.lib.StringUtil.getList(roots, ",", ""));
                }
            }

            complete = true;
        } catch (IOException e) {
            throw Error.error(ErrorCode.FILE_IO_ERROR, e);
        } catch (OutOfMemoryError e) {
            throw Error.error(ErrorCode.OUT_OF_MEMORY, e);
        } catch (Throwable t) {
            throw Error.error(ErrorCode.GENERAL_ERROR, t);
        } finally {
            try {
                if (fileStreamOut != null) {
                    fileStreamOut.close();
                }

                if (dest != null) {
                    dest.close();
                }
            } catch (Throwable t) {
                database.logger.logSevereEvent("backupFile failed", t);
            }
View Full Code Here

Examples of org.hsqldb.lib.Storage

    // buggy database files had size == position == 0 at the end
    public static void restoreFile(Database database, String sourceName,
                                   String destName) throws IOException {

        Storage source = getStorage(database, sourceName, "r");
        Storage dest   = getStorage(database, destName, "rw");

        while (source.getFilePointer() != source.length()) {
            int    size     = source.readInt();
            long   position = source.readLong();
            byte[] buffer   = new byte[size];

            source.read(buffer, 0, buffer.length);
            dest.seek(position);
            dest.write(buffer, 0, buffer.length);
        }

        source.close();
        dest.close();
    }
View Full Code Here

Examples of org.hsqldb_voltpatches.lib.Storage

        HsqlArrayList allTables = database.schemaManager.getAllTables();

        rootsList = new int[allTables.size()][];

        Storage dest = null;

        try {
            OutputStream fos =
                database.getFileAccess().openOutputStreamElement(filename
                    + ".new");

            fileStreamOut = new BufferedOutputStream(fos, 1 << 12);

            for (int i = 0; i < DataFileCache.INITIAL_FREE_POS; i++) {
                fileStreamOut.write(0);
            }

            fileOffset = DataFileCache.INITIAL_FREE_POS;

            for (int i = 0, tSize = allTables.size(); i < tSize; i++) {
                Table t = (Table) allTables.get(i);

                if (t.getTableType() == TableBase.CACHED_TABLE) {
                    int[] rootsArray = writeTableToDataFile(t);

                    rootsList[i] = rootsArray;
                } else {
                    rootsList[i] = null;
                }

                Error.printSystemOut(t.getName().name + " complete");
            }

            writeTransactionRows();
            fileStreamOut.flush();
            fileStreamOut.close();

            fileStreamOut = null;

            // write out the end of file position
            dest = ScaledRAFile.newScaledRAFile(
                database, filename + ".new", false,
                ScaledRAFile.DATA_FILE_RAF,
                database.getURLProperties().getProperty("storage_class_name"),
                database.getURLProperties().getProperty("storage_key"));

            dest.seek(DataFileCache.LONG_FREE_POS_POS);
            dest.writeLong(fileOffset);
            dest.close();

            dest = null;

            for (int i = 0, size = rootsList.length; i < size; i++) {
                int[] roots = rootsList[i];

                if (roots != null) {
                    Error.printSystemOut(
                        org.hsqldb_voltpatches.lib.StringUtil.getList(roots, ",", ""));
                }
            }

            complete = true;
        } catch (IOException e) {
            throw Error.error(ErrorCode.FILE_IO_ERROR, filename + ".new");
        } catch (OutOfMemoryError e) {
            throw Error.error(ErrorCode.OUT_OF_MEMORY);
        } finally {
            if (fileStreamOut != null) {
                fileStreamOut.close();
            }

            if (dest != null) {
                dest.close();
            }

            if (!complete) {
                database.getFileAccess().removeElement(filename + ".new");
            }
View Full Code Here

Examples of org.voltdb.planner.PlanColumn.Storage

    @Test
    public void testDuplicateColumns() {
        AbstractExpression expression = new NullValueExpression();
        String columnName = "TABLEA.A_ID";
        SortOrder sortOrder = SortOrder.kUnsorted;
        Storage storage = Storage.kTemporary;
       
        PlanColumn col0 = context.getPlanColumn(expression, columnName, sortOrder, storage);
        assertNotNull(col0);
//        System.err.println(col0 + " ==> " + col0.hashCode());
       
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.