X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fwamblee%2Fxmlrouter%2Fimpl%2FSingleRouterConfig.java;h=8eab34b708996198b73c4cbfd271462937ff1119;hb=f8027d76e1c3e517a8b80a3476f51adee845fc5b;hp=cc778fe7c707928fc10ef6673390d8a30c1cbff4;hpb=7b7444ecb86a1af3eb11013e94776c2860205f2a;p=xmlrouter diff --git a/impl/src/main/java/org/wamblee/xmlrouter/impl/SingleRouterConfig.java b/impl/src/main/java/org/wamblee/xmlrouter/impl/SingleRouterConfig.java index cc778fe..8eab34b 100644 --- a/impl/src/main/java/org/wamblee/xmlrouter/impl/SingleRouterConfig.java +++ b/impl/src/main/java/org/wamblee/xmlrouter/impl/SingleRouterConfig.java @@ -22,8 +22,6 @@ import org.wamblee.xmlrouter.config.Filter; import org.wamblee.xmlrouter.config.RouterConfig; import org.wamblee.xmlrouter.config.Transformation; -// TODO implement equality based on ids for the single routerconfig. -// TODO add clear method to the routerconfig // TODO implement copying of routerconfig. /** @@ -34,6 +32,7 @@ import org.wamblee.xmlrouter.config.Transformation; */ public class SingleRouterConfig implements ExtendedRouterConfig { private Id id; + private ExtendedConfig documentTypes; private ExtendedConfig transformations; private ExtendedConfig filters; @@ -41,27 +40,28 @@ public class SingleRouterConfig implements ExtendedRouterConfig { /** * Constructs a router configuration. * - * @param aSequenceNumberGenerator - * Sequence number generator to use. + * @param aId + * Unique id for this configuration. */ public SingleRouterConfig(Id aId) { id = aId; documentTypes = new ConfigImpl(new Id( - "documentTypes")) { + aId.getId() + ".documenttypes")) { @Override public DocumentType wrap(String aPrefix, DocumentType aT) { return new RobustDocumentType(aPrefix, aT); } }; transformations = new ConfigImpl(new Id( - "transformations")) { + aId.getId() + ".transformations")) { @Override public Transformation wrap(String aPrefix, Transformation aTransformation) { return new RobustTransformation(aPrefix, aTransformation); } }; - filters = new ConfigImpl(new Id("filters")) { + filters = new ConfigImpl(new Id(aId.getId() + + ".filters")) { @Override public Filter wrap(String aPrefix, Filter aFilter) { return new RobustFilter(aPrefix, aFilter); @@ -69,7 +69,6 @@ public class SingleRouterConfig implements ExtendedRouterConfig { }; } - // TODO test getId. @Override public Id getId() { return id; @@ -89,4 +88,25 @@ public class SingleRouterConfig implements ExtendedRouterConfig { public Config filterConfig() { return filters; } + + @Override + public boolean equals(Object aObj) { + if (aObj == null) { + return false; + } + if (!(aObj instanceof SingleRouterConfig)) { + return false; + } + SingleRouterConfig obj = (SingleRouterConfig) aObj; + + return documentTypes.equals(obj.documentTypes) && + transformations.equals(obj.transformations) && + filters.equals(obj.filters); + } + + @Override + public int hashCode() { + return documentTypes.hashCode() + transformations.hashCode() + + filters.hashCode(); + } }