Main Page | Class Hierarchy | Data Structures | Directories | File List | Data Fields | Related Pages

ReplicationConfig.java

00001 /*-
00002  * See the file LICENSE for redistribution information.
00003  *
00004  * Copyright (c) 2002-2005
00005  *      Sleepycat Software.  All rights reserved.
00006  *
00007  * $Id: ReplicationConfig.java,v 12.3 2005/11/02 03:14:12 mjc Exp $
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     /* package */
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     /* package */
00053     int getFlag() {
00054         return flag;
00055     }
00056 
00057     public String toString() {
00058         return "ReplicationConfig." + configName;
00059     }
00060 }

Generated on Sun Dec 25 12:14:33 2005 for Berkeley DB 4.4.16 by  doxygen 1.4.2