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,
27 public static final int size = HandlerType.values().length;
29 public enum Action { ADD, UPDATE, DELETE }
31 private HandlerType handlerType;
32 private Action action;
34 private AbstractEvent() {
35 // this is private to force proper construction
38 protected AbstractEvent(HandlerType handlerType, Action action) {
39 this.handlerType = handlerType;
43 public HandlerType getHandlerType() {
47 public Action getAction() {
52 public String toString() {
53 return "AbstractEvent [handlerType=" + handlerType + " action=" + action + "]";
57 public int hashCode() {
60 result = prime * result + ((handlerType == null) ? 0 : handlerType.hashCode());
61 result = prime * result + ((action == null) ? 0 : action.hashCode());
66 public boolean equals(Object obj) {
71 if (getClass() != obj.getClass())
73 AbstractEvent other = (AbstractEvent) obj;
74 if (handlerType == null) {
75 if (other.handlerType != null)
77 } else if (!handlerType.equals(other.handlerType))
80 if (other.action != null)
82 } else if (!action.equals(other.action))