Examples of SecondaryConfig


Examples of com.sleepycat.je.SecondaryConfig

            currentTxn =
                CurrentTransaction.getInstanceInternal(db.getEnvironment());
            DatabaseConfig dbConfig;
            if (db instanceof SecondaryDatabase) {
                secDb = (SecondaryDatabase) database;
                SecondaryConfig secConfig = secDb.getSecondaryConfig();
                secKeyCreator = secConfig.getKeyCreator();
                dbConfig = secConfig;
            } else {
                dbConfig = db.getConfig();
            }
            ordered = !DbCompat.isTypeHash(dbConfig);
View Full Code Here

Examples of com.sleepycat.je.SecondaryConfig

    keyBinding = new SerialBinding(classCatalog, KClass);
    valueBinding = new SerialBinding(classCatalog, VClass);
    entryBinding = new SerialBinding(classCatalog, Entry.class);
    pairKeyBinding = new SerialBinding(classCatalog, PairKey.class);

    SecondaryConfig mySecConfig = new SecondaryConfig();
    mySecConfig.setAllowCreate(true);
    /*
     * Duplicates are frequently required for secondary databases.
     */
    mySecConfig.setSortedDuplicates(true);

    /*
     * Get a secondary object and set the key creator on it.
     */
    SecondaryKeyCreator firstKeyCreator = new MyFirstKeyCreator();
    mySecConfig.setKeyCreator(firstKeyCreator);
   

    firstKeyIndex = BerkeleyDBFactory.getEnv().openSecondaryDatabase(null,
        "matrix_first_key", db, mySecConfig);
   
    /*
     * Get a secondary object and set the key creator on it.
     */
    SecondaryKeyCreator secondKeyCreator = new MySecondaryKeyCreator();
    mySecConfig.setKeyCreator(secondKeyCreator);
   
    secondKeyIndex = BerkeleyDBFactory.getEnv().openSecondaryDatabase(null,
        "matrix_second_key", db, mySecConfig);
   
  }
View Full Code Here

Examples of com.sleepycat.je.SecondaryConfig

            currentTxn =
                CurrentTransaction.getInstanceInternal(db.getEnvironment());
            DatabaseConfig dbConfig;
            if (db instanceof SecondaryDatabase) {
                secDb = (SecondaryDatabase) database;
                SecondaryConfig secConfig = secDb.getSecondaryConfig();
                secKeyCreator = secConfig.getKeyCreator();
                dbConfig = secConfig;
            } else {
                dbConfig = db.getConfig();
            }
            ordered = !DbCompat.isTypeHash(dbConfig);
View Full Code Here

Examples of com.sleepycat.je.SecondaryConfig

      try {
    dc = getConnection(JE_ENV);

    env = dc.getEnvironment();
    DatabaseConfig dbConfig = new DatabaseConfig();
    SecondaryConfig secDbConfig = new SecondaryConfig();
    dbConfig.setAllowCreate(true);
    dbConfig.setTransactional(TRANSACTIONAL);
    secDbConfig.setAllowCreate(true);
    secDbConfig.setTransactional(TRANSACTIONAL);
    secDbConfig.setKeyCreator(new MyKeyCreator());

    /*
     * Use JEConnection.openDatabase() to obtain a cached Database
     * handle.  Do not call close() on Database handles obtained
     * using this method.
View Full Code Here

Examples of com.sleepycat.je.SecondaryConfig

        // Open the database. Create it if it does not already exist.
        this.ownerDirectory = env.openDatabase(null, "ownerDirecotry",
                new DatabaseConfig().setAllowCreate(true).setTransactional(true));

        this.ownerIndex = env.openSecondaryDatabase(null, "ownerIndex", ownerDirectory,
                ((SecondaryConfig) (new SecondaryConfig().setAllowCreate(true).setSortedDuplicates(true).setTransactional(true))).setAllowPopulate(true).setKeyCreator(new OwnerKeyCreator()));

        PreloadConfig ownerDirectoryPreloadConfig = new PreloadConfig();
        this.ownerDirectory.preload(ownerDirectoryPreloadConfig);

        this.mainStore = env.openDatabase(null, "mainStore",
View Full Code Here

Examples of com.sleepycat.je.SecondaryConfig

                           PrimaryOpenState priOpenState)
        throws DatabaseException {

        assert !secIndexMap.containsKey(secName);
        String[] fileAndDbNames = parseDbName(storePrefix + dbSecName);
        SecondaryConfig config =
            getSecondaryConfig(secName, entityMeta, keyClassName, secKeyMeta);
        Database priDb = primaryIndex.getDatabase();
        DatabaseConfig priConfig = priDb.getConfig();

        String relatedClsName = secKeyMeta.getRelatedEntity();
        if (relatedClsName != null) {
            PrimaryIndex relatedIndex = getRelatedIndex(relatedClsName);
            config.setForeignKeyDatabase(relatedIndex.getDatabase());
        }

        if (config.getTransactional() != priConfig.getTransactional() ||
            DbCompat.getDeferredWrite(config) !=
            DbCompat.getDeferredWrite(priConfig) ||
            config.getReadOnly() != priConfig.getReadOnly()) {
            throw new IllegalArgumentException
                ("One of these properties was changed to be inconsistent" +
                 " with the associated primary database: " +
                 " Transactional, DeferredWrite, ReadOnly");
        }
View Full Code Here

Examples of com.sleepycat.je.SecondaryConfig

    private SecondaryConfig getSecondaryConfig(String secName,
                                               EntityMetadata entityMeta,
                                               String keyClassName,
                                               SecondaryKeyMetadata
                                               secKeyMeta) {
        SecondaryConfig config = secConfigMap.get(secName);
        if (config == null) {
            /* Set common properties to match the primary DB. */
            DatabaseConfig priConfig = getPrimaryConfig(entityMeta);
            config = new SecondaryConfig();
            config.setTransactional(priConfig.getTransactional());
            config.setAllowCreate(!priConfig.getReadOnly());
            config.setReadOnly(priConfig.getReadOnly());
            DbCompat.setTypeBtree(config);
            /* <!-- begin JE only --> */
            config.setTemporary(priConfig.getTemporary());
            config.setDeferredWrite(priConfig.getDeferredWrite());
            config.setOverrideBtreeComparator(true);
            /* <!-- end JE only --> */
            /* Set secondary properties based on metadata. */
            config.setAllowPopulate(true);
            Relationship rel = secKeyMeta.getRelationship();
            config.setSortedDuplicates(rel == Relationship.MANY_TO_ONE ||
                                       rel == Relationship.MANY_TO_MANY);
            setBtreeComparator(config, keyClassName);
            PersistKeyCreator keyCreator = new PersistKeyCreator
                (catalog, entityMeta, keyClassName, secKeyMeta, rawAccess);
            if (rel == Relationship.ONE_TO_MANY ||
                rel == Relationship.MANY_TO_MANY) {
                config.setMultiKeyCreator(keyCreator);
            } else {
                config.setKeyCreator(keyCreator);
            }
            DeleteAction deleteAction = secKeyMeta.getDeleteAction();
            if (deleteAction != null) {
                ForeignKeyDeleteAction baseDeleteAction;
                switch (deleteAction) {
                case ABORT:
                    baseDeleteAction = ForeignKeyDeleteAction.ABORT;
                    break;
                case CASCADE:
                    baseDeleteAction = ForeignKeyDeleteAction.CASCADE;
                    break;
                case NULLIFY:
                    baseDeleteAction = ForeignKeyDeleteAction.NULLIFY;
                    break;
                default:
                    throw DbCompat.unexpectedState(deleteAction.toString());
                }
                config.setForeignKeyDeleteAction(baseDeleteAction);
                if (deleteAction == DeleteAction.NULLIFY) {
                    config.setForeignMultiKeyNullifier(keyCreator);
                }
            }
            secConfigMap.put(secName, config);
        }
        return config;
View Full Code Here

Examples of com.sleepycat.je.SecondaryConfig

        String secName = makeSecName(entityClass.getName(), keyName);
        if (secIndexMap.containsKey(secName)) {
            throw new IllegalStateException
                ("Cannot set config after DB is open");
        }
        SecondaryConfig dbConfig =
            getSecondaryConfig(secName, entityMeta, keyClassName, secKeyMeta);
        if (config.getExclusiveCreate() ||
            config.getAllowCreate() == config.getReadOnly() ||
            config.getSortedDuplicates() != dbConfig.getSortedDuplicates() ||
            config.getBtreeComparator() != dbConfig.getBtreeComparator() ||
            config.getDuplicateComparator() != null ||
            /* <!-- begin JE only --> */
            config.getTemporary() != dbConfig.getTemporary() ||
            /* <!-- end JE only --> */
            config.getAllowPopulate() != dbConfig.getAllowPopulate() ||
            config.getKeyCreator() != dbConfig.getKeyCreator() ||
            config.getMultiKeyCreator() != dbConfig.getMultiKeyCreator() ||
            config.getForeignKeyNullifier() !=
                dbConfig.getForeignKeyNullifier() ||
            config.getForeignMultiKeyNullifier() !=
                dbConfig.getForeignMultiKeyNullifier() ||
            config.getForeignKeyDeleteAction() !=
                dbConfig.getForeignKeyDeleteAction() ||
            config.getForeignKeyDatabase() != null) {
            throw new IllegalArgumentException
                ("One of these properties was illegally changed: " +
                 " AllowCreate, ExclusiveCreate, SortedDuplicates," +
                 " BtreeComparator, DuplicateComparator, Temporary," +
View Full Code Here

Examples of com.sleepycat.je.SecondaryConfig

        Database diskStore = dbufferEnv.openDatabase(null, dbName, dbConfig);

        int i=0;
        for (SecondaryKeyCreator keyCreator : keyCreators) {
            SecondaryConfig secDbConfig = new SecondaryConfig();
            secDbConfig.setKeyCreator(keyCreator);
            secDbConfig.setAllowCreate(true);
            secDbConfig.setSortedDuplicates(true);
            secDbConfig.setTransactional(false);

            // Perform the actual open
            String secDbName = dbName + i;
            dbufferEnv.openSecondaryDatabase(null, secDbName, diskStore, secDbConfig);
            i++;
View Full Code Here

Examples of com.sleepycat.je.SecondaryConfig

    public MessageStore createQueueMessageStore(String destinationName) throws JMSException {
        try {
            Database database = createDatabase("Queue_" + destinationName);
            SequenceNumberCreator sequenceNumberCreator = new SequenceNumberCreator();
            SecondaryConfig secondaryConfig = createSecondaryConfig(sequenceNumberCreator);
            SecondaryDatabase secondaryDatabase = createSecondaryDatabase("Queue_Index_" + destinationName, database, secondaryConfig);
            sequenceNumberCreator.initialise(secondaryDatabase);
            return new BDbMessageStore(database, secondaryDatabase, secondaryConfig, sequenceNumberCreator, wireFormat.copy());
        }
        catch (DatabaseException e) {
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.