blob: f71b723c938711bbd481532fb5457f198d7ed843 (
plain) (
blame)
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
|
/*******************************************************************************
* Copyright (c) 2014 Wind River Systems, Inc. and others. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.tcf.te.tcf.core.events;
import java.util.EventObject;
import org.eclipse.tcf.protocol.IChannel;
import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
/**
* Channel event implementation.
*/
public final class ChannelEvent extends EventObject {
private static final long serialVersionUID = 864759021559875199L;
// Event type constants
public static final String TYPE_OPENING = "opening"; //$NON-NLS-1$
public static final String TYPE_REDIRECT = "redirect"; //$NON-NLS-1$
public static final String TYPE_OPEN = "open"; //$NON-NLS-1$
public static final String TYPE_CLOSE = "close"; //$NON-NLS-1$
public static final String TYPE_MARK = "mark"; //$NON-NLS-1$
public static final String TYPE_CLOSE_WRITER = "closeWriter"; //$NON-NLS-1$
// Property constants
public static final String PROP_MESSAGE = "message"; //$NON-NLS-1$
public static final String PROP_LOG_NAME = "logname"; //$NON-NLS-1$
// The channel
private final IChannel channel;
// The event type
private final String type;
// The event data
private final IPropertiesContainer data;
/**
* Constructor
*
* @param source The source object. Must not be <code>null</code>.
* @param channel The channel. Must not be <code>null</code>.
* @param type The event type. Must not be <code>null</code>.
* @param data The event data <code>null</code>.
*/
public ChannelEvent(Object source, IChannel channel, String type, IPropertiesContainer data) {
super(source);
if (channel == null) {
throw new IllegalArgumentException("null channel"); //$NON-NLS-1$
}
if (type == null) {
throw new IllegalArgumentException("null type"); //$NON-NLS-1$
}
this.channel = channel;
this.type = type;
this.data = data;
}
/**
* Returns the channel.
*
* @return The channel.
*/
public IChannel getChannel() {
return channel;
}
/**
* Returns the event type.
*
* @return The event type.
*/
public String getType() {
return type;
}
/**
* Returns the event data.
*
* @return The event data or <code>null</code>.
*/
public IPropertiesContainer getData() {
return data;
}
}
|