本文整理汇总了Java中com.sleepycat.collections.StoredMap类的典型用法代码示例。如果您正苦于以下问题:Java StoredMap类的具体用法?Java StoredMap怎么用?Java StoredMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StoredMap类属于com.sleepycat.collections包,在下文中一共展示了StoredMap类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: ReadDatabase
import com.sleepycat.collections.StoredMap; //导入依赖的package包/类
public ReadDatabase(StoreDescriptor[] desc, DatabaseConfig[] configs, String namePrefix) throws DatabaseException, FileNotFoundException {
String dir = SieveContext.getModuleProperty("imsCore", BDBDataStore.CFG_DB_DIR);
file_prefix = namePrefix;
secondaries = new SecondaryDatabase[desc.length - 1];
maps = new StoredMap[desc.length - 1];
for (int i = 0; i < desc.length; ++i) {
StoreDescriptor d = desc[i];
String name = d.getName();
String file = dir + File.separator + file_prefix + "_" + name;
if(i == 0) {
primary = new Database(file, name, configs[i]);
} else {
secondaries[i - 1] = new SecondaryDatabase(file, name, primary, (SecondaryConfig)configs[i]);
maps[i] = new StoredMap(secondaries[i - 1], d.getKeyBinding(), d.getValueBinding(), false);
}
}
}
开发者ID:nologic,项目名称:nabs,代码行数:23,代码来源:ReadDatabase.java
示例2: getMap
import com.sleepycat.collections.StoredMap; //导入依赖的package包/类
public DataStoredMap getMap(int map, List sel_dbs) {
Object[] dbs = null;
StoredMap[] maps = null;
synchronized(readDbs){
// it'll do for now
maps = new StoredMap[readDbs.size()];
dbs = readDbs.toArray();
}
for (int i = 0; i < dbs.length; ++i) {
ReadingDB db = (ReadingDB) dbs[i];
StoredMap smap = db.getMap(map);
maps[i] = smap;
}
return new BDBStoredMap(maps);
}
开发者ID:nologic,项目名称:nabs,代码行数:19,代码来源:RollingDataStore.java
示例3: setUp
import com.sleepycat.collections.StoredMap; //导入依赖的package包/类
public void setUp()
throws Exception {
DbTestUtil.printTestName(getName());
env = testEnv.open(makeTestName(testEnv), false);
runner = new TransactionRunner(env);
catalog = new StoredClassCatalog(openDb(CATALOG_FILE, false));
catalog2 = new StoredClassCatalog(openDb("catalog2.db", true));
SerialBinding keyBinding = new SerialBinding(catalog,
String.class);
SerialBinding valueBinding = new SerialBinding(catalog,
TestSerial.class);
store = openDb(STORE_FILE, false);
map = new StoredMap(store, keyBinding, valueBinding, true);
}
开发者ID:nologic,项目名称:nabs,代码行数:19,代码来源:StoredClassCatalogTest.java
示例4: setUp
import com.sleepycat.collections.StoredMap; //导入依赖的package包/类
public void setUp()
throws Exception {
DbTestUtil.printTestName(getName());
env = testEnv.open(StoredClassCatalogTest.makeTestName(testEnv));
runner = new TransactionRunner(env);
catalog = new StoredClassCatalog(openDb(CATALOG_FILE));
SerialBinding keyBinding = new SerialBinding(catalog, String.class);
SerialBinding valueBinding =
new SerialBinding(catalog, TestSerial.class);
store = openDb(STORE_FILE);
map = new StoredMap(store, keyBinding, valueBinding, true);
}
开发者ID:nologic,项目名称:nabs,代码行数:17,代码来源:StoredClassCatalogTestInit.java
示例5: setUp
import com.sleepycat.collections.StoredMap; //导入依赖的package包/类
public void setUp()
throws Exception {
SharedTestUtils.printTestName(getName());
env = testEnv.open(makeTestName(testEnv), false);
runner = new TransactionRunner(env);
catalog = new StoredClassCatalog(openDb(CATALOG_FILE, false));
catalog2 = new StoredClassCatalog(openDb("catalog2.db", true));
SerialBinding keyBinding = new SerialBinding(catalog,
String.class);
SerialBinding valueBinding = new SerialBinding(catalog,
TestSerial.class);
store = openDb(STORE_FILE, false);
map = new StoredMap(store, keyBinding, valueBinding, true);
}
开发者ID:nologic,项目名称:nabs,代码行数:19,代码来源:StoredClassCatalogTest.java
示例6: setUp
import com.sleepycat.collections.StoredMap; //导入依赖的package包/类
public void setUp()
throws Exception {
SharedTestUtils.printTestName(getName());
env = testEnv.open(StoredClassCatalogTest.makeTestName(testEnv));
runner = new TransactionRunner(env);
catalog = new StoredClassCatalog(openDb(CATALOG_FILE));
SerialBinding keyBinding = new SerialBinding(catalog, String.class);
SerialBinding valueBinding =
new SerialBinding(catalog, TestSerial.class);
store = openDb(STORE_FILE);
map = new StoredMap(store, keyBinding, valueBinding, true);
}
开发者ID:nologic,项目名称:nabs,代码行数:17,代码来源:StoredClassCatalogTestInit.java
示例7: getObject
import com.sleepycat.collections.StoredMap; //导入依赖的package包/类
public Object getObject(Uuid uuid) {
logger.info("Getting object: " + uuid);
waitIfBusy(uuid);
StoredMap<UuidKey, UuidObject> uuidObjectMap = views.getUuidObjectMap();
int tries = 0;
while (uuidObjectMap == null && tries < 100) {
logger.info("Didn't get UuidObjectMap, trying: " + tries);
try {
Thread.sleep(50);
} catch (InterruptedException ie) {
}
views.getUuidObjectMap();
tries++;
}
UuidObject uuidObj = uuidObjectMap.get(new UuidKey(uuid));
return uuidObj != null ? uuidObj.getObject() : null;
}
开发者ID:mwsobol,项目名称:SORCER,代码行数:20,代码来源:DatabaseProvider.java
示例8: storedContextMapTest
import com.sleepycat.collections.StoredMap; //导入依赖的package包/类
@Test
public void storedContextMapTest() throws Exception {
StoredMap<UuidKey, Context> sm = runner.getViews()
.getContextMap();
Iterator<Map.Entry<UuidKey, Context>> mei = sm
.entrySet().iterator();
List<String> names = new ArrayList<String>();
Map.Entry<UuidKey, Context> entry = null;
while (mei.hasNext()) {
entry = mei.next();
names.add(entry.getValue().getName());
}
List<String> ln = list("c1", "c2", "c3");
Collections.sort(names);
logger.info("names: " + names);
assertEquals(ln, names);
}
开发者ID:mwsobol,项目名称:SORCER,代码行数:22,代码来源:SorcerDatabaseTest.java
示例9: storedTableMapTest
import com.sleepycat.collections.StoredMap; //导入依赖的package包/类
@Test
public void storedTableMapTest() throws Exception {
StoredMap<UuidKey, ModelTable> sm = runner.getViews()
.getTableMap();
Iterator<Map.Entry<UuidKey, ModelTable>> it = sm
.entrySet().iterator();
List<String> names = new ArrayList<String>();
Map.Entry<UuidKey, ModelTable> entry = null;
while (it.hasNext()) {
entry = it.next();
names.add(entry.getValue().getName());
}
List<String> ln = list("undefined0", "undefined1", "undefined2");
Collections.sort(names);
logger.info("table names: " + names);
assertEquals(ln, names);
}
开发者ID:mwsobol,项目名称:SORCER,代码行数:22,代码来源:SorcerDatabaseTest.java
示例10: storedExertionMapTest
import com.sleepycat.collections.StoredMap; //导入依赖的package包/类
@Test
public void storedExertionMapTest() throws Exception {
StoredMap<UuidKey, Exertion> sm = runner.getViews()
.getExertionMap();
Iterator<Map.Entry<UuidKey, Exertion>> it = sm
.entrySet().iterator();
List<String> names = new ArrayList<String>();
Map.Entry<UuidKey, Exertion> entry = null;
while (it.hasNext()) {
entry = it.next();
names.add(entry.getValue().getName());
}
List<String> ln = list("f1", "f4");
Collections.sort(names);
logger.info("names: " + names);
assertEquals(ln, names);
}
开发者ID:mwsobol,项目名称:SORCER,代码行数:22,代码来源:SorcerDatabaseTest.java
示例11: storedUuidObjectMapTest
import com.sleepycat.collections.StoredMap; //导入依赖的package包/类
@Test
public void storedUuidObjectMapTest() throws Exception {
StoredMap<UuidKey, UuidObject> sm = runner.getViews()
.getUuidObjectMap();
Iterator<Map.Entry<UuidKey, UuidObject>> it = sm
.entrySet().iterator();
List<String> names = new ArrayList<String>();
Map.Entry<UuidKey, UuidObject> entry = null;
while (it.hasNext()) {
entry = it.next();
names.add(entry.getValue().getObject().toString());
}
List<String> ln = list("Mike", "Sobolewski");
Collections.sort(names);
logger.info("names: " + names);
assertEquals(ln, names);
}
开发者ID:mwsobol,项目名称:SORCER,代码行数:22,代码来源:SorcerDatabaseTest.java
示例12: createMap
import com.sleepycat.collections.StoredMap; //导入依赖的package包/类
@Override
public <K, V> BerkeleyDbMap<K, V> createMap(final Class<K> keyType, final Class<V> valueType)
throws IllegalStateException {
try {
final EntryBinding keyBinding = createBinding(keyType);
final EntryBinding valueBinding = createBinding(valueType);
final Database database = createDatabase();
final StoredMap map = new StoredMap(database, keyBinding, valueBinding, true);
return new BerkeleyDbMap<>(getEnvironment(), database, map);
} catch (final DatabaseException e) {
throw new IllegalStateException(e);
}
}
开发者ID:datacleaner,项目名称:DataCleaner,代码行数:14,代码来源:BerkeleyDbStorageProvider.java
示例13: SampleViews
import com.sleepycat.collections.StoredMap; //导入依赖的package包/类
/**
* Create the data bindings and collection views.
*/
public SampleViews(SampleDatabase db) {
// In this sample, the stored key and data entries are used directly
// rather than mapping them to separate objects. Therefore, no binding
// classes are defined here and the SerialBinding class is used.
//
ClassCatalog catalog = db.getClassCatalog();
EntryBinding partKeyBinding =
new SerialBinding(catalog, PartKey.class);
EntryBinding partDataBinding =
new SerialBinding(catalog, PartData.class);
EntryBinding supplierKeyBinding =
new SerialBinding(catalog, SupplierKey.class);
EntryBinding supplierDataBinding =
new SerialBinding(catalog, SupplierData.class);
EntryBinding shipmentKeyBinding =
new SerialBinding(catalog, ShipmentKey.class);
EntryBinding shipmentDataBinding =
new SerialBinding(catalog, ShipmentData.class);
// Create map views for all stores and indices.
// StoredSortedMap is not used since the stores and indices are
// ordered by serialized key objects, which do not provide a very
// useful ordering.
//
partMap =
new StoredMap(db.getPartDatabase(),
partKeyBinding, partDataBinding, true);
supplierMap =
new StoredMap(db.getSupplierDatabase(),
supplierKeyBinding, supplierDataBinding, true);
shipmentMap =
new StoredMap(db.getShipmentDatabase(),
shipmentKeyBinding, shipmentDataBinding, true);
}
开发者ID:nologic,项目名称:nabs,代码行数:39,代码来源:SampleViews.java
示例14: createMap
import com.sleepycat.collections.StoredMap; //导入依赖的package包/类
@Override
public <K, V> BerkeleyDbMap<K, V> createMap(Class<K> keyType,
Class<V> valueType) throws IllegalStateException {
try {
final EntryBinding keyBinding = createBinding(keyType);
final EntryBinding valueBinding = createBinding(valueType);
final Database database = createDatabase();
final StoredMap map = new StoredMap(database, keyBinding,
valueBinding, true);
return new BerkeleyDbMap<K, V>(getEnvironment(), database, map);
} catch (DatabaseException e) {
throw new IllegalStateException(e);
}
}
开发者ID:datacleaner,项目名称:AnalyzerBeans,代码行数:15,代码来源:BerkeleyDbStorageProvider.java
示例15: getContext
import com.sleepycat.collections.StoredMap; //导入依赖的package包/类
public Context getContext(Uuid uuid) {
try {
append(uuid, "context");
StoredMap<UuidKey, Context> cxtMap = views.getContextMap();
return cxtMap.get(new UuidKey(uuid));
} finally {
objectsQueue.remove(uuid);
}
}
开发者ID:mwsobol,项目名称:SORCER,代码行数:10,代码来源:DatabaseProvider.java
示例16: getExertion
import com.sleepycat.collections.StoredMap; //导入依赖的package包/类
public Exertion getExertion(Uuid uuid) {
try {
append(uuid, "exertion");
StoredMap<UuidKey, Exertion> xrtMap = views.getExertionMap();
return xrtMap.get(new UuidKey(uuid));
} finally {
objectsQueue.remove(uuid);
}
}
开发者ID:mwsobol,项目名称:SORCER,代码行数:10,代码来源:DatabaseProvider.java
示例17: getTable
import com.sleepycat.collections.StoredMap; //导入依赖的package包/类
public ModelTable getTable(Uuid uuid) {
try {
append(uuid, "dataTable");
StoredMap<UuidKey, ModelTable> xrtMap = views.getTableMap();
return xrtMap.get(new UuidKey(uuid));
} finally {
objectsQueue.remove(uuid);
}
}
开发者ID:mwsobol,项目名称:SORCER,代码行数:10,代码来源:DatabaseProvider.java
示例18: run
import com.sleepycat.collections.StoredMap; //导入依赖的package包/类
public void run() {
StoredMap storedMap = null;
UuidKey key = null;
try {
key = new UuidKey(uuid);
if (object instanceof Context) {
storedMap = views.getContextMap();
storedMap.replace(key, object);
} else if (object instanceof Exertion) {
storedMap = views.getExertionMap();
storedMap.replace(key, object);
} else if (object instanceof ModelTable) {
storedMap = views.getTableMap();
storedMap.replace(key, object);
} else if (object instanceof Object) {
storedMap = views.getUuidObjectMap();
storedMap.replace(key, object);
}
} catch (IllegalArgumentException ie) {
logger.warn("Problem updating object with key: " + key.toString()
+ "\n" + storedMap.get(key).toString());
objectsQueue.remove(this.uuid);
throw (ie);
} finally {
objectsQueue.remove(this.uuid);
}
}
开发者ID:mwsobol,项目名称:SORCER,代码行数:28,代码来源:DatabaseProvider.java
示例19: getStoredMap
import com.sleepycat.collections.StoredMap; //导入依赖的package包/类
public StoredMap getStoredMap(Store storeType) {
waitIfBusy();
StoredMap storedMap = null;
if (storeType == Store.context) {
storedMap = views.getContextMap();
} else if (storeType == Store.exertion) {
storedMap = views.getExertionMap();
} else if (storeType == Store.table) {
storedMap = views.getTableMap();
} else if (storeType == Store.object) {
storedMap = views.getUuidObjectMap();
}
return storedMap;
}
开发者ID:mwsobol,项目名称:SORCER,代码行数:15,代码来源:DatabaseProvider.java
示例20: SessionDatabaseViews
import com.sleepycat.collections.StoredMap; //导入依赖的package包/类
/**
* Create the data bindings and collection views.
*/
public SessionDatabaseViews(SessionDatabase db) {
// Create the data bindings.
ClassCatalog catalog = db.getClassCatalog();
SerialBinding sessionKeyBinding = new SerialBinding(catalog, UuidKey.class);
EntityBinding sessionDataBinding = new SessionBinding(catalog,
UuidKey.class, MarshalledData.class);
sessionMap = new StoredMap(db.getSessionDatabase(),
sessionKeyBinding, sessionDataBinding, true);
}
开发者ID:mwsobol,项目名称:SORCER,代码行数:14,代码来源:SessionDatabaseViews.java
注:本文中的com.sleepycat.collections.StoredMap类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论