summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
Diffstat (limited to 'services')
-rw-r--r--services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/EventConsumerFactory.java22
-rw-r--r--services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/EventProducerFactory.java19
-rw-r--r--services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/EventProtocolFactory.java32
-rw-r--r--services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/jsonprotocolplugin/Apex2JsonEventConverter.java36
-rw-r--r--services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/engineservice/EngineServiceParametersJsonAdapter.java11
-rw-r--r--services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperEventProducer.java2
-rw-r--r--services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperEventSubscriber.java20
7 files changed, 74 insertions, 68 deletions
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/EventConsumerFactory.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/EventConsumerFactory.java
index 5c44f2d7d..30a44e024 100644
--- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/EventConsumerFactory.java
+++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/EventConsumerFactory.java
@@ -1,19 +1,20 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* 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=========================================================
*/
@@ -40,13 +41,12 @@ public class EventConsumerFactory {
* Create an event consumer of the required type for the specified consumer technology.
*
* @param name the name of the consumer
- * @param consumerParameters The parameters for the Apex engine, we use the technology type of
- * the required consumer
+ * @param consumerParameters The parameters for the Apex engine, we use the technology type of the required consumer
* @return the event consumer
* @throws ApexEventException on errors creating the Apex event consumer
*/
public ApexEventConsumer createConsumer(final String name, final EventHandlerParameters consumerParameters)
- throws ApexEventException {
+ throws ApexEventException {
// Get the carrier technology parameters
final CarrierTechnologyParameters technologyParameters = consumerParameters.getCarrierTechnologyParameters();
@@ -57,8 +57,8 @@ public class EventConsumerFactory {
consumerPluginObject = Class.forName(consumerPluginClass).newInstance();
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
final String errorMessage = "could not create an Apex event consumer for \"" + name
- + "\" for the carrier technology \"" + technologyParameters.getLabel()
- + "\", specified event consumer plugin class \"" + consumerPluginClass + "\" not found";
+ + "\" for the carrier technology \"" + technologyParameters.getLabel()
+ + "\", specified event consumer plugin class \"" + consumerPluginClass + "\" not found";
LOGGER.error(errorMessage, e);
throw new ApexEventException(errorMessage, e);
}
@@ -66,9 +66,9 @@ public class EventConsumerFactory {
// Check the class is an event consumer
if (!(consumerPluginObject instanceof ApexEventConsumer)) {
final String errorMessage = "could not create an Apex event consumer \"" + name
- + "\" for the carrier technology \"" + technologyParameters.getLabel()
- + "\", specified event consumer plugin class \"" + consumerPluginClass
- + "\" is not an instance of \"" + ApexEventConsumer.class.getCanonicalName() + "\"";
+ + "\" for the carrier technology \"" + technologyParameters.getLabel()
+ + "\", specified event consumer plugin class \"" + consumerPluginClass
+ + "\" is not an instance of \"" + ApexEventConsumer.class.getName() + "\"";
LOGGER.error(errorMessage);
throw new ApexEventException(errorMessage);
}
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/EventProducerFactory.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/EventProducerFactory.java
index 727f77995..349a6e38f 100644
--- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/EventProducerFactory.java
+++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/EventProducerFactory.java
@@ -1,19 +1,20 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* 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=========================================================
*/
@@ -45,7 +46,7 @@ public class EventProducerFactory {
* @throws ApexEventException on errors creating the Apex event producer
*/
public ApexEventProducer createProducer(final String name, final EventHandlerParameters producerParameters)
- throws ApexEventException {
+ throws ApexEventException {
// Get the carrier technology parameters
final CarrierTechnologyParameters technologyParameters = producerParameters.getCarrierTechnologyParameters();
@@ -56,8 +57,8 @@ public class EventProducerFactory {
producerPluginObject = Class.forName(producerPluginClass).newInstance();
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
final String errorMessage = "could not create an Apex event producer for Producer \"" + name
- + "\" for the carrier technology \"" + technologyParameters.getLabel()
- + "\", specified event producer plugin class \"" + producerPluginClass + "\" not found";
+ + "\" for the carrier technology \"" + technologyParameters.getLabel()
+ + "\", specified event producer plugin class \"" + producerPluginClass + "\" not found";
LOGGER.error(errorMessage, e);
throw new ApexEventException(errorMessage, e);
}
@@ -65,9 +66,9 @@ public class EventProducerFactory {
// Check the class is an event producer
if (!(producerPluginObject instanceof ApexEventProducer)) {
final String errorMessage = "could not create an Apex event producer for Producer \"" + name
- + "\" for the carrier technology \"" + technologyParameters.getLabel()
- + "\", specified event producer plugin class \"" + producerPluginClass
- + "\" is not an instance of \"" + ApexEventProducer.class.getCanonicalName() + "\"";
+ + "\" for the carrier technology \"" + technologyParameters.getLabel()
+ + "\", specified event producer plugin class \"" + producerPluginClass
+ + "\" is not an instance of \"" + ApexEventProducer.class.getName() + "\"";
LOGGER.error(errorMessage);
throw new ApexEventException(errorMessage);
}
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/EventProtocolFactory.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/EventProtocolFactory.java
index 85c5bf03f..b2a6f4754 100644
--- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/EventProtocolFactory.java
+++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/EventProtocolFactory.java
@@ -1,19 +1,20 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* 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=========================================================
*/
@@ -27,8 +28,8 @@ import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
/**
- * This factory class uses the Apex event protocol parameters to create and return an instance of
- * the correct Apex event protocol converter plugin for the specified event protocol.
+ * This factory class uses the Apex event protocol parameters to create and return an instance of the correct Apex event
+ * protocol converter plugin for the specified event protocol.
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
@@ -37,16 +38,15 @@ public class EventProtocolFactory {
private static final XLogger LOGGER = XLoggerFactory.getXLogger(EventProtocolFactory.class);
/**
- * Create an event converter that converts between an
- * {@link org.onap.policy.apex.service.engine.event.ApexEvent} and the specified event protocol.
+ * Create an event converter that converts between an {@link org.onap.policy.apex.service.engine.event.ApexEvent}
+ * and the specified event protocol.
*
* @param name the name of the event protocol
- * @param eventProtocolParameters the event protocol parameters defining what to convert from
- * and to
+ * @param eventProtocolParameters the event protocol parameters defining what to convert from and to
* @return The event converter for converting events to and from Apex format
*/
public ApexEventProtocolConverter createConverter(final String name,
- final EventProtocolParameters eventProtocolParameters) {
+ final EventProtocolParameters eventProtocolParameters) {
// Get the class for the event protocol plugin using reflection
final String eventProtocolPluginClass = eventProtocolParameters.getEventProtocolPluginClass();
Object eventProtocolPluginObject = null;
@@ -54,9 +54,9 @@ public class EventProtocolFactory {
eventProtocolPluginObject = Class.forName(eventProtocolPluginClass).newInstance();
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
final String errorMessage = "could not create an Apex event protocol converter for \"" + name
- + "\" for the protocol \"" + eventProtocolParameters.getLabel()
- + "\", specified event protocol converter plugin class \"" + eventProtocolPluginClass
- + "\" not found";
+ + "\" for the protocol \"" + eventProtocolParameters.getLabel()
+ + "\", specified event protocol converter plugin class \"" + eventProtocolPluginClass
+ + "\" not found";
LOGGER.error(errorMessage, e);
throw new ApexEventRuntimeException(errorMessage, e);
}
@@ -64,9 +64,9 @@ public class EventProtocolFactory {
// Check the class is an event consumer
if (!(eventProtocolPluginObject instanceof ApexEventProtocolConverter)) {
final String errorMessage = "could not create an Apex event protocol converter for \"" + name
- + "\" for the protocol \"" + eventProtocolParameters.getLabel()
- + "\", specified event protocol converter plugin class \"" + eventProtocolPluginClass
- + "\" is not an instance of \"" + ApexEventProtocolConverter.class.getCanonicalName() + "\"";
+ + "\" for the protocol \"" + eventProtocolParameters.getLabel()
+ + "\", specified event protocol converter plugin class \"" + eventProtocolPluginClass
+ + "\" is not an instance of \"" + ApexEventProtocolConverter.class.getName() + "\"";
LOGGER.error(errorMessage);
throw new ApexEventRuntimeException(errorMessage);
}
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/jsonprotocolplugin/Apex2JsonEventConverter.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/jsonprotocolplugin/Apex2JsonEventConverter.java
index b1c62b298..ad0508078 100644
--- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/jsonprotocolplugin/Apex2JsonEventConverter.java
+++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/jsonprotocolplugin/Apex2JsonEventConverter.java
@@ -1,19 +1,20 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* 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=========================================================
*/
@@ -124,7 +125,7 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter {
/**
* Decode a list of Apex events.
- *
+ *
* @param eventName the name of the incoming events
* @param jsonEventString the JSON representation of the event list
* @param decodedJsonObject The JSON list object
@@ -176,9 +177,8 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter {
}
/**
- /**
* Serialise an Apex event to a JSON string field by field.
- *
+ *
* @param apexEvent the event to Serialise
* @return the Serialise event as JSON
* @throws ApexEventException exceptions on marshaling to JSON
@@ -207,8 +207,8 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter {
if (!apexEvent.containsKey(fieldName)) {
if (!eventField.getOptional()) {
- final String errorMessage = ERROR_CODING + eventDefinition.getId() + " event to Json. "
- + "Field \"" + fieldName + "\" is missing, but is mandatory. Fields: " + apexEvent;
+ final String errorMessage = ERROR_CODING + eventDefinition.getId() + " event to Json. " + "Field \""
+ + fieldName + "\" is missing, but is mandatory. Fields: " + apexEvent;
LOGGER.debug(errorMessage);
throw new ApexEventRuntimeException(errorMessage);
}
@@ -229,7 +229,7 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter {
/**
* Serialise an Apex event to a JSON string as a single POJO.
- *
+ *
* @param apexEvent the event to Serialise
* @return the Serialise event as JSON
* @throws ApexEventException exceptions on marshaling to JSON
@@ -268,7 +268,7 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter {
// Get the schema helper
final SchemaHelper fieldSchemaHelper = new SchemaHelperFactory()
.createSchemaHelper(pojoFieldDefinition.getKey(), pojoFieldDefinition.getSchema());
-
+
return fieldSchemaHelper.marshal2String(fieldValue);
}
@@ -322,7 +322,7 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter {
/**
* Decode an Apex event field by field.
- *
+ *
* @param jsonObject the JSON representation of the event
* @param apexEvent the incoming event header
* @param eventDefinition the definition of the event from the model
@@ -358,7 +358,7 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter {
/**
* Decode an Apex event as a single POJO.
- *
+ *
* @param jsonObject the JSON representation of the event
* @param apexEvent the incoming event header
* @param eventDefinition the definition of the event from the model
@@ -439,7 +439,7 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter {
/**
* Determine the name field of the event header.
- *
+ *
* @param jsonObject the event in JSON format
* @param parameterEventName the configured event name from the parameters
* @return the event name to use on the event header
@@ -468,7 +468,7 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter {
/**
* Determine the version field of the event header.
- *
+ *
* @param jsonObject the event in JSON format
* @return the event version
*/
@@ -481,7 +481,7 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter {
/**
* Determine the name space field of the event header.
- *
+ *
* @param jsonObject the event in JSON format
* @param eventName the name of the event
* @param eventDefinition the definition of the event structure
@@ -505,7 +505,7 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter {
/**
* Determine the source field of the event header.
- *
+ *
* @param jsonObject the event in JSON format
* @param eventDefinition the definition of the event structure
* @return the event version
@@ -522,7 +522,7 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter {
/**
* Determine the target field of the event header.
- *
+ *
* @param jsonObject the event in JSON format
* @param eventDefinition the definition of the event structure
* @return the event version
@@ -565,7 +565,7 @@ public class Apex2JsonEventConverter implements ApexEventProtocolConverter {
} catch (final Exception e) {
// The element is not a string so throw an error
throw new ApexEventRuntimeException("field \"" + fieldName + "\" with type \""
- + jsonField.getClass().getCanonicalName() + "\" is not a string value", e);
+ + jsonField.getClass().getName() + "\" is not a string value", e);
}
// Is regular expression checking required
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/engineservice/EngineServiceParametersJsonAdapter.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/engineservice/EngineServiceParametersJsonAdapter.java
index 902322ca1..1b8dacad4 100644
--- a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/engineservice/EngineServiceParametersJsonAdapter.java
+++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/engineservice/EngineServiceParametersJsonAdapter.java
@@ -1,19 +1,20 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* 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=========================================================
*/
@@ -266,8 +267,8 @@ public class EngineServiceParametersJsonAdapter
parameters = context.deserialize(parametersObject, Class.forName(parameterClassName));
} catch (JsonParseException | ClassNotFoundException e) {
final String returnMessage = "failed to deserialize the parameters for \"" + parametersLabel + "\" "
- + "to parameter class \"" + parameterClassName + "\"\n" + e.getClass().getCanonicalName()
- + ": " + e.getMessage();
+ + "to parameter class \"" + parameterClassName + "\"\n" + e.getClass().getName() + ": "
+ + e.getMessage();
LOGGER.error(returnMessage, e);
throw new ParameterRuntimeException(returnMessage, e);
}
diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperEventProducer.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperEventProducer.java
index a188901f3..a87f94201 100644
--- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperEventProducer.java
+++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperEventProducer.java
@@ -80,7 +80,7 @@ public class SuperDooperEventProducer implements ApexEventProducer {
@Override
public void sendEvent(final long executionId, final Properties executionProperties, final String eventName,
final Object event) {
- LOGGER.info("Sending Event: " + this.getClass().getCanonicalName() + ":" + this.name + " ... event ("
+ LOGGER.info("Sending Event: " + this.getClass().getName() + ":" + this.name + " ... event ("
+ eventName + ") : " + event);
}
diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperEventSubscriber.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperEventSubscriber.java
index 6c5d55183..c945480d4 100644
--- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperEventSubscriber.java
+++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperEventSubscriber.java
@@ -1,19 +1,20 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* 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=========================================================
*/
@@ -35,13 +36,14 @@ public class SuperDooperEventSubscriber implements ApexEventConsumer {
private String name;
- public SuperDooperEventSubscriber() {}
+ public SuperDooperEventSubscriber() {
+ }
@Override
public void init(final String name, final EventHandlerParameters consumerParameters,
- final ApexEventReceiver apexEventReceiver) throws ApexEventException {
+ final ApexEventReceiver apexEventReceiver) throws ApexEventException {
this.name = name;
- LOGGER.info("Initialising Apex Consumer: " + this.getClass().getCanonicalName() + ":" + this.name);
+ LOGGER.info("Initialising Apex Consumer: " + this.getClass().getName() + ":" + this.name);
}
@Override
@@ -61,7 +63,8 @@ public class SuperDooperEventSubscriber implements ApexEventConsumer {
* {@inheritDoc}.
*/
@Override
- public void setPeeredReference(final EventHandlerPeeredMode peeredMode, final PeeredReference peeredReference) {}
+ public void setPeeredReference(final EventHandlerPeeredMode peeredMode, final PeeredReference peeredReference) {
+ }
@Override
public void start() {
@@ -70,6 +73,7 @@ public class SuperDooperEventSubscriber implements ApexEventConsumer {
}
@Override
- public void stop() {}
+ public void stop() {
+ }
}