KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > snmp4j > agent > ContextEvent


1 /*_############################################################################
2   _##
3   _## SNMP4J-Agent - ContextEvent.java
4   _##
5   _## Copyright (C) 2005-2007 Frank Fock (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
22 package org.snmp4j.agent;
23
24 import java.util.*;
25
26 import org.snmp4j.smi.*;
27
28 /**
29  * The <code>ContextEvent</code> object describes an event that added or removed
30  * a context to/from a system.
31  *
32  * @author Frank Fock
33  * @version 1.0
34  */

35 public class ContextEvent extends EventObject {
36
37   private static final long serialVersionUID = -7705596020456783972L;
38
39   public static final int CONTEXT_ADDED = 1;
40   public static final int CONTEXT_REMOVED = 2;
41
42   private int type;
43   private OctetString context;
44
45   /**
46    * Creates a context event.
47    * @param source
48    * the source object that triggered the event.
49    * @param type
50    * the event type, for example {@link #CONTEXT_ADDED} or
51    * {@link #CONTEXT_REMOVED}.
52    * @param context
53    * the name of the context on whose behalf this event has been created.
54    */

55   public ContextEvent(Object JavaDoc source, int type, OctetString context) {
56     super(source);
57     this.type = type;
58     this.context = context;
59   }
60
61   /**
62    * Returns context name associated with this event object.
63    * @return
64    * the context name.
65    */

66   public OctetString getContext() {
67     return context;
68   }
69
70   /**
71    * Returns the event type.
72    * @return
73    * one of the CONTEXT_* constant values defined by this event object.
74    */

75   public int getType() {
76     return type;
77   }
78 }
79
Popular Tags