FailoverState.java
01 /*
02  *
03  * Licensed to the Apache Software Foundation (ASF) under one
04  * or more contributor license agreements.  See the NOTICE file
05  * distributed with this work for additional information
06  * regarding copyright ownership.  The ASF licenses this file
07  * to you under the Apache License, Version 2.0 (the
08  * "License"); you may not use this file except in compliance
09  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  */
21 package org.apache.qpid.client.failover;
22 
23 /**
24  * Defines the possible states of the failover process; not started, in progress, failed.
25  *
26  <p/><table id="crc"><caption>CRC Card</caption>
27  <tr><th> Responsibilities <th> Collaborations
28  <tr><td> Represent a one of the states of the fail-over process.
29  </table>
30  */
31 public final class FailoverState
32 {
33     /** The string description on this state. */
34     private final String _state;
35 
36     /** Failover has not yet been attempted on this connection. */
37     public static final FailoverState NOT_STARTED = new FailoverState("NOT STARTED");
38 
39     /** Failover has been requested on this connection but has not completed. */
40     public static final FailoverState IN_PROGRESS = new FailoverState("IN PROGRESS");
41 
42     /** Failover has been attempted and failed. */
43     public static final FailoverState FAILED = new FailoverState("FAILED");
44 
45     /**
46      * Creates a type safe enumeration of a fail-over state.
47      *
48      @param state The fail-over state description string.
49      */
50     private FailoverState(String state)
51     {
52         _state = state;
53     }
54 
55     /**
56      * Prints this state, mainly for debugging purposes.
57      *
58      @return The string description of this state.
59      */
60     public String toString()
61     {
62         return "FailoverState: " + _state;
63     }
64 }