01: /*
02: * Copyright 2004-2006 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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:
17: package org.compass.core.config;
18:
19: import java.util.ArrayList;
20:
21: import org.compass.core.config.process.*;
22: import org.compass.core.converter.ConverterLookup;
23: import org.compass.core.engine.naming.PropertyNamingStrategy;
24: import org.compass.core.mapping.CompassMapping;
25:
26: /**
27: * @author kimchy
28: */
29: public class CompassMappingProcessor implements MappingProcessor {
30:
31: private ArrayList<MappingProcessor> mappingProcessors = new ArrayList<MappingProcessor>();
32:
33: public CompassMappingProcessor() {
34: mappingProcessors.add(new ResolveExtendsMappingProcessor());
35: mappingProcessors.add(new PropertyAccessorMappingProcessor());
36: mappingProcessors.add(new NullValueMappingProcessor());
37: mappingProcessors.add(new ResolveRefAliasProcessor());
38: mappingProcessors.add(new CollectionMappingProcessor());
39: mappingProcessors
40: .add(new ResolveLateAttributesMappingProcessor());
41: mappingProcessors.add(new ConverterLookupMappingProcessor());
42: // start late binding
43: mappingProcessors.add(new LateBindingOsemMappingProcessor());
44: mappingProcessors.add(new LateBindingXsemMappingProcessor());
45: // end late binding
46: mappingProcessors.add(new CascadingMappingProcessor());
47: mappingProcessors.add(new InternalIdsMappingProcessor());
48: mappingProcessors.add(new PostProcessorMappingProcessor());
49: mappingProcessors.add(new RootAliasPostProcessor());
50: mappingProcessors.add(new CompassMappingPostProcessor());
51: mappingProcessors.add(new UIDMappingProcessor());
52: mappingProcessors.add(new ValidatorMappingProcessor());
53: }
54:
55: public CompassMapping process(CompassMapping compassMapping,
56: PropertyNamingStrategy namingStrategy,
57: ConverterLookup converterLookup, CompassSettings settings)
58: throws ConfigurationException {
59: CompassMapping retMapping = compassMapping;
60: for (MappingProcessor mappingProcessor : mappingProcessors) {
61: retMapping = mappingProcessor.process(retMapping,
62: namingStrategy, converterLookup, settings);
63: }
64: return retMapping;
65: }
66: }
|