First version after introduction of meaningful ids and Identifiable interface.
[xmlrouter] / impl / src / main / java / org / wamblee / xmlrouter / impl / RobustTransformation.java
index 81748e0f9c1c1c3274f1c7b4e6791c54e1b50578..2fa025e005a836410517332d8f7ff2b3053ffbf7 100644 (file)
@@ -21,7 +21,6 @@ import java.util.logging.Logger;
 import javax.xml.transform.dom.DOMSource;
 
 import org.wamblee.xml.XMLDocument;
-import org.wamblee.xmlrouter.common.Id;
 import org.wamblee.xmlrouter.config.Transformation;
 
 /**
@@ -30,12 +29,12 @@ import org.wamblee.xmlrouter.config.Transformation;
  * @author Erik Brakkee
  * 
  */
-public class RobustTransformation implements Transformation {
+public class RobustTransformation extends RobustIdentifiable<Transformation>
+    implements Transformation {
 
     private static final Logger LOGGER = Logger
         .getLogger(RobustTransformation.class.getName());
 
-    private Id<Transformation> id;
     private Transformation transformation;
 
     /**
@@ -46,27 +45,11 @@ public class RobustTransformation implements Transformation {
      * @param aTransformation
      *            Wrapped transformation.
      */
-    public RobustTransformation(Id<Transformation> aId,
-        Transformation aTransformation) {
-        id = aId;
+    public RobustTransformation(Transformation aTransformation) {
+        super(aTransformation);
         transformation = aTransformation;
     }
 
-    @Override
-    public String getName() {
-        try {
-            String name = transformation.getName();
-            if (name == null) {
-                logTypeReturnedNull("from");
-                return Constants.UNKNOWN_DOCUMENT_TYPE.toString();
-            }
-            return name;
-        } catch (Exception e) {
-            logNameThrewException(e);
-            return Constants.UNKNOWN_DOCUMENT_TYPE.toString();
-        }
-    }
-
     @Override
     public String getFromType() {
         try {
@@ -132,12 +115,12 @@ public class RobustTransformation implements Transformation {
 
     private void logTranformationThrewException(DOMSource aEvent, Exception aE) {
         LOGGER.log(Level.WARNING,
-            "transformation " + id + " threw exception for event " +
+            "transformation " + getId() + " threw exception for event " +
                 new XMLDocument(aEvent).print(true), aE);
     }
 
     private void logTransformationReturnedNull(DOMSource aEvent) {
-        LOGGER.log(Level.WARNING, "transformation " + id +
+        LOGGER.log(Level.WARNING, "transformation " + getId() +
             " returned null for event " + new XMLDocument(aEvent).print(true));
     }