d7395522497faa6a9db73449c5dec0d87c16e164
[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.plugins.context.distribution.infinispan;
22
23 import org.onap.policy.apex.context.parameters.DistributorParameters;
24 import org.onap.policy.apex.model.basicmodel.service.ParameterService;
25
26 /**
27  * Distributor parameters for the Infinspan Distributor.
28  *
29  * @author Liam Fallon (liam.fallon@ericsson.com)
30  */
31 public class InfinispanDistributorParameters extends DistributorParameters {
32     // @formatter:off
33
34     /** The default Infinispan configuration file location. */
35     public static final String  DEFAULT_INFINISPAN_DISTRIBUTION_CONFIG_FILE = "/infinispan/infinispan.xml";
36
37     /** The default Infinispan jgroups configuration file location. */
38     public static final String  DEFAULT_INFINISPAN_DISTRIBUTION_JGROUPS_FILE = null;
39
40     /** The default Infinispan IP stack is IPV4. */
41     public static final boolean DEFAULT_INFINISPAN_JAVA_NET_PREFER_IPV4_STACK = true;
42
43     /** The default Infinispan bind address is localhost. */
44     public static final String  DEFAULT_INFINSPAN_JGROUPS_BIND_ADDRESS = "localhost";
45
46     // Infinspan configuration file names
47     private String configFile         = DEFAULT_INFINISPAN_DISTRIBUTION_CONFIG_FILE;
48     private String jgroupsFile        = DEFAULT_INFINISPAN_DISTRIBUTION_JGROUPS_FILE;
49     private boolean preferIPv4Stack   = DEFAULT_INFINISPAN_JAVA_NET_PREFER_IPV4_STACK;
50     private String jGroupsBindAddress = DEFAULT_INFINSPAN_JGROUPS_BIND_ADDRESS;
51     // @formatter:on
52
53     /**
54      * The Constructor.
55      */
56     public InfinispanDistributorParameters() {
57         super(InfinispanDistributorParameters.class.getCanonicalName());
58         ParameterService.registerParameters(InfinispanDistributorParameters.class, this);
59         ParameterService.registerParameters(DistributorParameters.class, this);
60     }
61
62     /**
63      * Gets the config file.
64      *
65      * @return the config file
66      */
67     public String getConfigFile() {
68         return configFile;
69     }
70
71     /**
72      * Sets the config file.
73      *
74      * @param configFile the config file
75      */
76     public void setConfigFile(final String configFile) {
77         this.configFile = configFile;
78     }
79
80     /**
81      * Gets the jgroups file.
82      *
83      * @return the jgroups file
84      */
85     public String getJgroupsFile() {
86         return jgroupsFile;
87     }
88
89     /**
90      * Sets the jgroups file.
91      *
92      * @param jgroupsFile the jgroups file
93      */
94     public void setJgroupsFile(final String jgroupsFile) {
95         this.jgroupsFile = jgroupsFile;
96     }
97
98     /**
99      * Prefer I pv 4 stack.
100      *
101      * @return true, if prefer I pv 4 stack
102      */
103     public boolean preferIPv4Stack() {
104         return preferIPv4Stack;
105     }
106
107     /**
108      * Sets the prefer I pv 4 stack.
109      *
110      * @param preferIPv4Stack the prefer I pv 4 stack
111      */
112     public void setPreferIPv4Stack(final boolean preferIPv4Stack) {
113         this.preferIPv4Stack = preferIPv4Stack;
114     }
115
116     /**
117      * Getj groups bind address.
118      *
119      * @return the j groups bind address
120      */
121     public String getjGroupsBindAddress() {
122         return jGroupsBindAddress;
123     }
124
125     /**
126      * Setj groups bind address.
127      *
128      * @param jGroupsBindAddress the j groups bind address
129      */
130     public void setjGroupsBindAddress(final String jGroupsBindAddress) {
131         this.jGroupsBindAddress = jGroupsBindAddress;
132     }
133
134     /*
135      * (non-Javadoc)
136      * 
137      * @see com.ericsson.apex.context.parameters.DistributorParameters#toString()
138      */
139     @Override
140     public String toString() {
141         return "InfinispanDistributorParameters [configFile=" + configFile + ", jgroupsFile=" + jgroupsFile
142                 + ", preferIPv4Stack=" + preferIPv4Stack + ", jGroupsBindAddress=" + jGroupsBindAddress + "]";
143     }
144 }