Package com.sleepycat.bdb.collection

Examples of com.sleepycat.bdb.collection.StoredSortedMap


     * to create a read-only collection.
     */
    public StoredSortedMap newSortedMap(DataStore store, Class keyClass,
                                        boolean writeAllowed) {

        return new StoredSortedMap(store,
                        getKeyBinding(keyClass),
                        getEntityBinding(store),
                        writeAllowed);
    }
View Full Code Here


     * to create a read-only collection.
     */
    public StoredSortedMap newSortedMap(DataIndex index, Class keyClass,
                                        boolean writeAllowed) {

        return new StoredSortedMap(index,
                        getKeyBinding(keyClass),
                        getEntityBinding(index.getStore()),
                        writeAllowed);
    }
View Full Code Here

        throws Exception {

        // create primary map
        if (testStore.isOrdered()) {
            if (isEntityBinding) {
                smap = new StoredSortedMap(store, keyBinding,
                                           entityBinding, true);
                valueSet = new StoredSortedValueSet(store, entityBinding,
                                                    true);
            } else {
                smap = new StoredSortedMap(store, keyBinding,
                                           valueBinding, true);
                // non-indexed sorted value set is not possible since key
                // cannot be derived for performing subSet, etc.
            }
            keySet = new StoredSortedKeySet(store, keyBinding, true);
View Full Code Here

        readAll();

        // create indexed map (keySet/valueSet)
        if (testStore.isOrdered()) {
            if (isEntityBinding) {
                map = smap = new StoredSortedMap(index, keyBinding,
                                                 entityBinding, true);
                valueSet = new StoredSortedValueSet(index, entityBinding,
                                                    true);
            } else {
                map = smap = new StoredSortedMap(index, keyBinding,
                                                 valueBinding, true);
                valueSet = new StoredSortedValueSet(index, valueBinding, true);
            }
            keySet = new StoredSortedKeySet(index, keyBinding, true);
        } else {
View Full Code Here

        System.out.println(DbTestUtil.qualifiedTestName(this));
        env = TestEnv.TXN.open("TransactionTests");
        currentTxn = CurrentTransaction.getInstance(env);
        store = testStore.open(env, null);
        map = new StoredSortedMap(store, testStore.getKeyBinding(),
                                  testStore.getValueBinding(), true);
    }
View Full Code Here

        assertTrue(!map.isDirtyReadEnabled());
        assertTrue(!((StoredContainer) map.values()).isDirtyReadEnabled());
        assertTrue(!((StoredContainer) map.keySet()).isDirtyReadEnabled());
        assertTrue(!((StoredContainer) map.entrySet()).isDirtyReadEnabled());

        StoredSortedMap other =
            (StoredSortedMap) StoredCollections.dirtyReadMap(map);
        assertTrue(other.isDirtyReadEnabled());
        assertTrue(((StoredContainer) other.values()).isDirtyReadEnabled());
        assertTrue(((StoredContainer) other.keySet()).isDirtyReadEnabled());
        assertTrue(((StoredContainer) other.entrySet()).isDirtyReadEnabled());
        assertTrue(!map.isDirtyReadEnabled());
        assertTrue(!((StoredContainer) map.values()).isDirtyReadEnabled());
        assertTrue(!((StoredContainer) map.keySet()).isDirtyReadEnabled());
        assertTrue(!((StoredContainer) map.entrySet()).isDirtyReadEnabled());

        // auto-commit property should be inherited

        assertTrue(!map.isAutoCommit());
        assertTrue(!((StoredContainer) map.values()).isAutoCommit());
        assertTrue(!((StoredContainer) map.keySet()).isAutoCommit());
        assertTrue(!((StoredContainer) map.entrySet()).isAutoCommit());

        other = (StoredSortedMap) StoredCollections.autoCommitMap(map);
        assertTrue(other.isAutoCommit());
        assertTrue(((StoredContainer) other.values()).isAutoCommit());
        assertTrue(((StoredContainer) other.keySet()).isAutoCommit());
        assertTrue(((StoredContainer) other.entrySet()).isAutoCommit());
        assertTrue(!map.isAutoCommit());
        assertTrue(!((StoredContainer) map.values()).isAutoCommit());
        assertTrue(!((StoredContainer) map.keySet()).isAutoCommit());
        assertTrue(!((StoredContainer) map.entrySet()).isAutoCommit());
View Full Code Here

        //
        Db db = new Db(env, 0);
        db.open(null, null, null, Db.DB_BTREE, 0, 0);
        store = new DataStore(db, TestStore.BYTE_FORMAT,
                                  TestStore.BYTE_FORMAT, null);
        map = new StoredSortedMap(store,
                testStore.getKeyBinding(), testStore.getValueBinding(), true);
        assertTrue(!map.isTransactional());
        map.put(ONE, ONE);
        readCheck(map, ONE, ONE);
        store.close();

        // is transactional because is opened in a transaction
        //
        currentTxn.beginTxn();
        db = new Db(env, 0);
        db.open(currentTxn.getTxn(), null, null, Db.DB_BTREE, 0, 0);
        currentTxn.commitTxn();
        store = new DataStore(db, TestStore.BYTE_FORMAT,
                                  TestStore.BYTE_FORMAT, null);
        map = new StoredSortedMap(store,
                testStore.getKeyBinding(), testStore.getValueBinding(), true);
        assertTrue(map.isTransactional());
        currentTxn.beginTxn();
        map.put(ONE, ONE);
        readCheck(map, ONE, ONE);
View Full Code Here

    }

    public void testDirtyReadCollection()
        throws Exception {

        StoredSortedMap dirtyMap =
            (StoredSortedMap) StoredCollections.dirtyReadSortedMap(map);

        // original map is not dirty-read
        assertTrue(map.isDirtyReadAllowed());
        assertTrue(!map.isDirtyReadEnabled());
View Full Code Here

        // Create map views for all stores and indices.
        // StoredSortedMap is used since the stores and indices are ordered
        // (they use the DB_BTREE access method).
        //
        partMap =
            new StoredSortedMap(db.getPartStore(),
                          partKeyBinding, partValueBinding, true);
        supplierMap =
            new StoredSortedMap(db.getSupplierStore(),
                          supplierKeyBinding, supplierValueBinding, true);
        shipmentMap =
            new StoredSortedMap(db.getShipmentStore(),
                          shipmentKeyBinding, shipmentValueBinding, true);
        shipmentByPartMap =
            new StoredSortedMap(db.getShipmentByPartIndex(),
                          partKeyBinding, shipmentValueBinding, true);
        shipmentBySupplierMap =
            new StoredSortedMap(db.getShipmentBySupplierIndex(),
                          supplierKeyBinding, shipmentValueBinding, true);
        supplierByCityMap =
            new StoredSortedMap(db.getSupplierByCityIndex(),
                          cityKeyBinding, supplierValueBinding, true);
    }
View Full Code Here

        // Create map views for all stores and indices.
        // StoredSortedMap is used since the stores and indices are ordered
        // (they use the DB_BTREE access method).
        //
        partMap =
            new StoredSortedMap(db.getPartStore(),
                          partKeyBinding, partValueBinding, true);
        supplierMap =
            new StoredSortedMap(db.getSupplierStore(),
                          supplierKeyBinding, supplierValueBinding, true);
        shipmentMap =
            new StoredSortedMap(db.getShipmentStore(),
                          shipmentKeyBinding, shipmentValueBinding, true);
        shipmentByPartMap =
            new StoredSortedMap(db.getShipmentByPartIndex(),
                          partKeyBinding, shipmentValueBinding, true);
        shipmentBySupplierMap =
            new StoredSortedMap(db.getShipmentBySupplierIndex(),
                          supplierKeyBinding, shipmentValueBinding, true);
        supplierByCityMap =
            new StoredSortedMap(db.getSupplierByCityIndex(),
                          cityKeyBinding, supplierValueBinding, true);
    }
View Full Code Here

TOP

Related Classes of com.sleepycat.bdb.collection.StoredSortedMap

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.