e50cc60b43daf8ced681291f8bdac52bb717df40
[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 parameters for schema
28  * handling, distribution, locking, and persistence of context albums.
29  * <p>
30  * The following parameters are defined:
31  * <ol>
32  * <li>flushPeriod: Context is flushed to any persistor plugin that is defined periodically, and the period for flushing
33  * is the flush period.
34  * <li>distributorParameters: The parameters (a {@link distributorParameters} instance) for the distributor plugin that
35  * is being used for context album distribution
36  * <li>schemaParameters: The parameters (a {@link SchemaParameters} instance) for the schema plugin that is being used
37  * for context album schemas
38  * <li>lockManagerParameters: The parameters (a {@link LockManagerParameters} instance) for the locking mechanism plugin
39  * that is being used for context album locking
40  * <li>persistorParameters: The parameters (a {@link PersistorParameters} instance) for the persistence plugin that is
41  * 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 parameter service.
57      */
58     public ContextParameters() {
59         super(ContextParameters.class.getCanonicalName());
60         ParameterService.registerParameters(ContextParameters.class, this);
61     }
62
63     /**
64      * Gets the distributor parameters.
65      *
66      * @return the distributor parameters
67      */
68     public DistributorParameters getDistributorParameters() {
69         return distributorParameters;
70     }
71
72     /**
73      * Sets the distributor parameters.
74      *
75      * @param distributorParameters the distributor parameters
76      */
77     public void setDistributorParameters(final DistributorParameters distributorParameters) {
78         this.distributorParameters = distributorParameters;
79     }
80
81     /**
82      * Gets the schema parameters.
83      *
84      * @return the schema parameters
85      */
86     public SchemaParameters getSchemaParameters() {
87         return schemaParameters;
88     }
89
90     /**
91      * Sets the schema parameters.
92      *
93      * @param schemaParameters the schema parameters
94      */
95     public void setSchemaParameters(final SchemaParameters schemaParameters) {
96         this.schemaParameters = schemaParameters;
97     }
98
99     /**
100      * Gets the lock manager parameters.
101      *
102      * @return the lock manager parameters
103      */
104     public LockManagerParameters getLockManagerParameters() {
105         return lockManagerParameters;
106     }
107
108     /**
109      * Sets the lock manager parameters.
110      *
111      * @param lockManagerParameters the lock manager parameters
112      */
113     public void setLockManagerParameters(final LockManagerParameters lockManagerParameters) {
114         this.lockManagerParameters = lockManagerParameters;
115     }
116
117     /**
118      * Gets the persistor parameters.
119      *
120      * @return the persistor parameters
121      */
122     public PersistorParameters getPersistorParameters() {
123         return persistorParameters;
124     }
125
126     /**
127      * Sets the persistor parameters.
128      *
129      * @param persistorParameters the persistor parameters
130      */
131     public void setPersistorParameters(final PersistorParameters persistorParameters) {
132         this.persistorParameters = persistorParameters;
133     }
134
135     /*
136      * (non-Javadoc)
137      *
138      * @see org.onap.policy.apex.model.basicmodel.service.AbstractParameters#toString()
139      */
140     @Override
141     public String toString() {
142         return "ContextParameters [distributorParameters=" + distributorParameters + ", schemaParameters="
143                 + schemaParameters + ", lockManagerParameters=" + lockManagerParameters + ", persistorParameters="
144                 + persistorParameters + "]";
145     }
146 }