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=========================================================
25 import java.util.regex.Matcher;
26 import java.util.regex.Pattern;
28 import org.onap.aai.setup.*;
29 import org.onap.aai.util.AAIConstants;
32 * Quick and dirty access to test schema files
35 public abstract class AbstractConfigTranslator extends ConfigTranslator {
37 public AbstractConfigTranslator(SchemaLocationsBean bean, SchemaConfigVersions schemaVersions) {
38 super(bean, schemaVersions);
44 * @see org.onap.aai.setup.ConfigTranslator#getNodeFiles()
47 public Map<SchemaVersion, List<String>> getNodeFiles() {
48 String prefix = bean.getNodeDirectory() + AAIConstants.AAI_FILESEP;
50 String suffix = ".xml";
52 Map<SchemaVersion, List<String>> files = new TreeMap<>();
53 for (SchemaVersion v : schemaVersions.getVersions()) {
55 List<String> container = getVersionNodeFiles(v);
57 files.put(v, container);
63 public List<String> getVersionNodeFiles(SchemaVersion v) {
64 Pattern p = Pattern.compile("aai(.*)" + "_oxm_(.*).xml");
66 List<String> container = new ArrayList<>();
67 String directoryName =
68 bean.getNodeDirectory() + AAIConstants.AAI_FILESEP + v.toString() + AAIConstants.AAI_FILESEP;
70 File[] files = new File(directoryName).listFiles();
71 for (File f : files) {
72 String fileName = f.getName();
73 Matcher m = p.matcher(fileName);
75 String file = directoryName + m.group();
76 container.add(file.toString());