KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > kernel > plugins > event > AbstractEvent


1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2005, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */

22 package org.jboss.kernel.plugins.event;
23
24 import org.jboss.kernel.spi.event.KernelEvent;
25 import org.jboss.util.JBossObject;
26 import org.jboss.util.JBossStringBuilder;
27
28 /**
29  * Abstract Event.
30  *
31  * @author <a HREF="adrian@jboss.com">Adrian Brock</a>
32  * @version $Revision: 40756 $
33  */

34 public class AbstractEvent extends JBossObject implements KernelEvent
35 {
36    /** The source */
37    protected Object JavaDoc source;
38    
39    /** The type */
40    protected String JavaDoc type;
41    
42    /** The sequence */
43    protected long sequence;
44    
45    /** The timestamp */
46    protected long timestamp;
47    
48    /** The context */
49    protected Object JavaDoc context;
50
51    /**
52     * Create a new abstract event
53     *
54     * @param source the source
55     * @param type the type
56     * @param sequence the sequeunce
57     * @param timestamp the timestamp
58     * @param context the context
59     */

60    public AbstractEvent(Object JavaDoc source, String JavaDoc type, long sequence, long timestamp, Object JavaDoc context)
61    {
62       this.source = source;
63       this.type = type;
64       this.sequence = sequence;
65       this.timestamp = timestamp;
66       this.context = context;
67    }
68
69    public Object JavaDoc getContext()
70    {
71       return context;
72    }
73    
74    public long getSequence()
75    {
76       return sequence;
77    }
78    
79    public Object JavaDoc getSource()
80    {
81       return source;
82    }
83    
84    public long getTimestamp()
85    {
86       return timestamp;
87    }
88    
89    public String JavaDoc getType()
90    {
91       return type;
92    }
93    
94    public void toString(JBossStringBuilder buffer)
95    {
96       buffer.append("source=").append(source);
97       buffer.append(" type=").append(type);
98       buffer.append(" seq=").append(sequence);
99       buffer.append(" time=").append(timestamp);
100       buffer.append(" context=").append(context);
101    }
102    
103    public void toShortString(JBossStringBuilder buffer)
104    {
105       buffer.append(type);
106    }
107 }
108
Popular Tags