X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fwamblee%2Fxmlrouter%2Fimpl%2FSingleRouterConfig.java;h=4ecaad4a35d633679620f791426242f868784b35;hb=5582d07a1ba9821cc789ea63b71f246e89d13cae;hp=8eab34b708996198b73c4cbfd271462937ff1119;hpb=f8027d76e1c3e517a8b80a3476f51adee845fc5b;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 8eab34b..4ecaad4 100644 --- a/impl/src/main/java/org/wamblee/xmlrouter/impl/SingleRouterConfig.java +++ b/impl/src/main/java/org/wamblee/xmlrouter/impl/SingleRouterConfig.java @@ -31,11 +31,59 @@ import org.wamblee.xmlrouter.config.Transformation; * @author Erik Brakkee */ public class SingleRouterConfig implements ExtendedRouterConfig { + + public static final class DocumentConfig extends ConfigImpl { + public DocumentConfig(Id aId) { + super(DocumentType.class, aId); + } + + public DocumentConfig(DocumentConfig aConfig) { + super(aConfig); + } + + @Override + public DocumentType wrap(String aPrefix, DocumentType aT) { + return new RobustDocumentType("", aT); + } + } + + public static final class TransformationConfig extends + ConfigImpl { + public TransformationConfig(Id aId) { + super(Transformation.class, aId); + } + + public TransformationConfig(TransformationConfig aConfig) { + super(aConfig); + } + + @Override + public Transformation wrap(String aPrefix, + Transformation aTransformation) { + return new RobustTransformation("", aTransformation); + } + } + + public static final class FilterConfig extends ConfigImpl { + public FilterConfig(Id aId) { + super(Filter.class, aId); + } + + public FilterConfig(FilterConfig aConfig) { + super(aConfig); + } + + @Override + public Filter wrap(String aPrefix, Filter aFilter) { + return new RobustFilter("", aFilter); + } + } + private Id id; - private ExtendedConfig documentTypes; - private ExtendedConfig transformations; - private ExtendedConfig filters; + private DocumentConfig documentTypes; + private TransformationConfig transformations; + private FilterConfig filters; /** * Constructs a router configuration. @@ -45,28 +93,18 @@ public class SingleRouterConfig implements ExtendedRouterConfig { */ public SingleRouterConfig(Id aId) { id = aId; - documentTypes = new ConfigImpl(new Id( - aId.getId() + ".documenttypes")) { - @Override - public DocumentType wrap(String aPrefix, DocumentType aT) { - return new RobustDocumentType(aPrefix, aT); - } - }; - transformations = new ConfigImpl(new Id( - aId.getId() + ".transformations")) { - @Override - public Transformation wrap(String aPrefix, - Transformation aTransformation) { - return new RobustTransformation(aPrefix, aTransformation); - } - }; - filters = new ConfigImpl(new Id(aId.getId() + - ".filters")) { - @Override - public Filter wrap(String aPrefix, Filter aFilter) { - return new RobustFilter(aPrefix, aFilter); - } - }; + documentTypes = new DocumentConfig(new Id(aId.getId() + + ".documenttypes")); + transformations = new TransformationConfig(new Id(aId.getId() + + ".transformations")); + filters = new FilterConfig(new Id(aId.getId() + ".filters")); + } + + public SingleRouterConfig(SingleRouterConfig aConfig) { + id = aConfig.id; + documentTypes = new DocumentConfig(aConfig.documentTypes); + transformations = new TransformationConfig(aConfig.transformations); + filters = new FilterConfig(aConfig.filters); } @Override