diff options
author | liamfallon <liam.fallon@est.tech> | 2019-11-27 13:32:45 +0000 |
---|---|---|
committer | liamfallon <liam.fallon@est.tech> | 2019-11-28 11:06:05 +0000 |
commit | 9253f81d14a5217479ca8e59efb198eaa32ec9f0 (patch) | |
tree | 4b4c5d42738928e9ade09e57d1b4cc01cdc7ae75 /services/services-engine/src/main/java | |
parent | 8a3a78067eb678f3e51e2199a57b713e3ffcfb29 (diff) |
Replace getCaononicalName() with getName() in code base
Issue-ID: POLICY-1861
Change-Id: Iccbdcbc5b5978305c56ab74c01a52a562697bee1
Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'services/services-engine/src/main/java')
5 files changed, 61 insertions, 59 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); } |