Пример #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());
   }
 }