2 * Copyright 2005-2011 the original author or authors.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.wamblee.xmlrouter.impl;
18 import java.util.concurrent.atomic.AtomicLong;
20 import org.wamblee.xmlrouter.common.Id;
21 import org.wamblee.xmlrouter.config.Config;
22 import org.wamblee.xmlrouter.config.DocumentType;
23 import org.wamblee.xmlrouter.config.Filter;
24 import org.wamblee.xmlrouter.config.Transformation;
27 * Represents a single configuration set of a single configuration client of the
30 * @author Erik Brakkee
32 public class SingleRouterConfig implements ExtendedRouterConfig {
33 private AtomicLong sequenceNumbers;
34 private ExtendedConfig<DocumentType> documentTypes;
35 private ExtendedConfig<Transformation> transformations;
36 private ExtendedConfig<Filter> filters;
39 * Constructs a router configuration.
41 * @param aSequenceNumberGenerator
42 * Sequence number generator to use.
44 public SingleRouterConfig(AtomicLong aSequenceNumberGenerator) {
45 sequenceNumbers = aSequenceNumberGenerator;
46 documentTypes = new ConfigImpl<DocumentType>(sequenceNumbers) {
48 public DocumentType wrap(Id<DocumentType> aId, DocumentType aT) {
49 return new RobustDocumentType(aId, aT);
52 transformations = new ConfigImpl<Transformation>(sequenceNumbers) {
54 public Transformation wrap(Id<Transformation> aId,
55 Transformation aTransformation) {
56 return new RobustTransformation(aId, aTransformation);
59 filters = new ConfigImpl<Filter>(sequenceNumbers) {
61 public Filter wrap(Id<Filter> aId, Filter aFilter) {
62 return new RobustFilter(aId, aFilter);
68 public Config<DocumentType> documentTypeConfig() {
73 public Config<Transformation> transformationConfig() {
74 return transformations;
78 public Config<Filter> filterConfig() {
83 public boolean isDirty() {
84 return documentTypes.isDirty() || transformations.isDirty() ||
89 public void resetDirty() {
90 documentTypes.resetDirty();
92 transformations.resetDirty();