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 {
19 public enum HandlerType {
24 NEUTRON_PORT_SECURITY,
28 NEUTRON_LOAD_BALANCER,
29 NEUTRON_LOAD_BALANCER_POOL,
30 NEUTRON_LOAD_BALANCER_POOL_MEMBER,
33 public static final int size = HandlerType.values().length;
36 private HandlerType handlerType;
37 private Action action;
39 private AbstractEvent() {
40 // this is private to force proper construction
43 protected AbstractEvent(HandlerType handlerType, Action action) {
44 this.handlerType = handlerType;
48 public HandlerType getHandlerType() {
52 public Action getAction() {
57 public String toString() {
58 return "AbstractEvent [handlerType=" + handlerType + " action=" + action + "]";
62 public int hashCode() {
65 result = prime * result + ((handlerType == null) ? 0 : handlerType.hashCode());
66 result = prime * result + ((action == null) ? 0 : action.hashCode());
71 public boolean equals(Object obj) {
76 if (getClass() != obj.getClass())
78 AbstractEvent other = (AbstractEvent) obj;
79 if (handlerType == null) {
80 if (other.handlerType != null)
82 } else if (!handlerType.equals(other.handlerType))
85 if (other.action != null)
87 } else if (!action.equals(other.action))