aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/be/config/BeEcompErrorManager.java827
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/be/config/CleanComponentsConfiguration.java32
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/be/config/Configuration.java184
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/be/config/ConfigurationManager.java167
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/be/config/DistributionEngineConfiguration.java650
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/be/config/DmaapConsumerConfiguration.java547
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/be/config/DmeConfiguration.java50
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/be/config/ErrorConfiguration.java52
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/be/config/ErrorInfo.java146
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/be/config/Neo4jErrorsConfiguration.java32
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/be/config/validation/DeploymentArtifactHeatConfiguration.java39
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/be/monitoring/BeMonitoringService.java106
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/api/ApplicationErrorCodesEnum.java22
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/api/ArtifactGroupTypeEnum.java68
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/api/ArtifactTypeEnum.java85
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/api/BasicConfiguration.java4
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/api/ConfigurationListener.java42
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/api/ConfigurationSource.java8
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/api/Constants.java241
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/api/FileChangeCallback.java6
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/api/HealthCheckInfo.java174
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/api/HealthCheckWrapper.java58
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/api/ResourceType.java6
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/api/ResponseInfo.java114
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/api/ToscaNodeTypeInfo.java106
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/api/ToscaNodeTypeInterface.java18
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/api/UploadArtifactInfo.java250
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/api/UserRoleEnum.java20
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/api/YamlConstants.java12
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/api/YamlSuffixEnum.java46
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/config/AbsEcompErrorManager.java14
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompClassification.java26
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorCode.java264
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorConfiguration.java264
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorEnum.java932
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorInfo.java88
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorLogUtil.java238
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorName.java38
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/config/IEcompConfigurationManager.java6
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/config/generation/GenerateEcompErrorsCsv.java288
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/datastructure/AuditingFieldsKey.java154
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/datastructure/ESTimeBasedEvent.java182
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/datastructure/FunctionalInterfaces.java862
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/datastructure/MonitoringFieldsKeysEnum.java66
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/datastructure/Wrapper.java41
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/ComparableHttpRequestRetryHandler.java7
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/HttpClient.java71
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/HttpClientConfigImmutable.java58
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/HttpClientFactory.java26
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/HttpConnectionMngFactory.java47
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/HttpExecuteException.java10
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/HttpRequest.java69
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/HttpRequestHandler.java32
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/HttpResponse.java10
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/Responses.java6
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/RestUtils.java4
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/RetryHandlers.java13
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/http/config/BasicAuthorization.java42
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/http/config/ClientCertificate.java50
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/http/config/ExternalServiceConfig.java8
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/http/config/HttpClientConfig.java14
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/http/config/HttpRequestConfig.java14
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/http/config/Timeouts.java59
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/impl/ConfigFileChangeListener.java152
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/impl/ExternalConfiguration.java145
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/impl/FSConfigurationSource.java127
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/impl/MutableHttpServletRequest.java75
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/jsongraph/util/CommonUtility.java106
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/kpi/api/ASDCKpiApi.java60
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/listener/AppContextListener.java120
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/log/api/ILogConfiguration.java4
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/log/api/ILogFieldsHandler.java4
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/log/api/ILogger.java12
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/log/elements/LogFieldsMdcHandler.java34
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/log/elements/LoggerAudit.java9
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/log/elements/LoggerBase.java21
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/log/elements/LoggerDebug.java10
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/log/elements/LoggerError.java15
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/log/elements/LoggerFactory.java4
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/log/elements/LoggerMetric.java33
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/log/enums/EcompLoggerErrorCode.java9
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/log/enums/LogLevel.java4
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/log/enums/LogMarkers.java8
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/log/enums/Severity.java6
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/log/enums/StatusCode.java12
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/log/wrappers/Logger.java135
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/log/wrappers/LoggerSdcAudit.java22
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/log/wrappers/LoggerSdcUtilBase.java48
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/monitoring/MonitoringEvent.java198
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/monitoring/MonitoringMetricsFetcher.java345
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/rest/api/RestConfigurationInfo.java160
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/rest/impl/validator/RequestHeadersValidator.java102
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/rest/impl/validator/RestRequestValidationException.java18
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/servlets/BasicServlet.java8
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/test/BaseConfDependent.java43
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/util/CapabilityTypeNameEnum.java42
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/util/GeneralUtility.java263
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/util/GsonFactory.java26
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/util/HealthCheckUtil.java5
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/util/HtmlCleaner.java108
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/util/HttpUtil.java88
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/util/JsonUtils.java56
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/util/MethodActivationStatusEnum.java6
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/util/PairUtils.java4
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/util/SerializationUtils.java87
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/util/StreamUtils.java175
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/util/ThreadLocalsHolder.java75
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/util/ValidationUtils.java1019
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/util/YamlToObjectConverter.java448
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/util/ZipUtil.java179
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/exception/AbstractSdncException.java168
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/exception/DeleteLastApplicationEnvironmentException.java18
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/exception/DeleteReferencedObjectException.java12
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/exception/FunctionalException.java21
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/exception/IndexingServiceException.java20
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/exception/InvalidArgumentException.java18
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/exception/NotFoundException.java18
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/exception/OkResponseInfo.java10
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/exception/PolicyException.java14
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/exception/ResponseFormat.java322
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/exception/ServiceException.java14
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/exception/TechnicalException.java19
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/exception/VersionConflictException.java12
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/fe/config/Configuration.java28
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/fe/config/ConfigurationManager.java142
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/fe/config/Connection.java40
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/fe/config/FeEcompErrorManager.java76
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/fe/config/PluginsConfiguration.java16
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/fe/monitoring/FeMonitoringService.java105
-rw-r--r--common-app-api/src/test/java/org/openecomp/sdc/be/config/ConfigurationManagerTest.java9
130 files changed, 6990 insertions, 6837 deletions
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/be/config/BeEcompErrorManager.java b/common-app-api/src/main/java/org/openecomp/sdc/be/config/BeEcompErrorManager.java
index bf6a022464..0a3d50f848 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/be/config/BeEcompErrorManager.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/be/config/BeEcompErrorManager.java
@@ -7,9 +7,9 @@
* 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.
@@ -26,416 +26,417 @@ import org.openecomp.sdc.common.config.IEcompConfigurationManager;
public class BeEcompErrorManager extends AbsEcompErrorManager {
- public enum ComponentName {
- SERVICE, PRODUCT, VF
- }
-
- public enum ErrorSeverity {
- INFO, WARNING, ERROR, FATAL
- }
-
- private static volatile BeEcompErrorManager instance;
- private static ConfigurationManager configurationManager;
-
- private BeEcompErrorManager() {
- };
-
- public static BeEcompErrorManager getInstance() {
- if (instance == null) {
- synchronized (BeEcompErrorManager.class){
- if (instance == null)
- instance = init();
- }
- }
- return instance;
- }
-
- private static synchronized BeEcompErrorManager init() {
- if (instance == null) {
- instance = new BeEcompErrorManager();
- configurationManager = ConfigurationManager.getConfigurationManager();
- }
- return instance;
- }
-
- @Override
- public IEcompConfigurationManager getConfigurationManager() {
- return configurationManager;
- }
-
- public void logBeUebAuthenticationError(String context, String reason) {
- processEcompError(context, EcompErrorEnum.BeUebAuthenticationError, reason);
- }
-
- public void logBeHealthCheckRecovery(String context) {
- processEcompError(context, EcompErrorEnum.BeHealthCheckRecovery);
- }
-
- public void logBeHealthCheckJanusGraphRecovery(String context) {
- processEcompError(context, EcompErrorEnum.BeHealthCheckJanusGraphRecovery);
- }
-
- public void logBeHealthCheckElasticSearchRecovery(String context) {
- processEcompError(context, EcompErrorEnum.BeHealthCheckElasticSearchRecovery);
- }
-
- public void logBeHealthCheckUebClusterRecovery(String context) {
- processEcompError(context, EcompErrorEnum.BeHealthCheckUebClusterRecovery);
- }
-
- public void logDmaapHealthCheckError(String context) {
- processEcompError(context, EcompErrorEnum.DmaapHealthCheckError);
- }
-
- public void logDmaapHealthCheckRecovery(String context) {
- processEcompError(context, EcompErrorEnum.DmaapHealthCheckRecovery);
- }
-
- public void logFeHealthCheckRecovery(String context) {
- processEcompError(context, EcompErrorEnum.FeHealthCheckRecovery);
- }
-
- public void logBeHealthCheckError(String context) {
- processEcompError(context, EcompErrorEnum.BeHealthCheckError);
- }
-
- public void logBeHealthCheckJanusGraphError(String context) {
- processEcompError(context, EcompErrorEnum.BeHealthCheckJanusGraphError);
- }
-
- public void logBeHealthCheckElasticSearchError(String context) {
- processEcompError(context, EcompErrorEnum.BeHealthCheckElasticSearchError);
- }
-
- public void logBeHealthCheckUebClusterError(String context) {
- processEcompError(context, EcompErrorEnum.BeHealthCheckUebClusterError);
- }
-
- public void logFeHealthCheckError(String context) {
- processEcompError(context, EcompErrorEnum.FeHealthCheckError);
- }
-
- /**
- * @param context
- * @param reason
- */
- public void logBeUebConnectionError(String context, String reason) {
- processEcompError(context, EcompErrorEnum.BeUebConnectionError, reason);
- }
-
- public void logBeUebUnkownHostError(String context, String host) {
- processEcompError(context, EcompErrorEnum.BeUebUnkownHostError, host);
- }
-
- public void logBeComponentMissingError(String context, String componentType, String name) {
- processEcompError(context, EcompErrorEnum.BeComponentMissingError, componentType, name);
- }
-
- public void logBeIncorrectComponentError(String context, String componentType, String name) {
- processEcompError(context, EcompErrorEnum.BeIncorrectComponentError, componentType, name);
- }
-
- public void logBeInvalidConfigurationError(String context, String parameterName, String parameterValue) {
- processEcompError(context, EcompErrorEnum.BeInvalidConfigurationError, parameterName, parameterValue);
- }
-
- public void logBeUebObjectNotFoundError(String context, String notFoundObjectName) {
- processEcompError(context, EcompErrorEnum.BeUebObjectNotFoundError, notFoundObjectName);
- }
-
- public void logBeDistributionEngineInvalidArtifactType(String context, String artifactType,
- String validArtifactTypes) {
- processEcompError(context, EcompErrorEnum.BeDistributionEngineInvalidArtifactType, artifactType,
- validArtifactTypes);
- }
-
- public void logBeMissingConfigurationError(String context, String parameterName) {
- processEcompError(context, EcompErrorEnum.BeMissingConfigurationError, parameterName);
- }
-
- public void logBeConfigurationInvalidListSizeError(String context, String parameterName, int listMinimumSize) {
- processEcompError(context, EcompErrorEnum.BeConfigurationInvalidListSizeError, parameterName,
- String.valueOf(listMinimumSize));
- }
-
- public void logErrorConfigFileFormat(String context, String description) {
- processEcompError(context, EcompErrorEnum.ErrorConfigFileFormat, description);
- }
-
- public void logBeMissingArtifactInformationError(String context, String missingInfo) {
- processEcompError(context, EcompErrorEnum.BeMissingArtifactInformationError, missingInfo);
- }
-
- public void logBeArtifactMissingError(String context, String artifactName) {
- processEcompError(context, EcompErrorEnum.BeArtifactMissingError, artifactName);
- }
-
- public void logBeUserMissingError(String context, String userId) {
- processEcompError(context, EcompErrorEnum.BeUserMissingError, userId);
- }
-
- public void logBeInvalidTypeError(String context, String type, String name) {
- processEcompError(context, EcompErrorEnum.BeInvalidTypeError, type, name);
- }
-
- public void logBeInvalidValueError(String context, String value, String name, String type) {
- processEcompError(context, EcompErrorEnum.BeInvalidValueError, value, name, type);
- }
-
- public void logBeArtifactPayloadInvalid(String context) {
- processEcompError(context, EcompErrorEnum.BeArtifactPayloadInvalid);
- }
-
- public void logBeArtifactInformationInvalidError(String context) {
- processEcompError(context, EcompErrorEnum.BeArtifactInformationInvalidError);
- }
-
- public void logBeDistributionMissingError(String context, String distributionName) {
- processEcompError(context, EcompErrorEnum.BeDistributionMissingError, "Distribution", distributionName);
- }
-
- public void logBeGraphObjectMissingError(String context, String objectType, String objectName) {
- processEcompError(context, EcompErrorEnum.BeGraphObjectMissingError, objectType, objectName);
- }
-
- public void logBeInvalidJsonInput(String context) {
- processEcompError(context, EcompErrorEnum.BeInvalidJsonInput);
- }
-
- public void logBeInitializationError(String context) {
- processEcompError(context, EcompErrorEnum.BeInitializationError);
- }
-
- public void logBeFailedAddingResourceInstanceError(String context, String resourceName, String serviceId) {
- processEcompError(context, EcompErrorEnum.BeFailedAddingResourceInstanceError, resourceName, serviceId);
- }
-
- public void logBeUebSystemError(String context, String operation) {
- processEcompError(context, EcompErrorEnum.BeUebSystemError, operation);
- }
-
- public void logBeDistributionEngineSystemError(String context, String operation) {
- processEcompError(context, EcompErrorEnum.BeDistributionEngineSystemError, operation);
- }
-
- public void logBeFailedAddingNodeTypeError(String context, String nodeType) {
- processEcompError(context, EcompErrorEnum.BeFailedAddingNodeTypeError, nodeType);
- }
-
- public void logBeDaoSystemError(String context) {
- processEcompError(context, EcompErrorEnum.BeDaoSystemError);
- }
-
- public void logBeSystemError(String context) {
- processEcompError(context, EcompErrorEnum.BeSystemError);
- }
-
- public void logBeExecuteRollbackError(String context) {
- processEcompError(context, EcompErrorEnum.BeExecuteRollbackError);
- }
-
- public void logBeFailedLockObjectError(String context, String type, String id) {
- processEcompError(context, EcompErrorEnum.BeFailedLockObjectError, type, id);
- }
-
- public void logBeFailedCreateNodeError(String context, String nodeName, String status) {
- processEcompError(context, EcompErrorEnum.BeFailedCreateNodeError, nodeName, status);
- }
-
- public void logBeFailedUpdateNodeError(String context, String nodeName, String status) {
- processEcompError(context, EcompErrorEnum.BeFailedUpdateNodeError, nodeName, status);
- }
-
- public void logBeFailedDeleteNodeError(String context, String nodeName, String status) {
- processEcompError(context, EcompErrorEnum.BeFailedDeleteNodeError, nodeName, status);
- }
-
- public void logBeFailedRetrieveNodeError(String context, String nodeName, String status) {
- processEcompError(context, EcompErrorEnum.BeFailedRetrieveNodeError, nodeName, status);
- }
-
- public void logBeFailedFindParentError(String context, String node, String status) {
- processEcompError(context, EcompErrorEnum.BeFailedFindParentError, node, status);
- }
-
- public void logBeFailedFindAllNodesError(String context, String nodeType, String parentNode, String status) {
- processEcompError(context, EcompErrorEnum.BeFailedFindAllNodesError, nodeType, parentNode, status);
- }
-
- public void logBeFailedFindAssociationError(String context, String nodeType, String fromNode, String status) {
- processEcompError(context, EcompErrorEnum.BeFailedFindAssociationError, nodeType, fromNode, status);
- }
-
- public void logBeComponentCleanerSystemError(String context, String operation) {
- processEcompError(context, EcompErrorEnum.BeComponentCleanerSystemError, operation);
- }
-
- public void logBeRestApiGeneralError(String context) {
- processEcompError(context, EcompErrorEnum.BeRestApiGeneralError);
- }
-
- public void logFqdnResolveError(String context, String description) {
- processEcompError(context, EcompErrorEnum.FqdnResolveError, description);
- }
-
- public void logSiteSwitchoverInfo(String context, String description) {
- processEcompError(context, EcompErrorEnum.SiteSwitchoverInfo, description);
- }
-
- public void logInternalAuthenticationError(String context, String description, ErrorSeverity severity) {
-
- if (severity == null) {
- processEcompError(context, EcompErrorEnum.InternalAuthenticationError, description);
- } else {
- switch (severity) {
- case INFO:
- processEcompError(context, EcompErrorEnum.InternalAuthenticationInfo, description);
- break;
- case WARNING:
- processEcompError(context, EcompErrorEnum.InternalAuthenticationWarning, description);
- break;
- case ERROR:
- processEcompError(context, EcompErrorEnum.InternalAuthenticationError, description);
- break;
- case FATAL:
- processEcompError(context, EcompErrorEnum.InternalAuthenticationFatal, description);
- break;
-
- default:
- break;
- }
- }
-
- }
-
- public void logInternalConnectionError(String context, String description, ErrorSeverity severity) {
-
- if (severity == null) {
- processEcompError(context, EcompErrorEnum.InternalConnectionError, description);
- } else {
- switch (severity) {
- case INFO:
- processEcompError(context, EcompErrorEnum.InternalConnectionInfo, description);
- break;
- case WARNING:
- processEcompError(context, EcompErrorEnum.InternalConnectionWarning, description);
- break;
- case ERROR:
- processEcompError(context, EcompErrorEnum.InternalConnectionError, description);
- break;
- case FATAL:
- processEcompError(context, EcompErrorEnum.InternalConnectionFatal, description);
- break;
-
- default:
- break;
- }
- }
-
- }
-
- public void logInternalDataError(String context, String description, ErrorSeverity severity) {
-
- if (severity == null) {
- processEcompError(context, EcompErrorEnum.InternalDataError, description);
- } else {
- switch (severity) {
- case INFO:
- processEcompError(context, EcompErrorEnum.InternalDataInfo, description);
- break;
- case WARNING:
- processEcompError(context, EcompErrorEnum.InternalDataWarning, description);
- break;
- case ERROR:
- processEcompError(context, EcompErrorEnum.InternalDataError, description);
- break;
- case FATAL:
- processEcompError(context, EcompErrorEnum.InternalDataFatal, description);
- break;
-
- default:
- break;
- }
- }
-
- }
-
- public void logInvalidInputError(String context, String description, ErrorSeverity severity) {
-
- if (severity == null) {
- processEcompError(context, EcompErrorEnum.InvalidInputError, description);
- } else {
- switch (severity) {
- case INFO:
- processEcompError(context, EcompErrorEnum.InvalidInputWarning, description);
- break;
- case WARNING:
- processEcompError(context, EcompErrorEnum.InvalidInputInfo, description);
- break;
- case ERROR:
- processEcompError(context, EcompErrorEnum.InvalidInputError, description);
- break;
- case FATAL:
- processEcompError(context, EcompErrorEnum.InvalidInputFatal, description);
- break;
-
- default:
- break;
- }
- }
-
- }
-
- public void logInternalFlowError(String context, String description, ErrorSeverity severity) {
-
- if (severity == null) {
- processEcompError(context, EcompErrorEnum.InternalFlowError, description);
- } else {
- switch (severity) {
- case INFO:
- processEcompError(context, EcompErrorEnum.InternalFlowInfo, description);
- break;
- case WARNING:
- processEcompError(context, EcompErrorEnum.InternalFlowWarning, description);
- break;
- case ERROR:
- processEcompError(context, EcompErrorEnum.InternalFlowError, description);
- break;
- case FATAL:
- processEcompError(context, EcompErrorEnum.InternalFlowFatal, description);
- break;
-
- default:
- break;
- }
- }
-
- }
-
- public void logInternalUnexpectedError(String context, String description, ErrorSeverity severity) {
-
- if (severity == null) {
- processEcompError(context, EcompErrorEnum.InternalUnexpectedError, description);
- } else {
- switch (severity) {
- case INFO:
- processEcompError(context, EcompErrorEnum.InternalUnexpectedInfo, description);
- break;
- case WARNING:
- processEcompError(context, EcompErrorEnum.InternalUnexpectedWarning, description);
- break;
- case ERROR:
- processEcompError(context, EcompErrorEnum.InternalUnexpectedError, description);
- break;
- case FATAL:
- processEcompError(context, EcompErrorEnum.InternalUnexpectedFatal, description);
- break;
-
- default:
- break;
- }
- }
-
- }
+ public enum ComponentName {
+ SERVICE, PRODUCT, VF
+ }
+
+ public enum ErrorSeverity {
+ INFO, WARNING, ERROR, FATAL
+ }
+
+ private static volatile BeEcompErrorManager instance;
+ private static ConfigurationManager configurationManager;
+
+ private BeEcompErrorManager() {
+ }
+
+ public static BeEcompErrorManager getInstance() {
+ if (instance == null) {
+ synchronized (BeEcompErrorManager.class) {
+ if (instance == null) {
+ instance = init();
+ }
+ }
+ }
+ return instance;
+ }
+
+ private static synchronized BeEcompErrorManager init() {
+ if (instance == null) {
+ instance = new BeEcompErrorManager();
+ configurationManager = ConfigurationManager.getConfigurationManager();
+ }
+ return instance;
+ }
+
+ @Override
+ public IEcompConfigurationManager getConfigurationManager() {
+ return configurationManager;
+ }
+
+ public void logBeUebAuthenticationError(String context, String reason) {
+ processEcompError(context, EcompErrorEnum.BeUebAuthenticationError, reason);
+ }
+
+ public void logBeHealthCheckRecovery(String context) {
+ processEcompError(context, EcompErrorEnum.BeHealthCheckRecovery);
+ }
+
+ public void logBeHealthCheckJanusGraphRecovery(String context) {
+ processEcompError(context, EcompErrorEnum.BeHealthCheckJanusGraphRecovery);
+ }
+
+ public void logBeHealthCheckElasticSearchRecovery(String context) {
+ processEcompError(context, EcompErrorEnum.BeHealthCheckElasticSearchRecovery);
+ }
+
+ public void logBeHealthCheckUebClusterRecovery(String context) {
+ processEcompError(context, EcompErrorEnum.BeHealthCheckUebClusterRecovery);
+ }
+
+ public void logDmaapHealthCheckError(String context) {
+ processEcompError(context, EcompErrorEnum.DmaapHealthCheckError);
+ }
+
+ public void logDmaapHealthCheckRecovery(String context) {
+ processEcompError(context, EcompErrorEnum.DmaapHealthCheckRecovery);
+ }
+
+ public void logFeHealthCheckRecovery(String context) {
+ processEcompError(context, EcompErrorEnum.FeHealthCheckRecovery);
+ }
+
+ public void logBeHealthCheckError(String context) {
+ processEcompError(context, EcompErrorEnum.BeHealthCheckError);
+ }
+
+ public void logBeHealthCheckJanusGraphError(String context) {
+ processEcompError(context, EcompErrorEnum.BeHealthCheckJanusGraphError);
+ }
+
+ public void logBeHealthCheckElasticSearchError(String context) {
+ processEcompError(context, EcompErrorEnum.BeHealthCheckElasticSearchError);
+ }
+
+ public void logBeHealthCheckUebClusterError(String context) {
+ processEcompError(context, EcompErrorEnum.BeHealthCheckUebClusterError);
+ }
+
+ public void logFeHealthCheckError(String context) {
+ processEcompError(context, EcompErrorEnum.FeHealthCheckError);
+ }
+
+ /**
+ * @param context
+ * @param reason
+ */
+ public void logBeUebConnectionError(String context, String reason) {
+ processEcompError(context, EcompErrorEnum.BeUebConnectionError, reason);
+ }
+
+ public void logBeUebUnkownHostError(String context, String host) {
+ processEcompError(context, EcompErrorEnum.BeUebUnkownHostError, host);
+ }
+
+ public void logBeComponentMissingError(String context, String componentType, String name) {
+ processEcompError(context, EcompErrorEnum.BeComponentMissingError, componentType, name);
+ }
+
+ public void logBeIncorrectComponentError(String context, String componentType, String name) {
+ processEcompError(context, EcompErrorEnum.BeIncorrectComponentError, componentType, name);
+ }
+
+ public void logBeInvalidConfigurationError(String context, String parameterName, String parameterValue) {
+ processEcompError(context, EcompErrorEnum.BeInvalidConfigurationError, parameterName, parameterValue);
+ }
+
+ public void logBeUebObjectNotFoundError(String context, String notFoundObjectName) {
+ processEcompError(context, EcompErrorEnum.BeUebObjectNotFoundError, notFoundObjectName);
+ }
+
+ public void logBeDistributionEngineInvalidArtifactType(String context, String artifactType,
+ String validArtifactTypes) {
+ processEcompError(context, EcompErrorEnum.BeDistributionEngineInvalidArtifactType, artifactType,
+ validArtifactTypes);
+ }
+
+ public void logBeMissingConfigurationError(String context, String parameterName) {
+ processEcompError(context, EcompErrorEnum.BeMissingConfigurationError, parameterName);
+ }
+
+ public void logBeConfigurationInvalidListSizeError(String context, String parameterName, int listMinimumSize) {
+ processEcompError(context, EcompErrorEnum.BeConfigurationInvalidListSizeError, parameterName,
+ String.valueOf(listMinimumSize));
+ }
+
+ public void logErrorConfigFileFormat(String context, String description) {
+ processEcompError(context, EcompErrorEnum.ErrorConfigFileFormat, description);
+ }
+
+ public void logBeMissingArtifactInformationError(String context, String missingInfo) {
+ processEcompError(context, EcompErrorEnum.BeMissingArtifactInformationError, missingInfo);
+ }
+
+ public void logBeArtifactMissingError(String context, String artifactName) {
+ processEcompError(context, EcompErrorEnum.BeArtifactMissingError, artifactName);
+ }
+
+ public void logBeUserMissingError(String context, String userId) {
+ processEcompError(context, EcompErrorEnum.BeUserMissingError, userId);
+ }
+
+ public void logBeInvalidTypeError(String context, String type, String name) {
+ processEcompError(context, EcompErrorEnum.BeInvalidTypeError, type, name);
+ }
+
+ public void logBeInvalidValueError(String context, String value, String name, String type) {
+ processEcompError(context, EcompErrorEnum.BeInvalidValueError, value, name, type);
+ }
+
+ public void logBeArtifactPayloadInvalid(String context) {
+ processEcompError(context, EcompErrorEnum.BeArtifactPayloadInvalid);
+ }
+
+ public void logBeArtifactInformationInvalidError(String context) {
+ processEcompError(context, EcompErrorEnum.BeArtifactInformationInvalidError);
+ }
+
+ public void logBeDistributionMissingError(String context, String distributionName) {
+ processEcompError(context, EcompErrorEnum.BeDistributionMissingError, "Distribution", distributionName);
+ }
+
+ public void logBeGraphObjectMissingError(String context, String objectType, String objectName) {
+ processEcompError(context, EcompErrorEnum.BeGraphObjectMissingError, objectType, objectName);
+ }
+
+ public void logBeInvalidJsonInput(String context) {
+ processEcompError(context, EcompErrorEnum.BeInvalidJsonInput);
+ }
+
+ public void logBeInitializationError(String context) {
+ processEcompError(context, EcompErrorEnum.BeInitializationError);
+ }
+
+ public void logBeFailedAddingResourceInstanceError(String context, String resourceName, String serviceId) {
+ processEcompError(context, EcompErrorEnum.BeFailedAddingResourceInstanceError, resourceName, serviceId);
+ }
+
+ public void logBeUebSystemError(String context, String operation) {
+ processEcompError(context, EcompErrorEnum.BeUebSystemError, operation);
+ }
+
+ public void logBeDistributionEngineSystemError(String context, String operation) {
+ processEcompError(context, EcompErrorEnum.BeDistributionEngineSystemError, operation);
+ }
+
+ public void logBeFailedAddingNodeTypeError(String context, String nodeType) {
+ processEcompError(context, EcompErrorEnum.BeFailedAddingNodeTypeError, nodeType);
+ }
+
+ public void logBeDaoSystemError(String context) {
+ processEcompError(context, EcompErrorEnum.BeDaoSystemError);
+ }
+
+ public void logBeSystemError(String context) {
+ processEcompError(context, EcompErrorEnum.BeSystemError);
+ }
+
+ public void logBeExecuteRollbackError(String context) {
+ processEcompError(context, EcompErrorEnum.BeExecuteRollbackError);
+ }
+
+ public void logBeFailedLockObjectError(String context, String type, String id) {
+ processEcompError(context, EcompErrorEnum.BeFailedLockObjectError, type, id);
+ }
+
+ public void logBeFailedCreateNodeError(String context, String nodeName, String status) {
+ processEcompError(context, EcompErrorEnum.BeFailedCreateNodeError, nodeName, status);
+ }
+
+ public void logBeFailedUpdateNodeError(String context, String nodeName, String status) {
+ processEcompError(context, EcompErrorEnum.BeFailedUpdateNodeError, nodeName, status);
+ }
+
+ public void logBeFailedDeleteNodeError(String context, String nodeName, String status) {
+ processEcompError(context, EcompErrorEnum.BeFailedDeleteNodeError, nodeName, status);
+ }
+
+ public void logBeFailedRetrieveNodeError(String context, String nodeName, String status) {
+ processEcompError(context, EcompErrorEnum.BeFailedRetrieveNodeError, nodeName, status);
+ }
+
+ public void logBeFailedFindParentError(String context, String node, String status) {
+ processEcompError(context, EcompErrorEnum.BeFailedFindParentError, node, status);
+ }
+
+ public void logBeFailedFindAllNodesError(String context, String nodeType, String parentNode, String status) {
+ processEcompError(context, EcompErrorEnum.BeFailedFindAllNodesError, nodeType, parentNode, status);
+ }
+
+ public void logBeFailedFindAssociationError(String context, String nodeType, String fromNode, String status) {
+ processEcompError(context, EcompErrorEnum.BeFailedFindAssociationError, nodeType, fromNode, status);
+ }
+
+ public void logBeComponentCleanerSystemError(String context, String operation) {
+ processEcompError(context, EcompErrorEnum.BeComponentCleanerSystemError, operation);
+ }
+
+ public void logBeRestApiGeneralError(String context) {
+ processEcompError(context, EcompErrorEnum.BeRestApiGeneralError);
+ }
+
+ public void logFqdnResolveError(String context, String description) {
+ processEcompError(context, EcompErrorEnum.FqdnResolveError, description);
+ }
+
+ public void logSiteSwitchoverInfo(String context, String description) {
+ processEcompError(context, EcompErrorEnum.SiteSwitchoverInfo, description);
+ }
+
+ public void logInternalAuthenticationError(String context, String description, ErrorSeverity severity) {
+
+ if (severity == null) {
+ processEcompError(context, EcompErrorEnum.InternalAuthenticationError, description);
+ } else {
+ switch (severity) {
+ case INFO:
+ processEcompError(context, EcompErrorEnum.InternalAuthenticationInfo, description);
+ break;
+ case WARNING:
+ processEcompError(context, EcompErrorEnum.InternalAuthenticationWarning, description);
+ break;
+ case ERROR:
+ processEcompError(context, EcompErrorEnum.InternalAuthenticationError, description);
+ break;
+ case FATAL:
+ processEcompError(context, EcompErrorEnum.InternalAuthenticationFatal, description);
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ }
+
+ public void logInternalConnectionError(String context, String description, ErrorSeverity severity) {
+
+ if (severity == null) {
+ processEcompError(context, EcompErrorEnum.InternalConnectionError, description);
+ } else {
+ switch (severity) {
+ case INFO:
+ processEcompError(context, EcompErrorEnum.InternalConnectionInfo, description);
+ break;
+ case WARNING:
+ processEcompError(context, EcompErrorEnum.InternalConnectionWarning, description);
+ break;
+ case ERROR:
+ processEcompError(context, EcompErrorEnum.InternalConnectionError, description);
+ break;
+ case FATAL:
+ processEcompError(context, EcompErrorEnum.InternalConnectionFatal, description);
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ }
+
+ public void logInternalDataError(String context, String description, ErrorSeverity severity) {
+
+ if (severity == null) {
+ processEcompError(context, EcompErrorEnum.InternalDataError, description);
+ } else {
+ switch (severity) {
+ case INFO:
+ processEcompError(context, EcompErrorEnum.InternalDataInfo, description);
+ break;
+ case WARNING:
+ processEcompError(context, EcompErrorEnum.InternalDataWarning, description);
+ break;
+ case ERROR:
+ processEcompError(context, EcompErrorEnum.InternalDataError, description);
+ break;
+ case FATAL:
+ processEcompError(context, EcompErrorEnum.InternalDataFatal, description);
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ }
+
+ public void logInvalidInputError(String context, String description, ErrorSeverity severity) {
+
+ if (severity == null) {
+ processEcompError(context, EcompErrorEnum.InvalidInputError, description);
+ } else {
+ switch (severity) {
+ case INFO:
+ processEcompError(context, EcompErrorEnum.InvalidInputWarning, description);
+ break;
+ case WARNING:
+ processEcompError(context, EcompErrorEnum.InvalidInputInfo, description);
+ break;
+ case ERROR:
+ processEcompError(context, EcompErrorEnum.InvalidInputError, description);
+ break;
+ case FATAL:
+ processEcompError(context, EcompErrorEnum.InvalidInputFatal, description);
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ }
+
+ public void logInternalFlowError(String context, String description, ErrorSeverity severity) {
+
+ if (severity == null) {
+ processEcompError(context, EcompErrorEnum.InternalFlowError, description);
+ } else {
+ switch (severity) {
+ case INFO:
+ processEcompError(context, EcompErrorEnum.InternalFlowInfo, description);
+ break;
+ case WARNING:
+ processEcompError(context, EcompErrorEnum.InternalFlowWarning, description);
+ break;
+ case ERROR:
+ processEcompError(context, EcompErrorEnum.InternalFlowError, description);
+ break;
+ case FATAL:
+ processEcompError(context, EcompErrorEnum.InternalFlowFatal, description);
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ }
+
+ public void logInternalUnexpectedError(String context, String description, ErrorSeverity severity) {
+
+ if (severity == null) {
+ processEcompError(context, EcompErrorEnum.InternalUnexpectedError, description);
+ } else {
+ switch (severity) {
+ case INFO:
+ processEcompError(context, EcompErrorEnum.InternalUnexpectedInfo, description);
+ break;
+ case WARNING:
+ processEcompError(context, EcompErrorEnum.InternalUnexpectedWarning, description);
+ break;
+ case ERROR:
+ processEcompError(context, EcompErrorEnum.InternalUnexpectedError, description);
+ break;
+ case FATAL:
+ processEcompError(context, EcompErrorEnum.InternalUnexpectedFatal, description);
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/be/config/CleanComponentsConfiguration.java b/common-app-api/src/main/java/org/openecomp/sdc/be/config/CleanComponentsConfiguration.java
index 6411005449..dd0c6d0235 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/be/config/CleanComponentsConfiguration.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/be/config/CleanComponentsConfiguration.java
@@ -7,9 +7,9 @@
* 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.
@@ -24,23 +24,23 @@ import java.util.List;
public class CleanComponentsConfiguration {
- private long cleanIntervalInMinutes;
- private List<String> componentsToClean;
+ private long cleanIntervalInMinutes;
+ private List<String> componentsToClean;
- public long getCleanIntervalInMinutes() {
- return cleanIntervalInMinutes;
- }
+ public long getCleanIntervalInMinutes() {
+ return cleanIntervalInMinutes;
+ }
- public void setCleanIntervalInMinutes(long cleanIntervalInMinutes) {
- this.cleanIntervalInMinutes = cleanIntervalInMinutes;
- }
+ public void setCleanIntervalInMinutes(long cleanIntervalInMinutes) {
+ this.cleanIntervalInMinutes = cleanIntervalInMinutes;
+ }
- public List<String> getComponentsToClean() {
- return componentsToClean;
- }
+ public List<String> getComponentsToClean() {
+ return componentsToClean;
+ }
- public void setComponentsToClean(List<String> componentsToClean) {
- this.componentsToClean = componentsToClean;
- }
+ public void setComponentsToClean(List<String> componentsToClean) {
+ this.componentsToClean = componentsToClean;
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/be/config/Configuration.java b/common-app-api/src/main/java/org/openecomp/sdc/be/config/Configuration.java
index 05e705ce14..a51b42fb24 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/be/config/Configuration.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/be/config/Configuration.java
@@ -7,9 +7,9 @@
* 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.
@@ -155,8 +155,8 @@ public class Configuration extends BasicConfiguration {
private Map<String, List<String>> resourcesForUpgrade;
private DmaapConsumerConfiguration dmaapConsumerConfiguration;
- private boolean skipUpgradeFailedVfs;
- private boolean skipUpgradeVSPs;
+ private boolean skipUpgradeFailedVfs;
+ private boolean skipUpgradeVSPs;
private DmeConfiguration dmeConfiguration;
private boolean supportAllottedResourcesAndProxy;
@@ -202,9 +202,14 @@ public class Configuration extends BasicConfiguration {
public void setDmeConfiguration(DmeConfiguration dmeConfiguration) {
this.dmeConfiguration = dmeConfiguration;
}
- public void setSkipUpgradeVSPs(boolean skipUpgradeVSPs) { this.skipUpgradeVSPs = skipUpgradeVSPs; }
- public boolean getSkipUpgradeVSPsFlag() { return skipUpgradeVSPs; }
+ public void setSkipUpgradeVSPs(boolean skipUpgradeVSPs) {
+ this.skipUpgradeVSPs = skipUpgradeVSPs;
+ }
+
+ public boolean getSkipUpgradeVSPsFlag() {
+ return skipUpgradeVSPs;
+ }
public boolean getSkipUpgradeFailedVfs() {
return skipUpgradeFailedVfs;
@@ -629,7 +634,7 @@ public class Configuration extends BasicConfiguration {
public static class ElasticSearchConfig {
- List<IndicesTimeFrequencyEntry> indicesTimeFrequency;
+ private List<IndicesTimeFrequencyEntry> indicesTimeFrequency;
public List<IndicesTimeFrequencyEntry> getIndicesTimeFrequency() {
return indicesTimeFrequency;
@@ -641,8 +646,8 @@ public class Configuration extends BasicConfiguration {
public static class IndicesTimeFrequencyEntry {
- String indexPrefix;
- String creationPeriod;
+ private String indexPrefix;
+ private String creationPeriod;
public String getIndexPrefix() {
return indexPrefix;
@@ -665,23 +670,27 @@ public class Configuration extends BasicConfiguration {
public static class CassandrConfig {
private static final Integer CASSANDRA_DEFAULT_PORT = 9042;
- List<String> cassandraHosts;
- Integer cassandraPort;
- String localDataCenter;
- Long reconnectTimeout;
- Integer socketReadTimeout;
- Integer socketConnectTimeout;
- List<KeyspaceConfig> keySpaces;
- boolean authenticate;
- String username;
- String password;
- boolean ssl;
- String truststorePath;
- String truststorePassword;
+ private List<String> cassandraHosts;
+ private Integer cassandraPort;
+ private String localDataCenter;
+ private Long reconnectTimeout;
+ private Integer socketReadTimeout;
+ private Integer socketConnectTimeout;
+ private List<KeyspaceConfig> keySpaces;
+ private boolean authenticate;
+ private String username;
+ private String password;
+ private boolean ssl;
+ private String truststorePath;
+ private String truststorePassword;
- public Integer getCassandraPort() { return cassandraPort != null ? cassandraPort : Configuration.CassandrConfig.CASSANDRA_DEFAULT_PORT; }
+ public Integer getCassandraPort() {
+ return cassandraPort != null ? cassandraPort : Configuration.CassandrConfig.CASSANDRA_DEFAULT_PORT;
+ }
- public void setCassandraPort(Integer cassandraPort) { this.cassandraPort = cassandraPort; }
+ public void setCassandraPort(Integer cassandraPort) {
+ this.cassandraPort = cassandraPort;
+ }
public String getLocalDataCenter() {
return localDataCenter;
@@ -747,13 +756,21 @@ public class Configuration extends BasicConfiguration {
this.reconnectTimeout = reconnectTimeout;
}
- public Integer getSocketReadTimeout() { return socketReadTimeout; }
+ public Integer getSocketReadTimeout() {
+ return socketReadTimeout;
+ }
- public void setSocketReadTimeout(Integer socketReadTimeout) { this.socketReadTimeout = socketReadTimeout;}
+ public void setSocketReadTimeout(Integer socketReadTimeout) {
+ this.socketReadTimeout = socketReadTimeout;
+ }
- public Integer getSocketConnectTimeout() { return socketConnectTimeout;}
+ public Integer getSocketConnectTimeout() {
+ return socketConnectTimeout;
+ }
- public void setSocketConnectTimeout(Integer socketConnectTimeout) { this.socketConnectTimeout = socketConnectTimeout; }
+ public void setSocketConnectTimeout(Integer socketConnectTimeout) {
+ this.socketConnectTimeout = socketConnectTimeout;
+ }
public List<String> getCassandraHosts() {
return cassandraHosts;
@@ -773,9 +790,9 @@ public class Configuration extends BasicConfiguration {
public static class KeyspaceConfig {
- String name;
- String replicationStrategy;
- List<String> replicationInfo;
+ private String name;
+ private String replicationStrategy;
+ private List<String> replicationInfo;
public String getName() {
return name;
@@ -805,19 +822,19 @@ public class Configuration extends BasicConfiguration {
public static class SwitchoverDetectorConfig {
- String gBeFqdn;
- String gFeFqdn;
- String beVip;
- String feVip;
- int beResolveAttempts;
- int feResolveAttempts;
- Boolean enabled;
- long interval;
- String changePriorityUser;
- String changePriorityPassword;
- String publishNetworkUrl;
- String publishNetworkBody;
- Map<String, GroupInfo> groups;
+ private String gBeFqdn;
+ private String gFeFqdn;
+ private String beVip;
+ private String feVip;
+ private int beResolveAttempts;
+ private int feResolveAttempts;
+ private Boolean enabled;
+ private long interval;
+ private String changePriorityUser;
+ private String changePriorityPassword;
+ private String publishNetworkUrl;
+ private String publishNetworkBody;
+ private Map<String, GroupInfo> groups;
public String getgBeFqdn() {
return gBeFqdn;
@@ -925,8 +942,8 @@ public class Configuration extends BasicConfiguration {
public static class GroupInfo {
- String changePriorityUrl;
- String changePriorityBody;
+ private String changePriorityUrl;
+ private String changePriorityBody;
public String getChangePriorityUrl() {
return changePriorityUrl;
@@ -949,9 +966,9 @@ public class Configuration extends BasicConfiguration {
public static class BeMonitoringConfig {
- Boolean enabled;
- Boolean isProxy;
- Integer probeIntervalInSeconds;
+ private Boolean enabled;
+ private Boolean isProxy;
+ private Integer probeIntervalInSeconds;
public Boolean getEnabled() {
return enabled;
@@ -984,8 +1001,8 @@ public class Configuration extends BasicConfiguration {
public static class ArtifactTypeConfig {
- List<String> acceptedTypes;
- List<String> validForResourceTypes;
+ private List<String> acceptedTypes;
+ private List<String> validForResourceTypes;
public List<String> getValidForResourceTypes() {
return validForResourceTypes;
@@ -1006,11 +1023,11 @@ public class Configuration extends BasicConfiguration {
public static class OnboardingConfig {
- String protocol = "http";
- String host;
- Integer port;
- String downloadCsarUri;
- String healthCheckUri;
+ private String protocol = "http";
+ private String host;
+ private Integer port;
+ private String downloadCsarUri;
+ private String healthCheckUri;
public String getProtocol() {
return protocol;
@@ -1070,10 +1087,10 @@ public class Configuration extends BasicConfiguration {
public static class DcaeConfig {
- String protocol = "http";
- String host;
- Integer port;
- String healthCheckUri;
+ private String protocol = "http";
+ private String host;
+ private Integer port;
+ private String healthCheckUri;
public String getProtocol() {
return protocol;
@@ -1129,7 +1146,7 @@ public class Configuration extends BasicConfiguration {
public static class ApplicationL1CacheConfig {
- ApplicationL1CacheInfo datatypes;
+ private ApplicationL1CacheInfo datatypes;
public ApplicationL1CacheInfo getDatatypes() {
return datatypes;
@@ -1148,10 +1165,10 @@ public class Configuration extends BasicConfiguration {
public static class ApplicationL2CacheConfig {
- boolean enabled;
- ApplicationL1CacheCatalogInfo catalogL1Cache;
+ private boolean enabled;
+ private ApplicationL1CacheCatalogInfo catalogL1Cache;
- QueueInfo queue;
+ private QueueInfo queue;
public boolean isEnabled() {
return enabled;
@@ -1205,9 +1222,9 @@ public class Configuration extends BasicConfiguration {
public static class ApplicationL1CacheInfo {
- Boolean enabled;
- Integer firstRunDelay;
- Integer pollIntervalInSec;
+ private Boolean enabled;
+ private Integer firstRunDelay;
+ private Integer pollIntervalInSec;
public Boolean getEnabled() {
return enabled;
@@ -1242,10 +1259,10 @@ public class Configuration extends BasicConfiguration {
public static class ApplicationL1CacheCatalogInfo {
- Boolean enabled;
- Integer resourcesSizeInCache;
- Integer servicesSizeInCache;
- Integer productsSizeInCache;
+ private Boolean enabled;
+ private Integer resourcesSizeInCache;
+ private Integer servicesSizeInCache;
+ private Integer productsSizeInCache;
public Boolean getEnabled() {
return enabled;
@@ -1289,9 +1306,9 @@ public class Configuration extends BasicConfiguration {
}
public static class QueueInfo {
- Integer numberOfCacheWorkers;
- Integer waitOnShutDownInMinutes;
- Integer syncIntervalInSecondes;
+ private Integer numberOfCacheWorkers;
+ private Integer waitOnShutDownInMinutes;
+ private Integer syncIntervalInSecondes;
public Integer getWaitOnShutDownInMinutes() {
return waitOnShutDownInMinutes;
@@ -1326,8 +1343,8 @@ public class Configuration extends BasicConfiguration {
public static class EnvironmentContext {
- String defaultValue;
- List<String> validValues;
+ private String defaultValue;
+ private List<String> validValues;
public String getDefaultValue() {
return defaultValue;
@@ -1347,7 +1364,6 @@ public class Configuration extends BasicConfiguration {
}
-
public CleanComponentsConfiguration getCleanComponentsConfiguration() {
return cleanComponentsConfiguration;
}
@@ -1369,7 +1385,7 @@ public class Configuration extends BasicConfiguration {
.append(format("JanusGraph In memory: %s%n", janusGraphInMemoryGraph))
.append(format("JanusGraph lock timeout: %s%n", janusGraphLockTimeout))
.append(format("JanusGraph reconnect interval seconds: %s%n",
- janusGraphReconnectIntervalInSeconds))
+ janusGraphReconnectIntervalInSeconds))
.append(format("excludeResourceCategory: %s%n", excludeResourceCategory))
.append(format("informationalResourceArtifacts: %s%n", informationalResourceArtifacts))
.append(format("deploymentResourceArtifacts: %s%n", deploymentResourceArtifacts))
@@ -1383,9 +1399,9 @@ public class Configuration extends BasicConfiguration {
.append(format("Service Api Artifacts: %s%n", serviceApiArtifacts))
.append(format("heat env artifact header: %s%n", heatEnvArtifactHeader))
.append(format("heat env artifact footer: %s%n", heatEnvArtifactFooter))
- .append(format("onboarding: %s%n", onboarding))
- .append(format("tosca conformance level: %s%n", toscaConformanceLevel))
- .toString();
+ .append(format("onboarding: %s%n", onboarding))
+ .append(format("tosca conformance level: %s%n", toscaConformanceLevel))
+ .toString();
}
public List<String> getUnLoggedUrls() {
@@ -1552,15 +1568,19 @@ public class Configuration extends BasicConfiguration {
public static class VfModuleProperty {
private String forBaseModule;
private String forNonBaseModule;
+
public String getForBaseModule() {
return forBaseModule;
}
+
public void setForBaseModule(String forBaseModule) {
this.forBaseModule = forBaseModule;
}
+
public String getForNonBaseModule() {
return forNonBaseModule;
}
+
public void setForNonBaseModule(String forNonBaseModule) {
this.forNonBaseModule = forNonBaseModule;
}
@@ -1583,7 +1603,7 @@ public class Configuration extends BasicConfiguration {
}
@SuppressWarnings("unchecked")
- public static <K,V> Map<K,V> safeGetCapsInsensitiveMap(Map<K,V> map) {
+ public static <K, V> Map<K, V> safeGetCapsInsensitiveMap(Map<K, V> map) {
return map == null ? emptyMap() : new CaseInsensitiveMap(map);
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/be/config/ConfigurationManager.java b/common-app-api/src/main/java/org/openecomp/sdc/be/config/ConfigurationManager.java
index f68cd52a56..f5891a089b 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/be/config/ConfigurationManager.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/be/config/ConfigurationManager.java
@@ -7,9 +7,9 @@
* 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.
@@ -32,122 +32,131 @@ import java.util.Map;
public class ConfigurationManager implements FileChangeCallback, IEcompConfigurationManager {
- ConfigurationSource configurationSource = null;
- private static ConfigurationManager instance;
- Map<String, Object> configurations = new HashMap<>();
+ private ConfigurationSource configurationSource = null;
+ private static ConfigurationManager instance;
- public ConfigurationManager(ConfigurationSource configurationSource) {
- super();
- this.configurationSource = configurationSource;
- loadConfigurationFiles();
- instance = this;
- }
+ public Map<String, Object> getConfigurations() {
+ return configurations;
+ }
- private void loadConfigurationFiles() {
+ public void setConfigurations(Map<String, Object> configurations) {
+ this.configurations = configurations;
+ }
- loadConfigurationClass(Configuration.class);
- loadConfigurationClass(ErrorConfiguration.class);
- loadConfigurationClass(Neo4jErrorsConfiguration.class);
- loadConfigurationClass(EcompErrorConfiguration.class);
- loadConfigurationClass(DistributionEngineConfiguration.class);
- }
+ private Map<String, Object> configurations = new HashMap<>();
- private <T extends BasicConfiguration> void loadConfigurationClass(Class<T> clazz) {
- ConfigurationListener configurationListener = new ConfigurationListener(clazz, this);
+ public ConfigurationManager(ConfigurationSource configurationSource) {
+ super();
+ this.configurationSource = configurationSource;
+ loadConfigurationFiles();
+ instance = this;
+ }
- T object = configurationSource.getAndWatchConfiguration(clazz, configurationListener);
+ private void loadConfigurationFiles() {
- configurations.put(getKey(clazz), object);
- }
+ loadConfigurationClass(Configuration.class);
+ loadConfigurationClass(ErrorConfiguration.class);
+ loadConfigurationClass(Neo4jErrorsConfiguration.class);
+ loadConfigurationClass(EcompErrorConfiguration.class);
+ loadConfigurationClass(DistributionEngineConfiguration.class);
+ }
- private <T> String getKey(Class<T> class1) {
+ private <T extends BasicConfiguration> void loadConfigurationClass(Class<T> clazz) {
+ ConfigurationListener configurationListener = new ConfigurationListener(clazz, this);
- return class1.getSimpleName();
+ T object = configurationSource.getAndWatchConfiguration(clazz, configurationListener);
- }
+ configurations.put(getKey(clazz), object);
+ }
- public Configuration getConfiguration() {
+ private <T> String getKey(Class<T> class1) {
- return (Configuration) configurations.get(getKey(Configuration.class));
+ return class1.getSimpleName();
- }
+ }
- public void setConfiguration(Configuration configuration) {
+ public Configuration getConfiguration() {
- configurations.put(getKey(Configuration.class), configuration);
+ return (Configuration) configurations.get(getKey(Configuration.class));
- }
+ }
- public void setErrorConfiguration(ErrorConfiguration configuration) {
+ public void setConfiguration(Configuration configuration) {
- configurations.put(getKey(ErrorConfiguration.class), configuration);
+ configurations.put(getKey(Configuration.class), configuration);
- }
+ }
- public ErrorConfiguration getErrorConfiguration() {
+ public void setErrorConfiguration(ErrorConfiguration configuration) {
- return (ErrorConfiguration) configurations.get(getKey(ErrorConfiguration.class));
+ configurations.put(getKey(ErrorConfiguration.class), configuration);
- }
+ }
- public Neo4jErrorsConfiguration getNeo4jErrorsConfiguration() {
- return (Neo4jErrorsConfiguration) configurations.get(getKey(Neo4jErrorsConfiguration.class));
- }
+ public ErrorConfiguration getErrorConfiguration() {
- @Override
- public EcompErrorConfiguration getEcompErrorConfiguration() {
+ return (ErrorConfiguration) configurations.get(getKey(ErrorConfiguration.class));
- return (EcompErrorConfiguration) configurations.get(getKey(EcompErrorConfiguration.class));
+ }
- }
+ public Neo4jErrorsConfiguration getNeo4jErrorsConfiguration() {
+ return (Neo4jErrorsConfiguration) configurations.get(getKey(Neo4jErrorsConfiguration.class));
+ }
- public Configuration getConfigurationAndWatch(ConfigurationListener configurationListener) {
+ @Override
+ public EcompErrorConfiguration getEcompErrorConfiguration() {
- if (configurationListener != null) {
+ return (EcompErrorConfiguration) configurations.get(getKey(EcompErrorConfiguration.class));
- configurationSource.addWatchConfiguration(Configuration.class, configurationListener);
+ }
- }
- return (Configuration) configurations.get(getKey(Configuration.class));
+ public Configuration getConfigurationAndWatch(ConfigurationListener configurationListener) {
- }
+ if (configurationListener != null) {
- public static ConfigurationManager getConfigurationManager() {
- return instance;
- }
+ configurationSource.addWatchConfiguration(Configuration.class, configurationListener);
- public void reconfigure(BasicConfiguration obj) {
+ }
+ return (Configuration) configurations.get(getKey(Configuration.class));
- // if (obj != null) {
+ }
- // if (obj instanceof Configuration) {
- // configurations.put(getKey(Configuration.class), obj);
- // }
- // if (obj instanceof ErrorConfiguration) {
- // configurations.put(getKey(ErrorConfiguration.class), obj);
- // }
- //
- // if (obj instanceof EcompErrorConfiguration) {
- // configurations.put(getKey(EcompErrorConfiguration.class), obj);
- // }
- // }
+ public static ConfigurationManager getConfigurationManager() {
+ return instance;
+ }
- }
+ public void reconfigure(BasicConfiguration obj) {
- /**
- * FOR TEST ONLY
- *
- * @param ecompErrorConfiguration
- */
- public void setEcompErrorConfiguration(EcompErrorConfiguration ecompErrorConfiguration) {
+ // if (obj != null) {
- configurations.put(getKey(EcompErrorConfiguration.class), ecompErrorConfiguration);
+ // if (obj instanceof Configuration) {
+ // configurations.put(getKey(Configuration.class), obj);
+ // }
+ // if (obj instanceof ErrorConfiguration) {
+ // configurations.put(getKey(ErrorConfiguration.class), obj);
+ // }
+ //
+ // if (obj instanceof EcompErrorConfiguration) {
+ // configurations.put(getKey(EcompErrorConfiguration.class), obj);
+ // }
+ // }
- }
+ }
- public DistributionEngineConfiguration getDistributionEngineConfiguration() {
+ /**
+ * FOR TEST ONLY
+ *
+ * @param ecompErrorConfiguration
+ */
+ public void setEcompErrorConfiguration(EcompErrorConfiguration ecompErrorConfiguration) {
- return (DistributionEngineConfiguration) configurations.get(getKey(DistributionEngineConfiguration.class));
+ configurations.put(getKey(EcompErrorConfiguration.class), ecompErrorConfiguration);
- }
+ }
+
+ public DistributionEngineConfiguration getDistributionEngineConfiguration() {
+
+ return (DistributionEngineConfiguration) configurations.get(getKey(DistributionEngineConfiguration.class));
+
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/be/config/DistributionEngineConfiguration.java b/common-app-api/src/main/java/org/openecomp/sdc/be/config/DistributionEngineConfiguration.java
index 6ac399c729..b7b0e64189 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/be/config/DistributionEngineConfiguration.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/be/config/DistributionEngineConfiguration.java
@@ -7,9 +7,9 @@
* 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.
@@ -23,451 +23,461 @@ package org.openecomp.sdc.be.config;
import org.openecomp.sdc.common.api.BasicConfiguration;
import org.openecomp.sdc.common.http.config.ExternalServiceConfig;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
public class DistributionEngineConfiguration extends BasicConfiguration {
- private List<String> uebServers;
+ private List<String> uebServers;
- private String distributionNotifTopicName;
+ private String distributionNotifTopicName;
- private String distributionStatusTopicName;
+ private String distributionStatusTopicName;
- private Integer initRetryIntervalSec;
+ private Integer initRetryIntervalSec;
- private Integer initMaxIntervalSec;
+ private Integer initMaxIntervalSec;
- private ComponentArtifactTypesConfig distribNotifServiceArtifactTypes;
+ private ComponentArtifactTypesConfig distribNotifServiceArtifactTypes;
- private ComponentArtifactTypesConfig distribNotifResourceArtifactTypes;
+ private ComponentArtifactTypesConfig distribNotifResourceArtifactTypes;
- private String uebPublicKey;
+ private String uebPublicKey;
- private String uebSecretKey;
+ private String uebSecretKey;
- private List<String> environments;
+ private List<String> environments;
- private DistributionStatusTopicConfig distributionStatusTopic;
+ private DistributionStatusTopicConfig distributionStatusTopic;
- private CreateTopicConfig createTopic;
+ private CreateTopicConfig createTopic;
- private boolean startDistributionEngine;
+ private boolean startDistributionEngine;
- private DistributionNotificationTopicConfig distributionNotificationTopic;
+ private DistributionNotificationTopicConfig distributionNotificationTopic;
- private Integer defaultArtifactInstallationTimeout = 60;
-
- private Integer currentArtifactInstallationTimeout = 120;
+ private Integer defaultArtifactInstallationTimeout = 60;
- private boolean useHttpsWithDmaap;
+ private Integer currentArtifactInstallationTimeout = 120;
- private ExternalServiceConfig aaiConfig;
+ private boolean useHttpsWithDmaap;
- private ExternalServiceConfig msoConfig;
-
- private Integer opEnvRecoveryIntervalSec;
-
- private Integer allowedTimeBeforeStaleSec;
-
- public static class DistribNotifServiceArtifacts {
+ private ExternalServiceConfig aaiConfig;
- Map<String, Object> service;
- Map<String, Object> resource;
-
-
+ private ExternalServiceConfig msoConfig;
- public Map<String, Object> getService() {
- return service;
- }
+ private Integer opEnvRecoveryIntervalSec;
- public void setService(Map<String, Object> service) {
- this.service = service;
- }
+ private Integer allowedTimeBeforeStaleSec;
- public Map<String, Object> getResource() {
- return resource;
- }
+ public static class DistribNotifServiceArtifacts {
- public void setResource(Map<String, Object> resource) {
- this.resource = resource;
- }
+ private Map<String, Object> service;
+ private Map<String, Object> resource;
- }
- public static class NotifArtifactTypes {
+ public Map<String, Object> getService() {
+ return service;
+ }
- List<String> info;
- List<String> lifecycle;
+ public void setService(Map<String, Object> service) {
+ this.service = service;
+ }
- public List<String> getInfo() {
- return info;
- }
+ public Map<String, Object> getResource() {
+ return resource;
+ }
- public void setInfo(List<String> info) {
- this.info = info;
- }
+ public void setResource(Map<String, Object> resource) {
+ this.resource = resource;
+ }
- public List<String> getLifecycle() {
- return lifecycle;
- }
+ }
- public void setLifecycle(List<String> lifecycle) {
- this.lifecycle = lifecycle;
- }
+ public static class NotifArtifactTypes {
- }
+ private List<String> info;
+ private List<String> lifecycle;
- public static class NotifArtifactTypesResource {
+ public List<String> getInfo() {
+ return info;
+ }
- List<ArtifcatTypeEnum> lifecycle;
+ public void setInfo(List<String> info) {
+ this.info = info;
+ }
- }
+ public List<String> getLifecycle() {
+ return lifecycle;
+ }
- public enum ArtifcatTypeEnum {
+ public void setLifecycle(List<String> lifecycle) {
+ this.lifecycle = lifecycle;
+ }
- MURANO_PKG("MURANO-PKG"), HEAT("HEAT"), DG_XML("DG_XML");
+ }
- String value;
+ public static class NotifArtifactTypesResource {
- private ArtifcatTypeEnum(String value) {
- this.value = value;
- }
+ private List<ArtifcatTypeEnum> lifecycle;
- public String getValue() {
+ public List<ArtifcatTypeEnum> getLifecycle() {
+ return lifecycle;
+ }
- return value;
- }
- }
+ public void setLifecycle(List<ArtifcatTypeEnum> lifecycle) {
+ this.lifecycle = lifecycle;
+ }
+ }
- public List<String> getUebServers() {
- return uebServers;
- }
+ public enum ArtifcatTypeEnum {
- public void setUebServers(List<String> uebServers) {
- this.uebServers = uebServers;
- }
+ MURANO_PKG("MURANO-PKG"), HEAT("HEAT"), DG_XML("DG_XML");
- public String getDistributionNotifTopicName() {
- return distributionNotifTopicName;
- }
+ private String value;
- public void setDistributionNotifTopicName(String distributionNotifTopicName) {
- this.distributionNotifTopicName = distributionNotifTopicName;
- }
+ ArtifcatTypeEnum(String value) {
+ this.value = value;
+ }
- public String getDistributionStatusTopicName() {
- return distributionStatusTopicName;
- }
+ public String getValue() {
- public void setDistributionStatusTopicName(String distributionStatusTopicName) {
- this.distributionStatusTopicName = distributionStatusTopicName;
- }
+ return value;
+ }
+ }
- public Integer getInitRetryIntervalSec() {
- return initRetryIntervalSec;
- }
+ public List<String> getUebServers() {
+ return uebServers;
+ }
+
+ public void setUebServers(List<String> uebServers) {
+ this.uebServers = uebServers;
+ }
- public void setInitRetryIntervalSec(Integer initRetryIntervalSec) {
- this.initRetryIntervalSec = initRetryIntervalSec;
- }
+ public String getDistributionNotifTopicName() {
+ return distributionNotifTopicName;
+ }
- public ComponentArtifactTypesConfig getDistribNotifServiceArtifactTypes() {
- return distribNotifServiceArtifactTypes;
- }
+ public void setDistributionNotifTopicName(String distributionNotifTopicName) {
+ this.distributionNotifTopicName = distributionNotifTopicName;
+ }
- public void setDistribNotifServiceArtifactTypes(ComponentArtifactTypesConfig distribNotifServiceArtifactTypes) {
- this.distribNotifServiceArtifactTypes = distribNotifServiceArtifactTypes;
- }
+ public String getDistributionStatusTopicName() {
+ return distributionStatusTopicName;
+ }
- public ComponentArtifactTypesConfig getDistribNotifResourceArtifactTypes() {
- return distribNotifResourceArtifactTypes;
- }
+ public void setDistributionStatusTopicName(String distributionStatusTopicName) {
+ this.distributionStatusTopicName = distributionStatusTopicName;
+ }
- public void setDistribNotifResourceArtifactTypes(ComponentArtifactTypesConfig distribNotifResourceArtifactTypes) {
- this.distribNotifResourceArtifactTypes = distribNotifResourceArtifactTypes;
- }
+ public Integer getInitRetryIntervalSec() {
+ return initRetryIntervalSec;
+ }
- public String getUebPublicKey() {
- return uebPublicKey;
- }
+ public void setInitRetryIntervalSec(Integer initRetryIntervalSec) {
+ this.initRetryIntervalSec = initRetryIntervalSec;
+ }
- public void setUebPublicKey(String uebPublicKey) {
- this.uebPublicKey = uebPublicKey;
- }
+ public ComponentArtifactTypesConfig getDistribNotifServiceArtifactTypes() {
+ return distribNotifServiceArtifactTypes;
+ }
- public String getUebSecretKey() {
- return uebSecretKey;
- }
+ public void setDistribNotifServiceArtifactTypes(ComponentArtifactTypesConfig distribNotifServiceArtifactTypes) {
+ this.distribNotifServiceArtifactTypes = distribNotifServiceArtifactTypes;
+ }
+
+ public ComponentArtifactTypesConfig getDistribNotifResourceArtifactTypes() {
+ return distribNotifResourceArtifactTypes;
+ }
+
+ public void setDistribNotifResourceArtifactTypes(ComponentArtifactTypesConfig distribNotifResourceArtifactTypes) {
+ this.distribNotifResourceArtifactTypes = distribNotifResourceArtifactTypes;
+ }
+
+ public String getUebPublicKey() {
+ return uebPublicKey;
+ }
+
+ public void setUebPublicKey(String uebPublicKey) {
+ this.uebPublicKey = uebPublicKey;
+ }
+
+ public String getUebSecretKey() {
+ return uebSecretKey;
+ }
+
+ public void setUebSecretKey(String uebSecretKey) {
+ this.uebSecretKey = uebSecretKey;
+ }
- public void setUebSecretKey(String uebSecretKey) {
- this.uebSecretKey = uebSecretKey;
- }
+ public List<String> getEnvironments() {
+ return environments;
+ }
- public List<String> getEnvironments() {
- return environments;
- }
+ public void setEnvironments(List<String> environments) {
- public void setEnvironments(List<String> environments) {
+ Set<String> set = new HashSet<>();
+ if (environments != null) {
+ set.addAll(environments);
+ this.environments = new ArrayList<>(set);
+ } else {
+ this.environments = null;
+ }
- Set<String> set = new HashSet<>();
- if (environments != null) {
- set.addAll(environments);
- this.environments = new ArrayList<>(set);
- } else {
- this.environments = null;
- }
+ }
- }
+ public DistributionStatusTopicConfig getDistributionStatusTopic() {
+ return distributionStatusTopic;
+ }
- public DistributionStatusTopicConfig getDistributionStatusTopic() {
- return distributionStatusTopic;
- }
+ public void setDistributionStatusTopic(DistributionStatusTopicConfig distributionStatusTopic) {
+ this.distributionStatusTopic = distributionStatusTopic;
+ }
- public void setDistributionStatusTopic(DistributionStatusTopicConfig distributionStatusTopic) {
- this.distributionStatusTopic = distributionStatusTopic;
- }
+ public Integer getInitMaxIntervalSec() {
+ return initMaxIntervalSec;
+ }
- public Integer getInitMaxIntervalSec() {
- return initMaxIntervalSec;
- }
+ public void setInitMaxIntervalSec(Integer initMaxIntervalSec) {
+ this.initMaxIntervalSec = initMaxIntervalSec;
+ }
- public void setInitMaxIntervalSec(Integer initMaxIntervalSec) {
- this.initMaxIntervalSec = initMaxIntervalSec;
- }
+ public CreateTopicConfig getCreateTopic() {
+ return createTopic;
+ }
- public CreateTopicConfig getCreateTopic() {
- return createTopic;
- }
+ public void setCreateTopic(CreateTopicConfig createTopic) {
+ this.createTopic = createTopic;
+ }
- public void setCreateTopic(CreateTopicConfig createTopic) {
- this.createTopic = createTopic;
- }
+ public boolean isStartDistributionEngine() {
+ return startDistributionEngine;
+ }
- public boolean isStartDistributionEngine() {
- return startDistributionEngine;
- }
+ public void setStartDistributionEngine(boolean startDistributionEngine) {
+ this.startDistributionEngine = startDistributionEngine;
+ }
- public void setStartDistributionEngine(boolean startDistributionEngine) {
- this.startDistributionEngine = startDistributionEngine;
- }
+ public DistributionNotificationTopicConfig getDistributionNotificationTopic() {
+ return distributionNotificationTopic;
+ }
- public DistributionNotificationTopicConfig getDistributionNotificationTopic() {
- return distributionNotificationTopic;
- }
+ public void setDistributionNotificationTopic(DistributionNotificationTopicConfig distributionNotificationTopic) {
+ this.distributionNotificationTopic = distributionNotificationTopic;
+ }
- public void setDistributionNotificationTopic(DistributionNotificationTopicConfig distributionNotificationTopic) {
- this.distributionNotificationTopic = distributionNotificationTopic;
- }
+ public int getDefaultArtifactInstallationTimeout() {
+ return defaultArtifactInstallationTimeout;
+ }
- public int getDefaultArtifactInstallationTimeout() {
- return defaultArtifactInstallationTimeout;
- }
+ public void setDefaultArtifactInstallationTimeout(int defaultArtifactInstallationTimeout) {
+ this.defaultArtifactInstallationTimeout = defaultArtifactInstallationTimeout;
+ }
- public void setDefaultArtifactInstallationTimeout(int defaultArtifactInstallationTimeout) {
- this.defaultArtifactInstallationTimeout = defaultArtifactInstallationTimeout;
- }
-
- public int getCurrentArtifactInstallationTimeout() {
- return currentArtifactInstallationTimeout;
- }
+ public int getCurrentArtifactInstallationTimeout() {
+ return currentArtifactInstallationTimeout;
+ }
- public void setCurrentArtifactInstallationTimeout(int currentArtifactInstallationTimeout) {
- this.currentArtifactInstallationTimeout = currentArtifactInstallationTimeout;
- }
+ public void setCurrentArtifactInstallationTimeout(int currentArtifactInstallationTimeout) {
+ this.currentArtifactInstallationTimeout = currentArtifactInstallationTimeout;
+ }
- public boolean isUseHttpsWithDmaap() {
- return useHttpsWithDmaap;
- }
+ public boolean isUseHttpsWithDmaap() {
+ return useHttpsWithDmaap;
+ }
- public void setUseHttpsWithDmaap(boolean useHttpsWithDmaap) {
- this.useHttpsWithDmaap = useHttpsWithDmaap;
- }
+ public void setUseHttpsWithDmaap(boolean useHttpsWithDmaap) {
+ this.useHttpsWithDmaap = useHttpsWithDmaap;
+ }
- public static class CreateTopicConfig {
+ public static class CreateTopicConfig {
- private Integer partitionCount;
- private Integer replicationCount;
+ private Integer partitionCount;
+ private Integer replicationCount;
- public Integer getPartitionCount() {
- return partitionCount;
- }
+ public Integer getPartitionCount() {
+ return partitionCount;
+ }
- public void setPartitionCount(Integer partitionCount) {
- this.partitionCount = partitionCount;
- }
+ public void setPartitionCount(Integer partitionCount) {
+ this.partitionCount = partitionCount;
+ }
- public Integer getReplicationCount() {
- return replicationCount;
- }
+ public Integer getReplicationCount() {
+ return replicationCount;
+ }
- public void setReplicationCount(Integer replicationCount) {
- this.replicationCount = replicationCount;
- }
+ public void setReplicationCount(Integer replicationCount) {
+ this.replicationCount = replicationCount;
+ }
- @Override
- public String toString() {
- return "CreateTopicConfig [partitionCount=" + partitionCount + ", replicationCount=" + replicationCount
- + "]";
- }
+ @Override
+ public String toString() {
+ return "CreateTopicConfig [partitionCount=" + partitionCount + ", replicationCount=" + replicationCount
+ + "]";
+ }
- }
+ }
- public static class EnvironmentConfig {
+ public static class EnvironmentConfig {
- private String name;
- private List<String> uebServers;
+ private String name;
+ private List<String> uebServers;
- public String getName() {
- return name;
- }
+ public String getName() {
+ return name;
+ }
- public void setName(String name) {
- this.name = name;
- }
+ public void setName(String name) {
+ this.name = name;
+ }
- public List<String> getUebServers() {
- return uebServers;
- }
+ public List<String> getUebServers() {
+ return uebServers;
+ }
- public void setUebServers(List<String> uebServers) {
- this.uebServers = uebServers;
- }
+ public void setUebServers(List<String> uebServers) {
+ this.uebServers = uebServers;
+ }
- @Override
- public String toString() {
- return "EnvironmentConfig [name=" + name + ", uebServers=" + uebServers + "]";
- }
+ @Override
+ public String toString() {
+ return "EnvironmentConfig [name=" + name + ", uebServers=" + uebServers + "]";
+ }
- }
+ }
- public static class DistributionStatusTopicConfig {
+ public static class DistributionStatusTopicConfig {
- private Integer pollingIntervalSec;
- private Integer fetchTimeSec;
- private String consumerGroup;
- private String consumerId;
+ private Integer pollingIntervalSec;
+ private Integer fetchTimeSec;
+ private String consumerGroup;
+ private String consumerId;
- public Integer getPollingIntervalSec() {
- return pollingIntervalSec;
- }
+ public Integer getPollingIntervalSec() {
+ return pollingIntervalSec;
+ }
- public void setPollingIntervalSec(Integer pollingIntervalSec) {
- this.pollingIntervalSec = pollingIntervalSec;
- }
+ public void setPollingIntervalSec(Integer pollingIntervalSec) {
+ this.pollingIntervalSec = pollingIntervalSec;
+ }
- public Integer getFetchTimeSec() {
- return fetchTimeSec;
- }
+ public Integer getFetchTimeSec() {
+ return fetchTimeSec;
+ }
- public void setFetchTimeSec(Integer fetchTimeSec) {
- this.fetchTimeSec = fetchTimeSec;
- }
+ public void setFetchTimeSec(Integer fetchTimeSec) {
+ this.fetchTimeSec = fetchTimeSec;
+ }
- public String getConsumerGroup() {
- return consumerGroup;
- }
+ public String getConsumerGroup() {
+ return consumerGroup;
+ }
- public void setConsumerGroup(String consumerGroup) {
- this.consumerGroup = consumerGroup;
- }
+ public void setConsumerGroup(String consumerGroup) {
+ this.consumerGroup = consumerGroup;
+ }
- public String getConsumerId() {
- return consumerId;
- }
+ public String getConsumerId() {
+ return consumerId;
+ }
- public void setConsumerId(String consumerId) {
- this.consumerId = consumerId;
- }
+ public void setConsumerId(String consumerId) {
+ this.consumerId = consumerId;
+ }
- @Override
- public String toString() {
- return "DistributionStatusTopicConfig [pollingIntervalSec=" + pollingIntervalSec + ", fetchTimeSec="
- + fetchTimeSec + ", consumerGroup=" + consumerGroup + ", consumerId=" + consumerId + "]";
- }
+ @Override
+ public String toString() {
+ return "DistributionStatusTopicConfig [pollingIntervalSec=" + pollingIntervalSec + ", fetchTimeSec="
+ + fetchTimeSec + ", consumerGroup=" + consumerGroup + ", consumerId=" + consumerId + "]";
+ }
- }
+ }
- public static class DistributionNotificationTopicConfig {
+ public static class DistributionNotificationTopicConfig {
- private Integer maxWaitingAfterSendingSeconds;
- private Integer maxThreadPoolSize;
- private Integer minThreadPoolSize;
+ private Integer maxWaitingAfterSendingSeconds;
+ private Integer maxThreadPoolSize;
+ private Integer minThreadPoolSize;
- public Integer getMaxWaitingAfterSendingSeconds() {
- return maxWaitingAfterSendingSeconds;
- }
+ public Integer getMaxWaitingAfterSendingSeconds() {
+ return maxWaitingAfterSendingSeconds;
+ }
- public void setMaxWaitingAfterSendingSeconds(Integer maxWaitingAfterSendingSeconds) {
- this.maxWaitingAfterSendingSeconds = maxWaitingAfterSendingSeconds;
- }
+ public void setMaxWaitingAfterSendingSeconds(Integer maxWaitingAfterSendingSeconds) {
+ this.maxWaitingAfterSendingSeconds = maxWaitingAfterSendingSeconds;
+ }
- public Integer getMaxThreadPoolSize() {
- return maxThreadPoolSize;
- }
+ public Integer getMaxThreadPoolSize() {
+ return maxThreadPoolSize;
+ }
- public void setMaxThreadPoolSize(Integer maxThreadPoolSize) {
- this.maxThreadPoolSize = maxThreadPoolSize;
- }
+ public void setMaxThreadPoolSize(Integer maxThreadPoolSize) {
+ this.maxThreadPoolSize = maxThreadPoolSize;
+ }
- public Integer getMinThreadPoolSize() {
- return minThreadPoolSize;
- }
+ public Integer getMinThreadPoolSize() {
+ return minThreadPoolSize;
+ }
- public void setMinThreadPoolSize(Integer minThreadPoolSize) {
- this.minThreadPoolSize = minThreadPoolSize;
- }
+ public void setMinThreadPoolSize(Integer minThreadPoolSize) {
+ this.minThreadPoolSize = minThreadPoolSize;
+ }
- @Override
- public String toString() {
- return "DistributionNotificationTopicConfig [maxWaitingAfterSendingSeconds=" + maxWaitingAfterSendingSeconds
- + ", maxThreadPoolSize=" + maxThreadPoolSize + ", minThreadPoolSize=" + minThreadPoolSize + "]";
- }
+ @Override
+ public String toString() {
+ return "DistributionNotificationTopicConfig [maxWaitingAfterSendingSeconds=" + maxWaitingAfterSendingSeconds
+ + ", maxThreadPoolSize=" + maxThreadPoolSize + ", minThreadPoolSize=" + minThreadPoolSize + "]";
+ }
- }
+ }
- public static class ComponentArtifactTypesConfig {
+ public static class ComponentArtifactTypesConfig {
- private List<String> info;
- private List<String> lifecycle;
+ private List<String> info;
+ private List<String> lifecycle;
- public List<String> getInfo() {
- return info;
- }
+ public List<String> getInfo() {
+ return info;
+ }
- public void setInfo(List<String> info) {
- this.info = info;
- }
+ public void setInfo(List<String> info) {
+ this.info = info;
+ }
- public List<String> getLifecycle() {
- return lifecycle;
- }
+ public List<String> getLifecycle() {
+ return lifecycle;
+ }
- public void setLifecycle(List<String> lifecycle) {
- this.lifecycle = lifecycle;
- }
+ public void setLifecycle(List<String> lifecycle) {
+ this.lifecycle = lifecycle;
+ }
- @Override
- public String toString() {
- return "ArtifactTypesConfig [info=" + info + ", lifecycle=" + lifecycle + "]";
- }
+ @Override
+ public String toString() {
+ return "ArtifactTypesConfig [info=" + info + ", lifecycle=" + lifecycle + "]";
+ }
- }
+ }
- public Integer getOpEnvRecoveryIntervalSec() {
- return opEnvRecoveryIntervalSec;
- }
+ public Integer getOpEnvRecoveryIntervalSec() {
+ return opEnvRecoveryIntervalSec;
+ }
- public void setOpEnvRecoveryIntervalSec(Integer opEnvRecoveryIntervalSec) {
- this.opEnvRecoveryIntervalSec = opEnvRecoveryIntervalSec;
- }
+ public void setOpEnvRecoveryIntervalSec(Integer opEnvRecoveryIntervalSec) {
+ this.opEnvRecoveryIntervalSec = opEnvRecoveryIntervalSec;
+ }
- public Integer getAllowedTimeBeforeStaleSec() {
- return allowedTimeBeforeStaleSec;
- }
+ public Integer getAllowedTimeBeforeStaleSec() {
+ return allowedTimeBeforeStaleSec;
+ }
- public void setAllowedTimeBeforeStaleSec(Integer allowedTimeBeforeStaleSec) {
- this.allowedTimeBeforeStaleSec = allowedTimeBeforeStaleSec;
- }
+ public void setAllowedTimeBeforeStaleSec(Integer allowedTimeBeforeStaleSec) {
+ this.allowedTimeBeforeStaleSec = allowedTimeBeforeStaleSec;
+ }
public ExternalServiceConfig getAaiConfig() {
return aaiConfig;
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/be/config/DmaapConsumerConfiguration.java b/common-app-api/src/main/java/org/openecomp/sdc/be/config/DmaapConsumerConfiguration.java
index e18665448c..c99cbbaae3 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/be/config/DmaapConsumerConfiguration.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/be/config/DmaapConsumerConfiguration.java
@@ -7,9 +7,9 @@
* 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.
@@ -19,275 +19,284 @@
*/
package org.openecomp.sdc.be.config;
+
/**
* Contains DMAAP Client configuration parameters
*/
public class DmaapConsumerConfiguration {
- private boolean active;
- private String hosts;
- private String consumerGroup;
- private String consumerId;
- private Integer timeoutMs;
- private Integer limit;
- private Integer pollingInterval;
- private String topic;
- private Double latitude;
- private Double longitude;
- private String version;
- private String serviceName;
- private String environment;
- private String partner;
- private String routeOffer;
- private String protocol;
- private String contenttype;
- private Boolean dme2TraceOn;
- private String aftEnvironment;
- private Integer aftDme2ConnectionTimeoutMs;
- private Integer aftDme2RoundtripTimeoutMs;
- private Integer aftDme2ReadTimeoutMs;
- private String dme2preferredRouterFilePath;
- private Credential credential;
- private Integer timeLimitForNotificationHandleMs;
-
- public String getHosts() {
- return hosts;
- }
-
- public void setHosts(String hosts) {
- this.hosts = hosts;
- }
-
- public String getConsumerGroup() {
- return consumerGroup;
- }
-
- public void setConsumerGroup(String consumerGroup) {
- this.consumerGroup = consumerGroup;
- }
-
- public String getConsumerId() {
- return consumerId;
- }
-
- public void setConsumerId(String consumerId) {
- this.consumerId = consumerId;
- }
-
- public Integer getTimeoutMs() {
- return timeoutMs;
- }
-
- public void setTimeoutMs(Integer timeoutMs) {
- this.timeoutMs = timeoutMs;
- }
-
- public Integer getLimit() {
- return limit;
- }
-
- public void setLimit(Integer limit) {
- this.limit = limit;
- }
-
- public Integer getPollingInterval() {
- return pollingInterval;
- }
-
- public void setPollingInterval(Integer pollingInterval) {
- this.pollingInterval = pollingInterval;
- }
-
- public String getTopic() {
- return topic;
- }
-
- public void setTopic(String topic) {
- this.topic = topic;
- }
-
- public Double getLatitude() {
- return latitude;
- }
-
- public void setLatitude(Double latitude) {
- this.latitude = latitude;
- }
-
- public Double getLongitude() {
- return longitude;
- }
-
- public void setLongitude(Double longitude) {
- this.longitude = longitude;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- public String getServiceName() {
- return serviceName;
- }
-
- public void setServiceName(String serviceName) {
- this.serviceName = serviceName;
- }
-
- public String getEnvironment() {
- return environment;
- }
-
- public void setEnvironment(String environment) {
- this.environment = environment;
- }
-
- public String getPartner() {
- return partner;
- }
-
- public void setPartner(String partner) {
- this.partner = partner;
- }
-
- public String getRouteOffer() {
- return routeOffer;
- }
-
- public void setRouteOffer(String routeOffer) {
- this.routeOffer = routeOffer;
- }
-
- public String getProtocol() {
- return protocol;
- }
-
- public void setProtocol(String protocol) {
- this.protocol = protocol;
- }
-
- public String getContenttype() {
- return contenttype;
- }
-
- public void setContenttype(String contenttype) {
- this.contenttype = contenttype;
- }
-
- public Boolean isDme2TraceOn() {
- return dme2TraceOn;
- }
-
- public Boolean getDme2TraceOn() {
- return dme2TraceOn;
- }
-
- public void setDme2TraceOn(Boolean dme2TraceOn) {
- this.dme2TraceOn = dme2TraceOn;
- }
-
- public String getAftEnvironment() {
- return aftEnvironment;
- }
-
- public void setAftEnvironment(String aftEnvironment) {
- this.aftEnvironment = aftEnvironment;
- }
-
- public Integer getAftDme2ConnectionTimeoutMs() {
- return aftDme2ConnectionTimeoutMs;
- }
-
- public void setAftDme2ConnectionTimeoutMs(Integer aftDme2ConnectionTimeoutMs) {
- this.aftDme2ConnectionTimeoutMs = aftDme2ConnectionTimeoutMs;
- }
-
- public Integer getAftDme2RoundtripTimeoutMs() {
- return aftDme2RoundtripTimeoutMs;
- }
-
- public void setAftDme2RoundtripTimeoutMs(Integer aftDme2RoundtripTimeoutMs) {
- this.aftDme2RoundtripTimeoutMs = aftDme2RoundtripTimeoutMs;
- }
-
- public Integer getAftDme2ReadTimeoutMs() {
- return aftDme2ReadTimeoutMs;
- }
-
- public void setAftDme2ReadTimeoutMs(Integer aftDme2ReadTimeoutMs) {
- this.aftDme2ReadTimeoutMs = aftDme2ReadTimeoutMs;
- }
-
- public String getDme2preferredRouterFilePath() {
- return dme2preferredRouterFilePath;
- }
-
- public void setDme2preferredRouterFilePath(String dme2preferredRouterFilePath) {
- this.dme2preferredRouterFilePath = dme2preferredRouterFilePath;
- }
-
- public Credential getCredential() {
- return credential;
- }
-
- public void setCredential(Credential credential) {
- this.credential = credential;
- }
-
- public boolean isActive() { return active; }
-
- public void setActive(boolean isActive) { this.active = isActive; }
-
- /**
- * Contains Dmaap Client credential parameters: username and password
- */
- public static class Credential{
-
- private String username;
- private String password;
-
- public String getUsername() {
- return username;
- }
- public void setUsername(String username) {
- this.username = username;
- }
- public String getPassword() {
- return password;
- }
- public void setPassword(String password) {
- this.password = password;
- }
- @Override
- public String toString() {
- return "Credential [username=" + username + ", password=" + password + "]";
- }
-
- }
-
- @Override
- public String toString() {
- return "DmaapConsumerConfiguration [active=" + active + ", hosts=" + hosts + ", consumerGroup=" + consumerGroup + ", consumerId="
- + consumerId + ", timeoutMs=" + timeoutMs + ", limit=" + limit + ", pollingInterval=" + pollingInterval
- + ", topic=" + topic + ", latitude=" + latitude + ", longitude=" + longitude + ", version=" + version
- + ", serviceName=" + serviceName + ", environment=" + environment + ", partner=" + partner
- + ", routeOffer=" + routeOffer + ", protocol=" + protocol + ", contenttype=" + contenttype
- + ", dme2TraceOn=" + dme2TraceOn + ", aftEnvironment=" + aftEnvironment
- + ", aftDme2ConnectionTimeoutMs=" + aftDme2ConnectionTimeoutMs + ", aftDme2RoundtripTimeoutMs="
- + aftDme2RoundtripTimeoutMs + ", aftDme2ReadTimeoutMs=" + aftDme2ReadTimeoutMs
- + ", dme2preferredRouterFilePath=" + dme2preferredRouterFilePath
- + ", timeLimitForNotificationHandleMs=" + timeLimitForNotificationHandleMs+ ", credential=" + credential + "]";
- }
-
- public Integer getTimeLimitForNotificationHandleMs() {
- return timeLimitForNotificationHandleMs;
- }
-
- public void setTimeLimitForNotificationHandleMs(Integer timeLimitForNotificationHandleMs) {
- this.timeLimitForNotificationHandleMs = timeLimitForNotificationHandleMs;
- }
-
+ private boolean active;
+ private String hosts;
+ private String consumerGroup;
+ private String consumerId;
+ private Integer timeoutMs;
+ private Integer limit;
+ private Integer pollingInterval;
+ private String topic;
+ private Double latitude;
+ private Double longitude;
+ private String version;
+ private String serviceName;
+ private String environment;
+ private String partner;
+ private String routeOffer;
+ private String protocol;
+ private String contenttype;
+ private Boolean dme2TraceOn;
+ private String aftEnvironment;
+ private Integer aftDme2ConnectionTimeoutMs;
+ private Integer aftDme2RoundtripTimeoutMs;
+ private Integer aftDme2ReadTimeoutMs;
+ private String dme2preferredRouterFilePath;
+ private Credential credential;
+ private Integer timeLimitForNotificationHandleMs;
+
+ public String getHosts() {
+ return hosts;
+ }
+
+ public void setHosts(String hosts) {
+ this.hosts = hosts;
+ }
+
+ public String getConsumerGroup() {
+ return consumerGroup;
+ }
+
+ public void setConsumerGroup(String consumerGroup) {
+ this.consumerGroup = consumerGroup;
+ }
+
+ public String getConsumerId() {
+ return consumerId;
+ }
+
+ public void setConsumerId(String consumerId) {
+ this.consumerId = consumerId;
+ }
+
+ public Integer getTimeoutMs() {
+ return timeoutMs;
+ }
+
+ public void setTimeoutMs(Integer timeoutMs) {
+ this.timeoutMs = timeoutMs;
+ }
+
+ public Integer getLimit() {
+ return limit;
+ }
+
+ public void setLimit(Integer limit) {
+ this.limit = limit;
+ }
+
+ public Integer getPollingInterval() {
+ return pollingInterval;
+ }
+
+ public void setPollingInterval(Integer pollingInterval) {
+ this.pollingInterval = pollingInterval;
+ }
+
+ public String getTopic() {
+ return topic;
+ }
+
+ public void setTopic(String topic) {
+ this.topic = topic;
+ }
+
+ public Double getLatitude() {
+ return latitude;
+ }
+
+ public void setLatitude(Double latitude) {
+ this.latitude = latitude;
+ }
+
+ public Double getLongitude() {
+ return longitude;
+ }
+
+ public void setLongitude(Double longitude) {
+ this.longitude = longitude;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ public String getEnvironment() {
+ return environment;
+ }
+
+ public void setEnvironment(String environment) {
+ this.environment = environment;
+ }
+
+ public String getPartner() {
+ return partner;
+ }
+
+ public void setPartner(String partner) {
+ this.partner = partner;
+ }
+
+ public String getRouteOffer() {
+ return routeOffer;
+ }
+
+ public void setRouteOffer(String routeOffer) {
+ this.routeOffer = routeOffer;
+ }
+
+ public String getProtocol() {
+ return protocol;
+ }
+
+ public void setProtocol(String protocol) {
+ this.protocol = protocol;
+ }
+
+ public String getContenttype() {
+ return contenttype;
+ }
+
+ public void setContenttype(String contenttype) {
+ this.contenttype = contenttype;
+ }
+
+ public Boolean isDme2TraceOn() {
+ return dme2TraceOn;
+ }
+
+ public Boolean getDme2TraceOn() {
+ return dme2TraceOn;
+ }
+
+ public void setDme2TraceOn(Boolean dme2TraceOn) {
+ this.dme2TraceOn = dme2TraceOn;
+ }
+
+ public String getAftEnvironment() {
+ return aftEnvironment;
+ }
+
+ public void setAftEnvironment(String aftEnvironment) {
+ this.aftEnvironment = aftEnvironment;
+ }
+
+ public Integer getAftDme2ConnectionTimeoutMs() {
+ return aftDme2ConnectionTimeoutMs;
+ }
+
+ public void setAftDme2ConnectionTimeoutMs(Integer aftDme2ConnectionTimeoutMs) {
+ this.aftDme2ConnectionTimeoutMs = aftDme2ConnectionTimeoutMs;
+ }
+
+ public Integer getAftDme2RoundtripTimeoutMs() {
+ return aftDme2RoundtripTimeoutMs;
+ }
+
+ public void setAftDme2RoundtripTimeoutMs(Integer aftDme2RoundtripTimeoutMs) {
+ this.aftDme2RoundtripTimeoutMs = aftDme2RoundtripTimeoutMs;
+ }
+
+ public Integer getAftDme2ReadTimeoutMs() {
+ return aftDme2ReadTimeoutMs;
+ }
+
+ public void setAftDme2ReadTimeoutMs(Integer aftDme2ReadTimeoutMs) {
+ this.aftDme2ReadTimeoutMs = aftDme2ReadTimeoutMs;
+ }
+
+ public String getDme2preferredRouterFilePath() {
+ return dme2preferredRouterFilePath;
+ }
+
+ public void setDme2preferredRouterFilePath(String dme2preferredRouterFilePath) {
+ this.dme2preferredRouterFilePath = dme2preferredRouterFilePath;
+ }
+
+ public Credential getCredential() {
+ return credential;
+ }
+
+ public void setCredential(Credential credential) {
+ this.credential = credential;
+ }
+
+ public boolean isActive() {
+ return active;
+ }
+
+ public void setActive(boolean isActive) {
+ this.active = isActive;
+ }
+
+ /**
+ * Contains Dmaap Client credential parameters: username and password
+ */
+ public static class Credential {
+
+ private String username;
+ private String password;
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ @Override
+ public String toString() {
+ return "Credential [username=" + username + ", password=" + password + "]";
+ }
+
+ }
+
+ @Override
+ public String toString() {
+ return "DmaapConsumerConfiguration [active=" + active + ", hosts=" + hosts + ", consumerGroup=" + consumerGroup + ", consumerId="
+ + consumerId + ", timeoutMs=" + timeoutMs + ", limit=" + limit + ", pollingInterval=" + pollingInterval
+ + ", topic=" + topic + ", latitude=" + latitude + ", longitude=" + longitude + ", version=" + version
+ + ", serviceName=" + serviceName + ", environment=" + environment + ", partner=" + partner
+ + ", routeOffer=" + routeOffer + ", protocol=" + protocol + ", contenttype=" + contenttype
+ + ", dme2TraceOn=" + dme2TraceOn + ", aftEnvironment=" + aftEnvironment
+ + ", aftDme2ConnectionTimeoutMs=" + aftDme2ConnectionTimeoutMs + ", aftDme2RoundtripTimeoutMs="
+ + aftDme2RoundtripTimeoutMs + ", aftDme2ReadTimeoutMs=" + aftDme2ReadTimeoutMs
+ + ", dme2preferredRouterFilePath=" + dme2preferredRouterFilePath
+ + ", timeLimitForNotificationHandleMs=" + timeLimitForNotificationHandleMs + ", credential=" + credential + "]";
+ }
+
+ public Integer getTimeLimitForNotificationHandleMs() {
+ return timeLimitForNotificationHandleMs;
+ }
+
+ public void setTimeLimitForNotificationHandleMs(Integer timeLimitForNotificationHandleMs) {
+ this.timeLimitForNotificationHandleMs = timeLimitForNotificationHandleMs;
+ }
+
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/be/config/DmeConfiguration.java b/common-app-api/src/main/java/org/openecomp/sdc/be/config/DmeConfiguration.java
index 796127d4e2..4e553fdd8d 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/be/config/DmeConfiguration.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/be/config/DmeConfiguration.java
@@ -7,9 +7,9 @@
* 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.
@@ -21,27 +21,27 @@
package org.openecomp.sdc.be.config;
public class DmeConfiguration {
- private String dme2Search = "DME2SEARCH";
- private String dme2Resolve = "DME2RESOLVE";
-
- public String getDme2Search() {
- return dme2Search;
- }
-
- public void setDme2Search(String dme2Search) {
- this.dme2Search = dme2Search;
- }
-
- public String getDme2Resolve() {
- return dme2Resolve;
- }
-
- public void setDme2Resolve(String dme2Resolve) {
- this.dme2Resolve = dme2Resolve;
- }
-
- @Override
- public String toString() {
- return "DmeConfiguration [dme2Search=" + dme2Search + ", dme2Resolve=" + dme2Resolve + "]";
- }
+ private String dme2Search = "DME2SEARCH";
+ private String dme2Resolve = "DME2RESOLVE";
+
+ public String getDme2Search() {
+ return dme2Search;
+ }
+
+ public void setDme2Search(String dme2Search) {
+ this.dme2Search = dme2Search;
+ }
+
+ public String getDme2Resolve() {
+ return dme2Resolve;
+ }
+
+ public void setDme2Resolve(String dme2Resolve) {
+ this.dme2Resolve = dme2Resolve;
+ }
+
+ @Override
+ public String toString() {
+ return "DmeConfiguration [dme2Search=" + dme2Search + ", dme2Resolve=" + dme2Resolve + "]";
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/be/config/ErrorConfiguration.java b/common-app-api/src/main/java/org/openecomp/sdc/be/config/ErrorConfiguration.java
index 52ea02cfab..3b7efbabf4 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/be/config/ErrorConfiguration.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/be/config/ErrorConfiguration.java
@@ -7,9 +7,9 @@
* 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.
@@ -26,29 +26,29 @@ import java.util.Map;
public class ErrorConfiguration extends BasicConfiguration {
- private Map<String, ErrorInfo> errors;
-
- public Map<String, ErrorInfo> getErrors() {
- return errors;
- }
-
- public void setErrors(Map<String, ErrorInfo> errors) {
- this.errors = errors;
- }
-
- public ErrorInfo getErrorInfo(String key) {
- ErrorInfo clone = null;
- ErrorInfo other = errors.get(key);
- if (other != null) {
- clone = new ErrorInfo();
- clone.cloneData(other);
- }
- return clone;
- }
-
- @Override
- public String toString() {
- return "ErrorConfiguration [errors=" + errors + "]";
- }
+ private Map<String, ErrorInfo> errors;
+
+ public Map<String, ErrorInfo> getErrors() {
+ return errors;
+ }
+
+ public void setErrors(Map<String, ErrorInfo> errors) {
+ this.errors = errors;
+ }
+
+ public ErrorInfo getErrorInfo(String key) {
+ ErrorInfo clone = null;
+ ErrorInfo other = errors.get(key);
+ if (other != null) {
+ clone = new ErrorInfo();
+ clone.cloneData(other);
+ }
+ return clone;
+ }
+
+ @Override
+ public String toString() {
+ return "ErrorConfiguration [errors=" + errors + "]";
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/be/config/ErrorInfo.java b/common-app-api/src/main/java/org/openecomp/sdc/be/config/ErrorInfo.java
index ec9a61c81f..0846fc7083 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/be/config/ErrorInfo.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/be/config/ErrorInfo.java
@@ -7,9 +7,9 @@
* 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.
@@ -24,76 +24,76 @@ import org.openecomp.sdc.common.log.wrappers.Logger;
public class ErrorInfo {
- private Integer code;
- private String message;
- private String messageId;
- private ErrorInfoType errorInfoType;
-
- private static final String SVC_PREFIX = "SVC";
- private static final String POL_PREFIX = "POL";
-
- private static Logger log = Logger.getLogger(ErrorInfo.class.getName());
-
- public ErrorInfo() {
- this.errorInfoType = ErrorInfoType.OK;
- }
-
- public Integer getCode() {
- return code;
- }
-
- public void setCode(Integer code) {
- this.code = code;
- }
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- public String getMessageId() {
- return messageId;
- }
-
- public void setMessageId(String messageId) {
- // Determining the type of error
- if (messageId == null) {
- this.errorInfoType = ErrorInfoType.OK;
- } else if (messageId.startsWith(SVC_PREFIX)) {
- this.errorInfoType = ErrorInfoType.SERVICE_EXCEPTION;
- } else if (messageId.startsWith(POL_PREFIX)) {
- this.errorInfoType = ErrorInfoType.POLICY_EXCEPTION;
- } else {
- // unexpected - should it fail the startup?
- BeEcompErrorManager.getInstance().logErrorConfigFileFormat("Error Info",
- "Could not set error info type for message id " + messageId);
- log.debug("Error: unexpected error message ID {}, should start with {} or {}", messageId, SVC_PREFIX,
- POL_PREFIX);
- }
- this.messageId = messageId;
- }
-
- public ErrorInfoType getErrorInfoType() {
- return this.errorInfoType;
- }
-
- public void cloneData(ErrorInfo other) {
- this.code = other.getCode();
- this.message = other.getMessage();
- this.messageId = other.getMessageId();
- this.errorInfoType = other.errorInfoType;
- }
-
- @Override
- public String toString() {
- return "ErrorInfo [code=" + code + ", messageId=" + messageId + ", message=" + message + "]";
- }
-
- public enum ErrorInfoType {
- OK, POLICY_EXCEPTION, SERVICE_EXCEPTION
- }
+ private Integer code;
+ private String message;
+ private String messageId;
+ private ErrorInfoType errorInfoType;
+
+ private static final String SVC_PREFIX = "SVC";
+ private static final String POL_PREFIX = "POL";
+
+ private static Logger log = Logger.getLogger(ErrorInfo.class.getName());
+
+ public ErrorInfo() {
+ this.errorInfoType = ErrorInfoType.OK;
+ }
+
+ public Integer getCode() {
+ return code;
+ }
+
+ public void setCode(Integer code) {
+ this.code = code;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public String getMessageId() {
+ return messageId;
+ }
+
+ public void setMessageId(String messageId) {
+ // Determining the type of error
+ if (messageId == null) {
+ this.errorInfoType = ErrorInfoType.OK;
+ } else if (messageId.startsWith(SVC_PREFIX)) {
+ this.errorInfoType = ErrorInfoType.SERVICE_EXCEPTION;
+ } else if (messageId.startsWith(POL_PREFIX)) {
+ this.errorInfoType = ErrorInfoType.POLICY_EXCEPTION;
+ } else {
+ // unexpected - should it fail the startup?
+ BeEcompErrorManager.getInstance().logErrorConfigFileFormat("Error Info",
+ "Could not set error info type for message id " + messageId);
+ log.debug("Error: unexpected error message ID {}, should start with {} or {}", messageId, SVC_PREFIX,
+ POL_PREFIX);
+ }
+ this.messageId = messageId;
+ }
+
+ public ErrorInfoType getErrorInfoType() {
+ return this.errorInfoType;
+ }
+
+ public void cloneData(ErrorInfo other) {
+ this.code = other.getCode();
+ this.message = other.getMessage();
+ this.messageId = other.getMessageId();
+ this.errorInfoType = other.errorInfoType;
+ }
+
+ @Override
+ public String toString() {
+ return "ErrorInfo [code=" + code + ", messageId=" + messageId + ", message=" + message + "]";
+ }
+
+ public enum ErrorInfoType {
+ OK, POLICY_EXCEPTION, SERVICE_EXCEPTION
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/be/config/Neo4jErrorsConfiguration.java b/common-app-api/src/main/java/org/openecomp/sdc/be/config/Neo4jErrorsConfiguration.java
index 02965242cf..7dc8dc8f26 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/be/config/Neo4jErrorsConfiguration.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/be/config/Neo4jErrorsConfiguration.java
@@ -7,9 +7,9 @@
* 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.
@@ -25,23 +25,23 @@ import org.openecomp.sdc.common.api.BasicConfiguration;
import java.util.Map;
public class Neo4jErrorsConfiguration extends BasicConfiguration {
- private Map<String, String> errors;
+ private Map<String, String> errors;
- public Map<String, String> getErrors() {
- return errors;
- }
+ public Map<String, String> getErrors() {
+ return errors;
+ }
- public void setErrors(Map<String, String> errors) {
- this.errors = errors;
- }
+ public void setErrors(Map<String, String> errors) {
+ this.errors = errors;
+ }
- public String getErrorMessage(String key) {
- return errors.get(key);
- }
+ public String getErrorMessage(String key) {
+ return errors.get(key);
+ }
- @Override
- public String toString() {
- return "Neo4jErrorsConfiguration [errors=" + errors + "]";
- }
+ @Override
+ public String toString() {
+ return "Neo4jErrorsConfiguration [errors=" + errors + "]";
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/be/config/validation/DeploymentArtifactHeatConfiguration.java b/common-app-api/src/main/java/org/openecomp/sdc/be/config/validation/DeploymentArtifactHeatConfiguration.java
index 72b53bac75..88bab26d7c 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/be/config/validation/DeploymentArtifactHeatConfiguration.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/be/config/validation/DeploymentArtifactHeatConfiguration.java
@@ -7,9 +7,9 @@
* 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.
@@ -24,34 +24,33 @@ import java.util.Map;
/**
* Currently for deployment artifacts HEAT validation only.
- *
+ *
* Other artifacts might require different fields validation Be sure to check it
* before you re-use this class
- *
- * @author paharoni
*
+ * @author paharoni
*/
public class DeploymentArtifactHeatConfiguration {
- // All the rest of heat file is not needed for now...
- String heat_template_version;
+ // All the rest of heat file is not needed for now...
+ private String heat_template_version;
- Map<String, Object> resources;
+ private Map<String, Object> resources;
- public String getHeat_template_version() {
- return heat_template_version;
- }
+ public String getHeat_template_version() {
+ return heat_template_version;
+ }
- public void setHeat_template_version(String heat_template_version) {
- this.heat_template_version = heat_template_version;
- }
+ public void setHeat_template_version(String heat_template_version) {
+ this.heat_template_version = heat_template_version;
+ }
- public Map<String, Object> getResources() {
- return resources;
- }
+ public Map<String, Object> getResources() {
+ return resources;
+ }
- public void setResources(Map<String, Object> resources) {
- this.resources = resources;
- }
+ public void setResources(Map<String, Object> resources) {
+ this.resources = resources;
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/be/monitoring/BeMonitoringService.java b/common-app-api/src/main/java/org/openecomp/sdc/be/monitoring/BeMonitoringService.java
index c29574dd1b..0117b2be9e 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/be/monitoring/BeMonitoringService.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/be/monitoring/BeMonitoringService.java
@@ -7,9 +7,9 @@
* 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.
@@ -46,64 +46,64 @@ import java.util.concurrent.TimeUnit;
public class BeMonitoringService {
- private static final String URL = "%s://%s:%s/sdc2/rest/monitoring";
- private static Logger monitoringLogger = Logger.getLogger("asdc.be.monitoring.service");
- private static Logger log = Logger.getLogger(BeMonitoringService.class.getName());
- private static Gson gson = new GsonBuilder().setPrettyPrinting().create();
+ private static final String URL = "%s://%s:%s/sdc2/rest/monitoring";
+ private static Logger monitoringLogger = Logger.getLogger("asdc.be.monitoring.service");
+ private static Logger log = Logger.getLogger(BeMonitoringService.class.getName());
+ private static Gson gson = new GsonBuilder().setPrettyPrinting().create();
- private class MonitoringScheduledTask implements Runnable {
- @Override
- public void run() {
- monitoringLogger.trace("Executing BE Monitoring Task - Start");
- MonitoringEvent monitoringMetrics = MonitoringMetricsFetcher.getInstance().getMonitoringMetrics();
- processMonitoringEvent(monitoringMetrics);
- monitoringLogger.trace("Executing BE Monitoring Task - Status = {}", monitoringMetrics.toString());
- }
- }
+ private class MonitoringScheduledTask implements Runnable {
+ @Override
+ public void run() {
+ monitoringLogger.trace("Executing BE Monitoring Task - Start");
+ MonitoringEvent monitoringMetrics = MonitoringMetricsFetcher.getInstance().getMonitoringMetrics();
+ processMonitoringEvent(monitoringMetrics);
+ monitoringLogger.trace("Executing BE Monitoring Task - Status = {}", monitoringMetrics.toString());
+ }
+ }
- /**
- * This executor will execute the Monitoring task.
- */
- ScheduledExecutorService monitoringExecutor = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() {
- @Override
- public Thread newThread(Runnable r) {
- return new Thread(r, "BE-Monitoring-Thread");
- }
- });
- private ServletContext context;
+ /**
+ * This executor will execute the Monitoring task.
+ */
+ private ScheduledExecutorService monitoringExecutor = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() {
+ @Override
+ public Thread newThread(Runnable r) {
+ return new Thread(r, "BE-Monitoring-Thread");
+ }
+ });
+ private ServletContext context;
- public BeMonitoringService(ServletContext context) {
- this.context = context;
- }
+ public BeMonitoringService(ServletContext context) {
+ this.context = context;
+ }
- public void start(int interval) {
- Configuration config = ((ConfigurationManager) context.getAttribute(Constants.CONFIGURATION_MANAGER_ATTR))
- .getConfiguration();
- if (config.getSystemMonitoring().getEnabled()) {
- log.info("BE monitoring service is enabled, interval is {} seconds", interval);
- this.monitoringExecutor.scheduleAtFixedRate(new MonitoringScheduledTask(), 0, interval, TimeUnit.SECONDS);
- } else {
- log.info("BE monitoring service is disabled");
- }
- }
+ public void start(int interval) {
+ Configuration config = ((ConfigurationManager) context.getAttribute(Constants.CONFIGURATION_MANAGER_ATTR))
+ .getConfiguration();
+ if (config.getSystemMonitoring().getEnabled()) {
+ log.info("BE monitoring service is enabled, interval is {} seconds", interval);
+ this.monitoringExecutor.scheduleAtFixedRate(new MonitoringScheduledTask(), 0, interval, TimeUnit.SECONDS);
+ } else {
+ log.info("BE monitoring service is disabled");
+ }
+ }
- private void processMonitoringEvent(MonitoringEvent monitoringMetrics) {
- try {
- Configuration config = ((ConfigurationManager) context.getAttribute(Constants.CONFIGURATION_MANAGER_ATTR))
- .getConfiguration();
- String redirectedUrl = String.format(URL, config.getBeProtocol(), config.getBeFqdn(),
- config.getBeHttpPort());
+ private void processMonitoringEvent(MonitoringEvent monitoringMetrics) {
+ try {
+ Configuration config = ((ConfigurationManager) context.getAttribute(Constants.CONFIGURATION_MANAGER_ATTR))
+ .getConfiguration();
+ String redirectedUrl = String.format(URL, config.getBeProtocol(), config.getBeFqdn(),
+ config.getBeHttpPort());
- final int timeout = 3000;
- String monitoringMetricsJson = gson.toJson(monitoringMetrics);
- HttpEntity myEntity = new StringEntity(monitoringMetricsJson, ContentType.APPLICATION_JSON);
- HttpResponse<String> httpResponse = HttpRequest.post(redirectedUrl, myEntity, new HttpClientConfig(new Timeouts(timeout, timeout)));
+ final int timeout = 3000;
+ String monitoringMetricsJson = gson.toJson(monitoringMetrics);
+ HttpEntity myEntity = new StringEntity(monitoringMetricsJson, ContentType.APPLICATION_JSON);
+ HttpResponse<String> httpResponse = HttpRequest.post(redirectedUrl, myEntity, new HttpClientConfig(new Timeouts(timeout, timeout)));
int beResponseStatus = httpResponse.getStatusCode();
if (beResponseStatus != HttpStatus.SC_OK) {
- monitoringLogger.error(EcompLoggerErrorCode.UNKNOWN_ERROR,"","","Unexpected HTTP response from BE : {}", beResponseStatus);
+ monitoringLogger.error(EcompLoggerErrorCode.UNKNOWN_ERROR, "", "", "Unexpected HTTP response from BE : {}", beResponseStatus);
}
- } catch (Exception e) {
- monitoringLogger.error(EcompLoggerErrorCode.UNKNOWN_ERROR,"","","Monitoring BE failed with exception ", e);
- }
- }
+ } catch (Exception e) {
+ monitoringLogger.error(EcompLoggerErrorCode.UNKNOWN_ERROR, "", "", "Monitoring BE failed with exception ", e);
+ }
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/api/ApplicationErrorCodesEnum.java b/common-app-api/src/main/java/org/openecomp/sdc/common/api/ApplicationErrorCodesEnum.java
index fa0f30842b..2127441cb7 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/api/ApplicationErrorCodesEnum.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/api/ApplicationErrorCodesEnum.java
@@ -7,9 +7,9 @@
* 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.
@@ -22,16 +22,16 @@ package org.openecomp.sdc.common.api;
public enum ApplicationErrorCodesEnum {
- POL5000, // INTERNAL_ERROR
+ POL5000, // INTERNAL_ERROR
- SVC4000, // INVALID_INPUT
+ SVC4000, // INVALID_INPUT
- SVC4002, // MISSING_INFORMATION
- SVC4003, // RESOURCE_NAME_ALREADY_EXIST
- SVC4004, // MISSING_CATEGORY
- SVC4005, // MISSING_TAGS
- SVC4006, // MISSING_DESCRIPTION
- SVC4007, // BAD_CATEGORY
+ SVC4002, // MISSING_INFORMATION
+ SVC4003, // RESOURCE_NAME_ALREADY_EXIST
+ SVC4004, // MISSING_CATEGORY
+ SVC4005, // MISSING_TAGS
+ SVC4006, // MISSING_DESCRIPTION
+ SVC4007, // BAD_CATEGORY
- SVC4030; // RESTRICTED_ACTION
+ SVC4030; // RESTRICTED_ACTION
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/api/ArtifactGroupTypeEnum.java b/common-app-api/src/main/java/org/openecomp/sdc/common/api/ArtifactGroupTypeEnum.java
index c990d43f64..d3107e0117 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/api/ArtifactGroupTypeEnum.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/api/ArtifactGroupTypeEnum.java
@@ -7,9 +7,9 @@
* 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.
@@ -25,37 +25,37 @@ import java.util.List;
public enum ArtifactGroupTypeEnum {
- INFORMATIONAL("INFORMATIONAL"), DEPLOYMENT("DEPLOYMENT"), LIFE_CYCLE("LIFE_CYCLE"), SERVICE_API("SERVICE_API"), TOSCA("TOSCA"), OTHER("OTHER");
-
- private String type;
-
- ArtifactGroupTypeEnum(String type) {
- this.type = type;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public static ArtifactGroupTypeEnum findType(final String type) {
- for (ArtifactGroupTypeEnum ate : ArtifactGroupTypeEnum.values()) {
- if (ate.getType().equals(type)) {
- return ate;
- }
- }
- return null;
- }
-
- public static List<String> getAllTypes() {
- List<String> types = new ArrayList<>();
- for (ArtifactGroupTypeEnum ate : ArtifactGroupTypeEnum.values()) {
- types.add(ate.getType());
- }
- return types;
- }
+ INFORMATIONAL("INFORMATIONAL"), DEPLOYMENT("DEPLOYMENT"), LIFE_CYCLE("LIFE_CYCLE"), SERVICE_API("SERVICE_API"), TOSCA("TOSCA"), OTHER("OTHER");
+
+ private String type;
+
+ ArtifactGroupTypeEnum(String type) {
+ this.type = type;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public static ArtifactGroupTypeEnum findType(final String type) {
+ for (ArtifactGroupTypeEnum ate : ArtifactGroupTypeEnum.values()) {
+ if (ate.getType().equals(type)) {
+ return ate;
+ }
+ }
+ return null;
+ }
+
+ public static List<String> getAllTypes() {
+ List<String> types = new ArrayList<>();
+ for (ArtifactGroupTypeEnum ate : ArtifactGroupTypeEnum.values()) {
+ types.add(ate.getType());
+ }
+ return types;
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/api/ArtifactTypeEnum.java b/common-app-api/src/main/java/org/openecomp/sdc/common/api/ArtifactTypeEnum.java
index db40a6ccb6..125cc68707 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/api/ArtifactTypeEnum.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/api/ArtifactTypeEnum.java
@@ -7,9 +7,9 @@
* 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.
@@ -25,53 +25,52 @@ import java.util.List;
/**
* Enum That Represents possible Artifacts Types.
- *
*/
public enum ArtifactTypeEnum {
- CHEF("CHEF"), PUPPET("PUPPET"), YANG("YANG"), SHELL_SCRIPT("SHELL_SCRIPT"), SHELL("SHELL"), ICON("ICON"), UNKNOWN("UNKNOWN"), HEAT("HEAT"), DG_XML("DG_XML"), MURANO_PKG("MURANO_PKG"), HEAT_ENV("HEAT_ENV"), YANG_XML("YANG_XML"), HEAT_VOL("HEAT_VOL"),
- HEAT_NET("HEAT_NET"), OTHER("OTHER"), WORKFLOW("WORKFLOW"), NETWORK_CALL_FLOW("NETWORK_CALL_FLOW"), TOSCA_TEMPLATE("TOSCA_TEMPLATE"), TOSCA_CSAR("TOSCA_CSAR"), VNF_CATALOG("VNF_CATALOG"), VF_LICENSE("VF_LICENSE"), BPEL("BPEL"),
- VENDOR_LICENSE("VENDOR_LICENSE"), MODEL_INVENTORY_PROFILE("MODEL_INVENTORY_PROFILE"), MODEL_QUERY_SPEC("MODEL_QUERY_SPEC"), APPC_CONFIG("APPC_CONFIG"), HEAT_NESTED("HEAT_NESTED"), HEAT_ARTIFACT("HEAT_ARTIFACT"), CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT("CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT"),
- VF_MODULES_METADATA("VF_MODULES_METADATA"), LIFECYCLE_OPERATIONS("LIFECYCLE_OPERATIONS"), VES_EVENTS("VES_EVENTS"), PERFORMANCE_COUNTER("PERFORMANCE_COUNTER"),UCPE_LAYER_2_CONFIGURATION("UCPE_LAYER_2_CONFIGURATION"),
- CONTROLLER_BLUEPRINT_ARCHIVE("CONTROLLER_BLUEPRINT_ARCHIVE"),
- // DCAE Artifacts
- DCAE_TOSCA("DCAE_TOSCA"), DCAE_JSON("DCAE_JSON"), DCAE_POLICY("DCAE_POLICY"), DCAE_DOC("DCAE_DOC"), DCAE_EVENT("DCAE_EVENT"), DCAE_INVENTORY_TOSCA("DCAE_INVENTORY_TOSCA"), DCAE_INVENTORY_JSON("DCAE_INVENTORY_JSON"),
- DCAE_INVENTORY_POLICY("DCAE_INVENTORY_POLICY"), DCAE_INVENTORY_DOC("DCAE_INVENTORY_DOC"), DCAE_INVENTORY_BLUEPRINT("DCAE_INVENTORY_BLUEPRINT"), DCAE_INVENTORY_EVENT("DCAE_INVENTORY_EVENT"),
- // AAI Artifacts
- AAI_SERVICE_MODEL("AAI_SERVICE_MODEL"), AAI_VF_MODEL("AAI_VF_MODEL"), AAI_VF_MODULE_MODEL("AAI_VF_MODULE_MODEL"), AAI_VF_INSTANCE_MODEL("AAI_VF_INSTANCE_MODEL"),
- // MIB artifacts
- SNMP_POLL ("SNMP_POLL"), SNMP_TRAP("SNMP_TRAP"), GUIDE("GUIDE"),
- PLAN("PLAN"), PM_DICTIONARY("PM_DICTIONARY"), YANG_MODULE("YANG_MODULE"),
- ANSIBLE_PLAYBOOK("ANSIBLE_PLAYBOOK"), ONBOARDED_PACKAGE("ONBOARDED_PACKAGE");
+ CHEF("CHEF"), PUPPET("PUPPET"), YANG("YANG"), SHELL_SCRIPT("SHELL_SCRIPT"), SHELL("SHELL"), ICON("ICON"), UNKNOWN("UNKNOWN"), HEAT("HEAT"), DG_XML("DG_XML"), MURANO_PKG("MURANO_PKG"), HEAT_ENV("HEAT_ENV"), YANG_XML("YANG_XML"), HEAT_VOL("HEAT_VOL"),
+ HEAT_NET("HEAT_NET"), OTHER("OTHER"), WORKFLOW("WORKFLOW"), NETWORK_CALL_FLOW("NETWORK_CALL_FLOW"), TOSCA_TEMPLATE("TOSCA_TEMPLATE"), TOSCA_CSAR("TOSCA_CSAR"), VNF_CATALOG("VNF_CATALOG"), VF_LICENSE("VF_LICENSE"), BPEL("BPEL"),
+ VENDOR_LICENSE("VENDOR_LICENSE"), MODEL_INVENTORY_PROFILE("MODEL_INVENTORY_PROFILE"), MODEL_QUERY_SPEC("MODEL_QUERY_SPEC"), APPC_CONFIG("APPC_CONFIG"), HEAT_NESTED("HEAT_NESTED"), HEAT_ARTIFACT("HEAT_ARTIFACT"), CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT("CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT"),
+ VF_MODULES_METADATA("VF_MODULES_METADATA"), LIFECYCLE_OPERATIONS("LIFECYCLE_OPERATIONS"), VES_EVENTS("VES_EVENTS"), PERFORMANCE_COUNTER("PERFORMANCE_COUNTER"), UCPE_LAYER_2_CONFIGURATION("UCPE_LAYER_2_CONFIGURATION"),
+ CONTROLLER_BLUEPRINT_ARCHIVE("CONTROLLER_BLUEPRINT_ARCHIVE"),
+ // DCAE Artifacts
+ DCAE_TOSCA("DCAE_TOSCA"), DCAE_JSON("DCAE_JSON"), DCAE_POLICY("DCAE_POLICY"), DCAE_DOC("DCAE_DOC"), DCAE_EVENT("DCAE_EVENT"), DCAE_INVENTORY_TOSCA("DCAE_INVENTORY_TOSCA"), DCAE_INVENTORY_JSON("DCAE_INVENTORY_JSON"),
+ DCAE_INVENTORY_POLICY("DCAE_INVENTORY_POLICY"), DCAE_INVENTORY_DOC("DCAE_INVENTORY_DOC"), DCAE_INVENTORY_BLUEPRINT("DCAE_INVENTORY_BLUEPRINT"), DCAE_INVENTORY_EVENT("DCAE_INVENTORY_EVENT"),
+ // AAI Artifacts
+ AAI_SERVICE_MODEL("AAI_SERVICE_MODEL"), AAI_VF_MODEL("AAI_VF_MODEL"), AAI_VF_MODULE_MODEL("AAI_VF_MODULE_MODEL"), AAI_VF_INSTANCE_MODEL("AAI_VF_INSTANCE_MODEL"),
+ // MIB artifacts
+ SNMP_POLL("SNMP_POLL"), SNMP_TRAP("SNMP_TRAP"), GUIDE("GUIDE"),
+ PLAN("PLAN"), PM_DICTIONARY("PM_DICTIONARY"), YANG_MODULE("YANG_MODULE"),
+ ANSIBLE_PLAYBOOK("ANSIBLE_PLAYBOOK"), ONBOARDED_PACKAGE("ONBOARDED_PACKAGE");
- private String type;
+ private String type;
- ArtifactTypeEnum(String type) {
- this.type = type;
- }
+ ArtifactTypeEnum(String type) {
+ this.type = type;
+ }
- public String getType() {
- return type;
- }
+ public String getType() {
+ return type;
+ }
- public void setType(String type) {
- this.type = type;
- }
+ public void setType(String type) {
+ this.type = type;
+ }
- public static ArtifactTypeEnum findType(final String type) {
- for (ArtifactTypeEnum ate : ArtifactTypeEnum.values()) {
- // According to Pavel/Ella
- if (ate.getType().equalsIgnoreCase(type)) {
- return ate;
- }
- }
- return null;
- }
+ public static ArtifactTypeEnum findType(final String type) {
+ for (ArtifactTypeEnum ate : ArtifactTypeEnum.values()) {
+ // According to Pavel/Ella
+ if (ate.getType().equalsIgnoreCase(type)) {
+ return ate;
+ }
+ }
+ return null;
+ }
- public static List<String> getAllTypes() {
- List<String> types = new ArrayList<>();
- for (ArtifactTypeEnum ate : ArtifactTypeEnum.values()) {
- types.add(ate.getType());
- }
- return types;
- }
+ public static List<String> getAllTypes() {
+ List<String> types = new ArrayList<>();
+ for (ArtifactTypeEnum ate : ArtifactTypeEnum.values()) {
+ types.add(ate.getType());
+ }
+ return types;
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/api/BasicConfiguration.java b/common-app-api/src/main/java/org/openecomp/sdc/common/api/BasicConfiguration.java
index 5152b2af26..271fbb7a96 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/api/BasicConfiguration.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/api/BasicConfiguration.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/api/ConfigurationListener.java b/common-app-api/src/main/java/org/openecomp/sdc/common/api/ConfigurationListener.java
index d60ed6dabc..360562b91a 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/api/ConfigurationListener.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/api/ConfigurationListener.java
@@ -7,9 +7,9 @@
* 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.
@@ -22,29 +22,29 @@ package org.openecomp.sdc.common.api;
public class ConfigurationListener {
- private Class<? extends BasicConfiguration> type;
- private FileChangeCallback callBack;
+ private Class<? extends BasicConfiguration> type;
+ private FileChangeCallback callBack;
- public ConfigurationListener(Class<? extends BasicConfiguration> type, FileChangeCallback callBack) {
- super();
- this.type = type;
- this.callBack = callBack;
- }
+ public ConfigurationListener(Class<? extends BasicConfiguration> type, FileChangeCallback callBack) {
+ super();
+ this.type = type;
+ this.callBack = callBack;
+ }
- public Class<? extends BasicConfiguration> getType() {
- return type;
- }
+ public Class<? extends BasicConfiguration> getType() {
+ return type;
+ }
- public void setType(Class<? extends BasicConfiguration> type) {
- this.type = type;
- }
+ public void setType(Class<? extends BasicConfiguration> type) {
+ this.type = type;
+ }
- public FileChangeCallback getCallBack() {
- return callBack;
- }
+ public FileChangeCallback getCallBack() {
+ return callBack;
+ }
- public void setCallBack(FileChangeCallback callBack) {
- this.callBack = callBack;
- }
+ public void setCallBack(FileChangeCallback callBack) {
+ this.callBack = callBack;
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/api/ConfigurationSource.java b/common-app-api/src/main/java/org/openecomp/sdc/common/api/ConfigurationSource.java
index 5901d1e267..a3d4179a41 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/api/ConfigurationSource.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/api/ConfigurationSource.java
@@ -7,9 +7,9 @@
* 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.
@@ -22,7 +22,7 @@ package org.openecomp.sdc.common.api;
public interface ConfigurationSource {
- public <T> T getAndWatchConfiguration(Class<T> className, ConfigurationListener configurationListener);
+ <T> T getAndWatchConfiguration(Class<T> className, ConfigurationListener configurationListener);
- public <T> void addWatchConfiguration(Class<T> className, ConfigurationListener configurationListener);
+ <T> void addWatchConfiguration(Class<T> className, ConfigurationListener configurationListener);
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/api/Constants.java b/common-app-api/src/main/java/org/openecomp/sdc/common/api/Constants.java
index 646c655bf0..0ced7ec648 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/api/Constants.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/api/Constants.java
@@ -7,9 +7,9 @@
* 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.
@@ -22,129 +22,130 @@ package org.openecomp.sdc.common.api;
public final class Constants {
- public static final String APPLICATION_NAME = "application-name";
- public static final String APPLICATION_VERSION = "application-version";
- public static final String CONFIG_HOME = "config.home";
- public static final String LOG_HOME = "log.home";
- public static final String YAML_SUFFIX = ".yaml";
- public static final String CONFIGURATION_SOURCE_ATTR = "configuration-source";
- public static final String MDC_APP_NAME = "APP_NAME";
- public static final String CONFIGURATION_MANAGER_ATTR = "configuration-manager";
- public static final String HEALTH_CHECK_SERVICE_ATTR = "healthCheckService";
- public static final String REST_CLIENT_ATTR = "rest-client";
- public static final String ARTIFACT_DAO_ATTR = "artifact-dao";
- public static final String UPLOAD_VALIDATORR_ATTR = "upload-validator";
- public static final String THREAD_EXECUTOR_ATTR = "thread-executor";
- public static final String ERROR_LOG_FORMAT = "EVENT = ARTIFACT_UPLOAD USER_ID=%s USER_NAME=%s ACCESS_IP=%s ACCESS_TYPE=%s RURL=%s SC=%d";
- public static final String FIRST_NAME_HEADER = "HTTP_CSP_FIRSTNAME";
- public static final String LAST_NAME_HEADER = "HTTP_CSP_LASTNAME";
- public static final String USER_ID_HEADER = "USER_ID";
- public static final String MD5_HEADER = "Content-MD5";
- public static final String CONTENT_LENGTH_HEADER = "Content-Length";
- public static final String CONTENT_DISPOSITION_HEADER = "Content-Disposition";
- public static final String CONTENT_TYPE_HEADER = "Content-Type";
- public static final String ORIGIN_HEADER = "HTTP_IV_REMOTE_ADDRESS";
- public static final String ACCESS_HEADER = "HTTP_CSP_WSTYPE";
- public static final String X_ECOMP_REQUEST_ID_HEADER = "X-ECOMP-RequestID";
- public static final String X_ECOMP_INSTANCE_ID_HEADER = "X-ECOMP-InstanceID";
- public static final String X_ECOMP_SERVICE_ID_HEADER = "X-ECOMP-ServiceID";
- public static final String X_TRANSACTION_ID_HEADER = "X-TransactionId";
- public static final String X_FROM_APP_ID = "X-FromAppId";
- public static final String HTTP = "http";
- public static final String HTTPS = "https";
- public static final String HTTP_IV_USER = "HTTP_IV_USER";
- public static final String A4C_CSAR_CONTEXT = "/rest/csars/";
- public static final String WEB_APPLICATION_CONTEXT_WRAPPER_ATTR = "web-application-context-wrapper";
- public static final String CATALOG_BE = "catalog-be";
- public static final String RESOURCE_SUPPORTED_VERSION = "0.0.1";
- public static final String ARTIFACT_ID_FORMAT = "%s:%s:%s"; // resourceName:resourceVersion:artifactName
- public static final String SERVICE_ARTIFACT_ID_FORMAT = "%s:%s:%s:%s"; // serviceName:serviceVersion:nodeTemplateName:artifactName
- public static final String CONTENT_DISPOSITION = "content-disposition";
- public static final String DOWNLOAD_ARTIFACT_LOGIC_ATTR = "downloadArtifactLogic";
- public static final String ASDC_RELEASE_VERSION_ATTR = "SDC-Version";
- public static final String YEAR = "year";
- public static final String MONTH = "month";
- public static final String DAY = "day";
- public static final String HOUR = "hour";
- public static final String MINUTE = "minute";
- public static final String NONE = "none";
- public static final String RESOURCE_OPERATION_MANAGER = "resourceOperationManager";
- public static final String PROPERTY_OPERATION_MANAGER = "propertyOperationManager";
- public static final String SERVICE_OPERATION_MANAGER = "serviceOperationManager";
- public static final String EMPTY_STRING = "";
- public static final String NULL_STRING = "null";
- public static final String DOUBLE_NULL_STRING = "null null";
- public static final String ECOMP_ERROR_MNGR_ATTR = "ecompErrorMngrAttr";
- public static final String AUTHORIZATION_HEADER = "Authorization";
- public static final String ACCEPT_HEADER = "Accept";
- public static final String STANDARD_INTERFACE_TYPE = "standard";
- public static final String MURANO_PKG_ARTIFACT_TYPE = "MURANO-PKG";
+ public static final String APPLICATION_NAME = "application-name";
+ public static final String APPLICATION_VERSION = "application-version";
+ public static final String CONFIG_HOME = "config.home";
+ public static final String LOG_HOME = "log.home";
+ public static final String YAML_SUFFIX = ".yaml";
+ public static final String CONFIGURATION_SOURCE_ATTR = "configuration-source";
+ public static final String MDC_APP_NAME = "APP_NAME";
+ public static final String CONFIGURATION_MANAGER_ATTR = "configuration-manager";
+ public static final String HEALTH_CHECK_SERVICE_ATTR = "healthCheckService";
+ public static final String REST_CLIENT_ATTR = "rest-client";
+ public static final String ARTIFACT_DAO_ATTR = "artifact-dao";
+ public static final String UPLOAD_VALIDATORR_ATTR = "upload-validator";
+ public static final String THREAD_EXECUTOR_ATTR = "thread-executor";
+ public static final String ERROR_LOG_FORMAT = "EVENT = ARTIFACT_UPLOAD USER_ID=%s USER_NAME=%s ACCESS_IP=%s ACCESS_TYPE=%s RURL=%s SC=%d";
+ public static final String FIRST_NAME_HEADER = "HTTP_CSP_FIRSTNAME";
+ public static final String LAST_NAME_HEADER = "HTTP_CSP_LASTNAME";
+ public static final String USER_ID_HEADER = "USER_ID";
+ public static final String MD5_HEADER = "Content-MD5";
+ public static final String CONTENT_LENGTH_HEADER = "Content-Length";
+ public static final String CONTENT_DISPOSITION_HEADER = "Content-Disposition";
+ public static final String CONTENT_TYPE_HEADER = "Content-Type";
+ public static final String ORIGIN_HEADER = "HTTP_IV_REMOTE_ADDRESS";
+ public static final String ACCESS_HEADER = "HTTP_CSP_WSTYPE";
+ public static final String X_ECOMP_REQUEST_ID_HEADER = "X-ECOMP-RequestID";
+ public static final String X_ECOMP_INSTANCE_ID_HEADER = "X-ECOMP-InstanceID";
+ public static final String X_ECOMP_SERVICE_ID_HEADER = "X-ECOMP-ServiceID";
+ public static final String X_TRANSACTION_ID_HEADER = "X-TransactionId";
+ public static final String X_FROM_APP_ID = "X-FromAppId";
+ public static final String HTTP = "http";
+ public static final String HTTPS = "https";
+ public static final String HTTP_IV_USER = "HTTP_IV_USER";
+ public static final String A4C_CSAR_CONTEXT = "/rest/csars/";
+ public static final String WEB_APPLICATION_CONTEXT_WRAPPER_ATTR = "web-application-context-wrapper";
+ public static final String CATALOG_BE = "catalog-be";
+ public static final String RESOURCE_SUPPORTED_VERSION = "0.0.1";
+ public static final String ARTIFACT_ID_FORMAT = "%s:%s:%s"; // resourceName:resourceVersion:artifactName
+ public static final String SERVICE_ARTIFACT_ID_FORMAT = "%s:%s:%s:%s"; // serviceName:serviceVersion:nodeTemplateName:artifactName
+ public static final String CONTENT_DISPOSITION = "content-disposition";
+ public static final String DOWNLOAD_ARTIFACT_LOGIC_ATTR = "downloadArtifactLogic";
+ public static final String ASDC_RELEASE_VERSION_ATTR = "SDC-Version";
+ public static final String YEAR = "year";
+ public static final String MONTH = "month";
+ public static final String DAY = "day";
+ public static final String HOUR = "hour";
+ public static final String MINUTE = "minute";
+ public static final String NONE = "none";
+ public static final String RESOURCE_OPERATION_MANAGER = "resourceOperationManager";
+ public static final String PROPERTY_OPERATION_MANAGER = "propertyOperationManager";
+ public static final String SERVICE_OPERATION_MANAGER = "serviceOperationManager";
+ public static final String EMPTY_STRING = "";
+ public static final String NULL_STRING = "null";
+ public static final String DOUBLE_NULL_STRING = "null null";
+ public static final String ECOMP_ERROR_MNGR_ATTR = "ecompErrorMngrAttr";
+ public static final String AUTHORIZATION_HEADER = "Authorization";
+ public static final String ACCEPT_HEADER = "Accept";
+ public static final String STANDARD_INTERFACE_TYPE = "standard";
+ public static final String MURANO_PKG_ARTIFACT_TYPE = "MURANO-PKG";
- // TOSCA
- public static final String TOSCA_META_PATH = "TOSCA-Metadata/TOSCA.meta";
- public static final String TOSCA_META_ENTRY_DEFINITIONS = "Entry-Definitions";
- public static final String USER_DEFINED_RESOURCE_NAMESPACE_PREFIX = "org.openecomp.resource.";
+ // TOSCA
+ public static final String TOSCA_META_PATH = "TOSCA-Metadata/TOSCA.meta";
+ public static final String TOSCA_META_ENTRY_DEFINITIONS = "Entry-Definitions";
+ public static final String USER_DEFINED_RESOURCE_NAMESPACE_PREFIX = "org.openecomp.resource.";
- public static final String IS_BASE = "isBase";
- public static final String HEAT_FILE_PROPS = "heat_file";
- public static final String GROUP_POLICY_NAME_DELIMETER = "..";
- public static final String POLICY_UID_POSTFIX = ".policy";
- public static final String MODULE_NAME_FORMAT = "%s..%s..module-%s";
- public static final String MODULE_DESC_PATTERN = "[\\_\\-\\.a-zA-Z0-9]+";
- public static final String MODULE_OLD_NAME_PATTERN = "([\\w\\_\\-\\.\\s]+)(::module-)(\\d+)";
- public static final String MODULE_NEW_NAME_PATTERN = "([\\w\\_\\-\\.\\s]+\\.\\.)([\\_\\-\\.a-zA-Z0-9]+)(..module-)(\\d+)";
- public static final String MODULE_NAME_DELIMITER = "module-";
- public static final String IMPORT_STRUCTURE = "importStructure";
- public static final String DEFAULT_GROUP_VF_MODULE = "org.openecomp.groups.VfModule";
- public static final String GROUP_TOSCA_HEAT = "org.openecomp.groups.heat.HeatStack";
+ public static final String IS_BASE = "isBase";
+ public static final String HEAT_FILE_PROPS = "heat_file";
+ public static final String GROUP_POLICY_NAME_DELIMETER = "..";
+ public static final String POLICY_UID_POSTFIX = ".policy";
+ public static final String MODULE_NAME_FORMAT = "%s..%s..module-%s";
+ public static final String MODULE_DESC_PATTERN = "[\\_\\-\\.a-zA-Z0-9]+";
+ public static final String MODULE_OLD_NAME_PATTERN = "([\\w\\_\\-\\.\\s]+)(::module-)(\\d+)";
+ public static final String MODULE_NEW_NAME_PATTERN = "([\\w\\_\\-\\.\\s]+\\.\\.)([\\_\\-\\.a-zA-Z0-9]+)(..module-)(\\d+)";
+ public static final String MODULE_NAME_DELIMITER = "module-";
+ public static final String IMPORT_STRUCTURE = "importStructure";
+ public static final String DEFAULT_GROUP_VF_MODULE = "org.openecomp.groups.VfModule";
+ public static final String GROUP_TOSCA_HEAT = "org.openecomp.groups.heat.HeatStack";
- public static final String ARTIFACT_GROUP_TYPE = "artifactGroupType";
- public static final String ARTIFACT_LABEL = "artifactLabel";
- public static final String ARTIFACT_PAYLOAD_DATA = "payloadData";
- public static final String ARTIFACT_DISPLAY_NAME = "artifactDisplayName";
- public static final String ARTIFACT_DESCRIPTION = "description";
- public static final String ARTIFACT_TYPE = "artifactType";
- public static final String ARTIFACT_NAME = "artifactName";
- public static final String IS_FROM_CSAR = "isFromCsar";
- public static final String ARTIFACT_ID = "uniqueId";
- public static final String REQUIRED_ARTIFACTS = "requiredArtifacts";
- public static final String ARTIFACT_HEAT_PARAMS = "heatParameters";
- public static final String ARTIFACT_ES_ID = "esId";
+ public static final String ARTIFACT_GROUP_TYPE = "artifactGroupType";
+ public static final String ARTIFACT_LABEL = "artifactLabel";
+ public static final String ARTIFACT_PAYLOAD_DATA = "payloadData";
+ public static final String ARTIFACT_DISPLAY_NAME = "artifactDisplayName";
+ public static final String ARTIFACT_DESCRIPTION = "description";
+ public static final String ARTIFACT_TYPE = "artifactType";
+ public static final String ARTIFACT_NAME = "artifactName";
+ public static final String IS_FROM_CSAR = "isFromCsar";
+ public static final String ARTIFACT_ID = "uniqueId";
+ public static final String REQUIRED_ARTIFACTS = "requiredArtifacts";
+ public static final String ARTIFACT_HEAT_PARAMS = "heatParameters";
+ public static final String ARTIFACT_ES_ID = "esId";
- public static final String ABSTRACT = "abstract";
- public static final String GLOBAL_SUBSTITUTION_TYPES_SERVICE_TEMPLATE = "Definitions/GlobalSubstitutionTypesServiceTemplate.yaml";
- public static final String ABSTRACT_SUBSTITUTE_GLOBAL_TYPES_SERVICE_TEMPLATE = "Definitions/AbstractSubstituteGlobalTypesServiceTemplate.yaml";
+ public static final String ABSTRACT = "abstract";
+ public static final String GLOBAL_SUBSTITUTION_TYPES_SERVICE_TEMPLATE = "Definitions/GlobalSubstitutionTypesServiceTemplate.yaml";
+ public static final String ABSTRACT_SUBSTITUTE_GLOBAL_TYPES_SERVICE_TEMPLATE = "Definitions/AbstractSubstituteGlobalTypesServiceTemplate.yaml";
- public static final String VENDOR_LICENSE_MODEL = "vendor-license-model.xml";
- public static final String VENDOR_LICENSE_LABEL = "vendorlicense";
- public static final String VENDOR_LICENSE_DISPLAY_NAME = "Vendor License";
- public static final String VENDOR_LICENSE_DESCRIPTION = " Vendor license file";
+ public static final String VENDOR_LICENSE_MODEL = "vendor-license-model.xml";
+ public static final String VENDOR_LICENSE_LABEL = "vendorlicense";
+ public static final String VENDOR_LICENSE_DISPLAY_NAME = "Vendor License";
+ public static final String VENDOR_LICENSE_DESCRIPTION = " Vendor license file";
- public static final String VF_LICENSE_MODEL = "vf-license-model.xml";
- public static final String VF_LICENSE_LABEL = "vflicense";
- public static final String VF_LICENSE_DISPLAY_NAME = "VF License";
- public static final String VF_LICENSE_DESCRIPTION = "VF license file";
- public static final String GET_INPUT = "get_input";
- public static final String GET_POLICY = "get_policy";
- public static final String SERVICE_TEMPLATE_FILE_POSTFIX = "ServiceTemplate.yaml";
- public static final String SERVICE_TEMPLATES_CONTAINING_FOLDER = "Definitions/";
- public static final String UNBOUNDED = "unbounded";
-
- //SDC HealthCheck components
- public static final String HC_COMPONENT_FE = "FE";
- public static final String HC_COMPONENT_BE = "BE";
- public static final String HC_COMPONENT_JANUSGRAPH = "JANUSGRAPH";
- public static final String HC_COMPONENT_ES = "ES";
- public static final String HC_COMPONENT_CASSANDRA = "CASSANDRA";
- public static final String HC_COMPONENT_DISTRIBUTION_ENGINE = "DE";
- public static final String HC_COMPONENT_DMAAP_ENGINE = "DMAAP";
+ public static final String VF_LICENSE_MODEL = "vf-license-model.xml";
+ public static final String VF_LICENSE_LABEL = "vflicense";
+ public static final String VF_LICENSE_DISPLAY_NAME = "VF License";
+ public static final String VF_LICENSE_DESCRIPTION = "VF license file";
+ public static final String GET_INPUT = "get_input";
+ public static final String GET_POLICY = "get_policy";
+ public static final String SERVICE_TEMPLATE_FILE_POSTFIX = "ServiceTemplate.yaml";
+ public static final String SERVICE_TEMPLATES_CONTAINING_FOLDER = "Definitions/";
+ public static final String UNBOUNDED = "unbounded";
- //external HealthCheck components
- public static final String HC_COMPONENT_ON_BOARDING = "ON_BOARDING";
- public static final String HC_COMPONENT_DCAE = "DCAE";
-
- //Plugin BL
- public static final String PLUGIN_BL_COMPONENT = "pluginStatusBL";
-
- private Constants(){}
+ //SDC HealthCheck components
+ public static final String HC_COMPONENT_FE = "FE";
+ public static final String HC_COMPONENT_BE = "BE";
+ public static final String HC_COMPONENT_JANUSGRAPH = "JANUSGRAPH";
+ public static final String HC_COMPONENT_ES = "ES";
+ public static final String HC_COMPONENT_CASSANDRA = "CASSANDRA";
+ public static final String HC_COMPONENT_DISTRIBUTION_ENGINE = "DE";
+ public static final String HC_COMPONENT_DMAAP_ENGINE = "DMAAP";
+
+ //external HealthCheck components
+ public static final String HC_COMPONENT_ON_BOARDING = "ON_BOARDING";
+ public static final String HC_COMPONENT_DCAE = "DCAE";
+
+ //Plugin BL
+ public static final String PLUGIN_BL_COMPONENT = "pluginStatusBL";
+
+ private Constants() {
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/api/FileChangeCallback.java b/common-app-api/src/main/java/org/openecomp/sdc/common/api/FileChangeCallback.java
index 5c4d3d5926..730d7067c2 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/api/FileChangeCallback.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/api/FileChangeCallback.java
@@ -7,9 +7,9 @@
* 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.
@@ -22,6 +22,6 @@ package org.openecomp.sdc.common.api;
public interface FileChangeCallback {
- public void reconfigure(BasicConfiguration obj);
+ void reconfigure(BasicConfiguration obj);
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/api/HealthCheckInfo.java b/common-app-api/src/main/java/org/openecomp/sdc/common/api/HealthCheckInfo.java
index 4d2fb00094..bfcba41faa 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/api/HealthCheckInfo.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/api/HealthCheckInfo.java
@@ -7,9 +7,9 @@
* 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.
@@ -27,92 +27,88 @@ import java.lang.reflect.Type;
import java.util.List;
public class HealthCheckInfo {
-
- private String healthCheckComponent;
- private HealthCheckStatus healthCheckStatus;
- private String version;
- private String description;
- private List<HealthCheckInfo> componentsInfo;
-
- public HealthCheckInfo(String healthCheckComponent, HealthCheckStatus healthCheckStatus,
- String version, String description) {
- super();
- this.healthCheckComponent = healthCheckComponent;
- this.healthCheckStatus = healthCheckStatus;
- this.version = version;
- this.description = description;
- }
-
- public HealthCheckInfo(String healthCheckComponent, HealthCheckStatus healthCheckStatus,
- String version, String description, List<HealthCheckInfo> componentsInfo) {
- super();
- this.healthCheckComponent = healthCheckComponent;
- this.healthCheckStatus = healthCheckStatus;
- this.version = version;
- this.description = description;
- this.componentsInfo = componentsInfo;
-}
- public HealthCheckInfo() {
- super();
- }
-
- public String getHealthCheckComponent() {
- return healthCheckComponent;
- }
-
- public HealthCheckStatus getHealthCheckStatus() {
- return healthCheckStatus;
- }
-
- public void setHealthCheckStatus(HealthCheckStatus healthCheckStatus) {
- this.healthCheckStatus = healthCheckStatus;
- }
-
- public List<HealthCheckInfo> getComponentsInfo() {
- return componentsInfo;
- }
-
- public void setComponentsInfo(List<HealthCheckInfo> componentsInfo) {
- this.componentsInfo = componentsInfo;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- /*public enum HealthCheckComponent {
- FE, BE, JANUSGRAPH, DE, ON_BOARDING, CASSANDRA, DCAE,
- CAS, ZU;//Amdocs components
- }*/
-
- public enum HealthCheckStatus {
- UP, DOWN, UNKNOWN;
- }
-
- @Override
- public String toString() {
- return "HealthCheckInfo [healthCheckComponent=" + healthCheckComponent + ", healthCheckStatus="
- + healthCheckStatus + ", version=" + version + ", description=" + description + ", componentsInfo="
- + componentsInfo + "]";
- }
-
- public static void main(String[] args) {
- String des = "[{healthCheckComponent=BE4, healthCheckStatus=UP, version=0.0.1-SNAPSHOT, description=OK}, {healthCheckComponent=BE, healthCheckStatus=UP, version=1710.0.0-SNAPSHOT, description=OK}, {healthCheckComponent=BE5, healthCheckStatus=UP, version=2.1.9, description=OK}]";
- Type listType = new TypeToken<List<HealthCheckInfo>>(){}.getType();
- List<HealthCheckInfo> componentsInfo = new Gson().fromJson(des.toString(), listType);
- System.out.println(componentsInfo.toString());
- }
+ private String healthCheckComponent;
+ private HealthCheckStatus healthCheckStatus;
+ private String version;
+ private String description;
+ private List<HealthCheckInfo> componentsInfo;
+
+ public HealthCheckInfo(String healthCheckComponent, HealthCheckStatus healthCheckStatus,
+ String version, String description) {
+ super();
+ this.healthCheckComponent = healthCheckComponent;
+ this.healthCheckStatus = healthCheckStatus;
+ this.version = version;
+ this.description = description;
+ }
+
+ public HealthCheckInfo(String healthCheckComponent, HealthCheckStatus healthCheckStatus,
+ String version, String description, List<HealthCheckInfo> componentsInfo) {
+ super();
+ this.healthCheckComponent = healthCheckComponent;
+ this.healthCheckStatus = healthCheckStatus;
+ this.version = version;
+ this.description = description;
+ this.componentsInfo = componentsInfo;
+ }
+
+ public HealthCheckInfo() {
+ super();
+ }
+
+ public String getHealthCheckComponent() {
+ return healthCheckComponent;
+ }
+
+ public HealthCheckStatus getHealthCheckStatus() {
+ return healthCheckStatus;
+ }
+
+ public void setHealthCheckStatus(HealthCheckStatus healthCheckStatus) {
+ this.healthCheckStatus = healthCheckStatus;
+ }
+
+ public List<HealthCheckInfo> getComponentsInfo() {
+ return componentsInfo;
+ }
+
+ public void setComponentsInfo(List<HealthCheckInfo> componentsInfo) {
+ this.componentsInfo = componentsInfo;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public enum HealthCheckStatus {
+ UP, DOWN, UNKNOWN;
+ }
+
+ @Override
+ public String toString() {
+ return "HealthCheckInfo [healthCheckComponent=" + healthCheckComponent + ", healthCheckStatus="
+ + healthCheckStatus + ", version=" + version + ", description=" + description + ", componentsInfo="
+ + componentsInfo + "]";
+ }
+
+ public static void main(String[] args) {
+ String des = "[{healthCheckComponent=BE4, healthCheckStatus=UP, version=0.0.1-SNAPSHOT, description=OK}, {healthCheckComponent=BE, healthCheckStatus=UP, version=1710.0.0-SNAPSHOT, description=OK}, {healthCheckComponent=BE5, healthCheckStatus=UP, version=2.1.9, description=OK}]";
+ Type listType = new TypeToken<List<HealthCheckInfo>>() {
+ }.getType();
+ List<HealthCheckInfo> componentsInfo = new Gson().fromJson(des.toString(), listType);
+ System.out.println(componentsInfo.toString());
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/api/HealthCheckWrapper.java b/common-app-api/src/main/java/org/openecomp/sdc/common/api/HealthCheckWrapper.java
index 29c6350516..184051600c 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/api/HealthCheckWrapper.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/api/HealthCheckWrapper.java
@@ -7,9 +7,9 @@
* 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.
@@ -24,39 +24,39 @@ import java.util.List;
public class HealthCheckWrapper {
- String sdcVersion;
- String siteMode;
- List<HealthCheckInfo> componentsInfo;
+ private String sdcVersion;
+ private String siteMode;
+ private List<HealthCheckInfo> componentsInfo;
- public HealthCheckWrapper(List<HealthCheckInfo> componentsInfo, String sdcVersion, String siteMode) {
- super();
- this.componentsInfo = componentsInfo;
- this.sdcVersion = sdcVersion;
- this.siteMode = siteMode;
- }
+ public HealthCheckWrapper(List<HealthCheckInfo> componentsInfo, String sdcVersion, String siteMode) {
+ super();
+ this.componentsInfo = componentsInfo;
+ this.sdcVersion = sdcVersion;
+ this.siteMode = siteMode;
+ }
- public List<HealthCheckInfo> getComponentsInfo() {
- return componentsInfo;
- }
+ public List<HealthCheckInfo> getComponentsInfo() {
+ return componentsInfo;
+ }
- public void setComponentsInfo(List<HealthCheckInfo> componentsInfo) {
- this.componentsInfo = componentsInfo;
- }
+ public void setComponentsInfo(List<HealthCheckInfo> componentsInfo) {
+ this.componentsInfo = componentsInfo;
+ }
- public String getSdcVersion() {
- return sdcVersion;
- }
+ public String getSdcVersion() {
+ return sdcVersion;
+ }
- public void setSdcVersion(String sdcVersion) {
- this.sdcVersion = sdcVersion;
- }
+ public void setSdcVersion(String sdcVersion) {
+ this.sdcVersion = sdcVersion;
+ }
- public String getSiteMode() {
- return siteMode;
- }
+ public String getSiteMode() {
+ return siteMode;
+ }
- public void setSiteMode(String siteMode) {
- this.siteMode = siteMode;
- }
+ public void setSiteMode(String siteMode) {
+ this.siteMode = siteMode;
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/api/ResourceType.java b/common-app-api/src/main/java/org/openecomp/sdc/common/api/ResourceType.java
index b93fed2e0c..f757f32a40 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/api/ResourceType.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/api/ResourceType.java
@@ -7,9 +7,9 @@
* 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.
@@ -21,5 +21,5 @@
package org.openecomp.sdc.common.api;
public enum ResourceType {
- RESOURCE, SERVICE
+ RESOURCE, SERVICE
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/api/ResponseInfo.java b/common-app-api/src/main/java/org/openecomp/sdc/common/api/ResponseInfo.java
index 3e8968a481..290a71fb3b 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/api/ResponseInfo.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/api/ResponseInfo.java
@@ -7,9 +7,9 @@
* 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.
@@ -25,59 +25,59 @@ import com.fasterxml.jackson.databind.ObjectMapper;
public class ResponseInfo {
- public enum ResponseStatusEnum {
- SUCCESS("success"), LOGIN_FAILED("loginFailed"), INTERNAL_ERROR("internalError"), MISSING_HEADERS("required headers are missing"), TIMEOUT("timeout"), PARSING_ERROR("parsingFailed");
-
- private String statusDescription;
-
- ResponseStatusEnum(String status) {
- this.statusDescription = status;
- }
-
- public String getStatusDescription() {
- return statusDescription;
- }
- }
-
- private ResponseStatusEnum applicativeStatus;
- private String description;
-
- public ResponseInfo(ResponseStatusEnum applicativeStatus, String description) {
- super();
- this.applicativeStatus = applicativeStatus;
- this.description = description;
- }
-
- public ResponseInfo(ResponseStatusEnum applicativeStatus) {
- super();
- this.applicativeStatus = applicativeStatus;
- }
-
- public ResponseStatusEnum getApplicativeStatus() {
- return applicativeStatus;
- }
-
- public void setApplicativeStatus(ResponseStatusEnum applicativeStatus) {
- this.applicativeStatus = applicativeStatus;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- @Override
- public String toString() {
- ObjectMapper mapper = new ObjectMapper();
- String tostring = super.toString();
- try {
- tostring = mapper.writeValueAsString(this);
- } catch (JsonProcessingException e) {
-
- }
- return tostring;
- }
+ public enum ResponseStatusEnum {
+ SUCCESS("success"), LOGIN_FAILED("loginFailed"), INTERNAL_ERROR("internalError"), MISSING_HEADERS("required headers are missing"), TIMEOUT("timeout"), PARSING_ERROR("parsingFailed");
+
+ private String statusDescription;
+
+ ResponseStatusEnum(String status) {
+ this.statusDescription = status;
+ }
+
+ public String getStatusDescription() {
+ return statusDescription;
+ }
+ }
+
+ private ResponseStatusEnum applicativeStatus;
+ private String description;
+
+ public ResponseInfo(ResponseStatusEnum applicativeStatus, String description) {
+ super();
+ this.applicativeStatus = applicativeStatus;
+ this.description = description;
+ }
+
+ public ResponseInfo(ResponseStatusEnum applicativeStatus) {
+ super();
+ this.applicativeStatus = applicativeStatus;
+ }
+
+ public ResponseStatusEnum getApplicativeStatus() {
+ return applicativeStatus;
+ }
+
+ public void setApplicativeStatus(ResponseStatusEnum applicativeStatus) {
+ this.applicativeStatus = applicativeStatus;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ @Override
+ public String toString() {
+ ObjectMapper mapper = new ObjectMapper();
+ String tostring = super.toString();
+ try {
+ tostring = mapper.writeValueAsString(this);
+ } catch (JsonProcessingException e) {
+
+ }
+ return tostring;
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/api/ToscaNodeTypeInfo.java b/common-app-api/src/main/java/org/openecomp/sdc/common/api/ToscaNodeTypeInfo.java
index f6608952d0..8246716566 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/api/ToscaNodeTypeInfo.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/api/ToscaNodeTypeInfo.java
@@ -7,9 +7,9 @@
* 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.
@@ -24,56 +24,56 @@ import java.util.List;
public class ToscaNodeTypeInfo {
- private String nodeName;
- private String templateVersion;
- private List<ToscaNodeTypeInterface> interfaces;
- private String iconPath;
- private String templateName;
-
- public String getTemplateName() {
- return templateName;
- }
-
- public void setTemplateName(String templateName) {
- this.templateName = templateName;
- }
-
- public String getNodeName() {
- return nodeName;
- }
-
- public void setNodeName(String nodeName) {
- this.nodeName = nodeName;
- }
-
- public String getTemplateVersion() {
- return templateVersion;
- }
-
- public void setTemplateVersion(String templateVersion) {
- this.templateVersion = templateVersion;
- }
-
- public List<ToscaNodeTypeInterface> getInterfaces() {
- return interfaces;
- }
-
- public void setInterfaces(List<ToscaNodeTypeInterface> interfaces) {
- this.interfaces = interfaces;
- }
-
- public String getIconPath() {
- return iconPath;
- }
-
- public void setIconPath(String iconPath) {
- this.iconPath = iconPath;
- }
-
- @Override
- public String toString() {
- return "ToscaNodeTypeInfo [nodeName=" + nodeName + ", templateVersion=" + templateVersion + ", templateName="
- + templateName + ", interfaces=" + interfaces + ", iconPath=" + iconPath + "]";
- }
+ private String nodeName;
+ private String templateVersion;
+ private List<ToscaNodeTypeInterface> interfaces;
+ private String iconPath;
+ private String templateName;
+
+ public String getTemplateName() {
+ return templateName;
+ }
+
+ public void setTemplateName(String templateName) {
+ this.templateName = templateName;
+ }
+
+ public String getNodeName() {
+ return nodeName;
+ }
+
+ public void setNodeName(String nodeName) {
+ this.nodeName = nodeName;
+ }
+
+ public String getTemplateVersion() {
+ return templateVersion;
+ }
+
+ public void setTemplateVersion(String templateVersion) {
+ this.templateVersion = templateVersion;
+ }
+
+ public List<ToscaNodeTypeInterface> getInterfaces() {
+ return interfaces;
+ }
+
+ public void setInterfaces(List<ToscaNodeTypeInterface> interfaces) {
+ this.interfaces = interfaces;
+ }
+
+ public String getIconPath() {
+ return iconPath;
+ }
+
+ public void setIconPath(String iconPath) {
+ this.iconPath = iconPath;
+ }
+
+ @Override
+ public String toString() {
+ return "ToscaNodeTypeInfo [nodeName=" + nodeName + ", templateVersion=" + templateVersion + ", templateName="
+ + templateName + ", interfaces=" + interfaces + ", iconPath=" + iconPath + "]";
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/api/ToscaNodeTypeInterface.java b/common-app-api/src/main/java/org/openecomp/sdc/common/api/ToscaNodeTypeInterface.java
index 4095714f4b..517ba8cc86 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/api/ToscaNodeTypeInterface.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/api/ToscaNodeTypeInterface.java
@@ -7,9 +7,9 @@
* 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.
@@ -24,14 +24,14 @@ import java.util.List;
public class ToscaNodeTypeInterface {
- List<String> scripts;
+ private List<String> scripts;
- public List<String> getScripts() {
- return scripts;
- }
+ public List<String> getScripts() {
+ return scripts;
+ }
- public void setScripts(List<String> scripts) {
- this.scripts = scripts;
- }
+ public void setScripts(List<String> scripts) {
+ this.scripts = scripts;
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/api/UploadArtifactInfo.java b/common-app-api/src/main/java/org/openecomp/sdc/common/api/UploadArtifactInfo.java
index 110dbf34a2..b168271257 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/api/UploadArtifactInfo.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/api/UploadArtifactInfo.java
@@ -7,9 +7,9 @@
* 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.
@@ -22,122 +22,134 @@ package org.openecomp.sdc.common.api;
public class UploadArtifactInfo {
- public UploadArtifactInfo() {
-
- }
-
- public UploadArtifactInfo(String artifactName, String artifactPath, ArtifactTypeEnum artifactType, String artifactDescription) {
- super();
- this.artifactName = artifactName;
- this.artifactPath = artifactPath;
- this.artifactType = artifactType;
- this.artifactDescription = artifactDescription;
- }
-
- public UploadArtifactInfo(String artifactName, String artifactPath, ArtifactTypeEnum artifactType, String artifactDescription, String artifactData) {
- super();
- this.artifactName = artifactName;
- this.artifactPath = artifactPath;
- this.artifactType = artifactType;
- this.artifactDescription = artifactDescription;
- this.artifactData = artifactData;
- }
-
- private String artifactName;
- private String artifactPath;
- private ArtifactTypeEnum artifactType;
- private String artifactDescription;
- private String artifactData;
-
- public String getArtifactName() {
- return artifactName;
- }
-
- public void setArtifactName(String artifactName) {
- this.artifactName = artifactName;
- }
-
- public String getArtifactPath() {
- return artifactPath;
- }
-
- public void setArtifactPath(String artifactPath) {
- this.artifactPath = artifactPath;
- }
-
- public ArtifactTypeEnum getArtifactType() {
- return artifactType;
- }
-
- public void setArtifactType(ArtifactTypeEnum artifactType) {
- this.artifactType = artifactType;
- }
-
- public String getArtifactDescription() {
- return artifactDescription;
- }
-
- public void setArtifactDescription(String artifactDescription) {
- this.artifactDescription = artifactDescription;
- }
-
- public String getArtifactData() {
- return artifactData;
- }
-
- public void setArtifactData(String artifactData) {
- this.artifactData = artifactData;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((artifactData == null) ? 0 : artifactData.hashCode());
- result = prime * result + ((artifactDescription == null) ? 0 : artifactDescription.hashCode());
- result = prime * result + ((artifactName == null) ? 0 : artifactName.hashCode());
- result = prime * result + ((artifactPath == null) ? 0 : artifactPath.hashCode());
- result = prime * result + ((artifactType == null) ? 0 : artifactType.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- UploadArtifactInfo other = (UploadArtifactInfo) obj;
- if (artifactData == null) {
- if (other.artifactData != null)
- return false;
- } else if (!artifactData.equals(other.artifactData))
- return false;
- if (artifactDescription == null) {
- if (other.artifactDescription != null)
- return false;
- } else if (!artifactDescription.equals(other.artifactDescription))
- return false;
- if (artifactName == null) {
- if (other.artifactName != null)
- return false;
- } else if (!artifactName.equals(other.artifactName))
- return false;
- if (artifactPath == null) {
- if (other.artifactPath != null)
- return false;
- } else if (!artifactPath.equals(other.artifactPath))
- return false;
- if (artifactType != other.artifactType)
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- return "UploadArtifactInfo [artifactName=" + artifactName + ", artifactPath=" + artifactPath + ", artifactType=" + artifactType + ", artifactDescription=" + artifactDescription + ", artifactData=" + artifactData + "]";
- }
+ public UploadArtifactInfo() {
+
+ }
+
+ public UploadArtifactInfo(String artifactName, String artifactPath, ArtifactTypeEnum artifactType, String artifactDescription) {
+ super();
+ this.artifactName = artifactName;
+ this.artifactPath = artifactPath;
+ this.artifactType = artifactType;
+ this.artifactDescription = artifactDescription;
+ }
+
+ public UploadArtifactInfo(String artifactName, String artifactPath, ArtifactTypeEnum artifactType, String artifactDescription, String artifactData) {
+ super();
+ this.artifactName = artifactName;
+ this.artifactPath = artifactPath;
+ this.artifactType = artifactType;
+ this.artifactDescription = artifactDescription;
+ this.artifactData = artifactData;
+ }
+
+ private String artifactName;
+ private String artifactPath;
+ private ArtifactTypeEnum artifactType;
+ private String artifactDescription;
+ private String artifactData;
+
+ public String getArtifactName() {
+ return artifactName;
+ }
+
+ public void setArtifactName(String artifactName) {
+ this.artifactName = artifactName;
+ }
+
+ public String getArtifactPath() {
+ return artifactPath;
+ }
+
+ public void setArtifactPath(String artifactPath) {
+ this.artifactPath = artifactPath;
+ }
+
+ public ArtifactTypeEnum getArtifactType() {
+ return artifactType;
+ }
+
+ public void setArtifactType(ArtifactTypeEnum artifactType) {
+ this.artifactType = artifactType;
+ }
+
+ public String getArtifactDescription() {
+ return artifactDescription;
+ }
+
+ public void setArtifactDescription(String artifactDescription) {
+ this.artifactDescription = artifactDescription;
+ }
+
+ public String getArtifactData() {
+ return artifactData;
+ }
+
+ public void setArtifactData(String artifactData) {
+ this.artifactData = artifactData;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((artifactData == null) ? 0 : artifactData.hashCode());
+ result = prime * result + ((artifactDescription == null) ? 0 : artifactDescription.hashCode());
+ result = prime * result + ((artifactName == null) ? 0 : artifactName.hashCode());
+ result = prime * result + ((artifactPath == null) ? 0 : artifactPath.hashCode());
+ result = prime * result + ((artifactType == null) ? 0 : artifactType.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ UploadArtifactInfo other = (UploadArtifactInfo) obj;
+ if (artifactData == null) {
+ if (other.artifactData != null) {
+ return false;
+ }
+ } else if (!artifactData.equals(other.artifactData)) {
+ return false;
+ }
+ if (artifactDescription == null) {
+ if (other.artifactDescription != null) {
+ return false;
+ }
+ } else if (!artifactDescription.equals(other.artifactDescription)) {
+ return false;
+ }
+ if (artifactName == null) {
+ if (other.artifactName != null) {
+ return false;
+ }
+ } else if (!artifactName.equals(other.artifactName)) {
+ return false;
+ }
+ if (artifactPath == null) {
+ if (other.artifactPath != null) {
+ return false;
+ }
+ } else if (!artifactPath.equals(other.artifactPath)) {
+ return false;
+ }
+ if (artifactType != other.artifactType) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "UploadArtifactInfo [artifactName=" + artifactName + ", artifactPath=" + artifactPath + ", artifactType=" + artifactType + ", artifactDescription=" + artifactDescription + ", artifactData=" + artifactData + "]";
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/api/UserRoleEnum.java b/common-app-api/src/main/java/org/openecomp/sdc/common/api/UserRoleEnum.java
index a750fa454a..6e7b2403f3 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/api/UserRoleEnum.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/api/UserRoleEnum.java
@@ -7,9 +7,9 @@
* 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.
@@ -21,15 +21,15 @@
package org.openecomp.sdc.common.api;
public enum UserRoleEnum {
- ADMIN("ADMIN"), DESIGNER("DESIGNER"), TESTER("TESTER"), GOVERNOR("GOVERNOR"), OPS("OPS"), PRODUCT_MANAGER("PRODUCT_MANAGER"), PRODUCT_STRATEGIST("PRODUCT_STRATEGIST");
+ ADMIN("ADMIN"), DESIGNER("DESIGNER"), TESTER("TESTER"), GOVERNOR("GOVERNOR"), OPS("OPS"), PRODUCT_MANAGER("PRODUCT_MANAGER"), PRODUCT_STRATEGIST("PRODUCT_STRATEGIST");
- private String name;
+ private String name;
- UserRoleEnum(String name) {
- this.name = name;
- }
+ UserRoleEnum(String name) {
+ this.name = name;
+ }
- public String getName() {
- return name;
- }
+ public String getName() {
+ return name;
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/api/YamlConstants.java b/common-app-api/src/main/java/org/openecomp/sdc/common/api/YamlConstants.java
index 0dadef9292..fe5e5288b0 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/api/YamlConstants.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/api/YamlConstants.java
@@ -7,9 +7,9 @@
* 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.
@@ -22,8 +22,8 @@ package org.openecomp.sdc.common.api;
public interface YamlConstants {
- public static final String NODE_TYPES = "node_types";
- public static final String INTERFACES = "interfaces";
- public static final String TEMPLATE_VERSION = "template_version";
- public static final String TEMPLATE_NAME = "template_name";
+ String NODE_TYPES = "node_types";
+ String INTERFACES = "interfaces";
+ String TEMPLATE_VERSION = "template_version";
+ String TEMPLATE_NAME = "template_name";
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/api/YamlSuffixEnum.java b/common-app-api/src/main/java/org/openecomp/sdc/common/api/YamlSuffixEnum.java
index 1310ab170f..8daf335c25 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/api/YamlSuffixEnum.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/api/YamlSuffixEnum.java
@@ -7,9 +7,9 @@
* 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.
@@ -25,36 +25,36 @@ import java.util.List;
public enum YamlSuffixEnum {
- YAML("YAML"),
+ YAML("YAML"),
- yaml("yaml"),
+ yaml("yaml"),
- YML("YML"),
+ YML("YML"),
- yml("yml");
+ yml("yml");
- YamlSuffixEnum(String suffix) {
- this.suffix = suffix;
- }
+ YamlSuffixEnum(String suffix) {
+ this.suffix = suffix;
+ }
- private String suffix;
+ private String suffix;
- public String getSuffix() {
- return suffix;
- }
+ public String getSuffix() {
+ return suffix;
+ }
- public void setSuufix(String suffix) {
- this.suffix = suffix;
- }
+ public void setSuufix(String suffix) {
+ this.suffix = suffix;
+ }
- public static List<String> getSuffixes() {
+ public static List<String> getSuffixes() {
- List<String> arrayList = new ArrayList<>();
+ List<String> arrayList = new ArrayList<>();
- for (YamlSuffixEnum yamlSuffixEnum : YamlSuffixEnum.values()) {
- arrayList.add(yamlSuffixEnum.getSuffix());
- }
+ for (YamlSuffixEnum yamlSuffixEnum : YamlSuffixEnum.values()) {
+ arrayList.add(yamlSuffixEnum.getSuffix());
+ }
- return arrayList;
- }
+ return arrayList;
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/config/AbsEcompErrorManager.java b/common-app-api/src/main/java/org/openecomp/sdc/common/config/AbsEcompErrorManager.java
index 49f04d2ee1..22df432afe 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/config/AbsEcompErrorManager.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/config/AbsEcompErrorManager.java
@@ -7,9 +7,9 @@
* 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.
@@ -25,14 +25,14 @@ import com.jcabi.aspects.Loggable;
@Loggable(prepend = true, value = Loggable.TRACE, trim = false)
public abstract class AbsEcompErrorManager {
- public static final String PARAM_STR = "%s";
+ public static final String PARAM_STR = "%s";
- public abstract IEcompConfigurationManager getConfigurationManager();
+ public abstract IEcompConfigurationManager getConfigurationManager();
- public void processEcompError(String context, EcompErrorEnum ecompErrorEnum, String... descriptionParams) {
+ public void processEcompError(String context, EcompErrorEnum ecompErrorEnum, String... descriptionParams) {
- EcompErrorLogUtil.logEcompError(context, ecompErrorEnum, descriptionParams);
+ EcompErrorLogUtil.logEcompError(context, ecompErrorEnum, descriptionParams);
- }
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompClassification.java b/common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompClassification.java
index 31499486de..fc5a2f0512 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompClassification.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompClassification.java
@@ -7,9 +7,9 @@
* 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.
@@ -22,20 +22,20 @@ package org.openecomp.sdc.common.config;
public enum EcompClassification {
- INFORMATION("I"), WARNING("W"), ERROR("E"), FATAL("F");
+ INFORMATION("I"), WARNING("W"), ERROR("E"), FATAL("F");
- String classification;
+ private String classification;
- EcompClassification(String classification) {
- this.classification = classification;
- }
+ EcompClassification(String classification) {
+ this.classification = classification;
+ }
- public String getClassification() {
- return classification;
- }
+ public String getClassification() {
+ return classification;
+ }
- public void setClassification(String classification) {
- this.classification = classification;
- }
+ public void setClassification(String classification) {
+ this.classification = classification;
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorCode.java b/common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorCode.java
index a423354e86..0763f9052e 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorCode.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorCode.java
@@ -7,9 +7,9 @@
* 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.
@@ -22,135 +22,135 @@ package org.openecomp.sdc.common.config;
public enum EcompErrorCode {
- E_100("Authentication problem towards U-EB server. Reason: %s",
- "An Authentication failure occured during access to UEB server. Please check that UEB keys are configured correctly in ASDC BE distribution configuration."), E_199(
- "Internal authentication problem. Description: %s"),
-
- E_200("ASDC Backend probably lost connectivity to either one of the following components: JanusGraph DB, Cassandra, Onboarding, UEB Cluster. Please check the logs for more information."), E_201(
- "ASDC Backend probably lost connectivity to JanusGraph DB. Please check the logs for more information."), E_202(
- "ASDC Backend probably lost connectivity to ElasticSearch. Please check the logs for more information."), E_203(
- "ASDC Backend probably lost connectivity to UEB Cluster. Please check the logs for more information.",
- "Check connectivity to UEB cluster which is configured under parameter uebServers in distribution-configuration.yaml."), E_204(
- "Unable to connect to a valid ASDC Backend Server",
- "Please check connectivity from this FE instance towards BE or BE Load Balancer. Please check that parameters in FE configuration.yaml: beHost, beHttpPort and beSslPort point to a valid host and port values."),
-
- E_205("ASDC Backend Recovery to either one of the following components: JanusGraph DB, Cassandra, Onboarding, UEB Cluster."), E_206(
- "ASDC Backend connection recovery to JanusGraph DB."), E_207(
- "ASDC Backend connection recovery to ElasticSearch."), E_208(
- "ASDC Backend connection recovery to UEB Cluster."), E_209(
- "Connectivity to ASDC BE Server is recovered."), E_210(
- "Connection problem towards U-EB server. Reason: %s",
- "Please check that that parameter uebServers in distribution-configuration.yaml points to a valid UEB Cluster."), E_211(
- "Connection problem towards U-EB server. Cannot reach host %s",
- "Please check that that parameter uebServers in distribution-configuration.yaml points to a valid UEB Cluster."), E_212(
- "Couldn't resolve hostIP. Desciption: %s"), E_213(
- "Site switch over was done. Site is now in %s mode"), E_214(
- "Dmaap Connection problem."), E_299(
- "Internal Connection problem. Description: %s"),
-
- // [resource/service/product]
- E_300("Mandatory %s Component %s cannot be found in repository"),
- // [SERVICE/RESOURCE/PRODUCT] [id] is not valid. Cannot be found in graph.
- E_301("%s Component %s is not valid. Cannot be found in graph."), E_302(
- "Configuration parameter %s is invalid. Value configured is %s."), E_303(
- "Error occured during access to U-EB Server. Data not found: %s",
- "An error occured during access to UEB Server, ASDC failed to either register or unregister to/from UEB topic."), E_304(
- "The artifact type %s does not appear in the list of valid artifacts %s"), E_305(
- "Configuration parameter %s is missing"), E_306(
- "Configuration parameter %s is invalid. At least %s values shall be configured"), E_307(
- "Invalid configuration in YAML file. %s"), E_308(
- "Artifact uploaded has missing information. Missing %s"), E_309(
- "Artifact %s requested is not found"), E_310(
- "User %s requested is not found"), E_311(
- "Ecomp error description params mismatch between code and YAML or wrong format, name: %s"), E_312(
- "Ecomp error element not found in YAML, name: %s"),
-
- E_399("Internal Invalid Object. Description: %s"),
-
- E_400("The type %s of %s is invalid"), E_401("The value %s of %s from type %s is invalid"), E_402(
- "Payload of artifact uploaded is invalid (invalid MD5 or encryption)"), E_403(
- "Input for artifact metadata is invalid"), E_404("%s %s required is missing"), E_405(
- "Failed to convert json input to object"), E_406("Distribution %s required is missing"),
-
- E_499("Invalid input. Description: %s"),
-
- E_500("Catalog-BE was not initialized properly"), E_501(
- "Failed to add resource instance of resource %s to service %s"), E_502(
- "Error occured during access to U-EB Server. Operation: %s",
- "An error occured in ASDC distribution mechanism. Please check the logs for more information."), E_503(
- "Error occured in Distribution Engine. Failed operation: %s",
- "System Error occured in ASDC Distribution Engine. Please check ASDC logs for more details."), E_504(
- "Failed adding node of type %s to graph."), E_505(
- "Operation towards database failed.",
- "Please check JanusGraph DB health or look at the logs for more details."), E_506(
- "Unexpected error during operation"), E_507(
- "Going to execute rollback on graph."), E_508(
- "Failed to lock object for update. Type = %s, Id = %s"), E_509(
- "Failed to create node %s on graph. status is %s"), E_510(
- "Failed to update node %s on graph. Status is %s"), E_511(
- "Failed to delete node %s on graph. Status is %s"), E_512(
- "Failed to retrieve node %s from graph. Status is %s"), E_513(
- "Failed to find parent node of %s on graph. Status is %s"), E_514(
- "Failed to fetch all nodes with type %s of parent node %s . Status is %s"), E_515(
- "Cannot find node with type %s associated with node %s . Status is %s"), E_516(
- "Error occured in Component Cleaner Task. Failed operation: %s"), E_517(
- "Error when logging FE HTTP request/response"), E_518(
- "Error when trying to access FE Portal page"),
-
- E_599("Internal flow error. Operation: %s"),
-
- E_900("Unexpected error during BE REST API execution"), E_901("General error during FE Health Check"), E_999(
- "Unexpected error. Description: %s");
-
- /*
- * 100-199 Security/Permission Related - Authentication problems (from
- * external client, to external server) - Certification errors -
- *
- * 200-299 Availability/Timeout Related - connectivity error - connection
- * timeout
- *
- * 300-399 Data Access/Integrity Related - Data in graph in invalid(E.g. no
- * creator is found for service) - Artifact is missing in ES, but exists in
- * graph.
- *
- * 400-499 Schema Interface Type/Validation - received payload checksum is
- * inavlid - received json is not valid
- *
- * 500-599 Business/Flow Processing Related - check out to service is not
- * allowed - rollback is done - failed to generate heat file
- *
- *
- * 600-899 Reserved – do not use
- *
- * 900-999 Unknown Errors - unexpected exception
- */
-
- String description;
- String resolution;
-
- EcompErrorCode(String description, String resolution) {
- this.description = description;
- this.resolution = resolution;
- }
-
- EcompErrorCode(String description) {
- this.description = description;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getResolution() {
- return resolution;
- }
-
- public void setResolution(String resolution) {
- this.resolution = resolution;
- }
+ E_100("Authentication problem towards U-EB server. Reason: %s",
+ "An Authentication failure occured during access to UEB server. Please check that UEB keys are configured correctly in ASDC BE distribution configuration."), E_199(
+ "Internal authentication problem. Description: %s"),
+
+ E_200("ASDC Backend probably lost connectivity to either one of the following components: JanusGraph DB, Cassandra, Onboarding, UEB Cluster. Please check the logs for more information."), E_201(
+ "ASDC Backend probably lost connectivity to JanusGraph DB. Please check the logs for more information."), E_202(
+ "ASDC Backend probably lost connectivity to ElasticSearch. Please check the logs for more information."), E_203(
+ "ASDC Backend probably lost connectivity to UEB Cluster. Please check the logs for more information.",
+ "Check connectivity to UEB cluster which is configured under parameter uebServers in distribution-configuration.yaml."), E_204(
+ "Unable to connect to a valid ASDC Backend Server",
+ "Please check connectivity from this FE instance towards BE or BE Load Balancer. Please check that parameters in FE configuration.yaml: beHost, beHttpPort and beSslPort point to a valid host and port values."),
+
+ E_205("ASDC Backend Recovery to either one of the following components: JanusGraph DB, Cassandra, Onboarding, UEB Cluster."), E_206(
+ "ASDC Backend connection recovery to JanusGraph DB."), E_207(
+ "ASDC Backend connection recovery to ElasticSearch."), E_208(
+ "ASDC Backend connection recovery to UEB Cluster."), E_209(
+ "Connectivity to ASDC BE Server is recovered."), E_210(
+ "Connection problem towards U-EB server. Reason: %s",
+ "Please check that that parameter uebServers in distribution-configuration.yaml points to a valid UEB Cluster."), E_211(
+ "Connection problem towards U-EB server. Cannot reach host %s",
+ "Please check that that parameter uebServers in distribution-configuration.yaml points to a valid UEB Cluster."), E_212(
+ "Couldn't resolve hostIP. Desciption: %s"), E_213(
+ "Site switch over was done. Site is now in %s mode"), E_214(
+ "Dmaap Connection problem."), E_299(
+ "Internal Connection problem. Description: %s"),
+
+ // [resource/service/product]
+ E_300("Mandatory %s Component %s cannot be found in repository"),
+ // [SERVICE/RESOURCE/PRODUCT] [id] is not valid. Cannot be found in graph.
+ E_301("%s Component %s is not valid. Cannot be found in graph."), E_302(
+ "Configuration parameter %s is invalid. Value configured is %s."), E_303(
+ "Error occured during access to U-EB Server. Data not found: %s",
+ "An error occured during access to UEB Server, ASDC failed to either register or unregister to/from UEB topic."), E_304(
+ "The artifact type %s does not appear in the list of valid artifacts %s"), E_305(
+ "Configuration parameter %s is missing"), E_306(
+ "Configuration parameter %s is invalid. At least %s values shall be configured"), E_307(
+ "Invalid configuration in YAML file. %s"), E_308(
+ "Artifact uploaded has missing information. Missing %s"), E_309(
+ "Artifact %s requested is not found"), E_310(
+ "User %s requested is not found"), E_311(
+ "Ecomp error description params mismatch between code and YAML or wrong format, name: %s"), E_312(
+ "Ecomp error element not found in YAML, name: %s"),
+
+ E_399("Internal Invalid Object. Description: %s"),
+
+ E_400("The type %s of %s is invalid"), E_401("The value %s of %s from type %s is invalid"), E_402(
+ "Payload of artifact uploaded is invalid (invalid MD5 or encryption)"), E_403(
+ "Input for artifact metadata is invalid"), E_404("%s %s required is missing"), E_405(
+ "Failed to convert json input to object"), E_406("Distribution %s required is missing"),
+
+ E_499("Invalid input. Description: %s"),
+
+ E_500("Catalog-BE was not initialized properly"), E_501(
+ "Failed to add resource instance of resource %s to service %s"), E_502(
+ "Error occured during access to U-EB Server. Operation: %s",
+ "An error occured in ASDC distribution mechanism. Please check the logs for more information."), E_503(
+ "Error occured in Distribution Engine. Failed operation: %s",
+ "System Error occured in ASDC Distribution Engine. Please check ASDC logs for more details."), E_504(
+ "Failed adding node of type %s to graph."), E_505(
+ "Operation towards database failed.",
+ "Please check JanusGraph DB health or look at the logs for more details."), E_506(
+ "Unexpected error during operation"), E_507(
+ "Going to execute rollback on graph."), E_508(
+ "Failed to lock object for update. Type = %s, Id = %s"), E_509(
+ "Failed to create node %s on graph. status is %s"), E_510(
+ "Failed to update node %s on graph. Status is %s"), E_511(
+ "Failed to delete node %s on graph. Status is %s"), E_512(
+ "Failed to retrieve node %s from graph. Status is %s"), E_513(
+ "Failed to find parent node of %s on graph. Status is %s"), E_514(
+ "Failed to fetch all nodes with type %s of parent node %s . Status is %s"), E_515(
+ "Cannot find node with type %s associated with node %s . Status is %s"), E_516(
+ "Error occured in Component Cleaner Task. Failed operation: %s"), E_517(
+ "Error when logging FE HTTP request/response"), E_518(
+ "Error when trying to access FE Portal page"),
+
+ E_599("Internal flow error. Operation: %s"),
+
+ E_900("Unexpected error during BE REST API execution"), E_901("General error during FE Health Check"), E_999(
+ "Unexpected error. Description: %s");
+
+ /*
+ * 100-199 Security/Permission Related - Authentication problems (from
+ * external client, to external server) - Certification errors -
+ *
+ * 200-299 Availability/Timeout Related - connectivity error - connection
+ * timeout
+ *
+ * 300-399 Data Access/Integrity Related - Data in graph in invalid(E.g. no
+ * creator is found for service) - Artifact is missing in ES, but exists in
+ * graph.
+ *
+ * 400-499 Schema Interface Type/Validation - received payload checksum is
+ * inavlid - received json is not valid
+ *
+ * 500-599 Business/Flow Processing Related - check out to service is not
+ * allowed - rollback is done - failed to generate heat file
+ *
+ *
+ * 600-899 Reserved – do not use
+ *
+ * 900-999 Unknown Errors - unexpected exception
+ */
+
+ private String description;
+ private String resolution;
+
+ EcompErrorCode(String description, String resolution) {
+ this.description = description;
+ this.resolution = resolution;
+ }
+
+ EcompErrorCode(String description) {
+ this.description = description;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getResolution() {
+ return resolution;
+ }
+
+ public void setResolution(String resolution) {
+ this.resolution = resolution;
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorConfiguration.java b/common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorConfiguration.java
index 196dd0aa71..89f4d17977 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorConfiguration.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorConfiguration.java
@@ -7,9 +7,9 @@
* 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.
@@ -29,133 +29,135 @@ import java.util.regex.Pattern;
public class EcompErrorConfiguration extends BasicConfiguration {
- private Map<String, EcompErrorInfo> errors = new HashMap<>();
- static final String ECODE_PREFIX = "ASDC_";
- private static final Pattern ECODE_PATTERN = Pattern.compile("^" + ECODE_PREFIX + "\\d{4}$");
-
- public Map<String, EcompErrorInfo> getErrors() {
- return errors;
- }
-
- public void setErrors(Map<String, EcompErrorInfo> errors) {
- // Validating ecomp-error-configuration.yaml
- for (Map.Entry<String, EcompErrorInfo> ecompErrorInfo : errors.entrySet()) {
- String ecompErrorName = ecompErrorInfo.getKey();
- EcompErrorInfo res = validateEcompErrorInfo(ecompErrorName, ecompErrorInfo.getValue());
- if (res != null) {
- // Validation failed!
- EcompErrorLogUtil.logEcompError(EcompErrorName.EcompConfigFileFormat, res, this.getClass().getName());
- return;
- }
- }
- // Validation passed
- this.errors = errors;
- }
-
- public EcompErrorInfo getEcompErrorInfo(String key) {
- EcompErrorInfo clone = null;
- EcompErrorInfo other = errors.get(key);
- if (other != null) {
- clone = new EcompErrorInfo();
- clone.cloneData(other);
- }
- return clone;
- }
-
- protected EcompErrorInfo validateEcompErrorInfo(String ecompErrorName, EcompErrorInfo ecompErrorInfoToValidate) {
- if (ecompErrorInfoToValidate == null) {
- return getErrorInfoForConfigFile("error " + ecompErrorName + " not found ");
- }
- String type = ecompErrorInfoToValidate.getType();
- if (type == null) {
- return getErrorInfoForConfigFile("empty error type for error " + ecompErrorName
- + ", value should be one of the following: " + Arrays.asList(EcompErrorType.values()));
- }
- try {
- EcompErrorType.valueOf(type);
- } catch (IllegalArgumentException e) {
- return getErrorInfoForConfigFile("error type " + type + " is invalid for error " + ecompErrorName
- + ", value should be one of the following: " + Arrays.asList(EcompErrorType.values()));
- }
-
- String severity = ecompErrorInfoToValidate.getSeverity();
- if (severity == null) {
- return getErrorInfoForConfigFile("empty error severity for error " + ecompErrorName
- + ", value should be one of the following: " + Arrays.asList(EcompErrorSeverity.values()));
- }
- try {
- EcompErrorSeverity.valueOf(severity);
- } catch (IllegalArgumentException e) {
- return getErrorInfoForConfigFile("error severity " + severity + " is invalid for error " + ecompErrorName
- + ", value should be one of the following: " + Arrays.asList(EcompErrorSeverity.values()));
- }
- String alarmSeverity = ecompErrorInfoToValidate.getAlarmSeverity();
- if (alarmSeverity == null) {
- return getErrorInfoForConfigFile("empty error alarm for error " + ecompErrorName
- + ", , value should be one of the following: " + Arrays.asList(EcompAlarmSeverity.values()));
- }
- try {
- EcompAlarmSeverity.valueOf(alarmSeverity);
- } catch (IllegalArgumentException e) {
- return getErrorInfoForConfigFile("error alarm severity " + alarmSeverity + " is invalid for error "
- + ecompErrorName + ", , value should be one of the following: "
- + Arrays.asList(EcompAlarmSeverity.values()));
- }
-
- String code = ecompErrorInfoToValidate.getCode();
- if (code != null && ECODE_PATTERN.matcher(code).matches()) {
- String[] split = code.split("_");
- int parseInt = Integer.parseInt(split[1]);
- if (parseInt < 3010 || parseInt > 9999) {
- return getErrorInfoForInvalidCode(code, ecompErrorName);
- }
- } else {
- return getErrorInfoForInvalidCode(code, ecompErrorName);
- }
- return null;
- }
-
- private EcompErrorInfo getErrorInfoForInvalidCode(String code, String ecompErrorName) {
- return getErrorInfoForConfigFile("error code " + code + " is invalid for error " + ecompErrorName
- + ", should be in format ASDC_[3010-9999]");
- }
-
- private EcompErrorInfo getErrorInfoForConfigFile(String errorMessage) {
- EcompErrorInfo ecompErrorInfo = new EcompErrorInfo();
- ecompErrorInfo.setCode(ECODE_PREFIX + "3000");
- ecompErrorInfo.setType(EcompErrorType.CONFIG_ERROR.name());
- ecompErrorInfo.setSeverity(EcompErrorSeverity.FATAL.name());
- ecompErrorInfo.setAlarmSeverity(EcompAlarmSeverity.CRITICAL.name());
- ecompErrorInfo.setDescription(errorMessage);
- return ecompErrorInfo;
- }
-
- @Override
- public String toString() {
- return "EcompErrorConfiguration [errors=" + errors + "]";
- }
-
- /*******************************
- * enums
- */
-
- public enum EcompErrorType {
- RECOVERY, CONFIG_ERROR, SYSTEM_ERROR, DATA_ERROR, CONNECTION_PROBLEM, AUTHENTICATION_PROBLEM;
- }
-
- public enum EcompAlarmSeverity {
- CRITICAL, MAJOR, MINOR, INFORMATIONAL, NONE;
- }
-
- public enum EcompErrorSeverity {
- INFO, WARN, ERROR, FATAL;
- }
-
- public enum EcompErrorSeverityPrefix {
- I, W, E, F;
- }
-
- public static void main(String[] args) {
- System.out.println(Arrays.asList(EcompErrorType.values()));
- }
+ private static final int LOWEST_ERROR_VALID_CODE = 3010;
+ private static final int HIGHEST_ERROR_VALID_CODE = 9999;
+ private Map<String, EcompErrorInfo> errors = new HashMap<>();
+ static final String ECODE_PREFIX = "ASDC_";
+ private static final Pattern ECODE_PATTERN = Pattern.compile("^" + ECODE_PREFIX + "\\d{4}$");
+
+ public Map<String, EcompErrorInfo> getErrors() {
+ return errors;
+ }
+
+ public void setErrors(Map<String, EcompErrorInfo> errors) {
+ // Validating ecomp-error-configuration.yaml
+ for (Map.Entry<String, EcompErrorInfo> ecompErrorInfo : errors.entrySet()) {
+ String ecompErrorName = ecompErrorInfo.getKey();
+ EcompErrorInfo res = validateEcompErrorInfo(ecompErrorName, ecompErrorInfo.getValue());
+ if (res != null) {
+ // Validation failed!
+ EcompErrorLogUtil.logEcompError(EcompErrorName.EcompConfigFileFormat, res, this.getClass().getName());
+ return;
+ }
+ }
+ // Validation passed
+ this.errors = errors;
+ }
+
+ public EcompErrorInfo getEcompErrorInfo(String key) {
+ EcompErrorInfo clone = null;
+ EcompErrorInfo other = errors.get(key);
+ if (other != null) {
+ clone = new EcompErrorInfo();
+ clone.cloneData(other);
+ }
+ return clone;
+ }
+
+ protected EcompErrorInfo validateEcompErrorInfo(String ecompErrorName, EcompErrorInfo ecompErrorInfoToValidate) {
+ if (ecompErrorInfoToValidate == null) {
+ return getErrorInfoForConfigFile("error " + ecompErrorName + " not found ");
+ }
+ String type = ecompErrorInfoToValidate.getType();
+ if (type == null) {
+ return getErrorInfoForConfigFile("empty error type for error " + ecompErrorName
+ + ", value should be one of the following: " + Arrays.asList(EcompErrorType.values()));
+ }
+ try {
+ EcompErrorType.valueOf(type);
+ } catch (IllegalArgumentException e) {
+ return getErrorInfoForConfigFile("error type " + type + " is invalid for error " + ecompErrorName
+ + ", value should be one of the following: " + Arrays.asList(EcompErrorType.values()));
+ }
+
+ String severity = ecompErrorInfoToValidate.getSeverity();
+ if (severity == null) {
+ return getErrorInfoForConfigFile("empty error severity for error " + ecompErrorName
+ + ", value should be one of the following: " + Arrays.asList(EcompErrorSeverity.values()));
+ }
+ try {
+ EcompErrorSeverity.valueOf(severity);
+ } catch (IllegalArgumentException e) {
+ return getErrorInfoForConfigFile("error severity " + severity + " is invalid for error " + ecompErrorName
+ + ", value should be one of the following: " + Arrays.asList(EcompErrorSeverity.values()));
+ }
+ String alarmSeverity = ecompErrorInfoToValidate.getAlarmSeverity();
+ if (alarmSeverity == null) {
+ return getErrorInfoForConfigFile("empty error alarm for error " + ecompErrorName
+ + ", , value should be one of the following: " + Arrays.asList(EcompAlarmSeverity.values()));
+ }
+ try {
+ EcompAlarmSeverity.valueOf(alarmSeverity);
+ } catch (IllegalArgumentException e) {
+ return getErrorInfoForConfigFile("error alarm severity " + alarmSeverity + " is invalid for error "
+ + ecompErrorName + ", , value should be one of the following: "
+ + Arrays.asList(EcompAlarmSeverity.values()));
+ }
+
+ String code = ecompErrorInfoToValidate.getCode();
+ if (code != null && ECODE_PATTERN.matcher(code).matches()) {
+ String[] split = code.split("_");
+ int parseInt = Integer.parseInt(split[1]);
+ if (parseInt < LOWEST_ERROR_VALID_CODE || parseInt > HIGHEST_ERROR_VALID_CODE) {
+ return getErrorInfoForInvalidCode(code, ecompErrorName);
+ }
+ } else {
+ return getErrorInfoForInvalidCode(code, ecompErrorName);
+ }
+ return null;
+ }
+
+ private EcompErrorInfo getErrorInfoForInvalidCode(String code, String ecompErrorName) {
+ return getErrorInfoForConfigFile("error code " + code + " is invalid for error " + ecompErrorName
+ + ", should be in format ASDC_[3010-9999]");
+ }
+
+ private EcompErrorInfo getErrorInfoForConfigFile(String errorMessage) {
+ EcompErrorInfo ecompErrorInfo = new EcompErrorInfo();
+ ecompErrorInfo.setCode(ECODE_PREFIX + "3000");
+ ecompErrorInfo.setType(EcompErrorType.CONFIG_ERROR.name());
+ ecompErrorInfo.setSeverity(EcompErrorSeverity.FATAL.name());
+ ecompErrorInfo.setAlarmSeverity(EcompAlarmSeverity.CRITICAL.name());
+ ecompErrorInfo.setDescription(errorMessage);
+ return ecompErrorInfo;
+ }
+
+ @Override
+ public String toString() {
+ return "EcompErrorConfiguration [errors=" + errors + "]";
+ }
+
+ /*******************************
+ * enums
+ */
+
+ public enum EcompErrorType {
+ RECOVERY, CONFIG_ERROR, SYSTEM_ERROR, DATA_ERROR, CONNECTION_PROBLEM, AUTHENTICATION_PROBLEM;
+ }
+
+ public enum EcompAlarmSeverity {
+ CRITICAL, MAJOR, MINOR, INFORMATIONAL, NONE;
+ }
+
+ public enum EcompErrorSeverity {
+ INFO, WARN, ERROR, FATAL;
+ }
+
+ public enum EcompErrorSeverityPrefix {
+ I, W, E, F;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(Arrays.asList(EcompErrorType.values()));
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorEnum.java b/common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorEnum.java
index 9d53f7bc2d..58e19a7347 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorEnum.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorEnum.java
@@ -7,9 +7,9 @@
* 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.
@@ -23,469 +23,467 @@ package org.openecomp.sdc.common.config;
public enum EcompErrorEnum {
- BeUebAuthenticationError(EcompErrorCode.E_100, ErrorType.AUTHENTICATION_PROBLEM, AlarmSeverity.MAJOR,
- EcompClassification.ERROR),
-
-
- DmaapHealthCheckError(EcompErrorCode.E_214, ErrorType.CONNECTION_PROBLEM, AlarmSeverity.MAJOR,
- EcompClassification.ERROR),
-
- InternalAuthenticationInfo(EcompErrorCode.E_199, ErrorType.AUTHENTICATION_PROBLEM, AlarmSeverity.INFORMATIONAL,
- EcompClassification.INFORMATION), InternalAuthenticationWarning(EcompErrorCode.E_199,
- ErrorType.AUTHENTICATION_PROBLEM, AlarmSeverity.MINOR,
- EcompClassification.WARNING), InternalAuthenticationError(EcompErrorCode.E_199,
- ErrorType.AUTHENTICATION_PROBLEM, AlarmSeverity.MAJOR,
- EcompClassification.ERROR), InternalAuthenticationFatal(EcompErrorCode.E_199,
- ErrorType.AUTHENTICATION_PROBLEM, AlarmSeverity.CRITICAL,
- EcompClassification.FATAL),
-
- BeHealthCheckRecovery(EcompErrorCode.E_205, ErrorType.RECOVERY, AlarmSeverity.INFORMATIONAL,
- EcompClassification.INFORMATION, null), BeHealthCheckJanusGraphRecovery(EcompErrorCode.E_206, ErrorType.RECOVERY,
- AlarmSeverity.INFORMATIONAL, EcompClassification.INFORMATION,
- null), BeHealthCheckElasticSearchRecovery(EcompErrorCode.E_207, ErrorType.RECOVERY,
- AlarmSeverity.INFORMATIONAL, EcompClassification.INFORMATION,
- null), BeHealthCheckUebClusterRecovery(EcompErrorCode.E_208, ErrorType.RECOVERY,
- AlarmSeverity.INFORMATIONAL, EcompClassification.INFORMATION,
- null), FeHealthCheckRecovery(EcompErrorCode.E_209, ErrorType.RECOVERY,
- AlarmSeverity.INFORMATIONAL, EcompClassification.INFORMATION,
- null),DmaapHealthCheckRecovery( EcompErrorCode.E_210, ErrorType.RECOVERY,
- AlarmSeverity.INFORMATIONAL, EcompClassification.INFORMATION,
- null), BeHealthCheckError(EcompErrorCode.E_200, ErrorType.SYSTEM_ERROR,
- AlarmSeverity.CRITICAL, EcompClassification.ERROR,
- BeHealthCheckRecovery),
-
- BeHealthCheckJanusGraphError(EcompErrorCode.E_201, ErrorType.SYSTEM_ERROR, AlarmSeverity.CRITICAL,
- EcompClassification.ERROR, BeHealthCheckJanusGraphRecovery), BeHealthCheckElasticSearchError(
- EcompErrorCode.E_202, ErrorType.SYSTEM_ERROR, AlarmSeverity.CRITICAL, EcompClassification.ERROR,
- BeHealthCheckElasticSearchRecovery), BeHealthCheckUebClusterError(EcompErrorCode.E_203,
- ErrorType.SYSTEM_ERROR, AlarmSeverity.CRITICAL, EcompClassification.ERROR,
- BeHealthCheckUebClusterRecovery), FeHealthCheckError(EcompErrorCode.E_204,
- ErrorType.SYSTEM_ERROR, AlarmSeverity.CRITICAL, EcompClassification.ERROR,
- FeHealthCheckRecovery), BeUebConnectionError(EcompErrorCode.E_210,
- ErrorType.CONNECTION_PROBLEM, AlarmSeverity.MAJOR,
- EcompClassification.ERROR), BeUebUnkownHostError(EcompErrorCode.E_211,
- ErrorType.CONNECTION_PROBLEM, AlarmSeverity.MAJOR,
- EcompClassification.ERROR),
-
- FqdnResolveError(EcompErrorCode.E_212, ErrorType.CONNECTION_PROBLEM, AlarmSeverity.MAJOR,
- EcompClassification.ERROR), SiteSwitchoverInfo(EcompErrorCode.E_213, ErrorType.RECOVERY,
- AlarmSeverity.INFORMATIONAL, EcompClassification.INFORMATION),
-
- InternalConnectionInfo(EcompErrorCode.E_299, ErrorType.CONNECTION_PROBLEM, AlarmSeverity.INFORMATIONAL,
- EcompClassification.INFORMATION), InternalConnectionWarning(EcompErrorCode.E_299,
- ErrorType.CONNECTION_PROBLEM, AlarmSeverity.MINOR,
- EcompClassification.WARNING), InternalConnectionError(EcompErrorCode.E_299,
- ErrorType.CONNECTION_PROBLEM, AlarmSeverity.MAJOR,
- EcompClassification.ERROR), InternalConnectionFatal(EcompErrorCode.E_299,
- ErrorType.CONNECTION_PROBLEM, AlarmSeverity.CRITICAL, EcompClassification.FATAL),
-
- BeComponentMissingError(EcompErrorCode.E_300, ErrorType.SYSTEM_ERROR, AlarmSeverity.MAJOR,
- EcompClassification.ERROR), BeIncorrectComponentError(EcompErrorCode.E_301, ErrorType.SYSTEM_ERROR,
- AlarmSeverity.MAJOR, EcompClassification.ERROR), BeInvalidConfigurationError(EcompErrorCode.E_302,
- ErrorType.CONFIG_ERROR, AlarmSeverity.MAJOR,
- EcompClassification.FATAL), BeUebObjectNotFoundError(EcompErrorCode.E_303,
- ErrorType.DATA_ERROR, AlarmSeverity.MAJOR,
- EcompClassification.ERROR), BeDistributionEngineInvalidArtifactType(
- EcompErrorCode.E_304, ErrorType.DATA_ERROR, AlarmSeverity.MAJOR,
- EcompClassification.WARNING), BeMissingConfigurationError(
- EcompErrorCode.E_305, ErrorType.CONFIG_ERROR, AlarmSeverity.MAJOR,
- EcompClassification.FATAL), BeConfigurationInvalidListSizeError(
- EcompErrorCode.E_306, ErrorType.CONFIG_ERROR,
- AlarmSeverity.MAJOR,
- EcompClassification.FATAL), ErrorConfigFileFormat(
- EcompErrorCode.E_307, ErrorType.CONFIG_ERROR,
- AlarmSeverity.MAJOR,
- EcompClassification.ERROR), BeMissingArtifactInformationError(
- EcompErrorCode.E_308, ErrorType.DATA_ERROR,
- AlarmSeverity.MAJOR,
- EcompClassification.ERROR), BeArtifactMissingError(
- EcompErrorCode.E_309,
- ErrorType.DATA_ERROR,
- AlarmSeverity.MAJOR,
- EcompClassification.ERROR), BeUserMissingError(
- EcompErrorCode.E_310,
- ErrorType.DATA_ERROR,
- AlarmSeverity.MAJOR,
- EcompClassification.ERROR), EcompMismatchParam(
- EcompErrorCode.E_311,
- ErrorType.CONFIG_ERROR,
- AlarmSeverity.MAJOR,
- EcompClassification.ERROR), EcompMissingError(
- EcompErrorCode.E_312,
- ErrorType.CONFIG_ERROR,
- AlarmSeverity.MAJOR,
- EcompClassification.ERROR),
-
- InternalDataInfo(EcompErrorCode.E_399, ErrorType.DATA_ERROR, AlarmSeverity.INFORMATIONAL,
- EcompClassification.INFORMATION), InternalDataWarning(EcompErrorCode.E_399, ErrorType.DATA_ERROR,
- AlarmSeverity.MINOR, EcompClassification.WARNING), InternalDataError(EcompErrorCode.E_399,
- ErrorType.DATA_ERROR, AlarmSeverity.MAJOR,
- EcompClassification.ERROR), InternalDataFatal(EcompErrorCode.E_399, ErrorType.DATA_ERROR,
- AlarmSeverity.CRITICAL, EcompClassification.FATAL),
-
- BeInvalidTypeError(EcompErrorCode.E_400, ErrorType.DATA_ERROR, AlarmSeverity.MAJOR,
- EcompClassification.WARNING), BeInvalidValueError(EcompErrorCode.E_401, ErrorType.DATA_ERROR,
- AlarmSeverity.MAJOR, EcompClassification.WARNING), BeArtifactPayloadInvalid(EcompErrorCode.E_402,
- ErrorType.DATA_ERROR, AlarmSeverity.MAJOR,
- EcompClassification.ERROR), BeArtifactInformationInvalidError(EcompErrorCode.E_403,
- ErrorType.DATA_ERROR, AlarmSeverity.MAJOR,
- EcompClassification.ERROR), BeGraphObjectMissingError(EcompErrorCode.E_404,
- ErrorType.DATA_ERROR, AlarmSeverity.CRITICAL,
- EcompClassification.ERROR), BeInvalidJsonInput(EcompErrorCode.E_405,
- ErrorType.SYSTEM_ERROR, AlarmSeverity.MAJOR,
- EcompClassification.ERROR), BeDistributionMissingError(
- EcompErrorCode.E_406, ErrorType.DATA_ERROR,
- AlarmSeverity.MAJOR, EcompClassification.ERROR),
-
- InvalidInputInfo(EcompErrorCode.E_499, ErrorType.SYSTEM_ERROR, AlarmSeverity.INFORMATIONAL,
- EcompClassification.INFORMATION), InvalidInputWarning(EcompErrorCode.E_499, ErrorType.SYSTEM_ERROR,
- AlarmSeverity.MINOR, EcompClassification.WARNING), InvalidInputError(EcompErrorCode.E_499,
- ErrorType.SYSTEM_ERROR, AlarmSeverity.MAJOR,
- EcompClassification.ERROR), InvalidInputFatal(EcompErrorCode.E_499, ErrorType.SYSTEM_ERROR,
- AlarmSeverity.CRITICAL, EcompClassification.FATAL),
-
- BeInitializationError(EcompErrorCode.E_500, ErrorType.SYSTEM_ERROR, AlarmSeverity.CRITICAL,
- EcompClassification.ERROR), BeFailedAddingResourceInstanceError(EcompErrorCode.E_501,
- ErrorType.SYSTEM_ERROR, AlarmSeverity.MAJOR, EcompClassification.ERROR), BeUebSystemError(
- EcompErrorCode.E_502, ErrorType.SYSTEM_ERROR, AlarmSeverity.MAJOR,
- EcompClassification.ERROR), BeDistributionEngineSystemError(EcompErrorCode.E_503,
- ErrorType.SYSTEM_ERROR, AlarmSeverity.MAJOR,
- EcompClassification.ERROR), BeFailedAddingNodeTypeError(EcompErrorCode.E_504,
- ErrorType.DATA_ERROR, AlarmSeverity.CRITICAL,
- EcompClassification.ERROR), BeDaoSystemError(EcompErrorCode.E_505,
- ErrorType.SYSTEM_ERROR, AlarmSeverity.CRITICAL,
- EcompClassification.ERROR), BeSystemError(EcompErrorCode.E_506,
- ErrorType.SYSTEM_ERROR, AlarmSeverity.CRITICAL,
- EcompClassification.ERROR), BeExecuteRollbackError(
- EcompErrorCode.E_507, ErrorType.DATA_ERROR,
- AlarmSeverity.MAJOR,
- EcompClassification.ERROR), BeFailedLockObjectError(
- EcompErrorCode.E_508,
- ErrorType.SYSTEM_ERROR,
- AlarmSeverity.CRITICAL,
- EcompClassification.WARNING), BeFailedCreateNodeError(
- EcompErrorCode.E_509,
- ErrorType.DATA_ERROR,
- AlarmSeverity.MAJOR,
- EcompClassification.ERROR), BeFailedUpdateNodeError(
- EcompErrorCode.E_510,
- ErrorType.DATA_ERROR,
- AlarmSeverity.MAJOR,
- EcompClassification.ERROR), BeFailedDeleteNodeError(
- EcompErrorCode.E_511,
- ErrorType.DATA_ERROR,
- AlarmSeverity.MAJOR,
- EcompClassification.ERROR), BeFailedRetrieveNodeError(
- EcompErrorCode.E_512,
- ErrorType.DATA_ERROR,
- AlarmSeverity.MAJOR,
- EcompClassification.ERROR), BeFailedFindParentError(
- EcompErrorCode.E_513,
- ErrorType.DATA_ERROR,
- AlarmSeverity.MAJOR,
- EcompClassification.ERROR), BeFailedFindAllNodesError(
- EcompErrorCode.E_514,
- ErrorType.DATA_ERROR,
- AlarmSeverity.MAJOR,
- EcompClassification.ERROR), BeFailedFindAssociationError(
- EcompErrorCode.E_515,
- ErrorType.DATA_ERROR,
- AlarmSeverity.MAJOR,
- EcompClassification.ERROR), BeComponentCleanerSystemError(
- EcompErrorCode.E_516,
- ErrorType.SYSTEM_ERROR,
- AlarmSeverity.MAJOR,
- EcompClassification.ERROR), FeHttpLoggingError(
- EcompErrorCode.E_517,
- ErrorType.SYSTEM_ERROR,
- AlarmSeverity.MINOR,
- EcompClassification.ERROR), FePortalServletError(
- EcompErrorCode.E_518,
- ErrorType.SYSTEM_ERROR,
- AlarmSeverity.MAJOR,
- EcompClassification.ERROR),
-
- InternalFlowInfo(EcompErrorCode.E_599, ErrorType.SYSTEM_ERROR, AlarmSeverity.INFORMATIONAL,
- EcompClassification.INFORMATION), InternalFlowWarning(EcompErrorCode.E_599, ErrorType.SYSTEM_ERROR,
- AlarmSeverity.MINOR, EcompClassification.WARNING), InternalFlowError(EcompErrorCode.E_599,
- ErrorType.SYSTEM_ERROR, AlarmSeverity.MAJOR,
- EcompClassification.ERROR), InternalFlowFatal(EcompErrorCode.E_599, ErrorType.SYSTEM_ERROR,
- AlarmSeverity.CRITICAL, EcompClassification.FATAL),
-
- BeRestApiGeneralError(EcompErrorCode.E_900, ErrorType.SYSTEM_ERROR, AlarmSeverity.CRITICAL,
- EcompClassification.ERROR, null), FeHealthCheckGeneralError(EcompErrorCode.E_901, ErrorType.SYSTEM_ERROR,
- AlarmSeverity.CRITICAL, EcompClassification.ERROR, null),
-
- InternalUnexpectedInfo(EcompErrorCode.E_999, ErrorType.SYSTEM_ERROR, AlarmSeverity.INFORMATIONAL,
- EcompClassification.INFORMATION), InternalUnexpectedWarning(EcompErrorCode.E_999, ErrorType.SYSTEM_ERROR,
- AlarmSeverity.MINOR, EcompClassification.WARNING), InternalUnexpectedError(EcompErrorCode.E_999,
- ErrorType.SYSTEM_ERROR, AlarmSeverity.MAJOR,
- EcompClassification.ERROR), InternalUnexpectedFatal(EcompErrorCode.E_999,
- ErrorType.SYSTEM_ERROR, AlarmSeverity.CRITICAL, EcompClassification.FATAL),
-
- /*
- * BeUebAuthenticationError(EcompErrorCode.E_100,
- * ErrorType.AUTHENTICATION_PROBLEM, AlarmSeverity.MAJOR,
- * EcompClassification.ERROR),
- *
- * InternalAuthenticationInfo(EcompErrorCode.E_199,
- * ErrorType.AUTHENTICATION_PROBLEM, AlarmSeverity.INFORMATIONAL,
- * EcompClassification.INFORMATION),
- * InternalAuthenticationWarning(EcompErrorCode.E_199,
- * ErrorType.AUTHENTICATION_PROBLEM, AlarmSeverity.MINOR,
- * EcompClassification.WARNING),
- * InternalAuthenticationError(EcompErrorCode.E_199,
- * ErrorType.AUTHENTICATION_PROBLEM, AlarmSeverity.MAJOR,
- * EcompClassification.ERROR),
- * InternalAuthenticationFatal(EcompErrorCode.E_199,
- * ErrorType.AUTHENTICATION_PROBLEM, AlarmSeverity.CRITICAL,
- * EcompClassification.FATAL),
- * //BeFailedDeletingResourceInstanceError(EcompErrorCode.E_200,
- * ErrorType.SYSTEM_ERROR, AlarmSeverity.MAJOR, Classification.ERROR),
- *
- * BeHealthCheckRecovery(EcompErrorCode.E_205, ErrorType.RECOVERY,
- * AlarmSeverity.INFORMATIONAL, EcompClassification.INFORMATION, null),
- * BeHealthCheckJanusGraphRecovery(EcompErrorCode.E_206, ErrorType.RECOVERY,
- * AlarmSeverity.INFORMATIONAL, EcompClassification.INFORMATION, null),
- * BeHealthCheckElasticSearchRecovery(EcompErrorCode.E_207,
- * ErrorType.RECOVERY, AlarmSeverity.INFORMATIONAL,
- * EcompClassification.INFORMATION, null),
- * BeHealthCheckUebClusterRecovery(EcompErrorCode.E_208, ErrorType.RECOVERY,
- * AlarmSeverity.INFORMATIONAL, EcompClassification.INFORMATION, null),
- * FeHealthCheckRecovery(EcompErrorCode.E_209, ErrorType.RECOVERY,
- * AlarmSeverity.INFORMATIONAL, EcompClassification.INFORMATION, null),
- * BeHealthCheckError(EcompErrorCode.E_200, ErrorType.SYSTEM_ERROR,
- * AlarmSeverity.CRITICAL, EcompClassification.ERROR,
- * BeHealthCheckRecovery),
- *
- * BeHealthCheckJanusGraphError(EcompErrorCode.E_201, ErrorType.SYSTEM_ERROR,
- * AlarmSeverity.CRITICAL, EcompClassification.ERROR,
- * BeHealthCheckJanusGraphRecovery),
- * BeHealthCheckElasticSearchError(EcompErrorCode.E_202,
- * ErrorType.SYSTEM_ERROR, AlarmSeverity.CRITICAL,
- * EcompClassification.ERROR, BeHealthCheckElasticSearchRecovery),
- * BeHealthCheckUebClusterError(EcompErrorCode.E_203,
- * ErrorType.SYSTEM_ERROR, AlarmSeverity.CRITICAL,
- * EcompClassification.ERROR, BeHealthCheckUebClusterRecovery),
- * FeHealthCheckError(EcompErrorCode.E_204, ErrorType.SYSTEM_ERROR,
- * AlarmSeverity.CRITICAL, EcompClassification.ERROR,
- * FeHealthCheckRecovery), BeUebConnectionError(EcompErrorCode.E_210,
- * ErrorType.CONNECTION_PROBLEM, AlarmSeverity.MAJOR,
- * EcompClassification.ERROR), BeUebUnkownHostError(EcompErrorCode.E_211,
- * ErrorType.CONNECTION_PROBLEM, AlarmSeverity.MAJOR,
- * EcompClassification.ERROR),
- *
- * InternalConnectionInfo(EcompErrorCode.E_299,
- * ErrorType.CONNECTION_PROBLEM, AlarmSeverity.INFORMATIONAL,
- * EcompClassification.INFORMATION),
- * InternalConnectionWarning(EcompErrorCode.E_299,
- * ErrorType.CONNECTION_PROBLEM, AlarmSeverity.MINOR,
- * EcompClassification.WARNING),
- * InternalConnectionError(EcompErrorCode.E_299,
- * ErrorType.CONNECTION_PROBLEM, AlarmSeverity.MAJOR,
- * EcompClassification.ERROR), InternalConnectionFatal(EcompErrorCode.E_299,
- * ErrorType.CONNECTION_PROBLEM, AlarmSeverity.CRITICAL,
- * EcompClassification.FATAL),
- *
- * BeComponentMissingError(EcompErrorCode.E_300, ErrorType.SYSTEM_ERROR,
- * AlarmSeverity.MAJOR, EcompClassification.ERROR),
- * BeIncorrectComponentError(EcompErrorCode.E_301, ErrorType.SYSTEM_ERROR,
- * AlarmSeverity.MAJOR, EcompClassification.ERROR),
- * BeInvalidConfigurationError(EcompErrorCode.E_302, ErrorType.CONFIG_ERROR,
- * AlarmSeverity.MAJOR, EcompClassification.FATAL),
- * BeUebObjectNotFoundError(EcompErrorCode.E_303, ErrorType.DATA_ERROR,
- * AlarmSeverity.MAJOR, EcompClassification.ERROR),
- * BeDistributionEngineInvalidArtifactType(EcompErrorCode.E_304,
- * ErrorType.DATA_ERROR, AlarmSeverity.MAJOR, EcompClassification.WARNING),
- * BeMissingConfigurationError(EcompErrorCode.E_305, ErrorType.CONFIG_ERROR,
- * AlarmSeverity.MAJOR, EcompClassification.FATAL),
- * BeConfigurationInvalidListSizeError(EcompErrorCode.E_306,
- * ErrorType.CONFIG_ERROR, AlarmSeverity.MAJOR, EcompClassification.FATAL),
- * ErrorConfigFileFormat(EcompErrorCode.E_307, ErrorType.CONFIG_ERROR,
- * AlarmSeverity.MAJOR, EcompClassification.ERROR),
- * BeMissingArtifactInformationError(EcompErrorCode.E_308,
- * ErrorType.DATA_ERROR, AlarmSeverity.MAJOR, EcompClassification.ERROR),
- * BeArtifactMissingError(EcompErrorCode.E_309, ErrorType.DATA_ERROR,
- * AlarmSeverity.MAJOR, EcompClassification.ERROR),
- * BeUserMissingError(EcompErrorCode.E_310, ErrorType.DATA_ERROR,
- * AlarmSeverity.MAJOR, EcompClassification.ERROR),
- * EcompMismatchParam(EcompErrorCode.E_311, ErrorType.CONFIG_ERROR,
- * AlarmSeverity.MAJOR, EcompClassification.ERROR),
- * EcompMissingError(EcompErrorCode.E_312, ErrorType.CONFIG_ERROR,
- * AlarmSeverity.MAJOR, EcompClassification.ERROR),
- *
- * InternalDataInfo(EcompErrorCode.E_399, ErrorType.DATA_ERROR,
- * AlarmSeverity.INFORMATIONAL, EcompClassification.INFORMATION),
- * InternalDataWarning(EcompErrorCode.E_399, ErrorType.DATA_ERROR,
- * AlarmSeverity.MINOR, EcompClassification.WARNING),
- * InternalDataError(EcompErrorCode.E_399, ErrorType.DATA_ERROR,
- * AlarmSeverity.MAJOR, EcompClassification.ERROR),
- * InternalDataFatal(EcompErrorCode.E_399, ErrorType.DATA_ERROR,
- * AlarmSeverity.CRITICAL, EcompClassification.FATAL),
- *
- * BeInvalidTypeError(EcompErrorCode.E_400, ErrorType.DATA_ERROR,
- * AlarmSeverity.MAJOR, EcompClassification.WARNING),
- * BeInvalidValueError(EcompErrorCode.E_401, ErrorType.DATA_ERROR,
- * AlarmSeverity.MAJOR, EcompClassification.WARNING),
- * BeArtifactPayloadInvalid(EcompErrorCode.E_402, ErrorType.DATA_ERROR,
- * AlarmSeverity.MAJOR, EcompClassification.ERROR),
- * BeArtifactInformationInvalidError(EcompErrorCode.E_403,
- * ErrorType.DATA_ERROR, AlarmSeverity.MAJOR, EcompClassification.ERROR),
- * BeDistributionMissingError(EcompErrorCode.E_404, ErrorType.DATA_ERROR,
- * AlarmSeverity.MAJOR, EcompClassification.ERROR),
- * BeGraphObjectMissingError(EcompErrorCode.E_404, ErrorType.DATA_ERROR,
- * AlarmSeverity.CRITICAL, EcompClassification.ERROR),
- * BeInvalidJsonInput(EcompErrorCode.E_405, ErrorType.SYSTEM_ERROR,
- * AlarmSeverity.MAJOR, EcompClassification.ERROR),
- *
- * InvalidInputInfo(EcompErrorCode.E_499, ErrorType.SYSTEM_ERROR,
- * AlarmSeverity.INFORMATIONAL, EcompClassification.INFORMATION),
- * InvalidInputWarning(EcompErrorCode.E_499, ErrorType.SYSTEM_ERROR,
- * AlarmSeverity.MINOR, EcompClassification.WARNING),
- * InvalidInputError(EcompErrorCode.E_499, ErrorType.SYSTEM_ERROR,
- * AlarmSeverity.MAJOR, EcompClassification.ERROR),
- * InvalidInputFatal(EcompErrorCode.E_499, ErrorType.SYSTEM_ERROR,
- * AlarmSeverity.CRITICAL, EcompClassification.FATAL),
- *
- * BeInitializationError(EcompErrorCode.E_500, ErrorType.SYSTEM_ERROR,
- * AlarmSeverity.CRITICAL, EcompClassification.ERROR),
- * BeFailedAddingResourceInstanceError(EcompErrorCode.E_501,
- * ErrorType.SYSTEM_ERROR, AlarmSeverity.MAJOR, EcompClassification.ERROR),
- * BeUebSystemError(EcompErrorCode.E_502, ErrorType.SYSTEM_ERROR,
- * AlarmSeverity.MAJOR, EcompClassification.ERROR),
- * BeDistributionEngineSystemError(EcompErrorCode.E_503,
- * ErrorType.SYSTEM_ERROR, AlarmSeverity.MAJOR, EcompClassification.ERROR),
- * BeFailedAddingNodeTypeError(EcompErrorCode.E_504, ErrorType.DATA_ERROR,
- * AlarmSeverity.CRITICAL, EcompClassification.ERROR),
- * BeDaoSystemError(EcompErrorCode.E_505, ErrorType.SYSTEM_ERROR,
- * AlarmSeverity.CRITICAL, EcompClassification.ERROR),
- * BeSystemError(EcompErrorCode.E_506, ErrorType.SYSTEM_ERROR,
- * AlarmSeverity.CRITICAL, EcompClassification.ERROR),
- * BeExecuteRollbackError(EcompErrorCode.E_507, ErrorType.DATA_ERROR,
- * AlarmSeverity.MAJOR, EcompClassification.ERROR),
- * BeFailedLockObjectError(EcompErrorCode.E_508, ErrorType.SYSTEM_ERROR,
- * AlarmSeverity.CRITICAL, EcompClassification.WARNING),
- * BeFailedCreateNodeError(EcompErrorCode.E_509, ErrorType.DATA_ERROR,
- * AlarmSeverity.MAJOR, EcompClassification.ERROR),
- * BeFailedUpdateNodeError(EcompErrorCode.E_510, ErrorType.DATA_ERROR,
- * AlarmSeverity.MAJOR, EcompClassification.ERROR),
- * BeFailedDeleteNodeError(EcompErrorCode.E_511, ErrorType.DATA_ERROR,
- * AlarmSeverity.MAJOR, EcompClassification.ERROR),
- * BeFailedRetrieveNodeError(EcompErrorCode.E_512, ErrorType.DATA_ERROR,
- * AlarmSeverity.MAJOR, EcompClassification.ERROR),
- * BeFailedFindParentError(EcompErrorCode.E_513, ErrorType.DATA_ERROR,
- * AlarmSeverity.MAJOR, EcompClassification.ERROR),
- * BeFailedFindAllNodesError(EcompErrorCode.E_514, ErrorType.DATA_ERROR,
- * AlarmSeverity.MAJOR, EcompClassification.ERROR),
- * BeFailedFindAssociationError(EcompErrorCode.E_515, ErrorType.DATA_ERROR,
- * AlarmSeverity.MAJOR, EcompClassification.ERROR),
- * BeComponentCleanerSystemError(EcompErrorCode.E_516,
- * ErrorType.SYSTEM_ERROR, AlarmSeverity.MAJOR, EcompClassification.ERROR),
- * FeHttpLoggingError(EcompErrorCode.E_517, ErrorType.SYSTEM_ERROR,
- * AlarmSeverity.MINOR, EcompClassification.ERROR),
- * FePortalServletError(EcompErrorCode.E_518, ErrorType.SYSTEM_ERROR,
- * AlarmSeverity.MAJOR, EcompClassification.ERROR),
- *
- * InternalFlowInfo(EcompErrorCode.E_599, ErrorType.SYSTEM_ERROR,
- * AlarmSeverity.INFORMATIONAL, EcompClassification.INFORMATION),
- * InternalFlowWarning(EcompErrorCode.E_599, ErrorType.SYSTEM_ERROR,
- * AlarmSeverity.MINOR, EcompClassification.WARNING),
- * InternalFlowError(EcompErrorCode.E_599, ErrorType.SYSTEM_ERROR,
- * AlarmSeverity.MAJOR, EcompClassification.ERROR),
- * InternalFlowFatal(EcompErrorCode.E_599, ErrorType.SYSTEM_ERROR,
- * AlarmSeverity.CRITICAL, EcompClassification.FATAL),
- *
- * BeRestApiGeneralError(EcompErrorCode.E_900, ErrorType.SYSTEM_ERROR,
- * AlarmSeverity.CRITICAL, EcompClassification.ERROR, null),
- * FeHealthCheckGeneralError(EcompErrorCode.E_901, ErrorType.SYSTEM_ERROR,
- * AlarmSeverity.CRITICAL, EcompClassification.ERROR, null),
- *
- * InternalUnexpectedInfo(EcompErrorCode.E_999, ErrorType.SYSTEM_ERROR,
- * AlarmSeverity.INFORMATIONAL, EcompClassification.INFORMATION),
- * InternalUnexpectedWarning(EcompErrorCode.E_999, ErrorType.SYSTEM_ERROR,
- * AlarmSeverity.MINOR, EcompClassification.WARNING),
- * InternalUnexpectedError(EcompErrorCode.E_999, ErrorType.SYSTEM_ERROR,
- * AlarmSeverity.MAJOR, EcompClassification.ERROR),
- * InternalUnexpectedFatal(EcompErrorCode.E_999, ErrorType.SYSTEM_ERROR,
- * AlarmSeverity.CRITICAL, EcompClassification.FATAL),
- */
-
- ;
-
- EcompErrorCode ecompErrorCode;
- ErrorType eType;
- AlarmSeverity alarmSeverity;
- EcompClassification classification;
- EcompErrorEnum clearCode;
-
- EcompErrorEnum(EcompErrorCode ecompErrorCode, ErrorType eType, AlarmSeverity alarmSeverity,
- EcompClassification classification, EcompErrorEnum clearCode) {
-
- this.ecompErrorCode = ecompErrorCode;
- this.eType = eType;
- this.alarmSeverity = alarmSeverity;
- this.classification = classification;
- this.clearCode = clearCode;
- }
-
- EcompErrorEnum(EcompErrorCode ecompErrorCode, ErrorType eType, AlarmSeverity alarmSeverity,
- EcompClassification classification) {
-
- this.ecompErrorCode = ecompErrorCode;
- this.eType = eType;
- this.alarmSeverity = alarmSeverity;
- this.classification = classification;
- }
-
- public ErrorType geteType() {
- return eType;
- }
-
- public void seteType(ErrorType eType) {
- this.eType = eType;
- }
-
- public AlarmSeverity getAlarmSeverity() {
- return alarmSeverity;
- }
-
- public void setAlarmSeverity(AlarmSeverity alarmSeverity) {
- this.alarmSeverity = alarmSeverity;
- }
-
- public EcompErrorCode getEcompErrorCode() {
- return ecompErrorCode;
- }
-
- public void setEcompErrorCode(EcompErrorCode ecompErrorCode) {
- this.ecompErrorCode = ecompErrorCode;
- }
-
- public EcompClassification getClassification() {
- return classification;
- }
-
- public void setClassification(EcompClassification classification) {
- this.classification = classification;
- }
-
- public EcompErrorEnum getClearCode() {
- return clearCode;
- }
-
- public void setClearCode(EcompErrorEnum clearCode) {
- this.clearCode = clearCode;
- }
-
- public static enum ErrorType {
- RECOVERY, CONFIG_ERROR, SYSTEM_ERROR, DATA_ERROR, CONNECTION_PROBLEM, AUTHENTICATION_PROBLEM
- }
-
- public static enum AlarmSeverity {
- CRITICAL, MAJOR, MINOR, INFORMATIONAL, NONE
- }
-
- // public String toString() {
- // return eType + "," + eCode + "," + desc;
- // }
+ BeUebAuthenticationError(EcompErrorCode.E_100, ErrorType.AUTHENTICATION_PROBLEM, AlarmSeverity.MAJOR,
+ EcompClassification.ERROR),
+
+
+ DmaapHealthCheckError(EcompErrorCode.E_214, ErrorType.CONNECTION_PROBLEM, AlarmSeverity.MAJOR,
+ EcompClassification.ERROR),
+
+ InternalAuthenticationInfo(EcompErrorCode.E_199, ErrorType.AUTHENTICATION_PROBLEM, AlarmSeverity.INFORMATIONAL,
+ EcompClassification.INFORMATION), InternalAuthenticationWarning(EcompErrorCode.E_199,
+ ErrorType.AUTHENTICATION_PROBLEM, AlarmSeverity.MINOR,
+ EcompClassification.WARNING), InternalAuthenticationError(EcompErrorCode.E_199,
+ ErrorType.AUTHENTICATION_PROBLEM, AlarmSeverity.MAJOR,
+ EcompClassification.ERROR), InternalAuthenticationFatal(EcompErrorCode.E_199,
+ ErrorType.AUTHENTICATION_PROBLEM, AlarmSeverity.CRITICAL,
+ EcompClassification.FATAL),
+
+ BeHealthCheckRecovery(EcompErrorCode.E_205, ErrorType.RECOVERY, AlarmSeverity.INFORMATIONAL,
+ EcompClassification.INFORMATION, null), BeHealthCheckJanusGraphRecovery(EcompErrorCode.E_206, ErrorType.RECOVERY,
+ AlarmSeverity.INFORMATIONAL, EcompClassification.INFORMATION,
+ null), BeHealthCheckElasticSearchRecovery(EcompErrorCode.E_207, ErrorType.RECOVERY,
+ AlarmSeverity.INFORMATIONAL, EcompClassification.INFORMATION,
+ null), BeHealthCheckUebClusterRecovery(EcompErrorCode.E_208, ErrorType.RECOVERY,
+ AlarmSeverity.INFORMATIONAL, EcompClassification.INFORMATION,
+ null), FeHealthCheckRecovery(EcompErrorCode.E_209, ErrorType.RECOVERY,
+ AlarmSeverity.INFORMATIONAL, EcompClassification.INFORMATION,
+ null), DmaapHealthCheckRecovery(EcompErrorCode.E_210, ErrorType.RECOVERY,
+ AlarmSeverity.INFORMATIONAL, EcompClassification.INFORMATION,
+ null), BeHealthCheckError(EcompErrorCode.E_200, ErrorType.SYSTEM_ERROR,
+ AlarmSeverity.CRITICAL, EcompClassification.ERROR,
+ BeHealthCheckRecovery),
+
+ BeHealthCheckJanusGraphError(EcompErrorCode.E_201, ErrorType.SYSTEM_ERROR, AlarmSeverity.CRITICAL,
+ EcompClassification.ERROR, BeHealthCheckJanusGraphRecovery), BeHealthCheckElasticSearchError(
+ EcompErrorCode.E_202, ErrorType.SYSTEM_ERROR, AlarmSeverity.CRITICAL, EcompClassification.ERROR,
+ BeHealthCheckElasticSearchRecovery), BeHealthCheckUebClusterError(EcompErrorCode.E_203,
+ ErrorType.SYSTEM_ERROR, AlarmSeverity.CRITICAL, EcompClassification.ERROR,
+ BeHealthCheckUebClusterRecovery), FeHealthCheckError(EcompErrorCode.E_204,
+ ErrorType.SYSTEM_ERROR, AlarmSeverity.CRITICAL, EcompClassification.ERROR,
+ FeHealthCheckRecovery), BeUebConnectionError(EcompErrorCode.E_210,
+ ErrorType.CONNECTION_PROBLEM, AlarmSeverity.MAJOR,
+ EcompClassification.ERROR), BeUebUnkownHostError(EcompErrorCode.E_211,
+ ErrorType.CONNECTION_PROBLEM, AlarmSeverity.MAJOR,
+ EcompClassification.ERROR),
+
+ FqdnResolveError(EcompErrorCode.E_212, ErrorType.CONNECTION_PROBLEM, AlarmSeverity.MAJOR,
+ EcompClassification.ERROR), SiteSwitchoverInfo(EcompErrorCode.E_213, ErrorType.RECOVERY,
+ AlarmSeverity.INFORMATIONAL, EcompClassification.INFORMATION),
+
+ InternalConnectionInfo(EcompErrorCode.E_299, ErrorType.CONNECTION_PROBLEM, AlarmSeverity.INFORMATIONAL,
+ EcompClassification.INFORMATION), InternalConnectionWarning(EcompErrorCode.E_299,
+ ErrorType.CONNECTION_PROBLEM, AlarmSeverity.MINOR,
+ EcompClassification.WARNING), InternalConnectionError(EcompErrorCode.E_299,
+ ErrorType.CONNECTION_PROBLEM, AlarmSeverity.MAJOR,
+ EcompClassification.ERROR), InternalConnectionFatal(EcompErrorCode.E_299,
+ ErrorType.CONNECTION_PROBLEM, AlarmSeverity.CRITICAL, EcompClassification.FATAL),
+
+ BeComponentMissingError(EcompErrorCode.E_300, ErrorType.SYSTEM_ERROR, AlarmSeverity.MAJOR,
+ EcompClassification.ERROR), BeIncorrectComponentError(EcompErrorCode.E_301, ErrorType.SYSTEM_ERROR,
+ AlarmSeverity.MAJOR, EcompClassification.ERROR), BeInvalidConfigurationError(EcompErrorCode.E_302,
+ ErrorType.CONFIG_ERROR, AlarmSeverity.MAJOR,
+ EcompClassification.FATAL), BeUebObjectNotFoundError(EcompErrorCode.E_303,
+ ErrorType.DATA_ERROR, AlarmSeverity.MAJOR,
+ EcompClassification.ERROR), BeDistributionEngineInvalidArtifactType(
+ EcompErrorCode.E_304, ErrorType.DATA_ERROR, AlarmSeverity.MAJOR,
+ EcompClassification.WARNING), BeMissingConfigurationError(
+ EcompErrorCode.E_305, ErrorType.CONFIG_ERROR, AlarmSeverity.MAJOR,
+ EcompClassification.FATAL), BeConfigurationInvalidListSizeError(
+ EcompErrorCode.E_306, ErrorType.CONFIG_ERROR,
+ AlarmSeverity.MAJOR,
+ EcompClassification.FATAL), ErrorConfigFileFormat(
+ EcompErrorCode.E_307, ErrorType.CONFIG_ERROR,
+ AlarmSeverity.MAJOR,
+ EcompClassification.ERROR), BeMissingArtifactInformationError(
+ EcompErrorCode.E_308, ErrorType.DATA_ERROR,
+ AlarmSeverity.MAJOR,
+ EcompClassification.ERROR), BeArtifactMissingError(
+ EcompErrorCode.E_309,
+ ErrorType.DATA_ERROR,
+ AlarmSeverity.MAJOR,
+ EcompClassification.ERROR), BeUserMissingError(
+ EcompErrorCode.E_310,
+ ErrorType.DATA_ERROR,
+ AlarmSeverity.MAJOR,
+ EcompClassification.ERROR), EcompMismatchParam(
+ EcompErrorCode.E_311,
+ ErrorType.CONFIG_ERROR,
+ AlarmSeverity.MAJOR,
+ EcompClassification.ERROR), EcompMissingError(
+ EcompErrorCode.E_312,
+ ErrorType.CONFIG_ERROR,
+ AlarmSeverity.MAJOR,
+ EcompClassification.ERROR),
+
+ InternalDataInfo(EcompErrorCode.E_399, ErrorType.DATA_ERROR, AlarmSeverity.INFORMATIONAL,
+ EcompClassification.INFORMATION), InternalDataWarning(EcompErrorCode.E_399, ErrorType.DATA_ERROR,
+ AlarmSeverity.MINOR, EcompClassification.WARNING), InternalDataError(EcompErrorCode.E_399,
+ ErrorType.DATA_ERROR, AlarmSeverity.MAJOR,
+ EcompClassification.ERROR), InternalDataFatal(EcompErrorCode.E_399, ErrorType.DATA_ERROR,
+ AlarmSeverity.CRITICAL, EcompClassification.FATAL),
+
+ BeInvalidTypeError(EcompErrorCode.E_400, ErrorType.DATA_ERROR, AlarmSeverity.MAJOR,
+ EcompClassification.WARNING), BeInvalidValueError(EcompErrorCode.E_401, ErrorType.DATA_ERROR,
+ AlarmSeverity.MAJOR, EcompClassification.WARNING), BeArtifactPayloadInvalid(EcompErrorCode.E_402,
+ ErrorType.DATA_ERROR, AlarmSeverity.MAJOR,
+ EcompClassification.ERROR), BeArtifactInformationInvalidError(EcompErrorCode.E_403,
+ ErrorType.DATA_ERROR, AlarmSeverity.MAJOR,
+ EcompClassification.ERROR), BeGraphObjectMissingError(EcompErrorCode.E_404,
+ ErrorType.DATA_ERROR, AlarmSeverity.CRITICAL,
+ EcompClassification.ERROR), BeInvalidJsonInput(EcompErrorCode.E_405,
+ ErrorType.SYSTEM_ERROR, AlarmSeverity.MAJOR,
+ EcompClassification.ERROR), BeDistributionMissingError(
+ EcompErrorCode.E_406, ErrorType.DATA_ERROR,
+ AlarmSeverity.MAJOR, EcompClassification.ERROR),
+
+ InvalidInputInfo(EcompErrorCode.E_499, ErrorType.SYSTEM_ERROR, AlarmSeverity.INFORMATIONAL,
+ EcompClassification.INFORMATION), InvalidInputWarning(EcompErrorCode.E_499, ErrorType.SYSTEM_ERROR,
+ AlarmSeverity.MINOR, EcompClassification.WARNING), InvalidInputError(EcompErrorCode.E_499,
+ ErrorType.SYSTEM_ERROR, AlarmSeverity.MAJOR,
+ EcompClassification.ERROR), InvalidInputFatal(EcompErrorCode.E_499, ErrorType.SYSTEM_ERROR,
+ AlarmSeverity.CRITICAL, EcompClassification.FATAL),
+
+ BeInitializationError(EcompErrorCode.E_500, ErrorType.SYSTEM_ERROR, AlarmSeverity.CRITICAL,
+ EcompClassification.ERROR), BeFailedAddingResourceInstanceError(EcompErrorCode.E_501,
+ ErrorType.SYSTEM_ERROR, AlarmSeverity.MAJOR, EcompClassification.ERROR), BeUebSystemError(
+ EcompErrorCode.E_502, ErrorType.SYSTEM_ERROR, AlarmSeverity.MAJOR,
+ EcompClassification.ERROR), BeDistributionEngineSystemError(EcompErrorCode.E_503,
+ ErrorType.SYSTEM_ERROR, AlarmSeverity.MAJOR,
+ EcompClassification.ERROR), BeFailedAddingNodeTypeError(EcompErrorCode.E_504,
+ ErrorType.DATA_ERROR, AlarmSeverity.CRITICAL,
+ EcompClassification.ERROR), BeDaoSystemError(EcompErrorCode.E_505,
+ ErrorType.SYSTEM_ERROR, AlarmSeverity.CRITICAL,
+ EcompClassification.ERROR), BeSystemError(EcompErrorCode.E_506,
+ ErrorType.SYSTEM_ERROR, AlarmSeverity.CRITICAL,
+ EcompClassification.ERROR), BeExecuteRollbackError(
+ EcompErrorCode.E_507, ErrorType.DATA_ERROR,
+ AlarmSeverity.MAJOR,
+ EcompClassification.ERROR), BeFailedLockObjectError(
+ EcompErrorCode.E_508,
+ ErrorType.SYSTEM_ERROR,
+ AlarmSeverity.CRITICAL,
+ EcompClassification.WARNING), BeFailedCreateNodeError(
+ EcompErrorCode.E_509,
+ ErrorType.DATA_ERROR,
+ AlarmSeverity.MAJOR,
+ EcompClassification.ERROR), BeFailedUpdateNodeError(
+ EcompErrorCode.E_510,
+ ErrorType.DATA_ERROR,
+ AlarmSeverity.MAJOR,
+ EcompClassification.ERROR), BeFailedDeleteNodeError(
+ EcompErrorCode.E_511,
+ ErrorType.DATA_ERROR,
+ AlarmSeverity.MAJOR,
+ EcompClassification.ERROR), BeFailedRetrieveNodeError(
+ EcompErrorCode.E_512,
+ ErrorType.DATA_ERROR,
+ AlarmSeverity.MAJOR,
+ EcompClassification.ERROR), BeFailedFindParentError(
+ EcompErrorCode.E_513,
+ ErrorType.DATA_ERROR,
+ AlarmSeverity.MAJOR,
+ EcompClassification.ERROR), BeFailedFindAllNodesError(
+ EcompErrorCode.E_514,
+ ErrorType.DATA_ERROR,
+ AlarmSeverity.MAJOR,
+ EcompClassification.ERROR), BeFailedFindAssociationError(
+ EcompErrorCode.E_515,
+ ErrorType.DATA_ERROR,
+ AlarmSeverity.MAJOR,
+ EcompClassification.ERROR), BeComponentCleanerSystemError(
+ EcompErrorCode.E_516,
+ ErrorType.SYSTEM_ERROR,
+ AlarmSeverity.MAJOR,
+ EcompClassification.ERROR), FeHttpLoggingError(
+ EcompErrorCode.E_517,
+ ErrorType.SYSTEM_ERROR,
+ AlarmSeverity.MINOR,
+ EcompClassification.ERROR), FePortalServletError(
+ EcompErrorCode.E_518,
+ ErrorType.SYSTEM_ERROR,
+ AlarmSeverity.MAJOR,
+ EcompClassification.ERROR),
+
+ InternalFlowInfo(EcompErrorCode.E_599, ErrorType.SYSTEM_ERROR, AlarmSeverity.INFORMATIONAL,
+ EcompClassification.INFORMATION), InternalFlowWarning(EcompErrorCode.E_599, ErrorType.SYSTEM_ERROR,
+ AlarmSeverity.MINOR, EcompClassification.WARNING), InternalFlowError(EcompErrorCode.E_599,
+ ErrorType.SYSTEM_ERROR, AlarmSeverity.MAJOR,
+ EcompClassification.ERROR), InternalFlowFatal(EcompErrorCode.E_599, ErrorType.SYSTEM_ERROR,
+ AlarmSeverity.CRITICAL, EcompClassification.FATAL),
+
+ BeRestApiGeneralError(EcompErrorCode.E_900, ErrorType.SYSTEM_ERROR, AlarmSeverity.CRITICAL,
+ EcompClassification.ERROR, null), FeHealthCheckGeneralError(EcompErrorCode.E_901, ErrorType.SYSTEM_ERROR,
+ AlarmSeverity.CRITICAL, EcompClassification.ERROR, null),
+
+ InternalUnexpectedInfo(EcompErrorCode.E_999, ErrorType.SYSTEM_ERROR, AlarmSeverity.INFORMATIONAL,
+ EcompClassification.INFORMATION), InternalUnexpectedWarning(EcompErrorCode.E_999, ErrorType.SYSTEM_ERROR,
+ AlarmSeverity.MINOR, EcompClassification.WARNING), InternalUnexpectedError(EcompErrorCode.E_999,
+ ErrorType.SYSTEM_ERROR, AlarmSeverity.MAJOR,
+ EcompClassification.ERROR), InternalUnexpectedFatal(EcompErrorCode.E_999,
+ ErrorType.SYSTEM_ERROR, AlarmSeverity.CRITICAL, EcompClassification.FATAL),
+
+ /*
+ * BeUebAuthenticationError(EcompErrorCode.E_100,
+ * ErrorType.AUTHENTICATION_PROBLEM, AlarmSeverity.MAJOR,
+ * EcompClassification.ERROR),
+ *
+ * InternalAuthenticationInfo(EcompErrorCode.E_199,
+ * ErrorType.AUTHENTICATION_PROBLEM, AlarmSeverity.INFORMATIONAL,
+ * EcompClassification.INFORMATION),
+ * InternalAuthenticationWarning(EcompErrorCode.E_199,
+ * ErrorType.AUTHENTICATION_PROBLEM, AlarmSeverity.MINOR,
+ * EcompClassification.WARNING),
+ * InternalAuthenticationError(EcompErrorCode.E_199,
+ * ErrorType.AUTHENTICATION_PROBLEM, AlarmSeverity.MAJOR,
+ * EcompClassification.ERROR),
+ * InternalAuthenticationFatal(EcompErrorCode.E_199,
+ * ErrorType.AUTHENTICATION_PROBLEM, AlarmSeverity.CRITICAL,
+ * EcompClassification.FATAL),
+ * //BeFailedDeletingResourceInstanceError(EcompErrorCode.E_200,
+ * ErrorType.SYSTEM_ERROR, AlarmSeverity.MAJOR, Classification.ERROR),
+ *
+ * BeHealthCheckRecovery(EcompErrorCode.E_205, ErrorType.RECOVERY,
+ * AlarmSeverity.INFORMATIONAL, EcompClassification.INFORMATION, null),
+ * BeHealthCheckJanusGraphRecovery(EcompErrorCode.E_206, ErrorType.RECOVERY,
+ * AlarmSeverity.INFORMATIONAL, EcompClassification.INFORMATION, null),
+ * BeHealthCheckElasticSearchRecovery(EcompErrorCode.E_207,
+ * ErrorType.RECOVERY, AlarmSeverity.INFORMATIONAL,
+ * EcompClassification.INFORMATION, null),
+ * BeHealthCheckUebClusterRecovery(EcompErrorCode.E_208, ErrorType.RECOVERY,
+ * AlarmSeverity.INFORMATIONAL, EcompClassification.INFORMATION, null),
+ * FeHealthCheckRecovery(EcompErrorCode.E_209, ErrorType.RECOVERY,
+ * AlarmSeverity.INFORMATIONAL, EcompClassification.INFORMATION, null),
+ * BeHealthCheckError(EcompErrorCode.E_200, ErrorType.SYSTEM_ERROR,
+ * AlarmSeverity.CRITICAL, EcompClassification.ERROR,
+ * BeHealthCheckRecovery),
+ *
+ * BeHealthCheckJanusGraphError(EcompErrorCode.E_201, ErrorType.SYSTEM_ERROR,
+ * AlarmSeverity.CRITICAL, EcompClassification.ERROR,
+ * BeHealthCheckJanusGraphRecovery),
+ * BeHealthCheckElasticSearchError(EcompErrorCode.E_202,
+ * ErrorType.SYSTEM_ERROR, AlarmSeverity.CRITICAL,
+ * EcompClassification.ERROR, BeHealthCheckElasticSearchRecovery),
+ * BeHealthCheckUebClusterError(EcompErrorCode.E_203,
+ * ErrorType.SYSTEM_ERROR, AlarmSeverity.CRITICAL,
+ * EcompClassification.ERROR, BeHealthCheckUebClusterRecovery),
+ * FeHealthCheckError(EcompErrorCode.E_204, ErrorType.SYSTEM_ERROR,
+ * AlarmSeverity.CRITICAL, EcompClassification.ERROR,
+ * FeHealthCheckRecovery), BeUebConnectionError(EcompErrorCode.E_210,
+ * ErrorType.CONNECTION_PROBLEM, AlarmSeverity.MAJOR,
+ * EcompClassification.ERROR), BeUebUnkownHostError(EcompErrorCode.E_211,
+ * ErrorType.CONNECTION_PROBLEM, AlarmSeverity.MAJOR,
+ * EcompClassification.ERROR),
+ *
+ * InternalConnectionInfo(EcompErrorCode.E_299,
+ * ErrorType.CONNECTION_PROBLEM, AlarmSeverity.INFORMATIONAL,
+ * EcompClassification.INFORMATION),
+ * InternalConnectionWarning(EcompErrorCode.E_299,
+ * ErrorType.CONNECTION_PROBLEM, AlarmSeverity.MINOR,
+ * EcompClassification.WARNING),
+ * InternalConnectionError(EcompErrorCode.E_299,
+ * ErrorType.CONNECTION_PROBLEM, AlarmSeverity.MAJOR,
+ * EcompClassification.ERROR), InternalConnectionFatal(EcompErrorCode.E_299,
+ * ErrorType.CONNECTION_PROBLEM, AlarmSeverity.CRITICAL,
+ * EcompClassification.FATAL),
+ *
+ * BeComponentMissingError(EcompErrorCode.E_300, ErrorType.SYSTEM_ERROR,
+ * AlarmSeverity.MAJOR, EcompClassification.ERROR),
+ * BeIncorrectComponentError(EcompErrorCode.E_301, ErrorType.SYSTEM_ERROR,
+ * AlarmSeverity.MAJOR, EcompClassification.ERROR),
+ * BeInvalidConfigurationError(EcompErrorCode.E_302, ErrorType.CONFIG_ERROR,
+ * AlarmSeverity.MAJOR, EcompClassification.FATAL),
+ * BeUebObjectNotFoundError(EcompErrorCode.E_303, ErrorType.DATA_ERROR,
+ * AlarmSeverity.MAJOR, EcompClassification.ERROR),
+ * BeDistributionEngineInvalidArtifactType(EcompErrorCode.E_304,
+ * ErrorType.DATA_ERROR, AlarmSeverity.MAJOR, EcompClassification.WARNING),
+ * BeMissingConfigurationError(EcompErrorCode.E_305, ErrorType.CONFIG_ERROR,
+ * AlarmSeverity.MAJOR, EcompClassification.FATAL),
+ * BeConfigurationInvalidListSizeError(EcompErrorCode.E_306,
+ * ErrorType.CONFIG_ERROR, AlarmSeverity.MAJOR, EcompClassification.FATAL),
+ * ErrorConfigFileFormat(EcompErrorCode.E_307, ErrorType.CONFIG_ERROR,
+ * AlarmSeverity.MAJOR, EcompClassification.ERROR),
+ * BeMissingArtifactInformationError(EcompErrorCode.E_308,
+ * ErrorType.DATA_ERROR, AlarmSeverity.MAJOR, EcompClassification.ERROR),
+ * BeArtifactMissingError(EcompErrorCode.E_309, ErrorType.DATA_ERROR,
+ * AlarmSeverity.MAJOR, EcompClassification.ERROR),
+ * BeUserMissingError(EcompErrorCode.E_310, ErrorType.DATA_ERROR,
+ * AlarmSeverity.MAJOR, EcompClassification.ERROR),
+ * EcompMismatchParam(EcompErrorCode.E_311, ErrorType.CONFIG_ERROR,
+ * AlarmSeverity.MAJOR, EcompClassification.ERROR),
+ * EcompMissingError(EcompErrorCode.E_312, ErrorType.CONFIG_ERROR,
+ * AlarmSeverity.MAJOR, EcompClassification.ERROR),
+ *
+ * InternalDataInfo(EcompErrorCode.E_399, ErrorType.DATA_ERROR,
+ * AlarmSeverity.INFORMATIONAL, EcompClassification.INFORMATION),
+ * InternalDataWarning(EcompErrorCode.E_399, ErrorType.DATA_ERROR,
+ * AlarmSeverity.MINOR, EcompClassification.WARNING),
+ * InternalDataError(EcompErrorCode.E_399, ErrorType.DATA_ERROR,
+ * AlarmSeverity.MAJOR, EcompClassification.ERROR),
+ * InternalDataFatal(EcompErrorCode.E_399, ErrorType.DATA_ERROR,
+ * AlarmSeverity.CRITICAL, EcompClassification.FATAL),
+ *
+ * BeInvalidTypeError(EcompErrorCode.E_400, ErrorType.DATA_ERROR,
+ * AlarmSeverity.MAJOR, EcompClassification.WARNING),
+ * BeInvalidValueError(EcompErrorCode.E_401, ErrorType.DATA_ERROR,
+ * AlarmSeverity.MAJOR, EcompClassification.WARNING),
+ * BeArtifactPayloadInvalid(EcompErrorCode.E_402, ErrorType.DATA_ERROR,
+ * AlarmSeverity.MAJOR, EcompClassification.ERROR),
+ * BeArtifactInformationInvalidError(EcompErrorCode.E_403,
+ * ErrorType.DATA_ERROR, AlarmSeverity.MAJOR, EcompClassification.ERROR),
+ * BeDistributionMissingError(EcompErrorCode.E_404, ErrorType.DATA_ERROR,
+ * AlarmSeverity.MAJOR, EcompClassification.ERROR),
+ * BeGraphObjectMissingError(EcompErrorCode.E_404, ErrorType.DATA_ERROR,
+ * AlarmSeverity.CRITICAL, EcompClassification.ERROR),
+ * BeInvalidJsonInput(EcompErrorCode.E_405, ErrorType.SYSTEM_ERROR,
+ * AlarmSeverity.MAJOR, EcompClassification.ERROR),
+ *
+ * InvalidInputInfo(EcompErrorCode.E_499, ErrorType.SYSTEM_ERROR,
+ * AlarmSeverity.INFORMATIONAL, EcompClassification.INFORMATION),
+ * InvalidInputWarning(EcompErrorCode.E_499, ErrorType.SYSTEM_ERROR,
+ * AlarmSeverity.MINOR, EcompClassification.WARNING),
+ * InvalidInputError(EcompErrorCode.E_499, ErrorType.SYSTEM_ERROR,
+ * AlarmSeverity.MAJOR, EcompClassification.ERROR),
+ * InvalidInputFatal(EcompErrorCode.E_499, ErrorType.SYSTEM_ERROR,
+ * AlarmSeverity.CRITICAL, EcompClassification.FATAL),
+ *
+ * BeInitializationError(EcompErrorCode.E_500, ErrorType.SYSTEM_ERROR,
+ * AlarmSeverity.CRITICAL, EcompClassification.ERROR),
+ * BeFailedAddingResourceInstanceError(EcompErrorCode.E_501,
+ * ErrorType.SYSTEM_ERROR, AlarmSeverity.MAJOR, EcompClassification.ERROR),
+ * BeUebSystemError(EcompErrorCode.E_502, ErrorType.SYSTEM_ERROR,
+ * AlarmSeverity.MAJOR, EcompClassification.ERROR),
+ * BeDistributionEngineSystemError(EcompErrorCode.E_503,
+ * ErrorType.SYSTEM_ERROR, AlarmSeverity.MAJOR, EcompClassification.ERROR),
+ * BeFailedAddingNodeTypeError(EcompErrorCode.E_504, ErrorType.DATA_ERROR,
+ * AlarmSeverity.CRITICAL, EcompClassification.ERROR),
+ * BeDaoSystemError(EcompErrorCode.E_505, ErrorType.SYSTEM_ERROR,
+ * AlarmSeverity.CRITICAL, EcompClassification.ERROR),
+ * BeSystemError(EcompErrorCode.E_506, ErrorType.SYSTEM_ERROR,
+ * AlarmSeverity.CRITICAL, EcompClassification.ERROR),
+ * BeExecuteRollbackError(EcompErrorCode.E_507, ErrorType.DATA_ERROR,
+ * AlarmSeverity.MAJOR, EcompClassification.ERROR),
+ * BeFailedLockObjectError(EcompErrorCode.E_508, ErrorType.SYSTEM_ERROR,
+ * AlarmSeverity.CRITICAL, EcompClassification.WARNING),
+ * BeFailedCreateNodeError(EcompErrorCode.E_509, ErrorType.DATA_ERROR,
+ * AlarmSeverity.MAJOR, EcompClassification.ERROR),
+ * BeFailedUpdateNodeError(EcompErrorCode.E_510, ErrorType.DATA_ERROR,
+ * AlarmSeverity.MAJOR, EcompClassification.ERROR),
+ * BeFailedDeleteNodeError(EcompErrorCode.E_511, ErrorType.DATA_ERROR,
+ * AlarmSeverity.MAJOR, EcompClassification.ERROR),
+ * BeFailedRetrieveNodeError(EcompErrorCode.E_512, ErrorType.DATA_ERROR,
+ * AlarmSeverity.MAJOR, EcompClassification.ERROR),
+ * BeFailedFindParentError(EcompErrorCode.E_513, ErrorType.DATA_ERROR,
+ * AlarmSeverity.MAJOR, EcompClassification.ERROR),
+ * BeFailedFindAllNodesError(EcompErrorCode.E_514, ErrorType.DATA_ERROR,
+ * AlarmSeverity.MAJOR, EcompClassification.ERROR),
+ * BeFailedFindAssociationError(EcompErrorCode.E_515, ErrorType.DATA_ERROR,
+ * AlarmSeverity.MAJOR, EcompClassification.ERROR),
+ * BeComponentCleanerSystemError(EcompErrorCode.E_516,
+ * ErrorType.SYSTEM_ERROR, AlarmSeverity.MAJOR, EcompClassification.ERROR),
+ * FeHttpLoggingError(EcompErrorCode.E_517, ErrorType.SYSTEM_ERROR,
+ * AlarmSeverity.MINOR, EcompClassification.ERROR),
+ * FePortalServletError(EcompErrorCode.E_518, ErrorType.SYSTEM_ERROR,
+ * AlarmSeverity.MAJOR, EcompClassification.ERROR),
+ *
+ * InternalFlowInfo(EcompErrorCode.E_599, ErrorType.SYSTEM_ERROR,
+ * AlarmSeverity.INFORMATIONAL, EcompClassification.INFORMATION),
+ * InternalFlowWarning(EcompErrorCode.E_599, ErrorType.SYSTEM_ERROR,
+ * AlarmSeverity.MINOR, EcompClassification.WARNING),
+ * InternalFlowError(EcompErrorCode.E_599, ErrorType.SYSTEM_ERROR,
+ * AlarmSeverity.MAJOR, EcompClassification.ERROR),
+ * InternalFlowFatal(EcompErrorCode.E_599, ErrorType.SYSTEM_ERROR,
+ * AlarmSeverity.CRITICAL, EcompClassification.FATAL),
+ *
+ * BeRestApiGeneralError(EcompErrorCode.E_900, ErrorType.SYSTEM_ERROR,
+ * AlarmSeverity.CRITICAL, EcompClassification.ERROR, null),
+ * FeHealthCheckGeneralError(EcompErrorCode.E_901, ErrorType.SYSTEM_ERROR,
+ * AlarmSeverity.CRITICAL, EcompClassification.ERROR, null),
+ *
+ * InternalUnexpectedInfo(EcompErrorCode.E_999, ErrorType.SYSTEM_ERROR,
+ * AlarmSeverity.INFORMATIONAL, EcompClassification.INFORMATION),
+ * InternalUnexpectedWarning(EcompErrorCode.E_999, ErrorType.SYSTEM_ERROR,
+ * AlarmSeverity.MINOR, EcompClassification.WARNING),
+ * InternalUnexpectedError(EcompErrorCode.E_999, ErrorType.SYSTEM_ERROR,
+ * AlarmSeverity.MAJOR, EcompClassification.ERROR),
+ * InternalUnexpectedFatal(EcompErrorCode.E_999, ErrorType.SYSTEM_ERROR,
+ * AlarmSeverity.CRITICAL, EcompClassification.FATAL),
+ */;
+
+ private EcompErrorCode ecompErrorCode;
+ private ErrorType eType;
+ private AlarmSeverity alarmSeverity;
+ private EcompClassification classification;
+ private EcompErrorEnum clearCode;
+
+ EcompErrorEnum(EcompErrorCode ecompErrorCode, ErrorType eType, AlarmSeverity alarmSeverity,
+ EcompClassification classification, EcompErrorEnum clearCode) {
+
+ this.ecompErrorCode = ecompErrorCode;
+ this.eType = eType;
+ this.alarmSeverity = alarmSeverity;
+ this.classification = classification;
+ this.clearCode = clearCode;
+ }
+
+ EcompErrorEnum(EcompErrorCode ecompErrorCode, ErrorType eType, AlarmSeverity alarmSeverity,
+ EcompClassification classification) {
+
+ this.ecompErrorCode = ecompErrorCode;
+ this.eType = eType;
+ this.alarmSeverity = alarmSeverity;
+ this.classification = classification;
+ }
+
+ public ErrorType geteType() {
+ return eType;
+ }
+
+ public void seteType(ErrorType eType) {
+ this.eType = eType;
+ }
+
+ public AlarmSeverity getAlarmSeverity() {
+ return alarmSeverity;
+ }
+
+ public void setAlarmSeverity(AlarmSeverity alarmSeverity) {
+ this.alarmSeverity = alarmSeverity;
+ }
+
+ public EcompErrorCode getEcompErrorCode() {
+ return ecompErrorCode;
+ }
+
+ public void setEcompErrorCode(EcompErrorCode ecompErrorCode) {
+ this.ecompErrorCode = ecompErrorCode;
+ }
+
+ public EcompClassification getClassification() {
+ return classification;
+ }
+
+ public void setClassification(EcompClassification classification) {
+ this.classification = classification;
+ }
+
+ public EcompErrorEnum getClearCode() {
+ return clearCode;
+ }
+
+ public void setClearCode(EcompErrorEnum clearCode) {
+ this.clearCode = clearCode;
+ }
+
+ public enum ErrorType {
+ RECOVERY, CONFIG_ERROR, SYSTEM_ERROR, DATA_ERROR, CONNECTION_PROBLEM, AUTHENTICATION_PROBLEM
+ }
+
+ public enum AlarmSeverity {
+ CRITICAL, MAJOR, MINOR, INFORMATIONAL, NONE
+ }
+
+ // public String toString() {
+ // return eType + "," + eCode + "," + desc;
+ // }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorInfo.java b/common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorInfo.java
index e1fd34b26d..75ad74c56b 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorInfo.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorInfo.java
@@ -7,9 +7,9 @@
* 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.
@@ -22,57 +22,57 @@ package org.openecomp.sdc.common.config;
public class EcompErrorInfo {
- private String type;
- private String code;
- private String severity;
- private String description;
- private String alarmSeverity;
+ private String type;
+ private String code;
+ private String severity;
+ private String description;
+ private String alarmSeverity;
- public String getType() {
- return type;
- }
+ public String getType() {
+ return type;
+ }
- public void setType(String type) {
- this.type = type;
- }
+ public void setType(String type) {
+ this.type = type;
+ }
- public String getCode() {
- return code;
- }
+ public String getCode() {
+ return code;
+ }
- public void setCode(String code) {
- this.code = code;
- }
+ public void setCode(String code) {
+ this.code = code;
+ }
- public String getSeverity() {
- return severity;
- }
+ public String getSeverity() {
+ return severity;
+ }
- public void setSeverity(String severity) {
- this.severity = severity;
- }
+ public void setSeverity(String severity) {
+ this.severity = severity;
+ }
- public String getDescription() {
- return description;
- }
+ public String getDescription() {
+ return description;
+ }
- public void setDescription(String description) {
- this.description = description;
- }
+ public void setDescription(String description) {
+ this.description = description;
+ }
- public String getAlarmSeverity() {
- return alarmSeverity;
- }
+ public String getAlarmSeverity() {
+ return alarmSeverity;
+ }
- public void setAlarmSeverity(String alarmSeverity) {
- this.alarmSeverity = alarmSeverity;
- }
+ public void setAlarmSeverity(String alarmSeverity) {
+ this.alarmSeverity = alarmSeverity;
+ }
- public void cloneData(EcompErrorInfo other) {
- this.type = other.getType();
- this.severity = other.getSeverity();
- this.description = other.getDescription();
- this.code = other.getCode();
- this.alarmSeverity = other.getAlarmSeverity();
- }
+ public void cloneData(EcompErrorInfo other) {
+ this.type = other.getType();
+ this.severity = other.getSeverity();
+ this.description = other.getDescription();
+ this.code = other.getCode();
+ this.alarmSeverity = other.getAlarmSeverity();
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorLogUtil.java b/common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorLogUtil.java
index af53611104..933b510e91 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorLogUtil.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorLogUtil.java
@@ -7,9 +7,9 @@
* 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.
@@ -33,133 +33,133 @@ import java.util.Locale;
public class EcompErrorLogUtil {
- private static String ECOMP_ERROR_TMPL = "ETYPE = \"%s\" ENAME = \"%s\" ECODE = \"%s\" ECONTEXT = \"%s\" EDESC = \"%s\"";
- private static Logger log = Logger.getLogger(EcompErrorLogUtil.class.getName());
- private static final String FATAL_ERROR_PREFIX = "FATAL ERROR!! ";
-
- public static void logEcompError(EcompErrorName ecompErrorName, EcompErrorInfo ecompErrorInfo,
- String ecompErrorContext, String... ecompDescriptionParams) {
- if (ecompErrorInfo != null) {
- StringBuilder sb = new StringBuilder();
- Formatter formatter = new Formatter(sb, Locale.US);
- try {
- String description = ecompErrorInfo.getDescription();
- String severityStr = ecompErrorInfo.getSeverity();
- EcompErrorConfiguration.EcompErrorSeverity severity = EcompErrorSeverity.ERROR;
- // Since there is no FATAL log level, this is how we distinguish
- // the FATAL errors
- if (severityStr.equals(EcompErrorConfiguration.EcompErrorSeverity.FATAL.name())) {
- description = FATAL_ERROR_PREFIX + description;
- severity = EcompErrorSeverity.FATAL;
- } else if (severityStr.equals(EcompErrorConfiguration.EcompErrorSeverity.WARN.name())) {
- severity = EcompErrorSeverity.WARN;
- } else if (severityStr.equals(EcompErrorConfiguration.EcompErrorSeverity.INFO.name())) {
- severity = EcompErrorSeverity.INFO;
- }
-
- MDC.put("alarmSeverity", ecompErrorInfo.getAlarmSeverity());
- // else it stays ERROR
- formatter.format(ECOMP_ERROR_TMPL, ecompErrorInfo.getType(), ecompErrorName.name(),
- ecompErrorInfo.getCode(), ecompErrorContext, description);
+ private static final String ECOMP_ERROR_TMPL = "ETYPE = \"%s\" ENAME = \"%s\" ECODE = \"%s\" ECONTEXT = \"%s\" EDESC = \"%s\"";
+ private static Logger log = Logger.getLogger(EcompErrorLogUtil.class.getName());
+ private static final String FATAL_ERROR_PREFIX = "FATAL ERROR!! ";
+
+ public static void logEcompError(EcompErrorName ecompErrorName, EcompErrorInfo ecompErrorInfo,
+ String ecompErrorContext, String... ecompDescriptionParams) {
+ if (ecompErrorInfo != null) {
+ StringBuilder sb = new StringBuilder();
+ Formatter formatter = new Formatter(sb, Locale.US);
+ try {
+ String description = ecompErrorInfo.getDescription();
+ String severityStr = ecompErrorInfo.getSeverity();
+ EcompErrorConfiguration.EcompErrorSeverity severity = EcompErrorSeverity.ERROR;
+ // Since there is no FATAL log level, this is how we distinguish
+ // the FATAL errors
+ if (severityStr.equals(EcompErrorConfiguration.EcompErrorSeverity.FATAL.name())) {
+ description = FATAL_ERROR_PREFIX + description;
+ severity = EcompErrorSeverity.FATAL;
+ } else if (severityStr.equals(EcompErrorConfiguration.EcompErrorSeverity.WARN.name())) {
+ severity = EcompErrorSeverity.WARN;
+ } else if (severityStr.equals(EcompErrorConfiguration.EcompErrorSeverity.INFO.name())) {
+ severity = EcompErrorSeverity.INFO;
+ }
+
+ MDC.put("alarmSeverity", ecompErrorInfo.getAlarmSeverity());
+ // else it stays ERROR
+ formatter.format(ECOMP_ERROR_TMPL, ecompErrorInfo.getType(), ecompErrorName.name(),
+ ecompErrorInfo.getCode(), ecompErrorContext, description);
log.error(severity, EcompLoggerErrorCode.getByValue(ecompErrorInfo.getCode()),
ecompErrorContext, ecompErrorContext, description);
} finally {
- formatter.close();
- MDC.remove("alarmSeverity");
- }
- }
- }
-
- public static void logEcompError(String ecompErrorContext, EcompErrorEnum ecompErrorEnum,
- String... ecompDescriptionParams) {
- logEcompError(ecompErrorContext, ecompErrorEnum, true, ecompDescriptionParams);
- }
-
- public static void logEcompError(String ecompErrorContext, EcompErrorEnum ecompErrorEnum, boolean logMissingParams,
- String... ecompDescriptionParams) {
- StringBuilder sb = new StringBuilder();
- Formatter formatter = new Formatter(sb, Locale.US);
- try {
- String description;
-
- Either<String, Boolean> setDescriptionParamsResult = setDescriptionParams(ecompErrorEnum,
- ecompDescriptionParams);
- if (setDescriptionParamsResult.isLeft()) {
- description = setDescriptionParamsResult.left().value();
- } else {
- EcompErrorEnum mismatchErrorEnum = EcompErrorEnum.EcompMismatchParam;
- if (logMissingParams) {
- logEcompError("logEcompError", mismatchErrorEnum, false, ecompErrorEnum.name());
- } else {
- log.info("Failed to log the error code {}", mismatchErrorEnum);
- }
- return;
- }
- EcompClassification classification = ecompErrorEnum.getClassification();
-
- EcompErrorConfiguration.EcompErrorSeverity severity = EcompErrorSeverity.ERROR;
- // Since there is no FATAL log level, this is how we distinguish the
- // FATAL errors
- if (classification == EcompClassification.FATAL) {
- description = FATAL_ERROR_PREFIX + description;
- severity = EcompErrorSeverity.FATAL;
- } else if (classification == EcompClassification.WARNING) {
- severity = EcompErrorSeverity.WARN;
- } else if (classification == EcompClassification.INFORMATION) {
- severity = EcompErrorSeverity.INFO;
- }
-
- String eCode = createEcode(ecompErrorEnum);
-
- MDC.put("alarmSeverity", ecompErrorEnum.alarmSeverity.name());
- // else it stays ERROR
- formatter.format(ECOMP_ERROR_TMPL, ecompErrorEnum.geteType(), ecompErrorEnum.name(), eCode,
- ecompErrorContext, description);
+ formatter.close();
+ MDC.remove("alarmSeverity");
+ }
+ }
+ }
+
+ public static void logEcompError(String ecompErrorContext, EcompErrorEnum ecompErrorEnum,
+ String... ecompDescriptionParams) {
+ logEcompError(ecompErrorContext, ecompErrorEnum, true, ecompDescriptionParams);
+ }
+
+ public static void logEcompError(String ecompErrorContext, EcompErrorEnum ecompErrorEnum, boolean logMissingParams,
+ String... ecompDescriptionParams) {
+ StringBuilder sb = new StringBuilder();
+ Formatter formatter = new Formatter(sb, Locale.US);
+ try {
+ String description;
+
+ Either<String, Boolean> setDescriptionParamsResult = setDescriptionParams(ecompErrorEnum,
+ ecompDescriptionParams);
+ if (setDescriptionParamsResult.isLeft()) {
+ description = setDescriptionParamsResult.left().value();
+ } else {
+ EcompErrorEnum mismatchErrorEnum = EcompErrorEnum.EcompMismatchParam;
+ if (logMissingParams) {
+ logEcompError("logEcompError", mismatchErrorEnum, false, ecompErrorEnum.name());
+ } else {
+ log.info("Failed to log the error code {}", mismatchErrorEnum);
+ }
+ return;
+ }
+ EcompClassification classification = ecompErrorEnum.getClassification();
+
+ EcompErrorConfiguration.EcompErrorSeverity severity = EcompErrorSeverity.ERROR;
+ // Since there is no FATAL log level, this is how we distinguish the
+ // FATAL errors
+ if (classification == EcompClassification.FATAL) {
+ description = FATAL_ERROR_PREFIX + description;
+ severity = EcompErrorSeverity.FATAL;
+ } else if (classification == EcompClassification.WARNING) {
+ severity = EcompErrorSeverity.WARN;
+ } else if (classification == EcompClassification.INFORMATION) {
+ severity = EcompErrorSeverity.INFO;
+ }
+
+ String eCode = createEcode(ecompErrorEnum);
+
+ MDC.put("alarmSeverity", ecompErrorEnum.getAlarmSeverity().name());
+ // else it stays ERROR
+ formatter.format(ECOMP_ERROR_TMPL, ecompErrorEnum.geteType(), ecompErrorEnum.name(), eCode,
+ ecompErrorContext, description);
log.error(severity, EcompLoggerErrorCode.getByValue(ecompErrorEnum.getEcompErrorCode().name()),
ecompErrorContext, ecompErrorContext, description);
- } finally {
- formatter.close();
- MDC.remove("alarmSeverity");
- }
- }
+ } finally {
+ formatter.close();
+ MDC.remove("alarmSeverity");
+ }
+ }
- public static String createEcode(EcompErrorEnum ecompErrorEnum) {
+ public static String createEcode(EcompErrorEnum ecompErrorEnum) {
- EcompClassification classification = ecompErrorEnum.getClassification();
- String ecompErrorCode = ecompErrorEnum.getEcompErrorCode().name();
+ EcompClassification classification = ecompErrorEnum.getClassification();
+ String ecompErrorCode = ecompErrorEnum.getEcompErrorCode().name();
- String ecodeNumber = ecompErrorCode.substring(ecompErrorCode.indexOf("_") + 1);
+ String ecodeNumber = ecompErrorCode.substring(ecompErrorCode.indexOf("_") + 1);
return "ASDC" + ecodeNumber + classification.getClassification();
- }
-
- private static Either<String, Boolean> setDescriptionParams(EcompErrorEnum ecompErrorEnum,
- String... descriptionParams) {
- String description = ecompErrorEnum.getEcompErrorCode().getDescription();
-
- // Counting number of params in description
- int countMatches = StringUtils.countMatches(description, AbsEcompErrorManager.PARAM_STR);
- // Catching cases when there are more params passed than there are in
- // the description (formatter will ignore extra params and won't throw
- // exception)
- if (countMatches != descriptionParams.length) {
- return Either.right(false);
- }
- // Setting params of the description if any
- StringBuilder sb = new StringBuilder();
- Formatter formatter = new Formatter(sb, Locale.US);
- try {
- formatter.format(description, (Object[]) descriptionParams).toString();
- return Either.left(formatter.toString());
- } catch (IllegalFormatException e) {
- // Number of passed params doesn't match number of params in config
- // file
- return Either.right(false);
- } finally {
- formatter.close();
- }
-
- }
+ }
+
+ private static Either<String, Boolean> setDescriptionParams(EcompErrorEnum ecompErrorEnum,
+ String... descriptionParams) {
+ String description = ecompErrorEnum.getEcompErrorCode().getDescription();
+
+ // Counting number of params in description
+ int countMatches = StringUtils.countMatches(description, AbsEcompErrorManager.PARAM_STR);
+ // Catching cases when there are more params passed than there are in
+ // the description (formatter will ignore extra params and won't throw
+ // exception)
+ if (countMatches != descriptionParams.length) {
+ return Either.right(false);
+ }
+ // Setting params of the description if any
+ StringBuilder sb = new StringBuilder();
+ Formatter formatter = new Formatter(sb, Locale.US);
+ try {
+ formatter.format(description, (Object[]) descriptionParams).toString();
+ return Either.left(formatter.toString());
+ } catch (IllegalFormatException e) {
+ // Number of passed params doesn't match number of params in config
+ // file
+ return Either.right(false);
+ } finally {
+ formatter.close();
+ }
+
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorName.java b/common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorName.java
index 5da7808376..b33bc45520 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorName.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/config/EcompErrorName.java
@@ -7,9 +7,9 @@
* 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.
@@ -21,23 +21,23 @@
package org.openecomp.sdc.common.config;
public enum EcompErrorName {
- // general
- EcompConfigFileFormat, EcompErrorNotFound, EcompErrorDescParamsMismatch,
+ // general
+ EcompConfigFileFormat, EcompErrorNotFound, EcompErrorDescParamsMismatch,
- // FE
- FeHealthCheckConnectionError, FeHealthCheckRecovery /* Recovery */, FeHttpLoggingError, FePortalServletError, FeHealthCheckGeneralError,
+ // FE
+ FeHealthCheckConnectionError, FeHealthCheckRecovery /* Recovery */, FeHttpLoggingError, FePortalServletError, FeHealthCheckGeneralError,
- // BE section here...
- BeHealthCheckError, BeHealthCheckRecovery, /* Recovery */
- BeRestApiGeneralError, BeInitializationError, BeResourceMissingError, BeServiceMissingError, BeMissingArtifactInformationError, BeArtifactMissingError, BeArtifactPayloadInvalid, BeUserMissingError, BeArtifactInformationInvalidError, BeIncorrectServiceError, BeFailedAddingResourceInstanceError,
- // BeFailedDeletingResourceInstanceError,
- BeFailedAddingCapabilityTypeError, BeCapabilityTypeMissingError, BeInterfaceMissingError,
- // BeRepositoryObjectNotFoundError,
- // BeRepositoryDeleteError,
- // BeRepositoryQueryError,
- BeDaoSystemError, BeSystemError, BeInvalidConfigurationError, BeMissingConfigurationError, BeUebConnectionError, BeUebObjectNotFoundError, BeUebSystemError, BeDistributionEngineSystemError, BeDistributionEngineInvalidArtifactType, BeConfigurationInvalidListSizeError, BeUebAuthenticationError, BeUebUnkownHostError, BeInvalidTypeError, BeInvalidValueError, BeFailedLockObjectError, BeInvalidJsonInput, BeDistributionMissingError, ErrorConfigFileFormat,
- // model
- BeFailedCreateNodeError, BeFailedUpdateNodeError, BeFailedDeleteNodeError, BeFailedRetrieveNodeError, BeExecuteRollbackError, BeFailedFindParentError, BeFailedFindAllNodesError, BeFailedFindAssociationError, BeFailedToAssociateError, BeComponentCleanerSystemError,
- //dmaap
- DmaapHealthCheckRecovery , DmaapHealthCheckError;
+ // BE section here...
+ BeHealthCheckError, BeHealthCheckRecovery, /* Recovery */
+ BeRestApiGeneralError, BeInitializationError, BeResourceMissingError, BeServiceMissingError, BeMissingArtifactInformationError, BeArtifactMissingError, BeArtifactPayloadInvalid, BeUserMissingError, BeArtifactInformationInvalidError, BeIncorrectServiceError, BeFailedAddingResourceInstanceError,
+ // BeFailedDeletingResourceInstanceError,
+ BeFailedAddingCapabilityTypeError, BeCapabilityTypeMissingError, BeInterfaceMissingError,
+ // BeRepositoryObjectNotFoundError,
+ // BeRepositoryDeleteError,
+ // BeRepositoryQueryError,
+ BeDaoSystemError, BeSystemError, BeInvalidConfigurationError, BeMissingConfigurationError, BeUebConnectionError, BeUebObjectNotFoundError, BeUebSystemError, BeDistributionEngineSystemError, BeDistributionEngineInvalidArtifactType, BeConfigurationInvalidListSizeError, BeUebAuthenticationError, BeUebUnkownHostError, BeInvalidTypeError, BeInvalidValueError, BeFailedLockObjectError, BeInvalidJsonInput, BeDistributionMissingError, ErrorConfigFileFormat,
+ // model
+ BeFailedCreateNodeError, BeFailedUpdateNodeError, BeFailedDeleteNodeError, BeFailedRetrieveNodeError, BeExecuteRollbackError, BeFailedFindParentError, BeFailedFindAllNodesError, BeFailedFindAssociationError, BeFailedToAssociateError, BeComponentCleanerSystemError,
+ //dmaap
+ DmaapHealthCheckRecovery, DmaapHealthCheckError;
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/config/IEcompConfigurationManager.java b/common-app-api/src/main/java/org/openecomp/sdc/common/config/IEcompConfigurationManager.java
index c16d8d329b..3ecfa7914a 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/config/IEcompConfigurationManager.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/config/IEcompConfigurationManager.java
@@ -7,9 +7,9 @@
* 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.
@@ -21,5 +21,5 @@
package org.openecomp.sdc.common.config;
public interface IEcompConfigurationManager {
- public EcompErrorConfiguration getEcompErrorConfiguration();
+ EcompErrorConfiguration getEcompErrorConfiguration();
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/config/generation/GenerateEcompErrorsCsv.java b/common-app-api/src/main/java/org/openecomp/sdc/common/config/generation/GenerateEcompErrorsCsv.java
index f57695de99..d46ead42a9 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/config/generation/GenerateEcompErrorsCsv.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/config/generation/GenerateEcompErrorsCsv.java
@@ -7,9 +7,9 @@
* 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.
@@ -24,6 +24,8 @@ import org.openecomp.sdc.common.config.EcompErrorEnum;
import org.openecomp.sdc.common.config.EcompErrorEnum.AlarmSeverity;
import org.openecomp.sdc.common.config.EcompErrorEnum.ErrorType;
import org.openecomp.sdc.common.config.EcompErrorLogUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.FileWriter;
@@ -33,200 +35,198 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
public class GenerateEcompErrorsCsv {
- private static Logger log = LoggerFactory.getLogger(GenerateEcompErrorsCsv.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(GenerateEcompErrorsCsv.class);
- private static String DATE_FORMAT = "dd-M-yyyy-hh-mm-ss";
+ private static final String DATE_FORMAT = "dd-M-yyyy-hh-mm-ss";
- private static String NEW_LINE = System.getProperty("line.separator");
+ private static final String NEW_LINE = System.getProperty("line.separator");
- private static void usage() {
- System.out.println("java org.openecomp.sdc.common.config.generation.GenerateEcompErrorsCsv <target folder>");
- System.exit(1);
- }
+ private static void usage() {
+ System.out.println("java org.openecomp.sdc.common.config.generation.GenerateEcompErrorsCsv <target folder>");
+ System.exit(1);
+ }
- public static void main(String[] args) {
+ public static void main(String[] args) {
- String targetFolder = "target";
- if (args.length > 1) {
- targetFolder = args[0];
- }
+ String targetFolder = "target";
+ if (args.length > 1) {
+ targetFolder = args[0];
+ }
- GenerateEcompErrorsCsv ecompErrorsCsv = new GenerateEcompErrorsCsv();
+ GenerateEcompErrorsCsv ecompErrorsCsv = new GenerateEcompErrorsCsv();
- ecompErrorsCsv.generateEcompErrorsCsvFile(targetFolder, true);
- }
+ ecompErrorsCsv.generateEcompErrorsCsvFile(targetFolder, true);
+ }
- public static class EcompErrorRow {
+ public static class EcompErrorRow {
- String errorName;
- String errorCode;
- String description;
- ErrorType errorType;
- AlarmSeverity alarmSeverity;
- String cleanErrorCode;
- String resolution;
+ private String errorName;
+ private String errorCode;
+ private String description;
+ private ErrorType errorType;
+ private AlarmSeverity alarmSeverity;
+ private String cleanErrorCode;
+ private String resolution;
- public String getErrorName() {
- return errorName;
- }
+ public String getErrorName() {
+ return errorName;
+ }
- public void setErrorName(String errorName) {
- this.errorName = errorName;
- }
+ public void setErrorName(String errorName) {
+ this.errorName = errorName;
+ }
- public String getErrorCode() {
- return errorCode;
- }
+ public String getErrorCode() {
+ return errorCode;
+ }
- public void setErrorCode(String errorCode) {
- this.errorCode = errorCode;
- }
+ public void setErrorCode(String errorCode) {
+ this.errorCode = errorCode;
+ }
- public String getDescription() {
- return description;
- }
+ public String getDescription() {
+ return description;
+ }
- public void setDescription(String description) {
- this.description = description;
- }
+ public void setDescription(String description) {
+ this.description = description;
+ }
- public ErrorType getErrorType() {
- return errorType;
- }
+ public ErrorType getErrorType() {
+ return errorType;
+ }
- public void setErrorType(ErrorType errorType) {
- this.errorType = errorType;
- }
+ public void setErrorType(ErrorType errorType) {
+ this.errorType = errorType;
+ }
- public AlarmSeverity getAlarmSeverity() {
- return alarmSeverity;
- }
+ public AlarmSeverity getAlarmSeverity() {
+ return alarmSeverity;
+ }
- public void setAlarmSeverity(AlarmSeverity alarmSeverity) {
- this.alarmSeverity = alarmSeverity;
- }
+ public void setAlarmSeverity(AlarmSeverity alarmSeverity) {
+ this.alarmSeverity = alarmSeverity;
+ }
- public String getCleanErrorCode() {
- return cleanErrorCode;
- }
+ public String getCleanErrorCode() {
+ return cleanErrorCode;
+ }
- public void setCleanErrorCode(String cleanErrorCode) {
- this.cleanErrorCode = cleanErrorCode;
- }
+ public void setCleanErrorCode(String cleanErrorCode) {
+ this.cleanErrorCode = cleanErrorCode;
+ }
- public String getResolution() {
- return resolution;
- }
+ public String getResolution() {
+ return resolution;
+ }
- public void setResolution(String resolution) {
- this.resolution = resolution;
- }
+ public void setResolution(String resolution) {
+ this.resolution = resolution;
+ }
- }
+ }
- public boolean generateEcompErrorsCsvFile(String targetFolder, boolean addTimeToFileName) {
+ public boolean generateEcompErrorsCsvFile(String targetFolder, boolean addTimeToFileName) {
- targetFolder += File.separator;
+ targetFolder += File.separator;
- boolean result = false;
- String dateFormatted = "";
+ boolean result = false;
+ String dateFormatted = "";
- if (addTimeToFileName) {
- DateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT);
+ if (addTimeToFileName) {
+ DateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT);
- Date date = new Date();
+ Date date = new Date();
- dateFormatted = "." + dateFormat.format(date);
+ dateFormatted = "." + dateFormat.format(date);
- }
+ }
- String outputFile = targetFolder + "ecompErrorCodes" + dateFormatted + ".csv";
+ String outputFile = targetFolder + "ecompErrorCodes" + dateFormatted + ".csv";
- try(FileWriter writer = new FileWriter(outputFile)) {
+ try (FileWriter writer = new FileWriter(outputFile)) {
- List<EcompErrorRow> errors = new ArrayList<>();
+ List<EcompErrorRow> errors = new ArrayList<>();
- for (EcompErrorEnum ecompErrorEnum : EcompErrorEnum.values()) {
+ for (EcompErrorEnum ecompErrorEnum : EcompErrorEnum.values()) {
- EcompErrorRow ecompErrorRow = new EcompErrorRow();
+ EcompErrorRow ecompErrorRow = new EcompErrorRow();
- String errorCode = EcompErrorLogUtil.createEcode(ecompErrorEnum);
+ String errorCode = EcompErrorLogUtil.createEcode(ecompErrorEnum);
- EcompErrorEnum clearCodeEnum = ecompErrorEnum.getClearCode();
- String cleanErrorCode = null;
- if (clearCodeEnum != null) {
- cleanErrorCode = EcompErrorLogUtil.createEcode(clearCodeEnum);
- }
+ EcompErrorEnum clearCodeEnum = ecompErrorEnum.getClearCode();
+ String cleanErrorCode = null;
+ if (clearCodeEnum != null) {
+ cleanErrorCode = EcompErrorLogUtil.createEcode(clearCodeEnum);
+ }
- ecompErrorRow.setAlarmSeverity(ecompErrorEnum.getAlarmSeverity());
- ecompErrorRow.setCleanErrorCode(cleanErrorCode);
- ecompErrorRow.setDescription(ecompErrorEnum.getEcompErrorCode().getDescription());
- ecompErrorRow.setErrorCode(errorCode);
- ecompErrorRow.setErrorName(ecompErrorEnum.name().toString());
- ecompErrorRow.setErrorType(ecompErrorEnum.geteType());
- ecompErrorRow.setResolution(ecompErrorEnum.getEcompErrorCode().getResolution());
+ ecompErrorRow.setAlarmSeverity(ecompErrorEnum.getAlarmSeverity());
+ ecompErrorRow.setCleanErrorCode(cleanErrorCode);
+ ecompErrorRow.setDescription(ecompErrorEnum.getEcompErrorCode().getDescription());
+ ecompErrorRow.setErrorCode(errorCode);
+ ecompErrorRow.setErrorName(ecompErrorEnum.name().toString());
+ ecompErrorRow.setErrorType(ecompErrorEnum.geteType());
+ ecompErrorRow.setResolution(ecompErrorEnum.getEcompErrorCode().getResolution());
- errors.add(ecompErrorRow);
- }
+ errors.add(ecompErrorRow);
+ }
- writeHeaders(writer);
+ writeHeaders(writer);
- for (EcompErrorRow ecompErrorRow : errors) {
- writer.append(addInvertedCommas(ecompErrorRow.getErrorCode()));
- writer.append(',');
- writer.append(addInvertedCommas(ecompErrorRow.getErrorType().toString()));
- writer.append(',');
- writer.append(addInvertedCommas(ecompErrorRow.getDescription()));
- writer.append(',');
- writer.append(addInvertedCommas(ecompErrorRow.getResolution()));
- writer.append(',');
- writer.append(addInvertedCommas(ecompErrorRow.getAlarmSeverity().toString()));
- writer.append(',');
- writer.append(addInvertedCommas(ecompErrorRow.getErrorName()));
- writer.append(',');
- writer.append(addInvertedCommas(ecompErrorRow.getCleanErrorCode()));
- writer.append(NEW_LINE);
- }
+ for (EcompErrorRow ecompErrorRow : errors) {
+ writer.append(addInvertedCommas(ecompErrorRow.getErrorCode()));
+ writer.append(',');
+ writer.append(addInvertedCommas(ecompErrorRow.getErrorType().toString()));
+ writer.append(',');
+ writer.append(addInvertedCommas(ecompErrorRow.getDescription()));
+ writer.append(',');
+ writer.append(addInvertedCommas(ecompErrorRow.getResolution()));
+ writer.append(',');
+ writer.append(addInvertedCommas(ecompErrorRow.getAlarmSeverity().toString()));
+ writer.append(',');
+ writer.append(addInvertedCommas(ecompErrorRow.getErrorName()));
+ writer.append(',');
+ writer.append(addInvertedCommas(ecompErrorRow.getCleanErrorCode()));
+ writer.append(NEW_LINE);
+ }
- result = true;
+ result = true;
- } catch (Exception e) {
- log.info("generate Ecomp Errors Csv File failed - {}" , e);
- }
+ } catch (Exception e) {
+ LOGGER.info("generate Ecomp Errors Csv File failed - {}", e);
+ }
- return result;
- }
+ return result;
+ }
- private void writeHeaders(FileWriter writer) throws IOException {
+ private void writeHeaders(FileWriter writer) throws IOException {
- writer.append("\"ERROR CODE\"");
- writer.append(',');
- writer.append("\"ERROR TYPE\"");
- writer.append(',');
- writer.append("\"DESCRIPTION\"");
- writer.append(',');
- writer.append("\"RESOLUTION\"");
- writer.append(',');
- writer.append("\"ALARM SEVERITY\"");
- writer.append(',');
- writer.append("\"ERROR NAME\"");
- writer.append(',');
- writer.append("\"CLEAN CODE\"");
- writer.append(NEW_LINE);
- }
+ writer.append("\"ERROR CODE\"");
+ writer.append(',');
+ writer.append("\"ERROR TYPE\"");
+ writer.append(',');
+ writer.append("\"DESCRIPTION\"");
+ writer.append(',');
+ writer.append("\"RESOLUTION\"");
+ writer.append(',');
+ writer.append("\"ALARM SEVERITY\"");
+ writer.append(',');
+ writer.append("\"ERROR NAME\"");
+ writer.append(',');
+ writer.append("\"CLEAN CODE\"");
+ writer.append(NEW_LINE);
+ }
- private String addInvertedCommas(String str) {
+ private String addInvertedCommas(String str) {
- if (str == null) {
- return "\"\"";
- }
+ if (str == null) {
+ return "\"\"";
+ }
- return "\"" + str + "\"";
- }
+ return "\"" + str + "\"";
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/datastructure/AuditingFieldsKey.java b/common-app-api/src/main/java/org/openecomp/sdc/common/datastructure/AuditingFieldsKey.java
index 06b2452d82..57752ae420 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/datastructure/AuditingFieldsKey.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/datastructure/AuditingFieldsKey.java
@@ -7,9 +7,9 @@
* 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.
@@ -23,92 +23,92 @@ package org.openecomp.sdc.common.datastructure;
import java.util.Date;
public enum AuditingFieldsKey {
- // General
- AUDIT_TIMESTAMP(Date.class, "TIMESTAMP"),
- AUDIT_ACTION(String.class, "ACTION"),
- AUDIT_MODIFIER_NAME(String.class, "MODIFIER_ID"),
- AUDIT_MODIFIER_UID(String.class, "MODIFIER"),
- AUDIT_STATUS(String.class, "STATUS"),
- AUDIT_DESC(String.class, "DESC"),
- AUDIT_SERVICE_INSTANCE_ID(String.class, "SERVICE_INSTANCE_ID"),
- AUDIT_INVARIANT_UUID(String.class, "INVARIANT_UUID"),
- AUDIT_REQUEST_ID(String.class, "REQUEST_ID"),
+ // General
+ AUDIT_TIMESTAMP(Date.class, "TIMESTAMP"),
+ AUDIT_ACTION(String.class, "ACTION"),
+ AUDIT_MODIFIER_NAME(String.class, "MODIFIER_ID"),
+ AUDIT_MODIFIER_UID(String.class, "MODIFIER"),
+ AUDIT_STATUS(String.class, "STATUS"),
+ AUDIT_DESC(String.class, "DESC"),
+ AUDIT_SERVICE_INSTANCE_ID(String.class, "SERVICE_INSTANCE_ID"),
+ AUDIT_INVARIANT_UUID(String.class, "INVARIANT_UUID"),
+ AUDIT_REQUEST_ID(String.class, "REQUEST_ID"),
- // Users administration
- AUDIT_USER_UID(String.class, "USER"),
- AUDIT_USER_BEFORE(String.class, "USER_BEFORE"),
- AUDIT_USER_AFTER(String.class, "USER_AFTER"),
- AUDIT_USER_DETAILS(String.class, "DETAILS"),
+ // Users administration
+ AUDIT_USER_UID(String.class, "USER"),
+ AUDIT_USER_BEFORE(String.class, "USER_BEFORE"),
+ AUDIT_USER_AFTER(String.class, "USER_AFTER"),
+ AUDIT_USER_DETAILS(String.class, "DETAILS"),
- // Resource administration
- AUDIT_RESOURCE_NAME(String.class, "RESOURCE_NAME"),
- AUDIT_RESOURCE_TYPE(String.class, "RESOURCE_TYPE"),
- AUDIT_RESOURCE_CURR_VERSION(String.class, "CURR_VERSION"),
- AUDIT_RESOURCE_PREV_VERSION(String.class, "PREV_VERSION"),
- AUDIT_RESOURCE_CURR_STATE(String.class, "CURR_STATE"),
- AUDIT_RESOURCE_PREV_STATE(String.class, "PREV_STATE"),
- AUDIT_RESOURCE_COMMENT(String.class, "COMMENT"),
- AUDIT_ARTIFACT_DATA(String.class, "ARTIFACT_DATA"),
- AUDIT_PREV_ARTIFACT_UUID(String.class, "PREV_ARTIFACT_UUID"),
- AUDIT_CURR_ARTIFACT_UUID(String.class, "CURR_ARTIFACT_UUID"),
- AUDIT_RESOURCE_DPREV_STATUS(String.class, "DPREV_STATUS"),
- AUDIT_RESOURCE_DCURR_STATUS(String.class, "DCURR_STATUS"),
- AUDIT_RESOURCE_TOSCA_NODE_TYPE(String.class, "TOSCA_NODE_TYPE"),
- AUDIT_RESOURCE_URL(String.class, "RESOURCE_URL"),
+ // Resource administration
+ AUDIT_RESOURCE_NAME(String.class, "RESOURCE_NAME"),
+ AUDIT_RESOURCE_TYPE(String.class, "RESOURCE_TYPE"),
+ AUDIT_RESOURCE_CURR_VERSION(String.class, "CURR_VERSION"),
+ AUDIT_RESOURCE_PREV_VERSION(String.class, "PREV_VERSION"),
+ AUDIT_RESOURCE_CURR_STATE(String.class, "CURR_STATE"),
+ AUDIT_RESOURCE_PREV_STATE(String.class, "PREV_STATE"),
+ AUDIT_RESOURCE_COMMENT(String.class, "COMMENT"),
+ AUDIT_ARTIFACT_DATA(String.class, "ARTIFACT_DATA"),
+ AUDIT_PREV_ARTIFACT_UUID(String.class, "PREV_ARTIFACT_UUID"),
+ AUDIT_CURR_ARTIFACT_UUID(String.class, "CURR_ARTIFACT_UUID"),
+ AUDIT_RESOURCE_DPREV_STATUS(String.class, "DPREV_STATUS"),
+ AUDIT_RESOURCE_DCURR_STATUS(String.class, "DCURR_STATUS"),
+ AUDIT_RESOURCE_TOSCA_NODE_TYPE(String.class, "TOSCA_NODE_TYPE"),
+ AUDIT_RESOURCE_URL(String.class, "RESOURCE_URL"),
- // Distribution Engine
- AUDIT_DISTRIBUTION_ENVRIONMENT_NAME(String.class, "D_ENV"),
- AUDIT_DISTRIBUTION_TOPIC_NAME(String.class, "TOPIC_NAME"),
- AUDIT_DISTRIBUTION_NOTIFICATION_TOPIC_NAME(String.class, "DNOTIF_TOPIC"),
+ // Distribution Engine
+ AUDIT_DISTRIBUTION_ENVRIONMENT_NAME(String.class, "D_ENV"),
+ AUDIT_DISTRIBUTION_TOPIC_NAME(String.class, "TOPIC_NAME"),
+ AUDIT_DISTRIBUTION_NOTIFICATION_TOPIC_NAME(String.class, "DNOTIF_TOPIC"),
AUDIT_DISTRIBUTION_STATUS_TOPIC_NAME(String.class, "DSTATUS_TOPIC"),
- AUDIT_DISTRIBUTION_ROLE(String.class, "ROLE"),
- AUDIT_DISTRIBUTION_ID(String.class, "DID"),
- AUDIT_DISTRIBUTION_API_KEY(String.class, "API_KEY"),
- AUDIT_DISTRIBUTION_CONSUMER_ID(String.class, "CONSUMER_ID"),
- AUDIT_DISTRIBUTION_RESOURCE_URL(String.class, "RESOURCE_URL"),
- AUDIT_DISTRIBUTION_STATUS_TIME(String.class, "STATUS_TIME"),
+ AUDIT_DISTRIBUTION_ROLE(String.class, "ROLE"),
+ AUDIT_DISTRIBUTION_ID(String.class, "DID"),
+ AUDIT_DISTRIBUTION_API_KEY(String.class, "API_KEY"),
+ AUDIT_DISTRIBUTION_CONSUMER_ID(String.class, "CONSUMER_ID"),
+ AUDIT_DISTRIBUTION_RESOURCE_URL(String.class, "RESOURCE_URL"),
+ AUDIT_DISTRIBUTION_STATUS_TIME(String.class, "STATUS_TIME"),
AUDIT_DISTRIBUTION_STATUS_DESC(String.class, "STATUS_DESC"),
- AUDIT_DISTRIBUTION_ENVIRONMENT_ID(String.class, "ENV_ID"),
- AUDIT_DISTRIBUTION_VNF_WORKLOAD_CONTEXT(String.class, "VNF_WORKLOAD_CONTEXT"),
- AUDIT_DISTRIBUTION_TENANT(String.class, "TENANT"),
+ AUDIT_DISTRIBUTION_ENVIRONMENT_ID(String.class, "ENV_ID"),
+ AUDIT_DISTRIBUTION_VNF_WORKLOAD_CONTEXT(String.class, "VNF_WORKLOAD_CONTEXT"),
+ AUDIT_DISTRIBUTION_TENANT(String.class, "TENANT"),
- // category
- AUDIT_CATEGORY_NAME(String.class, "CATEGORY_NAME"),
- AUDIT_SUB_CATEGORY_NAME(String.class, "SUB_CATEGORY_NAME"),
- AUDIT_GROUPING_NAME(String.class, "GROUPING_NAME"),
- AUDIT_DETAILS(String.class, "DETAILS"),
+ // category
+ AUDIT_CATEGORY_NAME(String.class, "CATEGORY_NAME"),
+ AUDIT_SUB_CATEGORY_NAME(String.class, "SUB_CATEGORY_NAME"),
+ AUDIT_GROUPING_NAME(String.class, "GROUPING_NAME"),
+ AUDIT_DETAILS(String.class, "DETAILS"),
- //operational environment
- AUDIT_OPERATIONAL_ENVIRONMENT_ID(String.class, "OPERATIONAL_ENVIRONMENT_ID"),
- AUDIT_OPERATIONAL_ENVIRONMENT_NAME(String.class, "OPERATIONAL_ENVIRONMENT_NAME"),
- AUDIT_OPERATIONAL_ENVIRONMENT_TYPE(String.class, "OPERATIONAL_ENVIRONMENT_TYPE"),
- AUDIT_OPERATIONAL_ENVIRONMENT_ACTION(String.class, "OPERATIONAL_ENVIRONMENT_ACTION"),
- AUDIT_TENANT_CONTEXT(String.class, "TENANT_CONTEXT"),
+ //operational environment
+ AUDIT_OPERATIONAL_ENVIRONMENT_ID(String.class, "OPERATIONAL_ENVIRONMENT_ID"),
+ AUDIT_OPERATIONAL_ENVIRONMENT_NAME(String.class, "OPERATIONAL_ENVIRONMENT_NAME"),
+ AUDIT_OPERATIONAL_ENVIRONMENT_TYPE(String.class, "OPERATIONAL_ENVIRONMENT_TYPE"),
+ AUDIT_OPERATIONAL_ENVIRONMENT_ACTION(String.class, "OPERATIONAL_ENVIRONMENT_ACTION"),
+ AUDIT_TENANT_CONTEXT(String.class, "TENANT_CONTEXT"),
- // authentication
- AUDIT_AUTH_URL(String.class, "URL"),
- AUDIT_AUTH_USER(String.class, "USER"),
- AUDIT_AUTH_STATUS(String.class, "AUTH_STATUS"),
- AUDIT_AUTH_REALM(String.class, "REALM"),
- AUDIT_ECOMP_USER(String.class, "ECOMP_USER");
+ // authentication
+ AUDIT_AUTH_URL(String.class, "URL"),
+ AUDIT_AUTH_USER(String.class, "USER"),
+ AUDIT_AUTH_STATUS(String.class, "AUTH_STATUS"),
+ AUDIT_AUTH_REALM(String.class, "REALM"),
+ AUDIT_ECOMP_USER(String.class, "ECOMP_USER");
- private Class<?> clazz;
- private String displayName;
+ private Class<?> clazz;
+ private String displayName;
- AuditingFieldsKey(Class<?> clazz, String displayName) {
- this.clazz = clazz;
- this.displayName = displayName;
- }
+ AuditingFieldsKey(Class<?> clazz, String displayName) {
+ this.clazz = clazz;
+ this.displayName = displayName;
+ }
- public Class<?> getValueClass() {
- return this.clazz;
- }
+ public Class<?> getValueClass() {
+ return this.clazz;
+ }
- public String getDisplayName() {
- return displayName;
- }
+ public String getDisplayName() {
+ return displayName;
+ }
- public void setDisplayName(String displayName) {
- this.displayName = displayName;
- }
+ public void setDisplayName(String displayName) {
+ this.displayName = displayName;
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/datastructure/ESTimeBasedEvent.java b/common-app-api/src/main/java/org/openecomp/sdc/common/datastructure/ESTimeBasedEvent.java
index d31f8227dc..9e991e8dcb 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/datastructure/ESTimeBasedEvent.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/datastructure/ESTimeBasedEvent.java
@@ -7,9 +7,9 @@
* 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.
@@ -24,97 +24,109 @@ import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;
import java.text.SimpleDateFormat;
-import java.util.*;
+import java.util.Date;
+import java.util.Formatter;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.Map;
+import java.util.TimeZone;
/**
* Extending this class enforces the objects of implementing classes to have a
* timestamp, so that like in logstash, we can derive the index name for those
* object from the timestamp.
- *
- * @author paharoni
*
+ * @author paharoni
*/
public class ESTimeBasedEvent {
- protected SimpleDateFormat simpleDateFormat;
- protected static String dateFormatPattern = "yyyy-MM-dd HH:mm:ss.SSS z";
- protected String timestamp;
- protected Map<String, Object> fields = new HashMap<>();
-
- public ESTimeBasedEvent() {
- simpleDateFormat = new SimpleDateFormat(dateFormatPattern);
- simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
- this.timestamp = simpleDateFormat.format(new Date());
- fields.put(AuditingFieldsKey.AUDIT_TIMESTAMP.getDisplayName(), this.timestamp);
-
- }
-
- public static ESTimeBasedEvent createEventFromJson(String jsonString) throws JSONException {
-
- ESTimeBasedEvent event = new ESTimeBasedEvent();
- JSONObject gsonObj;
- gsonObj = new JSONObject(jsonString);
- Iterator keys = gsonObj.keys();
-
- while (keys.hasNext()) {
- String key = (String) keys.next();
- event.fields.put(key, gsonObj.get(key));
- if (key.equals(AuditingFieldsKey.AUDIT_TIMESTAMP.getDisplayName())) {
- event.timestamp = (String) gsonObj.get(key);
- }
- }
- return event;
- }
-
- public String calculateYearIndexSuffix() {
- return timestamp.substring(0, 4);
- }
-
- public String calculateMonthIndexSuffix() {
- return timestamp.substring(0, 7);
- }
-
- public String calculateDayIndexSuffix() {
- return timestamp.substring(0, 10);
- }
-
- public String calculateHourIndexSuffix() {
- return new StringBuilder().append(timestamp.substring(0, 10)).append("-").append(timestamp.substring(11, 13))
- .toString();
- }
-
- public String calculateMinuteIndexSuffix() {
- return new StringBuilder().append(timestamp.substring(0, 10)).append("-").append(timestamp.substring(11, 13))
- .append("-").append(timestamp.substring(14, 16)).toString();
- }
-
- protected String getFormattedString(String template, Object... params) {
- String res = null;
- StringBuilder sb = new StringBuilder();
- Formatter formatter = new Formatter(sb, Locale.US);
- try {
- formatter.format(template, params);
- res = formatter.toString();
- } finally {
- formatter.close();
- }
- return res;
- }
-
- public String getTimestamp() {
- return timestamp;
- }
-
- public void setTimestamp(String timestamp) {
- this.timestamp = timestamp;
- }
-
- public Map<String, Object> getFields() {
- return fields;
- }
-
- public void setFields(Map<String, Object> fields) {
- this.fields = fields;
- }
+ private static final int TIMESTAMP_YEAR_SUBSTRING = 4;
+ private static final int TIMESTAMP_MONTH_SUBSTRING = 7;
+ private static final int TIMESTAMP_DAY_SUBSTRING = 10;
+ private static final int TIMESTAMP_HOURS_START = 11;
+ private static final int TIMESTAMP_HOURS_END = 13;
+ private static final int TIMESTAMP_MINUTES_START = 14;
+ private static final int TIMESTAMP_MINUTES_END = 16;
+
+ protected SimpleDateFormat simpleDateFormat;
+ protected static String dateFormatPattern = "yyyy-MM-dd HH:mm:ss.SSS z";
+ protected String timestamp;
+ protected Map<String, Object> fields = new HashMap<>();
+
+ public ESTimeBasedEvent() {
+ simpleDateFormat = new SimpleDateFormat(dateFormatPattern);
+ simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
+ this.timestamp = simpleDateFormat.format(new Date());
+ fields.put(AuditingFieldsKey.AUDIT_TIMESTAMP.getDisplayName(), this.timestamp);
+
+ }
+
+ public static ESTimeBasedEvent createEventFromJson(String jsonString) throws JSONException {
+
+ ESTimeBasedEvent event = new ESTimeBasedEvent();
+ JSONObject gsonObj;
+ gsonObj = new JSONObject(jsonString);
+ Iterator keys = gsonObj.keys();
+
+ while (keys.hasNext()) {
+ String key = (String) keys.next();
+ event.fields.put(key, gsonObj.get(key));
+ if (key.equals(AuditingFieldsKey.AUDIT_TIMESTAMP.getDisplayName())) {
+ event.timestamp = (String) gsonObj.get(key);
+ }
+ }
+ return event;
+ }
+
+ public String calculateYearIndexSuffix() {
+ return timestamp.substring(0, TIMESTAMP_YEAR_SUBSTRING);
+ }
+
+ public String calculateMonthIndexSuffix() {
+ return timestamp.substring(0, TIMESTAMP_MONTH_SUBSTRING);
+ }
+
+ public String calculateDayIndexSuffix() {
+ return timestamp.substring(0, TIMESTAMP_DAY_SUBSTRING);
+ }
+
+ public String calculateHourIndexSuffix() {
+ return calculateBaseIndexSuffix().toString();
+ }
+
+ public String calculateMinuteIndexSuffix() {
+ return calculateBaseIndexSuffix().append("-").append(timestamp, TIMESTAMP_MINUTES_START, TIMESTAMP_MINUTES_END).toString();
+ }
+
+ private StringBuilder calculateBaseIndexSuffix() {
+ return new StringBuilder().append(timestamp, 0, TIMESTAMP_DAY_SUBSTRING).append("-").append(timestamp, TIMESTAMP_HOURS_START, TIMESTAMP_HOURS_END);
+ }
+
+ protected String getFormattedString(String template, Object... params) {
+ String res;
+ StringBuilder sb = new StringBuilder();
+ try (Formatter formatter = new Formatter(sb, Locale.US)) {
+ formatter.format(template, params);
+ res = formatter.toString();
+ }
+ return res;
+ }
+
+ public String getTimestamp() {
+ return timestamp;
+ }
+
+ public void setTimestamp(String timestamp) {
+ this.timestamp = timestamp;
+ }
+
+ public Map<String, Object> getFields() {
+ return fields;
+ }
+
+ public void setFields(Map<String, Object> fields) {
+ this.fields = fields;
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/datastructure/FunctionalInterfaces.java b/common-app-api/src/main/java/org/openecomp/sdc/common/datastructure/FunctionalInterfaces.java
index e66af77648..5d268d2948 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/datastructure/FunctionalInterfaces.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/datastructure/FunctionalInterfaces.java
@@ -7,9 +7,9 @@
* 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.
@@ -29,7 +29,12 @@ import java.io.Serializable;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
-import java.util.concurrent.*;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;
@@ -37,77 +42,75 @@ import java.util.function.Supplier;
/**
* Class For Functional interfaces And Functional Methods
- *
- * @author mshitrit
*
+ * @author mshitrit
*/
public class FunctionalInterfaces {
- private static final int DEFAULT_REDO_INTERVAL_TIME_MS = 50;
- private static final int DEFAULT_MAX_WAIT_TIME_MS = 10000;
- private static final Logger LOGGER = Logger.getLogger(FunctionalInterfaces.class.getName());
-
- /**
- * This is an interface of a List that implements Serializable
- *
- * @author mshitrit
- *
- * @param <T>
- */
- public interface SerializableList<T> extends List<T>, Serializable {
- }
-
- /**
- * @author mshitrit Consumer that takes two parameters
- * @param <T1>
- * @param <T2>
- */
- public interface ConsumerTwoParam<T1, T2> {
- /**
- * Same Accept method, but takes two parameters
- *
- * @param t1
- * @param t2
- */
- void accept(T1 t1, T2 t2);
- }
-
- /**
- * @author mshitrit Function that takes two parameters
- * @param <T1>
- * @param <T2>
- * @param <R>
- */
- public interface FunctionTwoParam<T1, T2, R> {
- /**
- * Same apply method, but takes two parameters
- *
- * @param t1
- * @param t2
- * @return
- */
- R apply(T1 t1, T2 t2);
- }
-
- /**
- * @author mshitrit Function that throws an exception
- * @param <T>
- * @param <R>
- * @param <E>
- */
- public interface FunctionThrows<T, R, E extends Exception> {
- /**
- * Same apply method, but throws an exception
- *
- * @param t
- * @return
- */
- R apply(T t) throws E;
- }
+ private static final int DEFAULT_REDO_INTERVAL_TIME_MS = 50;
+ private static final int DEFAULT_MAX_WAIT_TIME_MS = 10000;
+ private static final Logger LOGGER = Logger.getLogger(FunctionalInterfaces.class.getName());
+
+ /**
+ * This is an interface of a List that implements Serializable
+ *
+ * @param <T>
+ * @author mshitrit
+ */
+ public interface SerializableList<T> extends List<T>, Serializable {
+ }
+
+ /**
+ * @param <T1>
+ * @param <T2>
+ * @author mshitrit Consumer that takes two parameters
+ */
+ public interface ConsumerTwoParam<T1, T2> {
+ /**
+ * Same Accept method, but takes two parameters
+ *
+ * @param t1
+ * @param t2
+ */
+ void accept(T1 t1, T2 t2);
+ }
+
+ /**
+ * @param <T1>
+ * @param <T2>
+ * @param <R>
+ * @author mshitrit Function that takes two parameters
+ */
+ public interface FunctionTwoParam<T1, T2, R> {
+ /**
+ * Same apply method, but takes two parameters
+ *
+ * @param t1
+ * @param t2
+ * @return
+ */
+ R apply(T1 t1, T2 t2);
+ }
+
+ /**
+ * @param <T>
+ * @param <R>
+ * @param <E>
+ * @author mshitrit Function that throws an exception
+ */
+ public interface FunctionThrows<T, R, E extends Exception> {
+ /**
+ * Same apply method, but throws an exception
+ *
+ * @param t
+ * @return
+ */
+ R apply(T t) throws E;
+ }
public interface FunctionTwoParamThrows<T1, T2, R, E extends Exception> {
/**
* Same apply method, but throws an exception
- *
+ *
* @param t1
* @param t2
* @return
@@ -115,219 +118,213 @@ public class FunctionalInterfaces {
R apply(T1 t1, T2 t2) throws E;
}
- /**
- * @author mshitrit Supplier that throws an exception
- * @param <R>
- * @param <E>
- */
- public interface SupplierThrows<R, E extends Exception> {
- /**
- * Same get method, but throws an exception
- *
- * @return
- * @throws E
- */
- R get() throws E;
- }
-
- /**
- * @author mshitrit Consumer that throws an exception
- * @param <T>
- * @param <E>
- */
- public interface ConsumerThrows<T, E extends Exception> {
- /**
- * Same accept, but throws an exception
- *
- * @param t
- * @throws E
- */
- void accept(T t) throws E;
- }
-
- /**
- * @author mshitrit Runnable that throws an exception
- * @param <E>
- */
- public interface RunnableThrows<E extends Exception> {
- /**
- * Same run, but throws an exception
- *
- * @throws E
- */
- void run() throws E;
- }
-
- /**
- * Runs a method that declares throwing an Exception and has a return value.
- * <br>
- * In case Exception Occurred replaces it with FunctionalAttException. <br>
- * This is useful for two cases:<br>
- * 1.using methods that throws exceptions in streams.<br>
- * 2.replacing declared exception with undeclared exception (Runtime).<br>
- * See below Use Case:<br>
- * Instead of: intList.stream().map(e -> fooThrowsAndReturnsBoolean(e)); -
- * does not compile !<br>
- * Use This : intList.stream().map(e -> swallowException( () ->
- * fooThrowsAndReturnsBoolean(e))); - compiles !<br>
- *
- * @param methodToRun
- * @return
- */
- public static <R, E extends Exception> R swallowException(SupplierThrows<R, E> methodToRun) {
- try {
+ /**
+ * @param <R>
+ * @param <E>
+ * @author mshitrit Supplier that throws an exception
+ */
+ public interface SupplierThrows<R, E extends Exception> {
+ /**
+ * Same get method, but throws an exception
+ *
+ * @return
+ * @throws E
+ */
+ R get() throws E;
+ }
+
+ /**
+ * @param <T>
+ * @param <E>
+ * @author mshitrit Consumer that throws an exception
+ */
+ public interface ConsumerThrows<T, E extends Exception> {
+ /**
+ * Same accept, but throws an exception
+ *
+ * @param t
+ * @throws E
+ */
+ void accept(T t) throws E;
+ }
+
+ /**
+ * @param <E>
+ * @author mshitrit Runnable that throws an exception
+ */
+ public interface RunnableThrows<E extends Exception> {
+ /**
+ * Same run, but throws an exception
+ *
+ * @throws E
+ */
+ void run() throws E;
+ }
+
+ /**
+ * Runs a method that declares throwing an Exception and has a return value.
+ * <br>
+ * In case Exception Occurred replaces it with FunctionalAttException. <br>
+ * This is useful for two cases:<br>
+ * 1.using methods that throws exceptions in streams.<br>
+ * 2.replacing declared exception with undeclared exception (Runtime).<br>
+ * See below Use Case:<br>
+ * Instead of: intList.stream().map(e -> fooThrowsAndReturnsBoolean(e)); -
+ * does not compile !<br>
+ * Use This : intList.stream().map(e -> swallowException( () ->
+ * fooThrowsAndReturnsBoolean(e))); - compiles !<br>
+ *
+ * @param methodToRun
+ * @return
+ */
+ public static <R, E extends Exception> R swallowException(SupplierThrows<R, E> methodToRun) {
+ try {
return methodToRun.get();
- } catch (Exception e) {
- throw new FunctionalAttException(e);
- }
- }
-
- /**
- * Runs a method that declares throwing an Exception without return value.
- * <br>
- * In case Exception Occurred replaces it with FunctionalAttException. <br>
- * This is useful for two cases:<br>
- * 1.using methods that throws exceptions in streams.<br>
- * 2.replacing declared exception with undeclared exception (Runtime).<br>
- * See below Use Case:<br>
- *
- * @param methodToRun
- */
- public static <E extends Exception> void swallowException(RunnableThrows<E> methodToRun) {
-
- SupplierThrows<Boolean, E> runnableWrapper = () -> {
- methodToRun.run();
- return true;
- };
- swallowException(runnableWrapper);
- }
-
- private static class FunctionalAttException extends RuntimeException {
- private static final long serialVersionUID = 1L;
-
- private FunctionalAttException(Exception e) {
- super(e);
- }
- }
-
- /**
- * Runs the given method.<br>
- * Verify the method result against the resultVerifier.<br>
- * If verification passed returns the result.<br>
- * If Verification failed keeps retrying until it passes or until 10 seconds
- * pass.<br>
- * If Exception Occurred keeps retrying until it passes or until 10 seconds
- * pass,<br>
- * If last retry result caused an exception - it is thrown.
- *
- * @param methodToRun
- * given Method
- * @param resultVerifier
- * verifier for the method result
- * @return
- */
- public static <R> R retryMethodOnResult(Supplier<R> methodToRun, Function<R, Boolean> resultVerifier) {
- return retryMethodOnResult(methodToRun, resultVerifier, DEFAULT_MAX_WAIT_TIME_MS,
- DEFAULT_REDO_INTERVAL_TIME_MS);
- }
-
- /**
- * Runs the given method.<br>
- * Verify the method result against the resultVerifier.<br>
- * If verification passed returns the result.<br>
- * If Verification failed keeps retrying until it passes or until maxWait
- * pass.<br>
- * If Exception Occurred keeps retrying until it passes or until maxWait
- * pass,<br>
- * If last retry result caused an exception - it is thrown.
- *
- * @param methodToRun
- * given Method
- * @param resultVerifier
- * verifier for the method result
- * @param maxWaitMS
- * @param retryIntervalMS
- * @return
- */
- public static <R> R retryMethodOnResult(Supplier<R> methodToRun, Function<R, Boolean> resultVerifier,
- long maxWaitMS, long retryIntervalMS) {
- boolean stopSearch = false;
- R ret = null;
- int timeElapsed = 0;
- FunctionalAttException functionalExceotion = null;
- boolean isExceptionInLastTry = false;
- while (!stopSearch) {
- try {
- ret = methodToRun.get();
- stopSearch = resultVerifier.apply(ret);
- isExceptionInLastTry = false;
- } catch (Exception e) {
- functionalExceotion = new FunctionalAttException(e);
- isExceptionInLastTry = true;
-
- } finally {
- sleep(retryIntervalMS);
- timeElapsed += retryIntervalMS;
- if (timeElapsed > maxWaitMS) {
- stopSearch = true;
- }
- }
-
- }
- if (isExceptionInLastTry) {
- throw functionalExceotion;
- } else {
- return ret;
- }
-
- }
-
- /**
- * Runs the given method.<br>
- * Verify the method result against the resultVerifier.<br>
- * If verification passed returns the result.<br>
- * If Verification failed keeps retrying until maxRetries reached.<br>
- * If Exception Occurred keeps retrying until it passes or until maxRetries
- * reached,<br>
- * If last retry result caused an exception - it is thrown.
- *
- * @param methodToRun
- * given Method
- * @param resultVerifier
- * verifier for the method result
- * @param maxRetries
- * @return
- */
- public static <R> R retryMethodOnResult(Supplier<R> methodToRun, Function<R, Boolean> resultVerifier,
- long maxRetries) {
- boolean stopSearch = false;
- R ret = null;
- int retriesCount = 0;
- FunctionalAttException functionalExceotion = null;
- boolean isExceptionInLastTry = false;
- while (!stopSearch) {
- try {
- ret = methodToRun.get();
- stopSearch = resultVerifier.apply(ret);
- isExceptionInLastTry = false;
- } catch (Exception e) {
- functionalExceotion = new FunctionalAttException(e);
- isExceptionInLastTry = true;
- } finally {
- if (++retriesCount >= maxRetries) {
- stopSearch = true;
- }
- }
- }
- if (isExceptionInLastTry) {
- throw functionalExceotion;
- } else {
- return ret;
- }
- }
-
- public static <R> R retryMethodOnException(SupplierThrows<R, Exception> methodToRun,
- Function<Exception, Boolean> exceptionVerifier, long maxRetries) throws Exception {
+ } catch (Exception e) {
+ throw new FunctionalAttException(e);
+ }
+ }
+
+ /**
+ * Runs a method that declares throwing an Exception without return value.
+ * <br>
+ * In case Exception Occurred replaces it with FunctionalAttException. <br>
+ * This is useful for two cases:<br>
+ * 1.using methods that throws exceptions in streams.<br>
+ * 2.replacing declared exception with undeclared exception (Runtime).<br>
+ * See below Use Case:<br>
+ *
+ * @param methodToRun
+ */
+ public static <E extends Exception> void swallowException(RunnableThrows<E> methodToRun) {
+
+ SupplierThrows<Boolean, E> runnableWrapper = () -> {
+ methodToRun.run();
+ return true;
+ };
+ swallowException(runnableWrapper);
+ }
+
+ private static class FunctionalAttException extends RuntimeException {
+ private static final long serialVersionUID = 1L;
+
+ private FunctionalAttException(Exception e) {
+ super(e);
+ }
+ }
+
+ /**
+ * Runs the given method.<br>
+ * Verify the method result against the resultVerifier.<br>
+ * If verification passed returns the result.<br>
+ * If Verification failed keeps retrying until it passes or until 10 seconds
+ * pass.<br>
+ * If Exception Occurred keeps retrying until it passes or until 10 seconds
+ * pass,<br>
+ * If last retry result caused an exception - it is thrown.
+ *
+ * @param methodToRun given Method
+ * @param resultVerifier verifier for the method result
+ * @return
+ */
+ public static <R> R retryMethodOnResult(Supplier<R> methodToRun, Function<R, Boolean> resultVerifier) {
+ return retryMethodOnResult(methodToRun, resultVerifier, DEFAULT_MAX_WAIT_TIME_MS,
+ DEFAULT_REDO_INTERVAL_TIME_MS);
+ }
+
+ /**
+ * Runs the given method.<br>
+ * Verify the method result against the resultVerifier.<br>
+ * If verification passed returns the result.<br>
+ * If Verification failed keeps retrying until it passes or until maxWait
+ * pass.<br>
+ * If Exception Occurred keeps retrying until it passes or until maxWait
+ * pass,<br>
+ * If last retry result caused an exception - it is thrown.
+ *
+ * @param methodToRun given Method
+ * @param resultVerifier verifier for the method result
+ * @param maxWaitMS
+ * @param retryIntervalMS
+ * @return
+ */
+ public static <R> R retryMethodOnResult(Supplier<R> methodToRun, Function<R, Boolean> resultVerifier,
+ long maxWaitMS, long retryIntervalMS) {
+ boolean stopSearch = false;
+ R ret = null;
+ int timeElapsed = 0;
+ FunctionalAttException functionalExceotion = null;
+ boolean isExceptionInLastTry = false;
+ while (!stopSearch) {
+ try {
+ ret = methodToRun.get();
+ stopSearch = resultVerifier.apply(ret);
+ isExceptionInLastTry = false;
+ } catch (Exception e) {
+ functionalExceotion = new FunctionalAttException(e);
+ isExceptionInLastTry = true;
+
+ } finally {
+ sleep(retryIntervalMS);
+ timeElapsed += retryIntervalMS;
+ if (timeElapsed > maxWaitMS) {
+ stopSearch = true;
+ }
+ }
+
+ }
+ if (isExceptionInLastTry) {
+ throw functionalExceotion;
+ } else {
+ return ret;
+ }
+
+ }
+
+ /**
+ * Runs the given method.<br>
+ * Verify the method result against the resultVerifier.<br>
+ * If verification passed returns the result.<br>
+ * If Verification failed keeps retrying until maxRetries reached.<br>
+ * If Exception Occurred keeps retrying until it passes or until maxRetries
+ * reached,<br>
+ * If last retry result caused an exception - it is thrown.
+ *
+ * @param methodToRun given Method
+ * @param resultVerifier verifier for the method result
+ * @param maxRetries
+ * @return
+ */
+ public static <R> R retryMethodOnResult(Supplier<R> methodToRun, Function<R, Boolean> resultVerifier,
+ long maxRetries) {
+ boolean stopSearch = false;
+ R ret = null;
+ int retriesCount = 0;
+ FunctionalAttException functionalExceotion = null;
+ boolean isExceptionInLastTry = false;
+ while (!stopSearch) {
+ try {
+ ret = methodToRun.get();
+ stopSearch = resultVerifier.apply(ret);
+ isExceptionInLastTry = false;
+ } catch (Exception e) {
+ functionalExceotion = new FunctionalAttException(e);
+ isExceptionInLastTry = true;
+ } finally {
+ if (++retriesCount >= maxRetries) {
+ stopSearch = true;
+ }
+ }
+ }
+ if (isExceptionInLastTry) {
+ throw functionalExceotion;
+ } else {
+ return ret;
+ }
+ }
+
+ public static <R> R retryMethodOnException(SupplierThrows<R, Exception> methodToRun,
+ Function<Exception, Boolean> exceptionVerifier, long maxRetries) throws Exception {
boolean stopSearch = false;
R ret = null;
int retriesCount = 0;
@@ -337,12 +334,10 @@ public class FunctionalInterfaces {
exception = null;
ret = methodToRun.get();
stopSearch = true;
- }
- catch (Exception e) {
+ } catch (Exception e) {
exception = e;
stopSearch = exceptionVerifier.apply(e);
- }
- finally {
+ } finally {
if (++retriesCount >= maxRetries) {
stopSearch = true;
}
@@ -350,162 +345,157 @@ public class FunctionalInterfaces {
}
if (exception != null) {
throw exception;
- }
- else {
+ } else {
return ret;
}
}
- /**
- * Runs the given method.<br>
- * In case exception occurred runs the method again either until succeed or
- * until 10 seconds pass.
- *
- * @param methodToRun
- * given method
- * @return
- */
-
- public static <R> R retryMethodOnException(Supplier<R> methodToRun) {
- Function<R, Boolean> dummyVerifier = someResult -> true;
- return retryMethodOnResult(methodToRun, dummyVerifier, DEFAULT_MAX_WAIT_TIME_MS, DEFAULT_REDO_INTERVAL_TIME_MS);
- }
-
- /**
- * Runs the given method.<br>
- * In case exception occurred runs the method again either until succeed or
- * until 10 seconds pass.
- *
- * @param methodToRun
- * given method
- */
- public static void retryMethodOnException(Runnable methodToRun) {
- Function<Boolean, Boolean> dummyVerifier = someResult -> true;
- Supplier<Boolean> dummySupplier = () -> {
- methodToRun.run();
- return true;
- };
- retryMethodOnResult(dummySupplier, dummyVerifier, DEFAULT_MAX_WAIT_TIME_MS, DEFAULT_REDO_INTERVAL_TIME_MS);
- }
-
- /**
- * Same as Thread.sleep but throws a FunctionalAttException
- * (RuntimeException) instead of InterruptedException.<br>
- *
- * @param millis
- */
- public static void sleep(long millis) {
- swallowException(() -> Thread.sleep(millis));
-
- }
-
- /**
- * Converts Either containing right value to another either with different
- * type of left value and the same type of right value.
- *
- * @param eitherToConvert
- * @return
- */
- public static <T1, T2, T3> Either<T1, T2> convertEitherRight(Either<T3, T2> eitherToConvert) {
- if (eitherToConvert.isLeft()) {
- throw new UnsupportedOperationException("Can not convert either right value because it has left value");
- } else {
- return Either.right(eitherToConvert.right().value());
- }
-
- }
-
- /**
- * Converts Either containing left value to another either with different
- * type of right value and the same type of left value.
- *
- * @param eitherToConvert
- * @return
- */
- public static <T1, T2, T3> Either<T1, T2> convertEitherLeft(Either<T1, T3> eitherToConvert) {
- if (eitherToConvert.isLeft()) {
- throw new UnsupportedOperationException("Can not convert either left value because it has right value");
- } else {
- return Either.left(eitherToConvert.left().value());
- }
-
- }
-
- /**
- * Returns enum value for a field <br>
- *
- * @param fieldValue
- * @param values
- * @param enumValueGetter
- * @return
- */
- public static <T extends Enum<T>> T getEnumValueByFieldValue(String fieldValue, T[] values,
- Function<T, String> enumValueGetter, T defaultValue) {
- return getEnumValueByFieldValue(fieldValue, values, enumValueGetter, defaultValue, true);
-
- }
-
-
- public static <T extends Enum<T>> T getEnumValueByFieldValue(String fieldValue, T[] values,
- Function<T, String> enumValueGetter, T defaultValue, boolean isCaseSensetive ){
-
- final Predicate<? super T> predicate;
- if( isCaseSensetive ){
- predicate = e -> fieldValue.equals(enumValueGetter.apply(e));
- }
- else{
- predicate = e -> fieldValue.equalsIgnoreCase(enumValueGetter.apply(e));
- }
- Optional<T> optionalFound =
- // Stream of values of enum
- Arrays.asList(values).stream().
- // Filter in the one that match the field
- filter(predicate).
- // collect
- findAny();
- T ret;
- ret = optionalFound.isPresent() ? optionalFound.get() : defaultValue;
- return ret;
-
- }
-
- /**
- * This method runs the given method.<br>
- * In case given method finished running within timeoutInMs limit it returns
- * Either which left value is the result of the method that ran.<br>
- * In case given method did not finish running within timeoutInMs limit it
- * returns Either which right value is false. <br>
- *
- * @param supplier
- * @param timeoutInMs
- * - if 0 or lower no timeout is used
- * @return
- */
- public static <T> Either<T, Boolean> runMethodWithTimeOut(Supplier<T> supplier, long timeoutInMs) {
- Either<T, Boolean> result;
- if (timeoutInMs <= NumberUtils.LONG_ZERO) {
- result = Either.left(supplier.get());
- } else {
- ExecutorService pool = Executors.newSingleThreadExecutor();
- Future<T> future = pool.submit(supplier::get);
- try {
- T calcValue = future.get(timeoutInMs, TimeUnit.MILLISECONDS);
- result = Either.left(calcValue);
- } catch (InterruptedException e) {
- LOGGER.debug("InterruptedException in runMethodWithTimeOut", e);
- Thread.currentThread().interrupt();
- result = Either.right(false);
- } catch (ExecutionException | TimeoutException e) {
- LOGGER.debug("method run was canceled because it has passed its time limit of {} MS", timeoutInMs, e);
- result = Either.right(false);
- } finally {
- pool.shutdownNow();
- }
- }
- return result;
- }
-
- public static <T> F<T, Boolean> convertToFunction(Consumer<T> consumer) {
+ /**
+ * Runs the given method.<br>
+ * In case exception occurred runs the method again either until succeed or
+ * until 10 seconds pass.
+ *
+ * @param methodToRun given method
+ * @return
+ */
+
+ public static <R> R retryMethodOnException(Supplier<R> methodToRun) {
+ Function<R, Boolean> dummyVerifier = someResult -> true;
+ return retryMethodOnResult(methodToRun, dummyVerifier, DEFAULT_MAX_WAIT_TIME_MS, DEFAULT_REDO_INTERVAL_TIME_MS);
+ }
+
+ /**
+ * Runs the given method.<br>
+ * In case exception occurred runs the method again either until succeed or
+ * until 10 seconds pass.
+ *
+ * @param methodToRun given method
+ */
+ public static void retryMethodOnException(Runnable methodToRun) {
+ Function<Boolean, Boolean> dummyVerifier = someResult -> true;
+ Supplier<Boolean> dummySupplier = () -> {
+ methodToRun.run();
+ return true;
+ };
+ retryMethodOnResult(dummySupplier, dummyVerifier, DEFAULT_MAX_WAIT_TIME_MS, DEFAULT_REDO_INTERVAL_TIME_MS);
+ }
+
+ /**
+ * Same as Thread.sleep but throws a FunctionalAttException
+ * (RuntimeException) instead of InterruptedException.<br>
+ *
+ * @param millis
+ */
+ public static void sleep(long millis) {
+ swallowException(() -> Thread.sleep(millis));
+
+ }
+
+ /**
+ * Converts Either containing right value to another either with different
+ * type of left value and the same type of right value.
+ *
+ * @param eitherToConvert
+ * @return
+ */
+ public static <T1, T2, T3> Either<T1, T2> convertEitherRight(Either<T3, T2> eitherToConvert) {
+ if (eitherToConvert.isLeft()) {
+ throw new UnsupportedOperationException("Can not convert either right value because it has left value");
+ } else {
+ return Either.right(eitherToConvert.right().value());
+ }
+
+ }
+
+ /**
+ * Converts Either containing left value to another either with different
+ * type of right value and the same type of left value.
+ *
+ * @param eitherToConvert
+ * @return
+ */
+ public static <T1, T2, T3> Either<T1, T2> convertEitherLeft(Either<T1, T3> eitherToConvert) {
+ if (eitherToConvert.isLeft()) {
+ throw new UnsupportedOperationException("Can not convert either left value because it has right value");
+ } else {
+ return Either.left(eitherToConvert.left().value());
+ }
+
+ }
+
+ /**
+ * Returns enum value for a field <br>
+ *
+ * @param fieldValue
+ * @param values
+ * @param enumValueGetter
+ * @return
+ */
+ public static <T extends Enum<T>> T getEnumValueByFieldValue(String fieldValue, T[] values,
+ Function<T, String> enumValueGetter, T defaultValue) {
+ return getEnumValueByFieldValue(fieldValue, values, enumValueGetter, defaultValue, true);
+
+ }
+
+
+ public static <T extends Enum<T>> T getEnumValueByFieldValue(String fieldValue, T[] values,
+ Function<T, String> enumValueGetter, T defaultValue, boolean isCaseSensetive) {
+
+ final Predicate<? super T> predicate;
+ if (isCaseSensetive) {
+ predicate = e -> fieldValue.equals(enumValueGetter.apply(e));
+ } else {
+ predicate = e -> fieldValue.equalsIgnoreCase(enumValueGetter.apply(e));
+ }
+ Optional<T> optionalFound =
+ // Stream of values of enum
+ Arrays.asList(values).stream().
+ // Filter in the one that match the field
+ filter(predicate).
+ // collect
+ findAny();
+ T ret;
+ ret = optionalFound.isPresent() ? optionalFound.get() : defaultValue;
+ return ret;
+
+ }
+
+ /**
+ * This method runs the given method.<br>
+ * In case given method finished running within timeoutInMs limit it returns
+ * Either which left value is the result of the method that ran.<br>
+ * In case given method did not finish running within timeoutInMs limit it
+ * returns Either which right value is false. <br>
+ *
+ * @param supplier
+ * @param timeoutInMs - if 0 or lower no timeout is used
+ * @return
+ */
+ public static <T> Either<T, Boolean> runMethodWithTimeOut(Supplier<T> supplier, long timeoutInMs) {
+ Either<T, Boolean> result;
+ if (timeoutInMs <= NumberUtils.LONG_ZERO) {
+ result = Either.left(supplier.get());
+ } else {
+ ExecutorService pool = Executors.newSingleThreadExecutor();
+ Future<T> future = pool.submit(supplier::get);
+ try {
+ T calcValue = future.get(timeoutInMs, TimeUnit.MILLISECONDS);
+ result = Either.left(calcValue);
+ } catch (InterruptedException e) {
+ LOGGER.debug("InterruptedException in runMethodWithTimeOut", e);
+ Thread.currentThread().interrupt();
+ result = Either.right(false);
+ } catch (ExecutionException | TimeoutException e) {
+ LOGGER.debug("method run was canceled because it has passed its time limit of {} MS", timeoutInMs, e);
+ result = Either.right(false);
+ } finally {
+ pool.shutdownNow();
+ }
+ }
+ return result;
+ }
+
+ public static <T> F<T, Boolean> convertToFunction(Consumer<T> consumer) {
return t -> {
try {
consumer.accept(t);
@@ -514,6 +504,6 @@ public class FunctionalInterfaces {
return false;
}
};
- }
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/datastructure/MonitoringFieldsKeysEnum.java b/common-app-api/src/main/java/org/openecomp/sdc/common/datastructure/MonitoringFieldsKeysEnum.java
index f92b4ef687..4ac3e26f1e 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/datastructure/MonitoringFieldsKeysEnum.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/datastructure/MonitoringFieldsKeysEnum.java
@@ -7,9 +7,9 @@
* 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.
@@ -23,35 +23,35 @@ package org.openecomp.sdc.common.datastructure;
import java.util.Date;
public enum MonitoringFieldsKeysEnum {
- MONITORING_TIMESTAMP(Date.class, "TIMESTAMP"),
- MONITORING_HOST_IP(String.class, "HOST_IP"),
- MONITORING_HOST_CPU(Long.class, "HOST_CPU"),
- MONITORING_HOST_MEM(Long.class, "HOST_MEMORY"),
- MONITORING_HOST_DISC(Long.class, "HOST_DISC"),
- MONITORING_JVM_ID(String.class, "JVM_ID"),
- MONITORING_JVM_CPU(Long.class, "JVM_CPU"),
- MONITORING_JVM_MEM(Long.class, "JVM_MEMORY"),
- MONITORING_JVM_TNUM(Long.class, "JVM_TNUM"),
- MONITORING_APP_ID(String.class, "APP_ID"),
- MONITORING_APP_STAT(String.class, "APP_STAT");
-
- private Class<?> clazz;
- private String displayName;
-
- MonitoringFieldsKeysEnum(Class<?> clazz, String displayName) {
- this.clazz = clazz;
- this.displayName = displayName;
- }
-
- public Class<?> getValueClass() {
- return this.clazz;
- }
-
- public String getDisplayName() {
- return displayName;
- }
-
- public void setDisplayName(String displayName) {
- this.displayName = displayName;
- }
+ MONITORING_TIMESTAMP(Date.class, "TIMESTAMP"),
+ MONITORING_HOST_IP(String.class, "HOST_IP"),
+ MONITORING_HOST_CPU(Long.class, "HOST_CPU"),
+ MONITORING_HOST_MEM(Long.class, "HOST_MEMORY"),
+ MONITORING_HOST_DISC(Long.class, "HOST_DISC"),
+ MONITORING_JVM_ID(String.class, "JVM_ID"),
+ MONITORING_JVM_CPU(Long.class, "JVM_CPU"),
+ MONITORING_JVM_MEM(Long.class, "JVM_MEMORY"),
+ MONITORING_JVM_TNUM(Long.class, "JVM_TNUM"),
+ MONITORING_APP_ID(String.class, "APP_ID"),
+ MONITORING_APP_STAT(String.class, "APP_STAT");
+
+ private Class<?> clazz;
+ private String displayName;
+
+ MonitoringFieldsKeysEnum(Class<?> clazz, String displayName) {
+ this.clazz = clazz;
+ this.displayName = displayName;
+ }
+
+ public Class<?> getValueClass() {
+ return this.clazz;
+ }
+
+ public String getDisplayName() {
+ return displayName;
+ }
+
+ public void setDisplayName(String displayName) {
+ this.displayName = displayName;
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/datastructure/Wrapper.java b/common-app-api/src/main/java/org/openecomp/sdc/common/datastructure/Wrapper.java
index 43fd5ca15f..96c38cc3cf 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/datastructure/Wrapper.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/datastructure/Wrapper.java
@@ -7,9 +7,9 @@
* 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.
@@ -22,31 +22,30 @@ package org.openecomp.sdc.common.datastructure;
/**
* Very Basic Wrapper class.
- *
- * @author mshitrit
- *
+ *
* @param <T>
+ * @author mshitrit
*/
public class Wrapper<T> {
- private T innerElement;
+ private T innerElement;
- public Wrapper(T innerElement) {
- this.innerElement = innerElement;
- }
+ public Wrapper(T innerElement) {
+ this.innerElement = innerElement;
+ }
- public Wrapper() {
- this.innerElement = null;
- }
+ public Wrapper() {
+ this.innerElement = null;
+ }
- public T getInnerElement() {
- return innerElement;
- }
+ public T getInnerElement() {
+ return innerElement;
+ }
- public void setInnerElement(T innerElement) {
- this.innerElement = innerElement;
- }
+ public void setInnerElement(T innerElement) {
+ this.innerElement = innerElement;
+ }
- public boolean isEmpty() {
- return innerElement == null;
- }
+ public boolean isEmpty() {
+ return innerElement == null;
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/ComparableHttpRequestRetryHandler.java b/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/ComparableHttpRequestRetryHandler.java
index 21c0f45e24..7273a04bd0 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/ComparableHttpRequestRetryHandler.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/ComparableHttpRequestRetryHandler.java
@@ -7,9 +7,9 @@
* 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.
@@ -19,10 +19,11 @@
*/
package org.openecomp.sdc.common.http.client.api;
+
import org.apache.http.client.HttpRequestRetryHandler;
public interface ComparableHttpRequestRetryHandler extends HttpRequestRetryHandler {
- public default <T extends HttpRequestRetryHandler> boolean compare(T handler) {
+ default <T extends HttpRequestRetryHandler> boolean compare(T handler) {
return (handler != null && getClass() == handler.getClass());
}
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/HttpClient.java b/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/HttpClient.java
index d384893d1d..9ed3efde11 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/HttpClient.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/HttpClient.java
@@ -7,9 +7,9 @@
* 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.
@@ -29,7 +29,13 @@ import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.AuthCache;
import org.apache.http.client.CredentialsProvider;
-import org.apache.http.client.methods.*;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpDelete;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPatch;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.methods.HttpPut;
+import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.impl.auth.BasicScheme;
import org.apache.http.impl.client.BasicAuthCache;
@@ -46,16 +52,18 @@ import java.net.URI;
import java.util.Properties;
public class HttpClient {
- private static final Logger logger = Logger.getLogger(HttpClient.class.getName());
-
+ private static final Logger LOGGER = Logger.getLogger(HttpClient.class.getName());
+ public static final int HTTPS_PORT = 443;
+ public static final int HTTP_PORT = 80;
+
private final CloseableHttpClient client;
private final HttpClientConfigImmutable configImmutable;
-
+
HttpClient(CloseableHttpClient client, HttpClientConfigImmutable configImmutable) {
this.client = client;
- this.configImmutable = configImmutable;
+ this.configImmutable = configImmutable;
}
-
+
<T> HttpResponse<T> get(String url, Properties headers, FunctionThrows<CloseableHttpResponse, HttpResponse<T>, Exception> responseBuilder) throws HttpExecuteException {
HttpGet httpGet = new HttpGet(url);
return execute(httpGet, headers, responseBuilder);
@@ -83,18 +91,17 @@ public class HttpClient {
HttpDelete httpDelete = new HttpDelete(url);
return execute(httpDelete, headers, responseBuilder);
}
-
+
void close() {
try {
client.close();
- }
- catch (IOException e) {
- logger.debug("Close http client failed with exception ", e);
+ } catch (IOException e) {
+ LOGGER.debug("Close http client failed with exception ", e);
}
}
-
+
private <T> HttpResponse<T> execute(HttpRequestBase request, Properties headers, FunctionThrows<CloseableHttpResponse, HttpResponse<T>, Exception> responseBuilder) throws HttpExecuteException {
- if(configImmutable.getHeaders() != null) {
+ if (configImmutable.getHeaders() != null) {
configImmutable.getHeaders().forEach(request::addHeader);
}
@@ -103,31 +110,30 @@ public class HttpClient {
}
HttpClientContext httpClientContext = null;
- if(request.getHeaders(HttpHeaders.AUTHORIZATION).length == 0) {
+ if (request.getHeaders(HttpHeaders.AUTHORIZATION).length == 0) {
httpClientContext = createHttpContext(request.getURI());
}
- logger.debug("Execute request {}", request.getRequestLine());
+ LOGGER.debug("Execute request {}", request.getRequestLine());
try (CloseableHttpResponse response = client.execute(request, httpClientContext)) {
return responseBuilder.apply(response);
- }
- catch (Exception e) {
- String description = String.format("Execute request %s failed with exception: %s", request.getRequestLine(), e.getMessage());
+ } catch (Exception e) {
+ String description = String.format("Execute request %s failed with exception: %s", request.getRequestLine(), e.getMessage());
BeEcompErrorManager.getInstance().logInternalFlowError("ExecuteRestRequest", description, ErrorSeverity.ERROR);
- logger.debug("{}: ",description, e);
+ LOGGER.debug("{}: ", description, e);
throw new HttpExecuteException(description, e);
- }
+ }
}
private HttpClientContext createHttpContext(URI uri) {
- if(StringUtils.isEmpty(configImmutable.getBasicAuthUserName()) || StringUtils.isEmpty(configImmutable.getBasicAuthPassword())) {
+ if (StringUtils.isEmpty(configImmutable.getBasicAuthUserName()) || StringUtils.isEmpty(configImmutable.getBasicAuthPassword())) {
return null;
}
CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
int port = getPort(uri);
- credentialsProvider.setCredentials(new AuthScope(uri.getHost(), port),
+ credentialsProvider.setCredentials(new AuthScope(uri.getHost(), port),
new UsernamePasswordCredentials(configImmutable.getBasicAuthUserName(), configImmutable.getBasicAuthPassword()));
HttpClientContext localContext = HttpClientContext.create();
@@ -141,18 +147,15 @@ public class HttpClient {
}
private int getPort(URI uri) {
- int port = uri.getPort();
- if(port < 0) {
- if(Constants.HTTPS.equals(uri.getScheme())) {
- port = 443;
- }
- else
- if (Constants.HTTP.equals(uri.getScheme())) {
- port = 80;
- }
- else {
+ int port = uri.getPort();
+ if (port < 0) {
+ if (Constants.HTTPS.equals(uri.getScheme())) {
+ port = HTTPS_PORT;
+ } else if (Constants.HTTP.equals(uri.getScheme())) {
+ port = HTTP_PORT;
+ } else {
port = AuthScope.ANY_PORT;
- logger.debug("Protocol \"{}\" is not supported, set port to {}", uri.getScheme(), port);
+ LOGGER.debug("Protocol \"{}\" is not supported, set port to {}", uri.getScheme(), port);
}
}
return port;
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/HttpClientConfigImmutable.java b/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/HttpClientConfigImmutable.java
index 2b31d49539..f0fe09fe7c 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/HttpClientConfigImmutable.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/HttpClientConfigImmutable.java
@@ -7,9 +7,9 @@
* 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.
@@ -36,14 +36,14 @@ final class HttpClientConfigImmutable {
private final ClientCertificate clientCertificate;
private final Timeouts timeouts;
/*
- * use ComparableHttpRequestRetryHandler.compare instead of default generated equals
+ * use ComparableHttpRequestRetryHandler.compare instead of default generated equals
*/
private final ComparableHttpRequestRetryHandler retryHandler;
private final int numOfRetries;
-
+
static HttpClientConfigImmutable getOrCreate(HttpClientConfig httpClientConfig) {
// TODO: retrieve from a pool if exist, otherwise create new
- return new HttpClientConfigImmutable(httpClientConfig);
+ return new HttpClientConfigImmutable(httpClientConfig);
}
HttpClientConfigImmutable(HttpClientConfig httpClientConfig) {
@@ -62,7 +62,7 @@ final class HttpClientConfigImmutable {
int getNumOfRetries() {
return numOfRetries;
}
-
+
String getBasicAuthPassword() {
return basicAuthorization != null ? basicAuthorization.getPassword() : null;
}
@@ -82,7 +82,7 @@ final class HttpClientConfigImmutable {
ClientCertificate getClientCertificate() {
return clientCertificate != null ? new ClientCertificate(clientCertificate) : null;
}
-
+
int getReadTimeoutMs() {
return timeouts.getReadTimeoutMs();
}
@@ -113,43 +113,51 @@ final class HttpClientConfigImmutable {
@Override
public boolean equals(Object obj) {
- if (this == obj)
+ if (this == obj) {
return true;
- if (obj == null)
+ }
+ if (obj == null) {
return false;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
+ }
HttpClientConfigImmutable other = (HttpClientConfigImmutable) obj;
if (basicAuthorization == null) {
- if (other.basicAuthorization != null)
+ if (other.basicAuthorization != null) {
return false;
- }
- else if (!basicAuthorization.equals(other.basicAuthorization))
+ }
+ } else if (!basicAuthorization.equals(other.basicAuthorization)) {
return false;
+ }
if (clientCertificate == null) {
- if (other.clientCertificate != null)
+ if (other.clientCertificate != null) {
return false;
- }
- else if (!clientCertificate.equals(other.clientCertificate))
+ }
+ } else if (!clientCertificate.equals(other.clientCertificate)) {
return false;
+ }
if (headers == null) {
- if (other.headers != null)
+ if (other.headers != null) {
return false;
- }
- else if (!headers.equals(other.headers))
+ }
+ } else if (!headers.equals(other.headers)) {
return false;
+ }
if (retryHandler == null) {
- if (other.retryHandler != null)
+ if (other.retryHandler != null) {
return false;
- }
- else if (!retryHandler.compare(other.retryHandler))
+ }
+ } else if (!retryHandler.compare(other.retryHandler)) {
return false;
+ }
if (timeouts == null) {
- if (other.timeouts != null)
+ if (other.timeouts != null) {
return false;
- }
- else if (!timeouts.equals(other.timeouts))
+ }
+ } else if (!timeouts.equals(other.timeouts)) {
return false;
+ }
return true;
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/HttpClientFactory.java b/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/HttpClientFactory.java
index 729bc1a0a0..24e2f909bc 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/HttpClientFactory.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/HttpClientFactory.java
@@ -7,9 +7,9 @@
* 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.
@@ -32,26 +32,26 @@ import org.openecomp.sdc.common.log.wrappers.Logger;
public class HttpClientFactory {
- private static final Logger logger = Logger.getLogger(HttpClientFactory.class.getName());
- private static final UserTokenHandler userTokenHandler = context -> null;
+ private static final Logger LOGGER = Logger.getLogger(HttpClientFactory.class.getName());
+ private static final UserTokenHandler USER_TOKEN_HANDLER = context -> null;
private final HttpConnectionMngFactory connectionMngFactory;
-
+
HttpClientFactory(HttpConnectionMngFactory connectionMngFactory) {
this.connectionMngFactory = connectionMngFactory;
}
HttpClient createClient(String protocol, HttpClientConfigImmutable config) {
- logger.debug("Create {} client based on {}", protocol, config);
+ LOGGER.debug("Create {} client based on {}", protocol, config);
- ClientCertificate clientCertificate = Constants.HTTPS.equals(protocol) ? config.getClientCertificate() : null;
+ ClientCertificate clientCertificate = Constants.HTTPS.equals(protocol) ? config.getClientCertificate() : null;
HttpClientConnectionManager connectionManager = connectionMngFactory.getOrCreate(clientCertificate);
RequestConfig requestConfig = createClientTimeoutConfiguration(config);
CloseableHttpClient client = HttpClients.custom()
- .setDefaultRequestConfig(requestConfig)
- .setConnectionManager(connectionManager)
- .setUserTokenHandler(userTokenHandler)
- .setRetryHandler(resolveRetryHandler(config))
- .build();
+ .setDefaultRequestConfig(requestConfig)
+ .setConnectionManager(connectionManager)
+ .setUserTokenHandler(USER_TOKEN_HANDLER)
+ .setRetryHandler(resolveRetryHandler(config))
+ .build();
return new HttpClient(client, config);
}
@@ -59,7 +59,7 @@ public class HttpClientFactory {
private HttpRequestRetryHandler resolveRetryHandler(HttpClientConfigImmutable config) {
return config.getNumOfRetries() > 0 ? config.getRetryHandler() : null;
}
-
+
private RequestConfig createClientTimeoutConfiguration(HttpClientConfigImmutable config) {
return RequestConfig.custom()
.setConnectTimeout(config.getConnectTimeoutMs())
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/HttpConnectionMngFactory.java b/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/HttpConnectionMngFactory.java
index c5634eaf8c..d5d03329bb 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/HttpConnectionMngFactory.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/HttpConnectionMngFactory.java
@@ -7,9 +7,9 @@
* 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.
@@ -48,43 +48,42 @@ public class HttpConnectionMngFactory {
private static final String P12_KEYSTORE_EXTENTION = ".p12";
private static final String PFX_KEYSTORE_EXTENTION = ".pfx";
private static final String JKS_KEYSTORE_EXTENTION = ".jks";
-
+
private static final String P12_KEYSTORE_TYPE = "pkcs12";
private static final String JKS_KEYSTORE_TYPE = "jks";
-
- private static final Logger logger = Logger.getLogger(HttpConnectionMngFactory.class.getName());
+
+ private static final Logger LOGGER = Logger.getLogger(HttpConnectionMngFactory.class.getName());
private static final int DEFAULT_CONNECTION_POOL_SIZE = 30;
private static final int DEFAULT_MAX_CONNECTION_PER_ROUTE = 5;
private static final int VALIDATE_CONNECTION_AFTER_INACTIVITY_MS = 10000;
-
+
private Map<ClientCertificate, HttpClientConnectionManager> sslClientConnectionManagers = new ConcurrentHashMap<>();
private HttpClientConnectionManager plainClientConnectionManager;
-
+
HttpConnectionMngFactory() {
plainClientConnectionManager = createConnectionMng(null);
}
HttpClientConnectionManager getOrCreate(ClientCertificate clientCertificate) {
- if(clientCertificate == null) {
+ if (clientCertificate == null) {
return plainClientConnectionManager;
}
return sslClientConnectionManagers.computeIfAbsent(clientCertificate, k -> createConnectionMng(clientCertificate));
}
-
+
private HttpClientConnectionManager createConnectionMng(ClientCertificate clientCertificate) {
SSLContextBuilder sslContextBuilder = new SSLContextBuilder();
SSLConnectionSocketFactory sslsf = null;
try {
sslContextBuilder.loadTrustMaterial(new TrustSelfSignedStrategy());
-
- if(clientCertificate != null) {
+
+ if (clientCertificate != null) {
setClientSsl(clientCertificate, sslContextBuilder);
}
sslsf = new SSLConnectionSocketFactory(sslContextBuilder.build(), NoopHostnameVerifier.INSTANCE);
- }
- catch (GeneralSecurityException e) {
- logger.debug("Create SSL connection socket factory failed with exception, use default SSL factory ", e);
+ } catch (GeneralSecurityException e) {
+ LOGGER.debug("Create SSL connection socket factory failed with exception, use default SSL factory ", e);
sslsf = SSLConnectionSocketFactory.getSocketFactory();
}
@@ -106,13 +105,12 @@ public class HttpConnectionMngFactory {
char[] keyStorePassword = clientCertificate.getKeyStorePassword().toCharArray();
KeyStore clientKeyStore = createClientKeyStore(clientCertificate.getKeyStore(), keyStorePassword);
sslContextBuilder.loadKeyMaterial(clientKeyStore, keyStorePassword);
- logger.debug("#setClientSsl - Set Client Certificate authentication");
- }
- catch (IOException | GeneralSecurityException e) {
- logger.debug("#setClientSsl - Set Client Certificate authentication failed with exception, diasable client SSL authentication ", e);
+ LOGGER.debug("#setClientSsl - Set Client Certificate authentication");
+ } catch (IOException | GeneralSecurityException e) {
+ LOGGER.debug("#setClientSsl - Set Client Certificate authentication failed with exception, diasable client SSL authentication ", e);
}
}
-
+
private KeyStore createClientKeyStore(String keyStorePath, char[] keyStorePassword) throws IOException, GeneralSecurityException {
KeyStore keyStore = null;
try (InputStream stream = new FileInputStream(keyStorePath)) {
@@ -121,15 +119,14 @@ public class HttpConnectionMngFactory {
}
return keyStore;
}
-
+
private String getKeyStoreType(String keyStore) {
- if(!StringUtils.isEmpty(keyStore)) {
- if(keyStore.endsWith(P12_KEYSTORE_EXTENTION) || keyStore.endsWith(PFX_KEYSTORE_EXTENTION)) {
+ if (!StringUtils.isEmpty(keyStore)) {
+ if (keyStore.endsWith(P12_KEYSTORE_EXTENTION) || keyStore.endsWith(PFX_KEYSTORE_EXTENTION)) {
return P12_KEYSTORE_TYPE;
- }
- else if(keyStore.endsWith(JKS_KEYSTORE_EXTENTION)) {
+ } else if (keyStore.endsWith(JKS_KEYSTORE_EXTENTION)) {
return JKS_KEYSTORE_TYPE;
- }
+ }
}
return KeyStore.getDefaultType();
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/HttpExecuteException.java b/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/HttpExecuteException.java
index 8487e1ff72..2b2e7a4f12 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/HttpExecuteException.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/HttpExecuteException.java
@@ -7,9 +7,9 @@
* 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.
@@ -25,17 +25,17 @@ public class HttpExecuteException extends Exception {
private static final long serialVersionUID = 1L;
public HttpExecuteException(String message) {
- super (message);
+ super(message);
}
public HttpExecuteException(String message, Throwable cause) {
- super (message, cause);
+ super(message, cause);
}
public HttpExecuteException(Throwable cause) {
super(cause);
}
-
+
@Override
public Throwable getCause() {
Throwable cause = super.getCause();
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/HttpRequest.java b/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/HttpRequest.java
index 57e5cb2bed..b418ce744e 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/HttpRequest.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/HttpRequest.java
@@ -7,9 +7,9 @@
* 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.
@@ -28,27 +28,34 @@ import java.util.Properties;
//TODO- remove all static and use instance methods for better testing
public abstract class HttpRequest {
- static final Properties defaultHeaders = null;
- static final HttpClientConfig defaultConfig = new HttpClientConfig();
-
+ private static final Properties DEFAULT_HEADERS = null;
+ private static final HttpClientConfig DEFAULT_CONFIG = new HttpClientConfig();
private HttpRequest() {
}
+ public static Properties getDefaultHeaders() {
+ return DEFAULT_HEADERS;
+ }
+
+ public static HttpClientConfig getDefaultConfig() {
+ return DEFAULT_CONFIG;
+ }
+
/*
* GET response as string
*/
public static HttpResponse<String> get(String url) throws HttpExecuteException {
- return get(url, defaultHeaders, defaultConfig);
+ return get(url, DEFAULT_HEADERS, DEFAULT_CONFIG);
}
public static HttpResponse<String> get(String url, Properties headers) throws HttpExecuteException {
- return get(url, headers, defaultConfig);
+ return get(url, headers, DEFAULT_CONFIG);
}
-
+
public static HttpResponse<String> get(String url, HttpClientConfig config) throws HttpExecuteException {
- return get(url, defaultHeaders, config);
+ return get(url, DEFAULT_HEADERS, config);
}
public static HttpResponse<String> get(String url, Properties headers, HttpClientConfig config) throws HttpExecuteException {
@@ -59,15 +66,15 @@ public abstract class HttpRequest {
* GET response as byte array
*/
public static HttpResponse<byte[]> getAsByteArray(String url) throws HttpExecuteException {
- return getAsByteArray(url, defaultHeaders, defaultConfig);
+ return getAsByteArray(url, DEFAULT_HEADERS, DEFAULT_CONFIG);
}
public static HttpResponse<byte[]> getAsByteArray(String url, Properties headers) throws HttpExecuteException {
- return getAsByteArray(url, headers, defaultConfig);
+ return getAsByteArray(url, headers, DEFAULT_CONFIG);
}
public static HttpResponse<byte[]> getAsByteArray(String url, HttpClientConfig config) throws HttpExecuteException {
- return getAsByteArray(url, defaultHeaders, config);
+ return getAsByteArray(url, DEFAULT_HEADERS, config);
}
public static HttpResponse<byte[]> getAsByteArray(String url, Properties headers, HttpClientConfig config) throws HttpExecuteException {
@@ -78,15 +85,15 @@ public abstract class HttpRequest {
* PUT
*/
public static HttpResponse<String> put(String url, HttpEntity entity) throws HttpExecuteException {
- return put(url, defaultHeaders, entity, defaultConfig);
+ return put(url, DEFAULT_HEADERS, entity, DEFAULT_CONFIG);
}
public static HttpResponse<String> put(String url, Properties headers, HttpEntity entity) throws HttpExecuteException {
- return put(url, headers, entity, defaultConfig);
+ return put(url, headers, entity, DEFAULT_CONFIG);
}
-
+
public static HttpResponse<String> put(String url, HttpEntity entity, HttpClientConfig config) throws HttpExecuteException {
- return put(url, defaultHeaders, entity, config);
+ return put(url, DEFAULT_HEADERS, entity, config);
}
public static HttpResponse<String> put(String url, Properties headers, HttpEntity entity, HttpClientConfig config) throws HttpExecuteException {
@@ -97,59 +104,59 @@ public abstract class HttpRequest {
* POST
*/
public static HttpResponse<String> post(String url, HttpEntity entity) throws HttpExecuteException {
- return post(url, defaultHeaders, entity, defaultConfig);
+ return post(url, DEFAULT_HEADERS, entity, DEFAULT_CONFIG);
}
public static HttpResponse<String> post(String url, Properties headers, HttpEntity entity) throws HttpExecuteException {
- return post(url, headers, entity, defaultConfig);
+ return post(url, headers, entity, DEFAULT_CONFIG);
}
-
+
public static HttpResponse<String> post(String url, HttpEntity entity, HttpClientConfig config) throws HttpExecuteException {
- return post(url, defaultHeaders, entity, config);
+ return post(url, DEFAULT_HEADERS, entity, config);
}
public static HttpResponse<String> post(String url, Properties headers, HttpEntity entity, HttpClientConfig config) throws HttpExecuteException {
return HttpRequestHandler.get().post(url, headers, entity, config);
}
-
+
/*
* PATCH
*/
public static HttpResponse<String> patch(String url, HttpEntity entity) throws HttpExecuteException {
- return patch(url, defaultHeaders, entity, defaultConfig);
+ return patch(url, DEFAULT_HEADERS, entity, DEFAULT_CONFIG);
}
public static HttpResponse<String> patch(String url, Properties headers, HttpEntity entity) throws HttpExecuteException {
- return patch(url, headers, entity, defaultConfig);
+ return patch(url, headers, entity, DEFAULT_CONFIG);
}
-
+
public static HttpResponse<String> patch(String url, HttpEntity entity, HttpClientConfig config) throws HttpExecuteException {
- return patch(url, defaultHeaders, entity, config);
+ return patch(url, DEFAULT_HEADERS, entity, config);
}
public static HttpResponse<String> patch(String url, Properties headers, HttpEntity entity, HttpClientConfig config) throws HttpExecuteException {
return HttpRequestHandler.get().patch(url, headers, entity, config);
}
-
+
/*
* DELETE
*/
public static HttpResponse<String> delete(String url) throws HttpExecuteException {
- return delete(url, defaultHeaders, defaultConfig);
+ return delete(url, DEFAULT_HEADERS, DEFAULT_CONFIG);
}
public static HttpResponse<String> delete(String url, Properties headers) throws HttpExecuteException {
- return delete(url, headers, defaultConfig);
+ return delete(url, headers, DEFAULT_CONFIG);
}
-
+
public static HttpResponse<String> delete(String url, HttpClientConfig config) throws HttpExecuteException {
- return delete(url, defaultHeaders, config);
+ return delete(url, DEFAULT_HEADERS, config);
}
public static HttpResponse<String> delete(String url, Properties headers, HttpClientConfig config) throws HttpExecuteException {
return HttpRequestHandler.get().delete(url, headers, config);
}
-
+
public static void destroy() {
HttpRequestHandler.get().destroy();
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/HttpRequestHandler.java b/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/HttpRequestHandler.java
index 73f0f15354..e4747f4308 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/HttpRequestHandler.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/HttpRequestHandler.java
@@ -7,9 +7,9 @@
* 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.
@@ -38,10 +38,10 @@ public class HttpRequestHandler {
private static HttpRequestHandler handlerInstance = new HttpRequestHandler();
private static final String HTTPS_PREFIX = "https://";
private static final String HTTP_PREFIX = "http://";
-
+
private Map<HttpClientConfigImmutable, HttpClient> clients = new ConcurrentHashMap<>();
private HttpClientFactory clientFactory;
-
+
private FunctionThrows<CloseableHttpResponse, HttpResponse<byte[]>, Exception> byteResponseBuilder = (CloseableHttpResponse httpResponse) -> {
HttpEntity entity = httpResponse.getEntity();
byte[] response = null;
@@ -51,8 +51,8 @@ public class HttpRequestHandler {
response = IOUtils.toByteArray(content);
}
}
- return new HttpResponse<>(response,
- httpResponse.getStatusLine().getStatusCode(),
+ return new HttpResponse<>(response,
+ httpResponse.getStatusLine().getStatusCode(),
httpResponse.getStatusLine().getReasonPhrase());
};
@@ -62,7 +62,7 @@ public class HttpRequestHandler {
if (entity != null) {
response = EntityUtils.toString(entity);
}
- return new HttpResponse<>(response,
+ return new HttpResponse<>(response,
httpResponse.getStatusLine().getStatusCode(),
httpResponse.getStatusLine().getReasonPhrase());
};
@@ -71,7 +71,7 @@ public class HttpRequestHandler {
HttpConnectionMngFactory connectionMngFactory = new HttpConnectionMngFactory();
clientFactory = new HttpClientFactory(connectionMngFactory);
}
-
+
public static HttpRequestHandler get() {
return handlerInstance;
}
@@ -81,7 +81,7 @@ public class HttpRequestHandler {
return client.<String>get(url, headers, stringResponseBuilder);
}
- public HttpResponse<byte []> getAsByteArray(String url, Properties headers, HttpClientConfig config) throws HttpExecuteException {
+ public HttpResponse<byte[]> getAsByteArray(String url, Properties headers, HttpClientConfig config) throws HttpExecuteException {
HttpClient client = getOrCreateClient(url, config);
return client.<byte[]>get(url, headers, byteResponseBuilder);
}
@@ -102,15 +102,15 @@ public class HttpRequestHandler {
}
public HttpResponse<String> delete(String url, Properties headers, HttpClientConfig config) throws HttpExecuteException {
- HttpClient client = getOrCreateClient(url, config != null ? config : HttpRequest.defaultConfig);
+ HttpClient client = getOrCreateClient(url, config != null ? config : HttpRequest.getDefaultConfig());
return client.<String>delete(url, headers, stringResponseBuilder);
}
-
+
public void destroy() {
clients.forEach((k, v) -> v.close());
clients.clear();
}
-
+
private HttpClient getOrCreateClient(String url, HttpClientConfig config) throws HttpExecuteException {
String protocol = getProtocol(url);
HttpClientConfigImmutable httpClientConfigImmutable = HttpClientConfigImmutable.getOrCreate(config);
@@ -129,12 +129,10 @@ public class HttpRequestHandler {
private String getProtocol(String url) throws HttpExecuteException {
if (url.startsWith(HTTPS_PREFIX)) {
return Constants.HTTPS;
- }
- else if (url.startsWith(HTTP_PREFIX)) {
+ } else if (url.startsWith(HTTP_PREFIX)) {
return Constants.HTTP;
- }
- else {
+ } else {
throw new HttpExecuteException(String.format("Failed to create http client. Requested protocol is not supported \"%s\"", url));
- }
+ }
}
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/HttpResponse.java b/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/HttpResponse.java
index c6061cf1c2..b3a4a96b2f 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/HttpResponse.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/HttpResponse.java
@@ -7,9 +7,9 @@
* 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.
@@ -32,7 +32,7 @@ public class HttpResponse<T> {
this.statusCode = statusCode;
this.description = StringUtils.EMPTY;
}
-
+
public HttpResponse(T response, int statusCode, String description) {
this.response = response;
this.statusCode = statusCode;
@@ -63,6 +63,6 @@ public class HttpResponse<T> {
builder.append("]");
return builder.toString();
}
-
-
+
+
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/Responses.java b/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/Responses.java
index 71f9ac2629..88c4a4fe87 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/Responses.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/Responses.java
@@ -7,9 +7,9 @@
* 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.
@@ -24,7 +24,7 @@ import org.apache.http.HttpStatus;
public final class Responses {
public static final HttpResponse<String> INTERNAL_SERVER_ERROR = new HttpResponse<>("Internal server error", HttpStatus.SC_INTERNAL_SERVER_ERROR);
-
+
private Responses() {
}
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/RestUtils.java b/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/RestUtils.java
index 7b39e3f8c9..efac5c18ef 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/RestUtils.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/RestUtils.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/RetryHandlers.java b/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/RetryHandlers.java
index bbcd815e75..f611ad6eba 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/RetryHandlers.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/http/client/api/RetryHandlers.java
@@ -7,9 +7,9 @@
* 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.
@@ -27,14 +27,15 @@ import java.io.IOException;
public class RetryHandlers {
- private static final Logger logger = Logger.getLogger(RetryHandlers.class.getName());
+ private static final Logger LOGGER = Logger.getLogger(RetryHandlers.class.getName());
- private RetryHandlers(){}
+ private RetryHandlers() {
+ }
public static ComparableHttpRequestRetryHandler getDefault(int numOfRetries) {
return (IOException exception, int executionCount, HttpContext context) -> {
- logger.debug("failed sending request with exception", exception);
- logger.debug("try request number: {}", executionCount);
+ LOGGER.debug("failed sending request with exception", exception);
+ LOGGER.debug("try request number: {}", executionCount);
return executionCount <= numOfRetries;
};
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/http/config/BasicAuthorization.java b/common-app-api/src/main/java/org/openecomp/sdc/common/http/config/BasicAuthorization.java
index efd1b558c2..47338b77e7 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/http/config/BasicAuthorization.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/http/config/BasicAuthorization.java
@@ -7,9 +7,9 @@
* 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.
@@ -53,19 +53,17 @@ public class BasicAuthorization {
return password;
}
-
+
private void setPassword(String password, boolean isEncoded) {
validate(password);
- if(isEncoded) {
+ if (isEncoded) {
Either<String, String> passkey = SecurityUtil.INSTANCE.decrypt(password);
- if(passkey.isLeft()) {
+ if (passkey.isLeft()) {
this.password = passkey.left().value();
- }
- else {
+ } else {
throw new IllegalArgumentException(passkey.right().value());
}
- }
- else {
+ } else {
this.password = password;
}
}
@@ -81,26 +79,28 @@ public class BasicAuthorization {
@Override
public boolean equals(Object obj) {
- if (this == obj)
+ if (this == obj) {
return true;
- if (obj == null)
+ }
+ if (obj == null) {
return false;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
+ }
BasicAuthorization other = (BasicAuthorization) obj;
if (password == null) {
- if (other.password != null)
+ if (other.password != null) {
return false;
- }
- else if (!password.equals(other.password))
+ }
+ } else if (!password.equals(other.password)) {
return false;
+ }
if (userName == null) {
- if (other.userName != null)
- return false;
+ return other.userName == null;
+ } else {
+ return userName.equals(other.userName);
}
- else if (!userName.equals(other.userName))
- return false;
- return true;
}
@Override
@@ -113,7 +113,7 @@ public class BasicAuthorization {
}
private void validate(String str) {
- if(StringUtils.isEmpty(str)) {
+ if (StringUtils.isEmpty(str)) {
throw new IllegalArgumentException("BasicAuthorization username and/or password cannot be empty");
}
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/http/config/ClientCertificate.java b/common-app-api/src/main/java/org/openecomp/sdc/common/http/config/ClientCertificate.java
index 6ce2a38553..259d965b0d 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/http/config/ClientCertificate.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/http/config/ClientCertificate.java
@@ -7,9 +7,9 @@
* 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.
@@ -35,7 +35,7 @@ public class ClientCertificate {
setKeyStore(clientCertificate.getKeyStore());
setKeyStorePassword(clientCertificate.getKeyStorePassword(), false);
}
-
+
public void setKeyStore(String keyStore) {
validate(keyStore);
this.keyStore = keyStore;
@@ -47,16 +47,14 @@ public class ClientCertificate {
private void setKeyStorePassword(String keyStorePassword, boolean isEncoded) {
validate(keyStorePassword);
- if(isEncoded) {
+ if (isEncoded) {
Either<String, String> passkey = SecurityUtil.INSTANCE.decrypt(keyStorePassword);
if (passkey.isLeft()) {
this.keyStorePassword = passkey.left().value();
- }
- else {
+ } else {
throw new IllegalArgumentException(passkey.right().value());
}
- }
- else {
+ } else {
this.keyStorePassword = keyStorePassword;
}
}
@@ -68,7 +66,7 @@ public class ClientCertificate {
public String getKeyStorePassword() {
return keyStorePassword;
}
-
+
@Override
public int hashCode() {
final int prime = 31;
@@ -80,39 +78,37 @@ public class ClientCertificate {
@Override
public boolean equals(Object obj) {
- if (this == obj)
+ if (this == obj) {
return true;
- if (obj == null)
+ }
+ if (obj == null) {
return false;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
+ }
ClientCertificate other = (ClientCertificate) obj;
if (keyStore == null) {
- if (other.keyStore != null)
+ if (other.keyStore != null) {
return false;
- }
- else if (!keyStore.equals(other.keyStore))
+ }
+ } else if (!keyStore.equals(other.keyStore)) {
return false;
+ }
if (keyStorePassword == null) {
- if (other.keyStorePassword != null)
- return false;
+ return other.keyStorePassword == null;
+ } else {
+ return keyStorePassword.equals(other.keyStorePassword);
}
- else if (!keyStorePassword.equals(other.keyStorePassword))
- return false;
- return true;
}
@Override
public String toString() {
- StringBuilder builder = new StringBuilder();
- builder.append("ClientCertificate [keyStore=");
- builder.append(keyStore);
- builder.append("]");
- return builder.toString();
+ return "ClientCertificate [keyStore=" + keyStore + "]";
}
-
+
private void validate(String str) {
- if(StringUtils.isEmpty(str)) {
+ if (StringUtils.isEmpty(str)) {
throw new IllegalArgumentException("ClientCertificate keystore and/or kestorePassword cannot be empty");
}
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/http/config/ExternalServiceConfig.java b/common-app-api/src/main/java/org/openecomp/sdc/common/http/config/ExternalServiceConfig.java
index dcc9b73bcd..2af8e74447 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/http/config/ExternalServiceConfig.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/http/config/ExternalServiceConfig.java
@@ -7,9 +7,9 @@
* 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.
@@ -21,14 +21,14 @@
package org.openecomp.sdc.common.http.config;
public class ExternalServiceConfig {
-
+
private HttpRequestConfig httpRequestConfig;
private HttpClientConfig httpClientConfig;
public HttpRequestConfig getHttpRequestConfig() {
return httpRequestConfig;
}
-
+
public void setHttpRequestConfig(HttpRequestConfig httpRequestConfig) {
this.httpRequestConfig = httpRequestConfig;
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/http/config/HttpClientConfig.java b/common-app-api/src/main/java/org/openecomp/sdc/common/http/config/HttpClientConfig.java
index e19d1c99d1..3ed3b7c86c 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/http/config/HttpClientConfig.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/http/config/HttpClientConfig.java
@@ -7,9 +7,9 @@
* 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.
@@ -33,9 +33,9 @@ public class HttpClientConfig {
private Map<String, String> headers;
private int numOfRetries;
- public HttpClientConfig() {
+ public HttpClientConfig() {
}
-
+
public HttpClientConfig(Timeouts timeouts) {
setTimeouts(timeouts);
}
@@ -81,11 +81,11 @@ public class HttpClientConfig {
public void setClientCertificate(ClientCertificate clientCertificate) {
this.clientCertificate = clientCertificate;
}
-
+
public Map<String, String> getHeaders() {
return headers;
}
-
+
public void setHeaders(Map<String, String> headers) {
this.headers = headers;
}
@@ -93,7 +93,7 @@ public class HttpClientConfig {
public int getNumOfRetries() {
return numOfRetries;
}
-
+
public void setNumOfRetries(int numOfRetries) {
this.numOfRetries = numOfRetries;
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/http/config/HttpRequestConfig.java b/common-app-api/src/main/java/org/openecomp/sdc/common/http/config/HttpRequestConfig.java
index 040d068dfe..89e3532a10 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/http/config/HttpRequestConfig.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/http/config/HttpRequestConfig.java
@@ -7,9 +7,9 @@
* 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.
@@ -27,22 +27,22 @@ public class HttpRequestConfig {
private String serverRootUrl;
private Map<String, String> resourceNamespaces;
-
+
public String getServerRootUrl() {
return serverRootUrl;
}
-
+
public void setServerRootUrl(String serverRootUrl) {
this.serverRootUrl = serverRootUrl;
}
-
+
public Map<String, String> getResourceNamespaces() {
- if(resourceNamespaces == null) {
+ if (resourceNamespaces == null) {
resourceNamespaces = new HashMap<>();
}
return resourceNamespaces;
}
-
+
public void setResourceNamespaces(Map<String, String> resourceNamespaces) {
this.resourceNamespaces = resourceNamespaces;
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/http/config/Timeouts.java b/common-app-api/src/main/java/org/openecomp/sdc/common/http/config/Timeouts.java
index 39ef8555ad..e8711f4d12 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/http/config/Timeouts.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/http/config/Timeouts.java
@@ -7,9 +7,9 @@
* 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.
@@ -28,8 +28,9 @@ public class Timeouts {
private int connectPoolTimeoutMs = DEFAULT_TIMEOUT_MS;
public static final Timeouts DEFAULT;
+
static {
- DEFAULT = new Timeouts();
+ DEFAULT = new Timeouts();
}
private Timeouts() {
@@ -49,30 +50,30 @@ public class Timeouts {
public int getConnectTimeoutMs() {
return connectTimeoutMs;
}
-
+
public void setConnectTimeoutMs(int connectTimeoutMs) {
validate(connectTimeoutMs);
this.connectTimeoutMs = connectTimeoutMs;
}
-
+
public int getReadTimeoutMs() {
return readTimeoutMs;
}
-
+
public void setReadTimeoutMs(int readTimeoutMs) {
validate(readTimeoutMs);
this.readTimeoutMs = readTimeoutMs;
}
-
+
public int getConnectPoolTimeoutMs() {
return connectPoolTimeoutMs;
}
-
+
public void setConnectPoolTimeoutMs(int connectPoolTimeoutMs) {
validate(connectPoolTimeoutMs);
this.connectPoolTimeoutMs = connectPoolTimeoutMs;
}
-
+
@Override
public int hashCode() {
final int prime = 31;
@@ -82,40 +83,38 @@ public class Timeouts {
result = prime * result + readTimeoutMs;
return result;
}
-
+
@Override
public boolean equals(Object obj) {
- if (this == obj)
+ if (this == obj) {
return true;
- if (obj == null)
+ }
+ if (obj == null) {
return false;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
+ }
Timeouts other = (Timeouts) obj;
- if (connectPoolTimeoutMs != other.connectPoolTimeoutMs)
- return false;
- if (connectTimeoutMs != other.connectTimeoutMs)
+ if (connectPoolTimeoutMs != other.connectPoolTimeoutMs) {
return false;
- if (readTimeoutMs != other.readTimeoutMs)
+ }
+ if (connectTimeoutMs != other.connectTimeoutMs) {
return false;
- return true;
+ }
+ return readTimeoutMs == other.readTimeoutMs;
}
-
+
@Override
public String toString() {
- StringBuilder builder = new StringBuilder();
- builder.append("Timeouts [connectTimeoutMs=");
- builder.append(connectTimeoutMs);
- builder.append(", readTimeoutMs=");
- builder.append(readTimeoutMs);
- builder.append(", connectPoolTimeoutMs=");
- builder.append(connectPoolTimeoutMs);
- builder.append("]");
- return builder.toString();
+ return "Timeouts [connectTimeoutMs=" + connectTimeoutMs
+ + ", readTimeoutMs=" + readTimeoutMs
+ + ", connectPoolTimeoutMs=" + connectPoolTimeoutMs
+ + "]";
}
-
+
private void validate(int timeout) {
- if(timeout <= 0) {
+ if (timeout <= 0) {
throw new IllegalArgumentException("Timeout values cannot be less than zero");
}
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/impl/ConfigFileChangeListener.java b/common-app-api/src/main/java/org/openecomp/sdc/common/impl/ConfigFileChangeListener.java
index e243bac730..f1f1305ee9 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/impl/ConfigFileChangeListener.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/impl/ConfigFileChangeListener.java
@@ -7,9 +7,9 @@
* 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.
@@ -35,111 +35,111 @@ import java.util.Map;
public class ConfigFileChangeListener extends FileChangeListener {
- private static Logger log = Logger.getLogger(ConfigFileChangeListener.class.getName());
+ private static Logger log = Logger.getLogger(ConfigFileChangeListener.class.getName());
- private Map<String, List<ConfigurationListener>> fileChangeToCallBack = new HashMap<>();
+ private Map<String, List<ConfigurationListener>> fileChangeToCallBack = new HashMap<>();
- private Object lock = new Object();
+ private Object lock = new Object();
- private YamlToObjectConverter yamlToObjectConverter = new YamlToObjectConverter();
+ private YamlToObjectConverter yamlToObjectConverter = new YamlToObjectConverter();
- @Override
- public void onFileChange(File pFile) {
+ @Override
+ public void onFileChange(File pFile) {
- super.onFileChange(pFile);
+ super.onFileChange(pFile);
- if (pFile != null) {
+ if (pFile != null) {
- if (fileChangeToCallBack != null) {
+ if (fileChangeToCallBack != null) {
- String id = findIdFromFileName(pFile.getName());
+ String id = findIdFromFileName(pFile.getName());
- if (id != null) {
+ if (id != null) {
- List<ConfigurationListener> listeners = fileChangeToCallBack.get(id);
- if (listeners != null) {
- for (ConfigurationListener configurationListener : listeners) {
+ List<ConfigurationListener> listeners = fileChangeToCallBack.get(id);
+ if (listeners != null) {
+ for (ConfigurationListener configurationListener : listeners) {
- Class<? extends BasicConfiguration> configClass = configurationListener.getType();
+ Class<? extends BasicConfiguration> configClass = configurationListener.getType();
- BasicConfiguration basicConfiguration = yamlToObjectConverter.convert(pFile.getAbsolutePath(), configClass);
+ BasicConfiguration basicConfiguration = yamlToObjectConverter.convert(pFile.getAbsolutePath(), configClass);
- if (basicConfiguration == null) {
- log.warn(EcompLoggerErrorCode.UNKNOWN_ERROR,"","","Cannot update the listeners for file Change since the file content is invalid");
- continue;
- }
- log.debug("Loaded configuration after converting is {}", basicConfiguration);
+ if (basicConfiguration == null) {
+ log.warn(EcompLoggerErrorCode.UNKNOWN_ERROR, "", "", "Cannot update the listeners for file Change since the file content is invalid");
+ continue;
+ }
+ log.debug("Loaded configuration after converting is {}", basicConfiguration);
- configurationListener.getCallBack().reconfigure(basicConfiguration);
+ configurationListener.getCallBack().reconfigure(basicConfiguration);
- }
- }
- } else {
+ }
+ }
+ } else {
- log.warn(EcompLoggerErrorCode.UNKNOWN_ERROR,"","","Cannot calculate id from file {}", pFile.getName());
- }
- }
+ log.warn(EcompLoggerErrorCode.UNKNOWN_ERROR, "", "", "Cannot calculate id from file {}", pFile.getName());
+ }
+ }
- }
+ }
- log.debug("File {} was changed.", pFile);
- }
+ log.debug("File {} was changed.", pFile);
+ }
- private String findIdFromFileName(String name) {
+ private String findIdFromFileName(String name) {
- String result = null;
- if (name != null) {
- int startIndex = 0;
- int endIndex = name.length();
- if (name.contains(File.separator)) {
- startIndex = name.lastIndexOf(File.separator);
- }
- // String subNameString = name.substring(startIndex, endIndex);
- // if (subNameString.contains(".")) {
- // endIndex = subNameString.indexOf(".");
- // }
+ String result = null;
+ if (name != null) {
+ int startIndex = 0;
+ int endIndex = name.length();
+ if (name.contains(File.separator)) {
+ startIndex = name.lastIndexOf(File.separator);
+ }
+ // String subNameString = name.substring(startIndex, endIndex);
+ // if (subNameString.contains(".")) {
+ // endIndex = subNameString.indexOf(".");
+ // }
- result = name.substring(startIndex, endIndex);
+ result = name.substring(startIndex, endIndex);
- }
+ }
- return result;
- }
+ return result;
+ }
- public void register(String id, ConfigurationListener configurationListener) {
+ public void register(String id, ConfigurationListener configurationListener) {
- if (configurationListener != null) {
+ if (configurationListener != null) {
- synchronized (lock) {
+ synchronized (lock) {
- List<ConfigurationListener> callbacks = fileChangeToCallBack.get(id);
- if (callbacks == null) {
- callbacks = new ArrayList<>();
- fileChangeToCallBack.put(id, callbacks);
- }
- callbacks.add(configurationListener);
+ List<ConfigurationListener> callbacks = fileChangeToCallBack.get(id);
+ if (callbacks == null) {
+ callbacks = new ArrayList<>();
+ fileChangeToCallBack.put(id, callbacks);
+ }
+ callbacks.add(configurationListener);
- }
+ }
- }
+ }
- }
+ }
- // public void notify(String id, BasicConfiguration object) {
- //
- // if (fileChangeToCallBack != null) {
- // List<ConfigurationListener> listeners = fileChangeToCallBack
- // .get(id);
- // if (listeners != null) {
- // for (ConfigurationListener configurationListener : listeners) {
- //
- // configurationListener.getCallBack().reconfigure(object);
- //
- // }
- // }
- // }
- //
- // }
+ // public void notify(String id, BasicConfiguration object) {
+ //
+ // if (fileChangeToCallBack != null) {
+ // List<ConfigurationListener> listeners = fileChangeToCallBack
+ // .get(id);
+ // if (listeners != null) {
+ // for (ConfigurationListener configurationListener : listeners) {
+ //
+ // configurationListener.getCallBack().reconfigure(object);
+ //
+ // }
+ // }
+ // }
+ //
+ // }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/impl/ExternalConfiguration.java b/common-app-api/src/main/java/org/openecomp/sdc/common/impl/ExternalConfiguration.java
index 79a78828e8..f1a1f490ca 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/impl/ExternalConfiguration.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/impl/ExternalConfiguration.java
@@ -7,9 +7,9 @@
* 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.
@@ -26,81 +26,80 @@ import org.openecomp.sdc.common.api.ConfigurationSource;
import java.io.File;
/**
- *
* Save the
- *
- * @author esofer
*
+ * @author esofer
*/
public class ExternalConfiguration {
- private static String appName;
- private static String appVersion;
- private static String configDir;
- private static ConfigurationSource configurationSource;
-
- private static FilesystemAlterationMonitor fam = null;
-
- private static ConfigFileChangeListener changeListener = new ConfigFileChangeListener();
-
- private static boolean enableReconfigure = true;
-
- public static String getAppName() {
- return appName;
- }
-
- public static void setAppName(String appName) {
- ExternalConfiguration.appName = appName;
- }
-
- public static String getAppVersion() {
- return appVersion;
- }
-
- public static void setAppVersion(String appVersion) {
- ExternalConfiguration.appVersion = appVersion;
- }
-
- public static String getConfigDir() {
- return configDir;
- }
-
- public static void setConfigDir(String configDir) {
- ExternalConfiguration.configDir = configDir;
- }
-
- public static ConfigurationSource getConfigurationSource() {
- return configurationSource;
- }
-
- public static void setConfigurationSource(ConfigurationSource configurationSource) {
- ExternalConfiguration.configurationSource = configurationSource;
- }
-
- public static ConfigFileChangeListener getChangeListener() {
- return changeListener;
- }
-
- public static void listenForChanges() {
-
- String watchingDir = configDir + File.separator + appName;
- if (enableReconfigure) {
- if (fam == null) {
- fam = new FilesystemAlterationMonitor();
- fam.setInterval(1000);
- fam.addListener(new File(watchingDir), changeListener);
- fam.start();
- }
- }
- }
-
- public static void stopListenForFileChanges() {
- if (enableReconfigure) {
- if (fam != null) {
- fam.stop();
- fam = null;
- }
- }
- }
+ public static final int FILESYSTEM_MONITOR_INTERVAL = 1000;
+ private static String appName;
+ private static String appVersion;
+ private static String configDir;
+ private static ConfigurationSource configurationSource;
+
+ private static FilesystemAlterationMonitor fam = null;
+
+ private static ConfigFileChangeListener changeListener = new ConfigFileChangeListener();
+
+ private static boolean enableReconfigure = true;
+
+ public static String getAppName() {
+ return appName;
+ }
+
+ public static void setAppName(String appName) {
+ ExternalConfiguration.appName = appName;
+ }
+
+ public static String getAppVersion() {
+ return appVersion;
+ }
+
+ public static void setAppVersion(String appVersion) {
+ ExternalConfiguration.appVersion = appVersion;
+ }
+
+ public static String getConfigDir() {
+ return configDir;
+ }
+
+ public static void setConfigDir(String configDir) {
+ ExternalConfiguration.configDir = configDir;
+ }
+
+ public static ConfigurationSource getConfigurationSource() {
+ return configurationSource;
+ }
+
+ public static void setConfigurationSource(ConfigurationSource configurationSource) {
+ ExternalConfiguration.configurationSource = configurationSource;
+ }
+
+ public static ConfigFileChangeListener getChangeListener() {
+ return changeListener;
+ }
+
+ public static void listenForChanges() {
+
+ String watchingDir = configDir + File.separator + appName;
+ if (enableReconfigure) {
+ if (fam == null) {
+ fam = new FilesystemAlterationMonitor();
+ fam.setInterval(FILESYSTEM_MONITOR_INTERVAL);
+ fam.addListener(new File(watchingDir), changeListener);
+ fam.start();
+ }
+ }
+ }
+
+ public static void stopListenForFileChanges() {
+ if (enableReconfigure) {
+ if (fam != null) {
+ fam.stop();
+ fam = null;
+ }
+ }
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/impl/FSConfigurationSource.java b/common-app-api/src/main/java/org/openecomp/sdc/common/impl/FSConfigurationSource.java
index a800305958..3f2f6a7a01 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/impl/FSConfigurationSource.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/impl/FSConfigurationSource.java
@@ -7,9 +7,9 @@
* 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.
@@ -27,89 +27,88 @@ import org.openecomp.sdc.common.util.YamlToObjectConverter;
/**
* Read configuration from file system
- *
- * @author esofer
*
+ * @author esofer
*/
public class FSConfigurationSource implements ConfigurationSource {
- private YamlToObjectConverter yamlToObjectConverter = new YamlToObjectConverter();
+ private YamlToObjectConverter yamlToObjectConverter = new YamlToObjectConverter();
- private ConfigFileChangeListener changeListener = null;
- private String appConfigDir = null;
+ private ConfigFileChangeListener changeListener = null;
+ private String appConfigDir = null;
- public FSConfigurationSource(ConfigFileChangeListener changeListener, String appConfigDir) {
- super();
- this.changeListener = changeListener;
- this.appConfigDir = appConfigDir;
- }
+ public FSConfigurationSource(ConfigFileChangeListener changeListener, String appConfigDir) {
+ super();
+ this.changeListener = changeListener;
+ this.appConfigDir = appConfigDir;
+ }
- /*
- * get and watch configuration changes. The file name we looking for is the lower case of the class name separated by "-".
- *
- * (non-Javadoc)
- *
- * @see org.openecomp.sdc.common.api.ConfigurationSource#getAndWatchConfiguration (java.lang.Class, org.openecomp.sdc.common.api.ConfigurationListener)
- */
- public <T> T getAndWatchConfiguration(Class<T> className, ConfigurationListener configurationListener) {
+ /*
+ * get and watch configuration changes. The file name we looking for is the lower case of the class name separated by "-".
+ *
+ * (non-Javadoc)
+ *
+ * @see org.openecomp.sdc.common.api.ConfigurationSource#getAndWatchConfiguration (java.lang.Class, org.openecomp.sdc.common.api.ConfigurationListener)
+ */
+ public <T> T getAndWatchConfiguration(Class<T> className, ConfigurationListener configurationListener) {
- String configFileName = calculateFileName(className);
+ String configFileName = calculateFileName(className);
- T object = yamlToObjectConverter.convert(this.appConfigDir, className, configFileName);
+ T object = yamlToObjectConverter.convert(this.appConfigDir, className, configFileName);
- if (configurationListener != null && changeListener != null) {
- if (object != null) {
- changeListener.register(configFileName, configurationListener);
- }
- }
+ if (configurationListener != null && changeListener != null) {
+ if (object != null) {
+ changeListener.register(configFileName, configurationListener);
+ }
+ }
- return object;
- }
+ return object;
+ }
- public <T> void addWatchConfiguration(Class<T> className, ConfigurationListener configurationListener) {
+ public <T> void addWatchConfiguration(Class<T> className, ConfigurationListener configurationListener) {
- String configFileName = calculateFileName(className);
+ String configFileName = calculateFileName(className);
- if (configurationListener != null) {
- changeListener.register(configFileName, configurationListener);
- }
+ if (configurationListener != null) {
+ changeListener.register(configFileName, configurationListener);
+ }
- }
+ }
- /**
- * convert camel case string to list of words separated by "-" where each word is in lower case format. For example, MyClass will be calculated to be my-class.yaml .
- *
- * @param className
- * @return file name based on the class name
- */
- private static <T> String calculateFileName(Class<T> className) {
+ /**
+ * convert camel case string to list of words separated by "-" where each word is in lower case format. For example, MyClass will be calculated to be my-class.yaml .
+ *
+ * @param className
+ * @return file name based on the class name
+ */
+ private static <T> String calculateFileName(Class<T> className) {
- String[] words = className.getSimpleName().split("(?=\\p{Upper})");
+ String[] words = className.getSimpleName().split("(?=\\p{Upper})");
- StringBuilder builder = new StringBuilder();
+ StringBuilder builder = new StringBuilder();
- // There cannot be a null value returned from "split" - words != null is
- // redundant
- // if (words != null) {
- boolean isFirst = true;
- for (int i = 0; i < words.length; i++) {
+ // There cannot be a null value returned from "split" - words != null is
+ // redundant
+ // if (words != null) {
+ boolean isFirst = true;
+ for (int i = 0; i < words.length; i++) {
- String word = words[i];
- if (word != null && !word.isEmpty()) {
- if (!isFirst) {
- builder.append("-");
- } else {
- isFirst = false;
- }
- builder.append(words[i].toLowerCase());
- }
- }
- return builder.toString() + Constants.YAML_SUFFIX;
+ String word = words[i];
+ if (word != null && !word.isEmpty()) {
+ if (!isFirst) {
+ builder.append("-");
+ } else {
+ isFirst = false;
+ }
+ builder.append(words[i].toLowerCase());
+ }
+ }
+ return builder.toString() + Constants.YAML_SUFFIX;
- /*
- * } else { return className.getSimpleName().toLowerCase() + Constants.YAML_SUFFIX; }
- */
+ /*
+ * } else { return className.getSimpleName().toLowerCase() + Constants.YAML_SUFFIX; }
+ */
- }
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/impl/MutableHttpServletRequest.java b/common-app-api/src/main/java/org/openecomp/sdc/common/impl/MutableHttpServletRequest.java
index 3b88ff8978..90ab998557 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/impl/MutableHttpServletRequest.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/impl/MutableHttpServletRequest.java
@@ -7,9 +7,9 @@
* 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.
@@ -22,46 +22,51 @@ package org.openecomp.sdc.common.impl;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
-import java.util.*;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
public final class MutableHttpServletRequest extends HttpServletRequestWrapper {
- // holds custom header and value mapping
- private final Map<String, String> customHeaders;
+ // holds custom header and value mapping
+ private final Map<String, String> customHeaders;
- public MutableHttpServletRequest(HttpServletRequest request) {
- super(request);
- this.customHeaders = new HashMap<>();
- }
+ public MutableHttpServletRequest(HttpServletRequest request) {
+ super(request);
+ this.customHeaders = new HashMap<>();
+ }
- public void putHeader(String name, String value) {
- this.customHeaders.put(name, value);
- }
+ public void putHeader(String name, String value) {
+ this.customHeaders.put(name, value);
+ }
- public String getHeader(String name) {
- // check the custom headers first
- String headerValue = customHeaders.get(name);
+ public String getHeader(String name) {
+ // check the custom headers first
+ String headerValue = customHeaders.get(name);
- if (headerValue != null) {
- return headerValue;
- }
- // else return from into the original wrapped object
- return ((HttpServletRequest) getRequest()).getHeader(name);
- }
+ if (headerValue != null) {
+ return headerValue;
+ }
+ // else return from into the original wrapped object
+ return ((HttpServletRequest) getRequest()).getHeader(name);
+ }
- public Enumeration<String> getHeaderNames() {
- // create a set of the custom header names
- Set<String> set = new HashSet<>(customHeaders.keySet());
+ public Enumeration<String> getHeaderNames() {
+ // create a set of the custom header names
+ Set<String> set = new HashSet<>(customHeaders.keySet());
- // now add the headers from the wrapped request object
- @SuppressWarnings("unchecked")
- Enumeration<String> e = ((HttpServletRequest) getRequest()).getHeaderNames();
- while (e.hasMoreElements()) {
- // add the names of the request headers into the list
- String n = e.nextElement();
- set.add(n);
- }
+ // now add the headers from the wrapped request object
+ @SuppressWarnings("unchecked")
+ Enumeration<String> e = ((HttpServletRequest) getRequest()).getHeaderNames();
+ while (e.hasMoreElements()) {
+ // add the names of the request headers into the list
+ String n = e.nextElement();
+ set.add(n);
+ }
- // create an enumeration from the set and return
- return Collections.enumeration(set);
- }
+ // create an enumeration from the set and return
+ return Collections.enumeration(set);
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/jsongraph/util/CommonUtility.java b/common-app-api/src/main/java/org/openecomp/sdc/common/jsongraph/util/CommonUtility.java
index a4fc1b520e..cbc5f0d56f 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/jsongraph/util/CommonUtility.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/jsongraph/util/CommonUtility.java
@@ -7,9 +7,9 @@
* 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.
@@ -24,57 +24,57 @@ import org.openecomp.sdc.common.log.wrappers.Logger;
/**
* Provides common utility: functionality, common fields and enumerations
- *
*/
public class CommonUtility {
- /**
- * Provides list of logging level names
- *
- */
- public enum LogLevelEnum {
- ERROR,
- WARNING,
- INFO,
- DEBUG,
- TRACE,
- }
- /**
- * Adds received message to log according to level in case if specified level is enabled
- * @param logger
- * @param logLevel
- * @param format
- * @param arguments
- */
- public static void addRecordToLog(Logger logger, LogLevelEnum logLevel, String format, Object... arguments ){
- switch(logLevel){
- case ERROR:
- if(logger.isErrorEnabled()){
- logger.error(format, arguments);
- }
- break;
- case WARNING:
- if(logger.isWarnEnabled()){
- logger.warn(format, arguments);
- }
- break;
- case INFO:
- if(logger.isInfoEnabled()){
- logger.info(format, arguments);
- }
- break;
- case DEBUG:
- if(logger.isDebugEnabled()){
- logger.debug(format, arguments);
- }
- break;
- case TRACE:
- if(logger.isTraceEnabled()){
- logger.trace(format, arguments);
- }
- break;
- default:
- break;
- }
- }
-
+ /**
+ * Provides list of logging level names
+ */
+ public enum LogLevelEnum {
+ ERROR,
+ WARNING,
+ INFO,
+ DEBUG,
+ TRACE,
+ }
+
+ /**
+ * Adds received message to log according to level in case if specified level is enabled
+ *
+ * @param logger
+ * @param logLevel
+ * @param format
+ * @param arguments
+ */
+ public static void addRecordToLog(Logger logger, LogLevelEnum logLevel, String format, Object... arguments) {
+ switch (logLevel) {
+ case ERROR:
+ if (logger.isErrorEnabled()) {
+ logger.error(format, arguments);
+ }
+ break;
+ case WARNING:
+ if (logger.isWarnEnabled()) {
+ logger.warn(format, arguments);
+ }
+ break;
+ case INFO:
+ if (logger.isInfoEnabled()) {
+ logger.info(format, arguments);
+ }
+ break;
+ case DEBUG:
+ if (logger.isDebugEnabled()) {
+ logger.debug(format, arguments);
+ }
+ break;
+ case TRACE:
+ if (logger.isTraceEnabled()) {
+ logger.trace(format, arguments);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/kpi/api/ASDCKpiApi.java b/common-app-api/src/main/java/org/openecomp/sdc/common/kpi/api/ASDCKpiApi.java
index 65cf7161d4..b1bd99ef76 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/kpi/api/ASDCKpiApi.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/kpi/api/ASDCKpiApi.java
@@ -7,9 +7,9 @@
* 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.
@@ -24,43 +24,43 @@ import org.openecomp.sdc.common.log.wrappers.Logger;
public class ASDCKpiApi {
- private static Logger log = Logger.getLogger(ASDCKpiApi.class.getName());
+ private static Logger log = Logger.getLogger(ASDCKpiApi.class.getName());
- /* Number of activated resource imports. */
- public static void countImportResourcesKPI() {
- // TODO Auto-generated method stub
- log.trace("Number of activated resource imports.");
+ /* Number of activated resource imports. */
+ public static void countImportResourcesKPI() {
+ // TODO Auto-generated method stub
+ log.trace("Number of activated resource imports.");
- }
+ }
- /* Number of created resources. */
- public static void countCreatedResourcesKPI() {
- // TODO Auto-generated method stub
- log.trace("Number of created resources.");
+ /* Number of created resources. */
+ public static void countCreatedResourcesKPI() {
+ // TODO Auto-generated method stub
+ log.trace("Number of created resources.");
- }
+ }
- /* Number of created services */
- public static void countCreatedServicesKPI() {
- // TODO Auto-generated method stub
- log.trace("Number of created services.");
+ /* Number of created services */
+ public static void countCreatedServicesKPI() {
+ // TODO Auto-generated method stub
+ log.trace("Number of created services.");
- }
+ }
- /*
- * Number of ASDC portal accesses ( number of activated user authorizations)
- */
- public static void countUsersAuthorizations() {
- // TODO Auto-generated method stub
- log.trace("Number of activated distribution");
+ /*
+ * Number of ASDC portal accesses ( number of activated user authorizations)
+ */
+ public static void countUsersAuthorizations() {
+ // TODO Auto-generated method stub
+ log.trace("Number of activated distribution");
- }
+ }
- /* Number of activated distribution */
- public static void countActivatedDistribution() {
- // TODO Auto-generated method stub
- log.trace("Number of activated distribution");
+ /* Number of activated distribution */
+ public static void countActivatedDistribution() {
+ // TODO Auto-generated method stub
+ log.trace("Number of activated distribution");
- }
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/listener/AppContextListener.java b/common-app-api/src/main/java/org/openecomp/sdc/common/listener/AppContextListener.java
index f5325a73e1..dd05ee47ae 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/listener/AppContextListener.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/listener/AppContextListener.java
@@ -7,9 +7,9 @@
* 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.
@@ -39,89 +39,89 @@ import java.util.jar.Manifest;
public class AppContextListener implements ServletContextListener {
- private static Logger log = Logger.getLogger(AppContextListener.class.getName());
+ private static Logger log = Logger.getLogger(AppContextListener.class.getName());
- public void contextInitialized(ServletContextEvent context) {
+ public void contextInitialized(ServletContextEvent context) {
- log.debug("ServletContextListener initialized ");
+ log.debug("ServletContextListener initialized ");
- log.debug("After read values from Manifest {}", getManifestInfo(context.getServletContext()));
+ log.debug("After read values from Manifest {}", getManifestInfo(context.getServletContext()));
- Map<String, String> manifestAttr = getManifestInfo(context.getServletContext());
+ Map<String, String> manifestAttr = getManifestInfo(context.getServletContext());
- String appName = setAndGetAttributeInContext(context, manifestAttr, Constants.APPLICATION_NAME);
- String appVersion = setAndGetAttributeInContext(context, manifestAttr, Constants.APPLICATION_VERSION);
+ String appName = setAndGetAttributeInContext(context, manifestAttr, Constants.APPLICATION_NAME);
+ String appVersion = setAndGetAttributeInContext(context, manifestAttr, Constants.APPLICATION_VERSION);
- ExternalConfiguration.setAppName(appName);
- ExternalConfiguration.setAppVersion(appVersion);
- String configHome = System.getProperty(Constants.CONFIG_HOME);
- ExternalConfiguration.setConfigDir(configHome);
+ ExternalConfiguration.setAppName(appName);
+ ExternalConfiguration.setAppVersion(appVersion);
+ String configHome = System.getProperty(Constants.CONFIG_HOME);
+ ExternalConfiguration.setConfigDir(configHome);
- String appConfigDir = configHome + File.separator + appName;
- // ChangeListener changeListener = new ChangeListener();
- ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(),
- appConfigDir);
+ String appConfigDir = configHome + File.separator + appName;
+ // ChangeListener changeListener = new ChangeListener();
+ ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(),
+ appConfigDir);
- context.getServletContext().setAttribute(Constants.CONFIGURATION_SOURCE_ATTR, configurationSource);
+ context.getServletContext().setAttribute(Constants.CONFIGURATION_SOURCE_ATTR, configurationSource);
- ExternalConfiguration.setConfigurationSource(configurationSource);
+ ExternalConfiguration.setConfigurationSource(configurationSource);
- ExternalConfiguration.listenForChanges();
+ ExternalConfiguration.listenForChanges();
- }
+ }
- public void contextDestroyed(ServletContextEvent context) {
+ public void contextDestroyed(ServletContextEvent context) {
- log.debug("ServletContextListener destroyed");
- ExternalConfiguration.stopListenForFileChanges();
- }
+ log.debug("ServletContextListener destroyed");
+ ExternalConfiguration.stopListenForFileChanges();
+ }
- private String setAndGetAttributeInContext(ServletContextEvent context, Map<String, String> manifestAttr,
- String attr) {
+ private String setAndGetAttributeInContext(ServletContextEvent context, Map<String, String> manifestAttr,
+ String attr) {
- String name = manifestAttr.get(attr);
- if (name != null) {
- context.getServletContext().setAttribute(attr, name);
- }
+ String name = manifestAttr.get(attr);
+ if (name != null) {
+ context.getServletContext().setAttribute(attr, name);
+ }
- return name;
- }
+ return name;
+ }
- public static Map<String, String> getManifestInfo(ServletContext application) {
+ public static Map<String, String> getManifestInfo(ServletContext application) {
- Map<String, String> result = new HashMap<>();
- InputStream inputStream = null;
- try {
+ Map<String, String> result = new HashMap<>();
+ InputStream inputStream = null;
+ try {
- inputStream = application.getResourceAsStream("/META-INF/MANIFEST.MF");
+ inputStream = application.getResourceAsStream("/META-INF/MANIFEST.MF");
- Manifest manifest = new Manifest(inputStream);
+ Manifest manifest = new Manifest(inputStream);
- Attributes attr = manifest.getMainAttributes();
- String name = attr.getValue("Implementation-Title");
- if (name != null) {
- result.put(Constants.APPLICATION_NAME, name);
- }
+ Attributes attr = manifest.getMainAttributes();
+ String name = attr.getValue("Implementation-Title");
+ if (name != null) {
+ result.put(Constants.APPLICATION_NAME, name);
+ }
- String version = attr.getValue("Implementation-Version");
- if (version != null) {
- result.put(Constants.APPLICATION_VERSION, version);
- }
+ String version = attr.getValue("Implementation-Version");
+ if (version != null) {
+ result.put(Constants.APPLICATION_VERSION, version);
+ }
- } catch (IOException e) {
+ } catch (IOException e) {
- } finally {
- if (inputStream != null) {
- try {
- inputStream.close();
- } catch (IOException e) {
- log.info("close FileOutputStream failed - {}" , e);
- }
- }
- }
+ } finally {
+ if (inputStream != null) {
+ try {
+ inputStream.close();
+ } catch (IOException e) {
+ log.info("close FileOutputStream failed - {}", e);
+ }
+ }
+ }
- return result;
+ return result;
- }
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/log/api/ILogConfiguration.java b/common-app-api/src/main/java/org/openecomp/sdc/common/log/api/ILogConfiguration.java
index 8347acb5d1..56fd7ad3a1 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/log/api/ILogConfiguration.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/log/api/ILogConfiguration.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/log/api/ILogFieldsHandler.java b/common-app-api/src/main/java/org/openecomp/sdc/common/log/api/ILogFieldsHandler.java
index 1af2a7f6f2..5b9728a6da 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/log/api/ILogFieldsHandler.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/log/api/ILogFieldsHandler.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/log/api/ILogger.java b/common-app-api/src/main/java/org/openecomp/sdc/common/log/api/ILogger.java
index bab372ebad..175e7ec016 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/log/api/ILogger.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/log/api/ILogger.java
@@ -7,9 +7,9 @@
* 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.
@@ -29,10 +29,16 @@ import java.util.List;
*/
public interface ILogger {
void log(LogLevel logLevel, String message);
- void log(LogLevel logLevel, String message, Object...params);
+
+ void log(LogLevel logLevel, String message, Object... params);
+
void log(LogLevel logLevel, String message, Throwable throwable);
+
List<String> getMandatoryFields();
+
ILogger clear();
+
ILogger startTimer();
+
ILogger setKeyRequestId(String keyRequestId);
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/log/elements/LogFieldsMdcHandler.java b/common-app-api/src/main/java/org/openecomp/sdc/common/log/elements/LogFieldsMdcHandler.java
index 531e5e0de1..9f7701bb49 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/log/elements/LogFieldsMdcHandler.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/log/elements/LogFieldsMdcHandler.java
@@ -7,9 +7,9 @@
* 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.
@@ -45,10 +45,10 @@ public class LogFieldsMdcHandler implements ILogFieldsHandler {
return instanceMdcWrapper;
}
- private final static String dateFormatPattern = "yyyy-MM-dd HH:mm:ss.SSSz";
- private final DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(dateFormatPattern);
+ private static final String DATE_FORMAT_PATTERN = "yyyy-MM-dd HH:mm:ss.SSSz";
+ private final DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(DATE_FORMAT_PATTERN);
protected static Logger log = LoggerFactory.getLogger(LogFieldsMdcHandler.class.getName());
- protected static String hostAddress;
+ static String hostAddress;
protected static String fqdn;
static {
@@ -261,52 +261,52 @@ public class LogFieldsMdcHandler implements ILogFieldsHandler {
}
@Override
- public void removePartnerName(){
+ public void removePartnerName() {
MDC.remove(ILogConfiguration.MDC_PARTNER_NAME);
}
@Override
- public void removeResponseCode(){
+ public void removeResponseCode() {
MDC.remove(ILogConfiguration.MDC_RESPONSE_CODE);
}
@Override
- public void removeResponseDesc(){
+ public void removeResponseDesc() {
MDC.remove(ILogConfiguration.MDC_RESPONSE_DESC);
}
@Override
- public void removeServiceInstanceId(){
+ public void removeServiceInstanceId() {
MDC.remove(ILogConfiguration.MDC_SERVICE_INSTANCE_ID);
}
@Override
- public void removeTargetEntity(){
+ public void removeTargetEntity() {
MDC.remove(ILogConfiguration.MDC_TARGET_ENTITY);
}
@Override
- public void removeTargetServiceName(){
+ public void removeTargetServiceName() {
MDC.remove(ILogConfiguration.MDC_TARGET_SERVICE_NAME);
}
@Override
- public void removeTargetVirtualEntity(){
+ public void removeTargetVirtualEntity() {
MDC.remove(ILogConfiguration.MDC_TARGET_VIRTUAL_ENTITY);
}
@Override
- public void removeErrorCode(){
+ public void removeErrorCode() {
MDC.remove(ILogConfiguration.MDC_ERROR_CODE);
}
@Override
- public void removeErrorCategory(){
+ public void removeErrorCategory() {
MDC.remove(ILogConfiguration.MDC_ERROR_CATEGORY);
}
@Override
- public void removeErrorDescription(){
+ public void removeErrorDescription() {
MDC.remove(ILogConfiguration.MDC_ERROR_DESC);
}
@@ -328,8 +328,8 @@ public class LogFieldsMdcHandler implements ILogFieldsHandler {
MDC.put(ILogConfiguration.MDC_ELAPSED_TIME, String.valueOf(timeDifference.toMillis()));
- } catch(Exception ex) {
- log.error("failed to calculate elapsed time",ex);
+ } catch (Exception ex) {
+ log.error("failed to calculate elapsed time", ex);
}
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/log/elements/LoggerAudit.java b/common-app-api/src/main/java/org/openecomp/sdc/common/log/elements/LoggerAudit.java
index 68a55773de..247bed2773 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/log/elements/LoggerAudit.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/log/elements/LoggerAudit.java
@@ -7,9 +7,9 @@
* 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.
@@ -37,6 +37,7 @@ import java.util.Collections;
import java.util.List;
public class LoggerAudit extends LoggerBase {
+ private static final int STATUS_MAJOR_PART_MASK = 100;
private static ArrayList<String> mandatoryFields = new ArrayList<>(Arrays.asList(
ILogConfiguration.MDC_AUDIT_BEGIN_TIMESTAMP,
ILogConfiguration.MDC_END_TIMESTAMP,
@@ -63,7 +64,7 @@ public class LoggerAudit extends LoggerBase {
ILogConfiguration.MDC_OPT_FIELD4));
LoggerAudit(ILogFieldsHandler ecompMdcWrapper, Logger logger) {
- super (ecompMdcWrapper, MarkerFactory.getMarker(LogMarkers.AUDIT_MARKER.text()), logger);
+ super(ecompMdcWrapper, MarkerFactory.getMarker(LogMarkers.AUDIT_MARKER.text()), logger);
//put the remote host and FQDN values from another thread if they are set
ecompMdcWrapper.setServerIPAddressInternally();
ecompMdcWrapper.setServerFQDNInternally();
@@ -140,7 +141,7 @@ public class LoggerAudit extends LoggerBase {
public LoggerAudit setStatusCode(String statusCode) {
// status code is either success (COMPLETE) or failure (ERROR) of the request.
- String respStatus = Integer.parseInt(statusCode) / 100 == 2 ? StatusCode.COMPLETE.getStatusCodeEnum() : StatusCode.ERROR.getStatusCodeEnum();
+ String respStatus = Integer.parseInt(statusCode) / STATUS_MAJOR_PART_MASK == 2 ? StatusCode.COMPLETE.getStatusCodeEnum() : StatusCode.ERROR.getStatusCodeEnum();
ecompLogFieldsHandler.setStatusCode(respStatus);
return this;
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/log/elements/LoggerBase.java b/common-app-api/src/main/java/org/openecomp/sdc/common/log/elements/LoggerBase.java
index ab5d2f5a6b..1c14d24da8 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/log/elements/LoggerBase.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/log/elements/LoggerBase.java
@@ -7,9 +7,9 @@
* 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.
@@ -43,8 +43,8 @@ import java.util.List;
public abstract class LoggerBase implements ILogger {
private final Logger myLogger;
private final Marker myMarker;
- protected final ILogFieldsHandler ecompLogFieldsHandler;
- private final static String missingLogFieldsMsg = "mandatory parameters for ECOMP logging, missing fields: %s, original message: %s";
+ final ILogFieldsHandler ecompLogFieldsHandler;
+ private static final String MISSING_LOG_FIELDS_MESSAGE = "mandatory parameters for ECOMP logging, missing fields: %s, original message: %s";
LoggerBase(ILogFieldsHandler ecompLogFieldsHandler, Marker marker, Logger logger) {
this.ecompLogFieldsHandler = ecompLogFieldsHandler;
@@ -53,18 +53,19 @@ public abstract class LoggerBase implements ILogger {
setKeyRequestIdIfNotSetYet();
}
- protected void setKeyRequestIdIfNotSetYet() {
+ void setKeyRequestIdIfNotSetYet() {
if (StringUtils.isEmpty(ecompLogFieldsHandler.getKeyRequestId())) {
setKeyRequestId(ThreadLocalsHolder.getUuid());
}
}
+
private void validateMandatoryFields(String originMsg) {
// this method only checks if the mandatory fields have been initialized
String filedNameThatHasNotBeenInitialized = checkMandatoryFieldsExistInMDC();
if (myLogger.isDebugEnabled() && !"".equalsIgnoreCase(filedNameThatHasNotBeenInitialized)) {
myLogger.debug(MarkerFactory.getMarker(LogMarkers.DEBUG_MARKER.text()),
- String.format(missingLogFieldsMsg, filedNameThatHasNotBeenInitialized, originMsg));
+ String.format(MISSING_LOG_FIELDS_MESSAGE, filedNameThatHasNotBeenInitialized, originMsg));
}
}
@@ -94,10 +95,10 @@ public abstract class LoggerBase implements ILogger {
}
@Override
- public void log(LogLevel logLevel, String message, Object...params) {
+ public void log(LogLevel logLevel, String message, Object... params) {
validateMandatoryFields(message);
- switch(logLevel) {
+ switch (logLevel) {
case ERROR:
case FATAL: //TODO check how to log "FATAL" word
myLogger.error(myMarker, message, params);
@@ -123,7 +124,7 @@ public abstract class LoggerBase implements ILogger {
public void log(LogLevel logLevel, String message, Throwable throwable) {
validateMandatoryFields(message);
- switch(logLevel) {
+ switch (logLevel) {
case ERROR:
case FATAL: //TODO check how to log "FATAL" word
myLogger.error(myMarker, createErrorMessage(message, throwable));
@@ -145,7 +146,7 @@ public abstract class LoggerBase implements ILogger {
}
}
- protected String createErrorMessage(String message, Throwable throwable) {
+ String createErrorMessage(String message, Throwable throwable) {
return String.format("%s: %s", message, throwable.getLocalizedMessage());
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/log/elements/LoggerDebug.java b/common-app-api/src/main/java/org/openecomp/sdc/common/log/elements/LoggerDebug.java
index b38228c57e..d7d48274c8 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/log/elements/LoggerDebug.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/log/elements/LoggerDebug.java
@@ -7,9 +7,9 @@
* 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.
@@ -46,19 +46,19 @@ public class LoggerDebug extends LoggerBase {
}
@Override
- public void log(LogLevel logLevel, String message, Object...params){
+ public void log(LogLevel logLevel, String message, Object... params) {
setKeyRequestIdIfNotSetYet();
super.log(logLevel, message, params);
}
@Override
- public void log(LogLevel logLevel, String message, Throwable throwable){
+ public void log(LogLevel logLevel, String message, Throwable throwable) {
setKeyRequestIdIfNotSetYet();
super.log(logLevel, message, throwable);
}
@Override
- public void log(LogLevel logLevel, String message){
+ public void log(LogLevel logLevel, String message) {
setKeyRequestIdIfNotSetYet();
super.log(logLevel, message);
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/log/elements/LoggerError.java b/common-app-api/src/main/java/org/openecomp/sdc/common/log/elements/LoggerError.java
index 6bc660b97d..835c5793ba 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/log/elements/LoggerError.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/log/elements/LoggerError.java
@@ -7,9 +7,9 @@
* 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.
@@ -75,7 +75,7 @@ public class LoggerError extends LoggerBase {
EcompLoggerErrorCode errorCodeEnum,
String serviceName,
String targetEntity,
- String message, Object...params) {
+ String message, Object... params) {
fillFieldsBeforeLogging(logLevel, errorCodeEnum, serviceName, targetEntity);
super.log(logLevel, message, params);
}
@@ -105,7 +105,7 @@ public class LoggerError extends LoggerBase {
public void log(LogLevel logLevel,
EcompLoggerErrorCode errorCodeEnum,
String serviceName,
- String message, Object...params) {
+ String message, Object... params) {
log(logLevel, errorCodeEnum, serviceName, null, message, params);
}
@@ -117,7 +117,7 @@ public class LoggerError extends LoggerBase {
}
@Override
- public void log(LogLevel logLevel, String message, Object...params) {
+ public void log(LogLevel logLevel, String message, Object... params) {
log(logLevel, EcompLoggerErrorCode.BUSINESS_PROCESS_ERROR, defaultServiceName, null, message, params);
}
@@ -134,7 +134,7 @@ public class LoggerError extends LoggerBase {
}
private LogLevel convertFromSeverityErrorLevel(EcompErrorConfiguration.EcompErrorSeverity severityLevel) {
- switch(severityLevel) {
+ switch (severityLevel) {
case INFO:
return LogLevel.INFO;
case FATAL:
@@ -143,8 +143,9 @@ public class LoggerError extends LoggerBase {
return LogLevel.ERROR;
case WARN:
return LogLevel.WARN;
+ default:
+ return LogLevel.ERROR;
}
- return LogLevel.ERROR;
}
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/log/elements/LoggerFactory.java b/common-app-api/src/main/java/org/openecomp/sdc/common/log/elements/LoggerFactory.java
index ce3b2fe8aa..41c76a3ebe 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/log/elements/LoggerFactory.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/log/elements/LoggerFactory.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/log/elements/LoggerMetric.java b/common-app-api/src/main/java/org/openecomp/sdc/common/log/elements/LoggerMetric.java
index c2df1c1ecf..f777244952 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/log/elements/LoggerMetric.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/log/elements/LoggerMetric.java
@@ -7,9 +7,9 @@
* 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.
@@ -32,7 +32,30 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import static org.openecomp.sdc.common.log.api.ILogConfiguration.*;
+import static org.openecomp.sdc.common.log.api.ILogConfiguration.MDC_ALERT_SEVERITY;
+import static org.openecomp.sdc.common.log.api.ILogConfiguration.MDC_CLASS_NAME;
+import static org.openecomp.sdc.common.log.api.ILogConfiguration.MDC_ELAPSED_TIME;
+import static org.openecomp.sdc.common.log.api.ILogConfiguration.MDC_END_TIMESTAMP;
+import static org.openecomp.sdc.common.log.api.ILogConfiguration.MDC_INSTANCE_UUID;
+import static org.openecomp.sdc.common.log.api.ILogConfiguration.MDC_KEY_REQUEST_ID;
+import static org.openecomp.sdc.common.log.api.ILogConfiguration.MDC_METRIC_BEGIN_TIMESTAMP;
+import static org.openecomp.sdc.common.log.api.ILogConfiguration.MDC_OPT_FIELD1;
+import static org.openecomp.sdc.common.log.api.ILogConfiguration.MDC_OPT_FIELD2;
+import static org.openecomp.sdc.common.log.api.ILogConfiguration.MDC_OPT_FIELD3;
+import static org.openecomp.sdc.common.log.api.ILogConfiguration.MDC_OPT_FIELD4;
+import static org.openecomp.sdc.common.log.api.ILogConfiguration.MDC_PARTNER_NAME;
+import static org.openecomp.sdc.common.log.api.ILogConfiguration.MDC_PROCESS_KEY;
+import static org.openecomp.sdc.common.log.api.ILogConfiguration.MDC_REMOTE_HOST;
+import static org.openecomp.sdc.common.log.api.ILogConfiguration.MDC_RESPONSE_CODE;
+import static org.openecomp.sdc.common.log.api.ILogConfiguration.MDC_RESPONSE_DESC;
+import static org.openecomp.sdc.common.log.api.ILogConfiguration.MDC_SERVER_FQDN;
+import static org.openecomp.sdc.common.log.api.ILogConfiguration.MDC_SERVER_IP_ADDRESS;
+import static org.openecomp.sdc.common.log.api.ILogConfiguration.MDC_SERVICE_INSTANCE_ID;
+import static org.openecomp.sdc.common.log.api.ILogConfiguration.MDC_SERVICE_NAME;
+import static org.openecomp.sdc.common.log.api.ILogConfiguration.MDC_STATUS_CODE;
+import static org.openecomp.sdc.common.log.api.ILogConfiguration.MDC_TARGET_ENTITY;
+import static org.openecomp.sdc.common.log.api.ILogConfiguration.MDC_TARGET_SERVICE_NAME;
+import static org.openecomp.sdc.common.log.api.ILogConfiguration.MDC_TARGET_VIRTUAL_ENTITY;
public class LoggerMetric extends LoggerBase {
@@ -76,7 +99,7 @@ public class LoggerMetric extends LoggerBase {
LogLevel logLevel,
Severity securityLevel,
String message) {
- log(statusInfo,className, logLevel, securityLevel, message);
+ log(statusInfo, className, logLevel, securityLevel, message);
}
@Override
@@ -226,6 +249,4 @@ public class LoggerMetric extends LoggerBase {
}
-
-
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/log/enums/EcompLoggerErrorCode.java b/common-app-api/src/main/java/org/openecomp/sdc/common/log/enums/EcompLoggerErrorCode.java
index 780b24d0e5..ce28ca0359 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/log/enums/EcompLoggerErrorCode.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/log/enums/EcompLoggerErrorCode.java
@@ -7,9 +7,9 @@
* 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.
@@ -35,6 +35,7 @@ public enum EcompLoggerErrorCode {
BUSINESS_PROCESS_ERROR(500),
UNKNOWN_ERROR(900);
+ private static final int ERROR_CODE_SUBSTRING = 3;
private int errorCode;
EcompLoggerErrorCode(int errorCode) {
@@ -47,7 +48,7 @@ public enum EcompLoggerErrorCode {
public static EcompLoggerErrorCode getByValue(String ecompErrorCode) {
String errorPrefix = parseCode(ecompErrorCode);
- Optional<EcompLoggerErrorCode> optionalCode = Arrays.stream(values()).filter(v->isCode(v, errorPrefix)).findFirst();
+ Optional<EcompLoggerErrorCode> optionalCode = Arrays.stream(values()).filter(v -> isCode(v, errorPrefix)).findFirst();
return optionalCode.orElse(UNKNOWN_ERROR);
}
@@ -57,7 +58,7 @@ public enum EcompLoggerErrorCode {
private static String parseCode(String errorCode) {
try {
- return errorCode.substring("E_".length(), 3);
+ return errorCode.substring("E_".length(), ERROR_CODE_SUBSTRING);
} catch (StringIndexOutOfBoundsException ex) {
return UNKNOWN_ERROR.name();
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/log/enums/LogLevel.java b/common-app-api/src/main/java/org/openecomp/sdc/common/log/enums/LogLevel.java
index 5b1ec9d4a9..b04477bc82 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/log/enums/LogLevel.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/log/enums/LogLevel.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/log/enums/LogMarkers.java b/common-app-api/src/main/java/org/openecomp/sdc/common/log/enums/LogMarkers.java
index 6feb8ed842..3e99b729dd 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/log/enums/LogMarkers.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/log/enums/LogMarkers.java
@@ -7,9 +7,9 @@
* 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.
@@ -32,11 +32,11 @@ public enum LogMarkers {
private String text;
- LogMarkers (String text){
+ LogMarkers(String text) {
this.text = text;
}
- public String text(){
+ public String text() {
return text;
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/log/enums/Severity.java b/common-app-api/src/main/java/org/openecomp/sdc/common/log/enums/Severity.java
index 15a6039f7f..9a5e8d92ab 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/log/enums/Severity.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/log/enums/Severity.java
@@ -7,9 +7,9 @@
* 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.
@@ -30,7 +30,7 @@ public enum Severity {
DOWN(3),
UNREACHABLE(4);
- int severityType;
+ private int severityType;
Severity(int serveryType) {
this.severityType = serveryType;
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/log/enums/StatusCode.java b/common-app-api/src/main/java/org/openecomp/sdc/common/log/enums/StatusCode.java
index d67c287e4c..6489916a4c 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/log/enums/StatusCode.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/log/enums/StatusCode.java
@@ -7,9 +7,9 @@
* 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.
@@ -24,11 +24,13 @@ public enum StatusCode {
ERROR("ERROR"),
COMPLETE("COMPLETE");
- String statusCode;
+ private String statusCode;
- StatusCode(String statusCode){this.statusCode = statusCode;}
+ StatusCode(String statusCode) {
+ this.statusCode = statusCode;
+ }
- public String getStatusCodeEnum(){
+ public String getStatusCodeEnum() {
return statusCode;
}
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/log/wrappers/Logger.java b/common-app-api/src/main/java/org/openecomp/sdc/common/log/wrappers/Logger.java
index f8a9faa241..8fbc44c46e 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/log/wrappers/Logger.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/log/wrappers/Logger.java
@@ -7,9 +7,9 @@
* 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.
@@ -73,12 +73,17 @@ public class Logger implements org.slf4j.Logger {
return logger.isTraceEnabled();
}
- public boolean isErrorEnabled() { return logger.isErrorEnabled(); }
+ public boolean isErrorEnabled() {
+ return logger.isErrorEnabled();
+ }
- public boolean isWarnEnabled() { return logger.isWarnEnabled(); }
+ public boolean isWarnEnabled() {
+ return logger.isWarnEnabled();
+ }
@Override
- @Deprecated /** Please use method {@link #warn(EcompLoggerErrorCode, String, String)} **/
+ @Deprecated
+ /** Please use method {@link #warn(EcompLoggerErrorCode, String, String)} **/
public void warn(String msg) {
if (isWarnEnabled()) {
error.log(LogLevel.WARN, msg);
@@ -86,7 +91,8 @@ public class Logger implements org.slf4j.Logger {
}
@Override
- @Deprecated /** Please use method {@link #warn(EcompLoggerErrorCode, String, String)} **/
+ @Deprecated
+ /** Please use method {@link #warn(EcompLoggerErrorCode, String, String)} **/
public void warn(String msg, Object o) {
if (isWarnEnabled()) {
@@ -94,7 +100,9 @@ public class Logger implements org.slf4j.Logger {
}
}
- public boolean isInfoEnabled() { return logger.isInfoEnabled(); }
+ public boolean isInfoEnabled() {
+ return logger.isInfoEnabled();
+ }
@Override
public void info(String msg) {
@@ -316,15 +324,17 @@ public class Logger implements org.slf4j.Logger {
}
}
- @Deprecated /** Please use method {@link #warn(EcompLoggerErrorCode, String, String)} **/
- public void warn(String msg, Object... params){
+ @Deprecated
+ /** Please use method {@link #warn(EcompLoggerErrorCode, String, String)} **/
+ public void warn(String msg, Object... params) {
if (isWarnEnabled()) {
error.log(LogLevel.WARN, msg, params);
}
}
@Override
- @Deprecated /** Please use method {@link #warn(EcompLoggerErrorCode, String, String)} **/
+ @Deprecated
+ /** Please use method {@link #warn(EcompLoggerErrorCode, String, String)} **/
public void warn(String msg, Object o, Object o1) {
if (isWarnEnabled()) {
error.log(LogLevel.WARN, msg, o, o1);
@@ -332,7 +342,8 @@ public class Logger implements org.slf4j.Logger {
}
@Override
- @Deprecated /** Please use method {@link #warn(EcompLoggerErrorCode, String, String)} **/
+ @Deprecated
+ /** Please use method {@link #warn(EcompLoggerErrorCode, String, String)} **/
public void warn(String msg, Throwable throwable) {
if (isWarnEnabled()) {
error.log(LogLevel.WARN, msg, throwable);
@@ -345,7 +356,8 @@ public class Logger implements org.slf4j.Logger {
}
@Override
- @Deprecated /** Please use method {@link #warn(EcompLoggerErrorCode, String, String)} **/
+ @Deprecated
+ /** Please use method {@link #warn(EcompLoggerErrorCode, String, String)} **/
public void warn(Marker marker, String msg) {
if (isWarnEnabled()) {
error.log(LogLevel.WARN, msg);
@@ -353,7 +365,8 @@ public class Logger implements org.slf4j.Logger {
}
@Override
- @Deprecated /** Please use method {@link #warn(EcompLoggerErrorCode, String, String)} **/
+ @Deprecated
+ /** Please use method {@link #warn(EcompLoggerErrorCode, String, String)} **/
public void warn(Marker marker, String msg, Object o) {
if (isWarnEnabled()) {
error.log(LogLevel.WARN, msg, o);
@@ -361,7 +374,8 @@ public class Logger implements org.slf4j.Logger {
}
@Override
- @Deprecated /** Please use method {@link #warn(EcompLoggerErrorCode, String, String)} **/
+ @Deprecated
+ /** Please use method {@link #warn(EcompLoggerErrorCode, String, String)} **/
public void warn(Marker marker, String msg, Object o, Object o1) {
if (isWarnEnabled()) {
error.log(LogLevel.WARN, msg, o, o1);
@@ -369,7 +383,8 @@ public class Logger implements org.slf4j.Logger {
}
@Override
- @Deprecated /** Please use method {@link #warn(EcompLoggerErrorCode, String, String)} **/
+ @Deprecated
+ /** Please use method {@link #warn(EcompLoggerErrorCode, String, String)} **/
public void warn(Marker marker, String msg, Object... objects) {
if (isWarnEnabled()) {
error.log(LogLevel.WARN, msg, objects);
@@ -377,22 +392,25 @@ public class Logger implements org.slf4j.Logger {
}
@Override
- @Deprecated /** Please use method {@link #warn(EcompLoggerErrorCode, String, String)} **/
+ @Deprecated
+ /** Please use method {@link #warn(EcompLoggerErrorCode, String, String)} **/
public void warn(Marker marker, String msg, Throwable throwable) {
if (isWarnEnabled()) {
error.log(LogLevel.WARN, msg, throwable);
}
}
- @Deprecated /** Please use method {@link #error(EcompLoggerErrorCode, String, String)} **/
- public void error(String msg, Object... params){
+ @Deprecated
+ /** Please use method {@link #error(EcompLoggerErrorCode, String, String)} **/
+ public void error(String msg, Object... params) {
if (isErrorEnabled()) {
error.log(LogLevel.ERROR, msg, params);
}
}
@Override
- @Deprecated /** Please use method {@link #error(EcompLoggerErrorCode, String, String)} **/
+ @Deprecated
+ /** Please use method {@link #error(EcompLoggerErrorCode, String, String)} **/
public void error(String msg, Throwable throwable) {
if (isErrorEnabled()) {
error.log(LogLevel.ERROR, msg, throwable);
@@ -405,7 +423,8 @@ public class Logger implements org.slf4j.Logger {
}
@Override
- @Deprecated /** Please use method {@link #error(EcompLoggerErrorCode, String, String)} **/
+ @Deprecated
+ /** Please use method {@link #error(EcompLoggerErrorCode, String, String)} **/
public void error(Marker marker, String msg) {
if (isErrorEnabled()) {
error.log(LogLevel.ERROR, msg);
@@ -413,7 +432,8 @@ public class Logger implements org.slf4j.Logger {
}
@Override
- @Deprecated /** Please use method {@link #error(EcompLoggerErrorCode, String, String)} **/
+ @Deprecated
+ /** Please use method {@link #error(EcompLoggerErrorCode, String, String)} **/
public void error(Marker marker, String msg, Object o) {
if (isErrorEnabled()) {
error.log(LogLevel.ERROR, msg, o);
@@ -421,7 +441,8 @@ public class Logger implements org.slf4j.Logger {
}
@Override
- @Deprecated /** Please use method {@link #error(EcompLoggerErrorCode, String, String)} **/
+ @Deprecated
+ /** Please use method {@link #error(EcompLoggerErrorCode, String, String)} **/
public void error(Marker marker, String msg, Object o, Object o1) {
if (isErrorEnabled()) {
error.log(LogLevel.ERROR, msg, o, o1);
@@ -429,7 +450,8 @@ public class Logger implements org.slf4j.Logger {
}
@Override
- @Deprecated /** Please use method {@link #error(EcompLoggerErrorCode, String, String)} **/
+ @Deprecated
+ /** Please use method {@link #error(EcompLoggerErrorCode, String, String)} **/
public void error(Marker marker, String msg, Object... params) {
if (isErrorEnabled()) {
error.log(LogLevel.ERROR, msg, params);
@@ -437,22 +459,25 @@ public class Logger implements org.slf4j.Logger {
}
@Override
- @Deprecated /** Please use method {@link #error(EcompLoggerErrorCode, String, String)} **/
+ @Deprecated
+ /** Please use method {@link #error(EcompLoggerErrorCode, String, String)} **/
public void error(Marker marker, String msg, Throwable throwable) {
if (isErrorEnabled()) {
error.log(LogLevel.ERROR, msg, throwable);
}
}
- @Deprecated /** Please use method {@link #error(EcompLoggerErrorCode, String, String)} **/
- public void error(String msg){
+ @Deprecated
+ /** Please use method {@link #error(EcompLoggerErrorCode, String, String)} **/
+ public void error(String msg) {
if (isErrorEnabled()) {
error.log(LogLevel.ERROR, msg);
}
}
@Override
- @Deprecated /** Please use method {@link #error(EcompLoggerErrorCode, String, String)} **/
+ @Deprecated
+ /** Please use method {@link #error(EcompLoggerErrorCode, String, String)} **/
public void error(String msg, Object o) {
if (isErrorEnabled()) {
error.log(LogLevel.ERROR, msg, o);
@@ -460,7 +485,8 @@ public class Logger implements org.slf4j.Logger {
}
@Override
- @Deprecated /** Please use method {@link #error(EcompLoggerErrorCode, String, String)} **/
+ @Deprecated
+ /** Please use method {@link #error(EcompLoggerErrorCode, String, String)} **/
public void error(String msg, Object o, Object o1) {
if (isErrorEnabled()) {
error.log(LogLevel.ERROR, msg, o, o1);
@@ -469,17 +495,18 @@ public class Logger implements org.slf4j.Logger {
/**
* Writes out ERROR logging level message to the application error log
- * @param errorLevel code representing the error severity level
- * @param serviceName name of the API invoked at the logging component
- * @param targetEntity name of the ECOMP component or sub-component, or external entity at which the error occurred or null
+ *
+ * @param errorLevel code representing the error severity level
+ * @param serviceName name of the API invoked at the logging component
+ * @param targetEntity name of the ECOMP component or sub-component, or external entity at which the error occurred or null
* @param errorDescription a human readable description of the error condition
- * @param params optional parameters of a given error description
+ * @param params optional parameters of a given error description
*/
public void error(EcompErrorConfiguration.EcompErrorSeverity errorLevel,
EcompLoggerErrorCode errorCodeEnum,
String serviceName,
String targetEntity,
- String errorDescription, Object...params) {
+ String errorDescription, Object... params) {
if (isErrorEnabled()) {
error.log(errorLevel, errorCodeEnum, serviceName, targetEntity, errorDescription, params);
}
@@ -487,16 +514,17 @@ public class Logger implements org.slf4j.Logger {
/**
* Writes out ERROR logging level message to the application error log
- * @param errorCodeEnum code representing the error condition
- * @param serviceName name of the API invoked at the logging component
- * @param targetEntity name of the ECOMP component or sub-component, or external entity at which the error occurred or null
+ *
+ * @param errorCodeEnum code representing the error condition
+ * @param serviceName name of the API invoked at the logging component
+ * @param targetEntity name of the ECOMP component or sub-component, or external entity at which the error occurred or null
* @param errorDescription a human readable description of the error condition
- * @param params optional parameters of a given error description
+ * @param params optional parameters of a given error description
*/
public void error(EcompLoggerErrorCode errorCodeEnum,
String serviceName,
String targetEntity,
- String errorDescription, Object...params) {
+ String errorDescription, Object... params) {
if (isErrorEnabled()) {
error.log(LogLevel.ERROR, errorCodeEnum, serviceName, targetEntity, errorDescription, params);
}
@@ -504,16 +532,17 @@ public class Logger implements org.slf4j.Logger {
/**
* Writes out WARN logging level message to the application error log
- * @param errorCodeEnum code representing the error condition
- * @param serviceName name of the API invoked at the logging component
- * @param targetEntity name of the ECOMP component or sub-component, or external entity at which the error occurred or null
+ *
+ * @param errorCodeEnum code representing the error condition
+ * @param serviceName name of the API invoked at the logging component
+ * @param targetEntity name of the ECOMP component or sub-component, or external entity at which the error occurred or null
* @param errorDescription a human readable description of the error condition
- * @param params optional parameters of a given error description
+ * @param params optional parameters of a given error description
*/
public void warn(EcompLoggerErrorCode errorCodeEnum,
- String serviceName,
- String targetEntity,
- String errorDescription, Object...params) {
+ String serviceName,
+ String targetEntity,
+ String errorDescription, Object... params) {
if (isWarnEnabled()) {
error.log(LogLevel.WARN, errorCodeEnum, serviceName, targetEntity, errorDescription, params);
}
@@ -521,26 +550,22 @@ public class Logger implements org.slf4j.Logger {
/**
* Writes out FATAL logging level message to the application error log
- * @param errorCodeEnum code representing the error condition
- * @param serviceName name of the API invoked at the logging component
- * @param targetEntity name of the ECOMP component or sub-component, or external entity at which the error occurred or null
+ *
+ * @param errorCodeEnum code representing the error condition
+ * @param serviceName name of the API invoked at the logging component
+ * @param targetEntity name of the ECOMP component or sub-component, or external entity at which the error occurred or null
* @param errorDescription a human readable description of the error condition
- * @param params optional parameters of a given error description
+ * @param params optional parameters of a given error description
*/
public void fatal(EcompLoggerErrorCode errorCodeEnum,
String serviceName,
String targetEntity,
- String errorDescription, Object...params) {
+ String errorDescription, Object... params) {
if (isErrorEnabled()) {
error.log(LogLevel.FATAL, errorCodeEnum, serviceName, targetEntity, errorDescription, params);
}
}
-
-
-
-
-
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/log/wrappers/LoggerSdcAudit.java b/common-app-api/src/main/java/org/openecomp/sdc/common/log/wrappers/LoggerSdcAudit.java
index 210b4a398d..aac4e2b1c8 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/log/wrappers/LoggerSdcAudit.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/log/wrappers/LoggerSdcAudit.java
@@ -7,9 +7,9 @@
* 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.
@@ -35,13 +35,13 @@ import javax.ws.rs.core.Response;
/**
* Created by dd4296 on 12/19/2017.
- *
+ * <p>
* audit log for asdc using the log library
* this is adapted for filter classes
*/
public class LoggerSdcAudit extends LoggerSdcUtilBase {
- private static String AUDIT_ON = "auditOn";
+ private static final String AUDIT_ON = "auditOn";
private String className;
private final LoggerAudit ecompLoggerAudit;
@@ -68,7 +68,7 @@ public class LoggerSdcAudit extends LoggerSdcUtilBase {
}
//this function clears the MDC data that relevant for this class
- public void clearMyData(){
+ public void clearMyData() {
ecompLoggerAudit.clear();
}
@@ -81,8 +81,8 @@ public class LoggerSdcAudit extends LoggerSdcUtilBase {
try {
- String msg = ecompLoggerAudit.getAuditMessage() == null ?
- message : ecompLoggerAudit.getAuditMessage();
+ String msg = ecompLoggerAudit.getAuditMessage() == null
+ ? message : ecompLoggerAudit.getAuditMessage();
ecompLoggerAudit.stopTimer()
.setRemoteHost(remoteAddress)
.setResponseCode(convertHttpCodeToErrorCode(statusInfo.getStatusCode()))
@@ -95,12 +95,10 @@ public class LoggerSdcAudit extends LoggerSdcUtilBase {
.setOptCustomField1(requestContext.getMethod() + ": " + getUrl(requestContext))
.setOptCustomField2(Integer.toString(statusInfo.getStatusCode()))
.log(logLevel, msg);
- }
- catch (Exception e) {
+ } catch (Exception e) {
log.warn("Failed to write to Audit Log. Original Message: {}", message, e);
- }
- finally {
- MDC.put(AUDIT_ON,"false");
+ } finally {
+ MDC.put(AUDIT_ON, "false");
}
}
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/log/wrappers/LoggerSdcUtilBase.java b/common-app-api/src/main/java/org/openecomp/sdc/common/log/wrappers/LoggerSdcUtilBase.java
index 996caa3aa6..86d43235c0 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/log/wrappers/LoggerSdcUtilBase.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/log/wrappers/LoggerSdcUtilBase.java
@@ -7,9 +7,9 @@
* 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.
@@ -29,27 +29,43 @@ import javax.ws.rs.container.ContainerRequestContext;
import java.util.List;
import java.util.StringTokenizer;
-import static java.net.HttpURLConnection.*;
+import static java.net.HttpURLConnection.HTTP_BAD_METHOD;
+import static java.net.HttpURLConnection.HTTP_BAD_REQUEST;
+import static java.net.HttpURLConnection.HTTP_CLIENT_TIMEOUT;
+import static java.net.HttpURLConnection.HTTP_CONFLICT;
+import static java.net.HttpURLConnection.HTTP_ENTITY_TOO_LARGE;
+import static java.net.HttpURLConnection.HTTP_FORBIDDEN;
+import static java.net.HttpURLConnection.HTTP_GONE;
+import static java.net.HttpURLConnection.HTTP_LENGTH_REQUIRED;
+import static java.net.HttpURLConnection.HTTP_NOT_ACCEPTABLE;
+import static java.net.HttpURLConnection.HTTP_NOT_FOUND;
+import static java.net.HttpURLConnection.HTTP_PAYMENT_REQUIRED;
+import static java.net.HttpURLConnection.HTTP_PRECON_FAILED;
+import static java.net.HttpURLConnection.HTTP_PROXY_AUTH;
+import static java.net.HttpURLConnection.HTTP_REQ_TOO_LONG;
+import static java.net.HttpURLConnection.HTTP_UNAUTHORIZED;
+import static java.net.HttpURLConnection.HTTP_UNSUPPORTED_TYPE;
/**
* Created by dd4296 on 12/20/2017.
- *
+ * <p>
* base class for metric and audit log logging
* holding the specific logic for data extraction
*/
public class LoggerSdcUtilBase {
+ private static final int SUCCESS_ERROR_CODE_LIMIT = 399;
+ private static final int BUSINESS_PROCESS_ERROR_BOUNDRY = 499;
protected static Logger log = LoggerFactory.getLogger(LoggerSdcUtilBase.class.getName());
String getRequestIDfromHeaders(List<Object> requestHeader) {
// this method gets list of type object.
// toString method returns the RequestId with brackets.
String requestHeaderString = requestHeader.toString();
- return requestHeaderString.replace("[","").replace("]","");
+ return requestHeaderString.replace("[", "").replace("]", "");
}
-
// this method translates http error code to ECOMP Logger Error code
// this is a naive translation and is not a result of any documented format ECOMP specification
protected EcompLoggerErrorCode convertHttpCodeToErrorCode(int httpResponseCode) {
@@ -98,9 +114,10 @@ public class LoggerSdcUtilBase {
case HTTP_BAD_METHOD:
case HTTP_PROXY_AUTH:
return true;
- }
- return false;
+ default:
+ return false;
+ }
}
private boolean isDataError(int httpResponseCode) {
@@ -113,9 +130,10 @@ public class LoggerSdcUtilBase {
case HTTP_ENTITY_TOO_LARGE:
case HTTP_UNSUPPORTED_TYPE:
return true;
- }
- return false;
+ default:
+ return false;
+ }
}
private boolean isSchemaError(int httpResponseCode) {
@@ -123,11 +141,11 @@ public class LoggerSdcUtilBase {
}
private boolean isSuccessError(int httpResponseCode) {
- return httpResponseCode < 399;
+ return httpResponseCode < SUCCESS_ERROR_CODE_LIMIT;
}
private boolean isBusinessProcessError(int httpResponseCode) {
- return httpResponseCode > 499;
+ return httpResponseCode > BUSINESS_PROCESS_ERROR_BOUNDRY;
}
protected String getPartnerName(String userAgent, String userId, String url) {
@@ -138,13 +156,15 @@ public class LoggerSdcUtilBase {
String urlUser = getUserIdFromUrl(url);
- if (!StringUtils.isEmpty(urlUser))
+ if (!StringUtils.isEmpty(urlUser)) {
return urlUser;
+ }
String userAgentName = getUserIdFromUserAgent(userAgent);
- if (!StringUtils.isEmpty(userAgentName))
+ if (!StringUtils.isEmpty(userAgentName)) {
return userAgentName;
+ }
return "";
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/monitoring/MonitoringEvent.java b/common-app-api/src/main/java/org/openecomp/sdc/common/monitoring/MonitoringEvent.java
index 8d96dbd61c..257d5a434b 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/monitoring/MonitoringEvent.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/monitoring/MonitoringEvent.java
@@ -7,9 +7,9 @@
* 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.
@@ -24,101 +24,101 @@ import org.openecomp.sdc.common.datastructure.ESTimeBasedEvent;
public class MonitoringEvent extends ESTimeBasedEvent {
- private static String MONITORING_EVENT_TEMPLATE = "hostid=\"%s\" hostcpu=\"%s\" hostmem=\"%s\" hostdisk=\"%s\" " + "jvmid=\"%s\" jvmcpu=\"%s\" jvmmem=\"%s\" jvmtnum=\"%s\" " + "appid=\"%s\" appstat=\"%s\"";
-
- private String hostid;
- private Long hostcpu;
- private Double hostmem;
- private String hostdisk;
- private String jvmid;
- private Long jvmcpu;
- private Long jvmmem;
- private Integer jvmtnum;
- private String appid;
- private String appstat;
-
- public String getHostid() {
- return hostid;
- }
-
- public void setHostid(String hostid) {
- this.hostid = hostid;
- }
-
- public Long getHostcpu() {
- return hostcpu;
- }
-
- public void setHostcpu(Long hostcpu) {
- this.hostcpu = hostcpu;
- }
-
- public Double getHostmem() {
- return hostmem;
- }
-
- public void setHostmem(Double hostmem) {
- this.hostmem = hostmem;
- }
-
- public String getHostdisk() {
- return hostdisk;
- }
-
- public void setHostdisk(String hostdisk) {
- this.hostdisk = hostdisk;
- }
-
- public String getJvmid() {
- return jvmid;
- }
-
- public void setJvmid(String jvmid) {
- this.jvmid = jvmid;
- }
-
- public Long getJvmcpu() {
- return jvmcpu;
- }
-
- public void setJvmcpu(Long jvmcpu) {
- this.jvmcpu = jvmcpu;
- }
-
- public Long getJvmmem() {
- return jvmmem;
- }
-
- public void setJvmmem(Long jvmmem) {
- this.jvmmem = jvmmem;
- }
-
- public Integer getJvmtnum() {
- return jvmtnum;
- }
-
- public void setJvmtnum(Integer jvmtnum) {
- this.jvmtnum = jvmtnum;
- }
-
- public String getAppid() {
- return appid;
- }
-
- public void setAppid(String appid) {
- this.appid = appid;
- }
-
- public String getAppstat() {
- return appstat;
- }
-
- public void setAppstat(String appstat) {
- this.appstat = appstat;
- }
-
- @Override
- public String toString() {
- return getFormattedString(MONITORING_EVENT_TEMPLATE, hostid, hostcpu, hostmem, hostdisk, jvmid, jvmcpu, jvmmem, jvmtnum, appid, appstat);
- }
+ private static final String MONITORING_EVENT_TEMPLATE = "hostid=\"%s\" hostcpu=\"%s\" hostmem=\"%s\" hostdisk=\"%s\" " + "jvmid=\"%s\" jvmcpu=\"%s\" jvmmem=\"%s\" jvmtnum=\"%s\" " + "appid=\"%s\" appstat=\"%s\"";
+
+ private String hostid;
+ private Long hostcpu;
+ private Double hostmem;
+ private String hostdisk;
+ private String jvmid;
+ private Long jvmcpu;
+ private Long jvmmem;
+ private Integer jvmtnum;
+ private String appid;
+ private String appstat;
+
+ public String getHostid() {
+ return hostid;
+ }
+
+ public void setHostid(String hostid) {
+ this.hostid = hostid;
+ }
+
+ public Long getHostcpu() {
+ return hostcpu;
+ }
+
+ public void setHostcpu(Long hostcpu) {
+ this.hostcpu = hostcpu;
+ }
+
+ public Double getHostmem() {
+ return hostmem;
+ }
+
+ public void setHostmem(Double hostmem) {
+ this.hostmem = hostmem;
+ }
+
+ public String getHostdisk() {
+ return hostdisk;
+ }
+
+ public void setHostdisk(String hostdisk) {
+ this.hostdisk = hostdisk;
+ }
+
+ public String getJvmid() {
+ return jvmid;
+ }
+
+ public void setJvmid(String jvmid) {
+ this.jvmid = jvmid;
+ }
+
+ public Long getJvmcpu() {
+ return jvmcpu;
+ }
+
+ public void setJvmcpu(Long jvmcpu) {
+ this.jvmcpu = jvmcpu;
+ }
+
+ public Long getJvmmem() {
+ return jvmmem;
+ }
+
+ public void setJvmmem(Long jvmmem) {
+ this.jvmmem = jvmmem;
+ }
+
+ public Integer getJvmtnum() {
+ return jvmtnum;
+ }
+
+ public void setJvmtnum(Integer jvmtnum) {
+ this.jvmtnum = jvmtnum;
+ }
+
+ public String getAppid() {
+ return appid;
+ }
+
+ public void setAppid(String appid) {
+ this.appid = appid;
+ }
+
+ public String getAppstat() {
+ return appstat;
+ }
+
+ public void setAppstat(String appstat) {
+ this.appstat = appstat;
+ }
+
+ @Override
+ public String toString() {
+ return getFormattedString(MONITORING_EVENT_TEMPLATE, hostid, hostcpu, hostmem, hostdisk, jvmid, jvmcpu, jvmmem, jvmtnum, appid, appstat);
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/monitoring/MonitoringMetricsFetcher.java b/common-app-api/src/main/java/org/openecomp/sdc/common/monitoring/MonitoringMetricsFetcher.java
index ea92156ce1..b5760bb521 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/monitoring/MonitoringMetricsFetcher.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/monitoring/MonitoringMetricsFetcher.java
@@ -7,9 +7,9 @@
* 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.
@@ -37,174 +37,175 @@ import java.util.Map;
public class MonitoringMetricsFetcher {
- private static Logger monitoringLogger = LoggerFactory.getLogger("asdc.fe.monitoring.fetcher");
-
- private static volatile MonitoringMetricsFetcher instance;
- private static RuntimeMXBean runtimeMXBean;
- private static ThreadMXBean threadMXBean;
- private static MemoryMXBean memoryMXBean;
- private static MBeanServer platformMBeanServer;
- private static Sigar sigarSession;
-
- private static String appName;
- private static String jvmName = "Unknown";
- private final String PROCESS_CPU_TIME_ATTR = "ProcessCpuTime";
-
- private static String FE_JVM_NAME = "jetty-fe";
- private static String BE_JVM_NAME = "jetty-be";
-
- private MonitoringMetricsFetcher() {
- };
-
- public static MonitoringMetricsFetcher getInstance() {
- if (instance == null) {
- instance = init();
- }
- return instance;
- }
-
- public MonitoringEvent getMonitoringMetrics() {
- MonitoringEvent monitoringEvent = new MonitoringEvent();
- monitoringEvent.setHostid(getFQDN());
- monitoringEvent.setHostcpu(getHostCpuTime());
- monitoringEvent.setHostmem(getHostUsedMemory());
- monitoringEvent.setHostdisk(getHostUsedDisk().toString());
-
- monitoringEvent.setJvmid(jvmName);
-
- monitoringEvent.setJvmcpu(getJvmCpuTime());
- monitoringEvent.setJvmmem(getJvmUsedHeapMemory());
- monitoringEvent.setJvmtnum(getJvmThreads());
-
- monitoringEvent.setAppid(appName);
- // this is probably from healthcheck
- monitoringEvent.setAppstat("appStatus");
- return monitoringEvent;
- }
-
- private static synchronized MonitoringMetricsFetcher init() {
- if (instance == null) {
- instance = new MonitoringMetricsFetcher();
- threadMXBean = ManagementFactory.getThreadMXBean();
- memoryMXBean = ManagementFactory.getMemoryMXBean();
- runtimeMXBean = ManagementFactory.getRuntimeMXBean();
- platformMBeanServer = ManagementFactory.getPlatformMBeanServer();
- sigarSession = new Sigar();
- appName = ExternalConfiguration.getAppName();
- monitoringLogger.debug("appName is {}", appName);
- // Accoridng to Yaki, there is no "calculated" jvmName like it was
- // in TAS,
- // just "jetty-be" or "jetty-fe"
- if (appName.contains("fe")) {
- jvmName = FE_JVM_NAME;
- } else if (appName.contains("be")) {
- jvmName = BE_JVM_NAME;
- } else {
- monitoringLogger
- .warn("Couldn't determine jvmName, appName is expected to contain \"be\" or \"fe\" string");
- }
- }
- return instance;
- }
-
- /**
- * Returns the number of live threads for this JVM
- *
- * @return number of live threads
- */
- private Integer getJvmThreads() {
- return threadMXBean.getThreadCount();
- }
-
- /**
- * Returns the number of used heap memory (bytes)
- *
- * @return the number of used heap memory (bytes)
- */
- private long getJvmUsedHeapMemory() {
- return memoryMXBean.getHeapMemoryUsage().getUsed();
- }
-
- /**
- * Returns the jvm cpu time (msec)
- *
- * @return the jvm cpu time (msec)
- */
- private long getJvmCpuTime() {
-
- long cpuTime = -1;
- try {
- cpuTime = (long) platformMBeanServer.getAttribute(
- new ObjectName(ManagementFactory.OPERATING_SYSTEM_MXBEAN_NAME), PROCESS_CPU_TIME_ATTR);
- } catch (Exception e) {
- monitoringLogger.error("Couldn't measure JVM CPU time, error: {}", e);
- }
- return cpuTime;
- }
-
- /**
- * Returns the host total cpu time (msec)
- *
- * @return the host total cpu time (msec)
- */
- private long getHostCpuTime() {
- long cpuTime = -1;
- try {
- cpuTime = sigarSession.getCpu().getTotal();
- } catch (Exception e) {
- monitoringLogger.error("Couldn't measure host CPU time, error: {}", e);
- }
- return cpuTime;
- }
-
- /**
- * Returns the host used memory(msec)
- *
- * @return the host used memory(msec)
- */
- private Double getHostUsedMemory() {
- Double memory = -1.0;
- try {
- memory = sigarSession.getMem().getUsedPercent();
- } catch (Exception e) {
- monitoringLogger.error("Couldn't measure host used memory, error: {}", e);
- }
- return memory;
- }
-
- /**
- * Returns the percentage of all available FS
- *
- * @return the host avail disk(bytes)
- */
- private Map<String, Double> getHostUsedDisk() {
- Map<String, Double> res = new HashMap<>();
- try {
- FileSystem[] fileSystemList = sigarSession.getFileSystemList();
- for (FileSystem fileSystem : fileSystemList) {
-
- String dirName = fileSystem.getDirName();
- double usePercent = sigarSession.getFileSystemUsage(dirName).getUsePercent() * 100;
- res.put(dirName, usePercent);
- }
- } catch (Exception e) {
- monitoringLogger.error("Couldn't measure host used disk, error: {}", e);
- }
- return res;
- }
-
- /**
- * Returns the FQDN
- *
- * @return the FQDN
- */
- private String getFQDN() {
- String fqdn = "";
- try {
- fqdn = sigarSession.getFQDN();
- } catch (Exception e) {
- monitoringLogger.error("Couldn't get FQDN, error: {}", e);
- }
- return fqdn;
- }
+ private static final int TO_PERCENT_MULTIPLIER = 100;
+ private static Logger monitoringLogger = LoggerFactory.getLogger("asdc.fe.monitoring.fetcher");
+
+ private static volatile MonitoringMetricsFetcher instance;
+ private static RuntimeMXBean runtimeMXBean;
+ private static ThreadMXBean threadMXBean;
+ private static MemoryMXBean memoryMXBean;
+ private static MBeanServer platformMBeanServer;
+ private static Sigar sigarSession;
+
+ private static String appName;
+ private static String jvmName = "Unknown";
+ private static final String PROCESS_CPU_TIME_ATTR = "ProcessCpuTime";
+
+ private static final String FE_JVM_NAME = "jetty-fe";
+ private static final String BE_JVM_NAME = "jetty-be";
+
+ private MonitoringMetricsFetcher() {
+ }
+
+ public static MonitoringMetricsFetcher getInstance() {
+ if (instance == null) {
+ instance = init();
+ }
+ return instance;
+ }
+
+ public MonitoringEvent getMonitoringMetrics() {
+ MonitoringEvent monitoringEvent = new MonitoringEvent();
+ monitoringEvent.setHostid(getFQDN());
+ monitoringEvent.setHostcpu(getHostCpuTime());
+ monitoringEvent.setHostmem(getHostUsedMemory());
+ monitoringEvent.setHostdisk(getHostUsedDisk().toString());
+
+ monitoringEvent.setJvmid(jvmName);
+
+ monitoringEvent.setJvmcpu(getJvmCpuTime());
+ monitoringEvent.setJvmmem(getJvmUsedHeapMemory());
+ monitoringEvent.setJvmtnum(getJvmThreads());
+
+ monitoringEvent.setAppid(appName);
+ // this is probably from healthcheck
+ monitoringEvent.setAppstat("appStatus");
+ return monitoringEvent;
+ }
+
+ private static synchronized MonitoringMetricsFetcher init() {
+ if (instance == null) {
+ instance = new MonitoringMetricsFetcher();
+ threadMXBean = ManagementFactory.getThreadMXBean();
+ memoryMXBean = ManagementFactory.getMemoryMXBean();
+ runtimeMXBean = ManagementFactory.getRuntimeMXBean();
+ platformMBeanServer = ManagementFactory.getPlatformMBeanServer();
+ sigarSession = new Sigar();
+ appName = ExternalConfiguration.getAppName();
+ monitoringLogger.debug("appName is {}", appName);
+ // Accoridng to Yaki, there is no "calculated" jvmName like it was
+ // in TAS,
+ // just "jetty-be" or "jetty-fe"
+ if (appName.contains("fe")) {
+ jvmName = FE_JVM_NAME;
+ } else if (appName.contains("be")) {
+ jvmName = BE_JVM_NAME;
+ } else {
+ monitoringLogger
+ .warn("Couldn't determine jvmName, appName is expected to contain \"be\" or \"fe\" string");
+ }
+ }
+ return instance;
+ }
+
+ /**
+ * Returns the number of live threads for this JVM
+ *
+ * @return number of live threads
+ */
+ private Integer getJvmThreads() {
+ return threadMXBean.getThreadCount();
+ }
+
+ /**
+ * Returns the number of used heap memory (bytes)
+ *
+ * @return the number of used heap memory (bytes)
+ */
+ private long getJvmUsedHeapMemory() {
+ return memoryMXBean.getHeapMemoryUsage().getUsed();
+ }
+
+ /**
+ * Returns the jvm cpu time (msec)
+ *
+ * @return the jvm cpu time (msec)
+ */
+ private long getJvmCpuTime() {
+
+ long cpuTime = -1;
+ try {
+ cpuTime = (long) platformMBeanServer.getAttribute(
+ new ObjectName(ManagementFactory.OPERATING_SYSTEM_MXBEAN_NAME), PROCESS_CPU_TIME_ATTR);
+ } catch (Exception e) {
+ monitoringLogger.error("Couldn't measure JVM CPU time, error: {}", e);
+ }
+ return cpuTime;
+ }
+
+ /**
+ * Returns the host total cpu time (msec)
+ *
+ * @return the host total cpu time (msec)
+ */
+ private long getHostCpuTime() {
+ long cpuTime = -1;
+ try {
+ cpuTime = sigarSession.getCpu().getTotal();
+ } catch (Exception e) {
+ monitoringLogger.error("Couldn't measure host CPU time, error: {}", e);
+ }
+ return cpuTime;
+ }
+
+ /**
+ * Returns the host used memory(msec)
+ *
+ * @return the host used memory(msec)
+ */
+ private Double getHostUsedMemory() {
+ Double memory = -1.0;
+ try {
+ memory = sigarSession.getMem().getUsedPercent();
+ } catch (Exception e) {
+ monitoringLogger.error("Couldn't measure host used memory, error: {}", e);
+ }
+ return memory;
+ }
+
+ /**
+ * Returns the percentage of all available FS
+ *
+ * @return the host avail disk(bytes)
+ */
+ private Map<String, Double> getHostUsedDisk() {
+ Map<String, Double> res = new HashMap<>();
+ try {
+ FileSystem[] fileSystemList = sigarSession.getFileSystemList();
+ for (FileSystem fileSystem : fileSystemList) {
+
+ String dirName = fileSystem.getDirName();
+ double usePercent = sigarSession.getFileSystemUsage(dirName).getUsePercent() * TO_PERCENT_MULTIPLIER;
+ res.put(dirName, usePercent);
+ }
+ } catch (Exception e) {
+ monitoringLogger.error("Couldn't measure host used disk, error: {}", e);
+ }
+ return res;
+ }
+
+ /**
+ * Returns the FQDN
+ *
+ * @return the FQDN
+ */
+ private String getFQDN() {
+ String fqdn = "";
+ try {
+ fqdn = sigarSession.getFQDN();
+ } catch (Exception e) {
+ monitoringLogger.error("Couldn't get FQDN, error: {}", e);
+ }
+ return fqdn;
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/rest/api/RestConfigurationInfo.java b/common-app-api/src/main/java/org/openecomp/sdc/common/rest/api/RestConfigurationInfo.java
index 89a9e24dff..0e660400d3 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/rest/api/RestConfigurationInfo.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/rest/api/RestConfigurationInfo.java
@@ -7,9 +7,9 @@
* 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.
@@ -24,84 +24,80 @@ import org.openecomp.sdc.common.api.BasicConfiguration;
public class RestConfigurationInfo extends BasicConfiguration {
- private Integer readTimeoutInSec = null;
-
- private Boolean ignoreCertificate = null;
-
- private Integer connectionPoolSize = null;
-
- private Integer connectTimeoutInSec = null;
-
- /**
- * @return the readTimeoutInSec
- */
- public Integer getReadTimeoutInSec() {
- return readTimeoutInSec;
- }
-
- /**
- * @param readTimeoutInSec
- * the readTimeoutInSec to set
- */
- public void setReadTimeoutInSec(Integer readTimeoutInSec) {
- this.readTimeoutInSec = readTimeoutInSec;
- }
-
- /**
- * @return the ignoreCertificate
- */
- public Boolean getIgnoreCertificate() {
- return ignoreCertificate;
- }
-
- /**
- * @param ignoreCertificate
- * the ignoreCertificate to set
- */
- public void setIgnoreCertificate(Boolean ignoreCertificate) {
- this.ignoreCertificate = ignoreCertificate;
- }
-
- /**
- * @return the connectionPoolSize
- */
- public Integer getConnectionPoolSize() {
- return connectionPoolSize;
- }
-
- /**
- * @param connectionPoolSize
- * the connectionPoolSize to set
- */
- public void setConnectionPoolSize(Integer connectionPoolSize) {
- this.connectionPoolSize = connectionPoolSize;
- }
-
- /**
- * @return the connectTimeoutInSec
- */
- public Integer getConnectTimeoutInSec() {
- return connectTimeoutInSec;
- }
-
- /**
- * @param connectTimeoutInSec
- * the connectTimeoutInSec to set
- */
- public void setConnectTimeoutInSec(Integer connectTimeoutInSec) {
- this.connectTimeoutInSec = connectTimeoutInSec;
- }
-
- public String toString() {
-
- StringBuilder builder = new StringBuilder();
-
- builder.append("[ timeoutInSec=" + readTimeoutInSec + ",");
- builder.append("connectTimeoutInSec=" + connectTimeoutInSec + ",");
- builder.append("ignoreCertificate=" + ignoreCertificate + ",");
- builder.append("connectionPoolSize=" + connectionPoolSize + "]");
-
- return builder.toString();
-
- }
+ private Integer readTimeoutInSec = null;
+
+ private Boolean ignoreCertificate = null;
+
+ private Integer connectionPoolSize = null;
+
+ private Integer connectTimeoutInSec = null;
+
+ /**
+ * @return the readTimeoutInSec
+ */
+ public Integer getReadTimeoutInSec() {
+ return readTimeoutInSec;
+ }
+
+ /**
+ * @param readTimeoutInSec the readTimeoutInSec to set
+ */
+ public void setReadTimeoutInSec(Integer readTimeoutInSec) {
+ this.readTimeoutInSec = readTimeoutInSec;
+ }
+
+ /**
+ * @return the ignoreCertificate
+ */
+ public Boolean getIgnoreCertificate() {
+ return ignoreCertificate;
+ }
+
+ /**
+ * @param ignoreCertificate the ignoreCertificate to set
+ */
+ public void setIgnoreCertificate(Boolean ignoreCertificate) {
+ this.ignoreCertificate = ignoreCertificate;
+ }
+
+ /**
+ * @return the connectionPoolSize
+ */
+ public Integer getConnectionPoolSize() {
+ return connectionPoolSize;
+ }
+
+ /**
+ * @param connectionPoolSize the connectionPoolSize to set
+ */
+ public void setConnectionPoolSize(Integer connectionPoolSize) {
+ this.connectionPoolSize = connectionPoolSize;
+ }
+
+ /**
+ * @return the connectTimeoutInSec
+ */
+ public Integer getConnectTimeoutInSec() {
+ return connectTimeoutInSec;
+ }
+
+ /**
+ * @param connectTimeoutInSec the connectTimeoutInSec to set
+ */
+ public void setConnectTimeoutInSec(Integer connectTimeoutInSec) {
+ this.connectTimeoutInSec = connectTimeoutInSec;
+ }
+
+ public String toString() {
+
+ StringBuilder builder = new StringBuilder();
+
+ builder.append("[ timeoutInSec=" + readTimeoutInSec + ",");
+ builder.append("connectTimeoutInSec=" + connectTimeoutInSec + ",");
+ builder.append("ignoreCertificate=" + ignoreCertificate + ",");
+ builder.append("connectionPoolSize=" + connectionPoolSize + "]");
+
+ return builder.toString();
+
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/rest/impl/validator/RequestHeadersValidator.java b/common-app-api/src/main/java/org/openecomp/sdc/common/rest/impl/validator/RequestHeadersValidator.java
index 6703b91a60..5c389fcd3f 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/rest/impl/validator/RequestHeadersValidator.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/rest/impl/validator/RequestHeadersValidator.java
@@ -7,9 +7,9 @@
* 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.
@@ -31,64 +31,64 @@ import java.util.List;
import java.util.Map;
public class RequestHeadersValidator {
- private static Logger log = Logger.getLogger(RequestHeadersValidator.class.getName());
+ private static Logger log = Logger.getLogger(RequestHeadersValidator.class.getName());
- public static void validateContentType(HttpServletRequest request, MediaType expectedContentType,
- Map<String, String> headersMap) throws RestRequestValidationException {
+ public static void validateContentType(HttpServletRequest request, MediaType expectedContentType,
+ Map<String, String> headersMap) throws RestRequestValidationException {
- log.debug("validateContentType - expected: {}", expectedContentType);
- if (request == null || expectedContentType == null) {
- throw new RestRequestValidationException("request or media-type are null");
- }
- String contentType = request.getHeader(Constants.CONTENT_TYPE_HEADER);
- if (contentType == null || !contentType.contains(MediaType.APPLICATION_JSON)) {
- throw new RestRequestValidationException(
- "Content-Type of requset is different then " + expectedContentType);
- } else {
- headersMap.put(Constants.CONTENT_TYPE_HEADER, contentType);
- }
- }
+ log.debug("validateContentType - expected: {}", expectedContentType);
+ if (request == null || expectedContentType == null) {
+ throw new RestRequestValidationException("request or media-type are null");
+ }
+ String contentType = request.getHeader(Constants.CONTENT_TYPE_HEADER);
+ if (contentType == null || !contentType.contains(MediaType.APPLICATION_JSON)) {
+ throw new RestRequestValidationException(
+ "Content-Type of requset is different then " + expectedContentType);
+ } else {
+ headersMap.put(Constants.CONTENT_TYPE_HEADER, contentType);
+ }
+ }
- public static void validateIdentificationHeaders(HttpServletRequest request, List<String> identificationList,
- Map<String, String> headersMap) throws RestRequestValidationException {
+ public static void validateIdentificationHeaders(HttpServletRequest request, List<String> identificationList,
+ Map<String, String> headersMap) throws RestRequestValidationException {
- log.debug("validateIdentificationHeaders");
- for (String requiredHeader : identificationList) {
- String headerVal = request.getHeader(requiredHeader);
- if (headerVal != null && !headerVal.isEmpty()) {
- headersMap.put(requiredHeader, headerVal);
- log.debug("found header - {} : {}", requiredHeader, headerVal);
- } else {
- log.error(EcompLoggerErrorCode.UNKNOWN_ERROR,"","","missing identification header: {}", requiredHeader);
- throw new RestRequestValidationException("missing identification header: " + requiredHeader);
- }
- }
+ log.debug("validateIdentificationHeaders");
+ for (String requiredHeader : identificationList) {
+ String headerVal = request.getHeader(requiredHeader);
+ if (headerVal != null && !headerVal.isEmpty()) {
+ headersMap.put(requiredHeader, headerVal);
+ log.debug("found header - {} : {}", requiredHeader, headerVal);
+ } else {
+ log.error(EcompLoggerErrorCode.UNKNOWN_ERROR, "", "", "missing identification header: {}", requiredHeader);
+ throw new RestRequestValidationException("missing identification header: " + requiredHeader);
+ }
+ }
- }
+ }
- public static void validateMd5(byte[] encodedData, HttpServletRequest request, Map<String, String> headersMap)
- throws RestRequestValidationException {
+ public static void validateMd5(byte[] encodedData, HttpServletRequest request, Map<String, String> headersMap)
+ throws RestRequestValidationException {
- // validate parameters
- if (encodedData == null || request == null) {
- throw new RestRequestValidationException("encoded data or request are not valid");
- }
+ // validate parameters
+ if (encodedData == null || request == null) {
+ throw new RestRequestValidationException("encoded data or request are not valid");
+ }
- // calculate MD5 on the data
- String md5 = org.apache.commons.codec.digest.DigestUtils.md5Hex(encodedData);
- byte[] encodedMd5 = Base64.encodeBase64(md5.getBytes());
+ // calculate MD5 on the data
+ String md5 = org.apache.commons.codec.digest.DigestUtils.md5Hex(encodedData);
+ byte[] encodedMd5 = Base64.encodeBase64(md5.getBytes());
- // read the Content-MD5 header
- String origMd5 = request.getHeader(Constants.MD5_HEADER);
- if ((origMd5 == null) || origMd5.isEmpty()) {
- throw new RestRequestValidationException("missing Content-MD5 header ");
- }
+ // read the Content-MD5 header
+ String origMd5 = request.getHeader(Constants.MD5_HEADER);
+ if ((origMd5 == null) || origMd5.isEmpty()) {
+ throw new RestRequestValidationException("missing Content-MD5 header ");
+ }
- // verify MD5 value
- if (!origMd5.equals(new String(encodedMd5))) {
- throw new RestRequestValidationException("uploaded file failed MD5 validation");
- }
- headersMap.put(Constants.MD5_HEADER, origMd5);
- }
+ // verify MD5 value
+ if (!origMd5.equals(new String(encodedMd5))) {
+ throw new RestRequestValidationException("uploaded file failed MD5 validation");
+ }
+ headersMap.put(Constants.MD5_HEADER, origMd5);
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/rest/impl/validator/RestRequestValidationException.java b/common-app-api/src/main/java/org/openecomp/sdc/common/rest/impl/validator/RestRequestValidationException.java
index 90ed39e1c2..0dd186a155 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/rest/impl/validator/RestRequestValidationException.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/rest/impl/validator/RestRequestValidationException.java
@@ -7,9 +7,9 @@
* 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.
@@ -22,13 +22,13 @@ package org.openecomp.sdc.common.rest.impl.validator;
public class RestRequestValidationException extends Exception {
- /**
- *
- */
- private static final long serialVersionUID = 1962654783383591672L;
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1962654783383591672L;
- public RestRequestValidationException(String message) {
- super(message);
- }
+ public RestRequestValidationException(String message) {
+ super(message);
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/servlets/BasicServlet.java b/common-app-api/src/main/java/org/openecomp/sdc/common/servlets/BasicServlet.java
index ce4f2a6e6b..7f428f253b 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/servlets/BasicServlet.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/servlets/BasicServlet.java
@@ -7,9 +7,9 @@
* 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.
@@ -25,8 +25,6 @@ import com.google.gson.GsonBuilder;
public abstract class BasicServlet {
- protected Gson gson = new GsonBuilder().setPrettyPrinting().create();
-
-
+ protected Gson gson = new GsonBuilder().setPrettyPrinting().create();
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/test/BaseConfDependent.java b/common-app-api/src/main/java/org/openecomp/sdc/common/test/BaseConfDependent.java
index 9faaaf9931..8e50c97623 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/test/BaseConfDependent.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/test/BaseConfDependent.java
@@ -7,9 +7,9 @@
* 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.
@@ -28,23 +28,24 @@ import org.openecomp.sdc.common.impl.FSConfigurationSource;
import java.io.File;
public class BaseConfDependent {
- protected static ConfigurationManager configurationManager;
- protected static String componentName;
- protected static String confPath;
-
-
- protected static void setUp(){
- ExternalConfiguration.setAppName(componentName);
- ExternalConfiguration.setConfigDir(confPath);
- ExternalConfiguration.listenForChanges();
- ExternalConfiguration.setAppVersion("1806.666");
-
- ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(), ExternalConfiguration.getConfigDir() + File.separator + ExternalConfiguration.getAppName());
-
- configurationManager = new ConfigurationManager(configurationSource);
-
- configurationManager.getConfiguration().setJanusGraphInMemoryGraph(true);
-
- }
-
+
+ protected static ConfigurationManager configurationManager;
+ protected static String componentName;
+ protected static String confPath;
+
+
+ protected static void setUp() {
+ ExternalConfiguration.setAppName(componentName);
+ ExternalConfiguration.setConfigDir(confPath);
+ ExternalConfiguration.listenForChanges();
+ ExternalConfiguration.setAppVersion("1806.666");
+
+ ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(), ExternalConfiguration.getConfigDir() + File.separator + ExternalConfiguration.getAppName());
+
+ configurationManager = new ConfigurationManager(configurationSource);
+
+ configurationManager.getConfiguration().setJanusGraphInMemoryGraph(true);
+
+ }
+
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/util/CapabilityTypeNameEnum.java b/common-app-api/src/main/java/org/openecomp/sdc/common/util/CapabilityTypeNameEnum.java
index cb78b8ed9b..a79e1ee22b 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/util/CapabilityTypeNameEnum.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/util/CapabilityTypeNameEnum.java
@@ -7,9 +7,9 @@
* 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.
@@ -21,26 +21,26 @@
package org.openecomp.sdc.common.util;
public enum CapabilityTypeNameEnum {
- ROOT("tosca.capabilities.Root"),
- NODE("tosca.capabilities.Node"),
- CONTAINER("tosca.capabilities.Container"),
- ENDPOINT("tosca.capabilities.Endpoint"),
- ENDPOINT_PUBLIC("tosca.capabilities.Endpoint.Public"),
- ENDPOINT_ADMIN("tosca.capabilities.Endpoint.Admin"),
- ENDPOINT_DATABASE("tosca.capabilities.Endpoint.Database"),
- OPERATING_SYSTEM("tosca.capabilities.OperatingSystem"),
- SCALABLE("tosca.capabilities.Scalable"),
- BINDABLE("tosca.capabilities.network.Bindable"),
- DOCKER("tosca.capabilities.Container.Docker"),
- ATTACHMENT("tosca.capabilities.Attachment");
+ ROOT("tosca.capabilities.Root"),
+ NODE("tosca.capabilities.Node"),
+ CONTAINER("tosca.capabilities.Container"),
+ ENDPOINT("tosca.capabilities.Endpoint"),
+ ENDPOINT_PUBLIC("tosca.capabilities.Endpoint.Public"),
+ ENDPOINT_ADMIN("tosca.capabilities.Endpoint.Admin"),
+ ENDPOINT_DATABASE("tosca.capabilities.Endpoint.Database"),
+ OPERATING_SYSTEM("tosca.capabilities.OperatingSystem"),
+ SCALABLE("tosca.capabilities.Scalable"),
+ BINDABLE("tosca.capabilities.network.Bindable"),
+ DOCKER("tosca.capabilities.Container.Docker"),
+ ATTACHMENT("tosca.capabilities.Attachment");
- private String capabilityName;
+ private String capabilityName;
- private CapabilityTypeNameEnum(String capName) {
- this.capabilityName = capName;
- }
+ CapabilityTypeNameEnum(String capName) {
+ this.capabilityName = capName;
+ }
- public String getCapabilityName() {
- return capabilityName;
- }
+ public String getCapabilityName() {
+ return capabilityName;
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/util/GeneralUtility.java b/common-app-api/src/main/java/org/openecomp/sdc/common/util/GeneralUtility.java
index a6cdd90993..7ff19ace72 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/util/GeneralUtility.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/util/GeneralUtility.java
@@ -7,9 +7,9 @@
* 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.
@@ -31,136 +31,135 @@ import java.util.regex.Pattern;
public class GeneralUtility {
- public static boolean generateTextFile(String fileName, String fileData) {
- boolean isSuccessfull = true;
- try {
- FileUtils.writeStringToFile(new File(fileName), fileData);
- } catch (IOException e) {
- isSuccessfull = false;
- }
- return isSuccessfull;
- }
-
- /**
- * Use with care, usage is not advised!!!
- * The method only checks if String does not contain special characters + length divided by 4 with no remainder.
- * The methods contained in other common libraries do the same.
- */
- public static boolean isBase64Encoded(byte[] data) {
- return Base64.isBase64(data);
- }
-
- /**
- *Use with care, usage is not advised!!!
- * The method only checks if String does not contain special characters + length divided by 4 with no remainder.
- * The methods contained in other common libraries do the same.
- */
- public static boolean isBase64Encoded(String str) {
- boolean isEncoded = false;
- try {
- // checks if the string was properly padded to the
- isEncoded = ((str.length() % 4 == 0) && (Pattern.matches("\\A[a-zA-Z0-9/+]+={0,2}\\z", str)));
- if (isEncoded) {
- // If no exception is caught, then it is possibly a base64
- // encoded string
- byte[] data = Base64.decodeBase64(str);
- }
-
- } catch (Exception e) {
- // If exception is caught, then it is not a base64 encoded string
- isEncoded = false;
- }
- return isEncoded;
- }
-
- /**
- * Checks whether the passed string exceeds a limit of number of characters.
- *
- * @param str
- * @param limit
- * @return the result of comparison, or false if str is null.
- */
- public static boolean isExceedingLimit(String str, int limit) {
- if (str == null) {
- return false;
- }
- return str.length() > limit;
- }
-
- /**
- * Checks the passed string list whether the cumulative length of strings and delimiters between them exceeds a limit of number of characters. For example for list ("one","two","three") with delimiter "," the length of list is calculated
- * 3+1+3+1+5=13
- *
- * @param strList
- * @param limit
- * @param delimiterLength
- * - 0 if there is no delimeter.
- * @return the result of comparison, or false if strList is null.
- */
- public static boolean isExceedingLimit(List<String> strList, int limit, int delimiterLength) {
- if (strList == null || strList.isEmpty()) {
- return false;
- }
- int sum = 0;
- int size = strList.size();
- for (int i = 0; i < size - 1; i++) {
- String str = strList.get(i);
- if (str != null) {
- sum += str.length();
- }
- sum += delimiterLength;
- }
- String str = strList.get(size - 1);
- if (str != null) {
- sum += str.length();
- }
- return sum > limit;
- }
-
- /**
- * Return the extension as the substring from the last dot. For input "kuku.txt", "txt" will be returned. If no dot is found or input is null, empty string is returned.
- *
- * @param fileName
- * @return extension
- */
- public static String getFilenameExtension(String fileName) {
- String res = Constants.EMPTY_STRING;
- if (fileName != null) {
- int indexOf = fileName.lastIndexOf('.');
- if (indexOf != -1 && indexOf < (fileName.length() - 1)) {
- res = fileName.substring(indexOf + 1);
- }
- }
- return res;
- }
-
- public static String calculateMD5Base64EncodedByByteArray(byte[] payload) {
- String decodedMd5 = org.apache.commons.codec.digest.DigestUtils.md5Hex(payload);
- byte[] encodeMd5 = Base64.encodeBase64(decodedMd5.getBytes());
- return new String(encodeMd5);
-
- }
-
- /**
- *
- * @param data
- * @return
- */
- public static String calculateMD5Base64EncodedByString(String data) {
- String calculatedMd5 = org.apache.commons.codec.digest.DigestUtils.md5Hex(data);
-
- // encode base-64 result
- byte[] encodeBase64 = Base64.encodeBase64(calculatedMd5.getBytes());
- return new String(encodeBase64);
- }
-
-
- /**
- *
- * @param String
- * @return String is null or Empty
- */
- public static boolean isEmptyString(String str) {
+ private static final int STRING_LENGTH_MULTIPLIER = 4;
+
+ public static boolean generateTextFile(String fileName, String fileData) {
+ boolean isSuccessfull = true;
+ try {
+ FileUtils.writeStringToFile(new File(fileName), fileData);
+ } catch (IOException e) {
+ isSuccessfull = false;
+ }
+ return isSuccessfull;
+ }
+
+ /**
+ * Use with care, usage is not advised!!!
+ * The method only checks if String does not contain special characters + length divided by 4 with no remainder.
+ * The methods contained in other common libraries do the same.
+ */
+ public static boolean isBase64Encoded(byte[] data) {
+ return Base64.isBase64(data);
+ }
+
+ /**
+ * Use with care, usage is not advised!!!
+ * The method only checks if String does not contain special characters + length divided by 4 with no remainder.
+ * The methods contained in other common libraries do the same.
+ */
+ public static boolean isBase64Encoded(String str) {
+ boolean isEncoded = false;
+ try {
+ // checks if the string was properly padded to the
+ isEncoded = ((str.length() % STRING_LENGTH_MULTIPLIER == 0) && (Pattern.matches("\\A[a-zA-Z0-9/+]+={0,2}\\z", str)));
+ if (isEncoded) {
+ // If no exception is caught, then it is possibly a base64
+ // encoded string
+ byte[] data = Base64.decodeBase64(str);
+ }
+
+ } catch (Exception e) {
+ // If exception is caught, then it is not a base64 encoded string
+ isEncoded = false;
+ }
+ return isEncoded;
+ }
+
+ /**
+ * Checks whether the passed string exceeds a limit of number of characters.
+ *
+ * @param str
+ * @param limit
+ * @return the result of comparison, or false if str is null.
+ */
+ public static boolean isExceedingLimit(String str, int limit) {
+ if (str == null) {
+ return false;
+ }
+ return str.length() > limit;
+ }
+
+ /**
+ * Checks the passed string list whether the cumulative length of strings and delimiters between them exceeds a limit of number of characters. For example for list ("one","two","three") with delimiter "," the length of list is calculated
+ * 3+1+3+1+5=13
+ *
+ * @param strList
+ * @param limit
+ * @param delimiterLength - 0 if there is no delimeter.
+ * @return the result of comparison, or false if strList is null.
+ */
+ public static boolean isExceedingLimit(List<String> strList, int limit, int delimiterLength) {
+ if (strList == null || strList.isEmpty()) {
+ return false;
+ }
+ int sum = 0;
+ int size = strList.size();
+ for (int i = 0; i < size - 1; i++) {
+ String str = strList.get(i);
+ if (str != null) {
+ sum += str.length();
+ }
+ sum += delimiterLength;
+ }
+ String str = strList.get(size - 1);
+ if (str != null) {
+ sum += str.length();
+ }
+ return sum > limit;
+ }
+
+ /**
+ * Return the extension as the substring from the last dot. For input "kuku.txt", "txt" will be returned. If no dot is found or input is null, empty string is returned.
+ *
+ * @param fileName
+ * @return extension
+ */
+ public static String getFilenameExtension(String fileName) {
+ String res = Constants.EMPTY_STRING;
+ if (fileName != null) {
+ int indexOf = fileName.lastIndexOf('.');
+ if (indexOf != -1 && indexOf < (fileName.length() - 1)) {
+ res = fileName.substring(indexOf + 1);
+ }
+ }
+ return res;
+ }
+
+ public static String calculateMD5Base64EncodedByByteArray(byte[] payload) {
+ String decodedMd5 = org.apache.commons.codec.digest.DigestUtils.md5Hex(payload);
+ byte[] encodeMd5 = Base64.encodeBase64(decodedMd5.getBytes());
+ return new String(encodeMd5);
+
+ }
+
+ /**
+ * @param data
+ * @return
+ */
+ public static String calculateMD5Base64EncodedByString(String data) {
+ String calculatedMd5 = org.apache.commons.codec.digest.DigestUtils.md5Hex(data);
+
+ // encode base-64 result
+ byte[] encodeBase64 = Base64.encodeBase64(calculatedMd5.getBytes());
+ return new String(encodeBase64);
+ }
+
+
+ /**
+ * @param String
+ * @return String is null or Empty
+ */
+ public static boolean isEmptyString(String str) {
return str == null || str.trim().isEmpty();
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/util/GsonFactory.java b/common-app-api/src/main/java/org/openecomp/sdc/common/util/GsonFactory.java
index 7c3bcb6cad..e7877e4fad 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/util/GsonFactory.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/util/GsonFactory.java
@@ -7,9 +7,9 @@
* 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.
@@ -24,17 +24,17 @@ import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
public class GsonFactory {
- private static Gson gson = null;
+ private static Gson gson = null;
- public static Gson getGson() {
- if (gson == null) {
- synchronized (GsonFactory.class) {
- if (gson == null) {
- gson = new GsonBuilder().disableHtmlEscaping().serializeNulls().create();
- }
- }
- }
+ public static Gson getGson() {
+ if (gson == null) {
+ synchronized (GsonFactory.class) {
+ if (gson == null) {
+ gson = new GsonBuilder().disableHtmlEscaping().serializeNulls().create();
+ }
+ }
+ }
- return gson;
- }
+ return gson;
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/util/HealthCheckUtil.java b/common-app-api/src/main/java/org/openecomp/sdc/common/util/HealthCheckUtil.java
index cb575eb1ae..7474d38372 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/util/HealthCheckUtil.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/util/HealthCheckUtil.java
@@ -7,9 +7,9 @@
* 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.
@@ -33,6 +33,7 @@ import static org.openecomp.sdc.common.api.HealthCheckInfo.HealthCheckStatus.DOW
public class HealthCheckUtil {
private static Logger log = Logger.getLogger(HealthCheckUtil.class.getName());
+
public boolean getAggregateStatus(List<HealthCheckInfo> healthCheckInfos, Collection<String> excludes) {
boolean status = true;
excludes = CollectionUtils.isEmpty(excludes) ? new ArrayList<>() : excludes;
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/util/HtmlCleaner.java b/common-app-api/src/main/java/org/openecomp/sdc/common/util/HtmlCleaner.java
index c9086fc272..5a7c426949 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/util/HtmlCleaner.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/util/HtmlCleaner.java
@@ -7,9 +7,9 @@
* 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.
@@ -31,81 +31,81 @@ import java.util.regex.Pattern;
public class HtmlCleaner {
- private static Set<String> htmlTags = new HashSet<>();
+ private static Set<String> htmlTags = new HashSet<>();
- private static String patternHtmlFullTagStr = "</?\\w+((\\s+\\w+(\\s*=\\s*(?:\".*?\"|'.*?'|[\\^'\">\\s]+))?)+\\s*|\\s*)/?>";
+ private static String patternHtmlFullTagStr = "</?\\w+((\\s+\\w+(\\s*=\\s*(?:\".*?\"|'.*?'|[\\^'\">\\s]+))?)+\\s*|\\s*)/?>";
- private static String patternHtmlTagOnlyStr = "</?(\\w+)[^>]*/?>";
+ private static String patternHtmlTagOnlyStr = "</?(\\w+)[^>]*/?>";
- private static Pattern onlyTagPattern = Pattern.compile(patternHtmlTagOnlyStr);
+ private static Pattern onlyTagPattern = Pattern.compile(patternHtmlTagOnlyStr);
- private static Pattern fullTagPattern = Pattern.compile(patternHtmlFullTagStr);
+ private static Pattern fullTagPattern = Pattern.compile(patternHtmlFullTagStr);
- static {
- Tag[] allTags = HTML.getAllTags();
- for (Tag tag : allTags) {
- htmlTags.add(tag.toString().toLowerCase());
- }
- }
+ static {
+ Tag[] allTags = HTML.getAllTags();
+ for (Tag tag : allTags) {
+ htmlTags.add(tag.toString().toLowerCase());
+ }
+ }
- public static String stripHtml(String input) {
+ public static String stripHtml(String input) {
- return stripHtml(input, false);
+ return stripHtml(input, false);
- }
+ }
- public static String stripHtml(String input, boolean toEscape) {
+ public static String stripHtml(String input, boolean toEscape) {
- if (input == null || input.isEmpty()) {
- return input;
- }
+ if (input == null || input.isEmpty()) {
+ return input;
+ }
- Matcher matcher = onlyTagPattern.matcher(input);
+ Matcher matcher = onlyTagPattern.matcher(input);
- Set<String> tagsToRemove = new HashSet<>();
+ Set<String> tagsToRemove = new HashSet<>();
- while (matcher.find()) {
+ while (matcher.find()) {
- int start = matcher.start();
- int end = matcher.end();
+ int start = matcher.start();
+ int end = matcher.end();
- String matchTag = input.substring(start, end);
+ String matchTag = input.substring(start, end);
- int groupCount = matcher.groupCount();
+ int groupCount = matcher.groupCount();
- if (groupCount > 0) {
- String tag = matcher.group(1);
- if (tag != null && htmlTags.contains(tag.toLowerCase())) {
- if (!tagsToRemove.contains(matchTag)) {
- tagsToRemove.add(matchTag);
- }
- }
- }
- }
+ if (groupCount > 0) {
+ String tag = matcher.group(1);
+ if (tag != null && htmlTags.contains(tag.toLowerCase())) {
+ if (!tagsToRemove.contains(matchTag)) {
+ tagsToRemove.add(matchTag);
+ }
+ }
+ }
+ }
- String stripHtmlStr = removeTagsFromString(tagsToRemove, input);
+ String stripHtmlStr = removeTagsFromString(tagsToRemove, input);
- if (stripHtmlStr != null) {
- if (toEscape) {
- stripHtmlStr = StringEscapeUtils.escapeHtml4(stripHtmlStr);
- }
- }
+ if (stripHtmlStr != null) {
+ if (toEscape) {
+ stripHtmlStr = StringEscapeUtils.escapeHtml4(stripHtmlStr);
+ }
+ }
- return stripHtmlStr;
+ return stripHtmlStr;
- }
+ }
- private static String removeTagsFromString(Set<String> tagsToRemove, String input) {
+ private static String removeTagsFromString(Set<String> tagsToRemove, String input) {
- String stripStr = input;
- if (input == null || tagsToRemove.isEmpty()) {
- return input;
- }
+ String stripStr = input;
+ if (input == null || tagsToRemove.isEmpty()) {
+ return input;
+ }
- for (String tag : tagsToRemove) {
- stripStr = stripStr.replaceAll(tag, "");
- }
- return stripStr;
- }
+ for (String tag : tagsToRemove) {
+ stripStr = stripStr.replaceAll(tag, "");
+ }
+ return stripStr;
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/util/HttpUtil.java b/common-app-api/src/main/java/org/openecomp/sdc/common/util/HttpUtil.java
index d9f099876a..5bd3b87fc4 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/util/HttpUtil.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/util/HttpUtil.java
@@ -7,9 +7,9 @@
* 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.
@@ -30,50 +30,50 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
public class HttpUtil {
- public static Either<String, IOException> readJsonStringFromRequest(HttpServletRequest request) {
- Either<String, IOException> eitherResult;
- try (ByteArrayOutputStream stream = new ByteArrayOutputStream()) {
- ServletInputStream reader = request.getInputStream();
- int value;
- while ((value = reader.read()) != -1) {
- stream.write(value);
- }
- eitherResult = Either.left(new String(stream.toByteArray()));
- } catch (IOException e) {
- eitherResult = Either.right(e);
- }
- return eitherResult;
+ public static Either<String, IOException> readJsonStringFromRequest(HttpServletRequest request) {
+ Either<String, IOException> eitherResult;
+ try (ByteArrayOutputStream stream = new ByteArrayOutputStream()) {
+ ServletInputStream reader = request.getInputStream();
+ int value;
+ while ((value = reader.read()) != -1) {
+ stream.write(value);
+ }
+ eitherResult = Either.left(new String(stream.toByteArray()));
+ } catch (IOException e) {
+ eitherResult = Either.right(e);
+ }
+ return eitherResult;
- }
+ }
- /**
- * Builds an object from a JSON in the POST Body of the request.
- */
- public static <T> Either<T, Exception> getObjectFromJson(HttpServletRequest request, Class<T> classOfT) {
- Either<T, Exception> eitherResult;
- try {
- Either<String, IOException> eitherReadJson = readJsonStringFromRequest(request);
- if (eitherReadJson.isLeft()) {
- eitherResult = convertJsonStringToObject(eitherReadJson.left().value(), classOfT);
- } else {
- eitherResult = Either.right((Exception) eitherReadJson.right().value());
- }
- } catch (Exception e) {
- eitherResult = Either.right(e);
- }
+ /**
+ * Builds an object from a JSON in the POST Body of the request.
+ */
+ public static <T> Either<T, Exception> getObjectFromJson(HttpServletRequest request, Class<T> classOfT) {
+ Either<T, Exception> eitherResult;
+ try {
+ Either<String, IOException> eitherReadJson = readJsonStringFromRequest(request);
+ if (eitherReadJson.isLeft()) {
+ eitherResult = convertJsonStringToObject(eitherReadJson.left().value(), classOfT);
+ } else {
+ eitherResult = Either.right((Exception) eitherReadJson.right().value());
+ }
+ } catch (Exception e) {
+ eitherResult = Either.right(e);
+ }
- return eitherResult;
- }
+ return eitherResult;
+ }
- public static <T> Either<T, Exception> convertJsonStringToObject(String sentJson, Class<T> classOfT) {
- Either<T, Exception> eitherResult;
- try {
- Gson gson = new GsonBuilder().setPrettyPrinting().create();
- T object = gson.fromJson(sentJson, classOfT);
- eitherResult = Either.left(object);
- } catch (Exception e) {
- eitherResult = Either.right(e);
- }
- return eitherResult;
- }
+ public static <T> Either<T, Exception> convertJsonStringToObject(String sentJson, Class<T> classOfT) {
+ Either<T, Exception> eitherResult;
+ try {
+ Gson gson = new GsonBuilder().setPrettyPrinting().create();
+ T object = gson.fromJson(sentJson, classOfT);
+ eitherResult = Either.left(object);
+ } catch (Exception e) {
+ eitherResult = Either.right(e);
+ }
+ return eitherResult;
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/util/JsonUtils.java b/common-app-api/src/main/java/org/openecomp/sdc/common/util/JsonUtils.java
index fbf94eaaed..b992f7dc7c 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/util/JsonUtils.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/util/JsonUtils.java
@@ -7,9 +7,9 @@
* 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.
@@ -25,38 +25,38 @@ import com.google.gson.JsonObject;
public class JsonUtils {
- public static String toString(JsonElement jsonElement) {
+ public static String toString(JsonElement jsonElement) {
- if (jsonElement == null) {
- return null;
- }
+ if (jsonElement == null) {
+ return null;
+ }
- if (!jsonElement.isJsonNull()) {
- if (!jsonElement.isJsonObject()) {
- return jsonElement.getAsString();
- } else {
- return jsonElement.toString();
- }
- } else {
- return null;
- }
+ if (!jsonElement.isJsonNull()) {
+ if (!jsonElement.isJsonObject()) {
+ return jsonElement.getAsString();
+ } else {
+ return jsonElement.toString();
+ }
+ } else {
+ return null;
+ }
- }
+ }
- public static boolean containsEntry(JsonObject json, String key) {
- return json.get(key) != null;
- }
+ public static boolean containsEntry(JsonObject json, String key) {
+ return json.get(key) != null;
+ }
- public static boolean isEmptyJson(JsonObject json) {
- return json.entrySet().isEmpty();
- }
+ public static boolean isEmptyJson(JsonObject json) {
+ return json.entrySet().isEmpty();
+ }
- public static boolean isEmptyJson(JsonElement json) {
- return json.isJsonPrimitive() ? false : JsonUtils.isEmptyJson(json.getAsJsonObject());
- }
+ public static boolean isEmptyJson(JsonElement json) {
+ return json.isJsonPrimitive() ? false : JsonUtils.isEmptyJson(json.getAsJsonObject());
+ }
- public static boolean isJsonNullOrEmpty(JsonObject json) {
- return json.isJsonNull() || isEmptyJson(json);
- }
+ public static boolean isJsonNullOrEmpty(JsonObject json) {
+ return json.isJsonNull() || isEmptyJson(json);
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/util/MethodActivationStatusEnum.java b/common-app-api/src/main/java/org/openecomp/sdc/common/util/MethodActivationStatusEnum.java
index bba04fa359..758b33bbd3 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/util/MethodActivationStatusEnum.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/util/MethodActivationStatusEnum.java
@@ -7,9 +7,9 @@
* 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.
@@ -21,5 +21,5 @@
package org.openecomp.sdc.common.util;
public enum MethodActivationStatusEnum {
- SUCCESS, NOT_ALLOWED, FAILED, NOT_FOUND;
+ SUCCESS, NOT_ALLOWED, FAILED, NOT_FOUND;
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/util/PairUtils.java b/common-app-api/src/main/java/org/openecomp/sdc/common/util/PairUtils.java
index eb6c29ce4a..7fee13fc0d 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/util/PairUtils.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/util/PairUtils.java
@@ -7,9 +7,9 @@
* 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.
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/util/SerializationUtils.java b/common-app-api/src/main/java/org/openecomp/sdc/common/util/SerializationUtils.java
index cf49718600..42eb6086fa 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/util/SerializationUtils.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/util/SerializationUtils.java
@@ -7,9 +7,9 @@
* 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.
@@ -26,54 +26,59 @@ import org.openecomp.sdc.be.config.BeEcompErrorManager;
import org.openecomp.sdc.be.config.BeEcompErrorManager.ErrorSeverity;
import org.openecomp.sdc.common.log.wrappers.Logger;
-import java.io.*;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInput;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutput;
+import java.io.ObjectOutputStream;
public class SerializationUtils {
- private static Logger log = Logger.getLogger(SerializationUtils.class.getName());
+ private static Logger log = Logger.getLogger(SerializationUtils.class.getName());
- private static FSTConfiguration conf = FSTConfiguration.createDefaultConfiguration();
+ private static FSTConfiguration conf = FSTConfiguration.createDefaultConfiguration();
- public static Either<byte[], Boolean> serialize(Object object) {
+ public static Either<byte[], Boolean> serialize(Object object) {
- try (ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(bos)) {
- out.writeObject(object);
- return Either.left(bos.toByteArray());
- } catch (Exception e) {
- log.debug("Failed to serialize object", e);
- return Either.right(false);
- }
- }
+ try (ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(bos)) {
+ out.writeObject(object);
+ return Either.left(bos.toByteArray());
+ } catch (Exception e) {
+ log.debug("Failed to serialize object", e);
+ return Either.right(false);
+ }
+ }
- public static Either<Object, Boolean> deserialize(byte[] bytes) {
+ public static Either<Object, Boolean> deserialize(byte[] bytes) {
- try (ByteArrayInputStream bis = new ByteArrayInputStream(bytes); ObjectInput in = new ObjectInputStream(bis)) {
- return Either.left(in.readObject());
- } catch (Exception e) {
- log.debug("Failed to deserialize object", e);
- return Either.right(false);
- }
- }
+ try (ByteArrayInputStream bis = new ByteArrayInputStream(bytes); ObjectInput in = new ObjectInputStream(bis)) {
+ return Either.left(in.readObject());
+ } catch (Exception e) {
+ log.debug("Failed to deserialize object", e);
+ return Either.right(false);
+ }
+ }
- public static Either<byte[], Boolean> serializeExt(Object object) {
- try {
- byte[] value = conf.asByteArray(object);
- return Either.left(value);
- } catch (Exception e) {
- return Either.right(false);
- }
- }
+ public static Either<byte[], Boolean> serializeExt(Object object) {
+ try {
+ byte[] value = conf.asByteArray(object);
+ return Either.left(value);
+ } catch (Exception e) {
+ return Either.right(false);
+ }
+ }
- public static <T> Either<T, Boolean> deserializeExt(byte[] bytes, Class<T> clazz, String componentName) {
- try {
- Object object = conf.asObject(bytes);
- T castObject = clazz.cast(object);
- return Either.left(castObject);
- } catch (Exception e) {
- log.debug("Failed to deserialize object of type {} and uid {}",clazz,componentName, e);
- BeEcompErrorManager.getInstance().logInternalUnexpectedError("DeserializeObjectFromCache", "Failed to deserialize object of type " + clazz, ErrorSeverity.WARNING);
- return Either.right(false);
- }
- }
+ public static <T> Either<T, Boolean> deserializeExt(byte[] bytes, Class<T> clazz, String componentName) {
+ try {
+ Object object = conf.asObject(bytes);
+ T castObject = clazz.cast(object);
+ return Either.left(castObject);
+ } catch (Exception e) {
+ log.debug("Failed to deserialize object of type {} and uid {}", clazz, componentName, e);
+ BeEcompErrorManager.getInstance().logInternalUnexpectedError("DeserializeObjectFromCache", "Failed to deserialize object of type " + clazz, ErrorSeverity.WARNING);
+ return Either.right(false);
+ }
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/util/StreamUtils.java b/common-app-api/src/main/java/org/openecomp/sdc/common/util/StreamUtils.java
index 2d07069388..88f00f5ee4 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/util/StreamUtils.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/util/StreamUtils.java
@@ -7,9 +7,9 @@
* 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.
@@ -31,69 +31,68 @@ import java.util.stream.StreamSupport;
/**
* Utility Class For Actions On Streams
- *
- * @author mshitrit
*
+ * @author mshitrit
*/
public final class StreamUtils {
- private StreamUtils() {
- throw new UnsupportedOperationException();
- }
-
- /**
- * Breaks the stream when the predicate is not met.<br>
- * Does not evaluate elements after the stream breaks.<br>
- * This method evaluates the stream.<br>
- *
- * @param stream
- * @param predicate
- * @return
- */
- public static <T> Stream<T> takeWhilePlusOneNoEval(Stream<T> stream, Predicate<T> predicate) {
- List<T> results = new ArrayList<>();
- Consumer<T> listAdder = results::add;
- stream.map(e -> {
- listAdder.accept(e);
- return e;
- }).filter(e -> !predicate.test(e)).findFirst();
- return results.stream();
- }
-
- public static <T> Stream<T> takeWhile(Stream<T> stream, Predicate<T> predicate) {
- return StreamSupport.stream(takeWhile(stream.spliterator(), predicate), false);
- }
-
- public static <T> Stream<T> takeWhilePlusOne(Stream<T> stream, Predicate<T> predicate) {
- return StreamSupport.stream(takeWhile(stream.spliterator(), new StopAfterFailPredicate<>(predicate)), false);
- }
-
- private static <T> Spliterator<T> takeWhile(Spliterator<T> splitr, Predicate<T> predicate) {
- return new MySplitIterator<>(splitr, predicate);
- }
-
- public static class MySplitIterator<T> extends AbstractSpliterator<T> implements Spliterator<T> {
- boolean stillGoing = true;
- private Spliterator<T> innerItr;
- private Predicate<T> innerPred;
-
- private MySplitIterator(Spliterator<T> splitItr, Predicate<T> pred) {
- super(splitItr.estimateSize(), 0);
- innerItr = splitItr;
- innerPred = pred;
- }
-
- @Override
- public boolean tryAdvance(Consumer<? super T> action) {
- boolean canAdvance = true;
- if (stillGoing) {
- stillGoing = innerItr.tryAdvance(createConsumerWrapper(action));
- } else {
- canAdvance = false;
- }
- return canAdvance;
- }
-
- private Consumer<? super T> createConsumerWrapper(Consumer<? super T> action) {
+ private StreamUtils() {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Breaks the stream when the predicate is not met.<br>
+ * Does not evaluate elements after the stream breaks.<br>
+ * This method evaluates the stream.<br>
+ *
+ * @param stream
+ * @param predicate
+ * @return
+ */
+ public static <T> Stream<T> takeWhilePlusOneNoEval(Stream<T> stream, Predicate<T> predicate) {
+ List<T> results = new ArrayList<>();
+ Consumer<T> listAdder = results::add;
+ stream.map(e -> {
+ listAdder.accept(e);
+ return e;
+ }).filter(e -> !predicate.test(e)).findFirst();
+ return results.stream();
+ }
+
+ public static <T> Stream<T> takeWhile(Stream<T> stream, Predicate<T> predicate) {
+ return StreamSupport.stream(takeWhile(stream.spliterator(), predicate), false);
+ }
+
+ public static <T> Stream<T> takeWhilePlusOne(Stream<T> stream, Predicate<T> predicate) {
+ return StreamSupport.stream(takeWhile(stream.spliterator(), new StopAfterFailPredicate<>(predicate)), false);
+ }
+
+ private static <T> Spliterator<T> takeWhile(Spliterator<T> splitr, Predicate<T> predicate) {
+ return new MySplitIterator<>(splitr, predicate);
+ }
+
+ public static class MySplitIterator<T> extends AbstractSpliterator<T> implements Spliterator<T> {
+ private boolean stillGoing = true;
+ private Spliterator<T> innerItr;
+ private Predicate<T> innerPred;
+
+ private MySplitIterator(Spliterator<T> splitItr, Predicate<T> pred) {
+ super(splitItr.estimateSize(), 0);
+ innerItr = splitItr;
+ innerPred = pred;
+ }
+
+ @Override
+ public boolean tryAdvance(Consumer<? super T> action) {
+ boolean canAdvance = true;
+ if (stillGoing) {
+ stillGoing = innerItr.tryAdvance(createConsumerWrapper(action));
+ } else {
+ canAdvance = false;
+ }
+ return canAdvance;
+ }
+
+ private Consumer<? super T> createConsumerWrapper(Consumer<? super T> action) {
return new Consumer<T>() {
@Override
@@ -105,31 +104,31 @@ public final class StreamUtils {
}
};
- }
-
- }
-
- public static class StopAfterFailPredicate<T> implements Predicate<T> {
- boolean hasNotFailed;
- Predicate<T> innerPredicate;
-
- private StopAfterFailPredicate(Predicate<T> pred) {
- hasNotFailed = true;
- innerPredicate = pred;
- };
-
- @Override
- public boolean test(T t) {
- boolean isPassed;
- if (hasNotFailed) {
- isPassed = true;
- hasNotFailed = innerPredicate.test(t);
- } else {
- isPassed = false;
- }
- return isPassed;
- }
-
- }
+ }
+
+ }
+
+ public static class StopAfterFailPredicate<T> implements Predicate<T> {
+ private boolean hasNotFailed;
+ private Predicate<T> innerPredicate;
+
+ private StopAfterFailPredicate(Predicate<T> pred) {
+ hasNotFailed = true;
+ innerPredicate = pred;
+ }
+
+ @Override
+ public boolean test(T t) {
+ boolean isPassed;
+ if (hasNotFailed) {
+ isPassed = true;
+ hasNotFailed = innerPredicate.test(t);
+ } else {
+ isPassed = false;
+ }
+ return isPassed;
+ }
+
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/util/ThreadLocalsHolder.java b/common-app-api/src/main/java/org/openecomp/sdc/common/util/ThreadLocalsHolder.java
index 92e0c07a4f..dcba5711d1 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/util/ThreadLocalsHolder.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/util/ThreadLocalsHolder.java
@@ -7,9 +7,9 @@
* 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.
@@ -22,42 +22,37 @@ package org.openecomp.sdc.common.util;
public class ThreadLocalsHolder {
- private static final ThreadLocal<String> uuidThreadLocal = new ThreadLocal<>();
- private static final ThreadLocal<Long> requestStartTimeThreadLocal = new ThreadLocal<>();
- private static final ThreadLocal<Boolean> isMdcProcessedThreadLocal = new ThreadLocal<Boolean>() {
- @Override
- protected Boolean initialValue() {
- return false;
- }
- };
-
- public static void setMdcProcessed(Boolean isMdcProcessed) {
- isMdcProcessedThreadLocal.set(isMdcProcessed);
- }
-
- public static void setUuid(String uuid) {
- uuidThreadLocal.set(uuid);
- }
-
- public static void setRequestStartTime(Long requestStartTime) {
- requestStartTimeThreadLocal.set(requestStartTime);
- }
-
- public static String getUuid() {
- return uuidThreadLocal.get();
- }
-
- public static Long getRequestStartTime() {
- return requestStartTimeThreadLocal.get();
- }
-
- public static Boolean isMdcProcessed() {
- return isMdcProcessedThreadLocal.get();
- }
-
- public static void cleanup() {
- uuidThreadLocal.remove();
- requestStartTimeThreadLocal.remove();
- isMdcProcessedThreadLocal.remove();
- }
+ private static final ThreadLocal<String> UUID_THREAD_LOCAL = new ThreadLocal<>();
+ private static final ThreadLocal<Long> REQUEST_START_TIME_THREAD_LOCAL = new ThreadLocal<>();
+ private static final ThreadLocal<Boolean> IS_MDC_PROCESSED_THREAD_LOCAL = ThreadLocal.withInitial(() -> false);
+
+ public static void setMdcProcessed(Boolean isMdcProcessed) {
+ IS_MDC_PROCESSED_THREAD_LOCAL.set(isMdcProcessed);
+ }
+
+ public static void setUuid(String uuid) {
+ UUID_THREAD_LOCAL.set(uuid);
+ }
+
+ public static void setRequestStartTime(Long requestStartTime) {
+ REQUEST_START_TIME_THREAD_LOCAL.set(requestStartTime);
+ }
+
+ public static String getUuid() {
+ return UUID_THREAD_LOCAL.get();
+ }
+
+ public static Long getRequestStartTime() {
+ return REQUEST_START_TIME_THREAD_LOCAL.get();
+ }
+
+ public static Boolean isMdcProcessed() {
+ return IS_MDC_PROCESSED_THREAD_LOCAL.get();
+ }
+
+ public static void cleanup() {
+ UUID_THREAD_LOCAL.remove();
+ REQUEST_START_TIME_THREAD_LOCAL.remove();
+ IS_MDC_PROCESSED_THREAD_LOCAL.remove();
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/util/ValidationUtils.java b/common-app-api/src/main/java/org/openecomp/sdc/common/util/ValidationUtils.java
index adfa457166..6633148485 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/util/ValidationUtils.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/util/ValidationUtils.java
@@ -7,9 +7,9 @@
* 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.
@@ -27,530 +27,529 @@ import org.apache.commons.lang3.math.NumberUtils;
import org.apache.commons.lang3.text.WordUtils;
import org.apache.commons.validator.routines.UrlValidator;
import org.jsoup.Jsoup;
-import org.jsoup.helper.StringUtil;
import org.jsoup.safety.Whitelist;
-import java.util.*;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
import java.util.regex.Pattern;
public class ValidationUtils {
- public final static Integer COMPONENT_NAME_MAX_LENGTH = 1024;
- public final static Pattern COMPONENT_NAME_PATTERN = Pattern
- .compile("^[\\w][\\w \\.\\-\\_\\:\\+]{0," + (COMPONENT_NAME_MAX_LENGTH-1) + "}$");
- public final static Integer ADDITIONAL_INFORMATION_KEY_MAX_LENGTH = 50;
- public final static Pattern ADDITIONAL_INFORMATION_KEY_PATTERN = Pattern
- .compile("^[\\w\\s\\.\\-\\_]{1," + COMPONENT_NAME_MAX_LENGTH + "}$");
- public final static Integer RSI_NAME_MAX_LENGTH = 1024;
- public final static Pattern RSI_NAME_PATTERN = Pattern
- .compile("^[\\w \\s\\.\\-\\_\\:\\+]{1," + RSI_NAME_MAX_LENGTH + "}$");
- public final static Integer COMMENT_MAX_LENGTH = 256;
-
- public final static Integer ICON_MAX_LENGTH = 25;
- public final static Pattern ICON_PATTERN = Pattern.compile("^[\\w\\-]{1," + ICON_MAX_LENGTH + "}$");
- public final static Integer PROJECT_CODE_MAX_LEGTH = 50;
- public final static Pattern PROJECT_CODE_PATTERN = Pattern.compile("^[\\s\\w_.-]{5,50}$");
-
- // USER_ID format : aannnX (where a=a-z or A-Z, n=0-9, and X=a-z,A-Z, or 0-9)
- public final static Integer CONNTACT_ID_MAX_LENGTH = 50;
-// public final static Pattern CONTACT_ID_PATTERN = Pattern
-// .compile("[mM]{1}[0-9]{5}|[a-zA-Z]{2}[0-9]{4}|[a-zA-Z]{2}[0-9]{3}[a-zA-Z]{1}");
- public final static Pattern CONTACT_ID_PATTERN = Pattern.compile("^[\\s\\w_.-]{1,50}$");
- public final static Pattern OCTET_PATTERN = Pattern.compile("%[a-fA-F0-9]{2}");
- public final static Pattern NONE_UTF8_PATTERN = Pattern.compile("[^\\x00-\\x7F]+");
- public final static Pattern URL_INVALIDE_PATTERN = Pattern.compile("[,#?&@$<>~^`\\\\\\[\\]{}|\")(*!+=;%]+");// ,#?&@$<>~^`\\[]{}|")(*!
-
- public final static Pattern ENGLISH_PATTERN = Pattern.compile("^[\\p{Graph}\\x20]+$");
- public final static Integer COMPONENT_DESCRIPTION_MAX_LENGTH = 1024;
- public final static Integer SERVICE_TYPE_MAX_LENGTH = 400;
- public final static Integer SERVICE_ROLE_MAX_LENGTH = 400;
-
- public final static Integer TAG_MAX_LENGTH = 1024;
- public final static Integer TAG_LIST_MAX_LENGTH = 1024;
- public final static Integer VENDOR_NAME_MAX_LENGTH = 60;
- public final static Pattern VENDOR_NAME_PATTERN = Pattern
- .compile("^[\\x20-\\x21\\x23-\\x29\\x2B-\\x2E\\x30-\\x39\\x3B\\x3D\\x40-\\x5B\\x5D-\\x7B\\x7D-\\xFF]+$");
- public final static Integer VENDOR_RELEASE_MAX_LENGTH = 25;
- public final static Pattern VENDOR_RELEASE_PATTERN = Pattern
- .compile("^[\\x20-\\x21\\x23-\\x29\\x2B-\\x2E\\x30-\\x39\\x3B\\x3D\\x40-\\x5B\\x5D-\\x7B\\x7D-\\xFF]+$");
- public final static Integer RESOURCE_VENDOR_MODEL_NUMBER_MAX_LENGTH = 65;
-
- public final static Pattern CLEAN_FILENAME_PATTERN = Pattern.compile("[\\x00-\\x1f\\x80-\\x9f\\x5c/<?>\\*:|\"/]+");
-
- public final static Pattern DASH_PATTERN = Pattern.compile("[-]+");
- public final static Pattern UNDERSCORE_PATTERN = Pattern.compile("[_]+");
- public final static Pattern PLUS_PATTERN = Pattern.compile("[+]+");
- public final static Pattern SPACE_PATTERN = Pattern.compile("[ ]+");
- public final static Pattern AMP_PATTERN = Pattern.compile("[&]+");
- public final static Pattern DOT_PATTERN = Pattern.compile("[\\.]+");
- public final static Pattern APOST_PATTERN = Pattern.compile("[']+");
- public final static Pattern HASHTAG_PATTERN = Pattern.compile("[#]+");
- public final static Pattern EQUAL_PATTERN = Pattern.compile("[=]+");
- public final static Pattern COLON_PATTERN = Pattern.compile("[:]+");
- public final static Pattern AT_PATTERN = Pattern.compile("[@]+");
- public final static Pattern AND_PATTERN = Pattern.compile(" [aA][Nn][Dd] ");
- public final static Set<String> CATEGORY_CONJUNCTIONS = new HashSet<>(
+ public static final Integer COMPONENT_NAME_MAX_LENGTH = 1024;
+ public static final Pattern COMPONENT_NAME_PATTERN = Pattern
+ .compile("^[\\w][\\w \\.\\-\\_\\:\\+]{0," + (COMPONENT_NAME_MAX_LENGTH - 1) + "}$");
+ public static final Integer ADDITIONAL_INFORMATION_KEY_MAX_LENGTH = 50;
+ public static final Pattern ADDITIONAL_INFORMATION_KEY_PATTERN = Pattern
+ .compile("^[\\w\\s\\.\\-\\_]{1," + COMPONENT_NAME_MAX_LENGTH + "}$");
+ public static final Integer RSI_NAME_MAX_LENGTH = 1024;
+ public static final Pattern RSI_NAME_PATTERN = Pattern
+ .compile("^[\\w \\s\\.\\-\\_\\:\\+]{1," + RSI_NAME_MAX_LENGTH + "}$");
+ public static final Integer COMMENT_MAX_LENGTH = 256;
+
+ public static final Integer ICON_MAX_LENGTH = 25;
+ public static final Pattern ICON_PATTERN = Pattern.compile("^[\\w\\-]{1," + ICON_MAX_LENGTH + "}$");
+ public static final Integer PROJECT_CODE_MAX_LEGTH = 50;
+ public static final Pattern PROJECT_CODE_PATTERN = Pattern.compile("^[\\s\\w_.-]{5,50}$");
+
+ public static final Integer CONNTACT_ID_MAX_LENGTH = 50;
+ public static final Pattern CONTACT_ID_PATTERN = Pattern.compile("^[\\s\\w_.-]{1,50}$");
+ public static final Pattern OCTET_PATTERN = Pattern.compile("%[a-fA-F0-9]{2}");
+ public static final Pattern NONE_UTF8_PATTERN = Pattern.compile("[^\\x00-\\x7F]+");
+ public static final Pattern URL_INVALIDE_PATTERN = Pattern.compile("[,#?&@$<>~^`\\\\\\[\\]{}|\")(*!+=;%]+"); // ,#?&@$<>~^`\\[]{}|")(*!
+
+ public static final Pattern ENGLISH_PATTERN = Pattern.compile("^[\\p{Graph}\\x20]+$");
+ public static final Integer COMPONENT_DESCRIPTION_MAX_LENGTH = 1024;
+ public static final Integer SERVICE_TYPE_MAX_LENGTH = 400;
+ public static final Integer SERVICE_ROLE_MAX_LENGTH = 400;
+
+ public static final Integer TAG_MAX_LENGTH = 1024;
+ public static final Integer TAG_LIST_MAX_LENGTH = 1024;
+ public static final Integer VENDOR_NAME_MAX_LENGTH = 60;
+ public static final Pattern VENDOR_NAME_PATTERN = Pattern
+ .compile("^[\\x20-\\x21\\x23-\\x29\\x2B-\\x2E\\x30-\\x39\\x3B\\x3D\\x40-\\x5B\\x5D-\\x7B\\x7D-\\xFF]+$");
+ public static final Integer VENDOR_RELEASE_MAX_LENGTH = 25;
+ public static final Pattern VENDOR_RELEASE_PATTERN = Pattern
+ .compile("^[\\x20-\\x21\\x23-\\x29\\x2B-\\x2E\\x30-\\x39\\x3B\\x3D\\x40-\\x5B\\x5D-\\x7B\\x7D-\\xFF]+$");
+ public static final Integer RESOURCE_VENDOR_MODEL_NUMBER_MAX_LENGTH = 65;
+
+ public static final Pattern CLEAN_FILENAME_PATTERN = Pattern.compile("[\\x00-\\x1f\\x80-\\x9f\\x5c/<?>\\*:|\"/]+");
+
+ public static final Pattern DASH_PATTERN = Pattern.compile("[-]+");
+ public static final Pattern UNDERSCORE_PATTERN = Pattern.compile("[_]+");
+ public static final Pattern PLUS_PATTERN = Pattern.compile("[+]+");
+ public static final Pattern SPACE_PATTERN = Pattern.compile("[ ]+");
+ public static final Pattern AMP_PATTERN = Pattern.compile("[&]+");
+ public static final Pattern DOT_PATTERN = Pattern.compile("[\\.]+");
+ public static final Pattern APOST_PATTERN = Pattern.compile("[']+");
+ public static final Pattern HASHTAG_PATTERN = Pattern.compile("[#]+");
+ public static final Pattern EQUAL_PATTERN = Pattern.compile("[=]+");
+ public static final Pattern COLON_PATTERN = Pattern.compile("[:]+");
+ public static final Pattern AT_PATTERN = Pattern.compile("[@]+");
+ public static final Pattern AND_PATTERN = Pattern.compile(" [aA][Nn][Dd] ");
+ public static final Set<String> CATEGORY_CONJUNCTIONS = new HashSet<>(
Arrays.asList("of", "to", "for", "as", "a", "an", "the"));
- public final static Pattern COST_PATTERN = Pattern.compile("^[0-9]{1,5}\\.[0-9]{1,3}$");
- public final static Pattern ARTIFACT_LABEL_PATTERN = Pattern.compile("^[a-zA-Z0-9 \\-+]+$");
- public final static Integer ARTIFACT_LABEL_LENGTH = 255;
- public final static Pattern ARTIFACT_DISPLAY_NAME_PATTERN = Pattern.compile("^[a-zA-Z0-9][a-zA-Z0-9 &\\.'#=:@_\\-+]+$");
- public final static Pattern CATEGORY_LABEL_PATTERN = Pattern.compile("^[a-zA-Z0-9][a-zA-Z0-9 &\\.'#=:@_\\-+]+$");
- public final static Integer CATEGORY_LABEL_MIN_LENGTH = 3;
- public final static Integer CATEGORY_LABEL_MAX_LENGTH = 25;
-
- public final static Pattern COMPONENT_NAME_DELIMETER_PATTERN = Pattern.compile("[\\.\\-\\_]+");
- public final static Pattern COMPONENT_INCTANCE_NAME_DELIMETER_PATTERN = Pattern.compile("[\\.\\-]+");
- public final static Pattern PRODUCT_NAME_DELIMETER_PATTERN = Pattern.compile("[\\.\\-\\_&=#@':\\[\\]\\+]+");
- public final static Integer CONSUMER_NAME_MAX_LENGTH = 255;
- // public final static Pattern CONSUMER_NAME_PATTERN =
- // Pattern.compile("^[\\w]{1}?[\\w\\.\\-]{0," + CONSUMER_NAME_MAX_LENGTH +
- // "}?$");
- public final static Pattern CONSUMER_NAME_PATTERN = Pattern.compile("^[\\w]+[\\w\\.\\-]*$");
- public final static Integer CONSUMER_SALT_LENGTH = 32;
- public final static Integer CONSUMER_PASSWORD_LENGTH = 64;
- public final static Pattern CONSUMER_PASS_SALT_PATTERN = Pattern.compile("^[a-z0-9]+$");
- public final static Pattern FLOAT_PATTERN = Pattern.compile("^[\\d]+[\\.]{1}[\\d]+$");
- public final static Pattern CERTIFIED_VERSION_PATTERN = Pattern.compile("^[1-9][0-9]*\\.0$");
- public final static Pattern MINOR_VERSION_PATTERN = Pattern.compile("^0\\.[1-9][0-9]*$");
- public final static Pattern TAGS_PATTERN = Pattern.compile("<[^><]*>");
-
- public final static Integer ARTIFACT_NAME_LENGTH = 255;
- public final static Integer API_URL_LENGTH = 100;
- public final static Integer ARTIFACT_DESCRIPTION_MAX_LENGTH = 256;
-
- public final static Integer PRODUCT_FULL_NAME_MIN_LENGTH = 4;
- public final static Integer PRODUCT_FULL_NAME_MAX_LENGTH = 100;
- public static final Integer FORWARDING_PATH_NAME_MAX_LENGTH = 100;
- public final static Pattern FORWARDING_PATH_NAME_PATTERN = Pattern.compile("^[\\w][\\w \\.\\-\\_\\:\\+]{0," + (FORWARDING_PATH_NAME_MAX_LENGTH-1) + "}$");
-
- public final static Integer POLICY_MAX_LENGTH = 1024;
- public final static Pattern POLICY_NAME_PATTERN = Pattern
- .compile("^[\\w][\\w \\.\\-\\_\\:\\+]{0," + (POLICY_MAX_LENGTH-1) + "}$");
-
- public static boolean validateArtifactLabel(String label) {
- return ARTIFACT_LABEL_PATTERN.matcher(label).matches();
- }
-
- public static boolean validateArtifactDisplayName(String displayName) {
- return ARTIFACT_DISPLAY_NAME_PATTERN.matcher(displayName).matches();
- }
-
- public static boolean validateCategoryDisplayNameFormat(String label) {
- boolean res = true;
- if (label != null) {
- label = label.trim();
- res = CATEGORY_LABEL_PATTERN.matcher(label).matches();
- }
- return res;
- }
-
- public static String normalizeCategoryName4Display(String str) {
- if (str != null) {
- str = str.trim();
- str = DASH_PATTERN.matcher(str).replaceAll("-");
- str = UNDERSCORE_PATTERN.matcher(str).replaceAll("_");
- str = AMP_PATTERN.matcher(str).replaceAll("&");
- str = PLUS_PATTERN.matcher(str).replaceAll("+");
- str = DOT_PATTERN.matcher(str).replaceAll(".");
- str = APOST_PATTERN.matcher(str).replaceAll("'");
- str = HASHTAG_PATTERN.matcher(str).replaceAll("#");
- str = EQUAL_PATTERN.matcher(str).replaceAll("=");
- str = COLON_PATTERN.matcher(str).replaceAll(":");
- str = AT_PATTERN.matcher(str).replaceAll("@");
- str = normaliseWhitespace(str);
- str = AND_PATTERN.matcher(str).replaceAll(" & ");
-
- // Case normalizing
- StringBuilder sb = new StringBuilder();
- String[] split = str.split(" ");
- for (int i = 0; i < split.length; i++) {
- String splitted = split[i];
- String lowerCase = splitted.toLowerCase();
- // BANK OF AMERICA --> BANK of AMERICA ("of" is lowercased), but
- // OF BANK OF AMERICA --> OF BANK of AMERICA (first "OF" is not
- // lowercased because it's first word)
- // Agreed with Ella, 26/11/15
- if ((i > 0) && CATEGORY_CONJUNCTIONS.contains(lowerCase)) {
- sb.append(lowerCase);
- } else {
- sb.append(WordUtils.capitalize(splitted));
- }
- sb.append(" ");
- }
- str = sb.toString().trim();
- }
- return str;
- }
-
- public static String normalizeCategoryName4Uniqueness(String str) {
- return str.toLowerCase();
- }
-
- public static boolean validateCategoryDisplayNameLength(String label) {
- return (label != null && label.length() >= CATEGORY_LABEL_MIN_LENGTH
- && label.length() <= CATEGORY_LABEL_MAX_LENGTH);
- }
-
- public static boolean validateProductFullNameLength(String fullName) {
- return (fullName != null && fullName.length() >= PRODUCT_FULL_NAME_MIN_LENGTH
- && fullName.length() <= PRODUCT_FULL_NAME_MAX_LENGTH);
- }
-
- public static boolean validateArtifactLabelLength(String label) {
- return label.length() > 0 && label.length() <= ARTIFACT_LABEL_LENGTH;
- }
-
- public static boolean validateResourceInstanceNameLength(String resourceInstanceName) {
- return resourceInstanceName.length() <= RSI_NAME_MAX_LENGTH;
- }
-
- public static boolean validateResourceInstanceName(String resourceInstanceName) {
- return RSI_NAME_PATTERN.matcher(resourceInstanceName).matches();
- }
-
- public static boolean validateUrlLength(String url) {
- return url.length() <= API_URL_LENGTH;
- }
-
- public static boolean validateArtifactNameLength(String artifactName) {
- return (artifactName.length() <= ARTIFACT_NAME_LENGTH && artifactName.length() > 0);
- }
-
- public static boolean validateComponentNamePattern(String componentName) {
- return COMPONENT_NAME_PATTERN.matcher(componentName).matches();
- }
-
- public static boolean validateComponentNameLength(String componentName) {
- return componentName.length() <= COMPONENT_NAME_MAX_LENGTH;
- }
-
- public static boolean validateIcon(String icon) {
- return ICON_PATTERN.matcher(icon).matches();
- }
-
- public static boolean validateIconLength(String icon) {
- return icon.length() <= ICON_MAX_LENGTH;
- }
-
- public static boolean validateProjectCode(String projectCode) {
- return PROJECT_CODE_PATTERN.matcher(projectCode).matches();
- }
-
- public static boolean validateProjectCodeLegth(String projectCode) {
- return projectCode.length() <= PROJECT_CODE_MAX_LEGTH;
- }
-
- public static boolean validateContactId(String contactId) {
- return CONTACT_ID_PATTERN.matcher(contactId).matches();
- }
-
- public static boolean validateCost(String cost) {
- return COST_PATTERN.matcher(cost).matches();
- }
-
- public static String removeHtmlTags(String str) {
- return Jsoup.clean(str, Whitelist.none());
- }
-
- public static String removeAllTags(String htmlText) {
+ public static final Pattern COST_PATTERN = Pattern.compile("^[0-9]{1,5}\\.[0-9]{1,3}$");
+ public static final Pattern ARTIFACT_LABEL_PATTERN = Pattern.compile("^[a-zA-Z0-9 \\-+]+$");
+ public static final Integer ARTIFACT_LABEL_LENGTH = 255;
+ public static final Pattern ARTIFACT_DISPLAY_NAME_PATTERN = Pattern.compile("^[a-zA-Z0-9][a-zA-Z0-9 &\\.'#=:@_\\-+]+$");
+ public static final Pattern CATEGORY_LABEL_PATTERN = Pattern.compile("^[a-zA-Z0-9][a-zA-Z0-9 &\\.'#=:@_\\-+]+$");
+ public static final Integer CATEGORY_LABEL_MIN_LENGTH = 3;
+ public static final Integer CATEGORY_LABEL_MAX_LENGTH = 25;
+
+ public static final Pattern COMPONENT_NAME_DELIMETER_PATTERN = Pattern.compile("[\\.\\-\\_]+");
+ public static final Pattern COMPONENT_INCTANCE_NAME_DELIMETER_PATTERN = Pattern.compile("[\\.\\-]+");
+ public static final Pattern PRODUCT_NAME_DELIMETER_PATTERN = Pattern.compile("[\\.\\-\\_&=#@':\\[\\]\\+]+");
+ public static final Integer CONSUMER_NAME_MAX_LENGTH = 255;
+ // public static final Pattern CONSUMER_NAME_PATTERN =
+ // Pattern.compile("^[\\w]{1}?[\\w\\.\\-]{0," + CONSUMER_NAME_MAX_LENGTH +
+ // "}?$");
+ public static final Pattern CONSUMER_NAME_PATTERN = Pattern.compile("^[\\w]+[\\w\\.\\-]*$");
+ public static final Integer CONSUMER_SALT_LENGTH = 32;
+ public static final Integer CONSUMER_PASSWORD_LENGTH = 64;
+ public static final Pattern CONSUMER_PASS_SALT_PATTERN = Pattern.compile("^[a-z0-9]+$");
+ public static final Pattern FLOAT_PATTERN = Pattern.compile("^[\\d]+[\\.]{1}[\\d]+$");
+ public static final Pattern CERTIFIED_VERSION_PATTERN = Pattern.compile("^[1-9][0-9]*\\.0$");
+ public static final Pattern MINOR_VERSION_PATTERN = Pattern.compile("^0\\.[1-9][0-9]*$");
+ public static final Pattern TAGS_PATTERN = Pattern.compile("<[^><]*>");
+
+ public static final Integer ARTIFACT_NAME_LENGTH = 255;
+ public static final Integer API_URL_LENGTH = 100;
+ public static final Integer ARTIFACT_DESCRIPTION_MAX_LENGTH = 256;
+
+ public static final Integer PRODUCT_FULL_NAME_MIN_LENGTH = 4;
+ public static final Integer PRODUCT_FULL_NAME_MAX_LENGTH = 100;
+ public static final Integer FORWARDING_PATH_NAME_MAX_LENGTH = 100;
+ public static final Pattern FORWARDING_PATH_NAME_PATTERN = Pattern.compile("^[\\w][\\w \\.\\-\\_\\:\\+]{0," + (FORWARDING_PATH_NAME_MAX_LENGTH - 1) + "}$");
+
+ public static final Integer POLICY_MAX_LENGTH = 1024;
+ public static final Pattern POLICY_NAME_PATTERN = Pattern
+ .compile("^[\\w][\\w \\.\\-\\_\\:\\+]{0," + (POLICY_MAX_LENGTH - 1) + "}$");
+
+ public static boolean validateArtifactLabel(String label) {
+ return ARTIFACT_LABEL_PATTERN.matcher(label).matches();
+ }
+
+ public static boolean validateArtifactDisplayName(String displayName) {
+ return ARTIFACT_DISPLAY_NAME_PATTERN.matcher(displayName).matches();
+ }
+
+ public static boolean validateCategoryDisplayNameFormat(String label) {
+ boolean res = true;
+ if (label != null) {
+ label = label.trim();
+ res = CATEGORY_LABEL_PATTERN.matcher(label).matches();
+ }
+ return res;
+ }
+
+ public static String normalizeCategoryName4Display(String str) {
+ if (str != null) {
+ str = str.trim();
+ str = DASH_PATTERN.matcher(str).replaceAll("-");
+ str = UNDERSCORE_PATTERN.matcher(str).replaceAll("_");
+ str = AMP_PATTERN.matcher(str).replaceAll("&");
+ str = PLUS_PATTERN.matcher(str).replaceAll("+");
+ str = DOT_PATTERN.matcher(str).replaceAll(".");
+ str = APOST_PATTERN.matcher(str).replaceAll("'");
+ str = HASHTAG_PATTERN.matcher(str).replaceAll("#");
+ str = EQUAL_PATTERN.matcher(str).replaceAll("=");
+ str = COLON_PATTERN.matcher(str).replaceAll(":");
+ str = AT_PATTERN.matcher(str).replaceAll("@");
+ str = normaliseWhitespace(str);
+ str = AND_PATTERN.matcher(str).replaceAll(" & ");
+
+ // Case normalizing
+ StringBuilder sb = new StringBuilder();
+ String[] split = str.split(" ");
+ for (int i = 0; i < split.length; i++) {
+ String splitted = split[i];
+ String lowerCase = splitted.toLowerCase();
+ // BANK OF AMERICA --> BANK of AMERICA ("of" is lowercased), but
+ // OF BANK OF AMERICA --> OF BANK of AMERICA (first "OF" is not
+ // lowercased because it's first word)
+ // Agreed with Ella, 26/11/15
+ if ((i > 0) && CATEGORY_CONJUNCTIONS.contains(lowerCase)) {
+ sb.append(lowerCase);
+ } else {
+ sb.append(WordUtils.capitalize(splitted));
+ }
+ sb.append(" ");
+ }
+ str = sb.toString().trim();
+ }
+ return str;
+ }
+
+ public static String normalizeCategoryName4Uniqueness(String str) {
+ return str.toLowerCase();
+ }
+
+ public static boolean validateCategoryDisplayNameLength(String label) {
+ return (label != null && label.length() >= CATEGORY_LABEL_MIN_LENGTH
+ && label.length() <= CATEGORY_LABEL_MAX_LENGTH);
+ }
+
+ public static boolean validateProductFullNameLength(String fullName) {
+ return (fullName != null && fullName.length() >= PRODUCT_FULL_NAME_MIN_LENGTH
+ && fullName.length() <= PRODUCT_FULL_NAME_MAX_LENGTH);
+ }
+
+ public static boolean validateArtifactLabelLength(String label) {
+ return label.length() > 0 && label.length() <= ARTIFACT_LABEL_LENGTH;
+ }
+
+ public static boolean validateResourceInstanceNameLength(String resourceInstanceName) {
+ return resourceInstanceName.length() <= RSI_NAME_MAX_LENGTH;
+ }
+
+ public static boolean validateResourceInstanceName(String resourceInstanceName) {
+ return RSI_NAME_PATTERN.matcher(resourceInstanceName).matches();
+ }
+
+ public static boolean validateUrlLength(String url) {
+ return url.length() <= API_URL_LENGTH;
+ }
+
+ public static boolean validateArtifactNameLength(String artifactName) {
+ return (artifactName.length() <= ARTIFACT_NAME_LENGTH && artifactName.length() > 0);
+ }
+
+ public static boolean validateComponentNamePattern(String componentName) {
+ return COMPONENT_NAME_PATTERN.matcher(componentName).matches();
+ }
+
+ public static boolean validateComponentNameLength(String componentName) {
+ return componentName.length() <= COMPONENT_NAME_MAX_LENGTH;
+ }
+
+ public static boolean validateIcon(String icon) {
+ return ICON_PATTERN.matcher(icon).matches();
+ }
+
+ public static boolean validateIconLength(String icon) {
+ return icon.length() <= ICON_MAX_LENGTH;
+ }
+
+ public static boolean validateProjectCode(String projectCode) {
+ return PROJECT_CODE_PATTERN.matcher(projectCode).matches();
+ }
+
+ public static boolean validateProjectCodeLegth(String projectCode) {
+ return projectCode.length() <= PROJECT_CODE_MAX_LEGTH;
+ }
+
+ public static boolean validateContactId(String contactId) {
+ return CONTACT_ID_PATTERN.matcher(contactId).matches();
+ }
+
+ public static boolean validateCost(String cost) {
+ return COST_PATTERN.matcher(cost).matches();
+ }
+
+ public static String removeHtmlTags(String str) {
+ return Jsoup.clean(str, Whitelist.none());
+ }
+
+ public static String removeAllTags(String htmlText) {
return TAGS_PATTERN.matcher(htmlText).replaceAll("").trim();
- }
-
- public static String normaliseWhitespace(String str) {
- StringBuilder sb = new StringBuilder(str.length());
- appendNormalisedWhitespace(sb, str, false);
- return sb.toString();
- }
-
- private static void appendNormalisedWhitespace(StringBuilder accum, String string, boolean stripLeading) {
- boolean lastWasWhite = false;
- boolean reachedNonWhite = false;
-
- int len = string.length();
- int c;
- for (int i = 0; i < len; i+= Character.charCount(c)) {
- c = string.codePointAt(i);
- if (isWhitespace(c)) {
- if ((stripLeading && !reachedNonWhite) || lastWasWhite)
- continue;
- accum.append(' ');
- lastWasWhite = true;
- }
- else {
- accum.appendCodePoint(c);
- lastWasWhite = false;
- reachedNonWhite = true;
- }
- }
- }
-
- private static boolean isWhitespace(int c){
- return c == ' ';
- }
-
- public static String stripOctets(String str) {
- return OCTET_PATTERN.matcher(str).replaceAll("");
- }
-
- public static String removeNoneUtf8Chars(String input) {
- return NONE_UTF8_PATTERN.matcher(input).replaceAll("");
- }
-
- public static boolean validateIsEnglish(String input) {
- return ENGLISH_PATTERN.matcher(input).matches();
- }
-
- public static boolean validateIsAscii(String input) {
+ }
+
+ public static String normaliseWhitespace(String str) {
+ StringBuilder sb = new StringBuilder(str.length());
+ appendNormalisedWhitespace(sb, str, false);
+ return sb.toString();
+ }
+
+ private static void appendNormalisedWhitespace(StringBuilder accum, String string, boolean stripLeading) {
+ boolean lastWasWhite = false;
+ boolean reachedNonWhite = false;
+
+ int len = string.length();
+ int c;
+ for (int i = 0; i < len; i += Character.charCount(c)) {
+ c = string.codePointAt(i);
+ if (isWhitespace(c)) {
+ if ((stripLeading && !reachedNonWhite) || lastWasWhite) {
+ continue;
+ }
+ accum.append(' ');
+ lastWasWhite = true;
+ } else {
+ accum.appendCodePoint(c);
+ lastWasWhite = false;
+ reachedNonWhite = true;
+ }
+ }
+ }
+
+ private static boolean isWhitespace(int c) {
+ return c == ' ';
+ }
+
+ public static String stripOctets(String str) {
+ return OCTET_PATTERN.matcher(str).replaceAll("");
+ }
+
+ public static String removeNoneUtf8Chars(String input) {
+ return NONE_UTF8_PATTERN.matcher(input).replaceAll("");
+ }
+
+ public static boolean validateIsEnglish(String input) {
+ return ENGLISH_PATTERN.matcher(input).matches();
+ }
+
+ public static boolean validateIsAscii(String input) {
return CharMatcher.ASCII.matchesAllOf(input);
- }
-
- public static String convertHtmlTagsToEntities(String input) {
- return StringEscapeUtils.escapeHtml4(input);
- }
-
- public static List<String> removeDuplicateFromList(List<String> list) {
- Set<String> hs = new LinkedHashSet<>(list);
- list.clear();
- list.addAll(hs);
- return list;
-
- }
-
- public static boolean validateTagLength(String tag) {
- if (tag != null) {
- return tag.length() <= TAG_MAX_LENGTH;
- }
- return false;
- }
-
- public static boolean validateTagListLength(int tagListLength) {
- return tagListLength <= TAG_LIST_MAX_LENGTH;
- }
-
- public static boolean validateDescriptionLength(String description) {
- return description.length() <= COMPONENT_DESCRIPTION_MAX_LENGTH;
- }
-
- public static boolean validateStringNotEmpty(String value) {
- if ((value == null) || (value.isEmpty())) {
- return false;
- }
- return true;
- }
-
- public static boolean validateListNotEmpty(List<?> list) {
- if ((list == null) || (list.isEmpty())) {
- return false;
- }
- return true;
- }
-
- public static boolean validateVendorName(String vendorName) {
- return VENDOR_NAME_PATTERN.matcher(vendorName).matches();
- }
-
- public static boolean validateVendorNameLength(String vendorName) {
- return vendorName.length() <= VENDOR_NAME_MAX_LENGTH;
- }
-
- public static boolean validateResourceVendorModelNumberLength(String resourceVendorModelNumber) {
- return resourceVendorModelNumber.length() <= RESOURCE_VENDOR_MODEL_NUMBER_MAX_LENGTH;
- }
-
- public static boolean validateVendorRelease(String vendorRelease) {
- return VENDOR_RELEASE_PATTERN.matcher(vendorRelease).matches();
- }
-
- public static boolean validateVendorReleaseLength(String vendorRelease) {
- return vendorRelease.length() <= VENDOR_RELEASE_MAX_LENGTH;
- }
-
- public static boolean validateServiceTypeLength(String serviceType) {
- return serviceType.length() <= SERVICE_TYPE_MAX_LENGTH;
- }
-
- public static boolean validateServiceRoleLength(String serviceRole) {
- return serviceRole.length() <= SERVICE_ROLE_MAX_LENGTH;
- }
-
-
-
- public static boolean hasBeenCertified(String version) {
- return NumberUtils.toDouble(version) >= 1;
- }
-
- public static String normaliseComponentName(String name) {
- String[] split = splitComponentName(name);
- StringBuffer sb = new StringBuffer();
- for (String splitElement : split) {
- sb.append(splitElement);
- }
- return sb.toString();
-
- }
-
- public static String normalizeComponentInstanceName(String name) {
- String[] split = splitComponentInstanceName(name);
- StringBuffer sb = new StringBuffer();
- for (String splitElement : split) {
- sb.append(splitElement);
- }
- return sb.toString();
-
- }
-
- private static String[] splitComponentName(String name) {
- String normalizedName = name.toLowerCase();
- normalizedName = COMPONENT_NAME_DELIMETER_PATTERN.matcher(normalizedName).replaceAll(" ");
+ }
+
+ public static String convertHtmlTagsToEntities(String input) {
+ return StringEscapeUtils.escapeHtml4(input);
+ }
+
+ public static List<String> removeDuplicateFromList(List<String> list) {
+ Set<String> hs = new LinkedHashSet<>(list);
+ list.clear();
+ list.addAll(hs);
+ return list;
+
+ }
+
+ public static boolean validateTagLength(String tag) {
+ if (tag != null) {
+ return tag.length() <= TAG_MAX_LENGTH;
+ }
+ return false;
+ }
+
+ public static boolean validateTagListLength(int tagListLength) {
+ return tagListLength <= TAG_LIST_MAX_LENGTH;
+ }
+
+ public static boolean validateDescriptionLength(String description) {
+ return description.length() <= COMPONENT_DESCRIPTION_MAX_LENGTH;
+ }
+
+ public static boolean validateStringNotEmpty(String value) {
+ if ((value == null) || (value.isEmpty())) {
+ return false;
+ }
+ return true;
+ }
+
+ public static boolean validateListNotEmpty(List<?> list) {
+ if ((list == null) || (list.isEmpty())) {
+ return false;
+ }
+ return true;
+ }
+
+ public static boolean validateVendorName(String vendorName) {
+ return VENDOR_NAME_PATTERN.matcher(vendorName).matches();
+ }
+
+ public static boolean validateVendorNameLength(String vendorName) {
+ return vendorName.length() <= VENDOR_NAME_MAX_LENGTH;
+ }
+
+ public static boolean validateResourceVendorModelNumberLength(String resourceVendorModelNumber) {
+ return resourceVendorModelNumber.length() <= RESOURCE_VENDOR_MODEL_NUMBER_MAX_LENGTH;
+ }
+
+ public static boolean validateVendorRelease(String vendorRelease) {
+ return VENDOR_RELEASE_PATTERN.matcher(vendorRelease).matches();
+ }
+
+ public static boolean validateVendorReleaseLength(String vendorRelease) {
+ return vendorRelease.length() <= VENDOR_RELEASE_MAX_LENGTH;
+ }
+
+ public static boolean validateServiceTypeLength(String serviceType) {
+ return serviceType.length() <= SERVICE_TYPE_MAX_LENGTH;
+ }
+
+ public static boolean validateServiceRoleLength(String serviceRole) {
+ return serviceRole.length() <= SERVICE_ROLE_MAX_LENGTH;
+ }
+
+
+ public static boolean hasBeenCertified(String version) {
+ return NumberUtils.toDouble(version) >= 1;
+ }
+
+ public static String normaliseComponentName(String name) {
+ String[] split = splitComponentName(name);
+ StringBuffer sb = new StringBuffer();
+ for (String splitElement : split) {
+ sb.append(splitElement);
+ }
+ return sb.toString();
+
+ }
+
+ public static String normalizeComponentInstanceName(String name) {
+ String[] split = splitComponentInstanceName(name);
+ StringBuffer sb = new StringBuffer();
+ for (String splitElement : split) {
+ sb.append(splitElement);
+ }
+ return sb.toString();
+
+ }
+
+ private static String[] splitComponentName(String name) {
+ String normalizedName = name.toLowerCase();
+ normalizedName = COMPONENT_NAME_DELIMETER_PATTERN.matcher(normalizedName).replaceAll(" ");
return normalizedName.split(" ");
- }
+ }
- private static String[] splitComponentInstanceName(String name) {
- String normalizedName = name.toLowerCase();
- normalizedName = COMPONENT_INCTANCE_NAME_DELIMETER_PATTERN.matcher(normalizedName).replaceAll(" ");
+ private static String[] splitComponentInstanceName(String name) {
+ String normalizedName = name.toLowerCase();
+ normalizedName = COMPONENT_INCTANCE_NAME_DELIMETER_PATTERN.matcher(normalizedName).replaceAll(" ");
return normalizedName.split(" ");
- }
-
- public static String convertToSystemName(String name) {
- String[] split = splitComponentName(name);
- StringBuffer sb = new StringBuffer();
- for (String splitElement : split) {
- String capitalize = WordUtils.capitalize(splitElement);
- sb.append(capitalize);
- }
- return sb.toString();
- }
-
- public static String normalizeFileName(String filename) {
- // String[] split = filename.split(Pattern.quote(File.separator));
- // String name = "";
- //
- // name = split[split.length - 1];
- return cleanFileName(filename);
-
- }
-
- private static String cleanFileName(String str) {
- str = CLEAN_FILENAME_PATTERN.matcher(str).replaceAll("");
- str = normaliseWhitespace(str);
- str = SPACE_PATTERN.matcher(str).replaceAll("-");
- str = DASH_PATTERN.matcher(str).replaceAll("-");
- str = StringUtils.strip(str, "-_ .");
-
- return str;
- }
-
- public static boolean validateUrl(String url) {
-
- UrlValidator urlValidator = new UrlValidator();
- if (!urlValidator.isValid(url)) {
- return false;
- }
- if (NONE_UTF8_PATTERN.matcher(url).find()) {
- return false;
- }
-
- if (URL_INVALIDE_PATTERN.matcher(url).find()) {
- return false;
- }
- return true;
-
- }
-
- public static String cleanArtifactDisplayName(String strIn) {
- String str = DASH_PATTERN.matcher(strIn).replaceAll("-");
- str = UNDERSCORE_PATTERN.matcher(str).replaceAll("_");
- str = PLUS_PATTERN.matcher(str).replaceAll("+");
- str = normaliseWhitespace(str);
- str = str.trim();
- // str = str.replaceAll(" ", "");
-
- return str;
- }
-
- public static String normalizeArtifactLabel(String strIn) {
-
- String str = DASH_PATTERN.matcher(strIn).replaceAll("");
- str = UNDERSCORE_PATTERN.matcher(str).replaceAll("");
- str = PLUS_PATTERN.matcher(str).replaceAll("");
- str = SPACE_PATTERN.matcher(str).replaceAll("");
- str = DOT_PATTERN.matcher(str).replaceAll("");
- str = str.toLowerCase();
-
- return str;
- }
-
- public static boolean validateAdditionalInformationKeyName(String str) {
- return ADDITIONAL_INFORMATION_KEY_PATTERN.matcher(str).matches();
- }
-
- public static String normalizeAdditionalInformation(String str) {
- if (str != null) {
- str = DASH_PATTERN.matcher(str).replaceAll("-");
- str = UNDERSCORE_PATTERN.matcher(str).replaceAll("_");
- str = normaliseWhitespace(str);
- }
- return str;
- }
-
- public static boolean validateLength(String str, int length) {
- if (str == null) {
- return true;
- }
- return str.length() <= length;
- }
-
- public static boolean validateConsumerName(String consumerName) {
- return CONSUMER_NAME_PATTERN.matcher(consumerName).matches();
- }
-
- public static boolean isUTF8Str(String str) {
- if (NONE_UTF8_PATTERN.matcher(str).find()) {
- return false;
- }
- return true;
- }
-
- public static boolean validateConsumerPassSalt(String consumerSalt) {
- return CONSUMER_PASS_SALT_PATTERN.matcher(consumerSalt).matches();
- }
-
- public static boolean isFloatNumber(String number) {
- return FLOAT_PATTERN.matcher(number).matches();
- }
-
- public static boolean validateCertifiedVersion(String version) {
- return (version != null && CERTIFIED_VERSION_PATTERN.matcher(version).matches());
- }
-
- public static boolean validateMinorVersion(String version) {
- return (version != null && MINOR_VERSION_PATTERN.matcher(version).matches());
- }
-
- public static String normaliseProductName(String name) {
- String[] split = splitComponentName(PRODUCT_NAME_DELIMETER_PATTERN, name);
- StringBuffer sb = new StringBuffer();
- for (String splitElement : split) {
- sb.append(splitElement);
- }
- return sb.toString();
-
- }
-
- private static String[] splitComponentName(Pattern pattern, String name) {
- String normalizedName = name.toLowerCase();
- normalizedName = pattern.matcher(normalizedName).replaceAll(" ");
+ }
+
+ public static String convertToSystemName(String name) {
+ String[] split = splitComponentName(name);
+ StringBuffer sb = new StringBuffer();
+ for (String splitElement : split) {
+ String capitalize = WordUtils.capitalize(splitElement);
+ sb.append(capitalize);
+ }
+ return sb.toString();
+ }
+
+ public static String normalizeFileName(String filename) {
+ // String[] split = filename.split(Pattern.quote(File.separator));
+ // String name = "";
+ //
+ // name = split[split.length - 1];
+ return cleanFileName(filename);
+
+ }
+
+ private static String cleanFileName(String str) {
+ str = CLEAN_FILENAME_PATTERN.matcher(str).replaceAll("");
+ str = normaliseWhitespace(str);
+ str = SPACE_PATTERN.matcher(str).replaceAll("-");
+ str = DASH_PATTERN.matcher(str).replaceAll("-");
+ str = StringUtils.strip(str, "-_ .");
+
+ return str;
+ }
+
+ public static boolean validateUrl(String url) {
+
+ UrlValidator urlValidator = new UrlValidator();
+ if (!urlValidator.isValid(url)) {
+ return false;
+ }
+ if (NONE_UTF8_PATTERN.matcher(url).find()) {
+ return false;
+ }
+
+ if (URL_INVALIDE_PATTERN.matcher(url).find()) {
+ return false;
+ }
+ return true;
+
+ }
+
+ public static String cleanArtifactDisplayName(String strIn) {
+ String str = DASH_PATTERN.matcher(strIn).replaceAll("-");
+ str = UNDERSCORE_PATTERN.matcher(str).replaceAll("_");
+ str = PLUS_PATTERN.matcher(str).replaceAll("+");
+ str = normaliseWhitespace(str);
+ str = str.trim();
+ // str = str.replaceAll(" ", "");
+
+ return str;
+ }
+
+ public static String normalizeArtifactLabel(String strIn) {
+
+ String str = DASH_PATTERN.matcher(strIn).replaceAll("");
+ str = UNDERSCORE_PATTERN.matcher(str).replaceAll("");
+ str = PLUS_PATTERN.matcher(str).replaceAll("");
+ str = SPACE_PATTERN.matcher(str).replaceAll("");
+ str = DOT_PATTERN.matcher(str).replaceAll("");
+ str = str.toLowerCase();
+
+ return str;
+ }
+
+ public static boolean validateAdditionalInformationKeyName(String str) {
+ return ADDITIONAL_INFORMATION_KEY_PATTERN.matcher(str).matches();
+ }
+
+ public static String normalizeAdditionalInformation(String str) {
+ if (str != null) {
+ str = DASH_PATTERN.matcher(str).replaceAll("-");
+ str = UNDERSCORE_PATTERN.matcher(str).replaceAll("_");
+ str = normaliseWhitespace(str);
+ }
+ return str;
+ }
+
+ public static boolean validateLength(String str, int length) {
+ if (str == null) {
+ return true;
+ }
+ return str.length() <= length;
+ }
+
+ public static boolean validateConsumerName(String consumerName) {
+ return CONSUMER_NAME_PATTERN.matcher(consumerName).matches();
+ }
+
+ public static boolean isUTF8Str(String str) {
+ if (NONE_UTF8_PATTERN.matcher(str).find()) {
+ return false;
+ }
+ return true;
+ }
+
+ public static boolean validateConsumerPassSalt(String consumerSalt) {
+ return CONSUMER_PASS_SALT_PATTERN.matcher(consumerSalt).matches();
+ }
+
+ public static boolean isFloatNumber(String number) {
+ return FLOAT_PATTERN.matcher(number).matches();
+ }
+
+ public static boolean validateCertifiedVersion(String version) {
+ return (version != null && CERTIFIED_VERSION_PATTERN.matcher(version).matches());
+ }
+
+ public static boolean validateMinorVersion(String version) {
+ return (version != null && MINOR_VERSION_PATTERN.matcher(version).matches());
+ }
+
+ public static String normaliseProductName(String name) {
+ String[] split = splitComponentName(PRODUCT_NAME_DELIMETER_PATTERN, name);
+ StringBuffer sb = new StringBuffer();
+ for (String splitElement : split) {
+ sb.append(splitElement);
+ }
+ return sb.toString();
+
+ }
+
+ private static String[] splitComponentName(Pattern pattern, String name) {
+ String normalizedName = name.toLowerCase();
+ normalizedName = pattern.matcher(normalizedName).replaceAll(" ");
return normalizedName.split(" ");
- }
+ }
- public static String removeHtmlTagsOnly(String htmlText) {
+ public static String removeHtmlTagsOnly(String htmlText) {
return HtmlCleaner.stripHtml(htmlText, false);
- }
+ }
- public static boolean validateForwardingPathNamePattern(String forwardingPathName) {
- return FORWARDING_PATH_NAME_PATTERN.matcher(forwardingPathName).matches();
- }
+ public static boolean validateForwardingPathNamePattern(String forwardingPathName) {
+ return FORWARDING_PATH_NAME_PATTERN.matcher(forwardingPathName).matches();
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/util/YamlToObjectConverter.java b/common-app-api/src/main/java/org/openecomp/sdc/common/util/YamlToObjectConverter.java
index af46140fc1..801b6c1aaa 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/util/YamlToObjectConverter.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/util/YamlToObjectConverter.java
@@ -7,9 +7,9 @@
* 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.
@@ -21,8 +21,16 @@
package org.openecomp.sdc.common.util;
import org.apache.commons.codec.binary.Base64;
-import org.openecomp.sdc.be.config.Configuration.*;
+import org.openecomp.sdc.be.config.Configuration.ApplicationL1CacheConfig;
+import org.openecomp.sdc.be.config.Configuration.ApplicationL2CacheConfig;
+import org.openecomp.sdc.be.config.Configuration.ArtifactTypeConfig;
+import org.openecomp.sdc.be.config.Configuration.BeMonitoringConfig;
+import org.openecomp.sdc.be.config.Configuration.EcompPortalConfig;
+import org.openecomp.sdc.be.config.Configuration.ElasticSearchConfig;
import org.openecomp.sdc.be.config.Configuration.ElasticSearchConfig.IndicesTimeFrequencyEntry;
+import org.openecomp.sdc.be.config.Configuration.OnboardingConfig;
+import org.openecomp.sdc.be.config.Configuration.SwitchoverDetectorConfig;
+import org.openecomp.sdc.be.config.Configuration.ToscaValidatorsConfig;
import org.openecomp.sdc.be.config.DistributionEngineConfiguration;
import org.openecomp.sdc.be.config.DistributionEngineConfiguration.ComponentArtifactTypesConfig;
import org.openecomp.sdc.be.config.DistributionEngineConfiguration.CreateTopicConfig;
@@ -49,226 +57,228 @@ import java.util.Map;
public class YamlToObjectConverter {
- private static Logger log = Logger.getLogger(YamlToObjectConverter.class.getName());
+ private static Logger log = Logger.getLogger(YamlToObjectConverter.class.getName());
- private static HashMap<String, Yaml> yamls = new HashMap<>();
+ private static HashMap<String, Yaml> yamls = new HashMap<>();
- private static Yaml defaultYaml = new Yaml();
+ private static Yaml defaultYaml = new Yaml();
- static {
+ static {
- org.yaml.snakeyaml.constructor.Constructor deConstructor = new org.yaml.snakeyaml.constructor.Constructor(
- DistributionEngineConfiguration.class);
- TypeDescription deDescription = new TypeDescription(DistributionEngineConfiguration.class);
- deDescription.putListPropertyType("distributionStatusTopic", DistributionStatusTopicConfig.class);
- deDescription.putListPropertyType("distribNotifServiceArtifactTypes", ComponentArtifactTypesConfig.class);
- deDescription.putListPropertyType("distribNotifResourceArtifactTypes", ComponentArtifactTypesConfig.class);
- deDescription.putListPropertyType("createTopic", CreateTopicConfig.class);
- deDescription.putListPropertyType("distributionNotificationTopic", DistributionNotificationTopicConfig.class);
- deConstructor.addTypeDescription(deDescription);
- Yaml yaml = new Yaml(deConstructor);
- yamls.put(DistributionEngineConfiguration.class.getName(), yaml);
+ org.yaml.snakeyaml.constructor.Constructor deConstructor = new org.yaml.snakeyaml.constructor.Constructor(
+ DistributionEngineConfiguration.class);
+ TypeDescription deDescription = new TypeDescription(DistributionEngineConfiguration.class);
+ deDescription.putListPropertyType("distributionStatusTopic", DistributionStatusTopicConfig.class);
+ deDescription.putListPropertyType("distribNotifServiceArtifactTypes", ComponentArtifactTypesConfig.class);
+ deDescription.putListPropertyType("distribNotifResourceArtifactTypes", ComponentArtifactTypesConfig.class);
+ deDescription.putListPropertyType("createTopic", CreateTopicConfig.class);
+ deDescription.putListPropertyType("distributionNotificationTopic", DistributionNotificationTopicConfig.class);
+ deConstructor.addTypeDescription(deDescription);
+ Yaml yaml = new Yaml(deConstructor);
+ yamls.put(DistributionEngineConfiguration.class.getName(), yaml);
- // FE conf
- org.yaml.snakeyaml.constructor.Constructor feConfConstructor = new org.yaml.snakeyaml.constructor.Constructor(
- org.openecomp.sdc.fe.config.Configuration.class);
- TypeDescription feConfDescription = new TypeDescription(org.openecomp.sdc.fe.config.Configuration.class);
- feConfDescription.putListPropertyType("systemMonitoring", FeMonitoringConfig.class);
- feConfConstructor.addTypeDescription(feConfDescription);
- yamls.put(org.openecomp.sdc.fe.config.Configuration.class.getName(), new Yaml(feConfConstructor));
-
- // BE conf
- org.yaml.snakeyaml.constructor.Constructor beConfConstructor = new org.yaml.snakeyaml.constructor.Constructor(
- org.openecomp.sdc.be.config.Configuration.class);
- TypeDescription beConfDescription = new TypeDescription(org.openecomp.sdc.be.config.Configuration.class);
- beConfConstructor.addTypeDescription(beConfDescription);
-
- // systemMonitoring
- beConfDescription.putListPropertyType("systemMonitoring", BeMonitoringConfig.class);
-
- // elasticSearch
- beConfDescription.putListPropertyType("elasticSearch", ElasticSearchConfig.class);
- TypeDescription esDescription = new TypeDescription(ElasticSearchConfig.class);
- esDescription.putListPropertyType("indicesTimeFrequency", IndicesTimeFrequencyEntry.class);
- beConfConstructor.addTypeDescription(esDescription);
-
- // resourceDeploymentArtifacts and serviceDeploymentArtifacts
- beConfDescription.putMapPropertyType("resourceDeploymentArtifacts", String.class,
- ArtifactTypeConfig.class);
- beConfDescription.putMapPropertyType("serviceDeploymentArtifacts", String.class,
- ArtifactTypeConfig.class);
-
- // onboarding
- beConfDescription.putListPropertyType("onboarding", OnboardingConfig.class);
-
- // ecompPortal
- beConfDescription.putListPropertyType("ecompPortal", EcompPortalConfig.class);
- // switchoverDetector
- beConfDescription.putListPropertyType("switchoverDetector", SwitchoverDetectorConfig.class);
-
- // ApplicationL1Cache
- beConfDescription.putListPropertyType("applicationL1Cache", ApplicationL1CacheConfig.class);
-
- // ApplicationL2Cache
- beConfDescription.putListPropertyType("applicationL2Cache", ApplicationL2CacheConfig.class);
-
- // tosca validators config
- beConfDescription.putListPropertyType("toscaValidators", ToscaValidatorsConfig.class);
-
- yamls.put(org.openecomp.sdc.be.config.Configuration.class.getName(), new Yaml(beConfConstructor));
-
- // HEAT deployment artifact
- org.yaml.snakeyaml.constructor.Constructor depArtHeatConstructor = new org.yaml.snakeyaml.constructor.Constructor(
- DeploymentArtifactHeatConfiguration.class);
- PropertyUtils propertyUtils = new PropertyUtils();
- // Skip properties which are found in YAML but not found in POJO
- propertyUtils.setSkipMissingProperties(true);
- depArtHeatConstructor.setPropertyUtils(propertyUtils);
- yamls.put(org.openecomp.sdc.be.config.validation.DeploymentArtifactHeatConfiguration.class.getName(),
- new Yaml(depArtHeatConstructor));
-
- }
-
- private static <T> Yaml getYamlByClassName(Class<T> className) {
+ // FE conf
+ org.yaml.snakeyaml.constructor.Constructor feConfConstructor = new org.yaml.snakeyaml.constructor.Constructor(
+ org.openecomp.sdc.fe.config.Configuration.class);
+ TypeDescription feConfDescription = new TypeDescription(org.openecomp.sdc.fe.config.Configuration.class);
+ feConfDescription.putListPropertyType("systemMonitoring", FeMonitoringConfig.class);
+ feConfConstructor.addTypeDescription(feConfDescription);
+ yamls.put(org.openecomp.sdc.fe.config.Configuration.class.getName(), new Yaml(feConfConstructor));
+
+ // BE conf
+ org.yaml.snakeyaml.constructor.Constructor beConfConstructor = new org.yaml.snakeyaml.constructor.Constructor(
+ org.openecomp.sdc.be.config.Configuration.class);
+ TypeDescription beConfDescription = new TypeDescription(org.openecomp.sdc.be.config.Configuration.class);
+ beConfConstructor.addTypeDescription(beConfDescription);
+
+ // systemMonitoring
+ beConfDescription.putListPropertyType("systemMonitoring", BeMonitoringConfig.class);
+
+ // elasticSearch
+ beConfDescription.putListPropertyType("elasticSearch", ElasticSearchConfig.class);
+ TypeDescription esDescription = new TypeDescription(ElasticSearchConfig.class);
+ esDescription.putListPropertyType("indicesTimeFrequency", IndicesTimeFrequencyEntry.class);
+ beConfConstructor.addTypeDescription(esDescription);
+
+ // resourceDeploymentArtifacts and serviceDeploymentArtifacts
+ beConfDescription.putMapPropertyType("resourceDeploymentArtifacts", String.class,
+ ArtifactTypeConfig.class);
+ beConfDescription.putMapPropertyType("serviceDeploymentArtifacts", String.class,
+ ArtifactTypeConfig.class);
+
+ // onboarding
+ beConfDescription.putListPropertyType("onboarding", OnboardingConfig.class);
+
+ // ecompPortal
+ beConfDescription.putListPropertyType("ecompPortal", EcompPortalConfig.class);
+ // switchoverDetector
+ beConfDescription.putListPropertyType("switchoverDetector", SwitchoverDetectorConfig.class);
+
+ // ApplicationL1Cache
+ beConfDescription.putListPropertyType("applicationL1Cache", ApplicationL1CacheConfig.class);
+
+ // ApplicationL2Cache
+ beConfDescription.putListPropertyType("applicationL2Cache", ApplicationL2CacheConfig.class);
+
+ // tosca validators config
+ beConfDescription.putListPropertyType("toscaValidators", ToscaValidatorsConfig.class);
+
+ yamls.put(org.openecomp.sdc.be.config.Configuration.class.getName(), new Yaml(beConfConstructor));
+
+ // HEAT deployment artifact
+ org.yaml.snakeyaml.constructor.Constructor depArtHeatConstructor = new org.yaml.snakeyaml.constructor.Constructor(
+ DeploymentArtifactHeatConfiguration.class);
+ PropertyUtils propertyUtils = new PropertyUtils();
+ // Skip properties which are found in YAML but not found in POJO
+ propertyUtils.setSkipMissingProperties(true);
+ depArtHeatConstructor.setPropertyUtils(propertyUtils);
+ yamls.put(org.openecomp.sdc.be.config.validation.DeploymentArtifactHeatConfiguration.class.getName(),
+ new Yaml(depArtHeatConstructor));
+
+ }
+
+ private static <T> Yaml getYamlByClassName(Class<T> className) {
+
+ Yaml yaml = yamls.get(className.getName());
+ if (yaml == null) {
+ yaml = defaultYaml;
+ }
+
+ return yaml;
+ }
+
+ public <T> T convert(String dirPath, Class<T> className, String configFileName) {
+
+ T config = null;
+
+ try {
+
+ String fullFileName = dirPath + File.separator + configFileName;
+
+ config = convert(fullFileName, className);
+
+ } catch (Exception e) {
+ log.error(EcompLoggerErrorCode.UNKNOWN_ERROR, "", "", "Failed to convert yaml file {} to object.", configFileName, e);
+ }
+
+ return config;
+ }
+
+ public class MyYamlConstructor extends org.yaml.snakeyaml.constructor.Constructor {
+ private HashMap<String, Class<?>> classMap = new HashMap<>();
+
+ public MyYamlConstructor(Class<? extends Object> theRoot) {
+ super(theRoot);
+ classMap.put(DistributionEngineConfiguration.class.getName(), DistributionEngineConfiguration.class);
+ classMap.put(DistributionStatusTopicConfig.class.getName(), DistributionStatusTopicConfig.class);
+ }
+
+ /*
+ * This is a modified version of the Constructor. Rather than using a
+ * class loader to get external classes, they are already predefined
+ * above. This approach works similar to the typeTags structure in the
+ * original constructor, except that class information is pre-populated
+ * during initialization rather than runtime.
+ *
+ * @see
+ * org.yaml.snakeyaml.constructor.Constructor#getClassForNode(org.yaml.
+ * snakeyaml.nodes.Node)
+ */
+ protected Class<?> getClassForNode(Node node) {
+ String name = node.getTag().getClassName();
+ Class<?> cl = classMap.get(name);
+ if (cl == null) {
+ throw new YAMLException("Class not found: " + name);
+ } else {
+ return cl;
+ }
+ }
+ }
+
+ public <T> T convert(String fullFileName, Class<T> className) {
+
+ T config = null;
+
+ Yaml yaml = getYamlByClassName(className);
+
+ InputStream in = null;
+ try {
+
+ File f = new File(fullFileName);
+ if (!f.exists()) {
+ log.warn(EcompLoggerErrorCode.UNKNOWN_ERROR, "", "", "The file {} cannot be found. Ignore reading configuration.", fullFileName);
+ return null;
+ }
+ in = Files.newInputStream(Paths.get(fullFileName));
+
+ config = yaml.loadAs(in, className);
+
+ // System.out.println(config.toString());
+ } catch (Exception e) {
+ log.error(EcompLoggerErrorCode.UNKNOWN_ERROR, "", "", "Failed to convert yaml file {} to object.", fullFileName, e);
+ } finally {
+ if (in != null) {
+ try {
+ in.close();
+ } catch (IOException e) {
+ log.debug("Failed to close input stream", e);
+ }
+ }
+ }
+
+ return config;
+ }
+
+ public <T> T convert(byte[] fileContents, Class<T> className) {
+
+ T config = null;
+
+ Yaml yaml = getYamlByClassName(className);
- Yaml yaml = yamls.get(className.getName());
- if (yaml == null) {
- yaml = defaultYaml;
- }
-
- return yaml;
- }
-
- public <T> T convert(String dirPath, Class<T> className, String configFileName) {
-
- T config = null;
-
- try {
-
- String fullFileName = dirPath + File.separator + configFileName;
-
- config = convert(fullFileName, className);
-
- } catch (Exception e) {
- log.error(EcompLoggerErrorCode.UNKNOWN_ERROR,"","","Failed to convert yaml file {} to object.", configFileName,e);
- }
-
- return config;
- }
-
- public class MyYamlConstructor extends org.yaml.snakeyaml.constructor.Constructor {
- private HashMap<String, Class<?>> classMap = new HashMap<>();
-
- public MyYamlConstructor(Class<? extends Object> theRoot) {
- super(theRoot);
- classMap.put(DistributionEngineConfiguration.class.getName(), DistributionEngineConfiguration.class);
- classMap.put(DistributionStatusTopicConfig.class.getName(), DistributionStatusTopicConfig.class);
- }
-
- /*
- * This is a modified version of the Constructor. Rather than using a
- * class loader to get external classes, they are already predefined
- * above. This approach works similar to the typeTags structure in the
- * original constructor, except that class information is pre-populated
- * during initialization rather than runtime.
- *
- * @see
- * org.yaml.snakeyaml.constructor.Constructor#getClassForNode(org.yaml.
- * snakeyaml.nodes.Node)
- */
- protected Class<?> getClassForNode(Node node) {
- String name = node.getTag().getClassName();
- Class<?> cl = classMap.get(name);
- if (cl == null)
- throw new YAMLException("Class not found: " + name);
- else
- return cl;
- }
- }
-
- public <T> T convert(String fullFileName, Class<T> className) {
-
- T config = null;
-
- Yaml yaml = getYamlByClassName(className);
-
- InputStream in = null;
- try {
-
- File f = new File(fullFileName);
- if (!f.exists()) {
- log.warn(EcompLoggerErrorCode.UNKNOWN_ERROR,"","","The file {} cannot be found. Ignore reading configuration.",fullFileName);
- return null;
- }
- in = Files.newInputStream(Paths.get(fullFileName));
-
- config = yaml.loadAs(in, className);
-
- // System.out.println(config.toString());
- } catch (Exception e) {
- log.error(EcompLoggerErrorCode.UNKNOWN_ERROR,"","","Failed to convert yaml file {} to object.", fullFileName, e);
- } finally {
- if (in != null) {
- try {
- in.close();
- } catch (IOException e) {
- log.debug("Failed to close input stream", e);
- }
- }
- }
-
- return config;
- }
-
- public <T> T convert(byte[] fileContents, Class<T> className) {
-
- T config = null;
-
- Yaml yaml = getYamlByClassName(className);
-
- InputStream in = null;
- try {
-
- in = new ByteArrayInputStream(fileContents);
-
- config = yaml.loadAs(in, className);
-
- } catch (Exception e) {
- log.error(EcompLoggerErrorCode.UNKNOWN_ERROR,"","","Failed to convert yaml file to object", e);
- } finally {
- if (in != null) {
- try {
- in.close();
- } catch (IOException e) {
- log.debug("Failed to close input stream", e);
- }
- }
- }
-
- return config;
- }
-
- public boolean isValidYamlEncoded64(byte[] fileContents) {
- log.trace("Received Base64 data - decoding before validating...");
- byte[] decodedFileContents = Base64.decodeBase64(fileContents);
-
- return isValidYaml(decodedFileContents);
- }
- @SuppressWarnings("unchecked")
- public boolean isValidYaml(byte[] fileContents) {
- try {
-
- Iterable<Object> mappedToscaTemplateIt = defaultYaml.loadAll(new ByteArrayInputStream(fileContents));
-
- for (Object o : mappedToscaTemplateIt) {
- System.out.println("Loaded object type:" + o.getClass());
- Map<String, Object> map = (Map<String, Object>) o;
- }
-
- } catch (Exception e) {
- log.error(EcompLoggerErrorCode.UNKNOWN_ERROR,"","","Failed to convert yaml file to object - yaml is invalid", e);
- return false;
- }
- return true;
- }
+ InputStream in = null;
+ try {
+
+ in = new ByteArrayInputStream(fileContents);
+
+ config = yaml.loadAs(in, className);
+
+ } catch (Exception e) {
+ log.error(EcompLoggerErrorCode.UNKNOWN_ERROR, "", "", "Failed to convert yaml file to object", e);
+ } finally {
+ if (in != null) {
+ try {
+ in.close();
+ } catch (IOException e) {
+ log.debug("Failed to close input stream", e);
+ }
+ }
+ }
+
+ return config;
+ }
+
+ public boolean isValidYamlEncoded64(byte[] fileContents) {
+ log.trace("Received Base64 data - decoding before validating...");
+ byte[] decodedFileContents = Base64.decodeBase64(fileContents);
+
+ return isValidYaml(decodedFileContents);
+ }
+
+ @SuppressWarnings("unchecked")
+ public boolean isValidYaml(byte[] fileContents) {
+ try {
+
+ Iterable<Object> mappedToscaTemplateIt = defaultYaml.loadAll(new ByteArrayInputStream(fileContents));
+
+ for (Object o : mappedToscaTemplateIt) {
+ System.out.println("Loaded object type:" + o.getClass());
+ Map<String, Object> map = (Map<String, Object>) o;
+ }
+
+ } catch (Exception e) {
+ log.error(EcompLoggerErrorCode.UNKNOWN_ERROR, "", "", "Failed to convert yaml file to object - yaml is invalid", e);
+ return false;
+ }
+ return true;
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/util/ZipUtil.java b/common-app-api/src/main/java/org/openecomp/sdc/common/util/ZipUtil.java
index 13ad92e8a5..ec3c31cffe 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/util/ZipUtil.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/util/ZipUtil.java
@@ -7,9 +7,9 @@
* 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.
@@ -24,7 +24,11 @@ import org.apache.commons.io.IOUtils;
import org.apache.commons.io.output.ByteArrayOutputStream;
import org.openecomp.sdc.common.log.wrappers.Logger;
-import java.io.*;
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
@@ -36,95 +40,96 @@ import java.util.zip.ZipOutputStream;
public class ZipUtil {
- private static Logger log = Logger.getLogger(ZipUtil.class.getName());
+ private static final int KB = 1024;
+ private static Logger log = Logger.getLogger(ZipUtil.class.getName());
- private ZipUtil() {
- }
+ private ZipUtil() {
+ }
- public static Map<String, byte[]> readZip(File file) {
- try(InputStream fileInputStream = new FileInputStream(file)){
- return readZip(IOUtils.toByteArray(fileInputStream));
+ public static Map<String, byte[]> readZip(File file) {
+ try (InputStream fileInputStream = new FileInputStream(file)) {
+ return readZip(IOUtils.toByteArray(fileInputStream));
} catch (IOException e) {
- log.info("close File stream failed - {}" , e);
+ log.info("close File stream failed - {}", e);
return null;
}
}
- public static Map<String, byte[]> readZip(byte[] zipAsBytes) {
- Map<String, byte[]> fileNameToByteArray = new HashMap<>();
- byte[] buffer = new byte[1024];
- try(ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(zipAsBytes);
- ZipInputStream zis = new ZipInputStream(byteArrayInputStream)) {
- // get the zipped file list entry
- ZipEntry ze = zis.getNextEntry();
-
- while (ze != null) {
-
- String fileName = ze.getName();
-
- if (!ze.isDirectory()) {
-
- try(ByteArrayOutputStream os = new ByteArrayOutputStream()) {
- int len;
- while ((len = zis.read(buffer)) > 0) {
- os.write(buffer, 0, len);
- }
-
- fileNameToByteArray.put(fileName, os.toByteArray());
-
- }
- }
- ze = zis.getNextEntry();
- }
- } catch (IOException ex) {
- log.info("close Byte stream failed" , ex);
- return null;
- }
-
- return fileNameToByteArray;
-
- }
-
- public static void main(String[] args) {
- String zipFileName = "/src/test/resources/config/config.zip";
- zipFileName = "C:\\Git_work\\D2-SDnC\\catalog-be\\src\\test\\resources\\config\\config.zip";
- Path path = Paths.get(zipFileName);
-
- try {
- byte[] zipAsBytes = Files.readAllBytes(path);
- // encode to base
-
- ZipUtil.readZip(zipAsBytes);
-
- } catch (IOException e) {
- log.info("close Byte stream failed" , e);
- }
- }
-
- public static byte[] zipBytes(byte[] input) throws IOException {
- try(ByteArrayOutputStream baos = new ByteArrayOutputStream();
- ZipOutputStream zos = new ZipOutputStream(baos)){
- ZipEntry entry = new ZipEntry("zip");
- entry.setSize(input.length);
- zos.putNextEntry(entry);
- zos.write(input);
- zos.closeEntry();
- return baos.toByteArray();
- }
- }
-
- public static byte[] unzip(byte[] zipped) {
- try(ZipInputStream zipinputstream = new ZipInputStream(new ByteArrayInputStream(zipped));
- ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) {
- byte[] buf = new byte[1024];
- ZipEntry zipentry = zipinputstream.getNextEntry();
- int n;
- while ((n = zipinputstream.read(buf, 0, 1024)) > -1) {
- outputStream.write(buf, 0, n);
- }
- return outputStream.toByteArray();
- } catch (Exception e) {
- throw new IllegalStateException("Can't unzip input stream", e);
- }
- }
+ public static Map<String, byte[]> readZip(byte[] zipAsBytes) {
+ Map<String, byte[]> fileNameToByteArray = new HashMap<>();
+ byte[] buffer = new byte[KB];
+ try (ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(zipAsBytes);
+ ZipInputStream zis = new ZipInputStream(byteArrayInputStream)) {
+ // get the zipped file list entry
+ ZipEntry ze = zis.getNextEntry();
+
+ while (ze != null) {
+
+ String fileName = ze.getName();
+
+ if (!ze.isDirectory()) {
+
+ try (ByteArrayOutputStream os = new ByteArrayOutputStream()) {
+ int len;
+ while ((len = zis.read(buffer)) > 0) {
+ os.write(buffer, 0, len);
+ }
+
+ fileNameToByteArray.put(fileName, os.toByteArray());
+
+ }
+ }
+ ze = zis.getNextEntry();
+ }
+ } catch (IOException ex) {
+ log.info("close Byte stream failed", ex);
+ return null;
+ }
+
+ return fileNameToByteArray;
+
+ }
+
+ public static void main(String[] args) {
+ String zipFileName = "/src/test/resources/config/config.zip";
+ zipFileName = "C:\\Git_work\\D2-SDnC\\catalog-be\\src\\test\\resources\\config\\config.zip";
+ Path path = Paths.get(zipFileName);
+
+ try {
+ byte[] zipAsBytes = Files.readAllBytes(path);
+ // encode to base
+
+ ZipUtil.readZip(zipAsBytes);
+
+ } catch (IOException e) {
+ log.info("close Byte stream failed", e);
+ }
+ }
+
+ public static byte[] zipBytes(byte[] input) throws IOException {
+ try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ZipOutputStream zos = new ZipOutputStream(baos)) {
+ ZipEntry entry = new ZipEntry("zip");
+ entry.setSize(input.length);
+ zos.putNextEntry(entry);
+ zos.write(input);
+ zos.closeEntry();
+ return baos.toByteArray();
+ }
+ }
+
+ public static byte[] unzip(byte[] zipped) {
+ try (ZipInputStream zipinputstream = new ZipInputStream(new ByteArrayInputStream(zipped));
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) {
+ byte[] buf = new byte[KB];
+ ZipEntry zipentry = zipinputstream.getNextEntry();
+ int n;
+ while ((n = zipinputstream.read(buf, 0, KB)) > -1) {
+ outputStream.write(buf, 0, n);
+ }
+ return outputStream.toByteArray();
+ } catch (Exception e) {
+ throw new IllegalStateException("Can't unzip input stream", e);
+ }
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/exception/AbstractSdncException.java b/common-app-api/src/main/java/org/openecomp/sdc/exception/AbstractSdncException.java
index e8af079f22..7fac9f33fa 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/exception/AbstractSdncException.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/exception/AbstractSdncException.java
@@ -7,9 +7,9 @@
* 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.
@@ -30,87 +30,87 @@ import java.util.regex.Pattern;
public abstract class AbstractSdncException {
- private String messageId;
-
- private String text;
-
- private String[] variables;
-
- private static Logger log = Logger.getLogger(AbstractSdncException.class.getName());
-
- private final static Pattern ERROR_PARAM_PATTERN = Pattern.compile("%\\d");
-
- public AbstractSdncException() {
- }
-
- public AbstractSdncException(String messageId, String text, String[] variables) {
- super();
- this.messageId = messageId;
- this.text = text;
- this.variables = validateParameters(messageId, text, variables);
- }
-
- private String[] validateParameters(String messageId, String text, String[] variables) {
- String[] res = null;
- Matcher m = ERROR_PARAM_PATTERN.matcher(text);
- int expectedParamsNum = 0;
- while (m.find()) {
- expectedParamsNum += 1;
- }
- int actualParamsNum = (variables != null) ? variables.length : 0;
- if (actualParamsNum < expectedParamsNum) {
- log.warn(EcompLoggerErrorCode.UNKNOWN_ERROR,"","",
- "Received less parameters than expected for error with messageId {}, expected: {}, actual: {}. Missing parameters are padded with null values.",
- messageId, expectedParamsNum, actualParamsNum);
- } else if (actualParamsNum > expectedParamsNum) {
- log.warn(EcompLoggerErrorCode.UNKNOWN_ERROR,"","","",
- "Received more parameters than expected for error with messageId {}, expected: {}, actual: {}. Extra parameters are ignored.",
- messageId, expectedParamsNum, actualParamsNum);
- }
- if (variables != null) {
- res = Arrays.copyOf(variables, expectedParamsNum);
- }
-
- return res;
- }
-
- public String getMessageId() {
- return this.messageId;
- }
-
- public String getText() {
- return text;
- }
-
- public String[] getVariables() {
- return variables;
- }
-
- public void setMessageId(String messageId) {
- this.messageId = messageId;
- }
-
- public void setText(String text) {
- this.text = text;
- }
-
- public void setVariables(String[] variables) {
- this.variables = variables;
- }
-
- public String getFormattedErrorMessage() {
- String res;
- if (variables != null && variables.length > 0) {
- Formatter formatter = new Formatter();
- try {
- res = formatter.format(this.text.replaceAll("%\\d", "%s"), (Object[]) this.variables).toString();
- } finally {
- formatter.close();
- }
- } else {
- res = this.text;
- }
- return res;
- }
+ private String messageId;
+
+ private String text;
+
+ private String[] variables;
+
+ private static Logger log = Logger.getLogger(AbstractSdncException.class.getName());
+
+ private static final Pattern ERROR_PARAM_PATTERN = Pattern.compile("%\\d");
+
+ public AbstractSdncException() {
+ }
+
+ public AbstractSdncException(String messageId, String text, String[] variables) {
+ super();
+ this.messageId = messageId;
+ this.text = text;
+ this.variables = validateParameters(messageId, text, variables);
+ }
+
+ private String[] validateParameters(String messageId, String text, String[] variables) {
+ String[] res = null;
+ Matcher m = ERROR_PARAM_PATTERN.matcher(text);
+ int expectedParamsNum = 0;
+ while (m.find()) {
+ expectedParamsNum += 1;
+ }
+ int actualParamsNum = (variables != null) ? variables.length : 0;
+ if (actualParamsNum < expectedParamsNum) {
+ log.warn(EcompLoggerErrorCode.UNKNOWN_ERROR, "", "",
+ "Received less parameters than expected for error with messageId {}, expected: {}, actual: {}. Missing parameters are padded with null values.",
+ messageId, expectedParamsNum, actualParamsNum);
+ } else if (actualParamsNum > expectedParamsNum) {
+ log.warn(EcompLoggerErrorCode.UNKNOWN_ERROR, "", "", "",
+ "Received more parameters than expected for error with messageId {}, expected: {}, actual: {}. Extra parameters are ignored.",
+ messageId, expectedParamsNum, actualParamsNum);
+ }
+ if (variables != null) {
+ res = Arrays.copyOf(variables, expectedParamsNum);
+ }
+
+ return res;
+ }
+
+ public String getMessageId() {
+ return this.messageId;
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ public String[] getVariables() {
+ return variables;
+ }
+
+ public void setMessageId(String messageId) {
+ this.messageId = messageId;
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ public void setVariables(String[] variables) {
+ this.variables = variables;
+ }
+
+ public String getFormattedErrorMessage() {
+ String res;
+ if (variables != null && variables.length > 0) {
+ Formatter formatter = new Formatter();
+ try {
+ res = formatter.format(this.text.replaceAll("%\\d", "%s"), (Object[]) this.variables).toString();
+ } finally {
+ formatter.close();
+ }
+ } else {
+ res = this.text;
+ }
+ return res;
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/exception/DeleteLastApplicationEnvironmentException.java b/common-app-api/src/main/java/org/openecomp/sdc/exception/DeleteLastApplicationEnvironmentException.java
index ec33b69d82..b9de46640a 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/exception/DeleteLastApplicationEnvironmentException.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/exception/DeleteLastApplicationEnvironmentException.java
@@ -7,9 +7,9 @@
* 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.
@@ -22,13 +22,13 @@ package org.openecomp.sdc.exception;
public class DeleteLastApplicationEnvironmentException extends TechnicalException {
- private static final long serialVersionUID = -5192834855057177252L;
+ private static final long serialVersionUID = -5192834855057177252L;
- public DeleteLastApplicationEnvironmentException(String message, Throwable cause) {
- super(message, cause);
- }
+ public DeleteLastApplicationEnvironmentException(String message, Throwable cause) {
+ super(message, cause);
+ }
- public DeleteLastApplicationEnvironmentException(String message) {
- super(message);
- }
+ public DeleteLastApplicationEnvironmentException(String message) {
+ super(message);
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/exception/DeleteReferencedObjectException.java b/common-app-api/src/main/java/org/openecomp/sdc/exception/DeleteReferencedObjectException.java
index 6957e960c3..28c0d99538 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/exception/DeleteReferencedObjectException.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/exception/DeleteReferencedObjectException.java
@@ -7,9 +7,9 @@
* 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.
@@ -27,9 +27,9 @@ package org.openecomp.sdc.exception;
* @author Minh Khang VU
*/
public class DeleteReferencedObjectException extends TechnicalException {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
- public DeleteReferencedObjectException(String message) {
- super(message);
- }
+ public DeleteReferencedObjectException(String message) {
+ super(message);
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/exception/FunctionalException.java b/common-app-api/src/main/java/org/openecomp/sdc/exception/FunctionalException.java
index 5bf67484d5..8989feb2ef 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/exception/FunctionalException.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/exception/FunctionalException.java
@@ -7,9 +7,9 @@
* 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.
@@ -23,19 +23,18 @@ package org.openecomp.sdc.exception;
/**
* All functional exception which is related to user input must go here. It's a
* checked exception to force error handling and checking.
- *
+ *
* @author mkv
- *
*/
public class FunctionalException extends Exception {
- private static final long serialVersionUID = 6712845685798792493L;
+ private static final long serialVersionUID = 6712845685798792493L;
- public FunctionalException(String message, Throwable cause) {
- super(message, cause);
- }
+ public FunctionalException(String message, Throwable cause) {
+ super(message, cause);
+ }
- public FunctionalException(String message) {
- super(message);
- }
+ public FunctionalException(String message) {
+ super(message);
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/exception/IndexingServiceException.java b/common-app-api/src/main/java/org/openecomp/sdc/exception/IndexingServiceException.java
index d8b8518919..0e505ff7ff 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/exception/IndexingServiceException.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/exception/IndexingServiceException.java
@@ -7,9 +7,9 @@
* 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.
@@ -22,18 +22,18 @@ package org.openecomp.sdc.exception;
/**
* All errors happened while trying to access to index service
- *
+ *
* @author mkv
*/
public class IndexingServiceException extends TechnicalException {
- private static final long serialVersionUID = 8644422735660389058L;
+ private static final long serialVersionUID = 8644422735660389058L;
- public IndexingServiceException(String message, Throwable cause) {
- super(message, cause);
- }
+ public IndexingServiceException(String message, Throwable cause) {
+ super(message, cause);
+ }
- public IndexingServiceException(String message) {
- super(message);
- }
+ public IndexingServiceException(String message) {
+ super(message);
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/exception/InvalidArgumentException.java b/common-app-api/src/main/java/org/openecomp/sdc/exception/InvalidArgumentException.java
index ef6cd659e4..6de09fd594 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/exception/InvalidArgumentException.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/exception/InvalidArgumentException.java
@@ -7,9 +7,9 @@
* 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.
@@ -21,13 +21,13 @@
package org.openecomp.sdc.exception;
public class InvalidArgumentException extends TechnicalException {
- private static final long serialVersionUID = 931646037604062840L;
+ private static final long serialVersionUID = 931646037604062840L;
- public InvalidArgumentException(String message, Throwable cause) {
- super(message, cause);
- }
+ public InvalidArgumentException(String message, Throwable cause) {
+ super(message, cause);
+ }
- public InvalidArgumentException(String message) {
- super(message);
- }
+ public InvalidArgumentException(String message) {
+ super(message);
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/exception/NotFoundException.java b/common-app-api/src/main/java/org/openecomp/sdc/exception/NotFoundException.java
index 988325ff3e..6f4d41c582 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/exception/NotFoundException.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/exception/NotFoundException.java
@@ -7,9 +7,9 @@
* 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.
@@ -22,14 +22,14 @@ package org.openecomp.sdc.exception;
public class NotFoundException extends TechnicalException {
- private static final long serialVersionUID = -5838741067731786413L;
+ private static final long serialVersionUID = -5838741067731786413L;
- public NotFoundException(String message, Throwable cause) {
- super(message, cause);
- }
+ public NotFoundException(String message, Throwable cause) {
+ super(message, cause);
+ }
- public NotFoundException(String message) {
- super(message);
- }
+ public NotFoundException(String message) {
+ super(message);
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/exception/OkResponseInfo.java b/common-app-api/src/main/java/org/openecomp/sdc/exception/OkResponseInfo.java
index 78405e0eb1..2c5da89eef 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/exception/OkResponseInfo.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/exception/OkResponseInfo.java
@@ -7,9 +7,9 @@
* 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.
@@ -22,7 +22,7 @@ package org.openecomp.sdc.exception;
public class OkResponseInfo extends AbstractSdncException {
- public OkResponseInfo(String messageId, String text, String[] variables) {
- super(messageId, text, variables);
- }
+ public OkResponseInfo(String messageId, String text, String[] variables) {
+ super(messageId, text, variables);
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/exception/PolicyException.java b/common-app-api/src/main/java/org/openecomp/sdc/exception/PolicyException.java
index 8c5c8609b6..c557bccad3 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/exception/PolicyException.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/exception/PolicyException.java
@@ -7,9 +7,9 @@
* 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.
@@ -22,10 +22,10 @@ package org.openecomp.sdc.exception;
public class PolicyException extends AbstractSdncException {
- public PolicyException(String messageId, String text, String[] variables) {
- super(messageId, text, variables);
- }
+ public PolicyException(String messageId, String text, String[] variables) {
+ super(messageId, text, variables);
+ }
- public PolicyException() {
- }
+ public PolicyException() {
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/exception/ResponseFormat.java b/common-app-api/src/main/java/org/openecomp/sdc/exception/ResponseFormat.java
index 109164d07d..59d30d5180 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/exception/ResponseFormat.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/exception/ResponseFormat.java
@@ -7,9 +7,9 @@
* 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.
@@ -22,171 +22,169 @@ package org.openecomp.sdc.exception;
/**
* Nested POJOs to express required JSON format of the error
- *
+ *
* { "requestError": { "serviceException": { "messageId": "", "text": "",
* "variables": [] } } }
- *
- *
- * @author paharoni
*
+ * @author paharoni
*/
public class ResponseFormat {
- private int status;
- private RequestErrorWrapper requestErrorWrapper;
-
- public ResponseFormat() {
- super();
- }
-
- public ResponseFormat(int status) {
- super();
- this.status = status;
- }
-
- public void setStatus(int status) {
- this.status = status;
- }
-
- public Integer getStatus() {
- return status;
- }
-
- public RequestErrorWrapper getRequestError() {
- return requestErrorWrapper;
- }
-
- public void setRequestError(RequestErrorWrapper requestErrorWrapper) {
- this.requestErrorWrapper = requestErrorWrapper;
- }
-
- public void setPolicyException(PolicyException policyException) {
- this.requestErrorWrapper = new RequestErrorWrapper(new RequestError());
- requestErrorWrapper.setPolicyException(policyException);
- }
-
- public void setServiceException(ServiceException serviceException) {
- this.requestErrorWrapper = new RequestErrorWrapper(new RequestError());
- requestErrorWrapper.setServiceException(serviceException);
- }
-
- public void setOkResponseInfo(OkResponseInfo okResponseInfo) {
- this.requestErrorWrapper = new RequestErrorWrapper(new RequestError());
- requestErrorWrapper.setOkResponseInfo(okResponseInfo);
- }
-
- public String getFormattedMessage() {
- if (this.requestErrorWrapper.requestError.okResponseInfo != null) {
- return this.requestErrorWrapper.requestError.okResponseInfo.getFormattedErrorMessage();
- }
- if (this.requestErrorWrapper.requestError.serviceException != null) {
- return this.requestErrorWrapper.requestError.serviceException.getFormattedErrorMessage();
- }
- return this.requestErrorWrapper.requestError.policyException.getFormattedErrorMessage();
- }
-
- public String getText() {
- if (this.requestErrorWrapper.requestError.okResponseInfo != null) {
- return this.requestErrorWrapper.requestError.okResponseInfo.getText();
- }
- if (this.requestErrorWrapper.requestError.serviceException != null) {
- return this.requestErrorWrapper.requestError.serviceException.getText();
- }
- return this.requestErrorWrapper.requestError.policyException.getText();
- }
-
- public String[] getVariables() {
- if (this.requestErrorWrapper.requestError.okResponseInfo != null) {
- return this.requestErrorWrapper.requestError.okResponseInfo.getVariables();
- }
- if (this.requestErrorWrapper.requestError.serviceException != null) {
- return this.requestErrorWrapper.requestError.serviceException.getVariables();
- }
- return this.requestErrorWrapper.requestError.policyException.getVariables();
- }
-
- public String getMessageId() {
- if (this.requestErrorWrapper.requestError.okResponseInfo != null) {
- return this.requestErrorWrapper.requestError.okResponseInfo.getMessageId();
- }
- if (this.requestErrorWrapper.requestError.serviceException != null) {
- return this.requestErrorWrapper.requestError.serviceException.getMessageId();
- }
- return this.requestErrorWrapper.requestError.policyException.getMessageId();
- }
-
- public class RequestErrorWrapper {
- private RequestError requestError;
-
- public RequestErrorWrapper() {
- this.requestError = new RequestError();
- }
-
- public RequestErrorWrapper(RequestError requestError) {
- this.requestError = requestError;
- }
-
- public RequestError getRequestError() {
- return requestError;
- }
-
- public void setRequestError(RequestError requestError) {
- this.requestError = requestError;
- }
-
- public void setPolicyException(PolicyException policyException) {
- requestError.setPolicyException(policyException);
- }
-
- public void setServiceException(ServiceException serviceException) {
- requestError.setServiceException(serviceException);
- }
-
- public void setOkResponseInfo(OkResponseInfo okResponseInfo) {
- requestError.setOkResponseInfo(okResponseInfo);
- }
- }
-
- public class RequestError {
- @SuppressWarnings("unused")
- private PolicyException policyException;
- @SuppressWarnings("unused")
- private ServiceException serviceException;
- @SuppressWarnings("unused")
- private OkResponseInfo okResponseInfo;
-
- public RequestError() {
- }
-
- public PolicyException getPolicyException() {
- return policyException;
- }
-
- public ServiceException getServiceException() {
- return serviceException;
- }
-
- public OkResponseInfo getOkResponseInfo() {
- return okResponseInfo;
- }
-
- public void setPolicyException(PolicyException policyException) {
- this.policyException = policyException;
- }
-
- public void setServiceException(ServiceException serviceException) {
- this.serviceException = serviceException;
- }
-
- public void setOkResponseInfo(OkResponseInfo okResponseInfo) {
- this.okResponseInfo = okResponseInfo;
- }
- }
-
- @Override
- public String toString() {
- return "ResponseFormat[" + "status=" + status + ", requestErrorWrapper=" + requestErrorWrapper + ']';
- }
-
+ private int status;
+ private RequestErrorWrapper requestErrorWrapper;
+
+ public ResponseFormat() {
+ super();
+ }
+
+ public ResponseFormat(int status) {
+ super();
+ this.status = status;
+ }
+
+ public void setStatus(int status) {
+ this.status = status;
+ }
+
+ public Integer getStatus() {
+ return status;
+ }
+
+ public RequestErrorWrapper getRequestError() {
+ return requestErrorWrapper;
+ }
+
+ public void setRequestError(RequestErrorWrapper requestErrorWrapper) {
+ this.requestErrorWrapper = requestErrorWrapper;
+ }
+
+ public void setPolicyException(PolicyException policyException) {
+ this.requestErrorWrapper = new RequestErrorWrapper(new RequestError());
+ requestErrorWrapper.setPolicyException(policyException);
+ }
+
+ public void setServiceException(ServiceException serviceException) {
+ this.requestErrorWrapper = new RequestErrorWrapper(new RequestError());
+ requestErrorWrapper.setServiceException(serviceException);
+ }
+
+ public void setOkResponseInfo(OkResponseInfo okResponseInfo) {
+ this.requestErrorWrapper = new RequestErrorWrapper(new RequestError());
+ requestErrorWrapper.setOkResponseInfo(okResponseInfo);
+ }
+
+ public String getFormattedMessage() {
+ if (this.requestErrorWrapper.requestError.okResponseInfo != null) {
+ return this.requestErrorWrapper.requestError.okResponseInfo.getFormattedErrorMessage();
+ }
+ if (this.requestErrorWrapper.requestError.serviceException != null) {
+ return this.requestErrorWrapper.requestError.serviceException.getFormattedErrorMessage();
+ }
+ return this.requestErrorWrapper.requestError.policyException.getFormattedErrorMessage();
+ }
+
+ public String getText() {
+ if (this.requestErrorWrapper.requestError.okResponseInfo != null) {
+ return this.requestErrorWrapper.requestError.okResponseInfo.getText();
+ }
+ if (this.requestErrorWrapper.requestError.serviceException != null) {
+ return this.requestErrorWrapper.requestError.serviceException.getText();
+ }
+ return this.requestErrorWrapper.requestError.policyException.getText();
+ }
+
+ public String[] getVariables() {
+ if (this.requestErrorWrapper.requestError.okResponseInfo != null) {
+ return this.requestErrorWrapper.requestError.okResponseInfo.getVariables();
+ }
+ if (this.requestErrorWrapper.requestError.serviceException != null) {
+ return this.requestErrorWrapper.requestError.serviceException.getVariables();
+ }
+ return this.requestErrorWrapper.requestError.policyException.getVariables();
+ }
+
+ public String getMessageId() {
+ if (this.requestErrorWrapper.requestError.okResponseInfo != null) {
+ return this.requestErrorWrapper.requestError.okResponseInfo.getMessageId();
+ }
+ if (this.requestErrorWrapper.requestError.serviceException != null) {
+ return this.requestErrorWrapper.requestError.serviceException.getMessageId();
+ }
+ return this.requestErrorWrapper.requestError.policyException.getMessageId();
+ }
+
+ public class RequestErrorWrapper {
+ private RequestError requestError;
+
+ public RequestErrorWrapper() {
+ this.requestError = new RequestError();
+ }
+
+ public RequestErrorWrapper(RequestError requestError) {
+ this.requestError = requestError;
+ }
+
+ public RequestError getRequestError() {
+ return requestError;
+ }
+
+ public void setRequestError(RequestError requestError) {
+ this.requestError = requestError;
+ }
+
+ public void setPolicyException(PolicyException policyException) {
+ requestError.setPolicyException(policyException);
+ }
+
+ public void setServiceException(ServiceException serviceException) {
+ requestError.setServiceException(serviceException);
+ }
+
+ public void setOkResponseInfo(OkResponseInfo okResponseInfo) {
+ requestError.setOkResponseInfo(okResponseInfo);
+ }
+ }
+
+ public class RequestError {
+ @SuppressWarnings("unused")
+ private PolicyException policyException;
+ @SuppressWarnings("unused")
+ private ServiceException serviceException;
+ @SuppressWarnings("unused")
+ private OkResponseInfo okResponseInfo;
+
+ public RequestError() {
+ }
+
+ public PolicyException getPolicyException() {
+ return policyException;
+ }
+
+ public ServiceException getServiceException() {
+ return serviceException;
+ }
+
+ public OkResponseInfo getOkResponseInfo() {
+ return okResponseInfo;
+ }
+
+ public void setPolicyException(PolicyException policyException) {
+ this.policyException = policyException;
+ }
+
+ public void setServiceException(ServiceException serviceException) {
+ this.serviceException = serviceException;
+ }
+
+ public void setOkResponseInfo(OkResponseInfo okResponseInfo) {
+ this.okResponseInfo = okResponseInfo;
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "ResponseFormat[" + "status=" + status + ", requestErrorWrapper=" + requestErrorWrapper + ']';
+ }
+
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/exception/ServiceException.java b/common-app-api/src/main/java/org/openecomp/sdc/exception/ServiceException.java
index 3aae180517..4bf3b2ba44 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/exception/ServiceException.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/exception/ServiceException.java
@@ -7,9 +7,9 @@
* 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.
@@ -22,11 +22,11 @@ package org.openecomp.sdc.exception;
public class ServiceException extends AbstractSdncException {
- public ServiceException(String messageId, String text, String[] variables) {
- super(messageId, text, variables);
- }
+ public ServiceException(String messageId, String text, String[] variables) {
+ super(messageId, text, variables);
+ }
- public ServiceException() {
- }
+ public ServiceException() {
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/exception/TechnicalException.java b/common-app-api/src/main/java/org/openecomp/sdc/exception/TechnicalException.java
index 96ef2f3159..3262a685fa 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/exception/TechnicalException.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/exception/TechnicalException.java
@@ -7,9 +7,9 @@
* 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.
@@ -24,17 +24,16 @@ package org.openecomp.sdc.exception;
* Base class for all Alien technical exception
*
* @author mkv
- *
*/
public abstract class TechnicalException extends RuntimeException {
- private static final long serialVersionUID = -9152473183025390161L;
+ private static final long serialVersionUID = -9152473183025390161L;
- public TechnicalException(String message, Throwable cause) {
- super(message, cause);
- }
+ public TechnicalException(String message, Throwable cause) {
+ super(message, cause);
+ }
- public TechnicalException(String message) {
- super(message);
- }
+ public TechnicalException(String message) {
+ super(message);
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/exception/VersionConflictException.java b/common-app-api/src/main/java/org/openecomp/sdc/exception/VersionConflictException.java
index a998d6393e..ba0457a16c 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/exception/VersionConflictException.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/exception/VersionConflictException.java
@@ -7,9 +7,9 @@
* 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.
@@ -25,9 +25,9 @@ package org.openecomp.sdc.exception;
* manner for users
*/
public class VersionConflictException extends TechnicalException {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 1L;
- public VersionConflictException(String message, Throwable cause) {
- super(message, cause);
- }
+ public VersionConflictException(String message, Throwable cause) {
+ super(message, cause);
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/fe/config/Configuration.java b/common-app-api/src/main/java/org/openecomp/sdc/fe/config/Configuration.java
index 012e96afa2..85417fb611 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/fe/config/Configuration.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/fe/config/Configuration.java
@@ -288,9 +288,9 @@ public class Configuration extends BasicConfiguration {
public static class FeMonitoringConfig {
- Boolean enabled;
- Boolean isProxy;
- Integer probeIntervalInSeconds;
+ private Boolean enabled;
+ private Boolean isProxy;
+ private Integer probeIntervalInSeconds;
public Boolean getEnabled() {
return enabled;
@@ -322,13 +322,13 @@ public class Configuration extends BasicConfiguration {
}
public static class OnboardingConfig {
- String protocolFe = "http";
- String hostFe;
- Integer portFe;
- String protocolBe = "http";
- String hostBe;
- Integer portBe;
- String healthCheckUriFe;
+ private String protocolFe = "http";
+ private String hostFe;
+ private Integer portFe;
+ private String protocolBe = "http";
+ private String hostBe;
+ private Integer portBe;
+ private String healthCheckUriFe;
public String getProtocolFe() {
return protocolFe;
@@ -389,10 +389,10 @@ public class Configuration extends BasicConfiguration {
public static class DcaeConfig {
- String protocol = "http";
- String host;
- Integer port;
- String healthCheckUri;
+ private String protocol = "http";
+ private String host;
+ private Integer port;
+ private String healthCheckUri;
public String getProtocol() {
return protocol;
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/fe/config/ConfigurationManager.java b/common-app-api/src/main/java/org/openecomp/sdc/fe/config/ConfigurationManager.java
index 413c8f825f..9353dd934f 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/fe/config/ConfigurationManager.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/fe/config/ConfigurationManager.java
@@ -7,9 +7,9 @@
* 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.
@@ -35,100 +35,100 @@ import java.util.Map;
public class ConfigurationManager implements FileChangeCallback, IEcompConfigurationManager {
- ConfigurationSource configurationSource = null;
- private static ConfigurationManager instance;
- private static Logger log = LoggerFactory.getLogger(ConfigurationManager.class.getName());
+ private ConfigurationSource configurationSource = null;
+ private static ConfigurationManager instance;
+ private static Logger logger = LoggerFactory.getLogger(ConfigurationManager.class.getName());
- public ConfigurationManager(ConfigurationSource configurationSource) {
- super();
- this.configurationSource = configurationSource;
- loadConfigurationFiles();
- instance = this;
- }
+ public ConfigurationManager(ConfigurationSource configurationSource) {
+ super();
+ this.configurationSource = configurationSource;
+ loadConfigurationFiles();
+ instance = this;
+ }
- Map<String, Object> configurations = new HashMap<>();
+ private Map<String, Object> configurations = new HashMap<>();
- private void loadConfigurationFiles() {
+ private void loadConfigurationFiles() {
- loadConfigurationClass(Configuration.class);
- loadConfigurationClass(RestConfigurationInfo.class);
- loadConfigurationClass(EcompErrorConfiguration.class);
- loadConfigurationClass(PluginsConfiguration.class);
+ loadConfigurationClass(Configuration.class);
+ loadConfigurationClass(RestConfigurationInfo.class);
+ loadConfigurationClass(EcompErrorConfiguration.class);
+ loadConfigurationClass(PluginsConfiguration.class);
- }
+ }
- private <T extends BasicConfiguration> void loadConfigurationClass(Class<T> clazz) {
- ConfigurationListener configurationListener = new ConfigurationListener(clazz, this);
-
- log.info("created listener for class {}: {}", clazz.getName(), configurationListener);
+ private <T extends BasicConfiguration> void loadConfigurationClass(Class<T> clazz) {
+ ConfigurationListener configurationListener = new ConfigurationListener(clazz, this);
- T object = configurationSource.getAndWatchConfiguration(clazz, configurationListener);
+ logger.info("created listener for class {}: {}", clazz.getName(), configurationListener);
- configurations.put(getKey(clazz), object);
- }
+ T object = configurationSource.getAndWatchConfiguration(clazz, configurationListener);
- private <T> String getKey(Class<T> class1) {
+ configurations.put(getKey(clazz), object);
+ }
- return class1.getSimpleName();
+ private <T> String getKey(Class<T> class1) {
- }
+ return class1.getSimpleName();
- public Configuration getConfiguration() {
+ }
- return (Configuration) configurations.get(getKey(Configuration.class));
+ public Configuration getConfiguration() {
- }
+ return (Configuration) configurations.get(getKey(Configuration.class));
- public RestConfigurationInfo getRestClientConfiguration() {
+ }
- return (RestConfigurationInfo) configurations.get(getKey(RestConfigurationInfo.class));
+ public RestConfigurationInfo getRestClientConfiguration() {
- }
+ return (RestConfigurationInfo) configurations.get(getKey(RestConfigurationInfo.class));
- @Override
- public EcompErrorConfiguration getEcompErrorConfiguration() {
+ }
- return (EcompErrorConfiguration) configurations.get(getKey(EcompErrorConfiguration.class));
+ @Override
+ public EcompErrorConfiguration getEcompErrorConfiguration() {
- }
-
- public PluginsConfiguration getPluginsConfiguration() {
-
- log.info("requested plugins configuration and got this:{}", configurations.get(getKey(PluginsConfiguration.class)));
-
- return (PluginsConfiguration) configurations.get(getKey(PluginsConfiguration.class));
- }
+ return (EcompErrorConfiguration) configurations.get(getKey(EcompErrorConfiguration.class));
- public Configuration getConfigurationAndWatch(ConfigurationListener configurationListener) {
+ }
- if (configurationListener != null) {
+ public PluginsConfiguration getPluginsConfiguration() {
- configurationSource.addWatchConfiguration(Configuration.class, configurationListener);
+ logger.info("requested plugins configuration and got this:{}", configurations.get(getKey(PluginsConfiguration.class)));
- }
- return (Configuration) configurations.get(getKey(Configuration.class));
+ return (PluginsConfiguration) configurations.get(getKey(PluginsConfiguration.class));
+ }
- }
+ public Configuration getConfigurationAndWatch(ConfigurationListener configurationListener) {
- public void reconfigure(BasicConfiguration obj) {
- //
- // if (obj != null) {
- //
- // if (obj instanceof Configuration) {
- // configurations.put(getKey(Configuration.class), obj);
- // }
- //
- // if (obj instanceof EcompErrorConfiguration) {
- // configurations.put(getKey(EcompErrorConfiguration.class), obj);
- // }
- // }
- }
+ if (configurationListener != null) {
- public static ConfigurationManager getConfigurationManager() {
- return instance;
- }
-
- public static void setTestInstance(ConfigurationManager configurationManagerInstance) {
- instance = configurationManagerInstance;
- }
+ configurationSource.addWatchConfiguration(Configuration.class, configurationListener);
+
+ }
+ return (Configuration) configurations.get(getKey(Configuration.class));
+
+ }
+
+ public void reconfigure(BasicConfiguration obj) {
+ //
+ // if (obj != null) {
+ //
+ // if (obj instanceof Configuration) {
+ // configurations.put(getKey(Configuration.class), obj);
+ // }
+ //
+ // if (obj instanceof EcompErrorConfiguration) {
+ // configurations.put(getKey(EcompErrorConfiguration.class), obj);
+ // }
+ // }
+ }
+
+ public static ConfigurationManager getConfigurationManager() {
+ return instance;
+ }
+
+ public static void setTestInstance(ConfigurationManager configurationManagerInstance) {
+ instance = configurationManagerInstance;
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/fe/config/Connection.java b/common-app-api/src/main/java/org/openecomp/sdc/fe/config/Connection.java
index 7208398525..7d681bdba6 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/fe/config/Connection.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/fe/config/Connection.java
@@ -7,9 +7,9 @@
* 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.
@@ -22,27 +22,27 @@ package org.openecomp.sdc.fe.config;
public class Connection {
- private String url;
- private int poolSize;
+ private String url;
+ private int poolSize;
- public String getUrl() {
- return url;
- }
+ public String getUrl() {
+ return url;
+ }
- public void setUrl(String url) {
- this.url = url;
- }
+ public void setUrl(String url) {
+ this.url = url;
+ }
- public int getPoolSize() {
- return poolSize;
- }
+ public int getPoolSize() {
+ return poolSize;
+ }
- public void setPoolSize(int poolSize) {
- this.poolSize = poolSize;
- }
+ public void setPoolSize(int poolSize) {
+ this.poolSize = poolSize;
+ }
- @Override
- public String toString() {
- return String.format("'%s' with pool of %d", getUrl(), getPoolSize());
- }
+ @Override
+ public String toString() {
+ return String.format("'%s' with pool of %d", getUrl(), getPoolSize());
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/fe/config/FeEcompErrorManager.java b/common-app-api/src/main/java/org/openecomp/sdc/fe/config/FeEcompErrorManager.java
index a36293b829..13459713ff 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/fe/config/FeEcompErrorManager.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/fe/config/FeEcompErrorManager.java
@@ -7,9 +7,9 @@
* 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.
@@ -26,51 +26,51 @@ import org.openecomp.sdc.common.config.IEcompConfigurationManager;
public class FeEcompErrorManager extends AbsEcompErrorManager {
- private static volatile FeEcompErrorManager instance;
- private static ConfigurationManager configurationManager;
+ private static volatile FeEcompErrorManager instance;
+ private static ConfigurationManager configurationManager;
- private FeEcompErrorManager() {
- };
+ private FeEcompErrorManager() {
+ }
- public static FeEcompErrorManager getInstance() {
- if (instance == null) {
+ public static FeEcompErrorManager getInstance() {
+ if (instance == null) {
- instance = init();
- }
- return instance;
- }
+ instance = init();
+ }
+ return instance;
+ }
- private static synchronized FeEcompErrorManager init() {
- if (instance == null) {
- instance = new FeEcompErrorManager();
- configurationManager = ConfigurationManager.getConfigurationManager();
- }
- return instance;
- }
+ private static synchronized FeEcompErrorManager init() {
+ if (instance == null) {
+ instance = new FeEcompErrorManager();
+ configurationManager = ConfigurationManager.getConfigurationManager();
+ }
+ return instance;
+ }
- @Override
- public IEcompConfigurationManager getConfigurationManager() {
- return configurationManager;
- }
+ @Override
+ public IEcompConfigurationManager getConfigurationManager() {
+ return configurationManager;
+ }
- public void logFeHealthCheckRecovery(String context) {
- processEcompError(context, EcompErrorEnum.FeHealthCheckRecovery);
- }
+ public void logFeHealthCheckRecovery(String context) {
+ processEcompError(context, EcompErrorEnum.FeHealthCheckRecovery);
+ }
- public void logFeHealthCheckError(String context) {
- processEcompError(context, EcompErrorEnum.FeHealthCheckError);
- }
+ public void logFeHealthCheckError(String context) {
+ processEcompError(context, EcompErrorEnum.FeHealthCheckError);
+ }
- public void logFeHttpLoggingError(String context) {
- processEcompError(context, EcompErrorEnum.FeHttpLoggingError);
- }
+ public void logFeHttpLoggingError(String context) {
+ processEcompError(context, EcompErrorEnum.FeHttpLoggingError);
+ }
- public void logFePortalServletError(String context) {
- processEcompError(context, EcompErrorEnum.FePortalServletError);
- }
+ public void logFePortalServletError(String context) {
+ processEcompError(context, EcompErrorEnum.FePortalServletError);
+ }
- public void logFeHealthCheckGeneralError(String context) {
- processEcompError(context, EcompErrorEnum.FeHealthCheckGeneralError);
- }
+ public void logFeHealthCheckGeneralError(String context) {
+ processEcompError(context, EcompErrorEnum.FeHealthCheckGeneralError);
+ }
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/fe/config/PluginsConfiguration.java b/common-app-api/src/main/java/org/openecomp/sdc/fe/config/PluginsConfiguration.java
index b891c7f85c..449c9eaccc 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/fe/config/PluginsConfiguration.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/fe/config/PluginsConfiguration.java
@@ -7,9 +7,9 @@
* 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.
@@ -134,17 +134,17 @@ public class PluginsConfiguration extends BasicConfiguration {
@Override
public String toString() {
- return "PluginDisplayOptions[" +
- "displayName='" + displayName +
- ", displayContext=" + displayContext +
- ", displayRoles=" + displayRoles +
- ']';
+ return "PluginDisplayOptions["
+ + "displayName='" + displayName
+ + ", displayContext=" + displayContext
+ + ", displayRoles=" + displayRoles
+ + ']';
}
}
@Override
public String toString() {
- return "PluginsConfiguration[" + "pluginsList=" + pluginsList + ", connectionTimeout=" + connectionTimeout +']';
+ return "PluginsConfiguration[" + "pluginsList=" + pluginsList + ", connectionTimeout=" + connectionTimeout + ']';
}
}
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/fe/monitoring/FeMonitoringService.java b/common-app-api/src/main/java/org/openecomp/sdc/fe/monitoring/FeMonitoringService.java
index 0bb33190f8..1ac10a2611 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/fe/monitoring/FeMonitoringService.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/fe/monitoring/FeMonitoringService.java
@@ -7,9 +7,9 @@
* 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.
@@ -46,64 +46,65 @@ import java.util.concurrent.TimeUnit;
public class FeMonitoringService {
- private static final String URL = "%s://%s:%s/sdc2/rest/monitoring";
- private static Logger monitoringLogger = LoggerFactory.getLogger("asdc.fe.monitoring.service");
- private static Logger log = LoggerFactory.getLogger(FeMonitoringService.class.getName());
- private static Gson gson = new GsonBuilder().setPrettyPrinting().create();
+ private static final String URL = "%s://%s:%s/sdc2/rest/monitoring";
+ private static final int DEFAULT_TIMEOUT = 3000;
+ private static Logger monitoringLogger = LoggerFactory.getLogger("asdc.fe.monitoring.service");
+ private static Logger log = LoggerFactory.getLogger(FeMonitoringService.class.getName());
+ private static Gson gson = new GsonBuilder().setPrettyPrinting().create();
- private class MonitoringScheduledTask implements Runnable {
- @Override
- public void run() {
- monitoringLogger.trace("Executing FE Monitoring Task - Start");
- MonitoringEvent monitoringMetrics = MonitoringMetricsFetcher.getInstance().getMonitoringMetrics();
- processMonitoringEvent(monitoringMetrics);
- monitoringLogger.trace("Executing FE Monitoring Task - Status = {}", monitoringMetrics.toString());
- }
- }
+ private class MonitoringScheduledTask implements Runnable {
+ @Override
+ public void run() {
+ monitoringLogger.trace("Executing FE Monitoring Task - Start");
+ MonitoringEvent monitoringMetrics = MonitoringMetricsFetcher.getInstance().getMonitoringMetrics();
+ processMonitoringEvent(monitoringMetrics);
+ monitoringLogger.trace("Executing FE Monitoring Task - Status = {}", monitoringMetrics.toString());
+ }
+ }
- /**
- * This executor will execute the Monitoring task.
- */
- ScheduledExecutorService monitoringExecutor = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() {
- @Override
- public Thread newThread(Runnable r) {
- return new Thread(r, "FE-Monitoring-Thread");
- }
- });
- private ServletContext context;
+ /**
+ * This executor will execute the Monitoring task.
+ */
+ private ScheduledExecutorService monitoringExecutor = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() {
+ @Override
+ public Thread newThread(Runnable r) {
+ return new Thread(r, "FE-Monitoring-Thread");
+ }
+ });
+ private ServletContext context;
- public FeMonitoringService(ServletContext context) {
- this.context = context;
- }
+ public FeMonitoringService(ServletContext context) {
+ this.context = context;
+ }
- public void start(int interval) {
- Configuration config = ((ConfigurationManager) context.getAttribute(Constants.CONFIGURATION_MANAGER_ATTR))
- .getConfiguration();
- if (config.getSystemMonitoring().getEnabled()) {
- log.info("FE monitoring service enabled, interval is {} seconds", interval);
- this.monitoringExecutor.scheduleAtFixedRate(new MonitoringScheduledTask(), 0, interval, TimeUnit.SECONDS);
- } else {
- log.info("FE monitoring service is disabled");
- }
- }
+ public void start(int interval) {
+ Configuration config = ((ConfigurationManager) context.getAttribute(Constants.CONFIGURATION_MANAGER_ATTR))
+ .getConfiguration();
+ if (config.getSystemMonitoring().getEnabled()) {
+ log.info("FE monitoring service enabled, interval is {} seconds", interval);
+ this.monitoringExecutor.scheduleAtFixedRate(new MonitoringScheduledTask(), 0, interval, TimeUnit.SECONDS);
+ } else {
+ log.info("FE monitoring service is disabled");
+ }
+ }
- private void processMonitoringEvent(MonitoringEvent monitoringMetrics) {
- try {
- Configuration config = ((ConfigurationManager) context.getAttribute(Constants.CONFIGURATION_MANAGER_ATTR))
- .getConfiguration();
- String redirectedUrl = String.format(URL, config.getBeProtocol(), config.getBeHost(),
- Constants.HTTPS.equals(config.getBeProtocol()) ? config.getBeSslPort() : config.getBeHttpPort());
+ private void processMonitoringEvent(MonitoringEvent monitoringMetrics) {
+ try {
+ Configuration config = ((ConfigurationManager) context.getAttribute(Constants.CONFIGURATION_MANAGER_ATTR))
+ .getConfiguration();
+ String redirectedUrl = String.format(URL, config.getBeProtocol(), config.getBeHost(),
+ Constants.HTTPS.equals(config.getBeProtocol()) ? config.getBeSslPort() : config.getBeHttpPort());
- int timeout = 3000;
- String monitoringMetricsJson = gson.toJson(monitoringMetrics);
- HttpEntity myEntity = new StringEntity(monitoringMetricsJson, ContentType.APPLICATION_JSON);
- HttpResponse<String> resposne = HttpRequest.post(redirectedUrl, myEntity, new HttpClientConfig(new Timeouts(timeout, timeout)));
+ int timeout = DEFAULT_TIMEOUT;
+ String monitoringMetricsJson = gson.toJson(monitoringMetrics);
+ HttpEntity myEntity = new StringEntity(monitoringMetricsJson, ContentType.APPLICATION_JSON);
+ HttpResponse<String> resposne = HttpRequest.post(redirectedUrl, myEntity, new HttpClientConfig(new Timeouts(timeout, timeout)));
int beResponseStatus = resposne.getStatusCode();
if (beResponseStatus != HttpStatus.SC_OK) {
monitoringLogger.error("Unexpected HTTP response from BE : {}", beResponseStatus);
}
- } catch (Exception e) {
- monitoringLogger.error("Monitoring BE failed with exception ", e);
- }
- }
+ } catch (Exception e) {
+ monitoringLogger.error("Monitoring BE failed with exception ", e);
+ }
+ }
}
diff --git a/common-app-api/src/test/java/org/openecomp/sdc/be/config/ConfigurationManagerTest.java b/common-app-api/src/test/java/org/openecomp/sdc/be/config/ConfigurationManagerTest.java
index 513c237035..eedab171b8 100644
--- a/common-app-api/src/test/java/org/openecomp/sdc/be/config/ConfigurationManagerTest.java
+++ b/common-app-api/src/test/java/org/openecomp/sdc/be/config/ConfigurationManagerTest.java
@@ -46,27 +46,28 @@ public class ConfigurationManagerTest {
@Test
public void testGetConfiguration() {
assertEquals(configurationManager.getConfiguration(),
- ConfigurationManager.getConfigurationManager().configurations.get(Configuration.class.getSimpleName()));
+ ConfigurationManager.getConfigurationManager().getConfigurations()
+ .get(Configuration.class.getSimpleName()));
}
@Test
public void testGetErrorConfiguration() {
assertEquals(configurationManager.getErrorConfiguration(),
- ConfigurationManager.getConfigurationManager().configurations
+ ConfigurationManager.getConfigurationManager().getConfigurations()
.get(ErrorConfiguration.class.getSimpleName()));
}
@Test
public void testGetEcompErrorConfiguration() {
assertEquals(configurationManager.getEcompErrorConfiguration(),
- ConfigurationManager.getConfigurationManager().configurations
+ ConfigurationManager.getConfigurationManager().getConfigurations()
.get(EcompErrorConfiguration.class.getSimpleName()));
}
@Test
public void testGetDistributionEngineConfiguration() {
assertEquals(configurationManager.getDistributionEngineConfiguration(),
- ConfigurationManager.getConfigurationManager().configurations
+ ConfigurationManager.getConfigurationManager().getConfigurations()
.get(DistributionEngineConfiguration.class.getSimpleName()));
}