introduction of EventInfo.
[xmlrouter] / listener / src / main / java / org / wamblee / xmlrouter / listener / EventInfo.java
diff --git a/listener/src/main/java/org/wamblee/xmlrouter/listener/EventInfo.java b/listener/src/main/java/org/wamblee/xmlrouter/listener/EventInfo.java
new file mode 100644 (file)
index 0000000..1c4e48e
--- /dev/null
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2005-2011 the original author or authors.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.wamblee.xmlrouter.listener;
+
+import javax.xml.transform.dom.DOMSource;
+
+import org.wamblee.xml.XMLDocument;
+import org.wamblee.xmlrouter.common.Id;
+
+/**
+ * Combines information about the event.
+ * 
+ * @author Erik Brakkee
+ * 
+ */
+public class EventInfo {
+
+    private long time;
+    private String source;
+    private Id<DOMSource> id;
+    private String type;
+    private DOMSource event;
+
+    public EventInfo(long aTime, String aSource, Id<DOMSource> aId,
+        String aType, DOMSource aEvent) {
+        time = aTime;
+        source = aSource;
+        id = aId;
+        type = aType;
+        event = aEvent;
+    }
+
+    public long getTime() {
+        return time;
+    }
+
+    public String getSource() {
+        return source;
+    }
+
+    public Id<DOMSource> getId() {
+        return id;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String aType) {
+        type = aType;
+    }
+
+    public DOMSource getEvent() {
+        return event;
+    }
+
+    @Override
+    public String toString() {
+        StringBuffer buf = new StringBuffer();
+        buf.append("Event(");
+        buf.append("time " + time);
+        buf.append(", source " + source);
+        buf.append(", id " + id);
+        buf.append(", type " + type);
+        buf.append(", event " + new XMLDocument(event).print(true));
+        buf.append(")");
+        return buf.toString();
+    }
+}