2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
26 import java.util.regex.Matcher;
27 import java.util.regex.Pattern;
29 import org.onap.aai.setup.*;
30 import org.onap.aai.util.AAIConstants;
33 * Quick and dirty access to test schema files
36 public abstract class AbstractConfigTranslator extends ConfigTranslator {
38 public AbstractConfigTranslator(SchemaLocationsBean bean, SchemaConfigVersions schemaVersions) {
39 super(bean, schemaVersions);
45 * @see org.onap.aai.setup.ConfigTranslator#getNodeFiles()
48 public Map<SchemaVersion, List<String>> getNodeFiles() {
49 String prefix = bean.getNodeDirectory() + AAIConstants.AAI_FILESEP;
51 String suffix = ".xml";
53 Map<SchemaVersion, List<String>> files = new TreeMap<>();
54 for (SchemaVersion v : schemaVersions.getVersions()) {
56 List<String> container = getVersionNodeFiles(v);
58 files.put(v, container);
64 public List<String> getVersionNodeFiles(SchemaVersion v) {
65 Pattern p = Pattern.compile("aai(.*)" + "_oxm_(.*).xml");
67 List<String> container = new ArrayList<>();
68 String directoryName =
69 bean.getNodeDirectory() + AAIConstants.AAI_FILESEP + v.toString() + AAIConstants.AAI_FILESEP;
71 File[] files = new File(directoryName).listFiles();
72 for (File f : files) {
73 String fileName = f.getName();
74 Matcher m = p.matcher(fileName);
76 String file = directoryName + m.group();
77 container.add(file.toString());