aboutsummaryrefslogtreecommitdiffstats
path: root/context/context-management/src/main/java
diff options
context:
space:
mode:
authorDinh Danh Le <dinh.danh.le@ericsson.com>2018-08-11 17:17:34 +0100
committerDinh Danh Le <dinh.danh.le@ericsson.com>2018-08-11 17:32:25 +0100
commit15dcabb76fd31f54452a94498e84516485dd838a (patch)
tree509c78c1dd92c1d825e530cb93da001fb65755e3 /context/context-management/src/main/java
parent4f0e4e0acb23479d705747cf6015d4d820659c78 (diff)
Checkstyle the context-management package
Change-Id: Ifc4fef920681f21b0a965ea55d9bb78785ec66f9 Signed-off-by: Dinh Danh Le <dinh.danh.le@ericsson.com> Issue-ID: POLICY-1034
Diffstat (limited to 'context/context-management/src/main/java')
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/ContextAlbum.java46
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/ContextException.java6
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/ContextRuntimeException.java6
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/AbstractSchemaHelper.java9
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/java/JavaSchemaHelper.java39
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/parameters/ContextParameters.java31
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/parameters/PersistorParameters.java19
-rw-r--r--context/context-management/src/main/java/org/onap/policy/apex/context/parameters/SchemaParameters.java16
8 files changed, 92 insertions, 80 deletions
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/ContextAlbum.java b/context/context-management/src/main/java/org/onap/policy/apex/context/ContextAlbum.java
index 559139321..b3e85282d 100644
--- a/context/context-management/src/main/java/org/onap/policy/apex/context/ContextAlbum.java
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/ContextAlbum.java
@@ -27,26 +27,32 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxConcept;
import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum;
/**
- * The Interface ContextAlbum is implemented by all classes that manage context in Apex. Context albums may store
- * context in memory, on disk, in a repository or in a mechanism such as a distributed map.
- * <p>
- * A context album uses plugins to handle its context schemas, its distribution, its locking, and its persistence.
- * <p>
- * The schema that defines the items in a context album is interpreted by a plugin that implements the
- * {@link SchemaHelper} interface. The schema helper uses the schema definition to provide new instances for a context
- * album. By default, context albums use Java schemas.
- * <p>
- * Context albums may be shared across an arbitrary number of JVMs using a distribution mechanism. Apex context
- * distributed context albums using plugins that implement the {@link Distributor} interface. By default, context albums
- * use JVM local distribution, that is context albums are only available in a single JVM
- * <p>
- * Items in a context album may be locked across all distributed instances of an album. Apex locks instances on context
- * albums using the distributed locking mechanism in a plugin that implements the {@link LockManager} interface. By
- * default, context albums use Java locking local to a single JVM on each context album instance.
+ * The Interface ContextAlbum is implemented by all classes that manage context in Apex. Context
+ * albums may store context in memory, on disk, in a repository or in a mechanism such as a
+ * distributed map.
+ *
+ * <p>A context album uses plugins to handle its context schemas, its distribution, its locking, and
+ * its persistence.
+ *
* <p>
- * Context albums may be persisted to disk, database, or any other repository. Apex persists context albums using the
- * persistence mechanism in a plugin that implements the {@link Persistor} interface. By default, context albums use a
- * dummy persistor plugin that does not persist context albums.
+ * The schema that defines the items in a context album is interpreted by a plugin that implements
+ * the {@link SchemaHelper} interface. The schema helper uses the schema definition to provide new
+ * instances for a context album. By default, context albums use Java schemas.
+ *
+ * <p>Context albums may be shared across an arbitrary number of JVMs using a distribution mechanism.
+ * Apex context distributed context albums using plugins that implement the {@link Distributor}
+ * interface. By default, context albums use JVM local distribution, that is context albums are only
+ * available in a single JVM
+ *
+ * <p>Items in a context album may be locked across all distributed instances of an album. Apex locks
+ * instances on context albums using the distributed locking mechanism in a plugin that implements
+ * the {@link LockManager} interface. By default, context albums use Java locking local to a single
+ * JVM on each context album instance.
+ *
+ * <p>Context albums may be persisted to disk, database, or any other repository. Apex persists context
+ * albums using the persistence mechanism in a plugin that implements the {@link Persistor}
+ * interface. By default, context albums use a dummy persistor plugin that does not persist context
+ * albums.
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
@@ -116,7 +122,7 @@ public interface ContextAlbum extends Map<String, Object> {
*
* @return the keys of the artifacts using the context album at the moment
*/
- AxConcept[] getUserArtifactStack();
+ AxConcept[] getUserArtifactStack();
/**
* Set the stack of artifact keys currently using this context item.
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/ContextException.java b/context/context-management/src/main/java/org/onap/policy/apex/context/ContextException.java
index de5cec051..aa800b30e 100644
--- a/context/context-management/src/main/java/org/onap/policy/apex/context/ContextException.java
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/ContextException.java
@@ -43,9 +43,9 @@ public class ContextException extends ApexException {
* Instantiates a new apex context exception with a message and a caused by exception.
*
* @param message the message
- * @param e the exception that caused this exception to be thrown
+ * @param ex the exception that caused this exception to be thrown
*/
- public ContextException(final String message, final Exception e) {
- super(message, e);
+ public ContextException(final String message, final Exception ex) {
+ super(message, ex);
}
}
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/ContextRuntimeException.java b/context/context-management/src/main/java/org/onap/policy/apex/context/ContextRuntimeException.java
index b2aa017e5..acfe9e7f9 100644
--- a/context/context-management/src/main/java/org/onap/policy/apex/context/ContextRuntimeException.java
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/ContextRuntimeException.java
@@ -43,9 +43,9 @@ public class ContextRuntimeException extends ApexRuntimeException {
* Instantiates a new apex context exception with a message and a caused by exception.
*
* @param message the message
- * @param e the exception that caused this exception to be thrown
+ * @param ex the exception that caused this exception to be thrown
*/
- public ContextRuntimeException(final String message, final Exception e) {
- super(message, e);
+ public ContextRuntimeException(final String message, final Exception ex) {
+ super(message, ex);
}
}
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/AbstractSchemaHelper.java b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/AbstractSchemaHelper.java
index 8acc03501..6ce924b0e 100644
--- a/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/AbstractSchemaHelper.java
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/impl/schema/AbstractSchemaHelper.java
@@ -32,8 +32,8 @@ import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
/**
- * This class implements the {@link SchemaHelper} functionality that is common across all implementations. Schema
- * helpers for specific schema mechanisms specialize this class.
+ * This class implements the {@link SchemaHelper} functionality that is common across all
+ * implementations. Schema helpers for specific schema mechanisms specialize this class.
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
@@ -62,8 +62,9 @@ public abstract class AbstractSchemaHelper implements SchemaHelper {
/*
* (non-Javadoc)
*
- * @see org.onap.policy.apex.context.SchemaHelper#init(org.onap.policy.apex.model.basicmodel.concepts.AxKey,
- * org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema)
+ * @see
+ * org.onap.policy.apex.context.SchemaHelper#init(org.onap.policy.apex.model.basicmodel.concepts
+ * .AxKey, org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema)
*/
@Override
public void init(final AxKey incomingUserKey, final AxContextSchema incomingSchema) throws ContextRuntimeException {
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 a4bfe6978..1bfe77a45 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
@@ -36,9 +36,9 @@ import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
/**
- * This class implements translation to and from Apex distributed objects and Java objects when a Java schema is used.
- * It creates schema items as Java objects and marshals and unmarshals these objects in various formats. All objects
- * must be of the type of Java class defined in the schema.
+ * This class implements translation to and from Apex distributed objects and Java objects when a
+ * Java schema is used. It creates schema items as Java objects and marshals and unmarshals these
+ * objects in various formats. All objects must be of the type of Java class defined in the schema.
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
@@ -49,6 +49,7 @@ public class JavaSchemaHelper extends AbstractSchemaHelper {
// This map defines the built in types in types in Java
// @formatter:off
private static final Map<String, Class<?>> BUILT_IN_MAP = new HashMap<>();
+
static {
BUILT_IN_MAP.put("int", Integer .TYPE);
BUILT_IN_MAP.put("long", Long .TYPE);
@@ -65,8 +66,10 @@ public class JavaSchemaHelper extends AbstractSchemaHelper {
/*
* (non-Javadoc)
*
- * @see org.onap.policy.apex.context.impl.schema.AbstractSchemaHelper#init(org.onap.policy.apex.model.basicmodel.
- * concepts. AxKey, org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema)
+ * @see
+ * org.onap.policy.apex.context.impl.schema.AbstractSchemaHelper#init(org.onap.policy.apex.model
+ * .basicmodel. concepts. AxKey,
+ * org.onap.policy.apex.model.contextmodel.concepts.AxContextSchema)
*/
@Override
public void init(final AxKey userKey, final AxContextSchema schema) {
@@ -80,7 +83,7 @@ public class JavaSchemaHelper extends AbstractSchemaHelper {
} catch (final IllegalArgumentException e) {
String resultSting = userKey.getID() + ": class/type " + schema.getSchema() + " for context schema \""
- + schema.getID() + "\" not found.";
+ + schema.getID() + "\" not found.";
if (JavaSchemaHelper.BUILT_IN_MAP.get(javatype) != null) {
resultSting += " Primitive types are not supported. Use the appropriate Java boxing type instead.";
} else {
@@ -101,7 +104,7 @@ public class JavaSchemaHelper extends AbstractSchemaHelper {
if (incomingObject == null) {
return null;
}
-
+
if (getSchemaClass() == null) {
final String returnString =
getUserKey().getID() + ": could not create an instance, schema class for the schema is null";
@@ -109,7 +112,7 @@ public class JavaSchemaHelper extends AbstractSchemaHelper {
throw new ContextRuntimeException(returnString);
}
- if (incomingObject instanceof JsonElement) {
+ if (incomingObject instanceof JsonElement) {
final String elementJsonString = new Gson().toJson((JsonElement) incomingObject);
return new Gson().fromJson(elementJsonString, this.getSchemaClass());
}
@@ -119,9 +122,9 @@ public class JavaSchemaHelper extends AbstractSchemaHelper {
}
final String returnString = getUserKey().getID() + ": the object \"" + incomingObject + "\" of type \""
- + incomingObject.getClass().getCanonicalName()
- + "\" is not an instance of JsonObject and is not assignable to \""
- + getSchemaClass().getCanonicalName() + "\"";
+ + incomingObject.getClass().getCanonicalName()
+ + "\" is not an instance of JsonObject and is not assignable to \""
+ + getSchemaClass().getCanonicalName() + "\"";
LOGGER.warn(returnString);
throw new ContextRuntimeException(returnString);
}
@@ -171,8 +174,8 @@ public class JavaSchemaHelper extends AbstractSchemaHelper {
return new Gson().toJson(schemaObject);
} else {
final String returnString = getUserKey().getID() + ": object \"" + schemaObject.toString()
- + "\" of class \"" + schemaObject.getClass().getCanonicalName()
- + "\" not compatible with class \"" + getSchemaClass().getCanonicalName() + "\"";
+ + "\" of class \"" + schemaObject.getClass().getCanonicalName() + "\" not compatible with class \""
+ + getSchemaClass().getCanonicalName() + "\"";
LOGGER.warn(returnString);
throw new ContextRuntimeException(returnString);
}
@@ -192,8 +195,7 @@ public class JavaSchemaHelper extends AbstractSchemaHelper {
/**
* Do a numeric conversion between numeric types.
*
- * @param object
- * The incoming numeric object
+ * @param object The incoming numeric object
* @return The converted object
*/
private Object numericConversion(final Object object) {
@@ -221,8 +223,7 @@ public class JavaSchemaHelper extends AbstractSchemaHelper {
/**
* Do a string conversion to the class type.
*
- * @param object
- * The incoming numeric object
+ * @param object The incoming numeric object
* @return The converted object
*/
private Object stringConversion(final Object object) {
@@ -232,8 +233,8 @@ public class JavaSchemaHelper extends AbstractSchemaHelper {
return stringConstructor.newInstance(object.toString());
} catch (final Exception e) {
final String returnString = getUserKey().getID() + ": object \"" + object.toString() + "\" of class \""
- + object.getClass().getCanonicalName() + "\" not compatible with class \""
- + getSchemaClass().getCanonicalName() + "\"";
+ + object.getClass().getCanonicalName() + "\" not compatible with class \""
+ + getSchemaClass().getCanonicalName() + "\"";
LOGGER.warn(returnString);
throw new ContextRuntimeException(returnString);
}
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/ContextParameters.java b/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/ContextParameters.java
index e50cc60b4..8bda76d21 100644
--- a/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/ContextParameters.java
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/ContextParameters.java
@@ -24,21 +24,21 @@ import org.onap.policy.apex.model.basicmodel.service.AbstractParameters;
import org.onap.policy.apex.model.basicmodel.service.ParameterService;
/**
- * Bean class to hold parameters for context handling in Apex. This class contains all the context parameters for schema
- * handling, distribution, locking, and persistence of context albums.
- * <p>
- * The following parameters are defined:
+ * Bean class to hold parameters for context handling in Apex. This class contains all the context
+ * parameters for schema handling, distribution, locking, and persistence of context albums.
+ *
+ * <p>The following parameters are defined:
* <ol>
- * <li>flushPeriod: Context is flushed to any persistor plugin that is defined periodically, and the period for flushing
- * is the flush period.
- * <li>distributorParameters: The parameters (a {@link distributorParameters} instance) for the distributor plugin that
- * is being used for context album distribution
- * <li>schemaParameters: The parameters (a {@link SchemaParameters} instance) for the schema plugin that is being used
- * for context album schemas
- * <li>lockManagerParameters: The parameters (a {@link LockManagerParameters} instance) for the locking mechanism plugin
- * that is being used for context album locking
- * <li>persistorParameters: The parameters (a {@link PersistorParameters} instance) for the persistence plugin that is
- * being used for context album persistence
+ * <li>flushPeriod: Context is flushed to any persistor plugin that is defined periodically, and the
+ * period for flushing is the flush period.
+ * <li>distributorParameters: The parameters (a {@link distributorParameters} instance) for the
+ * distributor plugin that is being used for context album distribution
+ * <li>schemaParameters: The parameters (a {@link SchemaParameters} instance) for the schema plugin
+ * that is being used for context album schemas
+ * <li>lockManagerParameters: The parameters (a {@link LockManagerParameters} instance) for the
+ * locking mechanism plugin that is being used for context album locking
+ * <li>persistorParameters: The parameters (a {@link PersistorParameters} instance) for the
+ * persistence plugin that is being used for context album persistence
* </ol>
*
* @author Liam Fallon (liam.fallon@ericsson.com)
@@ -53,7 +53,8 @@ public class ContextParameters extends AbstractParameters {
// @formatter:on
/**
- * Constructor to create a context parameters instance and register the instance with the parameter service.
+ * Constructor to create a context parameters instance and register the instance with the
+ * parameter service.
*/
public ContextParameters() {
super(ContextParameters.class.getCanonicalName());
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/PersistorParameters.java b/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/PersistorParameters.java
index c9b0d85f8..6fd320001 100644
--- a/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/PersistorParameters.java
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/PersistorParameters.java
@@ -24,14 +24,14 @@ import org.onap.policy.apex.model.basicmodel.service.AbstractParameters;
import org.onap.policy.apex.model.basicmodel.service.ParameterService;
/**
- * A persistor parameter class that may be specialized by context persistor plugins that require plugin specific
- * parameters.
- * <p>
- * The following parameters are defined:
+ * A persistor parameter class that may be specialized by context persistor plugins that require
+ * plugin specific parameters.
+ *
+ * <p>The following parameters are defined:
* <ol>
* <li>pluginClass: the persistor plugin as the JVM local dummy ephemeral persistor
- * <li>flushPeriod: Context is flushed to any persistor plugin that is defined periodically, and the period for flushing
- * is the flush period.
+ * <li>flushPeriod: Context is flushed to any persistor plugin that is defined periodically, and the
+ * period for flushing is the flush period.
* </ol>
*
* @author Liam Fallon (liam.fallon@ericsson.com)
@@ -51,7 +51,8 @@ public class PersistorParameters extends AbstractParameters {
private long flushPeriod = DEFAULT_FLUSH_PERIOD;
/**
- * Constructor to create a persistor parameters instance and register the instance with the parameter service.
+ * Constructor to create a persistor parameters instance and register the instance with the
+ * parameter service.
*/
public PersistorParameters() {
super(PersistorParameters.class.getCanonicalName());
@@ -59,8 +60,8 @@ public class PersistorParameters extends AbstractParameters {
}
/**
- * Constructor to create a persistor parameters instance with the name of a sub class of this class and register the
- * instance with the parameter service.
+ * Constructor to create a persistor parameters instance with the name of a sub class of this
+ * class and register the instance with the parameter service.
*
* @param parameterClassName the class name of a sub class of this class
*/
diff --git a/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/SchemaParameters.java b/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/SchemaParameters.java
index 858a6a3f7..12e203c30 100644
--- a/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/SchemaParameters.java
+++ b/context/context-management/src/main/java/org/onap/policy/apex/context/parameters/SchemaParameters.java
@@ -28,12 +28,13 @@ import org.onap.policy.apex.model.basicmodel.service.AbstractParameters;
import org.onap.policy.apex.model.basicmodel.service.ParameterService;
/**
- * Bean class holding schema parameters for schemas and their helpers. As more than one schema can be used in Apex
- * simultaneously, this class is used to hold the schemas that are defined in a given Apex system and to get the schema
- * helper plugin parameters {@link SchemaHelperParameters} for each schema.
- * <p>
- * The default {@code Java} schema is always defined and its parameters are held in a {@link JavaSchemaHelperParameters}
- * instance.
+ * Bean class holding schema parameters for schemas and their helpers. As more than one schema can
+ * be used in Apex simultaneously, this class is used to hold the schemas that are defined in a
+ * given Apex system and to get the schema helper plugin parameters {@link SchemaHelperParameters}
+ * for each schema.
+ *
+ * <p>The default {@code Java} schema is always defined and its parameters are held in a
+ * {@link JavaSchemaHelperParameters} instance.
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
@@ -45,7 +46,8 @@ public class SchemaParameters extends AbstractParameters {
private Map<String, SchemaHelperParameters> schemaHelperParameterMap;
/**
- * Constructor to create a distributor parameters instance and register the instance with the parameter service.
+ * Constructor to create a distributor parameters instance and register the instance with the
+ * parameter service.
*/
public SchemaParameters() {
super(SchemaParameters.class.getCanonicalName());