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


Java Environment类代码示例

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


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

示例1: open

import com.sleepycat.je.Environment; //导入依赖的package包/类
/**
 * 打开数据库环境及数据库本身
 * 
 * 写在open()之后的方法,都必须调用open()方法之后才能正常使用
 */
public void open()
{
    try
    {
        this.environment   = new Environment(new File(this.environmentHome) ,this.environmentConfig);
        
        this.database      = this.environment.openDatabase(null ,this.databaseName ,this.databaseConfig);
        
        this.classBerkeley = new ClassBerkeley(this ,this.databaseName + "_ClassCatalog");
    }
    catch (Exception exce)
    {
        exce.printStackTrace();
    }
}
 
开发者ID:HY-ZhengWei,项目名称:hy.common.berkeley,代码行数:21,代码来源:Berkeley.java

示例2: BerkeleyDBIdentifierMap

import com.sleepycat.je.Environment; //导入依赖的package包/类
public BerkeleyDBIdentifierMap(final Environment dbEnvironment, final FudgeContext fudgeContext) {
  ArgumentChecker.notNull(dbEnvironment, "dbEnvironment");
  ArgumentChecker.notNull(fudgeContext, "fudgeContext");
  _fudgeContext = fudgeContext;
  _valueSpecificationToIdentifier = new AbstractBerkeleyDBComponent(dbEnvironment, VALUE_SPECIFICATION_TO_IDENTIFIER_DATABASE) {
    @Override
    protected DatabaseConfig getDatabaseConfig() {
      return BerkeleyDBIdentifierMap.this.getDatabaseConfig();
    }
  };
  _identifierToValueSpecification = new AbstractBerkeleyDBComponent(dbEnvironment, IDENTIFIER_TO_VALUE_SPECIFICATION_DATABASE) {
    @Override
    protected DatabaseConfig getDatabaseConfig() {
      return BerkeleyDBIdentifierMap.this.getDatabaseConfig();
    }

    @Override
    protected void postStartInitialization() {
      _nextIdentifier.set(_identifierToValueSpecification.getDatabase().count() + 1);
    }
  };
  _newIdentifierMeter = OpenGammaMetricRegistry.getDetailedInstance().meter("BerkeleyDBIdentifierMap.newIdentifier");
  _getIdentifierTimer = OpenGammaMetricRegistry.getDetailedInstance().timer("BerkeleyDBIdentifierMap.getIdentifier");
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:25,代码来源:BerkeleyDBIdentifierMap.java

示例3: UpdateGroundhogScript

import com.sleepycat.je.Environment; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public UpdateGroundhogScript(File datadir) throws DatabaseException {
  environmentConfig = new EnvironmentConfig();
  environmentConfig.setAllowCreate(true);
  environmentConfig.setTransactional(true);
  environmentConfig.setCacheSize(302400000);

  // perform other environment configurations

  environment = new Environment(datadir, environmentConfig);
  List<String> names = environment.getDatabaseNames();
  if (names.contains(datadir.getName())) {
    environment.renameDatabase(null, datadir.getName(), databaseName);
  }
  environment.close();
}
 
开发者ID:BiosemanticsDotOrg,项目名称:GeneDiseasePaper,代码行数:17,代码来源:UpdateGroundhogScript.java

示例4: init

import com.sleepycat.je.Environment; //导入依赖的package包/类
private void init(File datadir){
  try {
    environmentConfig = new EnvironmentConfig();
    environmentConfig.setAllowCreate(true);
    environmentConfig.setTransactional(true);
    environmentConfig.setCacheSize(30240000);

    environment = new Environment(datadir, environmentConfig);

    databaseConfig = new DatabaseConfig();
    databaseConfig.setAllowCreate(true);
    databaseConfig.setTransactional(true);

    openDB();

    myIntegerBinding = TupleBinding.getPrimitiveBinding(Integer.class);
    myDataBinding = new IntegerToSetOfIntegersBinding();
    
    sh = new IntegerSetStoreShutdown();
    sh.g = this;
    Runtime.getRuntime().addShutdownHook(sh);
  } catch (DatabaseException e) {
    e.printStackTrace();
  }

}
 
开发者ID:BiosemanticsDotOrg,项目名称:GeneDiseasePaper,代码行数:27,代码来源:IntegerSetStore.java

示例5: init

import com.sleepycat.je.Environment; //导入依赖的package包/类
private void init(File datadir){
  try {
    environmentConfig = new EnvironmentConfig();
    environmentConfig.setAllowCreate(true);
    environmentConfig.setTransactional(true);
    environmentConfig.setCacheSize(30240000);

    environment = new Environment(datadir, environmentConfig);

    databaseConfig = new DatabaseConfig();
    databaseConfig.setAllowCreate(true);
    databaseConfig.setTransactional(true);

    openDB();

    myIntegerBinding = TupleBinding.getPrimitiveBinding(Integer.class);
    myDataBinding = new Integer2Integer2IntegerMapBinding();
    
    sh = new CooccurrenceDatabaseShutdown();
    sh.c = this;
    Runtime.getRuntime().addShutdownHook(sh);
  } catch (DatabaseException e) {
    e.printStackTrace();
  }

}
 
开发者ID:BiosemanticsDotOrg,项目名称:GeneDiseasePaper,代码行数:27,代码来源:CooccurrenceDatabase.java

示例6: initialize

import com.sleepycat.je.Environment; //导入依赖的package包/类
private void initialize() throws DatabaseException{
  environmentConfig = new EnvironmentConfig();
  environmentConfig.setAllowCreate(true);
  environmentConfig.setTransactional(false);
  environmentConfig.setCacheSize(cachesize);

  // perform other environment configurations

  environment = new Environment(datadir, environmentConfig);

  databaseConfig = new DatabaseConfig();
  databaseConfig.setAllowCreate(true);
  databaseConfig.setTransactional(false);

  // perform other database configurations

  openDB();

  // add a shutdown hook to close the database when the VM is terminated
  sh = new Shutdown();
  sh.cache = this;
  Runtime.getRuntime().addShutdownHook(sh);
}
 
开发者ID:BiosemanticsDotOrg,项目名称:GeneDiseasePaper,代码行数:24,代码来源:SleepyCatStoreCache.java

示例7: getDatabase

import com.sleepycat.je.Environment; //导入依赖的package包/类
public Database getDatabase(String name, boolean isTmp, boolean isSortedDuplicates) {
    DatabaseConfig dbConfig = new DatabaseConfig();
    dbConfig.setAllowCreate(true);
    Environment _env = env;
    if (isTmp) {
        dbConfig.setTemporary(true);
        dbConfig.setSortedDuplicates(isSortedDuplicates);
        _env = getTmpEnv();
    } else {
        if (!config.isTransactional()) {
            dbConfig.setDeferredWrite(config.isCommitSync());
        } else {
            dbConfig.setTransactional(true);
        }
    }

    Database database = buildPrimaryIndex(dbConfig, _env, name);
    return database;
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:20,代码来源:JE_Repository.java

示例8: init

import com.sleepycat.je.Environment; //导入依赖的package包/类
@Override
public void init() {

    EnvironmentConfig envConfig = new EnvironmentConfig();
    commonConfig(envConfig);
    envConfig.setCachePercent(config.getCachePercent());
    envConfig.setAllowCreate(true);
    if (config.isTransactional()) {
        envConfig.setCachePercent(config.getCachePercent());
        envConfig.setTransactional(config.isTransactional());
        envConfig.setTxnTimeout(config.getTxnTimeout(), TimeUnit.SECONDS);
        this.durability = config.isCommitSync() ? Durability.COMMIT_SYNC : Durability.COMMIT_NO_SYNC;
        envConfig.setDurability(this.durability);
    }
    File repo_dir = new File(config.getRepoDir());
    if (!repo_dir.exists()) {
        repo_dir.mkdirs();
    }
    this.env = new Environment(repo_dir, envConfig);
    cef = new CommandHandlerFactoryBDBImpl();
    cursorFactoryBDBImp = new CursorFactoryBDBImp();

}
 
开发者ID:beebeandwer,项目名称:TDDL,代码行数:24,代码来源:JE_Repository.java

示例9: WebGraph

import com.sleepycat.je.Environment; //导入依赖的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

示例10: AbstractFrontier

import com.sleepycat.je.Environment; //导入依赖的package包/类
public AbstractFrontier(String homeDirectory) {
  EnvironmentConfig envConfig = new EnvironmentConfig();
  envConfig.setTransactional(true);
  envConfig.setAllowCreate(true);
  env = new Environment(new File(homeDirectory), envConfig);
  // 设置databaseconfig
  DatabaseConfig dbConfig = new DatabaseConfig();
  dbConfig.setTransactional(true);
  dbConfig.setAllowCreate(true);
  // 打开
  catalogdatabase = env.openDatabase(null, CLASS_CATALOG, dbConfig);
  javaCatalog = new StoredClassCatalog(catalogdatabase);
  // 设置databaseconfig
  DatabaseConfig dbConfig0 = new DatabaseConfig();
  dbConfig0.setTransactional(true);
  dbConfig0.setAllowCreate(true);
  database = env.openDatabase(null, "URL", dbConfig0);
}
 
开发者ID:classtag,项目名称:scratch_crawler,代码行数:19,代码来源:AbstractFrontier.java

示例11: createEnv

import com.sleepycat.je.Environment; //导入依赖的package包/类
private Environment createEnv(boolean readOnly, File envDir) 
    throws DatabaseException {

    EnvironmentConfig envConfig = TestUtils.initEnvConfig();
    DbInternal.disableParameterValidation(envConfig);
    envConfig.setAllowCreate(true);
    envConfig.setReadOnly(readOnly);
    envConfig.setConfigParam(EnvironmentParams.LOG_FILE_MAX.getName(),
                             "400");
    envConfig.setConfigParam(EnvironmentParams.ENV_RUN_CLEANER.getName(),
                             "false");

    Environment env = new Environment(envDir, envConfig);

    return env;
}
 
开发者ID:nologic,项目名称:nabs,代码行数:17,代码来源:DbBackupTest.java

示例12: setup

import com.sleepycat.je.Environment; //导入依赖的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);

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

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

}
 
开发者ID:nologic,项目名称:nabs,代码行数:25,代码来源:MyDbEnv.java

示例13: open

import com.sleepycat.je.Environment; //导入依赖的package包/类
/**
 * ???
 */
public void open() {
    if (!isClosed()) {
        NeoLogger.warn("This backend is already open");
    }
    try {
        environment = new Environment(file, environmentConfig);

        this.containers = environment.openDatabase(null, KEY_CONTAINER, databaseConfig);
        this.instances = environment.openDatabase(null, KEY_INSTANCE_OF, databaseConfig);
        this.features = environment.openDatabase(null, KEY_FEATURES, databaseConfig);
        this.multivaluedFeatures = environment.openDatabase(null, KEY_MULTIVALUED_FEATURES, databaseConfig);
        isClosed = false;
    }
    catch (DatabaseException e) {
        NeoLogger.error(e);
    }
}
 
开发者ID:atlanmod,项目名称:NeoEMF,代码行数:21,代码来源:BerkeleyDbPersistenceBackend.java

示例14: setUp

import com.sleepycat.je.Environment; //导入依赖的package包/类
public void setUp()
    throws IOException, DatabaseException {

    TestUtils.removeFiles("Setup", envHome, FileManager.JE_SUFFIX);

    /*
     * Run environment without in compressor on so we can check the
     * compressor queue in a deterministic way.
     */
    EnvironmentConfig envConfig = TestUtils.initEnvConfig();
    envConfig.setTransactional(true);
    envConfig.setConfigParam(EnvironmentParams.NODE_MAX.getName(), "6");
    envConfig.setConfigParam(EnvironmentParams.
 ENV_RUN_INCOMPRESSOR.getName(),
                             "false");
    envConfig.setAllowCreate(true);
    env = new Environment(envHome, envConfig);
}
 
开发者ID:nologic,项目名称:nabs,代码行数:19,代码来源:TxnEndTest.java

示例15: renameDatabase

import com.sleepycat.je.Environment; //导入依赖的package包/类
/**
 * Returns false if the database is not found.
 */
public static boolean renameDatabase(Environment env,
                                     Transaction txn,
                                     String oldFileName,
                                     String oldDbName,
                                     String newFileName,
                                     String newDbName) {
    assert oldFileName == null;
    assert newFileName == null;
    try {
        env.renameDatabase(txn, oldDbName, newDbName);
        return true;
    } catch (DatabaseNotFoundException e) {
        return false;
    }
}
 
开发者ID:prat0318,项目名称:dbms,代码行数:19,代码来源:DbCompat.java


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