summaryrefslogtreecommitdiffstats
path: root/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src')
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroBytesObjectMapper.java11
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroDirectObjectMapper.java11
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroNullableMapper.java18
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaHelper.java12
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaKeyTranslationUtilities.java11
-rw-r--r--plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroStringObjectMapper.java11
6 files changed, 22 insertions, 52 deletions
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 c575eea02..6ea6857e9 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
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019-2021 Nordix Foundation.
+ * 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.
@@ -22,6 +23,7 @@
package org.onap.policy.apex.plugins.context.schema.avro;
import java.nio.ByteBuffer;
+import lombok.Getter;
import org.apache.avro.Schema;
import org.apache.avro.Schema.Type;
import org.onap.policy.apex.context.ContextRuntimeException;
@@ -40,6 +42,7 @@ public class AvroBytesObjectMapper implements AvroObjectMapper {
// The user keyAvro type for direct mapping
private AxKey userKey;
+ @Getter
private Type avroType;
// The Apex compatible class
@@ -76,14 +79,6 @@ public class AvroBytesObjectMapper implements AvroObjectMapper {
* {@inheritDoc}.
*/
@Override
- public Type getAvroType() {
- return avroType;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
public Object mapFromAvro(final Object avroObject) {
// The Avro object should be a Utf8 object
if (!(avroObject instanceof ByteBuffer)) {
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 2c2483384..945c30c6f 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
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019-2021 Nordix Foundation.
+ * 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.
@@ -24,6 +25,7 @@ package org.onap.policy.apex.plugins.context.schema.avro;
import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
+import lombok.Getter;
import org.apache.avro.Schema;
import org.apache.avro.Schema.Type;
import org.apache.avro.generic.GenericData;
@@ -64,6 +66,7 @@ public class AvroDirectObjectMapper implements AvroObjectMapper {
// The user keyAvro type for direct mapping
private AxKey userKey;
+ @Getter
private Type avroType;
// The Apex compatible class
@@ -100,14 +103,6 @@ public class AvroDirectObjectMapper implements AvroObjectMapper {
* {@inheritDoc}.
*/
@Override
- public Type getAvroType() {
- return avroType;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
public Object mapFromAvro(final Object avroObject) {
// Always return null if the schema is a null schema
if (schemaClass == null) {
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroNullableMapper.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroNullableMapper.java
index b2fccaab3..1f53b628e 100644
--- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroNullableMapper.java
+++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroNullableMapper.java
@@ -1,25 +1,27 @@
/*-
* ============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.schema.avro;
+import lombok.AllArgsConstructor;
import org.apache.avro.Schema;
import org.apache.avro.Schema.Type;
import org.onap.policy.apex.model.basicmodel.concepts.ApexRuntimeException;
@@ -30,20 +32,12 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxKey;
*
* @author John Keeney (john.keeney@ericsson.com)
*/
+@AllArgsConstructor
public class AvroNullableMapper extends AvroDirectObjectMapper {
// The wrapped mapper for nullables
private final AvroObjectMapper wrappedMapper;
/**
- * The Constructor.
- *
- * @param wrappedMapper the wrapped mapper
- */
- public AvroNullableMapper(final AvroObjectMapper wrappedMapper) {
- this.wrappedMapper = wrappedMapper;
- }
-
- /**
* {@inheritDoc}.
*/
@Override
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 fe6779891..b7fe0663d 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
@@ -3,6 +3,7 @@
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019-2021 Nordix Foundation.
* Modifications Copyright (C) 2021 Bell Canada. 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.
@@ -28,6 +29,7 @@ import com.google.gson.JsonElement;
import java.io.ByteArrayOutputStream;
import java.util.LinkedHashSet;
import java.util.Set;
+import lombok.Getter;
import org.apache.avro.Schema;
import org.apache.avro.Schema.Field;
import org.apache.avro.Schema.Type;
@@ -55,6 +57,7 @@ public class AvroSchemaHelper extends AbstractSchemaHelper {
private static final String OBJECT_TAG = ": object \"";
// The Avro schema for this context schema
+ @Getter
private Schema avroSchema;
// The mapper that translates between Java and Avro objects
@@ -81,15 +84,6 @@ public class AvroSchemaHelper extends AbstractSchemaHelper {
setSchemaClass(avroObjectMapper.getJavaClass());
}
- /**
- * Getter to get the Avro schema.
- *
- * @return the Avro schema
- */
- public Schema getAvroSchema() {
- return avroSchema;
- }
-
@Override
public Object getSchemaObject() {
return getAvroSchema();
diff --git a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaKeyTranslationUtilities.java b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaKeyTranslationUtilities.java
index 34a4dedb0..babca5cb2 100644
--- a/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaKeyTranslationUtilities.java
+++ b/plugins/plugins-context/plugins-context-schema/plugins-context-schema-avro/src/main/java/org/onap/policy/apex/plugins/context/schema/avro/AvroSchemaKeyTranslationUtilities.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2020-2021 Nordix Foundation.
+ * 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.
@@ -26,12 +27,15 @@ import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import java.util.Map.Entry;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
/**
* This static final class contains utility methods for Avro schemas.
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class AvroSchemaKeyTranslationUtilities {
// Constants for key replacements
private static final String DOT_STRING = ".";
@@ -42,13 +46,6 @@ public final class AvroSchemaKeyTranslationUtilities {
private static final String COLON_STRING_REPLACEMENT = "_ColoN_";
/**
- * Default constructor to avoid subclassing.
- */
- private AvroSchemaKeyTranslationUtilities() {
- // Private constructor to prevent subclassing
- }
-
- /**
* Translate characters in JSON keys to values that are legal in Avro. Avro names must start with [A-Za-z_] and
* subsequently contain only [A-Za-z0-9_]
*
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 27737b500..3d5e03605 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
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019-2021 Nordix Foundation.
+ * 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.
@@ -21,6 +22,7 @@
package org.onap.policy.apex.plugins.context.schema.avro;
+import lombok.Getter;
import org.apache.avro.Schema;
import org.apache.avro.Schema.Type;
import org.apache.avro.util.Utf8;
@@ -40,6 +42,7 @@ public class AvroStringObjectMapper implements AvroObjectMapper {
// The user keyAvro type for direct mapping
private AxKey userKey;
+ @Getter
private Type avroType;
// The Apex compatible class
@@ -76,14 +79,6 @@ public class AvroStringObjectMapper implements AvroObjectMapper {
* {@inheritDoc}.
*/
@Override
- public Type getAvroType() {
- return avroType;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
public Object mapFromAvro(final Object avroObject) {
// The Avro object should be a Utf8 object
if (!(avroObject instanceof Utf8)) {