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


Java SecondaryConfig.setAllowPopulate方法代码示例

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


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

示例1: init

import com.sleepycat.je.SecondaryConfig; //导入方法依赖的package包/类
@Override
public void init() throws DatabaseException {
	
	SecondaryConfig config = new SecondaryConfig();
	config.setAllowCreate(true);
	config.setAllowPopulate(true);
	config.setTransactional(true);
	config.setImmutableSecondaryKey(immutableSecondaryKey);
	config.setSortedDuplicates(sortedDuplicates);
	
	config.setMultiKeyCreator(keyCreator);
	
	db = primary.envWrap.env.openSecondaryDatabase(null, name, primary.db, config);
}
 
开发者ID:mosscode,项目名称:bdbwrap,代码行数:15,代码来源:MultiKeySecondaryDbWrap.java

示例2: init

import com.sleepycat.je.SecondaryConfig; //导入方法依赖的package包/类
@Override
public void init() throws DatabaseException {
	
	SecondaryConfig config = new SecondaryConfig();
	config.setAllowCreate(true);
	config.setAllowPopulate(true);
	config.setTransactional(true);
	config.setImmutableSecondaryKey(immutableSecondaryKey);
	config.setSortedDuplicates(allowDuplicates);
	config.setKeyCreator(keyCreator);
	
	db = primary.envWrap.env.openSecondaryDatabase(null, name, primary.db, config);
}
 
开发者ID:mosscode,项目名称:bdbwrap,代码行数:14,代码来源:SingleKeySecondaryDbWrap.java

示例3: setup

import com.sleepycat.je.SecondaryConfig; //导入方法依赖的package包/类
public void setup(File envHome, boolean readOnly) 
    throws DatabaseException {

    EnvironmentConfig myEnvConfig = new EnvironmentConfig();
    DatabaseConfig myDbConfig = new DatabaseConfig();
    SecondaryConfig mySecConfig = new SecondaryConfig();

    // If the environment is read-only, then
    // make the databases read-only too.
    myEnvConfig.setReadOnly(readOnly);
    myDbConfig.setReadOnly(readOnly);
    mySecConfig.setReadOnly(readOnly);

    // If the environment is opened for write, then we want to be 
    // able to create the environment and databases if 
    // they do not exist.
    myEnvConfig.setAllowCreate(!readOnly);
    myDbConfig.setAllowCreate(!readOnly);
    mySecConfig.setAllowCreate(!readOnly);

    // Allow transactions if we are writing to the database
    myEnvConfig.setTransactional(!readOnly);
    myDbConfig.setTransactional(!readOnly);
    mySecConfig.setTransactional(!readOnly);

    // Open the environment
    myEnv = new Environment(envHome, myEnvConfig);

    // Now open, or create and open, our databases
    // Open the vendors and inventory databases
    vendorDb = myEnv.openDatabase(null, 
                                  "VendorDB",
                                   myDbConfig);

    inventoryDb = myEnv.openDatabase(null, 
                                    "InventoryDB",
                                     myDbConfig);
    
    // Open the class catalog db. This is used to 
    // optimize class serialization.
    classCatalogDb = 
        myEnv.openDatabase(null, 
                           "ClassCatalogDB",
                           myDbConfig);

    // Create our class catalog
    classCatalog = new StoredClassCatalog(classCatalogDb);

    // Need a tuple binding for the Inventory class. 
    // We use the InventoryBinding class
    // that we implemented for this purpose.
    TupleBinding inventoryBinding = new InventoryBinding();
                                                                                                                              
    // Open the secondary database. We use this to create a
    // secondary index for the inventory database

    // We want to maintain an index for the inventory entries based 
    // on the item name. So, instantiate the appropriate key creator 
    // and open a secondary database.
    ItemNameKeyCreator keyCreator = 
        new ItemNameKeyCreator(new InventoryBinding());

   
    // Set up additional secondary properties
    // Need to allow duplicates for our secondary database
    mySecConfig.setSortedDuplicates(true);
    mySecConfig.setAllowPopulate(true); // Allow autopopulate
    mySecConfig.setKeyCreator(keyCreator);

    // Now open it
    itemNameIndexDb = 
        myEnv.openSecondaryDatabase(
                null,     
                "itemNameIndex", // index name
                inventoryDb,     // the primary db that we're indexing
                mySecConfig);    // the secondary config 
}
 
开发者ID:nologic,项目名称:nabs,代码行数:78,代码来源:MyDbEnv.java

示例4: openSecondary

import com.sleepycat.je.SecondaryConfig; //导入方法依赖的package包/类
private SecondaryDatabase openSecondary(Database priDb,
                                        boolean allowDuplicates,
                                        String dbName,
                                        boolean allowPopulate,
                                        boolean readOnly)
    throws DatabaseException {

    List secListBefore = priDb.getSecondaryDatabases();
    SecondaryConfig dbConfig = new SecondaryConfig();
    dbConfig.setTransactional(isTransactional);
    dbConfig.setAllowCreate(true);
    dbConfig.setSortedDuplicates(allowDuplicates);
    dbConfig.setReadOnly(readOnly);
    dbConfig.setAllowPopulate(allowPopulate);
    if (!readOnly) {
        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);
    }
    assertNotNull(secDb);

    /* Check configuration. */
    assertSame(priDb, secDb.getPrimaryDatabase());
    SecondaryConfig config2 = secDb.getSecondaryConfig();
    assertEquals(allowPopulate, config2.getAllowPopulate());
    assertEquals(dbConfig.getKeyCreator(), config2.getKeyCreator());

    /* Make sure the new secondary is added to the primary's list. */
    List secListAfter = priDb.getSecondaryDatabases();
    assertTrue(secListAfter.remove(secDb));
    assertEquals(secListBefore, secListAfter);

    return secDb;
}
 
开发者ID:nologic,项目名称:nabs,代码行数:45,代码来源:SecondaryTest.java

示例5: openSecondary

import com.sleepycat.je.SecondaryConfig; //导入方法依赖的package包/类
private SecondaryDatabase openSecondary(Database priDb, 
                                        boolean allowDuplicates,
                                        String dbName,
                                        boolean allowPopulate,
                                        boolean readOnly)
    throws DatabaseException {

    List secListBefore = priDb.getSecondaryDatabases();
    SecondaryConfig dbConfig = new SecondaryConfig();
    dbConfig.setTransactional(isTransactional);
    dbConfig.setAllowCreate(true);
    dbConfig.setSortedDuplicates(allowDuplicates);
    dbConfig.setReadOnly(readOnly);
    dbConfig.setAllowPopulate(allowPopulate);
    if (!readOnly) {
        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);
    }
    assertNotNull(secDb);

    /* Check configuration. */
    assertSame(priDb, secDb.getPrimaryDatabase());
    SecondaryConfig config2 = secDb.getSecondaryConfig();
    assertEquals(allowPopulate, config2.getAllowPopulate());
    assertEquals(dbConfig.getKeyCreator(), config2.getKeyCreator());

    /* Make sure the new secondary is added to the primary's list. */
    List secListAfter = priDb.getSecondaryDatabases();
    assertTrue(secListAfter.remove(secDb));
    assertEquals(secListBefore, secListAfter);

    return secDb;
}
 
开发者ID:nologic,项目名称:nabs,代码行数:45,代码来源:SecondaryTest.java

示例6: setup

import com.sleepycat.je.SecondaryConfig; //导入方法依赖的package包/类
public void setup(File envHome, boolean readOnly)
   throws DatabaseException, IOException {

   EnvironmentConfig myEnvConfig = new EnvironmentConfig();
   DatabaseConfig myDbConfig = new DatabaseConfig();
   SecondaryConfig mySecConfig = new SecondaryConfig();

   // If the environment is read-only, then
   // make the databases read-only too.
   myEnvConfig.setReadOnly(readOnly);
   myDbConfig.setReadOnly(readOnly);
   mySecConfig.setReadOnly(readOnly);

   // If the environment is opened for write, then we want to be
   // able to create the environment and databases if
   // they do not exist.
   myEnvConfig.setAllowCreate(!readOnly);
   myDbConfig.setAllowCreate(!readOnly);
   mySecConfig.setAllowCreate(!readOnly);

   // Allow transactions if we are writing to the database
   myEnvConfig.setTransactional(!readOnly);
   myDbConfig.setTransactional(!readOnly);
   mySecConfig.setTransactional(!readOnly);

   // Open the environment
   myEnv = new Environment(envHome, myEnvConfig);

   // Now open, or create and open, our databases
   // Open the vendors and inventory databases
   scannerHealthDB = myEnv.openDatabase(null, "ScannerHealthDB", myDbConfig);
   SequenceConfig config = new SequenceConfig();
   config.setAllowCreate(true);
   DatabaseEntry key = new DatabaseEntry("ScannerHealth".getBytes("UTF-8"));
   scannerHealthSequence = scannerHealthDB.openSequence(null, key, config);

   beaconEventsDB = myEnv.openDatabase(null, "BeaconEventsDB", myDbConfig);

   // Need a tuple binding for the Inventory class.
   // We use the InventoryBinding class
   // that we implemented for this purpose.
   TupleBinding inventoryBinding = new BeaconBinding();

   // Open the secondary database. We use this to create a
   // secondary index for the inventory database

   // We want to maintain an index for the inventory entries based
   // on the item name. So, instantiate the appropriate key creator
   // and open a secondary database.
   MinorKeyCreator keyCreator = new MinorKeyCreator(inventoryBinding);

   // Set up additional secondary properties
   // Need to allow duplicates for our secondary database
   mySecConfig.setSortedDuplicates(true);
   mySecConfig.setAllowPopulate(true); // Allow autopopulate
   mySecConfig.setKeyCreator(keyCreator);

   // Now open it
   beaconMinorIndexDB =
      myEnv.openSecondaryDatabase(
         null,
         "minorIDIndex", // index name
         beaconEventsDB,     // the primary db that we're indexing
         mySecConfig);    // the secondary config
}
 
开发者ID:starksm64,项目名称:RaspberryPiBeaconParser,代码行数:66,代码来源:ScannerEventsDB.java

示例7: open

import com.sleepycat.je.SecondaryConfig; //导入方法依赖的package包/类
void open(final boolean readOnly) {
	try {
		final EnvironmentConfig myEnvConfig = new EnvironmentConfig();
		final DatabaseConfig myDbConfig = new DatabaseConfig();

		// If the environment is read-only, then
		// make the databases read-only too.
		myEnvConfig.setReadOnly(readOnly);
		myDbConfig.setReadOnly(readOnly);

		// If the environment is opened for write, then we want to be
		// able to create the environment and databases if
		// they do not exist.
		myEnvConfig.setAllowCreate(!readOnly);
		myDbConfig.setAllowCreate(!readOnly);

		// Allow transactions if we are writing to the database
		myEnvConfig.setTransactional(!readOnly);
		myDbConfig.setTransactional(!readOnly);

		//On limite l'utilisation du cache � 20% de la m�moire globale.
		myEnvConfig.setCachePercent(20);
		//CHECKME On limite l'utilisation du cache � 200Mo
		//myEnvConfig.setCacheSize(200 * 1000 * 1000);

		// Open the environment
		myEnv = new Environment(myDbEnvPath, myEnvConfig);

		// Now open, or create and open, our databases
		// Open the vendors and inventory databases
		db = myEnv.openDatabase(null, "MyDB", myDbConfig);

		//On cr�e l'index sur le lastModified
		if (USE_INDEXES) {
			final SecondaryConfig lastModifiedIndexConfig = new SecondaryConfig();
			lastModifiedIndexConfig.setReadOnly(readOnly);
			lastModifiedIndexConfig.setAllowCreate(!readOnly);
			lastModifiedIndexConfig.setTransactional(!readOnly);
			lastModifiedIndexConfig.setAllowPopulate(!readOnly);//auto remplissage de la base si vide
			lastModifiedIndexConfig.setSortedDuplicates(true);
			lastModifiedIndexConfig.setKeyCreator(new LastModifiedIndexKeyCreator());
			final SecondaryDatabase lastModifiedIndex = myEnv.openSecondaryDatabase(null, "lastModifiedIndex", db, lastModifiedIndexConfig);
			indexMap.put(Indexes.lastModified, lastModifiedIndex);
		}
	} catch (final DatabaseException e) {
		throw new RuntimeException(e);
	}
}
 
开发者ID:KleeGroup,项目名称:vertigo-labs,代码行数:49,代码来源:BerkeleyDatabase.java

示例8: setup

import com.sleepycat.je.SecondaryConfig; //导入方法依赖的package包/类
public void setup(File envHome, boolean readOnly)
    throws DatabaseException {

    EnvironmentConfig myEnvConfig = new EnvironmentConfig();
    DatabaseConfig myDbConfig = new DatabaseConfig();
    SecondaryConfig mySecConfig = new SecondaryConfig();

    // If the environment is read-only, then
    // make the databases read-only too.
    myEnvConfig.setReadOnly(readOnly);
    myDbConfig.setReadOnly(readOnly);
    mySecConfig.setReadOnly(readOnly);

    // If the environment is opened for write, then we want to be
    // able to create the environment and databases if
    // they do not exist.
    myEnvConfig.setAllowCreate(!readOnly);
    myDbConfig.setAllowCreate(!readOnly);
    mySecConfig.setAllowCreate(!readOnly);

    // Allow transactions if we are writing to the database
    myEnvConfig.setTransactional(!readOnly);
    myDbConfig.setTransactional(!readOnly);
    mySecConfig.setTransactional(!readOnly);

    // Open the environment
    myEnv = new Environment(envHome, myEnvConfig);

    // Now open, or create and open, our databases
    // Open the vendors and inventory databases
    vendorDb = myEnv.openDatabase(null,
                                  "VendorDB",
                                   myDbConfig);

    inventoryDb = myEnv.openDatabase(null,
                                    "InventoryDB",
                                     myDbConfig);

    // Open the class catalog db. This is used to
    // optimize class serialization.
    classCatalogDb =
        myEnv.openDatabase(null,
                           "ClassCatalogDB",
                           myDbConfig);

    // Create our class catalog
    classCatalog = new StoredClassCatalog(classCatalogDb);

    // Need a tuple binding for the Inventory class.
    // We use the InventoryBinding class
    // that we implemented for this purpose.
    TupleBinding inventoryBinding = new InventoryBinding();

    // Open the secondary database. We use this to create a
    // secondary index for the inventory database

    // We want to maintain an index for the inventory entries based
    // on the item name. So, instantiate the appropriate key creator
    // and open a secondary database.
    ItemNameKeyCreator keyCreator =
        new ItemNameKeyCreator(inventoryBinding);

    // Set up additional secondary properties
    // Need to allow duplicates for our secondary database
    mySecConfig.setSortedDuplicates(true);
    mySecConfig.setAllowPopulate(true); // Allow autopopulate
    mySecConfig.setKeyCreator(keyCreator);

    // Now open it
    itemNameIndexDb =
        myEnv.openSecondaryDatabase(
                null,
                "itemNameIndex", // index name
                inventoryDb,     // the primary db that we're indexing
                mySecConfig);    // the secondary config
}
 
开发者ID:prat0318,项目名称:dbms,代码行数:77,代码来源:MyDbEnv.java


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