event listener is now used by the xml router and the publish method of the gateway is
[xmlrouter] / listener / src / main / java / org / wamblee / xmlrouter / listener / LoggingEventListener.java
index f623b135bb28787abf865bbc8f3c3278a5f2c868..24c6be65c9333d571ab60f43e28dc291e40f0cff 100644 (file)
@@ -19,11 +19,6 @@ import java.util.List;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import javax.print.attribute.standard.Destination;
-import javax.xml.transform.dom.DOMSource;
-
-import org.wamblee.xml.XMLDocument;
-import org.wamblee.xmlrouter.common.Id;
 import org.wamblee.xmlrouter.config.Transformation;
 
 /**
@@ -43,22 +38,24 @@ public class LoggingEventListener implements EventListener {
     }
 
     @Override
-    public void delivered(String aDocType, Id<DOMSource> aEventId,
-        DOMSource aEvent, List<Transformation> aSequence,
-        Id<Destination> aDestination, String aDestinationName,
-        boolean aSuccessFlag) {
+    public void delivered(EventInfo aEvent, List<Transformation> aSequence,
+        long aDestinationId, String aDestinationName, boolean aSuccessFlag) {
         if (LOGGER.isLoggable(level)) {
-            LOGGER.log(level, "event delivered: document type '" + aDocType +
-                "', eventId " + aEventId + ", event '" +
-                new XMLDocument(aEvent).print(true) + "', sequence '" +
-                getSequenceString(aSequence) + "', destionationId " +
-                aDestination + ", destinationName '" + aDestinationName + "'");
+            LOGGER
+                .log(level, "event delivered: " + aEvent + ", sequence '" +
+                    getSequenceString(aSequence) + "', destinationId " +
+                    aDestinationId + ", destinationName '" + aDestinationName +
+                    "'");
         }
     }
 
     private String getSequenceString(List<Transformation> aSequence) {
         StringBuffer buf = new StringBuffer();
-        for (Transformation transformation : aSequence) {
+        for (int i = 0; i < aSequence.size(); i++) {
+            if (i > 0) {
+                buf.append(", ");
+            }
+            Transformation transformation = aSequence.get(i);
             buf.append(transformation.getName());
             buf.append("(");
             buf.append(transformation.getFromType());
@@ -70,12 +67,9 @@ public class LoggingEventListener implements EventListener {
     }
 
     @Override
-    public void notDelivered(String aDocumentType, Id<DOMSource> aEventId,
-        DOMSource aEvent) {
+    public void notDelivered(EventInfo aInfo) {
         if (LOGGER.isLoggable(level)) {
-            LOGGER.log(level, "event not delivered: document type '" +
-                aDocumentType + "', eventId " + aEventId + ", event '" +
-                new XMLDocument(aEvent).print(true) + "'");
+            LOGGER.log(level, "event not delivered: " + aInfo);
         }
     }
 }