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=1e9dd86afb2afdf417db64e3d12063e7a2a76677;hpb=03a6b404471945aed9d48fc1e5b8447b4a9d9413;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 1e9dd86..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,7 +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 implement copying of routerconfig. /** @@ -33,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; @@ -40,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); @@ -68,7 +69,6 @@ public class SingleRouterConfig implements ExtendedRouterConfig { }; } - // TODO test getId. @Override public Id getId() { return id; @@ -88,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(); + } }