2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2016-2018 Ericsson. All rights reserved.
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
21 package org.onap.policy.apex.context.parameters;
24 import java.util.TreeMap;
26 import org.onap.policy.apex.context.impl.schema.java.JavaSchemaHelperParameters;
27 import org.onap.policy.common.parameters.GroupValidationResult;
28 import org.onap.policy.common.parameters.ParameterGroup;
31 * Bean class holding schema parameters for schemas and their helpers. As more than one schema can
32 * be used in Apex simultaneously, this class is used to hold the schemas that are defined in a
33 * given Apex system and to get the schema helper plugin parameters {@link SchemaHelperParameters}
36 * <p>The default {@code Java} schema is always defined and its parameters are held in a
37 * {@link JavaSchemaHelperParameters} instance.
39 * @author Liam Fallon (liam.fallon@ericsson.com)
41 public class SchemaParameters implements ParameterGroup {
42 /** The Java schema flavour is always available for use. */
43 public static final String DEFAULT_SCHEMA_FLAVOUR = "Java";
47 // A map of parameters for executors of various logic types
48 private Map<String, SchemaHelperParameters> schemaHelperParameterMap;
51 * Constructor to create a distributor parameters instance and register the instance with the
54 public SchemaParameters() {
57 // Set the name for the parameters
58 this.name = ContextParameterConstants.SCHEMA_GROUP_NAME;
60 schemaHelperParameterMap = new TreeMap<>();
62 // The default schema helper
63 schemaHelperParameterMap.put(DEFAULT_SCHEMA_FLAVOUR, new JavaSchemaHelperParameters());
67 * Gets a map of the schemas and schema helper parameters that are defined.
69 * @return the schema helper parameter map
71 public Map<String, SchemaHelperParameters> getSchemaHelperParameterMap() {
72 return schemaHelperParameterMap;
76 * Sets the map of the schemas and schema helper parameters.
78 * @param schemaHelperParameterMap the schema helper parameter map
80 public void setSchemaHelperParameterMap(final Map<String, SchemaHelperParameters> schemaHelperParameterMap) {
81 this.schemaHelperParameterMap = schemaHelperParameterMap;
85 * Gets the schema helper parameters for a given context schema flavour.
87 * @param schemaFlavour the schema flavour for which to get the schema helper parameters
88 * @return the schema helper parameters for the given schema flavour
90 public SchemaHelperParameters getSchemaHelperParameters(final String schemaFlavour) {
91 return schemaHelperParameterMap.get(schemaFlavour);
95 public String getName() {
100 public void setName(final String name) {
105 public GroupValidationResult validate() {
106 return new GroupValidationResult(this);