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=b069215b102731099ee88f6a22384af64a5ac886;hpb=ca624324bf36e5ba8217a6af861cbf898a40adfc;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 b069215..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,6 +22,8 @@ import org.wamblee.xmlrouter.config.Filter; import org.wamblee.xmlrouter.config.RouterConfig; import org.wamblee.xmlrouter.config.Transformation; +// TODO implement copying of routerconfig. + /** * Represents a single configuration set of a single configuration client of the * XML router. @@ -30,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; @@ -37,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); @@ -65,7 +69,6 @@ public class SingleRouterConfig implements ExtendedRouterConfig { }; } - // TODO test getId. @Override public Id getId() { return id; @@ -85,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(); + } }