本文整理汇总了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");
}
示例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");
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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();
}
示例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);
}
示例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)));
}
示例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);
}
示例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");
}
示例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);
}
示例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);
}
}
示例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);
}
}