2 * Copyright (C) 2014 Red Hat, Inc.
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
8 * Authors : Dave Tucker, Flavio Fernandes
11 package org.opendaylight.ovsdb.openstack.netvirt;
13 import org.opendaylight.ovsdb.openstack.netvirt.api.Action;
16 * Abstract class for events used by neutron northbound and southbound events.
18 public abstract class AbstractEvent {
20 public enum HandlerType {
25 NEUTRON_PORT_SECURITY,
29 NEUTRON_LOAD_BALANCER,
30 NEUTRON_LOAD_BALANCER_POOL,
31 NEUTRON_LOAD_BALANCER_POOL_MEMBER,
34 public static final int size = HandlerType.values().length;
37 private HandlerType handlerType;
38 private Action action;
40 private AbstractEvent() {
41 // this is private to force proper construction
44 protected AbstractEvent(HandlerType handlerType, Action action) {
45 this.handlerType = handlerType;
49 public HandlerType getHandlerType() {
53 public Action getAction() {
58 public String toString() {
59 return "AbstractEvent [handlerType=" + handlerType + " action=" + action + "]";
63 public int hashCode() {
66 result = prime * result + ((handlerType == null) ? 0 : handlerType.hashCode());
67 result = prime * result + ((action == null) ? 0 : action.hashCode());
72 public boolean equals(Object obj) {
79 if (getClass() != obj.getClass()) {
82 AbstractEvent other = (AbstractEvent) obj;
83 if (handlerType == null) {
84 if (other.handlerType != null) {
87 } else if (!handlerType.equals(other.handlerType)) {
91 if (other.action != null) {
94 } else if (!action.equals(other.action)) {