blob: fd9114ad0d4e0dac7b153061efbd9288072c58df (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
/*
* Jitsi, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.service.ldap.event;
import java.util.*;
/**
* An LdapEvent is triggered when
* the state of the LDAP connection changes.
* Available states for the moment are :
* connected
* disconnected
* connecting
* disconnecting
*
* @author Sebastien Mazy
*/
public class LdapEvent
extends EventObject
{
/**
* Serial version UID.
*/
private static final long serialVersionUID = 0L;
/**
* Indicates the possible causes why an event was triggered
*/
public static enum LdapEventCause
{
/**
* New result is available.
*/
NEW_SEARCH_RESULT,
/**
* Search is achieved.
*/
SEARCH_ACHIEVED,
/**
* Search is cancelled.
*/
SEARCH_CANCELLED,
/**
* Problem occurred during search.
*/
SEARCH_ERROR,
/**
* Authentication failed.
*/
SEARCH_AUTH_ERROR
}
/**
* the cause of this event
*/
private final LdapEventCause cause;
/**
* the content of this event
*/
private final Object content;
/**
* Simple constructor for this class
*
* @param source the source of the event (most likely an LdapDirectory)
* @param cause the cause why it was triggered
*/
public LdapEvent(LdapEventManager source, LdapEventCause cause)
{
this(source, cause, null);
}
/**
* Another constructor for this class. Use that one to pass more
* information to the listener using any Object.
*
* @param source the source of the event (most likely an LdapDirectory)
* @param cause the cause why it was triggered
* @param content related content
*/
public LdapEvent(LdapEventManager source, LdapEventCause cause,
Object content)
{
super(source);
this.cause = cause;
this.content = content;
}
/**
* @return the cause why this event was triggered
*/
public LdapEventCause getCause()
{
return this.cause;
}
/**
* @return the object embedded in this event, or null if there isn't one
*/
public Object getContent()
{
return this.content;
}
/**
* Returns the LdapEventManager which sent the LdapEvent.
*
* @return the LdapEventManager which sent the LdapEvent
*/
@Override
public LdapEventManager getSource()
{
return (LdapEventManager) super.getSource();
}
}
|