00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 package com.sleepycat.db;
00011
00012 import com.sleepycat.db.internal.DbConstants;
00013
00014 public final class ReplicationConfig implements Cloneable {
00015 public static final ReplicationConfig BULK =
00016 new ReplicationConfig("BULK", DbConstants.DB_REP_CONF_BULK);
00017
00018 public static final ReplicationConfig DELAYCLIENT =
00019 new ReplicationConfig("DELAYCLIENT", DbConstants.DB_REP_CONF_DELAYCLIENT);
00020
00021 public static final ReplicationConfig NOAUTOINIT =
00022 new ReplicationConfig("NOAUTOINIT", DbConstants.DB_REP_CONF_NOAUTOINIT);
00023
00024 public static final ReplicationConfig NOWAIT =
00025 new ReplicationConfig("NOWAIT", DbConstants.DB_REP_CONF_NOWAIT);
00026
00027
00028 static ReplicationConfig fromInt(int which) {
00029 switch(which) {
00030 case DbConstants.DB_REP_CONF_BULK:
00031 return BULK;
00032 case DbConstants.DB_REP_CONF_DELAYCLIENT:
00033 return DELAYCLIENT;
00034 case DbConstants.DB_REP_CONF_NOAUTOINIT:
00035 return NOAUTOINIT;
00036 case DbConstants.DB_REP_CONF_NOWAIT:
00037 return NOWAIT;
00038 default:
00039 throw new IllegalArgumentException(
00040 "Unknown replication config: " + which);
00041 }
00042 }
00043
00044 private String configName;
00045 private int flag;
00046
00047 private ReplicationConfig(final String configName, final int flag) {
00048 this.configName = configName;
00049 this.flag = flag;
00050 }
00051
00052
00053 int getFlag() {
00054 return flag;
00055 }
00056
00057 public String toString() {
00058 return "ReplicationConfig." + configName;
00059 }
00060 }