Examples of SerialBinding


Examples of com.sleepycat.bdb.bind.serial.SerialBinding

        SerialFormat valueFormat = new SerialFormat(catalog,
                                                    TestSerial.class);
        store = new DataStore(openDb(STORE_FILE),
                              keyFormat, valueFormat, null);

        SerialBinding keyBinding = new SerialBinding(keyFormat);
        SerialBinding valueBinding = new SerialBinding(valueFormat);
        map = new StoredMap(store, keyBinding, valueBinding, true);
    }
View Full Code Here

Examples of com.sleepycat.bdb.bind.serial.SerialBinding

    private void primitiveBindingTest(Object val)
        throws IOException {

        Class cls = val.getClass();
        SerialFormat format = new SerialFormat(catalog, cls);
        DataBinding binding = new SerialBinding(format);
        assertSame(format, binding.getDataFormat());

        binding.objectToData(val, buffer);
        assertTrue(buffer.getDataLength() > 0);

        Object val2 = binding.dataToObject(buffer);
        assertSame(cls, val2.getClass());
        assertEquals(val, val2);

        Object valWithWrongCls = (cls == String.class)
                      ? ((Object) new Integer(0)) : ((Object) new String(""));
        try {
            binding.objectToData(valWithWrongCls, buffer);
        } catch (IllegalArgumentException expected) {}
    }
View Full Code Here

Examples of com.sleepycat.bdb.bind.serial.SerialBinding

        // key/value data pair to a combined value object.  For keys, however,
        // the stored data is used directly via a SerialBinding and no
        // special binding class is needed.
        //
        DataBinding partKeyBinding =
            new SerialBinding(db.getPartKeyFormat());
        EntityBinding partValueBinding =
            new PartBinding(db.getPartKeyFormat(), db.getPartValueFormat());
        DataBinding supplierKeyBinding =
            new SerialBinding(db.getSupplierKeyFormat());
        EntityBinding supplierValueBinding =
            new SupplierBinding(db.getSupplierKeyFormat(),
                                db.getSupplierValueFormat());
        DataBinding shipmentKeyBinding =
            new SerialBinding(db.getShipmentKeyFormat());
        EntityBinding shipmentValueBinding =
            new ShipmentBinding(db.getShipmentKeyFormat(),
                                db.getShipmentValueFormat());
        DataBinding cityKeyBinding =
            new SerialBinding(db.getCityKeyFormat());

        // Create map views for all stores and indices.
        // StoredSortedMap is not used since the stores and indices are
        // ordered by serialized key objects, which do not provide a very
        // useful ordering.
View Full Code Here

Examples of com.sleepycat.bdb.bind.serial.SerialBinding

            TupleBinding.getPrimitiveBinding(Integer.class, keyFormat);

        // use String serial format and binding for values
        SerialFormat valueFormat =
            new SerialFormat(catalog, String.class);
        SerialBinding valueBinding = new SerialBinding(valueFormat);

        // open a BTREE (sorted) data store
        Db db = new Db(env, 0);
        db.open(null, "data.db", null, Db.DB_BTREE, dbFlags, 0);
        this.store = new DataStore(db, keyFormat, valueFormat, null);
View Full Code Here

Examples of com.sleepycat.bdb.bind.serial.SerialBinding

        // In this sample, the stored keys and values are used directly rather
        // than mapping them to separate objects. Therefore, no binding classes
        // are defined here and the SerialBinding class is used.
        //
        DataBinding partKeyBinding =
            new SerialBinding(db.getPartKeyFormat());
        DataBinding partValueBinding =
            new SerialBinding(db.getPartValueFormat());
        DataBinding supplierKeyBinding =
            new SerialBinding(db.getSupplierKeyFormat());
        DataBinding supplierValueBinding =
            new SerialBinding(db.getSupplierValueFormat());
        DataBinding shipmentKeyBinding =
            new SerialBinding(db.getShipmentKeyFormat());
        DataBinding shipmentValueBinding =
            new SerialBinding(db.getShipmentValueFormat());

        // Create map views for all stores and indices.
        // StoredSortedMap is not used since the stores and indices are
        // ordered by serialized key objects, which do not provide a very
        // useful ordering.
View Full Code Here

Examples of com.sleepycat.bdb.bind.serial.SerialBinding

        // In this sample, the stored keys and values are used directly rather
        // than mapping them to separate objects. Therefore, no binding classes
        // are defined here and the SerialBinding class is used.
        //
        DataBinding partKeyBinding =
            new SerialBinding(db.getPartKeyFormat());
        DataBinding partValueBinding =
            new SerialBinding(db.getPartValueFormat());
        DataBinding supplierKeyBinding =
            new SerialBinding(db.getSupplierKeyFormat());
        DataBinding supplierValueBinding =
            new SerialBinding(db.getSupplierValueFormat());
        DataBinding shipmentKeyBinding =
            new SerialBinding(db.getShipmentKeyFormat());
        DataBinding shipmentValueBinding =
            new SerialBinding(db.getShipmentValueFormat());
        DataBinding cityKeyBinding =
            new SerialBinding(db.getCityKeyFormat());

        // Create map views for all stores and indices.
        // StoredSortedMap is not used since the stores and indices are
        // ordered by serialized key objects, which do not provide a very
        // useful ordering.
View Full Code Here

Examples of com.sleepycat.bind.serial.SerialBinding

      cacheDb = env.openDatabase(null, cacheDbName, dbConfig);
      catalogDb = env.openDatabase(null, catalogDbName, dbConfig);

      /* Use the catalog for the serial binding. */
      catalog = new StoredClassCatalog(catalogDb);
      serialBinding = new SerialBinding(catalog, null);

      /* Start with a fresh transaction map. */
      txnMap = new ConcurrentHashMap<Object, Transaction>();
   }
View Full Code Here

Examples of com.sleepycat.bind.serial.SerialBinding

        this.ticketDb = this.environment.openDatabase(null, "ticketDb",
            dbConfig);
        this.catalogDb = this.environment.openDatabase(null, "catalogDb",
            dbConfig);
        StoredClassCatalog catalog = new StoredClassCatalog(this.catalogDb);
        this.ticketBinding = new SerialBinding(catalog, Ticket.class);
    }
View Full Code Here

Examples of com.sleepycat.bind.serial.SerialBinding

        runner = new TransactionRunner(env);

        catalog = new StoredClassCatalog(openDb(CATALOG_FILE, false));
        catalog2 = new StoredClassCatalog(openDb("catalog2.db", true));

        SerialBinding keyBinding = new SerialBinding(catalog,
                                                  String.class);
        SerialBinding valueBinding = new SerialBinding(catalog,
                                                    TestSerial.class);
        store = openDb(STORE_FILE, false);

        map = new StoredMap(store, keyBinding, valueBinding, true);
    }
View Full Code Here

Examples of com.sleepycat.bind.serial.SerialBinding

        env = testEnv.open(StoredClassCatalogTest.makeTestName(testEnv));
        runner = new TransactionRunner(env);

        catalog = new StoredClassCatalog(openDb(CATALOG_FILE));

        SerialBinding keyBinding = new SerialBinding(catalog,
                                                  String.class);
        SerialBinding valueBinding = new SerialBinding(catalog,
                                                    TestSerial.class);
        store = openDb(STORE_FILE);

        map = new StoredMap(store, keyBinding, valueBinding, true);
    }
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.