2 * Copyright (c) 2014, 2015 Red Hat, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.ovsdb.openstack.netvirt;
11 import org.opendaylight.ovsdb.openstack.netvirt.api.Action;
14 * Abstract class for events used by neutron northbound and southbound events.
16 public abstract class AbstractEvent {
18 public enum HandlerType {
23 NEUTRON_PORT_SECURITY,
27 NEUTRON_LOAD_BALANCER,
28 NEUTRON_LOAD_BALANCER_POOL,
29 NEUTRON_LOAD_BALANCER_POOL_MEMBER,
32 public static final int size = HandlerType.values().length;
35 private HandlerType handlerType;
36 private Action action;
37 private int transactionId;
39 public int getTransactionId() {
43 private static int txId = 0;
44 private static int incTxId() {
47 public static int getTxId() {
51 private AbstractEvent() {
52 // this is private to force proper construction
55 protected AbstractEvent(HandlerType handlerType, Action action) {
56 this.handlerType = handlerType;
58 this.transactionId = incTxId();
61 public HandlerType getHandlerType() {
65 public Action getAction() {
70 public String toString() {
71 return "AbstractEvent [transactionId=" + transactionId
72 + " handlerType=" + handlerType + " action=" + action + "]";
76 public int hashCode() {
79 result = prime * result + ((handlerType == null) ? 0 : handlerType.hashCode());
80 result = prime * result + ((action == null) ? 0 : action.hashCode());
85 public boolean equals(Object obj) {
92 if (getClass() != obj.getClass()) {
95 AbstractEvent other = (AbstractEvent) obj;
96 if (handlerType == null) {
97 if (other.handlerType != null) {
100 } else if (!handlerType.equals(other.handlerType)) {
103 if (action == null) {
104 if (other.action != null) {
107 } else if (!action.equals(other.action)) {