added first version of configuraiton api and simple function test.
[xmlrouter] / impl / src / main / java / org / wamblee / xmlrouter / impl / CompositeRouterConfig.java
1 /*
2  * Copyright 2005-2011 the original author or authors.
3  * 
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
7  * 
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  * 
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.
15  */
16 package org.wamblee.xmlrouter.impl;
17
18 import java.util.Collection;
19
20 import org.wamblee.xmlrouter.config.Config;
21 import org.wamblee.xmlrouter.config.DocumentType;
22 import org.wamblee.xmlrouter.config.Filter;
23 import org.wamblee.xmlrouter.config.RouterConfig;
24 import org.wamblee.xmlrouter.config.Transformation;
25
26 public class CompositeRouterConfig implements ExtendedRouterConfig {
27
28     private CompositeConfig<DocumentType> documentTypes;
29     private CompositeConfig<Transformation> transformations;
30     private CompositeConfig<Filter> filters;
31
32     public CompositeRouterConfig(Collection<RouterConfig> aConfigs) {
33         documentTypes = new CompositeConfig<DocumentType>();
34         transformations = new CompositeConfig<Transformation>();
35         filters = new CompositeConfig<Filter>();
36         for (RouterConfig config : aConfigs) {
37             documentTypes.add(config.documentTypeConfig());
38             transformations.add(config.transformationConfig());
39             filters.add(config.filterConfig());
40         }
41     }
42
43     @Override
44     public Config<DocumentType> documentTypeConfig() {
45         return documentTypes;
46     }
47
48     @Override
49     public Config<Transformation> transformationConfig() {
50         return transformations;
51     }
52
53     @Override
54     public Config<Filter> filterConfig() {
55         return filters;
56     }
57 }