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;
14 * Abstract class for events used by neutron northbound and southbound events.
16 public abstract class AbstractEvent {
17 public enum HandlerType {
22 NEUTRON_PORT_SECURITY,
28 public static final int size = HandlerType.values().length;
30 public enum Action { ADD, UPDATE, DELETE }
32 private HandlerType handlerType;
33 private Action action;
35 private AbstractEvent() {
36 // this is private to force proper construction
39 protected AbstractEvent(HandlerType handlerType, Action action) {
40 this.handlerType = handlerType;
44 public HandlerType getHandlerType() {
48 public Action getAction() {
53 public String toString() {
54 return "AbstractEvent [handlerType=" + handlerType + " action=" + action + "]";
58 public int hashCode() {
61 result = prime * result + ((handlerType == null) ? 0 : handlerType.hashCode());
62 result = prime * result + ((action == null) ? 0 : action.hashCode());
67 public boolean equals(Object obj) {
72 if (getClass() != obj.getClass())
74 AbstractEvent other = (AbstractEvent) obj;
75 if (handlerType == null) {
76 if (other.handlerType != null)
78 } else if (!handlerType.equals(other.handlerType))
81 if (other.action != null)
83 } else if (!action.equals(other.action))