Package org.hsqldb.persist

Examples of org.hsqldb.persist.DataFileCache


        final int ifree_count      = 6;
        final int ifree_pos        = 7;

        //
        PersistentStore store = database.persistentStoreCollection.getStore(t);
        DataFileCache   cache = null;
        Object[]        row;
        HashSet         cacheSet;
        Iterator        caches;
        Iterator        tables;
        Table           table;
        int             iFreeBytes;
        int             iLargestFreeItem;
        long            lSmallestFreeItem;

        // Initialization
        cacheSet = new HashSet();

        // dynamic system tables are never cached
        tables =
            database.schemaManager.databaseObjectIterator(SchemaObject.TABLE);

        while (tables.hasNext()) {
            table = (Table) tables.next();

            PersistentStore currentStore =
                database.persistentStoreCollection.getStore(t);

            if (session.getGrantee().isFullyAccessibleByRole(table)) {
                if (currentStore != null) {
                    cache = currentStore.getCache();
                }

                if (cache != null) {
                    cacheSet.add(cache);
                }
            }
        }

        caches = cacheSet.iterator();

        // Do it.
        while (caches.hasNext()) {
            cache = (DataFileCache) caches.next();
            row   = t.getEmptyRowData();
            row[icache_file] =
                FileUtil.getDefaultInstance().canonicalOrAbsolutePath(
                    cache.getFileName());
            row[imax_cache_sz]    = ValuePool.getInt(cache.capacity());
            row[imax_cache_bytes] = ValuePool.getLong(cache.bytesCapacity());
            row[icache_size] = ValuePool.getInt(cache.getCachedObjectCount());
            row[icache_length] =
                ValuePool.getLong(cache.getTotalCachedBlockSize());
            row[ifree_bytes] = ValuePool.getInt(cache.getTotalFreeBlockSize());
            row[ifree_count] = ValuePool.getInt(cache.getFreeBlockCount());
            row[ifree_pos]   = ValuePool.getLong(cache.getFileFreePos());

            t.insertSys(store, row);
        }

        return t;
View Full Code Here


            t.createPrimaryKey(null, new int[]{ 0 }, true);

            return t;
        }

        DataFileCache cache;
        Object[]      row;
        HashSet       cacheSet;
        Iterator      caches;
        Iterator      tables;
        Table         table;
        int           iFreeBytes;
        int           iLargestFreeItem;
        long          lSmallestFreeItem;

        // column number mappings
        final int icache_file      = 0;
        final int imax_cache_sz    = 1;
        final int imax_cache_bytes = 2;
        final int icache_size      = 3;
        final int icache_length    = 4;
        final int ifree_bytes      = 5;
        final int ifree_count      = 6;
        final int ifree_pos        = 7;

        // Initialization
        cacheSet = new HashSet();

        // dynamic system tables are never cached
        tables = database.schemaManager.allTablesIterator();

        while (tables.hasNext()) {
            table = (Table) tables.next();

            if (table.isFileBased() && isAccessibleTable(table)) {
                cache = table.getCache();

                if (cache != null) {
                    cacheSet.add(cache);
                }
            }
        }

        caches = cacheSet.iterator();

        // Do it.
        while (caches.hasNext()) {
            cache = (DataFileCache) caches.next();
            row   = t.getEmptyRowData();
            row[icache_file] =
                FileUtil.canonicalOrAbsolutePath(cache.getFileName());
            row[imax_cache_sz]    = ValuePool.getInt(cache.capacity());
            row[imax_cache_bytes] = ValuePool.getLong(cache.bytesCapacity());
            row[icache_size] = ValuePool.getInt(cache.getCachedObjectCount());
            row[icache_length] =
                ValuePool.getLong(cache.getTotalCachedBlockSize());
            row[ifree_bytes] = ValuePool.getInt(cache.getTotalFreeBlockSize());
            row[ifree_count] = ValuePool.getInt(cache.getFreeBlockCount());
            row[ifree_pos]   = ValuePool.getLong(cache.getFileFreePos());

            t.insertSys(row);
        }

        t.setDataReadOnly(true);
View Full Code Here

            t.createPrimaryKey(null, new int[]{ 0 }, true);

            return t;
        }

        DataFileCache cache;
        Object[]      row;
        HashSet       cacheSet;
        Iterator      caches;
        Iterator      tables;
        Table         table;
        int           iFreeBytes;
        int           iLargestFreeItem;
        long          lSmallestFreeItem;

        // column number mappings
        final int icache_file      = 0;
        final int imax_cache_sz    = 1;
        final int imax_cache_bytes = 2;
        final int icache_size      = 3;
        final int icache_length    = 4;
        final int ifree_bytes      = 5;
        final int ifree_count      = 6;
        final int ifree_pos        = 7;

        // Initialization
        cacheSet = new HashSet();

        // dynamic system tables are never cached
        tables = database.schemaManager.allTablesIterator();

        while (tables.hasNext()) {
            table = (Table) tables.next();

            if (table.isFileBased() && isAccessibleTable(table)) {
                cache = table.getCache();

                if (cache != null) {
                    cacheSet.add(cache);
                }
            }
        }

        caches = cacheSet.iterator();

        // Do it.
        while (caches.hasNext()) {
            cache = (DataFileCache) caches.next();
            row   = t.getEmptyRowData();
            row[icache_file] =
                FileUtil.canonicalOrAbsolutePath(cache.getFileName());
            row[imax_cache_sz]    = ValuePool.getInt(cache.capacity());
            row[imax_cache_bytes] = ValuePool.getLong(cache.bytesCapacity());
            row[icache_size] = ValuePool.getInt(cache.getCachedObjectCount());
            row[icache_length] =
                ValuePool.getLong(cache.getTotalCachedBlockSize());
            row[ifree_bytes] =
                ValuePool.getInt(cache.getTotalFreeBlockSize());
            row[ifree_count] = ValuePool.getInt(cache.getFreeBlockCount());
            row[ifree_pos]   = ValuePool.getLong(cache.getFileFreePos());

            t.insertSys(row);
        }

        t.setDataReadOnly(true);
View Full Code Here

      localTable1.createPrimaryKey(null, new int[] { 0 }, true);
      return localTable1;
    }
    HashSet localHashSet = new HashSet();
    Iterator localIterator2 = this.database.schemaManager.allTablesIterator();
    DataFileCache localDataFileCache;
    while (localIterator2.hasNext())
    {
      Table localTable2 = (Table)localIterator2.next();
      if ((!localTable2.isFileBased()) || (!isAccessibleTable(localTable2)))
        continue;
      localDataFileCache = localTable2.getCache();
      if (localDataFileCache == null)
        continue;
      localHashSet.add(localDataFileCache);
    }
    Iterator localIterator1 = localHashSet.iterator();
    while (localIterator1.hasNext())
    {
      localDataFileCache = (DataFileCache)localIterator1.next();
      Object[] arrayOfObject = localTable1.getEmptyRowData();
      arrayOfObject[0] = FileUtil.canonicalOrAbsolutePath(localDataFileCache.getFileName());
      arrayOfObject[1] = ValuePool.getInt(localDataFileCache.capacity());
      arrayOfObject[2] = ValuePool.getLong(localDataFileCache.bytesCapacity());
      arrayOfObject[3] = ValuePool.getInt(localDataFileCache.getCachedObjectCount());
      arrayOfObject[4] = ValuePool.getLong(localDataFileCache.getTotalCachedBlockSize());
      arrayOfObject[5] = ValuePool.getInt(localDataFileCache.getTotalFreeBlockSize());
      arrayOfObject[6] = ValuePool.getInt(localDataFileCache.getFreeBlockCount());
      arrayOfObject[7] = ValuePool.getLong(localDataFileCache.getFileFreePos());
      localTable1.insertSys(arrayOfObject);
    }
    localTable1.setDataReadOnly(true);
    return localTable1;
  }
View Full Code Here

TOP

Related Classes of org.hsqldb.persist.DataFileCache

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.