1c4e48ec2cae387c60ba472c0254eb44d88eafd1
[xmlrouter] / listener / src / main / java / org / wamblee / xmlrouter / listener / EventInfo.java
1 /*
2  * Copyright 2005-2011 the original author or authors.
3  * 
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  * 
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  * 
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package org.wamblee.xmlrouter.listener;
17
18 import javax.xml.transform.dom.DOMSource;
19
20 import org.wamblee.xml.XMLDocument;
21 import org.wamblee.xmlrouter.common.Id;
22
23 /**
24  * Combines information about the event.
25  * 
26  * @author Erik Brakkee
27  * 
28  */
29 public class EventInfo {
30
31     private long time;
32     private String source;
33     private Id<DOMSource> id;
34     private String type;
35     private DOMSource event;
36
37     public EventInfo(long aTime, String aSource, Id<DOMSource> aId,
38         String aType, DOMSource aEvent) {
39         time = aTime;
40         source = aSource;
41         id = aId;
42         type = aType;
43         event = aEvent;
44     }
45
46     public long getTime() {
47         return time;
48     }
49
50     public String getSource() {
51         return source;
52     }
53
54     public Id<DOMSource> getId() {
55         return id;
56     }
57
58     public String getType() {
59         return type;
60     }
61
62     public void setType(String aType) {
63         type = aType;
64     }
65
66     public DOMSource getEvent() {
67         return event;
68     }
69
70     @Override
71     public String toString() {
72         StringBuffer buf = new StringBuffer();
73         buf.append("Event(");
74         buf.append("time " + time);
75         buf.append(", source " + source);
76         buf.append(", id " + id);
77         buf.append(", type " + type);
78         buf.append(", event " + new XMLDocument(event).print(true));
79         buf.append(")");
80         return buf.toString();
81     }
82 }