summaryrefslogtreecommitdiffstats
path: root/context/context-management/src
diff options
context:
space:
mode:
authorRam Krishna Verma <ram_krishna.verma@bell.ca>2021-08-27 16:53:11 -0400
committerAjith Sreekumar <ajith.sreekumar@bell.ca>2021-08-31 10:14:34 +0000
commit9ee4561bcd28b7199fd1ffed118f122a8435203a (patch)
tree49f07ddc8d082f6028fb53dbfcfeb654b79a55a3 /context/context-management/src
parent795bd98b7459fd677e06354ea054c8922821522b (diff)
Fix sonar issues in apex-pdp
Issue-ID: POLICY-3077 Change-Id: Id5e7c2ddada2bac3b73fe543f9adade6f9b83e6c Signed-off-by: Ram Krishna Verma <ram_krishna.verma@bell.ca>
Diffstat (limited to 'context/context-management/src')
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/DistributorFactory.java7
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/DistributorFlushTimerTask.java5
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/impl/locking/LockManagerFactory.java7
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/impl/persistence/PersistorFactory.java7
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/SchemaHelperFactory.java9
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelper.java5
6 files changed, 23 insertions, 17 deletions
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/DistributorFactory.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/DistributorFactory.java
index 431c38789..9f1847543 100644
--- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/DistributorFactory.java
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/DistributorFactory.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019-2020 Nordix Foundation.
+ * Modifications Copyright (C) 2021 Bell Canada. 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.
@@ -53,8 +54,8 @@ public class DistributorFactory {
Assertions.argumentOfClassNotNull(key, ContextException.class, "Parameter \"key\" may not be null");
// Get the class for the distributor using reflection
- final DistributorParameters distributorParameters =
- ParameterService.get(ContextParameterConstants.DISTRIBUTOR_GROUP_NAME);
+ final var distributorParameters =
+ (DistributorParameters) ParameterService.get(ContextParameterConstants.DISTRIBUTOR_GROUP_NAME);
final String pluginClass = distributorParameters.getPluginClass();
Object contextDistributorObject = null;
try {
@@ -73,7 +74,7 @@ public class DistributorFactory {
}
// The context Distributor to return
- final Distributor contextDistributor = (Distributor) contextDistributorObject;
+ final var contextDistributor = (Distributor) contextDistributorObject;
// Lock and load the context distributor
contextDistributor.init(key);
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/DistributorFlushTimerTask.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/DistributorFlushTimerTask.java
index e98e66148..bd31059f7 100644
--- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/DistributorFlushTimerTask.java
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/distribution/DistributorFlushTimerTask.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2021 Bell Canada. 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.
@@ -64,8 +65,8 @@ public class DistributorFlushTimerTask extends TimerTask {
this.contextDistributor = contextDistributor;
// Set the period for persistence flushing
- final PersistorParameters persistorParameters = ParameterService
- .get(ContextParameterConstants.PERSISTENCE_GROUP_NAME);
+ final var persistorParameters =
+ (PersistorParameters) ParameterService.get(ContextParameterConstants.PERSISTENCE_GROUP_NAME);
flushPeriod = persistorParameters.getFlushPeriod();
// Set up the timer
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/locking/LockManagerFactory.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/locking/LockManagerFactory.java
index 923c83979..9aac801a3 100644
--- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/locking/LockManagerFactory.java
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/locking/LockManagerFactory.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2020 Nordix Foundation.
+ * Modifications Copyright (C) 2021 Bell Canada. 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.
@@ -50,8 +51,8 @@ public class LockManagerFactory {
public LockManager createLockManager(final AxArtifactKey key) throws ContextException {
LOGGER.entry("Lock Manager factory, key=" + key);
- final LockManagerParameters lockManagerParameters =
- ParameterService.get(ContextParameterConstants.LOCKING_GROUP_NAME);
+ final var lockManagerParameters =
+ (LockManagerParameters) ParameterService.get(ContextParameterConstants.LOCKING_GROUP_NAME);
// Get the class for the lock manager using reflection
Object lockManagerObject = null;
@@ -76,7 +77,7 @@ public class LockManagerFactory {
}
// The context lock manager to return
- final LockManager lockManager = (LockManager) lockManagerObject;
+ final var lockManager = (LockManager) lockManagerObject;
// Lock and load (OK sorry!!!) the lock manager
lockManager.init(key);
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/persistence/PersistorFactory.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/persistence/PersistorFactory.java
index fe06d2fdb..31a31b51f 100644
--- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/persistence/PersistorFactory.java
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/persistence/PersistorFactory.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019-2020 Nordix Foundation.
+ * Modifications Copyright (C) 2021 Bell Canada. 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.
@@ -51,8 +52,8 @@ public class PersistorFactory {
LOGGER.entry("persistor factory, key=" + key);
Assertions.argumentOfClassNotNull(key, ContextException.class, "Parameter \"key\" may not be null");
- final PersistorParameters persistorParameters =
- ParameterService.get(ContextParameterConstants.PERSISTENCE_GROUP_NAME);
+ final var persistorParameters =
+ (PersistorParameters) ParameterService.get(ContextParameterConstants.PERSISTENCE_GROUP_NAME);
// Get the class for the persistor using reflection
Object persistorObject = null;
@@ -75,7 +76,7 @@ public class PersistorFactory {
}
// The persistor to return
- final Persistor persistor = (Persistor) persistorObject;
+ final var persistor = (Persistor) persistorObject;
// Lock and load the persistor
persistor.init(key);
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/SchemaHelperFactory.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/SchemaHelperFactory.java
index a5fa26870..08289e642 100644
--- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/SchemaHelperFactory.java
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/SchemaHelperFactory.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019-2020 Nordix Foundation.
+ * Modifications Copyright (C) 2021 Bell Canada. 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.
@@ -24,7 +25,6 @@ package org.onap.policy.apex.context.impl.schema;
import org.onap.policy.apex.context.ContextRuntimeException;
import org.onap.policy.apex.context.SchemaHelper;
import org.onap.policy.apex.context.parameters.ContextParameterConstants;
-import org.onap.policy.apex.context.parameters.SchemaHelperParameters;
import org.onap.policy.apex.context.parameters.SchemaParameters;
import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
import org.onap.policy.apex.model.basicmodel.concepts.AxKey;
@@ -70,10 +70,11 @@ public class SchemaHelperFactory {
}
// Get the schema class using the parameter service
- final SchemaParameters schemaParameters = ParameterService.get(ContextParameterConstants.SCHEMA_GROUP_NAME);
+ final var schemaParameters =
+ (SchemaParameters) ParameterService.get(ContextParameterConstants.SCHEMA_GROUP_NAME);
// Get the class for the schema helper from the schema parameters
- final SchemaHelperParameters schemaHelperParameters =
+ final var schemaHelperParameters =
schemaParameters.getSchemaHelperParameters(schema.getSchemaFlavour());
if (schemaHelperParameters == null) {
final var resultString = "context schema helper parameters not found for context schema \""
@@ -103,7 +104,7 @@ public class SchemaHelperFactory {
}
// The context schema helper to return
- final SchemaHelper schemaHelper = (SchemaHelper) schemaHelperObject;
+ final var schemaHelper = (SchemaHelper) schemaHelperObject;
// Lock and load the schema helper
schemaHelper.init(owningEntityKey.getKey(), schema);
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelper.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelper.java
index 7d67788b6..f601062bb 100644
--- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelper.java
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelper.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019-2020 Nordix Foundation.
+ * Modifications Copyright (C) 2021 Bell Canada. 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.
@@ -234,10 +235,10 @@ public class JavaSchemaHelper extends AbstractSchemaHelper {
* @return the GSON instance
*/
private Gson getGson() {
- GsonBuilder gsonBuilder = new GsonBuilder().setPrettyPrinting();
+ var gsonBuilder = new GsonBuilder().setPrettyPrinting();
// Get the Java schema helper parameters from the parameter service
- SchemaParameters schemaParameters = ParameterService.get(ContextParameterConstants.SCHEMA_GROUP_NAME);
+ var schemaParameters = (SchemaParameters) ParameterService.get(ContextParameterConstants.SCHEMA_GROUP_NAME);
JavaSchemaHelperParameters javaSchemaHelperParmeters =
(JavaSchemaHelperParameters) schemaParameters.getSchemaHelperParameterMap().get("Java");