56b6c8ec490b84225dcbdb802bdc1a239cf56619
[policy/apex-pdp.git] /
1 /*-
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
4  *  Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
5  * ================================================================================
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *      http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  * SPDX-License-Identifier: Apache-2.0
19  * ============LICENSE_END=========================================================
20  */
21
22 package org.onap.policy.apex.context.parameters;
23
24 import org.onap.policy.common.parameters.ParameterGroupImpl;
25 import org.onap.policy.common.parameters.annotations.NotNull;
26 import org.onap.policy.common.parameters.annotations.Valid;
27
28 // @formatter:off
29 /**
30  * Bean class to hold parameters for context handling in Apex. This class contains all the context parameters for schema
31  * handling, distribution, locking, and persistence of context albums.
32  *
33  * <p>The following parameters are defined:
34  * <ol>
35  * <li>flushPeriod: Context is flushed to any persistor plugin that is defined periodically, and the period for flushing
36  * is the flush period.
37  * <li>distributorParameters: The parameters (a {@link DistributorParameters} instance) for the distributor plugin that
38  * is being used for context album distribution
39  * <li>schemaParameters: The parameters (a {@link SchemaParameters} instance) for the schema plugin that is being used
40  * for context album schemas
41  * <li>lockManagerParameters: The parameters (a {@link LockManagerParameters} instance) for the locking mechanism plugin
42  * that is being used for context album locking
43  * <li>persistorParameters: The parameters (a {@link PersistorParameters} instance) for the persistence plugin that is
44  * being used for context album persistence
45  * </ol>
46  */
47 @NotNull
48 public class ContextParameters extends ParameterGroupImpl {
49     private @Valid DistributorParameters distributorParameters = new DistributorParameters();
50     private @Valid SchemaParameters      schemaParameters      = new SchemaParameters();
51     private @Valid LockManagerParameters lockManagerParameters = new LockManagerParameters();
52     private @Valid PersistorParameters   persistorParameters   = new PersistorParameters();
53     // @formatter:on
54
55     /**
56      * Constructor to create a context parameters instance and register the instance with the parameter service.
57      */
58     public ContextParameters() {
59         super(ContextParameterConstants.MAIN_GROUP_NAME);
60     }
61
62     /**
63      * Gets the distributor parameters.
64      *
65      * @return the distributor parameters
66      */
67     public DistributorParameters getDistributorParameters() {
68         return distributorParameters;
69     }
70
71     /**
72      * Sets the distributor parameters.
73      *
74      * @param distributorParameters the distributor parameters
75      */
76     public void setDistributorParameters(final DistributorParameters distributorParameters) {
77         this.distributorParameters = distributorParameters;
78     }
79
80     /**
81      * Gets the schema parameters.
82      *
83      * @return the schema parameters
84      */
85     public SchemaParameters getSchemaParameters() {
86         return schemaParameters;
87     }
88
89     /**
90      * Sets the schema parameters.
91      *
92      * @param schemaParameters the schema parameters
93      */
94     public void setSchemaParameters(final SchemaParameters schemaParameters) {
95         this.schemaParameters = schemaParameters;
96     }
97
98     /**
99      * Gets the lock manager parameters.
100      *
101      * @return the lock manager parameters
102      */
103     public LockManagerParameters getLockManagerParameters() {
104         return lockManagerParameters;
105     }
106
107     /**
108      * Sets the lock manager parameters.
109      *
110      * @param lockManagerParameters the lock manager parameters
111      */
112     public void setLockManagerParameters(final LockManagerParameters lockManagerParameters) {
113         this.lockManagerParameters = lockManagerParameters;
114     }
115
116     /**
117      * Gets the persistor parameters.
118      *
119      * @return the persistor parameters
120      */
121     public PersistorParameters getPersistorParameters() {
122         return persistorParameters;
123     }
124
125     /**
126      * Sets the persistor parameters.
127      *
128      * @param persistorParameters the persistor parameters
129      */
130     public void setPersistorParameters(final PersistorParameters persistorParameters) {
131         this.persistorParameters = persistorParameters;
132     }
133
134     @Override
135     public String toString() {
136         return "ContextParameters [name=" + getName() + ", distributorParameters=" + distributorParameters
137                         + ", schemaParameters=" + schemaParameters + ", lockManagerParameters=" + lockManagerParameters
138                         + ", persistorParameters=" + persistorParameters + "]";
139     }
140 }