예제 #1
0
 public DatabaseConfig getConfig__wrappee__base() throws DatabaseException {
   DatabaseConfig showConfig = configuration.cloneConfig();
   Comparator btComp = (databaseImpl == null ? null : databaseImpl.getBtreeComparator());
   Comparator dupComp = (databaseImpl == null ? null : databaseImpl.getDuplicateComparator());
   showConfig.setBtreeComparator(btComp == null ? null : btComp.getClass());
   showConfig.setDuplicateComparator(dupComp == null ? null : dupComp.getClass());
   return showConfig;
 }
예제 #2
0
 private void init__wrappee__base(Environment env, DatabaseConfig config)
     throws DatabaseException {
   handleLocker = null;
   envHandle = env;
   configuration = config.cloneConfig();
   isWritable = !configuration.getReadOnly();
   state = OPEN;
 }
예제 #3
0
 void initExisting__wrappee__base(
     Environment env, Locker locker, DatabaseImpl databaseImpl, DatabaseConfig dbConfig)
     throws DatabaseException {
   validateConfigAgainstExistingDb(dbConfig, databaseImpl);
   init(env, dbConfig);
   this.databaseImpl = databaseImpl;
   databaseImpl.addReferringHandle(this);
   configuration.setSortedDuplicates(databaseImpl.getSortedDuplicates());
   configuration.setTransactional(databaseImpl.isTransactional());
 }
예제 #4
0
 void initNew__wrappee__base(
     Environment env, Locker locker, String databaseName, DatabaseConfig dbConfig)
     throws DatabaseException {
   if (dbConfig.getReadOnly()) {
     throw new DatabaseException(
         "DatabaseConfig.setReadOnly() must be set to false " + "when creating a Database");
   }
   init(env, dbConfig);
   EnvironmentImpl environmentImpl = DbInternal.envGetEnvironmentImpl(envHandle);
   databaseImpl = environmentImpl.createDb(locker, databaseName, dbConfig, this);
   databaseImpl.addReferringHandle(this);
 }
예제 #5
0
 private void validateConfigAgainstExistingDb__wrappee__base(
     DatabaseConfig config, DatabaseImpl databaseImpl) throws DatabaseException {
   if (!config.getUseExistingConfig()) {
     if (databaseImpl.getSortedDuplicates() != config.getSortedDuplicates()) {
       throw new DatabaseException(
           "You can't open a Database with a duplicatesAllowed "
               + "configuration of "
               + config.getSortedDuplicates()
               + " if the underlying database was created with a "
               + "duplicatesAllowedSetting of "
               + databaseImpl.getSortedDuplicates()
               + ".");
     }
   }
   if (databaseImpl.hasOpenHandles()) {
     if (!config.getUseExistingConfig()) {
       if (config.getTransactional() != databaseImpl.isTransactional()) {
         throw new DatabaseException(
             "You can't open a Database with a transactional "
                 + "configuration of "
                 + config.getTransactional()
                 + " if the underlying database was created with a "
                 + "transactional configuration of "
                 + databaseImpl.isTransactional()
                 + ".");
       }
     }
   } else {
     databaseImpl.setTransactional(config.getTransactional());
   }
   if (config.getOverrideBtreeComparator()) {
     databaseImpl.setBtreeComparator(config.getBtreeComparator());
   }
   if (config.getOverrideDuplicateComparator()) {
     databaseImpl.setDuplicateComparator(config.getDuplicateComparator());
   }
 }