Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2014 Open Networking Laboratory |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 16 | package org.onosproject.cluster; |
tom | 73d6d1e | 2014-09-17 20:08:01 -0700 | [diff] [blame] | 17 | |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 18 | import org.onosproject.event.AbstractEvent; |
tom | 73d6d1e | 2014-09-17 20:08:01 -0700 | [diff] [blame] | 19 | |
| 20 | /** |
| 21 | * Describes cluster-related event. |
| 22 | */ |
tom | e472987 | 2014-09-23 00:37:37 -0700 | [diff] [blame] | 23 | public class ClusterEvent extends AbstractEvent<ClusterEvent.Type, ControllerNode> { |
tom | 73d6d1e | 2014-09-17 20:08:01 -0700 | [diff] [blame] | 24 | |
| 25 | /** |
tom | fc9a4ff | 2014-09-22 18:22:47 -0700 | [diff] [blame] | 26 | * Type of cluster-related events. |
tom | 73d6d1e | 2014-09-17 20:08:01 -0700 | [diff] [blame] | 27 | */ |
| 28 | public enum Type { |
| 29 | /** |
| 30 | * Signifies that a new cluster instance has been administratively added. |
| 31 | */ |
| 32 | INSTANCE_ADDED, |
| 33 | |
| 34 | /** |
| 35 | * Signifies that a cluster instance has been administratively removed. |
| 36 | */ |
| 37 | INSTANCE_REMOVED, |
| 38 | |
| 39 | /** |
| 40 | * Signifies that a cluster instance became active. |
| 41 | */ |
tom | fc9a4ff | 2014-09-22 18:22:47 -0700 | [diff] [blame] | 42 | INSTANCE_ACTIVATED, |
tom | 73d6d1e | 2014-09-17 20:08:01 -0700 | [diff] [blame] | 43 | |
| 44 | /** |
| 45 | * Signifies that a cluster instance became inactive. |
| 46 | */ |
tom | fc9a4ff | 2014-09-22 18:22:47 -0700 | [diff] [blame] | 47 | INSTANCE_DEACTIVATED |
tom | 73d6d1e | 2014-09-17 20:08:01 -0700 | [diff] [blame] | 48 | } |
tom | 73d6d1e | 2014-09-17 20:08:01 -0700 | [diff] [blame] | 49 | |
| 50 | /** |
| 51 | * Creates an event of a given type and for the specified instance and the |
| 52 | * current time. |
| 53 | * |
| 54 | * @param type cluster event type |
| 55 | * @param instance cluster device subject |
| 56 | */ |
tom | e472987 | 2014-09-23 00:37:37 -0700 | [diff] [blame] | 57 | public ClusterEvent(Type type, ControllerNode instance) { |
tom | 73d6d1e | 2014-09-17 20:08:01 -0700 | [diff] [blame] | 58 | super(type, instance); |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * Creates an event of a given type and for the specified device and time. |
| 63 | * |
| 64 | * @param type device event type |
| 65 | * @param instance event device subject |
| 66 | * @param time occurrence time |
| 67 | */ |
tom | e472987 | 2014-09-23 00:37:37 -0700 | [diff] [blame] | 68 | public ClusterEvent(Type type, ControllerNode instance, long time) { |
tom | 73d6d1e | 2014-09-17 20:08:01 -0700 | [diff] [blame] | 69 | super(type, instance, time); |
| 70 | } |
| 71 | |
| 72 | } |