diff options
author | Jim Hahn <jrh3@att.com> | 2021-08-02 15:28:00 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2021-08-06 09:22:13 -0400 |
commit | 338cc2611738783285f9edebd259f7e6bff3973d (patch) | |
tree | 86518ff526b89e6f2d24fb7ed1882fe95dd5c8e1 /plugins/plugins-context/plugins-context-distribution | |
parent | 7438fe5a86a9fcfaf248ee32197b24d1badaecb3 (diff) |
Use lombok in apex-pdp #3
Updated plugins thru plugins-persistence-jpa-eclipselink.
Issue-ID: POLICY-3391
Change-Id: Id7a5aeca8bb45c7a089f0b9d49c9ecd4bc8a7178
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'plugins/plugins-context/plugins-context-distribution')
4 files changed, 35 insertions, 128 deletions
diff --git a/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-hazelcast/src/main/java/org/onap/policy/apex/plugins/context/distribution/hazelcast/HazelcastContextDistributor.java b/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-hazelcast/src/main/java/org/onap/policy/apex/plugins/context/distribution/hazelcast/HazelcastContextDistributor.java index 3d6bd55c0..c1956330a 100644 --- a/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-hazelcast/src/main/java/org/onap/policy/apex/plugins/context/distribution/hazelcast/HazelcastContextDistributor.java +++ b/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-hazelcast/src/main/java/org/onap/policy/apex/plugins/context/distribution/hazelcast/HazelcastContextDistributor.java @@ -1,19 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ @@ -23,6 +24,8 @@ package org.onap.policy.apex.plugins.context.distribution.hazelcast; import com.hazelcast.core.Hazelcast; import com.hazelcast.core.HazelcastInstance; import java.util.Map; +import lombok.AccessLevel; +import lombok.Setter; import org.onap.policy.apex.context.ContextException; import org.onap.policy.apex.context.impl.distribution.AbstractDistributor; import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; @@ -40,6 +43,7 @@ public class HazelcastContextDistributor extends AbstractDistributor { private static final XLogger LOGGER = XLoggerFactory.getXLogger(HazelcastContextDistributor.class); // The hazelcast instance for distributing context for this JVM + @Setter(AccessLevel.PRIVATE) private static HazelcastInstance hazelcastInstance = null; /** @@ -72,14 +76,6 @@ public class HazelcastContextDistributor extends AbstractDistributor { } /** - * Set the hazelcast instance statically. - * @param newHazelcastInstance the hazelcast instance - */ - private static void setHazelcastInstance(HazelcastInstance newHazelcastInstance) { - hazelcastInstance = newHazelcastInstance; - } - - /** * {@inheritDoc}. */ @Override diff --git a/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/src/main/java/org/onap/policy/apex/plugins/context/distribution/infinispan/InfinispanContextDistributor.java b/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/src/main/java/org/onap/policy/apex/plugins/context/distribution/infinispan/InfinispanContextDistributor.java index f72407faa..346d23db8 100644 --- a/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/src/main/java/org/onap/policy/apex/plugins/context/distribution/infinispan/InfinispanContextDistributor.java +++ b/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/src/main/java/org/onap/policy/apex/plugins/context/distribution/infinispan/InfinispanContextDistributor.java @@ -1,19 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ @@ -21,6 +22,8 @@ package org.onap.policy.apex.plugins.context.distribution.infinispan; import java.util.Map; +import lombok.AccessLevel; +import lombok.Setter; import org.onap.policy.apex.context.ContextException; import org.onap.policy.apex.context.impl.distribution.AbstractDistributor; import org.onap.policy.apex.context.parameters.ContextParameterConstants; @@ -40,6 +43,7 @@ public class InfinispanContextDistributor extends AbstractDistributor { private static final XLogger LOGGER = XLoggerFactory.getXLogger(InfinispanContextDistributor.class); // The infinispan manager for distributing context for this JVM + @Setter(AccessLevel.PRIVATE) private static InfinispanManager infinispanManager = null; /** @@ -78,14 +82,6 @@ public class InfinispanContextDistributor extends AbstractDistributor { } /** - * Set the infinispan manager statically. - * @param newInfinispanManager the new infinspan manager instance - */ - private static void setInfinispanManager(InfinispanManager newInfinispanManager) { - infinispanManager = newInfinispanManager; - } - - /** * {@inheritDoc}. */ @Override diff --git a/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/src/main/java/org/onap/policy/apex/plugins/context/distribution/infinispan/InfinispanDistributorParameters.java b/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/src/main/java/org/onap/policy/apex/plugins/context/distribution/infinispan/InfinispanDistributorParameters.java index f6ee14886..91f39e26a 100644 --- a/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/src/main/java/org/onap/policy/apex/plugins/context/distribution/infinispan/InfinispanDistributorParameters.java +++ b/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/src/main/java/org/onap/policy/apex/plugins/context/distribution/infinispan/InfinispanDistributorParameters.java @@ -1,25 +1,30 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ package org.onap.policy.apex.plugins.context.distribution.infinispan; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import lombok.ToString; import org.onap.policy.apex.context.parameters.DistributorParameters; /** @@ -27,9 +32,13 @@ import org.onap.policy.apex.context.parameters.DistributorParameters; * * @author Liam Fallon (liam.fallon@ericsson.com) */ +@Getter +@Setter +@ToString +@NoArgsConstructor public class InfinispanDistributorParameters extends DistributorParameters { // @formatter:off - + /** The default Infinispan configuration file location. */ public static final String DEFAULT_INFINISPAN_DISTRIBUTION_CONFIG_FILE = "infinispan/infinispan.xml"; @@ -48,92 +57,4 @@ public class InfinispanDistributorParameters extends DistributorParameters { private boolean preferIPv4Stack = DEFAULT_INFINISPAN_JAVA_NET_PREFER_IPV4_STACK; private String jgroupsBindAddress = DEFAULT_INFINSPAN_JGROUPS_BIND_ADDRESS; // @formatter:on - - /** - * The Constructor. - */ - public InfinispanDistributorParameters() { - super(); - } - - /** - * Gets the config file. - * - * @return the config file - */ - public String getConfigFile() { - return configFile; - } - - /** - * Sets the config file. - * - * @param configFile the config file - */ - public void setConfigFile(final String configFile) { - this.configFile = configFile; - } - - /** - * Gets the jgroups file. - * - * @return the jgroups file - */ - public String getJgroupsFile() { - return jgroupsFile; - } - - /** - * Sets the jgroups file. - * - * @param jgroupsFile the jgroups file - */ - public void setJgroupsFile(final String jgroupsFile) { - this.jgroupsFile = jgroupsFile; - } - - /** - * Prefer I pv 4 stack. - * - * @return true, if prefer I pv 4 stack - */ - public boolean preferIPv4Stack() { - return preferIPv4Stack; - } - - /** - * Sets the prefer I pv 4 stack. - * - * @param preferIPv4Stack the prefer I pv 4 stack - */ - public void setPreferIPv4Stack(final boolean preferIPv4Stack) { - this.preferIPv4Stack = preferIPv4Stack; - } - - /** - * Getj groups bind address. - * - * @return the j groups bind address - */ - public String getjGroupsBindAddress() { - return jgroupsBindAddress; - } - - /** - * Setj groups bind address. - * - * @param jgroupsBindAddress the j groups bind address - */ - public void setjGroupsBindAddress(final String jgroupsBindAddress) { - this.jgroupsBindAddress = jgroupsBindAddress; - } - - /** - * {@inheritDoc}. - */ - @Override - public String toString() { - return "InfinispanDistributorParameters [configFile=" + configFile + ", jgroupsFile=" + jgroupsFile - + ", preferIPv4Stack=" + preferIPv4Stack + ", jGroupsBindAddress=" + jgroupsBindAddress + "]"; - } } diff --git a/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/src/main/java/org/onap/policy/apex/plugins/context/distribution/infinispan/InfinispanManager.java b/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/src/main/java/org/onap/policy/apex/plugins/context/distribution/infinispan/InfinispanManager.java index 2d733a1ee..a9346bcc3 100644 --- a/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/src/main/java/org/onap/policy/apex/plugins/context/distribution/infinispan/InfinispanManager.java +++ b/plugins/plugins-context/plugins-context-distribution/plugins-context-distribution-infinispan/src/main/java/org/onap/policy/apex/plugins/context/distribution/infinispan/InfinispanManager.java @@ -1,19 +1,20 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ @@ -21,6 +22,7 @@ package org.onap.policy.apex.plugins.context.distribution.infinispan; import java.io.IOException; +import lombok.Getter; import org.infinispan.manager.DefaultCacheManager; import org.infinispan.manager.EmbeddedCacheManager; import org.onap.policy.apex.context.ContextException; @@ -35,6 +37,7 @@ public class InfinispanManager { private static final XLogger LOGGER = XLoggerFactory.getXLogger(InfinispanManager.class); // The Infinispan Cache Manager + @Getter private EmbeddedCacheManager cacheManager; /** @@ -85,23 +88,14 @@ public class InfinispanManager { } /** - * Get the cache manager. - * - * @return the infinispan cache manager - */ - public EmbeddedCacheManager getCacheManager() { - return cacheManager; - } - - /** * Set system properties used by Infinispan. * * @param infinispanDistributorParameters The parameter values to set are passed as properties */ private void setSystemProperties(final InfinispanDistributorParameters infinispanDistributorParameters) { System.setProperty("java.net.preferIPv4Stack", - Boolean.toString(infinispanDistributorParameters.preferIPv4Stack())); - System.setProperty("jgroups.bind_addr", infinispanDistributorParameters.getjGroupsBindAddress()); + Boolean.toString(infinispanDistributorParameters.isPreferIPv4Stack())); + System.setProperty("jgroups.bind_addr", infinispanDistributorParameters.getJgroupsBindAddress()); } /** |