First version after introduction of meaningful ids and Identifiable interface.
[xmlrouter] / impl / src / main / java / org / wamblee / xmlrouter / impl / RobustDocumentType.java
index 34664e848188e3636f92171738018822e0135857..52244837dda20bcc70de5513c7c87be487a59857 100644 (file)
@@ -20,7 +20,6 @@ import java.util.logging.Logger;
 
 import javax.xml.transform.dom.DOMSource;
 
-import org.wamblee.xmlrouter.common.Id;
 import org.wamblee.xmlrouter.config.DocumentType;
 
 /**
@@ -30,12 +29,12 @@ import org.wamblee.xmlrouter.config.DocumentType;
  * @author Erik Brakkee
  * 
  */
-public class RobustDocumentType implements DocumentType {
+public class RobustDocumentType extends RobustIdentifiable<DocumentType>
+    implements DocumentType {
 
     private static final Logger LOGGER = Logger
         .getLogger(RobustDocumentType.class.getName());
 
-    private Id<DocumentType> id;
     private DocumentType type;
 
     /**
@@ -46,8 +45,8 @@ public class RobustDocumentType implements DocumentType {
      * @param aType
      *            Document type to wrap.
      */
-    public RobustDocumentType(Id<DocumentType> aId, DocumentType aType) {
-        id = aId;
+    public RobustDocumentType(DocumentType aType) {
+        super(aType);
         type = aType;
     }
 
@@ -56,13 +55,13 @@ public class RobustDocumentType implements DocumentType {
         try {
             String name = type.getName();
             if (name == null) {
-                LOGGER.log(Level.WARNING, "Document type " + id +
+                LOGGER.log(Level.WARNING, "Document type " + getId() +
                     " returned null for name");
                 return Constants.UNKNOWN_DOCUMENT_TYPE.toString();
             }
             return name;
         } catch (Exception e) {
-            LOGGER.log(Level.WARNING, "Document type " + id +
+            LOGGER.log(Level.WARNING, "Document type " + getId() +
                 " threw exception", e);
             return Constants.UNKNOWN_DOCUMENT_TYPE.toString();
         }
@@ -73,7 +72,7 @@ public class RobustDocumentType implements DocumentType {
         try {
             return type.isInstance(aSource);
         } catch (Exception e) {
-            LOGGER.log(Level.WARNING, "Document type " + id +
+            LOGGER.log(Level.WARNING, "Document type " + getId() +
                 " threw exception", e);
             return false;
         }
@@ -84,7 +83,7 @@ public class RobustDocumentType implements DocumentType {
         try {
             return type.validate(aSource);
         } catch (Exception e) {
-            LOGGER.log(Level.WARNING, "Document type " + id +
+            LOGGER.log(Level.WARNING, "Document type " + getId() +
                 " threw exception", e);
             return false;
         }