blob: 1673f7394a42c605f09833d50a618113c1757405 [file] [log] [blame]
Thomas Vachuska96d55b12015-05-11 08:52:03 -07001/*
2 * Copyright 2015 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 */
16package org.onosproject.incubator.net.config;
17
18import org.onosproject.event.AbstractEvent;
19
20/**
21 * Describes network configuration event.
22 */
23public class NetworkConfigEvent extends AbstractEvent<NetworkConfigEvent.Type, Object> {
24
25 private final Class configClass;
26
27 /**
28 * Type of network configuration events.
29 */
30 public enum Type {
31 /**
Thomas Vachuskae6360222015-07-21 10:10:36 -070032 * Signifies that a network configuration was registered.
33 */
34 CONFIG_REGISTERED,
35
36 /**
37 * Signifies that a network configuration was unregistered.
38 */
39 CONFIG_UNREGISTERED,
40
41 /**
Thomas Vachuska96d55b12015-05-11 08:52:03 -070042 * Signifies that network configuration was added.
43 */
Thomas Vachuska96d55b12015-05-11 08:52:03 -070044 CONFIG_ADDED,
Thomas Vachuskae6360222015-07-21 10:10:36 -070045
Thomas Vachuska96d55b12015-05-11 08:52:03 -070046 /**
47 * Signifies that network configuration was updated.
48 */
49 CONFIG_UPDATED,
50
51 /**
52 * Signifies that network configuration was removed.
53 */
54 CONFIG_REMOVED
55 }
56
57 /**
58 * Creates an event of a given type and for the specified subject and the
59 * current time.
60 *
61 * @param type event type
62 * @param subject event subject
63 * @param configClass configuration class
64 */
65 public NetworkConfigEvent(Type type, Object subject, Class configClass) {
66 super(type, subject);
67 this.configClass = configClass;
68 }
69
70 /**
71 * Creates an event of a given type and for the specified subject and time.
72 *
73 * @param type device event type
74 * @param subject event subject
75 * @param configClass configuration class
76 * @param time occurrence time
77 */
78 public NetworkConfigEvent(Type type, Object subject, Class configClass, long time) {
79 super(type, subject, time);
80 this.configClass = configClass;
81 }
82
83 /**
84 * Returns the class of configuration that has been changed.
85 *
86 * @return configuration class
87 */
88 public Class configClass() {
89 return configClass;
90 }
91
92}