d49adf46435a6542e99c1d54b0b31a352114ae0e
[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.apex.context.impl.locking.jvmlocal.JvmLocalLockManager;
25 import org.onap.policy.common.parameters.ParameterGroupImpl;
26 import org.onap.policy.common.parameters.annotations.ClassName;
27 import org.onap.policy.common.parameters.annotations.NotNull;
28
29 /**
30  * An empty lock manager parameter class that may be specialized by context lock manager plugins
31  * that require plugin specific parameters. The class defines the default lock manager plugin as the
32  * JVM local lock manager.
33  *
34  * @author Liam Fallon (liam.fallon@ericsson.com)
35  */
36 @NotNull
37 public class LockManagerParameters extends ParameterGroupImpl {
38     /**
39      * The default lock manager can lock context album instance across all threads in a single JVM.
40      */
41     public static final String DEFAULT_LOCK_MANAGER_PLUGIN_CLASS = JvmLocalLockManager.class.getName();
42
43     private @ClassName String pluginClass = DEFAULT_LOCK_MANAGER_PLUGIN_CLASS;
44
45     /**
46      * Constructor to create a lock manager parameters instance and register the instance with the
47      * parameter service.
48      */
49     public LockManagerParameters() {
50         super(ContextParameterConstants.LOCKING_GROUP_NAME);
51     }
52
53     /**
54      * Gets the plugin class.
55      *
56      * @return the plugin class
57      */
58     public String getPluginClass() {
59         return pluginClass;
60     }
61
62     /**
63      * Sets the plugin class.
64      *
65      * @param pluginClass the plugin class
66      */
67     public void setPluginClass(final String pluginClass) {
68         this.pluginClass = pluginClass;
69     }
70
71     @Override
72     public String toString() {
73         return "LockManagerParameters [name=" + getName() + ", pluginClass=" + pluginClass + "]";
74     }
75 }