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


Java EntityStore类代码示例

本文整理汇总了Java中com.sleepycat.persist.EntityStore的典型用法代码示例。如果您正苦于以下问题:Java EntityStore类的具体用法?Java EntityStore怎么用?Java EntityStore使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: WebGraph

import com.sleepycat.persist.EntityStore; //导入依赖的package包/类
/**
 * 构造函数
 */
public WebGraph(String dbDir) throws DatabaseException {
  File envDir = new File(dbDir);
  EnvironmentConfig envConfig = new EnvironmentConfig();
  envConfig.setTransactional(false);
  envConfig.setAllowCreate(true);
  Environment env = new Environment(envDir, envConfig);

  StoreConfig storeConfig = new StoreConfig();
  storeConfig.setAllowCreate(true);
  storeConfig.setTransactional(false);

  store = new EntityStore(env, "classDb", storeConfig);
  outLinkIndex = store.getPrimaryIndex(String.class, Link.class);
  inLinkIndex = store.getSecondaryIndex(outLinkIndex, String.class, "toURL");
}
 
开发者ID:classtag,项目名称:scratch_crawler,代码行数:19,代码来源:WebGraph.java

示例2: PersonAccessor

import com.sleepycat.persist.EntityStore; //导入依赖的package包/类
public PersonAccessor(EntityStore store)
    throws DatabaseException {

    personBySsn = store.getPrimaryIndex(
        String.class, Person.class);

    personByParentSsn = store.getSecondaryIndex(
        personBySsn, String.class, "parentSsn");

    personByEmailAddresses = store.getSecondaryIndex(
        personBySsn, String.class, "emailAddresses");

    personByEmployerIds = store.getSecondaryIndex(
        personBySsn, Long.class, "employerIds");

    employerById = store.getPrimaryIndex(
        Long.class, Employer.class);

    employerByName = store.getSecondaryIndex(
        employerById, String.class, "name"); 
}
 
开发者ID:nologic,项目名称:nabs,代码行数:22,代码来源:PersonExample.java

示例3: PersonExample

import com.sleepycat.persist.EntityStore; //导入依赖的package包/类
private PersonExample(File envHome)
    throws DatabaseException {

    /* Open a transactional Berkeley DB engine environment. */
    EnvironmentConfig envConfig = new EnvironmentConfig();
    envConfig.setAllowCreate(true);
    envConfig.setTransactional(true);
    env = new Environment(envHome, envConfig);

    /* Open a transactional entity store. */
    StoreConfig storeConfig = new StoreConfig();
    storeConfig.setAllowCreate(true);
    storeConfig.setTransactional(true);
    store = new EntityStore(env, "PersonStore", storeConfig);

    /* Initialize the data access object. */
    dao = new PersonAccessor(store);
}
 
开发者ID:nologic,项目名称:nabs,代码行数:19,代码来源:PersonExample.java

示例4: readObjects

import com.sleepycat.persist.EntityStore; //导入依赖的package包/类
@Override
void readObjects(EntityStore store, boolean doUpdate)
    throws DatabaseException {

    PrimaryIndex<Integer,ProxiedClass_Entity>
        index = store.getPrimaryIndex
            (Integer.class,
             ProxiedClass_Entity.class);
    ProxiedClass_Entity obj = index.get(99);
    TestCase.assertNotNull(obj);
    TestCase.assertEquals(99, obj.key);
    TestCase.assertNotNull(obj.embed);
    TestCase.assertEquals(88, obj.embed.data);

    if (doUpdate) {
        index.put(obj);
    }
}
 
开发者ID:nologic,项目名称:nabs,代码行数:19,代码来源:EvolveClasses.java

示例5: testConvertAndAddField

import com.sleepycat.persist.EntityStore; //导入依赖的package包/类
public void testConvertAndAddField()
    throws DatabaseException, IOException {

    /* Copy log file resource to log file zero. */
    TestUtils.loadLog(getClass(), "ConvertAndAddTest.jdb", envHome);

    EntityStore store = open(true /*addConverter*/);

    PrimaryIndex<Long, MyEntity> index =
        store.getPrimaryIndex(Long.class, MyEntity.class);

    MyEntity entity = index.get(1L);
    assertNotNull(entity);
    assertEquals(123, entity.b);

    close(store);
}
 
开发者ID:nologic,项目名称:nabs,代码行数:18,代码来源:ConvertAndAddTest.java

示例6: readObjects

import com.sleepycat.persist.EntityStore; //导入依赖的package包/类
@Override
void readObjects(EntityStore store, boolean doUpdate)
    throws DatabaseException {

    PrimaryIndex<Integer,AllowFieldTypeChanges>
        index = store.getPrimaryIndex
            (Integer.class, AllowFieldTypeChanges.class);
    AllowFieldTypeChanges obj = index.get((int) 99);
    checkValues(obj);
    checkSecondaries(store, index);

    if (doUpdate) {
        index.put(obj);
        checkSecondaries(store, index);
    }
}
 
开发者ID:nologic,项目名称:nabs,代码行数:17,代码来源:EvolveClasses.java

示例7: readObjects

import com.sleepycat.persist.EntityStore; //导入依赖的package包/类
@Override
void readObjects(EntityStore store, boolean doUpdate)
    throws DatabaseException {

    PrimaryIndex<Integer,RenamedEntity2_NewEntityName_WithRenamer>
        index = store.getPrimaryIndex
            (Integer.class,
             RenamedEntity2_NewEntityName_WithRenamer.class);
    RenamedEntity2_NewEntityName_WithRenamer obj = index.get(key);
    TestCase.assertNotNull(obj);
    TestCase.assertEquals(99, obj.key);
    TestCase.assertEquals(88, obj.skey);

    SecondaryIndex<Integer,Integer,
                   RenamedEntity2_NewEntityName_WithRenamer>
        sindex = store.getSecondaryIndex(index, Integer.class, "skey");
    obj = sindex.get(88);
    TestCase.assertNotNull(obj);
    TestCase.assertEquals(99, obj.key);
    TestCase.assertEquals(88, obj.skey);

    if (doUpdate) {
        index.put(obj);
    }
}
 
开发者ID:nologic,项目名称:nabs,代码行数:26,代码来源:EvolveClasses.java

示例8: SimpleDA

import com.sleepycat.persist.EntityStore; //导入依赖的package包/类
public SimpleDA(EntityStore store)
    throws DatabaseException {

    // Primary key for SimpleEntityClass classes
    pIdx = store.getPrimaryIndex(
        String.class, SimpleEntityClass.class);

    // Secondary key for SimpleEntityClass classes
    // Last field in the getSecondaryIndex() method must be
    // the name of a class member; in this case, an 
    // SimpleEntityClass.class data member.
    sIdx = store.getSecondaryIndex(
        pIdx, String.class, "sKey");

    sec_pcursor = pIdx.entities();
    sec_scursor = sIdx.subIndex("skeyone").entities();
}
 
开发者ID:nologic,项目名称:nabs,代码行数:18,代码来源:SimpleDA.java

示例9: PersonExample

import com.sleepycat.persist.EntityStore; //导入依赖的package包/类
private PersonExample(File envHome)
    throws DatabaseException, FileNotFoundException {

    /* Open a transactional Berkeley DB engine environment. */
    EnvironmentConfig envConfig = new EnvironmentConfig();
    envConfig.setAllowCreate(true);
    envConfig.setTransactional(true);
    envConfig.setInitializeCache(true);
    envConfig.setInitializeLocking(true);
    env = new Environment(envHome, envConfig);

    /* Open a transactional entity store. */
    StoreConfig storeConfig = new StoreConfig();
    storeConfig.setAllowCreate(true);
    storeConfig.setTransactional(true);
    store = new EntityStore(env, "PersonStore", storeConfig);

    /* Initialize the data access object. */
    dao = new PersonAccessor(store);
}
 
开发者ID:nologic,项目名称:nabs,代码行数:21,代码来源:PersonExample.java

示例10: checkSecondaries

import com.sleepycat.persist.EntityStore; //导入依赖的package包/类
private void checkSecondaries(EntityStore store,
                              PrimaryIndex<Integer,
                                           AllowFieldTypeChanges>
                                           index)
    throws DatabaseException {

    checkValues(store.getSecondaryIndex
        (index, Boolean.class, "kBoolean").get(true));
    checkValues(store.getSecondaryIndex
        (index, Byte.class, "kByte").get((byte) 77));
    checkValues(store.getSecondaryIndex
        (index, Short.class, "kShort").get((short) 66));
    checkValues(store.getSecondaryIndex
        (index, Integer.class, "kInteger").get((int) 55));
    checkValues(store.getSecondaryIndex
        (index, Long.class, "kLong").get((long) 44));
    checkValues(store.getSecondaryIndex
        (index, Float.class, "kFloat").get((float) 33));
    checkValues(store.getSecondaryIndex
        (index, Double.class, "kDouble").get((double) 22));
    checkValues(store.getSecondaryIndex
        (index, Character.class, "kCharacter").get((char) 11));
    checkValues(store.getSecondaryIndex
        (index, AllowFieldTypeChanges_Key.class, "kComposite").get
            (new AllowFieldTypeChanges_Key(true)));
}
 
开发者ID:nologic,项目名称:nabs,代码行数:27,代码来源:EvolveClasses.java

示例11: DataAccessor

import com.sleepycat.persist.EntityStore; //导入依赖的package包/类
public DataAccessor(EntityStore store)
    throws DatabaseException {

    // Primary key for Inventory classes
    inventoryBySku = store.getPrimaryIndex(
        String.class, Inventory.class);

    // Secondary key for Inventory classes
    // Last field in the getSecondaryIndex() method must be
    // the name of a class member; in this case, an Inventory.class
    // data member.
    inventoryByName = store.getSecondaryIndex(
        inventoryBySku, String.class, "itemName");

    // Primary key for Vendor class
    vendorByName = store.getPrimaryIndex(
        String.class, Vendor.class);
}
 
开发者ID:prat0318,项目名称:dbms,代码行数:19,代码来源:DataAccessor.java

示例12: PersonAccessor

import com.sleepycat.persist.EntityStore; //导入依赖的package包/类
public PersonAccessor(EntityStore store)
    throws DatabaseException {

    personBySsn = store.getPrimaryIndex(
        String.class, Person.class);

    personByParentSsn = store.getSecondaryIndex(
        personBySsn, String.class, "parentSsn");

    personByEmailAddresses = store.getSecondaryIndex(
        personBySsn, String.class, "emailAddresses");

    personByEmployerIds = store.getSecondaryIndex(
        personBySsn, Long.class, "employerIds");

    employerById = store.getPrimaryIndex(
        Long.class, Employer.class);

    employerByName = store.getSecondaryIndex(
        employerById, String.class, "name");
}
 
开发者ID:nologic,项目名称:nabs,代码行数:22,代码来源:PersonExample.java

示例13: setup

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

    EnvironmentConfig myEnvConfig = new EnvironmentConfig();
    StoreConfig storeConfig = new StoreConfig();

    myEnvConfig.setReadOnly(readOnly);
    storeConfig.setReadOnly(readOnly);

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

    // Open the environment and entity store
    myEnv = new Environment(envHome, myEnvConfig);
    store = new EntityStore(myEnv, "EntityStore", storeConfig);

}
 
开发者ID:prat0318,项目名称:dbms,代码行数:21,代码来源:MyDbEnv.java

示例14: setup

import com.sleepycat.persist.EntityStore; //导入依赖的package包/类
public void setup()
    throws DatabaseException {

    EnvironmentConfig envConfig = new EnvironmentConfig();
    StoreConfig storeConfig = new StoreConfig();

    envConfig.setAllowCreate(true);
    storeConfig.setAllowCreate(true);

    try {
        // Open the environment and entity store
        envmnt = new Environment(envHome, envConfig);
        store = new EntityStore(envmnt, "EntityStore", storeConfig);
    } catch (FileNotFoundException fnfe) {
        System.err.println("setup(): " + fnfe.toString());
        System.exit(-1);
    }
}
 
开发者ID:nologic,项目名称:nabs,代码行数:19,代码来源:SimpleStorePut.java

示例15: open

import com.sleepycat.persist.EntityStore; //导入依赖的package包/类
private void open(boolean create) {
	try {
		EnvironmentConfig envConfig = new EnvironmentConfig();
		envConfig.setAllowCreate(create);
		envConfig.setReadOnly(!create);
		dbEnvironment = new Environment(new File(databaseFolder), envConfig);

		StoreConfig storeConfig = new StoreConfig();
		storeConfig.setAllowCreate(create);
		storeConfig.setReadOnly(!create);
		store = new EntityStore(dbEnvironment, "EntityStore", storeConfig);
		conceptDataAccessor = new ConceptDataAccessor();
		mapsToRelationshipDataAccessor = new MapsToRelationshipDataAccessor();
		parentChildRelationshipDataAccessor = new ParentChildRelationshipDataAccessor();
	} catch (DatabaseException dbe) {
		throw new RuntimeException(dbe);
	}
}
 
开发者ID:OHDSI,项目名称:Usagi,代码行数:19,代码来源:BerkeleyDbEngine.java


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