diff options
author | liamfallon <liam.fallon@ericsson.com> | 2018-09-04 17:24:15 +0100 |
---|---|---|
committer | liamfallon <liam.fallon@ericsson.com> | 2018-09-04 17:25:22 +0100 |
commit | 87be30582d1db37bee7c6b456c0c5c3ca9584963 (patch) | |
tree | 28806c5866fc5d07c89a06014d7c7d2705772b4f /plugins/plugins-context | |
parent | f32508381ce0b555fc14978cbaa458aa4e2d91c5 (diff) |
Fix checkstyle issues in apex model basic
CHeckstyle issues in apex model basic and knock on changes
in other apex modules.
Issue-ID: POLICY-1034
Change-Id: I65823f5e2e344526abc74b0812877113acb056ec
Signed-off-by: liamfallon <liam.fallon@ericsson.com>
Diffstat (limited to 'plugins/plugins-context')
7 files changed, 20 insertions, 20 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 2b17b17cf..9d35c30a8 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 @@ -85,8 +85,8 @@ public class HazelcastContextDistributor extends AbstractDistributor { @Override public Map<String, Object> getContextAlbumMap(final AxArtifactKey contextAlbumKey) { // Get the map from Hazelcast - LOGGER.info("HazelcastContextDistributor: create album: " + contextAlbumKey.getID()); - return hazelcastInstance.getMap(contextAlbumKey.getID()); + LOGGER.info("HazelcastContextDistributor: create album: " + contextAlbumKey.getId()); + return hazelcastInstance.getMap(contextAlbumKey.getId()); } /* 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 d6a04dd7c..9f1327df1 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 @@ -91,11 +91,11 @@ public class InfinispanContextDistributor extends AbstractDistributor { */ @Override public Map<String, Object> getContextAlbumMap(final AxArtifactKey contextAlbumKey) { - LOGGER.info("InfinispanContextDistributor: create album: " + contextAlbumKey.getID()); + LOGGER.info("InfinispanContextDistributor: create album: " + contextAlbumKey.getId()); // Get the Cache from Infinispan final Cache<String, Object> infinispanCache = - infinispanManager.getCacheManager().getCache(contextAlbumKey.getID().replace(':', '_')); + infinispanManager.getCacheManager().getCache(contextAlbumKey.getId().replace(':', '_')); return infinispanCache; } diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroBytesObjectMapper.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroBytesObjectMapper.java index dc281a52b..20e701bc7 100644 --- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroBytesObjectMapper.java +++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroBytesObjectMapper.java @@ -102,7 +102,7 @@ public class AvroBytesObjectMapper implements AvroObjectMapper { // The Avro object should be a Utf8 object if (!(avroObject instanceof ByteBuffer)) { final String returnString = - userKey.getID() + ": object \"" + avroObject + "\" of class \"" + avroObject.getClass() + userKey.getId() + ": object \"" + avroObject + "\" of class \"" + avroObject.getClass() + "\" cannot be decoded to an object of class \"" + schemaClass.getCanonicalName() + "\""; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); @@ -127,7 +127,7 @@ public class AvroBytesObjectMapper implements AvroObjectMapper { @Override public Object mapToAvro(final Object object) { if (object == null) { - final String returnString = userKey.getID() + ": cannot encode a null object of class \"" + final String returnString = userKey.getId() + ": cannot encode a null object of class \"" + schemaClass.getCanonicalName() + "\""; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); @@ -135,7 +135,7 @@ public class AvroBytesObjectMapper implements AvroObjectMapper { // The incoming object should be a byte array if (!(object instanceof byte[])) { - final String returnString = userKey.getID() + ": object \"" + object + "\" of class \"" + object.getClass() + final String returnString = userKey.getId() + ": object \"" + object + "\" of class \"" + object.getClass() + "\" cannot be decoded to an object of class \"" + schemaClass.getCanonicalName() + "\""; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroDirectObjectMapper.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroDirectObjectMapper.java index acf64c3c9..35e811dec 100644 --- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroDirectObjectMapper.java +++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroDirectObjectMapper.java @@ -132,7 +132,7 @@ public class AvroDirectObjectMapper implements AvroObjectMapper { // the decoded object is always returned as a null if (!schemaClass.isAssignableFrom(avroObject.getClass())) { final String returnString = - userKey.getID() + ": object \"" + avroObject + "\" of class \"" + avroObject.getClass() + userKey.getId() + ": object \"" + avroObject + "\" of class \"" + avroObject.getClass() + "\" cannot be decoded to an object of class \"" + schemaClass.getCanonicalName() + "\""; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); @@ -152,7 +152,7 @@ public class AvroDirectObjectMapper implements AvroObjectMapper { // Null values are only allowed if the schema class is null if (object == null) { if (schemaClass != null) { - final String returnString = userKey.getID() + ": cannot encode a null object of class \"" + final String returnString = userKey.getId() + ": cannot encode a null object of class \"" + schemaClass.getCanonicalName() + "\""; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroObjectMapperFactory.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroObjectMapperFactory.java index 22152a8da..a48ca8089 100644 --- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroObjectMapperFactory.java +++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroObjectMapperFactory.java @@ -79,7 +79,7 @@ public class AvroObjectMapperFactory { // currently only support unions with 2 types, one of which is NULL final Schema nullschema = Schema.create(Schema.Type.NULL); if (types.size() != 2 || !types.contains(nullschema)) { - final String resultSting = userKey.getID() + final String resultSting = userKey.getId() + ": Apex currently only supports UNION schemas with 2 options, one must be NULL"; LOGGER.warn(resultSting); throw new ContextRuntimeException(resultSting); @@ -91,7 +91,7 @@ public class AvroObjectMapperFactory { schema = types.get(1); } if (Schema.Type.NULL.equals(schema.getType())) { - final String resultSting = userKey.getID() + final String resultSting = userKey.getId() + ": Apex currently only supports UNION schema2 with 2 options, only one can be NULL, and the other cannot be another UNION"; LOGGER.warn(resultSting); throw new ContextRuntimeException(resultSting); @@ -103,7 +103,7 @@ public class AvroObjectMapperFactory { // Check that there is a definition for the mapper for this type if (!AVRO_OBJECT_MAPPER_MAP.containsKey(avroType) || AVRO_OBJECT_MAPPER_MAP.get(avroType) == null) { final String resultSting = - userKey.getID() + ": no Avro object mapper defined for Avro type \"" + avroType + "\""; + userKey.getId() + ": no Avro object mapper defined for Avro type \"" + avroType + "\""; LOGGER.warn(resultSting); throw new ContextRuntimeException(resultSting); } @@ -117,7 +117,7 @@ public class AvroObjectMapperFactory { } } catch (final Exception e) { - final String resultSting = userKey.getID() + ": could not create an Avro object mapper of type \"" + final String resultSting = userKey.getId() + ": could not create an Avro object mapper of type \"" + AVRO_OBJECT_MAPPER_MAP.get(avroType) + "\" for Avro type \"" + avroType + "\" : " + e; LOGGER.warn(resultSting, e); throw new ContextRuntimeException(resultSting, e); diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelper.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelper.java index 5fba274ce..df430b683 100644 --- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelper.java +++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelper.java @@ -66,7 +66,7 @@ public class AvroSchemaHelper extends AbstractSchemaHelper { try { avroSchema = new Schema.Parser().parse(schema.getSchema()); } catch (final Exception e) { - final String resultSting = userKey.getID() + ": avro context schema \"" + schema.getID() + final String resultSting = userKey.getId() + ": avro context schema \"" + schema.getId() + "\" schema is invalid: " + e.getMessage() + ", schema: " + schema.getSchema(); LOGGER.warn(resultSting); throw new ContextRuntimeException(resultSting); @@ -121,7 +121,7 @@ public class AvroSchemaHelper extends AbstractSchemaHelper { return createNewInstance(elementJsonString); } else { - final String returnString = getUserKey().getID() + ": the object \"" + incomingObject + final String returnString = getUserKey().getId() + ": the object \"" + incomingObject + "\" is not an instance of JsonObject"; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); @@ -146,7 +146,7 @@ public class AvroSchemaHelper extends AbstractSchemaHelper { final JsonDecoder jsonDecoder = DecoderFactory.get().jsonDecoder(avroSchema, objectString); decodedObject = new GenericDatumReader<GenericRecord>(avroSchema).read(null, jsonDecoder); } catch (final Exception e) { - final String returnString = getUserKey().getID() + ": object \"" + objectString + final String returnString = getUserKey().getId() + ": object \"" + objectString + "\" Avro unmarshalling failed: " + e.getMessage(); LOGGER.warn(returnString, e); throw new ContextRuntimeException(returnString, e); @@ -185,7 +185,7 @@ public class AvroSchemaHelper extends AbstractSchemaHelper { return (String) object; } } catch (final ClassCastException e) { - final String returnString = getUserKey().getID() + ": object \"" + object + "\" of type \"" + final String returnString = getUserKey().getId() + ": object \"" + object + "\" of type \"" + (object != null ? object.getClass().getCanonicalName() : "null") + "\" must be assignable to \"" + getSchemaClass().getCanonicalName() + "\" or be a Json string representation of it for Avro unmarshalling"; @@ -218,7 +218,7 @@ public class AvroSchemaHelper extends AbstractSchemaHelper { return new String(output.toByteArray()); } catch (final Exception e) { final String returnString = - getUserKey().getID() + ": object \"" + object + "\" Avro marshalling failed: " + e.getMessage(); + getUserKey().getId() + ": object \"" + object + "\" Avro marshalling failed: " + e.getMessage(); LOGGER.warn(returnString); throw new ContextRuntimeException(returnString, e); } diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroStringObjectMapper.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroStringObjectMapper.java index cb3625f31..09d1d9f1f 100644 --- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroStringObjectMapper.java +++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroStringObjectMapper.java @@ -101,7 +101,7 @@ public class AvroStringObjectMapper implements AvroObjectMapper { // The Avro object should be a Utf8 object if (!(avroObject instanceof Utf8)) { final String returnString = - userKey.getID() + ": object \"" + avroObject + "\" of class \"" + avroObject.getClass() + userKey.getId() + ": object \"" + avroObject + "\" of class \"" + avroObject.getClass() + "\" cannot be decoded to an object of class \"" + schemaClass.getCanonicalName() + "\""; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); @@ -119,7 +119,7 @@ public class AvroStringObjectMapper implements AvroObjectMapper { @Override public Object mapToAvro(final Object object) { if (object == null) { - final String returnString = userKey.getID() + ": cannot encode a null object of class \"" + final String returnString = userKey.getId() + ": cannot encode a null object of class \"" + schemaClass.getCanonicalName() + "\""; LOGGER.warn(returnString); throw new ContextRuntimeException(returnString); |