當前位置: 首頁>>代碼示例>>Java>>正文


Java EnvironmentConfig.setAllowCreate方法代碼示例

本文整理匯總了Java中com.sleepycat.je.EnvironmentConfig.setAllowCreate方法的典型用法代碼示例。如果您正苦於以下問題:Java EnvironmentConfig.setAllowCreate方法的具體用法?Java EnvironmentConfig.setAllowCreate怎麽用?Java EnvironmentConfig.setAllowCreate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.sleepycat.je.EnvironmentConfig的用法示例。


在下文中一共展示了EnvironmentConfig.setAllowCreate方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: main

import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的package包/類
public static void main(String [] args) throws Exception
{
    EnvironmentConfig v_EnvConfig = new EnvironmentConfig();
    DatabaseConfig    v_DBConfig  = new DatabaseConfig();
    Berkeley          v_Berkeley  = new Berkeley();
    
    v_EnvConfig.setAllowCreate(true);
    v_DBConfig.setAllowCreate(true);
    
    v_Berkeley.setEnvironmentConfig(v_EnvConfig);
    v_Berkeley.setDatabaseConfig(   v_DBConfig);
    v_Berkeley.setEnvironmentHome(  "/Users/hy/WSS/WorkSpace_SearchDesktop/hy.common.berkeley/db");
    v_Berkeley.setDatabaseName(     "HY");
    
    v_Berkeley.open();
    
    
    String v_Key = "ZhengWei(HY)";
    
    v_Berkeley.put(v_Key ,Date.getNowTime().getFullMilli());
    System.out.println(v_Berkeley.get(v_Key));
}
 
開發者ID:HY-ZhengWei,項目名稱:hy.common.berkeley,代碼行數:23,代碼來源:JU_Berkeley.java

示例2: UpdateGroundhogScript

import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的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

示例3: init

import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的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

示例4: init

import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的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

示例5: initialize

import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的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

示例6: init

import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的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

示例7: WebGraph

import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的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

示例8: AbstractFrontier

import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的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

示例9: openEnv

import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的package包/類
/**
    * Opens the environment and db.
    */
   private void openEnv(boolean transactional, boolean dups, String nodeMax)
       throws DatabaseException {

       hasDups = dups;

       EnvironmentConfig envConfig = TestUtils.initEnvConfig();
       envConfig.setTransactional(transactional);
       envConfig.setConfigParam
           (EnvironmentParams.ENV_RUN_INCOMPRESSOR.getName(), "false");
if (nodeMax != null) {
    envConfig.setConfigParam
    (EnvironmentParams.NODE_MAX.getName(), nodeMax);
    envConfig.setConfigParam
    (EnvironmentParams.NODE_MAX_DUPTREE.getName(), nodeMax);
}
       envConfig.setAllowCreate(true);
       env = new Environment(envHome, envConfig);

       /* Make a db and open it. */
       DatabaseConfig dbConfig = new DatabaseConfig();
       dbConfig.setTransactional(transactional);
       dbConfig.setSortedDuplicates(dups);
       dbConfig.setAllowCreate(true);
       db = env.openDatabase(null, "testDB", dbConfig);
   }
 
開發者ID:nologic,項目名稱:nabs,代碼行數:29,代碼來源:INCompressorTest.java

示例10: main

import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的package包/類
/** Creates the environment and runs a transaction */
public static void main(String[] argv)
    throws Exception {

    String dir = "./tmp";

    // environment is transactional
    EnvironmentConfig envConfig = new EnvironmentConfig();
    envConfig.setTransactional(true);
    if (create) {
        envConfig.setAllowCreate(true);
    }
    Environment env = new Environment(new File(dir), envConfig);

    // create the application and run a transaction
    HelloDatabaseWorld worker = new HelloDatabaseWorld(env);
    TransactionRunner runner = new TransactionRunner(env);
    try {
        // open and access the database within a transaction
        runner.run(worker);
    } finally {
        // close the database outside the transaction
        worker.close();
    }
}
 
開發者ID:nologic,項目名稱:nabs,代碼行數:26,代碼來源:HelloDatabaseWorld.java

示例11: initDbs

import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的package包/類
/**
    * Set up the environment and db.
    */
   private void initDbs(int nDumps, Hashtable[] dataMaps)
throws DatabaseException {

EnvironmentConfig envConfig = TestUtils.initEnvConfig();
       envConfig.setConfigParam(EnvironmentParams.NODE_MAX.getName(), "6");
       envConfig.setAllowCreate(true);
       env = new Environment(envHome, envConfig);

       /* Make a db and open it. */
       for (int i = 0; i < nDumps; i += 1) {
           DatabaseConfig dbConfig = new DatabaseConfig();
           dbConfig.setAllowCreate(true);
           dbConfig.setSortedDuplicates(true);
           Database myDb = env.openDatabase(null, dbName + i, dbConfig);
           Cursor cursor = myDb.openCursor(null, null);
           doLargePut(dataMaps[i], cursor, N_KEYS);
           cursor.close();
           myDb.close();
       }
   }
 
開發者ID:nologic,項目名稱:nabs,代碼行數:24,代碼來源:DbDumpTest.java

示例12: initEngine

import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的package包/類
public boolean initEngine(File envHome)
{
 EnvironmentConfig envConfig = new EnvironmentConfig();
 m_DbConfig = new DatabaseConfig();
    
 // If the environment is read-only, then
 // make the databases read-only too.
 envConfig.setReadOnly(false);
 m_DbConfig.setReadOnly(false);
    
 // If the environment is opened for write, then we want to be 
 // able to create the environment and databases if 
 // they do not exist.
 envConfig.setAllowCreate(true);
 m_DbConfig.setAllowCreate(true);
    
 // Allow transactions if we are writing to the database
 envConfig.setTransactional(false);
 m_DbConfig.setTransactional(false);
 
 m_DbConfig.setDeferredWrite(true);
 
 envConfig.setLocking(false);	// No locking

 m_DbConfig.setBtreeComparator(BtreeKeyComparator.class);
    
 // Open the environment
 try
 {
 	m_env = new Environment(envHome, envConfig);
 	return true;
 }
 catch(DatabaseException e)
 {
 	return false;
 }
}
 
開發者ID:costea7,項目名稱:ChronoBike,代碼行數:38,代碼來源:BTreeEnv.java

示例13: start

import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的package包/類
/**
 * 打開數據庫方法
 */
public static void start(String path) {
    if (isrunning) {
        return;
    }
    /******************** 文件處理 ***********************/
    File envDir = new File(path);// 操作文件
    if (!envDir.exists())// 判斷文件路徑是否存在,不存在則創建
    {
        envDir.mkdir();// 創建
    }
 
    /******************** 環境配置 ***********************/
    EnvironmentConfig envConfig = new EnvironmentConfig();
    envConfig.setTransactional(false); // 不進行事務處理
    envConfig.setAllowCreate(true); // 如果不存在則創建一個
    exampleEnv = new Environment(envDir, envConfig);// 通過路徑,設置屬性進行創建
 
    /******************* 創建適配器對象 ******************/
    DatabaseConfig dbConfig = new DatabaseConfig();
    dbConfig.setTransactional(false); // 不進行事務處理
    dbConfig.setAllowCreate(true);// 如果不存在則創建一個
    dbConfig.setSortedDuplicates(true);// 數據分類
 
    bdb = exampleEnv.openDatabase(null, "simpleDb", dbConfig); // 使用適配器打開數據庫
    isrunning = true; // 設定是否運行
}
 
開發者ID:tiglabs,項目名稱:jsf-core,代碼行數:30,代碼來源:BDBTest.java

示例14: init

import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的package包/類
public void init() throws EnvironmentLockedException, DatabaseException {
    EnvironmentConfig environmentConfig = new EnvironmentConfig();
    DatabaseConfig dbConfig = new DatabaseConfig();
    dbConfig.setAllowCreate(true);
    dbConfig.setSortedDuplicates(true);
    environmentConfig.setReadOnly(false);
    environmentConfig.setAllowCreate(true);
    // Open the environment and entity store
    if (!dataDir.exists()) {
        dataDir.mkdirs();
    }
    environment = new Environment(dataDir, environmentConfig);
    // Database database = environment.openDatabase(transaction, "BDB", dbConfig);
    this.bdb = new BdbDatabaseImpl(environment, "DEFAULT");
}
 
開發者ID:tanhaichao,項目名稱:leopard,代碼行數:16,代碼來源:BdbImpl.java

示例15: constructDatabaseEnvironmentImpl

import com.sleepycat.je.EnvironmentConfig; //導入方法依賴的package包/類
private static Environment constructDatabaseEnvironmentImpl(final File dbDir, final boolean transactional) {
  if (!dbDir.exists()) {
    dbDir.mkdirs();
  }
  final EnvironmentConfig envConfig = new EnvironmentConfig();
  envConfig.setAllowCreate(true);
  envConfig.setTransactional(transactional);
  return new Environment(dbDir, envConfig);
}
 
開發者ID:DevStreet,項目名稱:FinanceAnalytics,代碼行數:10,代碼來源:BerkeleyDBViewComputationCacheSource.java


注:本文中的com.sleepycat.je.EnvironmentConfig.setAllowCreate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。