KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > snmp4j > event > UsmUserEvent


1 /*_############################################################################
2   _##
3   _## SNMP4J - UsmUserEvent.java
4   _##
5   _## Copyright 2003-2007 Frank Fock and Jochen Katz (SNMP4J.org)
6   _##
7   _## Licensed under the Apache License, Version 2.0 (the "License");
8   _## you may not use this file except in compliance with the License.
9   _## You may obtain a copy of the License at
10   _##
11   _## http://www.apache.org/licenses/LICENSE-2.0
12   _##
13   _## Unless required by applicable law or agreed to in writing, software
14   _## distributed under the License is distributed on an "AS IS" BASIS,
15   _## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   _## See the License for the specific language governing permissions and
17   _## limitations under the License.
18   _##
19   _##########################################################################*/

20
21 package org.snmp4j.event;
22
23 import java.util.EventObject JavaDoc;
24 import org.snmp4j.security.UsmUserEntry;
25 // needed for JavaDoc
26
import org.snmp4j.security.USM;
27 import org.snmp4j.security.UsmUserTable;
28
29 /**
30  * This Event is issued whenever a user of the {@link USM} is created
31  * modified or deleted.
32  *
33  * @author Frank Fock
34  * @version 1.0
35  */

36 public class UsmUserEvent extends EventObject JavaDoc {
37
38   private static final long serialVersionUID = -2650579887988635391L;
39
40   /**
41    * Constant: a new user was created.
42    */

43   public static final int USER_ADDED = 1;
44
45   /**
46    * Constant: a user was deleted.
47    */

48   public static final int USER_REMOVED = 2;
49
50   /**
51    * Constant: a user was changed (but not deleted).
52    */

53   public static final int USER_CHANGED = 3;
54
55   private org.snmp4j.security.UsmUserEntry user;
56   private int type;
57
58   /**
59    * Construct a UsmUserEvent.
60    *
61    * @param source
62    * the object that emitts this event
63    * @param changedEntry
64    * the changed entry
65    * @param type
66    * can be USER_ADDED, USER_REMOVED or USER_CHANGED.
67    */

68   public UsmUserEvent(Object JavaDoc source, UsmUserEntry changedEntry, int type) {
69     super(source);
70     this.user = changedEntry;
71     this.type = type;
72   }
73
74   /**
75    * Get the modified entry of the {@link UsmUserTable}.
76    *
77    * @return the entry <ul>
78    * <li> after the modification if the user was added or modified
79    * <li> before the modification if the user was deleted </ul>
80    */

81   public org.snmp4j.security.UsmUserEntry getUser() {
82     return user;
83   }
84
85   /**
86    * Return the type of operation that triggered this event.
87    *
88    * @return One of USER_ADDED, USER_REMOVED or USER_CHANGED.
89    */

90   public int getType() {
91     return type;
92   }
93 }
94
Popular Tags