8bda76d21ec99a29b4f6f02df81da8369484a605
[policy/apex-pdp.git] /
1 /*-
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
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
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.
16  *
17  * SPDX-License-Identifier: Apache-2.0
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.policy.apex.context.parameters;
22
23 import org.onap.policy.apex.model.basicmodel.service.AbstractParameters;
24 import org.onap.policy.apex.model.basicmodel.service.ParameterService;
25
26 /**
27  * Bean class to hold parameters for context handling in Apex. This class contains all the context
28  * parameters for schema handling, distribution, locking, and persistence of context albums.
29  *
30  * <p>The following parameters are defined:
31  * <ol>
32  * <li>flushPeriod: Context is flushed to any persistor plugin that is defined periodically, and the
33  * period for flushing is the flush period.
34  * <li>distributorParameters: The parameters (a {@link distributorParameters} instance) for the
35  * distributor plugin that is being used for context album distribution
36  * <li>schemaParameters: The parameters (a {@link SchemaParameters} instance) for the schema plugin
37  * that is being used for context album schemas
38  * <li>lockManagerParameters: The parameters (a {@link LockManagerParameters} instance) for the
39  * locking mechanism plugin that is being used for context album locking
40  * <li>persistorParameters: The parameters (a {@link PersistorParameters} instance) for the
41  * persistence plugin that is being used for context album persistence
42  * </ol>
43  *
44  * @author Liam Fallon (liam.fallon@ericsson.com)
45  */
46 public class ContextParameters extends AbstractParameters {
47     // @formatter:off
48     // Plugin Parameters
49     private DistributorParameters distributorParameters = new DistributorParameters();
50     private SchemaParameters      schemaParameters      = new SchemaParameters();
51     private LockManagerParameters lockManagerParameters = new LockManagerParameters();
52     private PersistorParameters   persistorParameters   = new PersistorParameters();
53     // @formatter:on
54
55     /**
56      * Constructor to create a context parameters instance and register the instance with the
57      * parameter service.
58      */
59     public ContextParameters() {
60         super(ContextParameters.class.getCanonicalName());
61         ParameterService.registerParameters(ContextParameters.class, this);
62     }
63
64     /**
65      * Gets the distributor parameters.
66      *
67      * @return the distributor parameters
68      */
69     public DistributorParameters getDistributorParameters() {
70         return distributorParameters;
71     }
72
73     /**
74      * Sets the distributor parameters.
75      *
76      * @param distributorParameters the distributor parameters
77      */
78     public void setDistributorParameters(final DistributorParameters distributorParameters) {
79         this.distributorParameters = distributorParameters;
80     }
81
82     /**
83      * Gets the schema parameters.
84      *
85      * @return the schema parameters
86      */
87     public SchemaParameters getSchemaParameters() {
88         return schemaParameters;
89     }
90
91     /**
92      * Sets the schema parameters.
93      *
94      * @param schemaParameters the schema parameters
95      */
96     public void setSchemaParameters(final SchemaParameters schemaParameters) {
97         this.schemaParameters = schemaParameters;
98     }
99
100     /**
101      * Gets the lock manager parameters.
102      *
103      * @return the lock manager parameters
104      */
105     public LockManagerParameters getLockManagerParameters() {
106         return lockManagerParameters;
107     }
108
109     /**
110      * Sets the lock manager parameters.
111      *
112      * @param lockManagerParameters the lock manager parameters
113      */
114     public void setLockManagerParameters(final LockManagerParameters lockManagerParameters) {
115         this.lockManagerParameters = lockManagerParameters;
116     }
117
118     /**
119      * Gets the persistor parameters.
120      *
121      * @return the persistor parameters
122      */
123     public PersistorParameters getPersistorParameters() {
124         return persistorParameters;
125     }
126
127     /**
128      * Sets the persistor parameters.
129      *
130      * @param persistorParameters the persistor parameters
131      */
132     public void setPersistorParameters(final PersistorParameters persistorParameters) {
133         this.persistorParameters = persistorParameters;
134     }
135
136     /*
137      * (non-Javadoc)
138      *
139      * @see org.onap.policy.apex.model.basicmodel.service.AbstractParameters#toString()
140      */
141     @Override
142     public String toString() {
143         return "ContextParameters [distributorParameters=" + distributorParameters + ", schemaParameters="
144                 + schemaParameters + ", lockManagerParameters=" + lockManagerParameters + ", persistorParameters="
145                 + persistorParameters + "]";
146     }
147 }