本文整理汇总了Java中com.sleepycat.je.SecondaryConfig类的典型用法代码示例。如果您正苦于以下问题:Java SecondaryConfig类的具体用法?Java SecondaryConfig怎么用?Java SecondaryConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SecondaryConfig类属于com.sleepycat.je包,在下文中一共展示了SecondaryConfig类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: open
import com.sleepycat.je.SecondaryConfig; //导入依赖的package包/类
public void open() {
sort_duplicates = false;
super.open();
try {
SecondaryConfig dbConfig = new SecondaryConfig();
dbConfig.setAllowCreate(true);
if (storage.getBerkleyEnvironment().getConfig().getTransactional()) {
dbConfig.setTransactional(true);
}
dbConfig.setKeyCreator(PlainSecondaryKeyCreator.getInstance());
dbConfig.setSortedDuplicates(true);
secondaryDb = storage.getBerkleyEnvironment().openSecondaryDatabase(null, SECONDARY_DB_NAME_PREFIX + name,
db, dbConfig);
}
catch (Throwable t) {
throw new HGException("While attempting to open index ;" + name + "': " + t.toString(), t);
}
}
开发者ID:hypergraphdb,项目名称:hypergraphdb,代码行数:22,代码来源:DefaultBiIndexImpl.java
示例2: openSecondaryDatabase
import com.sleepycat.je.SecondaryConfig; //导入依赖的package包/类
SecondaryDatabase openSecondaryDatabase(String dbName,
Database primaryDatabase,
SecondaryConfig config)
throws DatabaseException {
if (config.getReadOnly()) {
synchronized (roSecondaryDatabaseHandleCache) {
return openSecondaryDatabaseInternal
(roSecondaryDatabaseHandleCache, dbName,
primaryDatabase, config);
}
} else {
synchronized (rwSecondaryDatabaseHandleCache) {
return openSecondaryDatabaseInternal
(rwSecondaryDatabaseHandleCache, dbName,
primaryDatabase, config);
}
}
}
开发者ID:nologic,项目名称:nabs,代码行数:20,代码来源:JEManagedConnection.java
示例3: openSecondary
import com.sleepycat.je.SecondaryConfig; //导入依赖的package包/类
private SecondaryDatabase openSecondary(Database priDb, String dbName,
boolean dups, int keyId)
throws DatabaseException {
SecondaryConfig dbConfig = new SecondaryConfig();
dbConfig.setTransactional(isTransactional);
dbConfig.setAllowCreate(true);
dbConfig.setSortedDuplicates(dups);
if (useMultiKey) {
dbConfig.setMultiKeyCreator
(new SimpleMultiKeyCreator(new MyKeyCreator(keyId)));
} else {
dbConfig.setKeyCreator(new MyKeyCreator(keyId));
}
Transaction txn = txnBegin();
try {
return env.openSecondaryDatabase(txn, dbName, priDb, dbConfig);
} finally {
txnCommit(txn);
}
}
开发者ID:nologic,项目名称:nabs,代码行数:23,代码来源:JoinTest.java
示例4: openSecondary
import com.sleepycat.je.SecondaryConfig; //导入依赖的package包/类
private SecondaryDatabase openSecondary(Database priDb,
String dbName,
boolean dups)
throws DatabaseException {
SecondaryConfig dbConfig = new SecondaryConfig();
dbConfig.setTransactional(isTransactional);
dbConfig.setAllowCreate(true);
dbConfig.setSortedDuplicates(dups);
dbConfig.setMultiKeyCreator(new MyKeyCreator());
Transaction txn = txnBegin();
try {
return env.openSecondaryDatabase(txn, dbName, priDb, dbConfig);
} finally {
txnCommit(txn);
}
}
开发者ID:nologic,项目名称:nabs,代码行数:19,代码来源:ToManyTest.java
示例5: open
import com.sleepycat.je.SecondaryConfig; //导入依赖的package包/类
private void open()
throws DatabaseException {
EnvironmentConfig envConfig = TestUtils.initEnvConfig();
envConfig.setAllowCreate(true);
env = new Environment(envHome, envConfig);
DatabaseConfig priConfig = new DatabaseConfig();
priConfig.setAllowCreate(true);
priDb = env.openDatabase(null, "pri", priConfig);
SecondaryConfig secConfig = new SecondaryConfig();
secConfig.setAllowCreate(true);
secConfig.setSortedDuplicates(true);
secConfig.setKeyCreator(new KeyCreator());
secDb = env.openSecondaryDatabase(null, "sec", priDb, secConfig);
}
开发者ID:nologic,项目名称:nabs,代码行数:21,代码来源:SecondarySplitTestMain.java
示例6: openSecondary
import com.sleepycat.je.SecondaryConfig; //导入依赖的package包/类
/**
* Opens the secondary database.
*/
private SecondaryDatabase openSecondary(Database priDb, String dbName,
boolean allowDuplicates)
throws DatabaseException {
SecondaryConfig dbConfig = new SecondaryConfig();
dbConfig.setTransactional(isTransactional);
dbConfig.setAllowCreate(true);
dbConfig.setSortedDuplicates(allowDuplicates);
if (useMultiKey) {
dbConfig.setMultiKeyCreator
(new SimpleMultiKeyCreator(new MyKeyCreator()));
} else {
dbConfig.setKeyCreator(new MyKeyCreator());
}
Transaction txn = txnBegin();
SecondaryDatabase secDb;
try {
secDb = env.openSecondaryDatabase(txn, dbName, priDb, dbConfig);
} finally {
txnCommit(txn);
}
return secDb;
}
开发者ID:nologic,项目名称:nabs,代码行数:27,代码来源:SecondaryDirtyReadTest.java
示例7: openSecondaryDb
import com.sleepycat.je.SecondaryConfig; //导入依赖的package包/类
private SecondaryDatabase openSecondaryDb(Database primary,
String file,
String keyName)
throws Exception {
SecondaryConfig secConfig = new SecondaryConfig();
DbCompat.setTypeBtree(secConfig);
secConfig.setTransactional(true);
secConfig.setAllowCreate(true);
DbCompat.setSortedDuplicates(secConfig, true);
secConfig.setKeyCreator(factory.getKeyCreator(MarshalledObject.class,
keyName));
return DbCompat.openSecondaryDatabase(env, null,
file, null,
primary, secConfig);
}
开发者ID:nologic,项目名称:nabs,代码行数:18,代码来源:JoinTest.java
示例8: openSecondaryDb
import com.sleepycat.je.SecondaryConfig; //导入依赖的package包/类
private SecondaryDatabase openSecondaryDb(TupleSerialFactory factory,
String keyName,
Database primary,
String file,
Database foreignStore)
throws Exception {
TupleSerialMarshalledKeyCreator keyCreator =
factory.getKeyCreator(MarshalledObject.class, keyName);
SecondaryConfig secConfig = new SecondaryConfig();
secConfig.setTransactional(testEnv.isTxnMode());
secConfig.setAllowCreate(true);
secConfig.setKeyCreator(keyCreator);
if (foreignStore != null) {
secConfig.setForeignKeyDatabase(foreignStore);
secConfig.setForeignKeyDeleteAction(onDelete);
secConfig.setForeignKeyNullifier(keyCreator);
}
return DbCompat.openSecondaryDatabase(env, null, file, null,
primary, secConfig);
}
开发者ID:nologic,项目名称:nabs,代码行数:24,代码来源:ForeignKeyTest.java
示例9: openSecondaryDb
import com.sleepycat.je.SecondaryConfig; //导入依赖的package包/类
private SecondaryDatabase openSecondaryDb(TupleSerialFactory factory,
String keyName,
Database primary,
String file,
Database foreignStore)
throws Exception {
SecondaryConfig secConfig = new SecondaryConfig();
secConfig.setTransactional(testEnv.isTxnMode());
secConfig.setAllowCreate(true);
secConfig.setKeyCreator(factory.getKeyCreator(MarshalledObject.class,
keyName));
if (foreignStore != null) {
secConfig.setForeignKeyDatabase(foreignStore);
secConfig.setForeignKeyDeleteAction(
ForeignKeyDeleteAction.CASCADE);
}
return DbCompat.openSecondaryDatabase(env, null,
file, null,
primary, secConfig);
}
开发者ID:nologic,项目名称:nabs,代码行数:23,代码来源:TupleSerialFactoryTest.java
示例10: openSecondaryDatabase
import com.sleepycat.je.SecondaryConfig; //导入依赖的package包/类
/**
* Returns null if the database is not found (and AllowCreate is false) or
* already exists (and ExclusiveCreate is true).
*/
public static SecondaryDatabase
openSecondaryDatabase(Environment env,
Transaction txn,
String fileName,
String dbName,
Database primaryDatabase,
SecondaryConfig config) {
assert fileName == null;
try {
return env.openSecondaryDatabase(txn, dbName, primaryDatabase,
config);
} catch (DatabaseNotFoundException e) {
return null;
} catch (DatabaseExistsException e) {
return null;
}
}
开发者ID:prat0318,项目名称:dbms,代码行数:22,代码来源:DbCompat.java
示例11: testOpenSecondaryDatabase
import com.sleepycat.je.SecondaryConfig; //导入依赖的package包/类
/**
* Fires an assertion if the database is not found (and AllowCreate is
* false) or already exists (and ExclusiveCreate is true).
*/
public static SecondaryDatabase
testOpenSecondaryDatabase(Environment env,
Transaction txn,
String file,
String name,
Database primary,
SecondaryConfig config) {
try {
return env.openSecondaryDatabase(txn, makeTestDbName(file, name),
primary, config);
} catch (DatabaseNotFoundException e) {
assert false;
return null;
} catch (DatabaseExistsException e) {
assert false;
return null;
}
}
开发者ID:prat0318,项目名称:dbms,代码行数:23,代码来源:DbCompat.java
示例12: openSecondaryDatabase
import com.sleepycat.je.SecondaryConfig; //导入依赖的package包/类
SecondaryDatabase openSecondaryDatabase(String dbName,
Database primaryDatabase,
SecondaryConfig config)
throws DatabaseException {
if (config.getReadOnly()) {
synchronized (roSecondaryDatabaseHandleCache) {
return openSecondaryDatabaseInternal
(roSecondaryDatabaseHandleCache, dbName,
primaryDatabase, config);
}
} else {
synchronized (rwSecondaryDatabaseHandleCache) {
return openSecondaryDatabaseInternal
(rwSecondaryDatabaseHandleCache, dbName,
primaryDatabase, config);
}
}
}
开发者ID:prat0318,项目名称:dbms,代码行数:20,代码来源:JEManagedConnection.java
示例13: defaultSecondaryConfig
import com.sleepycat.je.SecondaryConfig; //导入依赖的package包/类
/**
* Default {@link SecondaryConfig}, {allowCreate: true, sortedDuplicates: true} with given {@link SecondaryKeyCreator}
* @param keyCreator
* @return
*/
public static SecondaryConfig defaultSecondaryConfig(SecondaryKeyCreator keyCreator) {
SecondaryConfig cfg = new SecondaryConfig();
cfg.setAllowCreate(true);
//Duplicates are frequently required for secondary databases
cfg.setSortedDuplicates(true);
cfg.setTransactional(true);
cfg.setKeyCreator(checkNotNull(keyCreator, "SecondaryKeyCreator cannot be null"));
return cfg;
}
开发者ID:jronrun,项目名称:benayn,代码行数:15,代码来源:Berkeley.java
示例14: getSecondaryConfig
import com.sleepycat.je.SecondaryConfig; //导入依赖的package包/类
public synchronized SecondaryConfig getSecondaryConfig(Class entityClass,
String keyName) {
checkOpen();
String entityClsName = entityClass.getName();
EntityMetadata entityMeta = checkEntityClass(entityClsName);
SecondaryKeyMetadata secKeyMeta = checkSecKey(entityMeta, keyName);
String keyClassName = getSecKeyClass(secKeyMeta);
String secName = makeSecName(entityClass.getName(), keyName);
return (SecondaryConfig) getSecondaryConfig
(secName, entityMeta, keyClassName, secKeyMeta).cloneConfig();
}
开发者ID:nologic,项目名称:nabs,代码行数:12,代码来源:Store.java
示例15: 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
示例16: openSecondaryDatabase
import com.sleepycat.je.SecondaryConfig; //导入依赖的package包/类
public static SecondaryDatabase
openSecondaryDatabase(Environment env,
Transaction txn,
String file,
String name,
Database primary,
SecondaryConfig config)
throws DatabaseException, FileNotFoundException {
return env.openSecondaryDatabase(txn, makeDbName(file, name),
primary, config);
}
开发者ID:nologic,项目名称:nabs,代码行数:13,代码来源:DbCompat.java
示例17: openSecondaryDatabase
import com.sleepycat.je.SecondaryConfig; //导入依赖的package包/类
public SecondaryDatabase openSecondaryDatabase(String name,
Database primaryDatabase,
SecondaryConfig config)
throws DatabaseException {
return mc.openSecondaryDatabase(name, primaryDatabase, config);
}
开发者ID:nologic,项目名称:nabs,代码行数:8,代码来源:JEConnectionImpl.java
示例18: openSecondary
import com.sleepycat.je.SecondaryConfig; //导入依赖的package包/类
private SecondaryDatabase openSecondary(Database priDb, String dbName,
Database foreignDb,
ForeignKeyDeleteAction onDelete)
throws DatabaseException {
SecondaryConfig dbConfig = new SecondaryConfig();
dbConfig.setTransactional(isTransactional);
dbConfig.setAllowCreate(true);
dbConfig.setSortedDuplicates(true);
MyKeyCreator keyCreator = new MyKeyCreator();
if (useMultiKey) {
dbConfig.setMultiKeyCreator(new SimpleMultiKeyCreator(keyCreator));
} else {
dbConfig.setKeyCreator(keyCreator);
}
if (foreignDb != null) {
if (useMultiKey) {
dbConfig.setForeignMultiKeyNullifier(keyCreator);
} else {
dbConfig.setForeignKeyNullifier(keyCreator);
}
dbConfig.setForeignKeyDatabase(foreignDb);
dbConfig.setForeignKeyDeleteAction(onDelete);
}
Transaction txn = txnBegin();
try {
return env.openSecondaryDatabase(txn, dbName, priDb, dbConfig);
} finally {
txnCommit(txn);
}
}
开发者ID:nologic,项目名称:nabs,代码行数:36,代码来源:ForeignKeyTest.java
示例19: TestStore
import com.sleepycat.je.SecondaryConfig; //导入依赖的package包/类
private TestStore(String name, SecondaryConfig config) {
this.name = name;
this.config = config;
isRecNumFormat = isQueueOrRecno() ||
(DbCompat.isTypeBtree(config) &&
DbCompat.getBtreeRecordNumbers(config));
}
开发者ID:nologic,项目名称:nabs,代码行数:10,代码来源:TestStore.java
示例20: getKeyCreator
import com.sleepycat.je.SecondaryConfig; //导入依赖的package包/类
private PersistKeyCreator getKeyCreator(final SecondaryConfig config) {
PersistKeyCreator keyCreator =
(PersistKeyCreator) config.getKeyCreator();
if (keyCreator != null) {
return keyCreator;
}
keyCreator = (PersistKeyCreator) config.getMultiKeyCreator();
assert keyCreator != null;
return keyCreator;
}
开发者ID:prat0318,项目名称:dbms,代码行数:11,代码来源:Store.java
注:本文中的com.sleepycat.je.SecondaryConfig类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论