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

RecoveryOperation.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: RecoveryOperation.java,v 12.1 2005/06/16 20:23:03 bostic Exp $
00008  */
00009 
00010 package com.sleepycat.db;
00011 
00012 import com.sleepycat.db.internal.DbConstants;
00013 
00014 public final class RecoveryOperation {
00015     public static final RecoveryOperation BACKWARD_ROLL =
00016         new RecoveryOperation("BACKWARD_ROLL", DbConstants.DB_TXN_BACKWARD_ROLL);
00017     public static final RecoveryOperation FORWARD_ROLL =
00018         new RecoveryOperation("FORWARD_ROLL", DbConstants.DB_TXN_FORWARD_ROLL);
00019     public static final RecoveryOperation ABORT =
00020         new RecoveryOperation("ABORT", DbConstants.DB_TXN_ABORT);
00021     public static final RecoveryOperation APPLY =
00022         new RecoveryOperation("APPLY", DbConstants.DB_TXN_APPLY);
00023     public static final RecoveryOperation PRINT =
00024         new RecoveryOperation("PRINT", DbConstants.DB_TXN_PRINT);
00025 
00026     private String operationName;
00027     private int flag;
00028 
00029     private RecoveryOperation(String operationName, int flag) {
00030         this.operationName = operationName;
00031         this.flag = flag;
00032     }
00033 
00034     public String toString() {
00035         return "RecoveryOperation." + operationName;
00036     }
00037 
00038     /* This is public only so it can be called from internal/DbEnv.java. */
00039     public static RecoveryOperation fromFlag(int flag) {
00040         switch (flag) {
00041         case DbConstants.DB_TXN_BACKWARD_ROLL:
00042             return BACKWARD_ROLL;
00043         case DbConstants.DB_TXN_FORWARD_ROLL:
00044             return FORWARD_ROLL;
00045         case DbConstants.DB_TXN_ABORT:
00046             return ABORT;
00047         case DbConstants.DB_TXN_APPLY:
00048             return APPLY;
00049         case DbConstants.DB_TXN_PRINT:
00050             return PRINT;
00051         default:
00052             throw new IllegalArgumentException(
00053                 "Unknown recover operation: " + flag);
00054         }
00055     }
00056 }

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