当前位置: 首页>>代码示例>>Java>>正文


Java SecondaryConfig.getKeyCreator方法代码示例

本文整理汇总了Java中com.sleepycat.je.SecondaryConfig.getKeyCreator方法的典型用法代码示例。如果您正苦于以下问题:Java SecondaryConfig.getKeyCreator方法的具体用法?Java SecondaryConfig.getKeyCreator怎么用?Java SecondaryConfig.getKeyCreator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sleepycat.je.SecondaryConfig的用法示例。


在下文中一共展示了SecondaryConfig.getKeyCreator方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setSecondaryConfig

import com.sleepycat.je.SecondaryConfig; //导入方法依赖的package包/类
public synchronized void setSecondaryConfig(Class entityClass,
                                            String keyName,
                                            SecondaryConfig config) {
    checkOpen();
    String entityClsName = entityClass.getName();
    EntityMetadata entityMeta = checkEntityClass(entityClsName);
    SecondaryKeyMetadata secKeyMeta = checkSecKey(entityMeta, keyName);
    String keyClassName = getSecKeyClass(secKeyMeta);
    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.getSortedDuplicates() != dbConfig.getSortedDuplicates() ||
        config.getBtreeComparator() != dbConfig.getBtreeComparator() ||
        config.getDuplicateComparator() != null ||
        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: " +
             " SortedDuplicates, BtreeComparator, DuplicateComparator," +
             " AllowPopulate, KeyCreator, MultiKeyCreator," +
             " ForeignKeyNullifer, ForeignMultiKeyNullifier," +
             " ForeignKeyDeleteAction, ForeignKeyDatabase");
    }
    secConfigMap.put(secName, config);
}
 
开发者ID:nologic,项目名称:nabs,代码行数:38,代码来源:Store.java

示例2: DataView

import com.sleepycat.je.SecondaryConfig; //导入方法依赖的package包/类
/**
 * Creates a view for a given database and bindings.  The initial key range
 * of the view will be open.
 */
DataView(Database database, EntryBinding keyBinding,
         EntryBinding valueBinding, EntityBinding entityBinding,
         boolean writeAllowed, PrimaryKeyAssigner keyAssigner)
    throws IllegalArgumentException {

    if (database == null) {
        throw new IllegalArgumentException("database is null");
    }
    db = database;
    try {
        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);
        recNumAllowed = DbCompat.isTypeQueue(dbConfig) ||
                        DbCompat.isTypeRecno(dbConfig) ||
                        DbCompat.getBtreeRecordNumbers(dbConfig);
        recNumRenumber = DbCompat.getRenumbering(dbConfig);
        dupsAllowed = DbCompat.getSortedDuplicates(dbConfig) ||
                      DbCompat.getUnsortedDuplicates(dbConfig);
        dupsOrdered = DbCompat.getSortedDuplicates(dbConfig);
        transactional = currentTxn.isTxnMode() &&
                        dbConfig.getTransactional();
        readUncommittedAllowed = DbCompat.getReadUncommitted(dbConfig);
        btreeRecNumDb = recNumAllowed && DbCompat.isTypeBtree(dbConfig);
        range = new KeyRange(dbConfig.getBtreeComparator());
    } catch (DatabaseException e) {
        throw new RuntimeExceptionWrapper(e);
    }
    this.writeAllowed = writeAllowed;
    this.keyBinding = keyBinding;
    this.valueBinding = valueBinding;
    this.entityBinding = entityBinding;
    this.keyAssigner = keyAssigner;
    cursorConfig = CursorConfig.DEFAULT;

    if (valueBinding != null && entityBinding != null)
        throw new IllegalArgumentException(
            "both valueBinding and entityBinding are non-null");

    if (keyBinding instanceof com.sleepycat.bind.RecordNumberBinding) {
        if (!recNumAllowed) {
            throw new IllegalArgumentException(
                "RecordNumberBinding requires DB_BTREE/DB_RECNUM, " +
                "DB_RECNO, or DB_QUEUE");
        }
        recNumAccess = true;
        if (btreeRecNumDb) {
            btreeRecNumAccess = true;
        }
    }
    keysRenumbered = recNumRenumber || btreeRecNumAccess;
}
 
开发者ID:nologic,项目名称:nabs,代码行数:66,代码来源:DataView.java

示例3: setSecondaryConfig

import com.sleepycat.je.SecondaryConfig; //导入方法依赖的package包/类
public synchronized void setSecondaryConfig(Class entityClass,
                                            String keyName,
                                            SecondaryConfig config) {
    checkOpen();
    String entityClsName = entityClass.getName();
    EntityMetadata entityMeta = checkEntityClass(entityClsName);
    SecondaryKeyMetadata secKeyMeta = checkSecKey(entityMeta, keyName);
    String keyClassName = getSecKeyClass(secKeyMeta);
    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," +
             " AllowPopulate, KeyCreator, MultiKeyCreator," +
             " ForeignKeyNullifer, ForeignMultiKeyNullifier," +
             " ForeignKeyDeleteAction, ForeignKeyDatabase");
    }
    if (!DbCompat.isTypeBtree(config)) {
        throw new IllegalArgumentException("Only type BTREE allowed");
    }
    secConfigMap.put(secName, config);
}
 
开发者ID:prat0318,项目名称:dbms,代码行数:47,代码来源:Store.java

示例4: DataView

import com.sleepycat.je.SecondaryConfig; //导入方法依赖的package包/类
/**
 * Creates a view for a given database and bindings.  The initial key range
 * of the view will be open.
 */
DataView(Database database, EntryBinding keyBinding,
         EntryBinding valueBinding, EntityBinding entityBinding,
         boolean writeAllowed, PrimaryKeyAssigner keyAssigner)
    throws IllegalArgumentException {

    if (database == null) {
        throw new IllegalArgumentException("database is null");
    }
    db = database;
    try {
        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);
        keyRangesAllowed = DbCompat.isTypeBtree(dbConfig);
        recNumAllowed = DbCompat.isTypeQueue(dbConfig) ||
                        DbCompat.isTypeRecno(dbConfig) ||
                        DbCompat.getBtreeRecordNumbers(dbConfig);
        recNumRenumber = DbCompat.getRenumbering(dbConfig);
        dupsAllowed = DbCompat.getSortedDuplicates(dbConfig) ||
                      DbCompat.getUnsortedDuplicates(dbConfig);
        dupsOrdered = DbCompat.getSortedDuplicates(dbConfig);
        transactional = currentTxn.isTxnMode() &&
                        dbConfig.getTransactional();
        readUncommittedAllowed = DbCompat.getReadUncommitted(dbConfig);
        btreeRecNumDb = recNumAllowed && DbCompat.isTypeBtree(dbConfig);
        range = new KeyRange(dbConfig.getBtreeComparator());
    } catch (DatabaseException e) {
        throw RuntimeExceptionWrapper.wrapIfNeeded(e);
    }
    this.writeAllowed = writeAllowed;
    this.keyBinding = keyBinding;
    this.valueBinding = valueBinding;
    this.entityBinding = entityBinding;
    this.keyAssigner = keyAssigner;
    cursorConfig = CursorConfig.DEFAULT;

    if (valueBinding != null && entityBinding != null)
        throw new IllegalArgumentException
            ("both valueBinding and entityBinding are non-null");

    if (keyBinding instanceof com.sleepycat.bind.RecordNumberBinding) {
        if (!recNumAllowed) {
            throw new IllegalArgumentException
                ("RecordNumberBinding requires DB_BTREE/DB_RECNUM, " +
                 "DB_RECNO, or DB_QUEUE");
        }
        recNumAccess = true;
        if (btreeRecNumDb) {
            btreeRecNumAccess = true;
        }
    }
    keysRenumbered = recNumRenumber || btreeRecNumAccess;
}
 
开发者ID:prat0318,项目名称:dbms,代码行数:67,代码来源:DataView.java


注:本文中的com.sleepycat.je.SecondaryConfig.getKeyCreator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。