blob: 8e20bb70a59483dd6f96cad8a3c9252f9801b5d6 [file] [log] [blame]
Toshio Koidead17d5e2014-02-11 11:36:02 -08001package net.onrc.onos.intent;
2
3/**
4 * @author Toshio Koide (t-koide@onlab.us)
5 */
Toshio Koideb609b3b2014-02-14 18:25:52 -08006public class Intent {
Nick Karanatsios88948d32014-02-18 15:14:30 -08007 public enum IntentState {
Toshio Koideb609b3b2014-02-14 18:25:52 -08008 CREATED,
9 INST_REQ,
10 INST_NACK,
11 INST_ACK,
12 DEL_REQ,
13 DEL_PENDING,
14 DEL_ACK,
Toshio Koide0e4d8d22014-02-14 10:56:10 -080015 }
Toshio Koideb609b3b2014-02-14 18:25:52 -080016
Toshio Koide13986d12014-02-11 20:25:32 -080017 protected String id;
Toshio Koideb609b3b2014-02-14 18:25:52 -080018 protected IntentState state = IntentState.CREATED;
Toshio Koide0e4d8d22014-02-14 10:56:10 -080019
20 /**
21 * Default constructor for Kryo deserialization
22 */
Toshio Koidec406e792014-02-14 16:52:42 -080023 protected Intent() {
Toshio Koide0e4d8d22014-02-14 10:56:10 -080024 }
Toshio Koide13986d12014-02-11 20:25:32 -080025
26 public Intent(String id) {
27 this.id = id;
28 }
29
Toshio Koideb609b3b2014-02-14 18:25:52 -080030 public Intent(String id, IntentState state) {
31 this.id = id;
32 this.state = state;
33 }
34
Toshio Koide13986d12014-02-11 20:25:32 -080035 public String getId() {
36 return id;
37 }
Toshio Koideb609b3b2014-02-14 18:25:52 -080038
Toshio Koide0e4d8d22014-02-14 10:56:10 -080039 public IntentState getState() {
40 return state;
41 }
Toshio Koideb609b3b2014-02-14 18:25:52 -080042
Toshio Koide0e4d8d22014-02-14 10:56:10 -080043 public IntentState setState(IntentState newState) {
44 IntentState oldState = state;
45 state = newState;
46 return oldState;
47 }
Toshio Koide4f308732014-02-18 15:19:48 -080048
Toshio Koide13986d12014-02-11 20:25:32 -080049 @Override
50 public int hashCode() {
51 return id.hashCode();
52 }
Toshio Koidead17d5e2014-02-11 11:36:02 -080053}