aboutsummaryrefslogtreecommitdiffstats
path: root/common/src/main
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2018-07-30 15:56:09 -0400
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2018-07-31 11:09:25 -0400
commit5a6a6de6f1a26a1897e4917a0df613e25a24eb70 (patch)
tree59a968f27b4b603aacc9d5e7b51fb598aeec5321 /common/src/main
parentb6dc38501f3b746426b42d9de4cc883d894149e8 (diff)
Containerization feature of SO
Change-Id: I95381232eeefcd247a66a5cec370a8ce1c288e18 Issue-ID: SO-670 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'common/src/main')
-rw-r--r--common/src/main/java/org/onap/so/client/DefaultProperties.java42
-rw-r--r--common/src/main/java/org/onap/so/client/HttpClient.java53
-rw-r--r--common/src/main/java/org/onap/so/client/PreconditionFailedException.java (renamed from common/src/main/java/org/openecomp/mso/client/PreconditionFailedException.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/ResponseExceptionMapper.java (renamed from common/src/main/java/org/openecomp/mso/client/ResponseExceptionMapper.java)35
-rw-r--r--common/src/main/java/org/onap/so/client/ResponseExceptionMapperImpl.java (renamed from common/src/main/java/org/openecomp/mso/client/ResponseExceptionMapperImpl.java)16
-rw-r--r--common/src/main/java/org/onap/so/client/RestClient.java320
-rw-r--r--common/src/main/java/org/onap/so/client/RestClientSSL.java (renamed from common/src/main/java/org/openecomp/mso/client/policy/RestClientSSL.java)41
-rw-r--r--common/src/main/java/org/onap/so/client/RestProperties.java (renamed from common/src/main/java/org/openecomp/mso/client/RestProperties.java)15
-rw-r--r--common/src/main/java/org/onap/so/client/RestPropertiesLoader.java (renamed from common/src/main/java/org/openecomp/mso/client/RestPropertiesLoader.java)18
-rw-r--r--common/src/main/java/org/onap/so/client/RestRequest.java91
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIClient.java62
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIClientResponseExceptionMapper.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/AAIClientResponseExceptionMapper.java)34
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAICommonObjectMapperPatchProvider.java35
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAICommonObjectMapperProvider.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/AAICommonObjectMapperProvider.java)16
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIConfigurationClient.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/AAIConfigurationClient.java)35
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIErrorFormatter.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/AAIErrorFormatter.java)11
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAINamespaceConstants.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/AAINamespaceConstants.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIObjectPlurals.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/AAIObjectPlurals.java)26
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIObjectType.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/AAIObjectType.java)166
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIProperties.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/AAIProperties.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIQueryClient.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/AAIQueryClient.java)50
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIQueryObjectMapperProvider.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/AAIQueryObjectMapperProvider.java)7
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIResourcesClient.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/AAIResourcesClient.java)100
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIResourcesObjectMapperProvider.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/AAIResourcesObjectMapperProvider.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIRestClient.java131
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIRestClientI.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/AAIRestClientI.java)11
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIRestClientImpl.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/AAIRestClientImpl.java)42
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAISubgraphType.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/AAISubgraphType.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/AAITransactionalClient.java)43
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIUpdator.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/AAIUpdator.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIUpdatorImpl.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/AAIUpdatorImpl.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIValidator.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/AAIValidator.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIValidatorImpl.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/AAIValidatorImpl.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIVersion.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/AAIVersion.java)13
-rw-r--r--common/src/main/java/org/onap/so/client/aai/EmptyStringToNullSerializer.java52
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/AAIEntity.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/entities/AAIEntity.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/AAIEntityObject.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/entities/AAIEntityObject.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/AAIError.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/entities/AAIError.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/AAIResultWrapper.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/entities/AAIResultWrapper.java)38
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/Configuration.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/entities/Configuration.java)7
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/CustomQuery.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/entities/CustomQuery.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/Relationships.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/entities/Relationships.java)30
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/RequestError.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/entities/RequestError.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/Results.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/entities/Results.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/ServiceException.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/entities/ServiceException.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/OperationBody.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/entities/bulkprocess/OperationBody.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/Transaction.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/entities/bulkprocess/Transaction.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/Transactions.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/entities/bulkprocess/Transactions.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/AAIResourceUri.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/entities/uri/AAIResourceUri.java)22
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java111
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUri.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/entities/uri/AAIUri.java)30
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUriFactory.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/entities/uri/AAIUriFactory.java)29
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/NodesUri.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/entities/uri/NodesUri.java)19
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUri.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/entities/uri/ServiceInstanceUri.java)81
-rw-r--r--common/src/main/java/org/onap/so/client/aai/objects/AAIOperationalEnvironment.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/objects/AAIOperationalEnvironment.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/aai/objects/AAIServiceInstance.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/objects/AAIServiceInstance.java)240
-rw-r--r--common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestClient.java79
-rw-r--r--common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestProperties.java29
-rw-r--r--common/src/main/java/org/onap/so/client/defaultproperties/DefaultDmaapPropertiesImpl.java (renamed from common/src/main/java/org/openecomp/mso/client/defaultproperties/DefaultDmaapPropertiesImpl.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/defaultproperties/PolicyRestPropertiesImpl.java (renamed from common/src/main/java/org/openecomp/mso/client/defaultproperties/PolicyRestPropertiesImpl.java)14
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/Consumer.java (renamed from common/src/main/java/org/openecomp/mso/client/dmaap/Consumer.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/DmaapClient.java (renamed from common/src/main/java/org/openecomp/mso/client/dmaap/DmaapClient.java)19
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/DmaapConsumer.java (renamed from common/src/main/java/org/openecomp/mso/client/dmaap/DmaapConsumer.java)20
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/DmaapProperties.java (renamed from common/src/main/java/org/openecomp/mso/client/dmaap/DmaapProperties.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/DmaapPropertiesLoader.java (renamed from common/src/main/java/org/openecomp/mso/client/dmaap/DmaapPropertiesLoader.java)19
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/DmaapPublisher.java (renamed from common/src/main/java/org/openecomp/mso/client/dmaap/DmaapPublisher.java)12
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/Publisher.java (renamed from common/src/main/java/org/openecomp/mso/client/dmaap/Publisher.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/exceptions/DMaaPConsumerFailure.java (renamed from common/src/main/java/org/openecomp/mso/client/dmaap/exceptions/DMaaPConsumerFailure.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/exceptions/ExceededMaximumPollingTime.java (renamed from common/src/main/java/org/openecomp/mso/client/dmaap/exceptions/ExceededMaximumPollingTime.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/rest/DMaaPRestClient.java (renamed from common/src/main/java/org/openecomp/mso/client/dmaap/rest/DMaaPRestClient.java)32
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/rest/PropertiesBean.java (renamed from common/src/main/java/org/openecomp/mso/client/dmaap/rest/PropertiesBean.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/rest/RestConsumer.java (renamed from common/src/main/java/org/openecomp/mso/client/dmaap/rest/RestConsumer.java)13
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/rest/RestPublisher.java (renamed from common/src/main/java/org/openecomp/mso/client/dmaap/rest/RestPublisher.java)11
-rw-r--r--common/src/main/java/org/onap/so/client/exceptions/SDNOException.java (renamed from common/src/main/java/org/openecomp/mso/client/exceptions/SDNOException.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/Format.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/Format.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryClient.java48
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectName.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/AAIObjectName.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectPlurals.java25
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectType.java25
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectUriPartial.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/AAIObjectUriPartial.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectUriTemplate.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/AAIObjectUriTemplate.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryVersion.java25
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/uri/Depth.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/entities/uri/Depth.java)9
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryResourceUri.java44
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryUri.java60
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/entities/uri/SimpleUri.java)75
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParser.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/entities/uri/parsers/UriParser.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParserSpringImpl.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/entities/uri/parsers/UriParserSpringImpl.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/exceptions/BulkProcessFailed.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/exceptions/BulkProcessFailed.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryPatchDepthExceededException.java31
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryPayloadException.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/exceptions/AAIPayloadException.java)14
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryUriComputationException.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/exceptions/AAIUriComputationException.java)12
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryUriNotFoundException.java (renamed from common/src/main/java/org/openecomp/mso/client/aai/exceptions/AAIUriNotFoundException.java)10
-rw-r--r--common/src/main/java/org/onap/so/client/grm/GRMAction.java (renamed from common/src/main/java/org/openecomp/mso/client/grm/GRMAction.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/grm/GRMClient.java (renamed from common/src/main/java/org/openecomp/mso/client/grm/GRMClient.java)18
-rw-r--r--common/src/main/java/org/onap/so/client/grm/GRMDefaultPropertiesImpl.java (renamed from common/src/main/java/org/openecomp/mso/client/grm/GRMDefaultPropertiesImpl.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/grm/GRMProperties.java (renamed from common/src/main/java/org/openecomp/mso/client/grm/GRMProperties.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/grm/GRMPropertiesLoader.java (renamed from common/src/main/java/org/openecomp/mso/client/grm/GRMPropertiesLoader.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/grm/GRMRestClient.java (renamed from common/src/main/java/org/openecomp/mso/client/grm/GRMRestClient.java)31
-rw-r--r--common/src/main/java/org/onap/so/client/grm/GRMRestInvoker.java (renamed from common/src/main/java/org/openecomp/mso/client/grm/GRMRestInvoker.java)10
-rw-r--r--common/src/main/java/org/onap/so/client/grm/beans/OperationalInfo.java (renamed from common/src/main/java/org/openecomp/mso/client/grm/beans/OperationalInfo.java)16
-rw-r--r--common/src/main/java/org/onap/so/client/grm/beans/Property.java (renamed from common/src/main/java/org/openecomp/mso/client/grm/beans/Property.java)16
-rw-r--r--common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPoint.java (renamed from common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPoint.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointList.java (renamed from common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPointList.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointLookup.java (renamed from common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPointLookup.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointLookupRequest.java (renamed from common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPointLookupRequest.java)13
-rw-r--r--common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointRequest.java (renamed from common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPointRequest.java)13
-rw-r--r--common/src/main/java/org/onap/so/client/grm/beans/Status.java (renamed from common/src/main/java/org/openecomp/mso/client/grm/beans/Status.java)16
-rw-r--r--common/src/main/java/org/onap/so/client/grm/beans/Version.java (renamed from common/src/main/java/org/openecomp/mso/client/grm/beans/Version.java)16
-rw-r--r--common/src/main/java/org/onap/so/client/grm/beans/VersionLookup.java (renamed from common/src/main/java/org/openecomp/mso/client/grm/beans/VersionLookup.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/grm/exceptions/GRMClientCallFailed.java (renamed from common/src/main/java/org/openecomp/mso/client/grm/exceptions/GRMClientCallFailed.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/policy/CommonObjectMapperProvider.java (renamed from common/src/main/java/org/openecomp/mso/client/policy/CommonObjectMapperProvider.java)15
-rw-r--r--common/src/main/java/org/onap/so/client/policy/DecisionAttributes.java (renamed from common/src/main/java/org/openecomp/mso/client/policy/DecisionAttributes.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/policy/JettisonStyleMapperProvider.java (renamed from common/src/main/java/org/openecomp/mso/client/policy/JettisonStyleMapperProvider.java)22
-rw-r--r--common/src/main/java/org/onap/so/client/policy/LoggingFilter.java (renamed from common/src/main/java/org/openecomp/mso/client/policy/LoggingFilter.java)10
-rw-r--r--common/src/main/java/org/onap/so/client/policy/PolicyClient.java (renamed from common/src/main/java/org/openecomp/mso/client/policy/PolicyClient.java)11
-rw-r--r--common/src/main/java/org/onap/so/client/policy/PolicyClientImpl.java (renamed from common/src/main/java/org/openecomp/mso/client/policy/PolicyClientImpl.java)48
-rw-r--r--common/src/main/java/org/onap/so/client/policy/PolicyRestClient.java (renamed from common/src/main/java/org/openecomp/mso/client/policy/PolicyRestClient.java)38
-rw-r--r--common/src/main/java/org/onap/so/client/policy/PolicyRestProperties.java (renamed from common/src/main/java/org/openecomp/mso/client/policy/PolicyRestProperties.java)12
-rw-r--r--common/src/main/java/org/onap/so/client/policy/entities/AllowedTreatments.java (renamed from common/src/main/java/org/openecomp/mso/client/policy/entities/AllowedTreatments.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/policy/entities/Bbid.java (renamed from common/src/main/java/org/openecomp/mso/client/policy/entities/Bbid.java)138
-rw-r--r--common/src/main/java/org/onap/so/client/policy/entities/DecisionAttributes.java (renamed from common/src/main/java/org/openecomp/mso/client/policy/entities/DecisionAttributes.java)52
-rw-r--r--common/src/main/java/org/onap/so/client/policy/entities/DictionaryData.java (renamed from common/src/main/java/org/openecomp/mso/client/policy/entities/DictionaryData.java)174
-rw-r--r--common/src/main/java/org/onap/so/client/policy/entities/DictionaryItemsRequest.java (renamed from common/src/main/java/org/openecomp/mso/client/policy/entities/DictionaryItemsRequest.java)7
-rw-r--r--common/src/main/java/org/onap/so/client/policy/entities/DictionaryJson.java (renamed from common/src/main/java/org/openecomp/mso/client/policy/entities/DictionaryJson.java)71
-rw-r--r--common/src/main/java/org/onap/so/client/policy/entities/Id.java (renamed from common/src/main/java/org/openecomp/mso/client/policy/entities/Id.java)102
-rw-r--r--common/src/main/java/org/onap/so/client/policy/entities/PolicyDecision.java (renamed from common/src/main/java/org/openecomp/mso/client/policy/PolicyDecision.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/policy/entities/PolicyDecisionRequest.java (renamed from common/src/main/java/org/openecomp/mso/client/policy/PolicyDecisionRequest.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/policy/entities/PolicyServiceType.java (renamed from common/src/main/java/org/openecomp/mso/client/policy/entities/PolicyServiceType.java)6
-rw-r--r--common/src/main/java/org/onap/so/client/policy/entities/Treatments.java (renamed from common/src/main/java/org/openecomp/mso/client/policy/entities/Treatments.java)138
-rw-r--r--common/src/main/java/org/onap/so/client/policy/entities/Workstep.java (renamed from common/src/main/java/org/openecomp/mso/client/policy/entities/Workstep.java)139
-rw-r--r--common/src/main/java/org/onap/so/client/ruby/RubyClient.java (renamed from common/src/main/java/org/openecomp/mso/client/ruby/RubyClient.java)18
-rw-r--r--common/src/main/java/org/onap/so/client/ruby/beans/Event.java (renamed from common/src/main/java/org/openecomp/mso/client/ruby/beans/Event.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/ruby/beans/MsoRequest.java (renamed from common/src/main/java/org/openecomp/mso/client/ruby/beans/MsoRequest.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/ruby/beans/Ruby.java (renamed from common/src/main/java/org/openecomp/mso/client/ruby/beans/Ruby.java)7
-rw-r--r--common/src/main/java/org/onap/so/client/ruby/dmaap/RubyCreateTicketRequestPublisher.java (renamed from common/src/main/java/org/openecomp/mso/client/ruby/dmaap/RubyCreateTicketRequestPublisher.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/sdno/SDNOHealthCheckClient.java (renamed from common/src/main/java/org/openecomp/mso/client/sdno/SDNOHealthCheckClient.java)24
-rw-r--r--common/src/main/java/org/onap/so/client/sdno/SDNOValidator.java (renamed from common/src/main/java/org/openecomp/mso/client/sdno/SDNOValidator.java)25
-rw-r--r--common/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java (renamed from common/src/main/java/org/openecomp/mso/client/sdno/SDNOValidatorImpl.java)56
-rw-r--r--common/src/main/java/org/onap/so/client/sdno/beans/AAIParamList.java (renamed from common/src/main/java/org/openecomp/mso/client/sdno/beans/AAIParamList.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/sdno/beans/Body.java (renamed from common/src/main/java/org/openecomp/mso/client/sdno/beans/Body.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/sdno/beans/Input.java (renamed from common/src/main/java/org/openecomp/mso/client/sdno/beans/Input.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/sdno/beans/RequestHdCustom.java (renamed from common/src/main/java/org/openecomp/mso/client/sdno/beans/RequestHdCustom.java)31
-rw-r--r--common/src/main/java/org/onap/so/client/sdno/beans/RequestHealthDiagnostic.java (renamed from common/src/main/java/org/openecomp/mso/client/sdno/beans/RequestHealthDiagnostic.java)26
-rw-r--r--common/src/main/java/org/onap/so/client/sdno/beans/ResultInfo.java (renamed from common/src/main/java/org/openecomp/mso/client/sdno/beans/ResultInfo.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/sdno/beans/SDNO.java (renamed from common/src/main/java/org/openecomp/mso/client/sdno/beans/SDNO.java)8
-rw-r--r--common/src/main/java/org/onap/so/client/sdno/dmaap/SDNOHealthCheckDmaapConsumer.java (renamed from common/src/main/java/org/openecomp/mso/client/sdno/dmaap/SDNOHealthCheckDmaapConsumer.java)14
-rw-r--r--common/src/main/java/org/onap/so/client/sdno/dmaap/SDNOHealthCheckDmaapPublisher.java (renamed from common/src/main/java/org/openecomp/mso/client/sdno/dmaap/SDNOHealthCheckDmaapPublisher.java)8
-rw-r--r--common/src/main/java/org/onap/so/entity/MsoRequest.java (renamed from common/src/main/java/org/openecomp/mso/entity/MsoRequest.java)9
-rw-r--r--common/src/main/java/org/onap/so/entity/package-info.java (renamed from common/src/main/java/org/openecomp/mso/entity/package-info.java)2
-rw-r--r--common/src/main/java/org/onap/so/exceptions/MarshallerException.java (renamed from common/src/main/java/org/openecomp/mso/utils/RootIgnoringObjectMapper.java)40
-rw-r--r--common/src/main/java/org/onap/so/exceptions/ValidationException.java54
-rw-r--r--common/src/main/java/org/onap/so/jsonpath/JsonPathUtil.java (renamed from common/src/main/java/org/openecomp/mso/jsonpath/JsonPathUtil.java)13
-rw-r--r--common/src/main/java/org/onap/so/logger/LoggerStartupListener.java87
-rw-r--r--common/src/main/java/org/onap/so/logger/MessageEnum.java (renamed from common/src/main/java/org/openecomp/mso/logger/MessageEnum.java)456
-rw-r--r--common/src/main/java/org/onap/so/logger/MsoAlarmLogger.java (renamed from common/src/main/java/org/openecomp/mso/logger/MsoAlarmLogger.java)8
-rw-r--r--common/src/main/java/org/onap/so/logger/MsoLogger.java (renamed from common/src/main/java/org/openecomp/mso/logger/MsoLogger.java)527
-rw-r--r--common/src/main/java/org/onap/so/logging/jaxrs/filter/jersey/JaxRsClientLogging.java135
-rw-r--r--common/src/main/java/org/onap/so/logging/jaxrs/filter/jersey/JaxRsFilterLogging.java180
-rw-r--r--common/src/main/java/org/onap/so/logging/jaxrs/filter/jersey/SpringClientFilter.java67
-rw-r--r--common/src/main/java/org/onap/so/openpojo/rules/CustomSetterMustExistRule.java (renamed from common/src/main/java/org/openecomp/mso/openpojo/rules/CustomSetterMustExistRule.java)8
-rw-r--r--common/src/main/java/org/onap/so/openpojo/rules/EqualsAndHashCodeTester.java (renamed from common/src/main/java/org/openecomp/mso/openpojo/rules/EqualsAndHashCodeTester.java)6
-rw-r--r--common/src/main/java/org/onap/so/openpojo/rules/HasAnnotationMatcher.java (renamed from common/src/main/java/org/openecomp/mso/openpojo/rules/HasAnnotationMatcher.java)20
-rw-r--r--common/src/main/java/org/onap/so/openpojo/rules/HasAnnotationPropertyWithValueMatcher.java (renamed from common/src/main/java/org/openecomp/mso/openpojo/rules/HasAnnotationPropertyWithValueMatcher.java)8
-rw-r--r--common/src/main/java/org/onap/so/openpojo/rules/HasEqualsAndHashCodeRule.java (renamed from common/src/main/java/org/openecomp/mso/openpojo/rules/HasEqualsAndHashCodeRule.java)4
-rw-r--r--common/src/main/java/org/onap/so/openpojo/rules/HasToStringRule.java (renamed from common/src/main/java/org/openecomp/mso/openpojo/rules/HasToStringRule.java)4
-rw-r--r--common/src/main/java/org/onap/so/openpojo/rules/ToStringTester.java (renamed from common/src/main/java/org/openecomp/mso/openpojo/rules/ToStringTester.java)4
-rw-r--r--common/src/main/java/org/onap/so/properties/MsoDatabaseException.java (renamed from common/src/main/java/org/openecomp/mso/properties/MsoDatabaseException.java)2
-rw-r--r--common/src/main/java/org/onap/so/security/MSOSpringFirewall.java34
-rw-r--r--common/src/main/java/org/onap/so/security/UserCredentials.java53
-rw-r--r--common/src/main/java/org/onap/so/security/UserDetailsServiceImpl.java56
-rw-r--r--common/src/main/java/org/onap/so/security/WebSecurityConfig.java76
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/CloudConfiguration.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/CloudConfiguration.java)6
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/ExceptionType.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/ExceptionType.java)13
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/GetOrchestrationListResponse.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/GetOrchestrationListResponse.java)4
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/GetOrchestrationResponse.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/GetOrchestrationResponse.java)2
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/InstanceDirection.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/InstanceDirection.java)6
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/InstanceReferences.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/InstanceReferences.java)8
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/LineOfBusiness.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/LineOfBusiness.java)6
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/ModelInfo.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/ModelInfo.java)23
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/ModelType.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/ModelType.java)5
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/Networks.java98
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/OwningEntity.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/OwningEntity.java)6
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/Platform.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/Platform.java)6
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/PolicyException.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/PolicyException.java)4
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/Project.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/Project.java)6
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/RelatedInstance.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/RelatedInstance.java)4
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/RelatedInstanceList.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/RelatedInstanceList.java)6
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/Request.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/Request.java)5
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/RequestDetails.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestDetails.java)33
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/RequestError.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestError.java)9
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/RequestInfo.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestInfo.java)6
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/RequestList.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestList.java)2
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/RequestParameters.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestParameters.java)75
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/RequestReferences.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestReferences.java)8
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/RequestStatus.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestStatus.java)6
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/Resources.java (renamed from common/src/main/java/org/openecomp/mso/client/policy/entities/PolicyDecisionRequest.java)66
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/Service.java98
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/ServiceException.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/ServiceException.java)7
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/ServiceInstancesRequest.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/ServiceInstancesRequest.java)2
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/ServiceInstancesResponse.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/ServiceInstancesResponse.java)2
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/SubscriberInfo.java (renamed from common/src/main/java/org/openecomp/mso/serviceinstancebeans/SubscriberInfo.java)6
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/VfModules.java99
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/Vnfs.java131
-rw-r--r--common/src/main/java/org/onap/so/test/categories/SlowTests.java25
-rw-r--r--common/src/main/java/org/onap/so/utils/CheckResults.java (renamed from common/src/main/java/org/openecomp/mso/utils/CheckResults.java)2
-rw-r--r--common/src/main/java/org/onap/so/utils/CryptoUtils.java (renamed from common/src/main/java/org/openecomp/mso/utils/CryptoUtils.java)40
-rw-r--r--common/src/main/java/org/onap/so/utils/TargetEntity.java (renamed from common/src/main/java/org/openecomp/mso/properties/MsoPropertiesParameters.java)17
-rw-r--r--common/src/main/java/org/onap/so/utils/UUIDChecker.java (renamed from common/src/main/java/org/openecomp/mso/utils/UUIDChecker.java)12
-rw-r--r--common/src/main/java/org/onap/so/utils/XmlMarshaller.java84
-rw-r--r--common/src/main/java/org/onap/so/web/exceptions/ExceptionResponse.java (renamed from common/src/main/java/org/openecomp/mso/client/policy/entities/PolicyDecision.java)46
-rw-r--r--common/src/main/java/org/onap/so/web/exceptions/RuntimeExceptionMapper.java46
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/AAIClient.java69
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/AAIRestClient.java76
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/objects/AAIOwningEntity.java67
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/objects/AAIProject.java55
-rw-r--r--common/src/main/java/org/openecomp/mso/client/defaultproperties/DefaultAAIPropertiesImpl.java78
-rw-r--r--common/src/main/java/org/openecomp/mso/client/policy/RestClient.java243
-rw-r--r--common/src/main/java/org/openecomp/mso/db/AbstractSessionFactoryManager.java74
-rw-r--r--common/src/main/java/org/openecomp/mso/logger/LogFilter.java68
-rw-r--r--common/src/main/java/org/openecomp/mso/logger/MsoLogInitializer.java108
-rw-r--r--common/src/main/java/org/openecomp/mso/logger/MsoLoggingServlet.java163
-rw-r--r--common/src/main/java/org/openecomp/mso/properties/AbstractMsoProperties.java75
-rw-r--r--common/src/main/java/org/openecomp/mso/properties/MsoJavaProperties.java228
-rw-r--r--common/src/main/java/org/openecomp/mso/properties/MsoJsonProperties.java167
-rw-r--r--common/src/main/java/org/openecomp/mso/properties/MsoPropertiesException.java51
-rw-r--r--common/src/main/java/org/openecomp/mso/properties/MsoPropertiesFactory.java395
-rw-r--r--common/src/main/java/org/openecomp/mso/properties/MsoPropertyInitializer.java87
-rw-r--r--common/src/main/java/org/openecomp/mso/utils/RootIgnoringJsonDeserializer.java67
-rw-r--r--common/src/main/resources/Policy.properties12
-rw-r--r--common/src/main/resources/dmaap/default-consumer.properties2
-rw-r--r--common/src/main/resources/dmaap/default-publisher.properties2
-rw-r--r--common/src/main/resources/test159
233 files changed, 5250 insertions, 4310 deletions
diff --git a/common/src/main/java/org/onap/so/client/DefaultProperties.java b/common/src/main/java/org/onap/so/client/DefaultProperties.java
new file mode 100644
index 0000000000..84509ead05
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/DefaultProperties.java
@@ -0,0 +1,42 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+public class DefaultProperties implements RestProperties {
+
+ private final URL url;
+ public DefaultProperties(URL url) {
+ this.url = url;
+ }
+ @Override
+ public URL getEndpoint() throws MalformedURLException {
+ return this.url;
+ }
+
+ @Override
+ public String getSystemName() {
+ return RestClient.ECOMP_COMPONENT_NAME;
+ }
+
+}
diff --git a/common/src/main/java/org/onap/so/client/HttpClient.java b/common/src/main/java/org/onap/so/client/HttpClient.java
new file mode 100644
index 0000000000..ad13745919
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/HttpClient.java
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client;
+
+import java.net.URL;
+import java.util.Map;
+import java.util.Optional;
+
+import org.onap.so.utils.TargetEntity;
+
+public class HttpClient extends RestClient {
+
+ private TargetEntity targetEntity;
+ public HttpClient(URL host, String contentType, TargetEntity targetEntity) {
+ super(host, contentType);
+ this.targetEntity = targetEntity;
+
+ }
+
+ @Override
+ public TargetEntity getTargetEntity(){
+ return targetEntity;
+ }
+
+ @Override
+ protected void initializeHeaderMap(Map<String, String> headerMap) {
+
+ }
+
+ @Override
+ protected Optional<ResponseExceptionMapper> addResponseExceptionMapper() {
+ return Optional.empty();
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/PreconditionFailedException.java b/common/src/main/java/org/onap/so/client/PreconditionFailedException.java
index df28baac74..4ff07a616d 100644
--- a/common/src/main/java/org/openecomp/mso/client/PreconditionFailedException.java
+++ b/common/src/main/java/org/onap/so/client/PreconditionFailedException.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client;
+package org.onap.so.client;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Response;
diff --git a/common/src/main/java/org/openecomp/mso/client/ResponseExceptionMapper.java b/common/src/main/java/org/onap/so/client/ResponseExceptionMapper.java
index 19c178496c..31cdd50aee 100644
--- a/common/src/main/java/org/openecomp/mso/client/ResponseExceptionMapper.java
+++ b/common/src/main/java/org/onap/so/client/ResponseExceptionMapper.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.
@@ -18,10 +18,11 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client;
+package org.onap.so.client;
import java.io.IOException;
import java.io.InputStream;
+import java.io.StringWriter;
import java.util.Optional;
import javax.ws.rs.BadRequestException;
@@ -33,24 +34,30 @@ import javax.ws.rs.NotAuthorizedException;
import javax.ws.rs.NotFoundException;
import javax.ws.rs.NotSupportedException;
import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.client.ClientRequestContext;
-import javax.ws.rs.client.ClientResponseContext;
-import javax.ws.rs.client.ClientResponseFilter;
import javax.ws.rs.core.Response;
-public abstract class ResponseExceptionMapper implements ClientResponseFilter {
+import org.apache.commons.io.IOUtils;
- @Override
- public void filter(ClientRequestContext requestContext, ClientResponseContext responseContext) throws IOException {
- if (responseContext.getStatus() >= 300) {
+public abstract class ResponseExceptionMapper {
+
+ public void map(Response response) {
+
+ response.bufferEntity();
+ if (response.getStatus() >= 300) {
String message = "empty message";
- if (responseContext.hasEntity()) {
- Optional<String> result = this.extractMessage(responseContext.getEntityStream());
+ if (response.hasEntity()) {
+ StringWriter writer = new StringWriter();
+ try {
+ IOUtils.copy((InputStream)response.getEntity(), writer, "UTF-8");
+ } catch (IOException e) {
+ writer.append("failed to read entity stream");
+ }
+ Optional<String> result = this.extractMessage(writer.toString());
if (result.isPresent()) {
message = result.get();
}
}
- Response.Status status = Response.Status.fromStatusCode(responseContext.getStatus());
+ Response.Status status = Response.Status.fromStatusCode(response.getStatus());
WebApplicationException webAppException;
switch (status) {
case BAD_REQUEST:
@@ -90,5 +97,5 @@ public abstract class ResponseExceptionMapper implements ClientResponseFilter {
}
}
- public abstract Optional<String> extractMessage(InputStream stream) throws IOException;
+ public abstract Optional<String> extractMessage(String entity);
}
diff --git a/common/src/main/java/org/openecomp/mso/client/ResponseExceptionMapperImpl.java b/common/src/main/java/org/onap/so/client/ResponseExceptionMapperImpl.java
index 7841d7accd..0392b49629 100644
--- a/common/src/main/java/org/openecomp/mso/client/ResponseExceptionMapperImpl.java
+++ b/common/src/main/java/org/onap/so/client/ResponseExceptionMapperImpl.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.
@@ -18,26 +18,20 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client;
+package org.onap.so.client;
-import java.io.IOException;
-import java.io.InputStream;
import java.util.Optional;
import javax.annotation.Priority;
import javax.ws.rs.ext.Provider;
-import org.apache.commons.io.IOUtils;
-
@Provider
@Priority(Integer.MIN_VALUE)
public class ResponseExceptionMapperImpl extends ResponseExceptionMapper {
@Override
- public Optional<String> extractMessage(InputStream stream) throws IOException {
- final String input = IOUtils.toString(stream, "UTF-8");
- IOUtils.closeQuietly(stream);
- return Optional.of(input);
+ public Optional<String> extractMessage(String entity) {
+ return Optional.of(entity);
}
diff --git a/common/src/main/java/org/onap/so/client/RestClient.java b/common/src/main/java/org/onap/so/client/RestClient.java
new file mode 100644
index 0000000000..79fd7df7ce
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/RestClient.java
@@ -0,0 +1,320 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client;
+
+import java.net.ConnectException;
+import java.net.MalformedURLException;
+import java.net.SocketTimeoutException;
+import java.net.URI;
+import java.net.URL;
+import java.security.GeneralSecurityException;
+import java.util.ArrayList;
+import java.util.Base64;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Optional;
+import java.util.concurrent.TimeUnit;
+import java.util.function.Predicate;
+
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+import javax.ws.rs.client.Invocation.Builder;
+import javax.ws.rs.client.WebTarget;
+import javax.ws.rs.core.GenericType;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+import javax.ws.rs.core.UriBuilder;
+
+import org.onap.so.client.policy.CommonObjectMapperProvider;
+import org.onap.so.client.policy.LoggingFilter;
+import org.onap.so.logger.MsoLogger;
+import org.onap.so.logging.jaxrs.filter.jersey.JaxRsClientLogging;
+import org.onap.so.utils.CryptoUtils;
+import org.onap.so.utils.TargetEntity;
+import org.slf4j.MDC;
+
+import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
+
+import net.jodah.failsafe.Failsafe;
+import net.jodah.failsafe.RetryPolicy;
+
+
+public abstract class RestClient {
+ public static final String ECOMP_COMPONENT_NAME = "MSO";
+
+ private static final int MAX_PAYLOAD_SIZE = 1024 * 1024;
+ private WebTarget webTarget;
+
+ protected final Map<String, String> headerMap;
+ protected final MsoLogger msoLogger;
+ protected URL host;
+ protected Optional<URI> path;
+ protected String accept;
+ protected String contentType;
+ protected String requestId;
+ protected JaxRsClientLogging jaxRsClientLogging;
+ protected RestProperties props;
+
+ protected RestClient(RestProperties props, Optional<URI> path) {
+
+ msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL, RestClient.class);
+ this.requestId = MDC.get(MsoLogger.REQUEST_ID);
+ if (requestId == null) {
+ requestId = "";
+ }
+ headerMap = new HashMap<>();
+ try {
+ host = props.getEndpoint();
+ } catch (MalformedURLException e) {
+
+ throw new RuntimeException(e);
+ }
+ this.props = props;
+ this.path = path;
+ }
+
+ protected RestClient(RestProperties props, Optional<URI> path, String accept, String contentType) {
+ this(props, path);
+ this.accept = accept;
+ this.contentType = contentType;
+ this.requestId = MDC.get(MsoLogger.REQUEST_ID);
+ if (requestId == null) {
+ requestId = "";
+ }
+ this.props = props;
+ }
+
+ protected RestClient(URL host, String contentType) {
+ headerMap = new HashMap<>();
+
+ msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL, RestClient.class);
+ this.path = Optional.empty();
+ this.host = host;
+ this.contentType = contentType;
+ this.requestId = MDC.get(MsoLogger.REQUEST_ID);
+ if (requestId == null) {
+ requestId = "";
+ }
+ this.props = new DefaultProperties(host);
+ }
+
+ /**
+ * Override method to return false to disable logging.
+ *
+ * @return true - to enable logging, false otherwise
+ */
+ protected boolean enableLogging() {
+ return true;
+ }
+
+ /**
+ * Override method to return custom value for max payload size.
+ *
+ * @return Default value for MAX_PAYLOAD_SIZE = 1024 * 1024
+ */
+ protected int getMaxPayloadSize()
+ {
+ return MAX_PAYLOAD_SIZE;
+ }
+
+ protected Builder getBuilder() {
+
+ if (webTarget == null) {
+ initializeClient(getClient());
+ }
+ Builder builder = webTarget.request();
+ initializeHeaderMap(headerMap);
+
+ headerMap.put("X-ECOMP-RequestID", requestId);
+ for (Entry<String, String> entry : headerMap.entrySet()) {
+ builder.header(entry.getKey(), entry.getValue());
+ }
+ return builder;
+ }
+
+ protected abstract void initializeHeaderMap(Map<String, String> headerMap);
+
+ protected Optional<ResponseExceptionMapper> addResponseExceptionMapper() {
+ return Optional.of(new ResponseExceptionMapperImpl());
+ }
+
+ protected CommonObjectMapperProvider getCommonObjectMapperProvider() {
+ return new CommonObjectMapperProvider();
+ }
+
+ /**
+ * Adds a basic authentication header to the request.
+ * @param auth the encrypted credentials
+ * @param key the key for decrypting the credentials
+ */
+ protected void addBasicAuthHeader(String auth, String key) {
+ try {
+ byte[] decryptedAuth = CryptoUtils.decrypt(auth, key).getBytes();
+ String authHeaderValue = "Basic " + Base64.getEncoder().encodeToString(decryptedAuth);
+ headerMap.put("Authorization", authHeaderValue);
+ } catch (GeneralSecurityException e) {
+ msoLogger.error(e.getMessage(), e);
+ }
+ }
+
+ protected String getAccept() {
+ return accept;
+ }
+
+ protected String getContentType() {
+ return contentType;
+ }
+
+ protected String getMergeContentType() {
+ return "application/merge-patch+json";
+ }
+
+ protected Client getClient() {
+ return ClientBuilder.newBuilder().build();
+ }
+
+ protected abstract TargetEntity getTargetEntity();
+
+ protected void initializeClient(Client client) {
+ if (this.enableLogging()) {
+ client.register(new LoggingFilter(this.getMaxPayloadSize()));
+ }
+ CommonObjectMapperProvider provider = this.getCommonObjectMapperProvider();
+ client.register(new JacksonJsonProvider(provider.getMapper()));
+
+ jaxRsClientLogging = new JaxRsClientLogging();
+ jaxRsClientLogging.setTargetService(getTargetEntity());
+ client.register(jaxRsClientLogging);
+
+ if (!path.isPresent()) {
+ webTarget = client.target(host.toString());
+ } else {
+ webTarget = client.target(UriBuilder.fromUri(host + path.get().toString()));
+ }
+ if (getAccept() == null || getAccept().isEmpty()) {
+ this.accept = MediaType.APPLICATION_JSON;
+ }
+ if (getContentType() == null || getContentType().isEmpty()) {
+ this.contentType = MediaType.APPLICATION_JSON;
+ }
+ }
+
+ protected List<Predicate<Throwable>> retryOn() {
+
+ List<Predicate<Throwable>> result = new ArrayList<>();
+
+ result.add(e -> {
+ return e.getCause() instanceof SocketTimeoutException;
+ });
+ result.add(e -> {
+ return e.getCause() instanceof ConnectException;
+ });
+ return result;
+ }
+
+ public Response get() {
+ return method("GET", null);
+ }
+
+ public Response post(Object obj) {
+ return method("POST", obj);
+ }
+
+ public Response patch(Object obj) {
+ return method("PATCH", obj);
+ }
+
+ public Response put(Object obj) {
+ return method("PUT", obj);
+ }
+
+ public Response delete() {
+ return method("DELETE", null);
+ }
+
+ public Response delete(Object obj) {
+ return method("DELETE", obj);
+ }
+
+ public <T> Optional<T> get(Class<T> resultClass) {
+ return format(method("GET", null), resultClass);
+ }
+
+ public <T> Optional<T> get(GenericType<T> resultClass) {
+ return format(method("GET", null), resultClass);
+ }
+
+ public <T> T post(Object obj, Class<T> resultClass) {
+ return format(method("POST", obj), resultClass).orElse(null);
+ }
+
+ public <T> T patch(Object obj, Class<T> resultClass) {
+ return format(method("PATCH", obj), resultClass).orElse(null);
+ }
+
+ public <T> T put(Object obj, Class<T> resultClass) {
+ return format(method("PUT", obj), resultClass).orElse(null);
+ }
+
+ public <T> T delete(Class<T> resultClass) {
+ return format(method("DELETE", null), resultClass).orElse(null);
+ }
+
+ public <T> T delete(Object obj, Class<T> resultClass) {
+ return format(method("DELETE", obj), resultClass).orElse(null);
+ }
+
+ private Response method(String method, Object entity) {
+ RetryPolicy policy = new RetryPolicy();
+
+ List<Predicate<Throwable>> items = retryOn();
+
+ Predicate<Throwable> pred = items.stream().reduce(Predicate::or).orElse(x -> false);
+
+ policy.retryOn(error -> pred.test(error));
+
+ policy.withDelay(this.props.getDelayBetweenRetries(), TimeUnit.MILLISECONDS)
+ .withMaxRetries(this.props.getRetries());
+
+ return Failsafe.with(policy).get(buildRequest(method, entity));
+ }
+
+ protected RestRequest buildRequest(String method, Object entity) {
+ return new RestRequest(this, method, entity);
+ }
+ private <T> Optional<T> format(Response response, Class<T> resultClass) {
+ if (this.props.mapNotFoundToEmpty() && response.getStatus() == Status.NOT_FOUND.getStatusCode()) {
+ return Optional.empty();
+ }
+ return Optional.of(response.readEntity(resultClass));
+ }
+
+ private <T> Optional<T> format(Response response, GenericType<T> resultClass) {
+ if (this.props.mapNotFoundToEmpty() && response.getStatus() == Status.NOT_FOUND.getStatusCode()) {
+ return Optional.empty();
+ }
+ return Optional.of(response.readEntity(resultClass));
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/RestClientSSL.java b/common/src/main/java/org/onap/so/client/RestClientSSL.java
index 6146fc373f..461bb5832c 100644
--- a/common/src/main/java/org/openecomp/mso/client/policy/RestClientSSL.java
+++ b/common/src/main/java/org/onap/so/client/RestClientSSL.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.
@@ -18,47 +18,38 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.policy;
+package org.onap.so.client;
import java.io.FileInputStream;
-import java.io.IOException;
import java.net.URI;
-import java.security.NoSuchAlgorithmException;
import java.security.KeyStore;
+import java.security.NoSuchAlgorithmException;
import java.util.Optional;
-import java.util.Properties;
-import java.util.UUID;
import javax.net.ssl.SSLContext;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
-import org.openecomp.mso.client.RestProperties;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-
public abstract class RestClientSSL extends RestClient {
public static final String SSL_KEY_STORE_KEY = "javax.net.ssl.keyStore";
- public static String SSL_KEY_STORE_PASSWORD_KEY;
+ public static final String SSL_KEY_STORE_PASSWORD_KEY = "javax.net.ssl.keyStorePassword";
public static final String MSO_LOAD_SSL_CLIENT_KEYSTORE_KEY = "mso.load.ssl.client.keystore";
- protected RestClientSSL(RestProperties props, UUID requestId, Optional<URI> path) {
- super(props, requestId, path);
+ protected RestClientSSL(RestProperties props, Optional<URI> path) {
+ super(props, path);
}
- protected RestClientSSL(RestProperties props, UUID requestId, Optional<URI> path, String accept, String contentType) {
- super(props, requestId, path, accept, contentType);
+ protected RestClientSSL(RestProperties props, Optional<URI> path, String accept, String contentType) {
+ super(props, path, accept, contentType);
}
@Override
protected Client getClient() {
+
Client client = null;
- Properties keyProp = new Properties ();
try {
- keyProp.load (Thread.currentThread ().getContextClassLoader ().getResourceAsStream ("Policy.properties"));
- SSL_KEY_STORE_PASSWORD_KEY=(String) keyProp.get ("ssl.key.store.password.key");
String loadSSLKeyStore = System.getProperty(RestClientSSL.MSO_LOAD_SSL_CLIENT_KEYSTORE_KEY);
if(loadSSLKeyStore != null && loadSSLKeyStore.equalsIgnoreCase("true")) {
KeyStore ks = getKeyStore();
@@ -71,22 +62,17 @@ public abstract class RestClientSSL extends RestClient {
//Use default SSL context
client = ClientBuilder.newBuilder().sslContext(SSLContext.getDefault()).build();
this.msoLogger.debug("RestClientSSL using default SSL context!");
- } catch (NoSuchAlgorithmException | IOException e) {
- this.msoLogger.error(MessageEnum.APIH_GENERAL_EXCEPTION, "AAI", "Client init", MsoLogger.ErrorCode.UnknownError, "could not create SSL client", e);
+ } catch (NoSuchAlgorithmException e) {
+ //this.logger.error(MessageEnum.APIH_GENERAL_EXCEPTION, "AAI", "Client init", MsoLogger.ErrorCode.UnknownError, "could not create SSL client", e);
throw new RuntimeException(e);
}
return client;
}
- private KeyStore getKeyStore() throws IOException {
+ private KeyStore getKeyStore() {
KeyStore ks = null;
- Properties keyProp = new Properties ();
-
- keyProp.load (Thread.currentThread ().getContextClassLoader ().getResourceAsStream ("Policy.properties"));
- SSL_KEY_STORE_PASSWORD_KEY=(String) keyProp.get ("ssl.key.store.password.key");
char[] password = System.getProperty(RestClientSSL.SSL_KEY_STORE_PASSWORD_KEY).toCharArray();
FileInputStream fis = null;
-
try {
ks = KeyStore.getInstance(KeyStore.getDefaultType());
fis = new FileInputStream(System.getProperty(RestClientSSL.SSL_KEY_STORE_KEY));
@@ -95,7 +81,6 @@ public abstract class RestClientSSL extends RestClient {
catch(Exception e) {
return null;
}
-
finally {
if (fis != null) {
try {
diff --git a/common/src/main/java/org/openecomp/mso/client/RestProperties.java b/common/src/main/java/org/onap/so/client/RestProperties.java
index ae8862de5e..7043e89b1e 100644
--- a/common/src/main/java/org/openecomp/mso/client/RestProperties.java
+++ b/common/src/main/java/org/onap/so/client/RestProperties.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client;
+package org.onap.so.client;
import java.net.MalformedURLException;
import java.net.URL;
@@ -27,4 +27,13 @@ public interface RestProperties {
public URL getEndpoint() throws MalformedURLException;
public String getSystemName();
+ public default Integer getRetries() {
+ return Integer.valueOf(2);
+ }
+ public default Long getDelayBetweenRetries() {
+ return Long.valueOf(500);
+ }
+ public default boolean mapNotFoundToEmpty() {
+ return false;
+ }
}
diff --git a/common/src/main/java/org/openecomp/mso/client/RestPropertiesLoader.java b/common/src/main/java/org/onap/so/client/RestPropertiesLoader.java
index 647acdfcf4..570b48ecb8 100644
--- a/common/src/main/java/org/openecomp/mso/client/RestPropertiesLoader.java
+++ b/common/src/main/java/org/onap/so/client/RestPropertiesLoader.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.
@@ -18,16 +18,21 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client;
+package org.onap.so.client;
import java.util.Iterator;
import java.util.ServiceLoader;
public class RestPropertiesLoader {
- private final ServiceLoader<RestProperties> services;
+ /* required to make ServiceLoader thread safe */
+ private static final ThreadLocal<ServiceLoader<RestProperties>> services = new ThreadLocal<ServiceLoader<RestProperties>>() {
+ @Override
+ protected ServiceLoader<RestProperties> initialValue() {
+ return ServiceLoader.load(RestProperties.class);
+ }
+ };
private RestPropertiesLoader() {
- services = ServiceLoader.load(RestProperties.class);
}
private static class Helper {
@@ -47,7 +52,8 @@ public class RestPropertiesLoader {
private <T> T getImpl(Class<? extends RestProperties> clazz, boolean forceNewInstance) {
T result = null;
- Iterator<RestProperties> propertyImpls = services.iterator();
+ ServiceLoader<RestProperties> loader = this.services.get();
+ Iterator<RestProperties> propertyImpls = loader.iterator();
RestProperties item;
while (propertyImpls.hasNext()) {
item = propertyImpls.next();
diff --git a/common/src/main/java/org/onap/so/client/RestRequest.java b/common/src/main/java/org/onap/so/client/RestRequest.java
new file mode 100644
index 0000000000..25bf54b643
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/RestRequest.java
@@ -0,0 +1,91 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client;
+
+import java.util.Optional;
+import java.util.concurrent.Callable;
+
+import javax.ws.rs.NotFoundException;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+
+import org.onap.so.logger.MsoLogger;
+
+public class RestRequest implements Callable<Response> {
+
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL, RestRequest.class);
+
+ private final RestClient client;
+ private final String method;
+ private final Object entity;
+
+ public RestRequest(RestClient client, String method, Object entity) {
+ this.client = client;
+ this.method = method;
+ this.entity = entity;
+ }
+ @Override
+ public Response call() throws Exception {
+ final Response response;
+ if ("GET".equals(method)) {
+ response = this.client.getBuilder().accept(this.client.getAccept()).get();
+ } else if ("POST".equals(method)) {
+ response = this.client.getBuilder().accept(this.client.getAccept()).post(Entity.entity(entity, this.client.getContentType()));
+ } else if ("PATCH".equals(method)) {
+ response = this.client.getBuilder().header("X-HTTP-Method-Override", "PATCH").accept(this.client.getAccept())
+ .post(Entity.entity(entity, this.client.getMergeContentType()));
+ } else if ("DELETE".equals(method)) {
+ if (entity == null) {
+ response = this.client.getBuilder().accept(this.client.getAccept()).delete();
+
+ } else {
+ response = this.client.getBuilder().header("X-HTTP-Method-Override", "DELETE").accept(this.client.getAccept())
+ .post(Entity.entity(entity, this.client.getContentType()));
+ }
+ } else if ("PUT".equals(method)) {
+ response = this.client.getBuilder().accept(this.client.getAccept()).put(Entity.entity(entity, this.client.getContentType()));
+ } else {
+ response = Response.serverError().entity(method + " not valid").build();
+ }
+
+ Optional<ResponseExceptionMapper> mapper = this.client.addResponseExceptionMapper();
+ if (mapper.isPresent()) {
+ try {
+ mapper.get().map(response);
+ } catch (NotFoundException e) {
+ if (this.client.props.mapNotFoundToEmpty()) {
+ msoLogger.error(e);
+ return response;
+ } else {
+ throw e;
+ }
+ }
+ } else {
+ if (response.getStatus() == Status.NOT_FOUND.getStatusCode() && this.client.props.mapNotFoundToEmpty()) {
+ return response;
+ }
+ }
+
+ return response;
+ }
+
+}
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIClient.java b/common/src/main/java/org/onap/so/client/aai/AAIClient.java
new file mode 100644
index 0000000000..39843b2263
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/aai/AAIClient.java
@@ -0,0 +1,62 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.aai;
+
+import java.net.URI;
+
+import javax.ws.rs.core.UriBuilder;
+
+import org.onap.so.client.RestClient;
+import org.onap.so.client.graphinventory.GraphInventoryClient;
+import org.onap.so.client.graphinventory.entities.uri.GraphInventoryUri;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public abstract class AAIClient extends GraphInventoryClient {
+
+ private static final String AAI_ROOT = "/aai";
+ protected static Logger logger = LoggerFactory.getLogger(AAIClient.class);
+ protected AAIVersion version;
+ public AAIClient() {
+ super(AAIProperties.class);
+ }
+
+ public AAIClient(AAIVersion version) {
+ super(AAIProperties.class);
+ }
+ @Override
+ protected URI constructPath(GraphInventoryUri uri) {
+
+ return UriBuilder.fromUri(AAI_ROOT + "/" + this.getVersion().toString() + uri.build().toString()).build();
+ }
+ @Override
+ protected RestClient createClient(GraphInventoryUri uri) {
+ return new AAIRestClient(getRestProperties(), constructPath(uri));
+ }
+
+ protected AAIVersion getVersion() {
+ if (version == null) {
+ return this.<AAIProperties>getRestProperties().getDefaultVersion();
+ } else {
+ return this.version;
+ }
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIClientResponseExceptionMapper.java b/common/src/main/java/org/onap/so/client/aai/AAIClientResponseExceptionMapper.java
index 657b4c5a2c..514eab6fc4 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAIClientResponseExceptionMapper.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIClientResponseExceptionMapper.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.
@@ -18,44 +18,46 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.aai;
import java.io.IOException;
-import java.io.InputStream;
import java.util.Optional;
-import java.util.UUID;
import javax.annotation.Priority;
import javax.ws.rs.ext.Provider;
-import org.openecomp.mso.client.ResponseExceptionMapper;
-import org.openecomp.mso.client.aai.entities.AAIError;
+import javax.annotation.Priority;
+import javax.ws.rs.ext.Provider;
+
+import org.onap.so.client.ResponseExceptionMapper;
+import org.onap.so.client.aai.entities.AAIError;
+import org.onap.so.logger.MsoLogger;
+import org.slf4j.MDC;
-import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.ObjectMapper;
@Provider
@Priority(Integer.MIN_VALUE)
public class AAIClientResponseExceptionMapper extends ResponseExceptionMapper {
- private final UUID requestId;
- public AAIClientResponseExceptionMapper(UUID requestId) {
- this.requestId = requestId;
+ private final String requestId;
+ public AAIClientResponseExceptionMapper() {
+ this.requestId = MDC.get(MsoLogger.REQUEST_ID);
}
@Override
- public Optional<String> extractMessage(InputStream stream) throws IOException {
+ public Optional<String> extractMessage(String entity) {
String errorString = "Error calling A&AI. Request-Id=" + this.getRequestId() + " ";
try {
- AAIError error = new ObjectMapper().readValue(stream, AAIError.class);
+ AAIError error = new ObjectMapper().readValue(entity, AAIError.class);
AAIErrorFormatter formatter = new AAIErrorFormatter(error);
return Optional.of(errorString + formatter.getMessage());
- } catch (JsonParseException e) {
- return Optional.of(errorString);
+ } catch (IOException e) {
+ return Optional.of(errorString + entity);
}
}
- protected UUID getRequestId() {
+ protected String getRequestId() {
return this.requestId;
}
}
diff --git a/common/src/main/java/org/onap/so/client/aai/AAICommonObjectMapperPatchProvider.java b/common/src/main/java/org/onap/so/client/aai/AAICommonObjectMapperPatchProvider.java
new file mode 100644
index 0000000000..33c9769400
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/aai/AAICommonObjectMapperPatchProvider.java
@@ -0,0 +1,35 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.aai;
+
+import com.fasterxml.jackson.databind.module.SimpleModule;
+
+public class AAICommonObjectMapperPatchProvider extends AAICommonObjectMapperProvider {
+
+
+ public AAICommonObjectMapperPatchProvider() {
+ super();
+ EmptyStringToNullSerializer sp = new EmptyStringToNullSerializer();
+ SimpleModule emptyStringModule = new SimpleModule();
+ emptyStringModule.addSerializer(String.class, sp);
+ mapper.registerModule(emptyStringModule);
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAICommonObjectMapperProvider.java b/common/src/main/java/org/onap/so/client/aai/AAICommonObjectMapperProvider.java
index cbee903835..0e2071842f 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAICommonObjectMapperProvider.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAICommonObjectMapperProvider.java
@@ -18,9 +18,9 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.aai;
-import javax.ws.rs.ext.ContextResolver;
+import org.onap.so.client.policy.CommonObjectMapperProvider;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
@@ -33,9 +33,7 @@ import com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector;
import com.fasterxml.jackson.databind.type.TypeFactory;
import com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector;
-public class AAICommonObjectMapperProvider implements ContextResolver<ObjectMapper> {
-
- final ObjectMapper mapper;
+public class AAICommonObjectMapperProvider extends CommonObjectMapperProvider {
public AAICommonObjectMapperProvider() {
mapper = new ObjectMapper();
@@ -51,12 +49,4 @@ public class AAICommonObjectMapperProvider implements ContextResolver<ObjectMapp
mapper.setAnnotationIntrospector(AnnotationIntrospector.pair(aiJaxb, aiJackson));
}
- @Override
- public ObjectMapper getContext(Class<?> type) {
- return mapper;
- }
-
- public ObjectMapper getMapper() {
- return mapper;
- }
}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIConfigurationClient.java b/common/src/main/java/org/onap/so/client/aai/AAIConfigurationClient.java
index fdeb975ad1..b29c8070c8 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAIConfigurationClient.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIConfigurationClient.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.
@@ -18,18 +18,18 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.aai;
-import org.openecomp.mso.client.aai.entities.Configuration;
-import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
-import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory;
-import org.openecomp.mso.serviceinstancebeans.RequestDetails;
+import org.onap.so.client.aai.entities.Configuration;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.serviceinstancebeans.RequestDetails;
public class AAIConfigurationClient {
private AAIResourcesClient aaiClient;
- private static final String ORCHESTRATION_STATUS = "PendingCreate";
+ private static final String ORCHESTRATION_STATUS = "PreCreated";
public AAIConfigurationClient() {
aaiClient = new AAIResourcesClient();
@@ -37,6 +37,16 @@ public class AAIConfigurationClient {
public void createConfiguration(RequestDetails requestDetails, String configurationId, String configurationType,
String configurationSubType) {
+
+ AAIResourceUri uri = getConfigurationURI(configurationId);
+ Configuration payload = configurePayload(requestDetails, configurationId, configurationType, configurationSubType);
+
+ aaiClient.create(uri, payload);
+ }
+
+ public Configuration configurePayload(RequestDetails requestDetails, String configurationId, String configurationType,
+ String configurationSubType) {
+
Configuration payload = new Configuration();
payload.setConfigurationId(configurationId);
payload.setConfigurationType(configurationType);
@@ -45,11 +55,10 @@ public class AAIConfigurationClient {
payload.setModelVersionId(requestDetails.getModelInfo().getModelVersionId());
payload.setOrchestrationStatus(ORCHESTRATION_STATUS);
payload.setOperationalStatus("");
- AAIResourceUri uri = getConfigurationURI(payload.getConfigurationId());
- payload.setConfigurationSelflink(uri.build().getPath());
+ payload.setConfigurationSelflink(getConfigurationURI(configurationId).build().getPath());
payload.setModelCustomizationId(requestDetails.getModelInfo().getModelCustomizationId());
-
- aaiClient.create(uri, payload);
+
+ return payload;
}
public void deleteConfiguration(String uuid) {
@@ -61,7 +70,7 @@ public class AAIConfigurationClient {
}
public Configuration getConfiguration(String uuid) {
- return aaiClient.get(Configuration.class, getConfigurationURI(uuid));
+ return aaiClient.get(Configuration.class, getConfigurationURI(uuid)).orElse(null);
}
public boolean configurationExists(String uuid) {
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIErrorFormatter.java b/common/src/main/java/org/onap/so/client/aai/AAIErrorFormatter.java
index dd56e9712f..6b3bb545de 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAIErrorFormatter.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIErrorFormatter.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.
@@ -18,13 +18,12 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.aai;
import java.util.List;
-import java.util.Optional;
-import org.openecomp.mso.client.aai.entities.AAIError;
-import org.openecomp.mso.client.aai.entities.ServiceException;
+import org.onap.so.client.aai.entities.AAIError;
+import org.onap.so.client.aai.entities.ServiceException;
public class AAIErrorFormatter {
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAINamespaceConstants.java b/common/src/main/java/org/onap/so/client/aai/AAINamespaceConstants.java
index 4bdfc4d793..242fd41b19 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAINamespaceConstants.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAINamespaceConstants.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.aai;
public class AAINamespaceConstants {
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIObjectPlurals.java b/common/src/main/java/org/onap/so/client/aai/AAIObjectPlurals.java
index dc2831c1ed..c50653a203 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAIObjectPlurals.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIObjectPlurals.java
@@ -18,22 +18,31 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.aai;
+
+import org.onap.so.client.graphinventory.GraphInventoryObjectPlurals;
import com.google.common.base.CaseFormat;
-public enum AAIObjectPlurals implements AAIObjectName, AAIObjectUriTemplate, AAIObjectUriPartial {
+public enum AAIObjectPlurals implements GraphInventoryObjectPlurals {
GENERIC_VNF(AAINamespaceConstants.NETWORK, "/generic-vnfs"),
- PSERVER(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/pservers");
-
+ PSERVER(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/pservers"),
+ P_INTERFACE(AAIObjectType.PSERVER.uriTemplate(), "/p-interfaces"),
+ L3_NETWORK(AAINamespaceConstants.NETWORK, "/l3-networks"),
+ SERVICE_SUBSCRIPTION(AAIObjectType.CUSTOMER.uriTemplate(), "/service-subscriptions"),
+ SERVICE_INSTANCE(AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), "/service-instances"),
+ OWNING_ENTITIES(AAINamespaceConstants.BUSINESS, "/owning-entities"),
+ VOLUME_GROUP(AAIObjectType.CLOUD_REGION.uriTemplate(), "/volume-groups/");
+
+
private final String uriTemplate;
private final String partialUri;
private AAIObjectPlurals(String parentUri, String partialUri) {
this.uriTemplate = parentUri + partialUri;
this.partialUri = partialUri;
}
-
+
@Override
public String toString() {
return this.uriTemplate();
@@ -55,11 +64,6 @@ public enum AAIObjectPlurals implements AAIObjectName, AAIObjectUriTemplate, AAI
}
@Override
public String typeName(CaseFormat format) {
- String enumName = this.name();
- if (this.equals(AAIObjectType.DEFAULT_CLOUD_REGION) || this.equals(AAIObjectType.DEFAULT_TENANT)) {
- enumName = enumName.replace("DEFAULT_", "");
- }
-
- return CaseFormat.UPPER_UNDERSCORE.to(format, enumName);
+ return CaseFormat.UPPER_UNDERSCORE.to(format, this.name());
}
}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIObjectType.java b/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java
index 9026c29522..ce75b1716a 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAIObjectType.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIObjectType.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.
@@ -18,81 +18,87 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
-
-import com.google.common.base.CaseFormat;
-
-public enum AAIObjectType implements AAIObjectName, AAIObjectUriTemplate, AAIObjectUriPartial {
-
- DEFAULT_CLOUD_REGION(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/cloud-regions/cloud-region/att-aic/{cloud-region-id}"),
- CUSTOMER(AAINamespaceConstants.BUSINESS, "/customers/customer/{global-customer-id}"),
- GENERIC_QUERY("/search", "/generic-query"),
- BULK_PROCESS("/bulkprocess", ""),
- GENERIC_VNF(AAINamespaceConstants.NETWORK, "/generic-vnfs/generic-vnf/{vnf-id}"),
- VF_MODULE(AAIObjectType.GENERIC_VNF.uriTemplate(), "/vf-modules/vf-module/{vf-module-id}"),
- L3_NETWORK(AAINamespaceConstants.NETWORK, "/l3-networks/l3-network/{network-id}"),
- NETWORK_POLICY(AAINamespaceConstants.NETWORK, "/network-policies/network-policy/{network-policy-id}"),
- NODES_QUERY("/search", "/nodes-query"),
- CUSTOM_QUERY("/query", ""),
- ROUTE_TABLE_REFERENCE(AAINamespaceConstants.NETWORK, "/route-table-references/route-table-reference/{route-table-reference-id}"),
- DEFAULT_TENANT(AAINamespaceConstants.CLOUD_INFRASTRUCTURE + "/cloud-regions/cloud-region/att-aic/AAIAIC25", "/tenants/tenant/{tenant-id}"),
- VCE(AAINamespaceConstants.NETWORK, "/vces/vce/{vnf-id}"),
- VPN_BINDING(AAINamespaceConstants.NETWORK, "/vpn-bindings/vpn-binding/{vpn-id}"),
- CONFIGURATION(AAINamespaceConstants.NETWORK, "/configurations/configuration/{configuration-id}"),
- PSERVER(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/pservers/pserver/{hostname}"),
- SERVICE_SUBSCRIPTION(AAIObjectType.CUSTOMER.uriTemplate(), "/service-subscriptions/service-subscription/{service-type}"),
- SERVICE_INSTANCE(AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), "/service-instances/service-instance/{service-instance-id}"),
- PROJECT(AAINamespaceConstants.BUSINESS, "/projects/project/{id}"),
- LINE_OF_BUSINESS(AAINamespaceConstants.BUSINESS, "/lines-of-business/line-of-business/{id}"),
- PLATFORM(AAINamespaceConstants.BUSINESS, "/platforms/platform/{id}"),
- OWNING_ENTITY(AAINamespaceConstants.BUSINESS, "/owning-entities/owning-entity/{id}"),
- ALLOTTED_RESOURCE(AAIObjectType.SERVICE_INSTANCE.uriTemplate(), "/allotted-resources/allotted-resource/{id}"),
- PNF(AAINamespaceConstants.NETWORK, "/pnfs/pnf/{pnf-name}"),
- OPERATIONAL_ENVIRONMENT(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/operational-environments/operational-environment/{operational-environment-id}"),
- CLOUD_REGION(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/cloud-regions/cloud-region/{cloud-owner-id}/{cloud-region-id}"),
- TENANT(AAIObjectType.CLOUD_REGION.uriTemplate(), "/tenants/tenant/{tenant-id}"),
- VSERVER(AAIObjectType.TENANT.uriTemplate(), "/vservers/vserver/{vserver-id}"),
- MODEL_VER(AAINamespaceConstants.SERVICE_DESIGN_AND_CREATION + "/models/model/{model-invariant-id}", "/model-vers/model-ver/{model-version-id}"),
- TUNNEL_XCONNECT(AAIObjectType.ALLOTTED_RESOURCE.uriTemplate(), "/tunnel-xconnects/tunnel-xconnect/{id}"),
- P_INTERFACE(AAIObjectType.PSERVER.uriTemplate(), "/p-interfaces/p-interface/{interface-name}"),
- PHYSICAL_LINK(AAINamespaceConstants.NETWORK, "/physical-links/physical-link/{link-name}"),
- UNKNOWN("", "");
-
- private final String uriTemplate;
- private final String parentUri;
- private final String partialUri;
- private AAIObjectType(String parentUri, String partialUri) {
- this.parentUri = parentUri;
- this.partialUri = partialUri;
- this.uriTemplate = parentUri + partialUri;
- }
-
- @Override
- public String toString() {
- return this.uriTemplate();
- }
-
- @Override
- public String typeName() {
- return this.typeName(CaseFormat.LOWER_HYPHEN);
- }
- @Override
- public String typeName(CaseFormat format) {
- String enumName = this.name();
- if (this.equals(AAIObjectType.DEFAULT_CLOUD_REGION) || this.equals(AAIObjectType.DEFAULT_TENANT)) {
- enumName = enumName.replace("DEFAULT_", "");
- }
-
- return CaseFormat.UPPER_UNDERSCORE.to(format, enumName);
- }
-
- @Override
- public String uriTemplate() {
- return this.uriTemplate;
- }
-
- @Override
- public String partialUri() {
- return this.partialUri;
- }
-} \ No newline at end of file
+package org.onap.so.client.aai;
+
+import org.onap.so.client.graphinventory.GraphInventoryObjectType;
+
+import com.google.common.base.CaseFormat;
+
+public enum AAIObjectType implements GraphInventoryObjectType {
+
+ DEFAULT_CLOUD_REGION(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/cloud-regions/cloud-region/att-aic/{cloud-region-id}"),
+ CUSTOMER(AAINamespaceConstants.BUSINESS, "/customers/customer/{global-customer-id}"),
+ GENERIC_QUERY("/search", "/generic-query"),
+ BULK_PROCESS("/bulkprocess", ""),
+ GENERIC_VNF(AAINamespaceConstants.NETWORK, "/generic-vnfs/generic-vnf/{vnf-id}"),
+ VF_MODULE(AAIObjectType.GENERIC_VNF.uriTemplate(), "/vf-modules/vf-module/{vf-module-id}"),
+ L3_NETWORK(AAINamespaceConstants.NETWORK, "/l3-networks/l3-network/{network-id}"),
+ NETWORK_POLICY(AAINamespaceConstants.NETWORK, "/network-policies/network-policy/{network-policy-id}"),
+ NODES_QUERY("/search", "/nodes-query"),
+ CUSTOM_QUERY("/query", ""),
+ ROUTE_TABLE_REFERENCE(AAINamespaceConstants.NETWORK, "/route-table-references/route-table-reference/{route-table-reference-id}"),
+ DEFAULT_TENANT(AAINamespaceConstants.CLOUD_INFRASTRUCTURE + "/cloud-regions/cloud-region/att-aic/AAIAIC25", "/tenants/tenant/{tenant-id}"),
+ VCE(AAINamespaceConstants.NETWORK, "/vces/vce/{vnf-id}"),
+ VPN_BINDING(AAINamespaceConstants.NETWORK, "/vpn-bindings/vpn-binding/{vpn-id}"),
+ VPN_BINDINGS(AAINamespaceConstants.NETWORK, "/vpn-bindings"),
+ CONFIGURATION(AAINamespaceConstants.NETWORK, "/configurations/configuration/{configuration-id}"),
+ PSERVER(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/pservers/pserver/{hostname}"),
+ SERVICE_SUBSCRIPTION(AAIObjectType.CUSTOMER.uriTemplate(), "/service-subscriptions/service-subscription/{service-type}"),
+ SERVICE_INSTANCE(AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), "/service-instances/service-instance/{service-instance-id}"),
+ PROJECT(AAINamespaceConstants.BUSINESS, "/projects/project/{id}"),
+ LINE_OF_BUSINESS(AAINamespaceConstants.BUSINESS, "/lines-of-business/line-of-business/{id}"),
+ PLATFORM(AAINamespaceConstants.BUSINESS, "/platforms/platform/{id}"),
+ OWNING_ENTITY(AAINamespaceConstants.BUSINESS, "/owning-entities/owning-entity/{id}"),
+ ALLOTTED_RESOURCE(AAIObjectType.SERVICE_INSTANCE.uriTemplate(), "/allotted-resources/allotted-resource/{id}"),
+ PNF(AAINamespaceConstants.NETWORK, "/pnfs/pnf/{pnf-name}"),
+ OPERATIONAL_ENVIRONMENT(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/operational-environments/operational-environment/{operational-environment-id}"),
+ CLOUD_REGION(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/cloud-regions/cloud-region/{cloud-owner-id}/{cloud-region-id}"),
+ TENANT(AAIObjectType.CLOUD_REGION.uriTemplate(), "/tenants/tenant/{tenant-id}"),
+ VOLUME_GROUP(AAIObjectType.CLOUD_REGION.uriTemplate(), "/volume-groups/volume-group/{volume-group-id}"),
+ VSERVER(AAIObjectType.TENANT.uriTemplate(), "/vservers/vserver/{vserver-id}"),
+ MODEL_VER(AAINamespaceConstants.SERVICE_DESIGN_AND_CREATION + "/models/model/{model-invariant-id}", "/model-vers/model-ver/{model-version-id}"),
+ TUNNEL_XCONNECT(AAIObjectType.ALLOTTED_RESOURCE.uriTemplate(), "/tunnel-xconnects/tunnel-xconnect/{tunnel-id}"),
+ P_INTERFACE(AAIObjectType.PSERVER.uriTemplate(), "/p-interfaces/p-interface/{interface-name}"),
+ PHYSICAL_LINK(AAINamespaceConstants.NETWORK, "/physical-links/physical-link/{link-name}"),
+ INSTANCE_GROUP(AAINamespaceConstants.NETWORK, "/instance-groups/instance-group/{id}"),
+ COLLECTION(AAINamespaceConstants.NETWORK, "/collections/collection/{collection-id}"),
+ UNKNOWN("", "");
+
+ private final String uriTemplate;
+ private final String parentUri;
+ private final String partialUri;
+ private AAIObjectType(String parentUri, String partialUri) {
+ this.parentUri = parentUri;
+ this.partialUri = partialUri;
+ this.uriTemplate = parentUri + partialUri;
+ }
+
+ @Override
+ public String toString() {
+ return this.uriTemplate();
+ }
+
+ @Override
+ public String typeName() {
+ return this.typeName(CaseFormat.LOWER_HYPHEN);
+ }
+ @Override
+ public String typeName(CaseFormat format) {
+ String enumName = this.name();
+ if (this.equals(AAIObjectType.DEFAULT_CLOUD_REGION) || this.equals(AAIObjectType.DEFAULT_TENANT)) {
+ enumName = enumName.replace("DEFAULT_", "");
+ }
+
+ return CaseFormat.UPPER_UNDERSCORE.to(format, enumName);
+ }
+
+ @Override
+ public String uriTemplate() {
+ return this.uriTemplate;
+ }
+
+ @Override
+ public String partialUri() {
+ return this.partialUri;
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIProperties.java b/common/src/main/java/org/onap/so/client/aai/AAIProperties.java
index c208d6dd5f..9f6708200c 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAIProperties.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIProperties.java
@@ -18,13 +18,17 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.aai;
-import org.openecomp.mso.client.RestProperties;
+import org.onap.so.client.RestProperties;
public interface AAIProperties extends RestProperties {
public AAIVersion getDefaultVersion();
public String getAuth();
public String getKey();
+ @Override
+ public default boolean mapNotFoundToEmpty() {
+ return true;
+ }
}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIQueryClient.java b/common/src/main/java/org/onap/so/client/aai/AAIQueryClient.java
index f8707dec3e..184b4e5251 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAIQueryClient.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIQueryClient.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.
@@ -18,47 +18,34 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.aai;
import java.util.Optional;
-import java.util.UUID;
-import org.openecomp.mso.client.aai.entities.CustomQuery;
-import org.openecomp.mso.client.aai.entities.uri.AAIUri;
-import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory;
-import org.openecomp.mso.client.policy.RestClient;
-import org.openecomp.mso.client.aai.AAIVersion;
+import org.onap.so.client.RestClient;
+import org.onap.so.client.aai.entities.CustomQuery;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.client.graphinventory.Format;
+import org.onap.so.client.graphinventory.entities.uri.GraphInventoryUri;
public class AAIQueryClient extends AAIClient {
-
- private final AAIVersion version;
private Optional<String> depth = Optional.empty();
private boolean nodesOnly = false;
private Optional<AAISubgraphType> subgraph = Optional.empty();
public AAIQueryClient() {
- super(UUID.randomUUID());
- this.version = super.getVersion();
- }
-
- public AAIQueryClient(AAIVersion version, UUID requestId) {
- super(requestId);
- this.version = version;
+ super();
}
public AAIQueryClient(AAIVersion version) {
- this(version, UUID.randomUUID());
+ super();
+ this.version = version;
}
public String query(Format format, CustomQuery query) {
return this.createClient(AAIUriFactory.createResourceUri(AAIObjectType.CUSTOM_QUERY).queryParam("format", format.toString()))
- .addRequestId(requestId).put(query, String.class);
- }
-
- @Override
- protected AAIVersion getVersion() {
- return this.version;
+ .put(query, String.class);
}
public AAIQueryClient depth (String depth) {
@@ -76,9 +63,8 @@ public class AAIQueryClient extends AAIClient {
return this;
}
- @Override
- public RestClient createClient(AAIUri uri) {
- AAIUri clone = uri.clone();
+ protected GraphInventoryUri setupQueryParams(GraphInventoryUri uri) {
+ GraphInventoryUri clone = uri.clone();
if (this.depth.isPresent()) {
clone.queryParam("depth", depth.get());
}
@@ -88,6 +74,10 @@ public class AAIQueryClient extends AAIClient {
if (this.subgraph.isPresent()) {
clone.queryParam("subgraph", this.subgraph.get().toString());
}
- return super.createClient(clone);
+ return clone;
+ }
+ @Override
+ protected RestClient createClient(GraphInventoryUri uri) {
+ return super.createClient(setupQueryParams(uri));
}
-} \ No newline at end of file
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIQueryObjectMapperProvider.java b/common/src/main/java/org/onap/so/client/aai/AAIQueryObjectMapperProvider.java
index 425d9ce60b..d5eeb83041 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAIQueryObjectMapperProvider.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIQueryObjectMapperProvider.java
@@ -18,10 +18,9 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.aai;
import com.fasterxml.jackson.databind.AnnotationIntrospector;
-import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector;
import com.fasterxml.jackson.databind.type.TypeFactory;
import com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector;
@@ -37,8 +36,4 @@ public class AAIQueryObjectMapperProvider extends AAICommonObjectMapperProvider
}
- @Override
- public ObjectMapper getContext(Class<?> type) {
- return mapper;
- }
}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIResourcesClient.java b/common/src/main/java/org/onap/so/client/aai/AAIResourcesClient.java
index c55e5e9eee..04757c6fc2 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAIResourcesClient.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIResourcesClient.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.
@@ -18,40 +18,33 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.aai;
+import java.lang.reflect.InvocationTargetException;
import java.util.Map;
import java.util.Optional;
-import java.util.UUID;
import javax.ws.rs.NotFoundException;
-import javax.ws.rs.client.ResponseProcessingException;
import javax.ws.rs.core.GenericType;
-
import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+
import org.onap.aai.domain.yang.Relationship;
-import org.openecomp.mso.client.aai.entities.AAIResultWrapper;
-import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
-import org.openecomp.mso.client.aai.entities.uri.AAIUri;
-import org.openecomp.mso.client.aai.entities.uri.Depth;
-import org.openecomp.mso.client.policy.RestClient;
+import org.onap.so.client.RestClient;
+import org.onap.so.client.RestProperties;
+import org.onap.so.client.aai.entities.AAIResultWrapper;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIUri;
+import org.onap.so.client.graphinventory.entities.uri.Depth;
public class AAIResourcesClient extends AAIClient {
-
- private final AAIVersion version;
-
+
public AAIResourcesClient() {
- super(UUID.randomUUID());
- this.version = super.getVersion();
+ super();
}
public AAIResourcesClient(AAIVersion version) {
- super(UUID.randomUUID());
- this.version = version;
- }
-
- public AAIResourcesClient(AAIVersion version, UUID requestId) {
- super(requestId);
+ super();
this.version = version;
}
@@ -89,16 +82,8 @@ public class AAIResourcesClient extends AAIClient {
public boolean exists(AAIResourceUri uri) {
AAIUri forceMinimal = this.addParams(Optional.of(Depth.ZERO), true, uri);
RestClient aaiRC = this.createClient(forceMinimal);
- try{
- aaiRC.get();
- } catch(ResponseProcessingException e) {
- if (e.getCause() instanceof NotFoundException) {
- return false;
- } else {
- throw e;
- }
- }
- return true;
+
+ return aaiRC.get().getStatus() == Status.OK.getStatusCode();
}
/**
@@ -137,7 +122,8 @@ public class AAIResourcesClient extends AAIClient {
public void delete(AAIResourceUri uri) {
AAIResourceUri clone = uri.clone();
RestClient aaiRC = this.createClient(clone);
- Map<String, Object> result = aaiRC.get(new GenericType<Map<String, Object>>(){});
+ Map<String, Object> result = aaiRC.get(new GenericType<Map<String, Object>>(){})
+ .orElseThrow(() -> new NotFoundException(clone.build() + " does not exist in A&AI"));
String resourceVersion = (String) result.get("resource-version");
aaiRC = this.createClient(clone.resourceVersion(resourceVersion));
aaiRC.delete();
@@ -154,17 +140,17 @@ public class AAIResourcesClient extends AAIClient {
aaiRC.patch(obj);
return;
}
-
+
/**
* Retrieves an object from A&AI and unmarshalls it into the Class specified
* @param clazz
* @param uri
* @return
*/
- public <T> T get(Class<T> clazz, AAIResourceUri uri) {
+ public <T> Optional<T> get(Class<T> clazz, AAIResourceUri uri) {
return this.createClient(uri).get(clazz);
}
-
+
/**
* Retrieves an object from A&AI and returns complete response
* @param uri
@@ -180,7 +166,7 @@ public class AAIResourcesClient extends AAIClient {
* @param uri
* @return
*/
- public <T> T get(GenericType<T> resultClass, AAIResourceUri uri) {
+ public <T> Optional<T> get(GenericType<T> resultClass, AAIResourceUri uri) {
return this.createClient(uri).get(resultClass);
}
@@ -191,11 +177,31 @@ public class AAIResourcesClient extends AAIClient {
* @return
*/
public AAIResultWrapper get(AAIResourceUri uri) {
- String json = this.createClient(uri).get(String.class);
+ String json = this.createClient(uri).get(String.class).orElse(null);
+ return new AAIResultWrapper(json);
+ }
+
+ /**
+ * Retrieves an object from A&AI wrapped in a helper class which offer additional features
+ * If the object cannot be found in A&AI the method will throw the runtime exception
+ * included as an argument
+ * @param uri
+ * @return
+ */
+ public AAIResultWrapper get(AAIResourceUri uri, Class<? extends RuntimeException> c) {
+ RuntimeException e;
+ try {
+ e = c.getConstructor(String.class).newInstance(uri.build() + " not found in A&AI");
+ } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException
+ | NoSuchMethodException | SecurityException e1) {
+ throw new IllegalArgumentException("could not create instance for " + c.getName());
+ }
+ String json = this.createClient(uri).get(String.class)
+ .orElseThrow(() -> e);
return new AAIResultWrapper(json);
-
}
+
private Relationship buildRelationship(AAIResourceUri uri) {
final Relationship result = new Relationship();
result.setRelatedLink(uri.build().toString());
@@ -227,17 +233,7 @@ public class AAIResourcesClient extends AAIClient {
* @return
*/
public AAITransactionalClient beginTransaction() {
- return new AAITransactionalClient(this.version, this.requestId);
- }
-
- @Override
- protected AAIVersion getVersion() {
- return this.version;
- }
-
- @Override
- protected RestClient createClient(AAIUri uri) {
- return super.createClient(uri);
+ return new AAITransactionalClient(this.getVersion());
}
private AAIUri addParams(Optional<Depth> depth, boolean nodesOnly, AAIUri uri) {
@@ -251,4 +247,8 @@ public class AAIResourcesClient extends AAIClient {
return clone;
}
+ @Override
+ protected <T extends RestProperties> T getRestProperties() {
+ return super.getRestProperties();
+ }
}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIResourcesObjectMapperProvider.java b/common/src/main/java/org/onap/so/client/aai/AAIResourcesObjectMapperProvider.java
index ada1939951..15f2ed2fa2 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAIResourcesObjectMapperProvider.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIResourcesObjectMapperProvider.java
@@ -18,9 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
+package org.onap.so.client.aai;
public class AAIResourcesObjectMapperProvider extends AAICommonObjectMapperProvider {
@@ -28,8 +26,4 @@ public class AAIResourcesObjectMapperProvider extends AAICommonObjectMapperProvi
super();
}
- @Override
- public ObjectMapper getContext(Class<?> type) {
- return mapper;
- }
}
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIRestClient.java b/common/src/main/java/org/onap/so/client/aai/AAIRestClient.java
new file mode 100644
index 0000000000..2bd5f118c0
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/aai/AAIRestClient.java
@@ -0,0 +1,131 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.aai;
+
+import java.net.URI;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.regex.Pattern;
+
+import javax.ws.rs.core.Response;
+
+import org.onap.so.client.ResponseExceptionMapper;
+import org.onap.so.client.RestClientSSL;
+import org.onap.so.client.graphinventory.exceptions.GraphInventoryPatchDepthExceededException;
+import org.onap.so.client.policy.CommonObjectMapperProvider;
+import org.onap.so.jsonpath.JsonPathUtil;
+import org.onap.so.utils.TargetEntity;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+
+public class AAIRestClient extends RestClientSSL {
+
+ private final AAIProperties aaiProperties;
+ private static final AAICommonObjectMapperProvider standardProvider = new AAICommonObjectMapperProvider();
+ private static final AAICommonObjectMapperPatchProvider patchProvider = new AAICommonObjectMapperPatchProvider();
+ private static final Pattern LOCATE_COMPLEX_OBJECT = Pattern.compile("^((?!relationship-list).)+?\\['[^\\[\\]]+?'\\]$");
+
+ protected AAIRestClient(AAIProperties props, URI uri) {
+ super(props, Optional.of(uri));
+ this.aaiProperties = props;
+ }
+
+ @Override
+ public TargetEntity getTargetEntity(){
+ return TargetEntity.AAI;
+ }
+
+ @Override
+ protected void initializeHeaderMap(Map<String, String> headerMap) {
+ headerMap.put("X-FromAppId", "MSO");
+ headerMap.put("X-TransactionId", requestId);
+ String auth = aaiProperties.getAuth();
+ String key = aaiProperties.getKey();
+
+ if (auth != null && !auth.isEmpty() && key != null && !key.isEmpty()) {
+ addBasicAuthHeader(auth, key);
+ }
+ }
+
+ @Override
+ protected Optional<ResponseExceptionMapper> addResponseExceptionMapper() {
+
+ return Optional.of(new AAIClientResponseExceptionMapper());
+ }
+
+ @Override
+ protected CommonObjectMapperProvider getCommonObjectMapperProvider() {
+ return standardProvider;
+ }
+
+ @Override
+ public Response patch(Object obj) {
+ String value = convertObjectToPatchFormat(obj);
+ validatePatchObject(value);
+ return super.patch(value);
+ }
+
+ @Override
+ public <T> T patch(Object obj, Class<T> resultClass) {
+ String value = convertObjectToPatchFormat(obj);
+ validatePatchObject(value);
+ return super.patch(value, resultClass);
+ }
+
+ protected String convertObjectToPatchFormat(Object obj) {
+ Object value = obj;
+ try {
+ if (!(obj instanceof Map || obj instanceof String)) {
+ value = patchProvider.getMapper().writeValueAsString(obj);
+ } else if (obj instanceof Map) {
+ value = standardProvider.getMapper().writeValueAsString(obj);
+ }
+ } catch (JsonProcessingException e) {
+ value = "{}";
+ }
+
+ return (String)value;
+ }
+
+
+ protected void validatePatchObject(String payload) {
+ if (hasComplexObject(payload)) {
+ throw new GraphInventoryPatchDepthExceededException(payload);
+ }
+ }
+
+ /** validates client side that json does not include any complex objects
+ * relationship-list is omitted from this validation
+ */
+ protected boolean hasComplexObject(String json) {
+ if (json.isEmpty()) {
+ return false;
+ }
+ String complex = "$.*.*";
+ String array = "$.*.*.*";
+ List<String> result = JsonPathUtil.getInstance().getPathList(json, complex);
+ List<String> result2 = JsonPathUtil.getInstance().getPathList(json, array);
+
+ result.addAll(result2);
+ return result.stream().anyMatch(item -> LOCATE_COMPLEX_OBJECT.matcher(item).find());
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIRestClientI.java b/common/src/main/java/org/onap/so/client/aai/AAIRestClientI.java
index 6819ba1edf..b56a6779cc 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAIRestClientI.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIRestClientI.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.
@@ -18,12 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.aai;
+
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.List;
-
import java.util.Optional;
+
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.Pnf;
import org.onap.aai.domain.yang.Pserver;
@@ -41,7 +42,7 @@ public interface AAIRestClientI {
void updateMaintenceFlag(String vnfId,boolean inMaint, String transactionLoggingUuid) throws Exception;
void updateMaintenceFlagVnfId(String vnfId, boolean inMaint, String transactionLoggingUuid) throws Exception;
-
+
GenericVnf getVnfByName(String vnfId, String transactionLoggingUuid) throws Exception;
Optional<Pnf> getPnfByName(String pnfId, String transactionLoggingUuid) throws Exception;
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIRestClientImpl.java b/common/src/main/java/org/onap/so/client/aai/AAIRestClientImpl.java
index a84aeaac8e..b471a1e53d 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAIRestClientImpl.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIRestClientImpl.java
@@ -18,10 +18,9 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.aai;
+
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
@@ -36,17 +35,20 @@ import org.onap.aai.domain.yang.GenericVnfs;
import org.onap.aai.domain.yang.Pnf;
import org.onap.aai.domain.yang.Pserver;
import org.onap.aai.domain.yang.Pservers;
-import org.openecomp.mso.client.aai.entities.CustomQuery;
-import org.openecomp.mso.client.aai.entities.Results;
-import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
-import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.client.aai.entities.CustomQuery;
+import org.onap.so.client.aai.entities.Results;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.client.graphinventory.Format;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
-@Service
+
public class AAIRestClientImpl implements AAIRestClientI {
- private static final EELFLogger logger = EELFManager.getInstance().getMetricsLogger();
+ private static Logger logger = LoggerFactory.getLogger(AAIClient.class);
private static final AAIVersion ENDPOINT_VERSION = AAIVersion.V10;
private static final String ENDPOINT_GET_ALL = ENDPOINT_VERSION + "/cloud-infrastructure/pservers";
private static final String ENDPOINT_GET_ALL_VNFS = ENDPOINT_VERSION + "/network/generic-vnfs";
@@ -79,8 +81,8 @@ public class AAIRestClientImpl implements AAIRestClientI {
logger.warn("could not parse uuid: " + uuid + " creating valid uuid automatically");
requestId = UUID.randomUUID();
}
- return new AAIResourcesClient(ENDPOINT_VERSION, requestId)
- .get(Pservers.class, AAIUriFactory.createResourceUri(AAIObjectPlurals.PSERVER));
+ return new AAIResourcesClient(ENDPOINT_VERSION)
+ .get(Pservers.class, AAIUriFactory.createResourceUri(AAIObjectPlurals.PSERVER)).orElse(null);
}
@Override
@@ -94,7 +96,7 @@ public class AAIRestClientImpl implements AAIRestClientI {
}
List<AAIResourceUri> startNodes = new ArrayList<>();
startNodes.add(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId));
- String jsonInput = new AAIQueryClient(ENDPOINT_VERSION, requestId)
+ String jsonInput = new AAIQueryClient(ENDPOINT_VERSION)
.query(Format.RESOURCE, new CustomQuery(startNodes, PSERVER_VNF_QUERY));
return this.getListOfPservers(jsonInput);
@@ -102,7 +104,7 @@ public class AAIRestClientImpl implements AAIRestClientI {
}
protected List<Pserver> getListOfPservers(String jsonInput) throws IOException {
- ObjectMapper mapper = new AAICommonObjectMapperProvider().getContext(Object.class);
+ ObjectMapper mapper = new AAICommonObjectMapperProvider().getMapper();
Results<Map<String, Pserver>> resultsFromJson = mapper.readValue(jsonInput,
new TypeReference<Results<Map<String, Pserver>>>() {
});
@@ -122,8 +124,8 @@ public class AAIRestClientImpl implements AAIRestClientI {
logger.warn("could not parse uuid: " + transactionLoggingUuid + " creating valid uuid automatically");
requestId = UUID.randomUUID();
}
- GenericVnfs genericVnfs = new AAIResourcesClient(ENDPOINT_VERSION, requestId).get(GenericVnfs.class,
- AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName));
+ GenericVnfs genericVnfs = new AAIResourcesClient(ENDPOINT_VERSION).get(GenericVnfs.class,
+ AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName)).orElse(null);
if (genericVnfs.getGenericVnf().size() > 1) {
throw new IndexOutOfBoundsException("Multiple Generic Vnfs Returned");
}
@@ -144,7 +146,7 @@ public class AAIRestClientImpl implements AAIRestClientI {
}
GenericVnf genericVnf = new GenericVnf();
genericVnf.setInMaint(inMaint);
- new AAIResourcesClient(ENDPOINT_VERSION, requestId)
+ new AAIResourcesClient(ENDPOINT_VERSION)
.update(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId), genericVnf);
}
@@ -158,8 +160,8 @@ public class AAIRestClientImpl implements AAIRestClientI {
logger.warn("could not parse uuid: " + transactionLoggingUuid + " creating valid uuid automatically");
requestId = UUID.randomUUID();
}
- return new AAIResourcesClient(ENDPOINT_VERSION, requestId)
- .get(GenericVnf.class, AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId));
+ return new AAIResourcesClient(ENDPOINT_VERSION)
+ .get(GenericVnf.class, AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)).orElse(null);
}
@Override
@@ -171,7 +173,7 @@ public class AAIRestClientImpl implements AAIRestClientI {
logger.warn("could not parse uuid: " + transactionLoggingUuid + " creating valid uuid automatically", e);
requestId = UUID.randomUUID();
}
- Response response = new AAIResourcesClient(ENDPOINT_VERSION, requestId)
+ Response response = new AAIResourcesClient(ENDPOINT_VERSION)
.getFullResponse(AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnfId));
if (response.getStatus() != 200) {
return Optional.empty();
@@ -189,7 +191,7 @@ public class AAIRestClientImpl implements AAIRestClientI {
logger.warn("could not parse uuid: " + transactionLoggingUuid + " creating valid uuid automatically", e);
requestId = UUID.randomUUID();
}
- new AAIResourcesClient(ENDPOINT_VERSION, requestId)
+ new AAIResourcesClient(ENDPOINT_VERSION)
.createIfNotExists(AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnfId), Optional.of(pnf));
}
}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAISubgraphType.java b/common/src/main/java/org/onap/so/client/aai/AAISubgraphType.java
index 917949967f..e9beb143fd 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAISubgraphType.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAISubgraphType.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.aai;
public enum AAISubgraphType {
@@ -35,4 +35,4 @@ public enum AAISubgraphType {
public String toString() {
return name;
}
-} \ No newline at end of file
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAITransactionalClient.java b/common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java
index 547862708a..884d2aaec6 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAITransactionalClient.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.aai;
import java.io.IOException;
import java.util.ArrayList;
@@ -27,22 +27,22 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
-import java.util.UUID;
+import javax.ws.rs.NotFoundException;
import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.Response;
import org.onap.aai.domain.yang.Relationship;
-import org.openecomp.mso.client.aai.entities.AAIError;
-import org.openecomp.mso.client.aai.entities.bulkprocess.OperationBody;
-import org.openecomp.mso.client.aai.entities.bulkprocess.Transaction;
-import org.openecomp.mso.client.aai.entities.bulkprocess.Transactions;
-import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
-import org.openecomp.mso.client.aai.entities.uri.AAIUri;
-import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory;
-import org.openecomp.mso.client.aai.exceptions.BulkProcessFailed;
-import org.openecomp.mso.client.policy.RestClient;
-import org.openecomp.mso.jsonpath.JsonPathUtil;
+import org.onap.so.client.RestClient;
+import org.onap.so.client.aai.entities.AAIError;
+import org.onap.so.client.aai.entities.bulkprocess.OperationBody;
+import org.onap.so.client.aai.entities.bulkprocess.Transaction;
+import org.onap.so.client.aai.entities.bulkprocess.Transactions;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIUri;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.client.graphinventory.exceptions.BulkProcessFailed;
+import org.onap.so.jsonpath.JsonPathUtil;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -54,8 +54,8 @@ public class AAITransactionalClient extends AAIClient {
private Transaction currentTransaction;
private final AAIVersion version;
private int actionCount = 0;
- protected AAITransactionalClient(AAIVersion version, UUID requestId) {
- super(requestId);
+ protected AAITransactionalClient(AAIVersion version) {
+ super();
this.version = version;
this.transactions = new Transactions();
startTransaction();
@@ -164,7 +164,8 @@ public class AAITransactionalClient extends AAIClient {
public AAITransactionalClient delete(AAIResourceUri uri) {
AAIResourcesClient client = new AAIResourcesClient();
AAIResourceUri clone = uri.clone();
- Map<String, Object> result = client.get(new GenericType<Map<String, Object>>(){}, clone);
+ Map<String, Object> result = client.get(new GenericType<Map<String, Object>>(){}, clone)
+ .orElseThrow(() -> new NotFoundException(clone.build() + " does not exist in A&AI"));
String resourceVersion = (String) result.get("resource-version");
currentTransaction.getDelete().add(new OperationBody().withUri(clone.resourceVersion(resourceVersion).build().toString()).withBody(""));
incrementActionAmount();
@@ -196,7 +197,7 @@ public class AAITransactionalClient extends AAIClient {
if (response.hasEntity()) {
final Optional<String> errorMessage = this.locateErrorMessages(response.readEntity(String.class));
if (errorMessage.isPresent()) {
- throw new BulkProcessFailed("One or more transactions failed in A&AI. Request-id=" + this.getRequestId() + ". Check logs for payloads.\nMessages:\n" + errorMessage.get());
+ throw new BulkProcessFailed("One or more transactions failed in A&AI. Check logs for payloads.\nMessages:\n" + errorMessage.get());
}
} else {
throw new BulkProcessFailed("Transactions acccepted by A&AI, but there was no response. Unsure of result.");
@@ -219,7 +220,7 @@ public class AAITransactionalClient extends AAIClient {
parsed.add(mapper.readValue(result, new TypeReference<Map<String, Object>>(){}));
}
} catch (IOException e) {
- metricsLogger.error("could not map json", e);
+ logger.error("could not map json", e);
}
for (Map<String, Object> map : parsed) {
for (Entry<String, Object> entry : map.entrySet()) {
@@ -228,12 +229,12 @@ public class AAITransactionalClient extends AAIClient {
try {
error = mapper.readValue(entry.getValue().toString(), AAIError.class);
} catch (IOException e) {
- metricsLogger.error("could not parse error object from A&AI", e);
+ logger.error("could not parse error object from A&AI", e);
error = new AAIError();
}
AAIErrorFormatter formatter = new AAIErrorFormatter(error);
String outputMessage = formatter.getMessage();
- metricsLogger.error("part of a bulk action failed in A&AI: " + entry.getValue());
+ logger.error("part of a bulk action failed in A&AI: " + entry.getValue());
errorMessages.add(outputMessage);
}
}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIUpdator.java b/common/src/main/java/org/onap/so/client/aai/AAIUpdator.java
index 3bdcdc56a3..8921e4bbbe 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAIUpdator.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIUpdator.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.aai;
import java.io.IOException;
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIUpdatorImpl.java b/common/src/main/java/org/onap/so/client/aai/AAIUpdatorImpl.java
index c808761040..a971fded0e 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAIUpdatorImpl.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIUpdatorImpl.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.
@@ -18,9 +18,11 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.aai;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
public class AAIUpdatorImpl implements AAIUpdator {
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIValidator.java b/common/src/main/java/org/onap/so/client/aai/AAIValidator.java
index 117ec42a36..bf6485a631 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAIValidator.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIValidator.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.aai;
import java.io.IOException;
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIValidatorImpl.java b/common/src/main/java/org/onap/so/client/aai/AAIValidatorImpl.java
index c84d2f41bd..fb6d122630 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAIValidatorImpl.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIValidatorImpl.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.aai;
import java.io.IOException;
import java.util.List;
@@ -30,7 +30,7 @@ import org.springframework.stereotype.Service;
-@Service
+
public class AAIValidatorImpl implements AAIValidator {
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIVersion.java b/common/src/main/java/org/onap/so/client/aai/AAIVersion.java
index 20117fb98b..20ee5becca 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAIVersion.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIVersion.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.
@@ -18,14 +18,17 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.aai;
-public enum AAIVersion {
+import org.onap.so.client.graphinventory.GraphInventoryVersion;
+
+public enum AAIVersion implements GraphInventoryVersion {
V8("v8"),
V9("v9"),
V10("v10"),
V11("v11"),
- V12("v12");
+ V12("v12"),
+ V13("v13");
public final static AAIVersion LATEST = AAIVersion.values()[AAIVersion.values().length - 1];
private final String value;
diff --git a/common/src/main/java/org/onap/so/client/aai/EmptyStringToNullSerializer.java b/common/src/main/java/org/onap/so/client/aai/EmptyStringToNullSerializer.java
new file mode 100644
index 0000000000..1120ebe0b9
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/aai/EmptyStringToNullSerializer.java
@@ -0,0 +1,52 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.aai;
+
+import java.io.IOException;
+
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import com.fasterxml.jackson.databind.ser.std.StdSerializer;
+
+public class EmptyStringToNullSerializer extends StdSerializer<String> {
+
+ private static final long serialVersionUID = 5367385969270400106L;
+
+ public EmptyStringToNullSerializer() {
+ this(null);
+ }
+ public EmptyStringToNullSerializer(Class<String> t) {
+ super(t);
+ }
+
+ @Override
+ public void serialize(String value, JsonGenerator gen, SerializerProvider serializers)
+ throws IOException, JsonProcessingException {
+
+ if("".equals(value)) {
+ gen.writeNull();
+ } else {
+ gen.writeString(value);
+ }
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/AAIEntity.java b/common/src/main/java/org/onap/so/client/aai/entities/AAIEntity.java
index 3f0c4f3439..c2aceeeeba 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/entities/AAIEntity.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/AAIEntity.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.entities;
+package org.onap.so.client.aai.entities;
public class AAIEntity{
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/AAIEntityObject.java b/common/src/main/java/org/onap/so/client/aai/entities/AAIEntityObject.java
index e4a64c4161..dc91c8a034 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/entities/AAIEntityObject.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/AAIEntityObject.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.
@@ -18,9 +18,9 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.entities;
+package org.onap.so.client.aai.entities;
-import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
public interface AAIEntityObject {
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/AAIError.java b/common/src/main/java/org/onap/so/client/aai/entities/AAIError.java
index 5f895ef862..4261f4f3c0 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/entities/AAIError.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/AAIError.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.entities;
+package org.onap.so.client.aai.entities;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/AAIResultWrapper.java b/common/src/main/java/org/onap/so/client/aai/entities/AAIResultWrapper.java
index 9898f04844..9087995f97 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/entities/AAIResultWrapper.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/AAIResultWrapper.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.
@@ -18,31 +18,36 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.entities;
+package org.onap.so.client.aai.entities;
import java.io.IOException;
+import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
-import org.openecomp.mso.client.aai.AAICommonObjectMapperProvider;
-import org.openecomp.mso.jsonpath.JsonPathUtil;
+import org.onap.so.client.aai.AAICommonObjectMapperProvider;
+import org.onap.so.jsonpath.JsonPathUtil;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
-public class AAIResultWrapper {
+public class AAIResultWrapper implements Serializable {
- private final String jsonBody;
+ private static final long serialVersionUID = 5895841925807816737L;
+ private final Optional<String> jsonBody;
private final ObjectMapper mapper;
public AAIResultWrapper(String json) {
- this.jsonBody = json;
+ this.jsonBody = Optional.ofNullable(json);
this.mapper = new AAICommonObjectMapperProvider().getMapper();
}
public Optional<Relationships> getRelationships() {
final String path = "$.relationship-list";
- Optional<String> result = JsonPathUtil.getInstance().locateResult(jsonBody, path);
+ if (!jsonBody.isPresent()) {
+ return Optional.empty();
+ }
+ Optional<String> result = JsonPathUtil.getInstance().locateResult(jsonBody.get(), path);
if (result.isPresent()) {
return Optional.of(new Relationships(result.get()));
} else {
@@ -51,25 +56,34 @@ public class AAIResultWrapper {
}
public String getJson() {
- return jsonBody;
+ return jsonBody.orElse("{}");
}
public Map<String, Object> asMap() {
+ if (!this.jsonBody.isPresent()) {
+ return new HashMap<>();
+ }
try {
- return mapper.readValue(this.jsonBody, new TypeReference<Map<String, Object>>(){});
+ return mapper.readValue(this.jsonBody.get(), new TypeReference<Map<String, Object>>(){});
} catch (IOException e) {
return new HashMap<>();
}
}
public <T> Optional<T> asBean(Class<T> clazz) {
+ if (!this.jsonBody.isPresent()) {
+ return Optional.empty();
+ }
try {
- return Optional.of(mapper.readValue(this.jsonBody, clazz));
+ return Optional.of(mapper.readValue(this.jsonBody.get(), clazz));
} catch (IOException e) {
return Optional.empty();
}
}
+ public boolean isEmpty() {
+ return !this.jsonBody.isPresent();
+ }
@Override
public String toString() {
return this.getJson();
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/Configuration.java b/common/src/main/java/org/onap/so/client/aai/entities/Configuration.java
index a2d0fb3604..e1ce3a8adc 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/entities/Configuration.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/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.
@@ -18,8 +18,7 @@
* ============LICENSE_END=========================================================
*/
-
-package org.openecomp.mso.client.aai.entities;
+package org.onap.so.client.aai.entities;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/CustomQuery.java b/common/src/main/java/org/onap/so/client/aai/entities/CustomQuery.java
index 3d014b8f67..8203476c82 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/entities/CustomQuery.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/CustomQuery.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.
@@ -18,13 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.entities;
+package org.onap.so.client.aai.entities;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
-import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import com.fasterxml.jackson.annotation.JsonInclude;
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/Relationships.java b/common/src/main/java/org/onap/so/client/aai/entities/Relationships.java
index cca2fb3744..bab145b3fd 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/entities/Relationships.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/Relationships.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.entities;
+package org.onap.so.client.aai.entities;
import java.io.IOException;
import java.util.ArrayList;
@@ -30,13 +30,13 @@ import java.util.function.Predicate;
import javax.ws.rs.core.UriBuilder;
-import org.openecomp.mso.client.aai.AAICommonObjectMapperProvider;
-import org.openecomp.mso.client.aai.AAIObjectName;
-import org.openecomp.mso.client.aai.AAIObjectType;
-import org.openecomp.mso.client.aai.AAIResourcesClient;
-import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
-import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory;
-import org.openecomp.mso.jsonpath.JsonPathUtil;
+import org.onap.so.client.aai.AAICommonObjectMapperProvider;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.client.graphinventory.GraphInventoryObjectName;
+import org.onap.so.jsonpath.JsonPathUtil;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -57,7 +57,7 @@ public class Relationships {
}
}
- public List<AAIResultWrapper> getByType(AAIObjectName type) {
+ public List<AAIResultWrapper> getByType(GraphInventoryObjectName type) {
return this.getAll(Optional.of(type));
}
@@ -72,7 +72,7 @@ public class Relationships {
return this.getRelatedLinks(Optional.empty());
}
- public List<String> getRelatedLinks(AAIObjectName type) {
+ public List<String> getRelatedLinks(GraphInventoryObjectName type) {
return this.getRelatedLinks(Optional.of(type));
}
@@ -80,7 +80,7 @@ public class Relationships {
return this.getRelatedAAIUris(x -> true);
}
- public List<AAIResourceUri> getRelatedAAIUris(AAIObjectName type) {
+ public List<AAIResourceUri> getRelatedAAIUris(GraphInventoryObjectName type) {
return this.getRelatedAAIUris(x -> type.typeName().equals(x));
}
protected List<AAIResourceUri> getRelatedAAIUris(Predicate<String> p) {
@@ -107,7 +107,7 @@ public class Relationships {
- protected List<AAIResultWrapper> getAll(final Optional<AAIObjectName> type) {
+ protected List<AAIResultWrapper> getAll(final Optional<GraphInventoryObjectName> type) {
List<AAIResourceUri> relatedLinks;
if (type.isPresent()) {
relatedLinks = this.getRelatedAAIUris(type.get());
@@ -126,7 +126,7 @@ public class Relationships {
}
- protected List<String> getRelatedLinks(Optional<AAIObjectName> type) {
+ protected List<String> getRelatedLinks(Optional<GraphInventoryObjectName> type) {
String matcher = "";
if (type.isPresent()) {
matcher = "[?(@.related-to=='" + type.get() + "')]";
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/RequestError.java b/common/src/main/java/org/onap/so/client/aai/entities/RequestError.java
index 2fd3572401..bc8c283e34 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/entities/RequestError.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/RequestError.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.entities;
+package org.onap.so.client.aai.entities;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/Results.java b/common/src/main/java/org/onap/so/client/aai/entities/Results.java
index e91823a348..c3f0ad1fa1 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/entities/Results.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/Results.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.entities;
+package org.onap.so.client.aai.entities;
import java.util.ArrayList;
import java.util.List;
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/ServiceException.java b/common/src/main/java/org/onap/so/client/aai/entities/ServiceException.java
index 66ca10d06b..9d9723c514 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/entities/ServiceException.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.entities;
+package org.onap.so.client.aai.entities;
import java.util.ArrayList;
import java.util.List;
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/bulkprocess/OperationBody.java b/common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/OperationBody.java
index ddd9a454f8..1803440edd 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/entities/bulkprocess/OperationBody.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/OperationBody.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.entities.bulkprocess;
+package org.onap.so.client.aai.entities.bulkprocess;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/bulkprocess/Transaction.java b/common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/Transaction.java
index 8c4d54dc16..1c405753c3 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/entities/bulkprocess/Transaction.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/Transaction.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.entities.bulkprocess;
+package org.onap.so.client.aai.entities.bulkprocess;
import java.util.ArrayList;
import java.util.List;
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/bulkprocess/Transactions.java b/common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/Transactions.java
index f6ce3c5d2c..51d56d371a 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/entities/bulkprocess/Transactions.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/Transactions.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.entities.bulkprocess;
+package org.onap.so.client.aai.entities.bulkprocess;
import java.util.ArrayList;
import java.util.List;
@@ -51,4 +51,4 @@ this.transactions = transactions;
return this;
}
-} \ No newline at end of file
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/AAIResourceUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIResourceUri.java
index 36e3d008ae..42fa1ad02a 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/AAIResourceUri.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIResourceUri.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.
@@ -18,19 +18,29 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.entities.uri;
+package org.onap.so.client.aai.entities.uri;
-import org.openecomp.mso.client.aai.AAIObjectPlurals;
-import org.openecomp.mso.client.aai.AAIObjectType;
+import org.onap.so.client.aai.AAIObjectPlurals;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.graphinventory.Format;
+import org.onap.so.client.graphinventory.entities.uri.Depth;
+import org.onap.so.client.graphinventory.entities.uri.GraphInventoryResourceUri;
-public interface AAIResourceUri extends AAIUri {
+public interface AAIResourceUri extends AAIUri, GraphInventoryResourceUri {
public AAIResourceUri relationshipAPI();
public AAIResourceUri relatedTo(AAIObjectPlurals plural);
public AAIResourceUri relatedTo(AAIObjectType type, String... values);
public AAIResourceUri resourceVersion(String version);
+ public AAIResourceUri format(Format format);
+ @Override
public AAIResourceUri depth(Depth depth);
+ @Override
public AAIResourceUri nodesOnly(boolean nodesOnly);
+ @Override
public AAIResourceUri queryParam(String name, String... values);
+ @Override
+ public AAIResourceUri replaceQueryParam(String name, String... values);
+ @Override
public AAIResourceUri clone();
}
diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java
new file mode 100644
index 0000000000..14671b2f85
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java
@@ -0,0 +1,111 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.aai.entities.uri;
+
+import java.net.URI;
+
+import javax.ws.rs.core.UriBuilder;
+
+import org.onap.so.client.aai.AAIObjectPlurals;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.graphinventory.Format;
+import org.onap.so.client.graphinventory.entities.uri.Depth;
+import org.onap.so.client.graphinventory.entities.uri.SimpleUri;
+
+public class AAISimpleUri extends SimpleUri implements AAIResourceUri {
+
+ protected AAISimpleUri(AAIObjectType type, Object... values) {
+ super(type, values);
+
+ }
+ protected AAISimpleUri(AAIObjectType type, URI uri) {
+ super(type, uri);
+ }
+ protected AAISimpleUri(AAIObjectType type, UriBuilder builder, Object... values) {
+ super(type, builder, values);
+ }
+ protected AAISimpleUri(AAIObjectPlurals type, UriBuilder builder, Object... values) {
+ super(type, builder, values);
+ }
+ protected AAISimpleUri(AAIObjectPlurals type) {
+ super(type);
+ }
+ protected AAISimpleUri(AAIObjectPlurals type, Object... values) {
+ super(type, values);
+ }
+
+ @Override
+ public AAISimpleUri relationshipAPI() {
+ return (AAISimpleUri) super.relationshipAPI();
+ }
+
+ @Override
+ public AAISimpleUri relatedTo(AAIObjectPlurals plural) {
+ return (AAISimpleUri) super.relatedTo(plural);
+ }
+ @Override
+ public AAISimpleUri relatedTo(AAIObjectType type, String... values) {
+ return (AAISimpleUri) super.relatedTo(type, values);
+ }
+
+ @Override
+ public AAISimpleUri resourceVersion(String version) {
+ return (AAISimpleUri) super.resourceVersion(version);
+ }
+
+ @Override
+ public AAISimpleUri queryParam(String name, String... values) {
+ return (AAISimpleUri) super.queryParam(name, values);
+ }
+
+ @Override
+ public AAISimpleUri replaceQueryParam(String name, String... values) {
+ return (AAISimpleUri) super.replaceQueryParam(name, values);
+ }
+
+ @Override
+ public AAISimpleUri clone() {
+ if (this.type != null) {
+ return new AAISimpleUri((AAIObjectType)this.type, this.internalURI.clone(), values);
+ } else {
+ return new AAISimpleUri((AAIObjectPlurals)this.pluralType, this.internalURI.clone(), values);
+ }
+ }
+
+ @Override
+ public AAIObjectType getObjectType() {
+ return (AAIObjectType)this.type;
+ }
+
+ @Override
+ public AAISimpleUri depth(Depth depth) {
+ return (AAISimpleUri) super.depth(depth);
+ }
+ @Override
+ public AAISimpleUri nodesOnly(boolean nodesOnly) {
+ return (AAISimpleUri)super.nodesOnly(nodesOnly);
+ }
+
+ @Override
+ public AAISimpleUri format(Format format) {
+ return (AAISimpleUri)super.format(format);
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/AAIUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUri.java
index 1617bcddea..eb336d9219 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/AAIUri.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUri.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.
@@ -18,17 +18,18 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.entities.uri;
+package org.onap.so.client.aai.entities.uri;
import java.net.URI;
import java.util.Map;
-import org.openecomp.mso.client.aai.AAIObjectPlurals;
-import org.openecomp.mso.client.aai.AAIObjectType;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.graphinventory.GraphInventoryObjectType;
+import org.onap.so.client.graphinventory.entities.uri.Depth;
+import org.onap.so.client.graphinventory.entities.uri.GraphInventoryUri;
-public interface AAIUri {
+public interface AAIUri extends GraphInventoryUri {
- public URI build();
/**
* By default A&AI enforces a depth of 1. Some objects can be told to retrieve objects
* nested beneath them by increasing this number.
@@ -38,21 +39,22 @@ public interface AAIUri {
* @param depth
* @return
*/
+ @Override
public AAIUri depth(Depth depth);
/**
* Makes client only return object fields, no relationships
*
* @return
*/
+ @Override
public AAIUri nodesOnly(boolean nodesOnly);
+ @Override
public AAIUri queryParam(String name, String... values);
+ @Override
+ public AAIUri replaceQueryParam(String name, String... values);
+ @Override
public AAIUri clone();
- /**
- * returns all key values of the URI as a map. Key names can be found in {@link AAIObjectType}
- * @return
- */
- public Map<String, String> getURIKeys();
+ @Override
public AAIObjectType getObjectType();
- public boolean equals(Object o);
-} \ No newline at end of file
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/AAIUriFactory.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUriFactory.java
index cb33435c69..2a7c8ee78c 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/AAIUriFactory.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUriFactory.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.
@@ -18,12 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.entities.uri;
+package org.onap.so.client.aai.entities.uri;
import java.net.URI;
-import org.openecomp.mso.client.aai.AAIObjectPlurals;
-import org.openecomp.mso.client.aai.AAIObjectType;
+import org.onap.so.client.aai.AAIObjectPlurals;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.graphinventory.entities.uri.SimpleUri;
public class AAIUriFactory {
@@ -39,7 +40,7 @@ public class AAIUriFactory {
if (AAIObjectType.SERVICE_INSTANCE.equals(type)) {
return new ServiceInstanceUri(values);
} else {
- return new SimpleUri(type, values);
+ return new AAISimpleUri(type, values);
}
}
@@ -56,7 +57,7 @@ public class AAIUriFactory {
* @return
*/
public static AAIResourceUri createResourceFromExistingURI(AAIObjectType type, URI uri) {
- return new SimpleUri(type, uri);
+ return new AAISimpleUri(type, uri);
}
/**
@@ -67,7 +68,19 @@ public class AAIUriFactory {
*/
public static AAIResourceUri createResourceUri(AAIObjectPlurals type) {
- return new SimpleUri(type);
+ return new AAISimpleUri(type);
+
+ }
+
+ /**
+ * Creates a uri for a plural type with values e.g. /cloud-infrastructure/pservers
+ *
+ * @param type
+ * @return
+ */
+ public static AAIResourceUri createResourceUri(AAIObjectPlurals type, Object... values) {
+
+ return new AAISimpleUri(type, values);
}
}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/NodesUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/NodesUri.java
index 407e0ecc9e..ccae0b44b7 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/NodesUri.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/NodesUri.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.
@@ -18,14 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.entities.uri;
+package org.onap.so.client.aai.entities.uri;
-import javax.ws.rs.core.UriBuilder;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.graphinventory.GraphInventoryObjectPlurals;
+import org.onap.so.client.graphinventory.GraphInventoryObjectType;
-import org.openecomp.mso.client.aai.AAIObjectPlurals;
-import org.openecomp.mso.client.aai.AAIObjectType;
-
-public class NodesUri extends SimpleUri {
+public class NodesUri extends AAISimpleUri {
protected NodesUri(AAIObjectType type, Object... values) {
super(type, values);
@@ -33,12 +32,12 @@ public class NodesUri extends SimpleUri {
@Override
- protected String getTemplate(AAIObjectType type) {
+ protected String getTemplate(GraphInventoryObjectType type) {
return "/nodes" + type.partialUri();
}
@Override
- protected String getTemplate(AAIObjectPlurals type) {
+ protected String getTemplate(GraphInventoryObjectPlurals type) {
return "/nodes" + type.partialUri();
}
}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/ServiceInstanceUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUri.java
index cdaecedfa9..093918d49b 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/ServiceInstanceUri.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUri.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.entities.uri;
+package org.onap.so.client.aai.entities.uri;
import java.io.IOException;
import java.net.URI;
@@ -27,22 +27,22 @@ import java.util.Map;
import java.util.Optional;
import javax.ws.rs.BadRequestException;
-import javax.ws.rs.client.ResponseProcessingException;
import javax.ws.rs.core.UriBuilder;
-import org.openecomp.mso.client.aai.AAIObjectType;
-import org.openecomp.mso.client.aai.AAIQueryClient;
-import org.openecomp.mso.client.aai.Format;
-import org.openecomp.mso.client.aai.entities.CustomQuery;
-import org.openecomp.mso.client.aai.entities.Results;
-import org.openecomp.mso.client.aai.exceptions.AAIPayloadException;
-import org.openecomp.mso.client.aai.exceptions.AAIUriComputationException;
-import org.openecomp.mso.client.aai.exceptions.AAIUriNotFoundException;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.AAIQueryClient;
+import org.onap.so.client.graphinventory.Format;
+import org.onap.so.client.aai.entities.CustomQuery;
+import org.onap.so.client.aai.entities.Results;
+import org.onap.so.client.graphinventory.entities.uri.SimpleUri;
+import org.onap.so.client.graphinventory.exceptions.GraphInventoryPayloadException;
+import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriComputationException;
+import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriNotFoundException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
-public class ServiceInstanceUri extends SimpleUri {
+public class ServiceInstanceUri extends AAISimpleUri {
private Optional<String> cachedValue = Optional.empty();
@@ -53,49 +53,45 @@ public class ServiceInstanceUri extends SimpleUri {
super(AAIObjectType.SERVICE_INSTANCE, builder, values);
this.cachedValue = cachedValue;
}
- protected String getSerivceInstance(Object id) throws AAIUriNotFoundException, AAIPayloadException {
+ protected String getSerivceInstance(Object id) throws GraphInventoryUriNotFoundException, GraphInventoryPayloadException {
if (!this.getCachedValue().isPresent()) {
AAIResourceUri serviceInstanceUri = AAIUriFactory.createNodesUri(AAIObjectType.SERVICE_INSTANCE, id);
CustomQuery query = new CustomQuery(Collections.singletonList(serviceInstanceUri));
String resultJson;
try {
resultJson = this.getQueryClient().query(Format.PATHED, query);
- } catch (ResponseProcessingException e) {
- if (e.getCause() instanceof BadRequestException) {
- throw new AAIUriNotFoundException("Service instance " + id + " not found at: " + serviceInstanceUri.build());
- } else {
- throw e;
- }
+ } catch (BadRequestException e) {
+ throw new GraphInventoryUriNotFoundException("Service instance " + id + " not found at: " + serviceInstanceUri.build());
+
}
try {
cachedValue = extractRelatedLink(resultJson);
if (!cachedValue.isPresent()) {
- throw new AAIUriNotFoundException("Service instance " + id + " not found at: " + serviceInstanceUri.build());
+ throw new GraphInventoryUriNotFoundException("Service instance " + id + " not found at: " + serviceInstanceUri.build());
}
} catch (IOException e) {
- throw new AAIPayloadException("could not map payload: " + resultJson, e);
+ throw new GraphInventoryPayloadException("could not map payload: " + resultJson, e);
}
-
}
-
- return this.getCachedValue().get();
+ Optional<String> cachedValueOpt = this.getCachedValue();
+ return cachedValueOpt.isPresent() ? cachedValueOpt.get() : "";
}
protected Optional<String> extractRelatedLink(String jsonString) throws IOException {
Optional<String> result;
ObjectMapper mapper = new ObjectMapper();
- Results<Map<String, String>> results = mapper.readValue(jsonString, new TypeReference<Results<Map<String, String>>>(){});
- if (results.getResult().size() == 1) {
- String uriString = results.getResult().get(0).get("resource-link");
- URI uri = UriBuilder.fromUri(uriString).build();
- String rawPath = uri.getRawPath();
+ Results<Map<String, String>> results = mapper.readValue(jsonString, new TypeReference<Results<Map<String, String>>>(){});
+ if (results.getResult().size() == 1) {
+ String uriString = results.getResult().get(0).get("resource-link");
+ URI uri = UriBuilder.fromUri(uriString).build();
+ String rawPath = uri.getRawPath();
result = Optional.of(rawPath.replaceAll("/aai/v\\d+", ""));
- } else if (results.getResult().isEmpty()) {
+ } else if (results.getResult().isEmpty()) {
result = Optional.empty();
- } else {
- throw new IllegalStateException("more than one result returned");
- }
+ } else {
+ throw new IllegalStateException("more than one result returned");
+ }
return result;
}
@@ -107,13 +103,13 @@ public class ServiceInstanceUri extends SimpleUri {
@Override
public URI build() {
try {
- if (this.values.length == 1) {
- String uri = getSerivceInstance(this.values[0]);
- Map<String, String> map = getURIKeys(uri);
- return super.build(map.values().toArray(values));
- }
- } catch (AAIUriNotFoundException | AAIPayloadException e) {
- throw new AAIUriComputationException(e);
+ if (this.values.length == 1) {
+ String uri = getSerivceInstance(this.values[0]);
+ Map<String, String> map = getURIKeys(uri);
+ return super.build(map.values().toArray(values));
+ }
+ } catch (GraphInventoryUriNotFoundException | GraphInventoryPayloadException e) {
+ throw new GraphInventoryUriComputationException(e);
}
return super.build();
}
@@ -124,6 +120,7 @@ public class ServiceInstanceUri extends SimpleUri {
}
protected AAIQueryClient getQueryClient() {
+ AAIResourceUri uri = AAIUriFactory.createNodesUri(AAIObjectType.ALLOTTED_RESOURCE, "").clone();
return new AAIQueryClient();
}
-} \ No newline at end of file
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/objects/AAIOperationalEnvironment.java b/common/src/main/java/org/onap/so/client/aai/objects/AAIOperationalEnvironment.java
index f044e2a237..02d8d56867 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/objects/AAIOperationalEnvironment.java
+++ b/common/src/main/java/org/onap/so/client/aai/objects/AAIOperationalEnvironment.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.objects;
+package org.onap.so.client.aai.objects;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/objects/AAIServiceInstance.java b/common/src/main/java/org/onap/so/client/aai/objects/AAIServiceInstance.java
index dbb34fcd44..af21949277 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/objects/AAIServiceInstance.java
+++ b/common/src/main/java/org/onap/so/client/aai/objects/AAIServiceInstance.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.
@@ -18,118 +18,124 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.objects;
-
-import org.openecomp.mso.client.aai.AAIObjectType;
-import org.openecomp.mso.client.aai.entities.AAIEntityObject;
-import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
-import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-public class AAIServiceInstance implements AAIEntityObject {
-
- @JsonProperty("service-instance-id")
- private String serviceInstanceId;
- @JsonProperty("service-instance-name")
- private String serviceInstanceName;
- @JsonProperty("service-type")
- private String serviceType;
- @JsonProperty("service-role")
- private String serviceRole;
- @JsonProperty("orchestration-status")
- private String oStatus;
- @JsonProperty("model-invariant-id")
- private String modelInvariantUuid;
- @JsonProperty("model-version-id")
- private String modelUuid;
- @JsonProperty("environment-context")
- private String environmentContext;
- @JsonProperty("workload-context")
- private String workloadContext;
-
- public String getServiceInstanceName() {
- return serviceInstanceName;
- }
-
- public void setServiceInstanceName(String serviceInstanceName) {
- this.serviceInstanceName = serviceInstanceName;
- }
-
- public String getServiceType() {
- return serviceType;
- }
-
- public void setServiceType(String serviceType) {
- this.serviceType = serviceType;
- }
-
- public String getServiceRole() {
- return serviceRole;
- }
-
- public void setServiceRole(String serviceRole) {
- this.serviceRole = serviceRole;
- }
-
- public String getoStatus() {
- return oStatus;
- }
-
- public void setoStatus(String oStatus) {
- this.oStatus = oStatus;
- }
-
- public String getModelInvariantUuid() {
- return modelInvariantUuid;
- }
-
- public void setModelInvariantUuid(String modelInvariantUuid) {
- this.modelInvariantUuid = modelInvariantUuid;
- }
-
- public String getModelUuid() {
- return modelUuid;
- }
-
- public void setModelUuid(String modelUuid) {
- this.modelUuid = modelUuid;
- }
-
- public String getEnvironmentContext() {
- return environmentContext;
- }
-
- public void setEnvironmentContext(String environmentContext) {
- this.environmentContext = environmentContext;
- }
-
- public String getWorkloadContext() {
- return workloadContext;
- }
-
- public void setWorkloadContext(String workloadContext) {
- this.workloadContext = workloadContext;
- }
-
- public String getServiceInstanceId() {
- return serviceInstanceId;
- }
-
- public void setServiceInstanceId(String serviceInstanceId) {
- this.serviceInstanceId = serviceInstanceId;
- }
-
- public AAIServiceInstance withServiceInstance(String serviceInstanceId) {
- this.setServiceInstanceId(serviceInstanceId);
- return this;
- }
-
- @Override
- public AAIResourceUri getUri() {
- final AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, this.serviceInstanceId);
- return uri;
- }
-
-
-}
+package org.onap.so.client.aai.objects;
+
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.entities.AAIEntityObject;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class AAIServiceInstance implements AAIEntityObject {
+
+ @JsonProperty("service-instance-id")
+ private String serviceInstanceId;
+ @JsonProperty("service-instance-name")
+ private String serviceInstanceName;
+ @JsonProperty("service-type")
+ private String serviceType;
+ @JsonProperty("service-role")
+ private String serviceRole;
+ @JsonProperty("orchestration-status")
+ private String oStatus;
+ @JsonProperty("model-invariant-id")
+ private String modelInvariantUuid;
+ @JsonProperty("model-version-id")
+ private String modelUuid;
+ @JsonProperty("environment-context")
+ private String environmentContext;
+ @JsonProperty("workload-context")
+ private String workloadContext;
+
+ public String getServiceInstanceName() {
+ return serviceInstanceName;
+ }
+
+ public void setServiceInstanceName(String serviceInstanceName) {
+ this.serviceInstanceName = serviceInstanceName;
+ }
+
+ public String getServiceType() {
+ return serviceType;
+ }
+
+ public void setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ }
+
+ public String getServiceRole() {
+ return serviceRole;
+ }
+
+ public void setServiceRole(String serviceRole) {
+ this.serviceRole = serviceRole;
+ }
+
+ public String getoStatus() {
+ return oStatus;
+ }
+
+ public void setoStatus(String oStatus) {
+ this.oStatus = oStatus;
+ }
+
+ public String getModelInvariantUuid() {
+ return modelInvariantUuid;
+ }
+
+ public void setModelInvariantUuid(String modelInvariantUuid) {
+ this.modelInvariantUuid = modelInvariantUuid;
+ }
+
+ public String getModelUuid() {
+ return modelUuid;
+ }
+
+ public void setModelUuid(String modelUuid) {
+ this.modelUuid = modelUuid;
+ }
+
+ public String getEnvironmentContext() {
+ return environmentContext;
+ }
+
+ public void setEnvironmentContext(String environmentContext) {
+ this.environmentContext = environmentContext;
+ }
+
+ public String getWorkloadContext() {
+ return workloadContext;
+ }
+
+ public void setWorkloadContext(String workloadContext) {
+ this.workloadContext = workloadContext;
+ }
+
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
+
+ public void setServiceInstanceId(String serviceInstanceId) {
+ this.serviceInstanceId = serviceInstanceId;
+ }
+
+ public AAIServiceInstance withServiceInstance(String serviceInstanceId) {
+ this.setServiceInstanceId(serviceInstanceId);
+ return this;
+ }
+
+ @Override
+ public AAIResourceUri getUri() {
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, this.serviceInstanceId);
+ return uri;
+ }
+ @Override
+ public String toString() {
+ return "AAIServiceInstance [serviceInstanceId=" + serviceInstanceId + ", serviceInstanceName="
+ + serviceInstanceName + ", serviceType=" + serviceType + ", serviceRole=" + serviceRole + ", oStatus="
+ + oStatus + ", modelInvariantUuid=" + modelInvariantUuid + ", modelUuid=" + modelUuid
+ + ", environmentContext=" + environmentContext + ", workloadContext=" + workloadContext + "]";
+ }
+
+}
diff --git a/common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestClient.java b/common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestClient.java
new file mode 100644
index 0000000000..2329a5acb9
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestClient.java
@@ -0,0 +1,79 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.adapter.rest;
+
+import java.net.URI;
+import java.security.GeneralSecurityException;
+import java.util.Map;
+import java.util.Optional;
+
+import org.apache.commons.codec.binary.Base64;
+import org.onap.so.client.RestClient;
+import org.onap.so.client.policy.CommonObjectMapperProvider;
+import org.onap.so.client.policy.JettisonStyleMapperProvider;
+import org.onap.so.utils.CryptoUtils;
+import org.onap.so.utils.TargetEntity;
+
+public class AdapterRestClient extends RestClient {
+
+ private final AdapterRestProperties adapterRestProperties;
+ public AdapterRestClient(AdapterRestProperties props, URI uri) {
+ super(props, Optional.of(uri));
+ this.adapterRestProperties = props;
+ }
+
+ public AdapterRestClient(AdapterRestProperties props, URI uri, String accept, String contentType) {
+ super(props, Optional.of(uri), accept, contentType);
+ this.adapterRestProperties = props;
+ }
+
+ @Override
+ public TargetEntity getTargetEntity(){
+ return TargetEntity.OPENSTACK_ADAPTER;
+ }
+
+ @Override
+ protected void initializeHeaderMap(Map<String, String> headerMap) {
+ headerMap.put("Authorization",
+ this.getBasicAuth(adapterRestProperties.getAuth(), adapterRestProperties.getKey()));
+ }
+
+ @Override
+ protected CommonObjectMapperProvider getCommonObjectMapperProvider() {
+ return new JettisonStyleMapperProvider();
+ }
+
+ private String getBasicAuth(String encryptedAuth, String msoKey) {
+ if ((encryptedAuth == null || encryptedAuth.isEmpty()) || (msoKey == null || msoKey.isEmpty())) {
+ return null;
+ }
+ try {
+ String auth = CryptoUtils.decrypt(encryptedAuth, msoKey);
+ byte[] encoded = Base64.encodeBase64(auth.getBytes());
+ String encodedString = new String(encoded);
+ encodedString = "Basic " + encodedString;
+ return encodedString;
+ } catch (GeneralSecurityException e) {
+ this.msoLogger.debug(e.getMessage());
+ return null;
+ }
+ }
+}
diff --git a/common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestProperties.java b/common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestProperties.java
new file mode 100644
index 0000000000..18e0bd8996
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestProperties.java
@@ -0,0 +1,29 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.adapter.rest;
+
+import org.onap.so.client.RestProperties;
+
+public interface AdapterRestProperties extends RestProperties {
+
+ public String getAuth();
+ public String getKey();
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/defaultproperties/DefaultDmaapPropertiesImpl.java b/common/src/main/java/org/onap/so/client/defaultproperties/DefaultDmaapPropertiesImpl.java
index 1345286d9c..ffebe77620 100644
--- a/common/src/main/java/org/openecomp/mso/client/defaultproperties/DefaultDmaapPropertiesImpl.java
+++ b/common/src/main/java/org/onap/so/client/defaultproperties/DefaultDmaapPropertiesImpl.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.defaultproperties;
+package org.onap.so.client.defaultproperties;
import java.io.File;
import java.io.FileInputStream;
@@ -28,7 +28,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
-import org.openecomp.mso.client.dmaap.DmaapProperties;
+import org.onap.so.client.dmaap.DmaapProperties;
public class DefaultDmaapPropertiesImpl implements DmaapProperties {
diff --git a/common/src/main/java/org/openecomp/mso/client/defaultproperties/PolicyRestPropertiesImpl.java b/common/src/main/java/org/onap/so/client/defaultproperties/PolicyRestPropertiesImpl.java
index 655dc5a83d..9e4574df4c 100644
--- a/common/src/main/java/org/openecomp/mso/client/defaultproperties/PolicyRestPropertiesImpl.java
+++ b/common/src/main/java/org/onap/so/client/defaultproperties/PolicyRestPropertiesImpl.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.defaultproperties;
+package org.onap.so.client.defaultproperties;
import java.io.File;
import java.io.FileInputStream;
@@ -30,7 +30,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
-import org.openecomp.mso.client.policy.PolicyRestProperties;
+import org.onap.so.client.policy.PolicyRestProperties;
public class PolicyRestPropertiesImpl implements PolicyRestProperties {
@@ -38,9 +38,8 @@ public class PolicyRestPropertiesImpl implements PolicyRestProperties {
final Map<Object, Object> props;
public PolicyRestPropertiesImpl() {
File initialFile = new File("src/test/resources/policy.properties");
-
Map<Object, Object> temp;
- try(InputStream targetStream = new FileInputStream(initialFile)) {
+ try (InputStream targetStream = new FileInputStream(initialFile)) {
Properties properties = new Properties();
properties.load(targetStream);
temp = properties;
@@ -64,14 +63,17 @@ public class PolicyRestPropertiesImpl implements PolicyRestProperties {
return "MSO";
}
+ @Override
public String getClientAuth() {
return (String)props.get("policy.client.auth");
}
+ @Override
public String getAuth() {
return (String)props.get("policy.auth");
}
+ @Override
public String getEnvironment() {
return (String)props.get("policy.environment");
}
diff --git a/common/src/main/java/org/openecomp/mso/client/dmaap/Consumer.java b/common/src/main/java/org/onap/so/client/dmaap/Consumer.java
index 0e00ae5da8..7b1310f252 100644
--- a/common/src/main/java/org/openecomp/mso/client/dmaap/Consumer.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/Consumer.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.dmaap;
+package org.onap.so.client.dmaap;
public interface Consumer {
diff --git a/common/src/main/java/org/openecomp/mso/client/dmaap/DmaapClient.java b/common/src/main/java/org/onap/so/client/dmaap/DmaapClient.java
index 5a2fa178de..dde0b31c90 100644
--- a/common/src/main/java/org/openecomp/mso/client/dmaap/DmaapClient.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/DmaapClient.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.dmaap;
+package org.onap.so.client.dmaap;
import java.io.IOException;
import java.util.Base64;
@@ -26,23 +26,23 @@ import java.util.Map;
import java.util.Optional;
import java.util.Properties;
-import org.openecomp.mso.client.defaultproperties.DefaultDmaapPropertiesImpl;
+import org.onap.so.client.defaultproperties.DefaultDmaapPropertiesImpl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
public abstract class DmaapClient {
- protected final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger();
+ protected static Logger logger = LoggerFactory.getLogger(DmaapClient.class);
protected final Map<String, String> msoProperties;
protected final Properties properties;
public DmaapClient(String filepath) throws IOException {
Resource resource = new ClassPathResource(filepath);
DmaapProperties dmaapProperties = DmaapPropertiesLoader.getInstance().getNewImpl();
if (dmaapProperties == null) {
- auditLogger.error("No RestProperty implementation found on classpath, loading default");
+ logger.error("No RestProperty implementation found on classpath, loading default");
dmaapProperties = new DefaultDmaapPropertiesImpl();
}
this.msoProperties = dmaapProperties.getProperties();
@@ -51,8 +51,9 @@ public abstract class DmaapClient {
this.properties.put("password", this.deobfuscatePassword(this.getPassword()));
this.properties.put("username", this.getUserName());
this.properties.put("topic", this.getTopic());
- if (this.getHost().isPresent()) {
- this.properties.put("host", this.getHost().get());
+ Optional<String> host = this.getHost();
+ if (host.isPresent()) {
+ this.properties.put("host", host.get());
}
}
protected String deobfuscatePassword(String password) {
@@ -60,7 +61,7 @@ public abstract class DmaapClient {
try {
return new String(Base64.getDecoder().decode(password.getBytes()));
} catch(IllegalArgumentException iae) {
- auditLogger.error("llegal Arguments",iae);
+ logger.error("llegal Arguments",iae);
return password;
}
}
diff --git a/common/src/main/java/org/openecomp/mso/client/dmaap/DmaapConsumer.java b/common/src/main/java/org/onap/so/client/dmaap/DmaapConsumer.java
index 6a01fb61ba..c9acdd7e89 100644
--- a/common/src/main/java/org/openecomp/mso/client/dmaap/DmaapConsumer.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/DmaapConsumer.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.
@@ -18,14 +18,14 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.dmaap;
+package org.onap.so.client.dmaap;
import com.google.common.base.Stopwatch;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
-import org.openecomp.mso.client.dmaap.exceptions.DMaaPConsumerFailure;
-import org.openecomp.mso.client.dmaap.exceptions.ExceededMaximumPollingTime;
-import org.openecomp.mso.client.dmaap.rest.RestConsumer;
+import org.onap.so.client.dmaap.exceptions.DMaaPConsumerFailure;
+import org.onap.so.client.dmaap.exceptions.ExceededMaximumPollingTime;
+import org.onap.so.client.dmaap.rest.RestConsumer;
public abstract class DmaapConsumer extends DmaapClient {
@@ -45,7 +45,7 @@ public abstract class DmaapConsumer extends DmaapClient {
while (this.continuePolling()) {
if (stopwatch.elapsed(TimeUnit.MILLISECONDS) >= this.getMaximumElapsedTime()) {
final String message = "exceeded maximum retries on " + this.getRequestId() + " on " + this.getTopic();
- auditLogger.error(message);
+ logger.error(message);
throw new ExceededMaximumPollingTime(message);
}
stopwatch.start();
@@ -53,15 +53,15 @@ public abstract class DmaapConsumer extends DmaapClient {
stopwatch.stop();
for (String message : itr) {
if (!accepted && this.isAccepted(message)) {
- auditLogger.info("accepted message found for " + this.getRequestId() + " on " + this.getTopic());
+ logger.info("accepted message found for " + this.getRequestId() + " on " + this.getTopic());
accepted = true;
}
if (accepted) {
- auditLogger.info("received dmaap message: " + message);
+ logger.info("received dmaap message: " + message);
if (this.isFailure(message)) {
this.stopProcessingMessages();
final String errorMsg = "failure received from dmaap topic " + this.getTopic();
- auditLogger.error(errorMsg);
+ logger.error(errorMsg);
throw new DMaaPConsumerFailure(errorMsg);
} else {
this.processMessage(message);
diff --git a/common/src/main/java/org/openecomp/mso/client/dmaap/DmaapProperties.java b/common/src/main/java/org/onap/so/client/dmaap/DmaapProperties.java
index 7bdd7dfe40..161608dc77 100644
--- a/common/src/main/java/org/openecomp/mso/client/dmaap/DmaapProperties.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/DmaapProperties.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.dmaap;
+package org.onap.so.client.dmaap;
import java.util.Map;
diff --git a/common/src/main/java/org/openecomp/mso/client/dmaap/DmaapPropertiesLoader.java b/common/src/main/java/org/onap/so/client/dmaap/DmaapPropertiesLoader.java
index 3c861991f6..3064f6142f 100644
--- a/common/src/main/java/org/openecomp/mso/client/dmaap/DmaapPropertiesLoader.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/DmaapPropertiesLoader.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.
@@ -18,15 +18,20 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.dmaap;
+package org.onap.so.client.dmaap;
import java.util.ServiceLoader;
public class DmaapPropertiesLoader {
+ /* required to make ServiceLoader thread safe */
+ private static final ThreadLocal<ServiceLoader<DmaapProperties>> services = new ThreadLocal<ServiceLoader<DmaapProperties>>() {
+ @Override
+ protected ServiceLoader<DmaapProperties> initialValue() {
+ return ServiceLoader.load(DmaapProperties.class);
+ }
+ };
- private final ServiceLoader<DmaapProperties> services;
private DmaapPropertiesLoader() {
- services = ServiceLoader.load(DmaapProperties.class);
}
private static class Helper {
@@ -43,7 +48,9 @@ public class DmaapPropertiesLoader {
return this.getImpl(true);
}
private DmaapProperties getImpl(boolean forceNewInstance) {
- for (DmaapProperties service : services) {
+
+ ServiceLoader<DmaapProperties> loader = this.services.get();
+ for (DmaapProperties service : loader) {
if (forceNewInstance) {
try {
return service.getClass().newInstance();
diff --git a/common/src/main/java/org/openecomp/mso/client/dmaap/DmaapPublisher.java b/common/src/main/java/org/onap/so/client/dmaap/DmaapPublisher.java
index d2752c531b..48691dcd84 100644
--- a/common/src/main/java/org/openecomp/mso/client/dmaap/DmaapPublisher.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/DmaapPublisher.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.
@@ -18,12 +18,12 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.dmaap;
+package org.onap.so.client.dmaap;
import java.io.FileNotFoundException;
import java.io.IOException;
-import org.openecomp.mso.client.dmaap.rest.RestPublisher;
+import org.onap.so.client.dmaap.rest.RestPublisher;
public abstract class DmaapPublisher extends DmaapClient {
@@ -41,8 +41,8 @@ public abstract class DmaapPublisher extends DmaapClient {
this.seconds = seconds;
}
- public void send(String json) throws IOException, InterruptedException {
- auditLogger.info("publishing message to dmaap topic " + this.getTopic() + ": " + json);
+ public void send(String json){
+ logger.info("publishing message to dmaap topic " + this.getTopic() + ": " + json);
publisher.send(json);
//publisher.close(seconds, TimeUnit.SECONDS);
}
diff --git a/common/src/main/java/org/openecomp/mso/client/dmaap/Publisher.java b/common/src/main/java/org/onap/so/client/dmaap/Publisher.java
index ed1b3f3796..ba6ce16418 100644
--- a/common/src/main/java/org/openecomp/mso/client/dmaap/Publisher.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/Publisher.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.dmaap;
+package org.onap.so.client.dmaap;
public interface Publisher {
diff --git a/common/src/main/java/org/openecomp/mso/client/dmaap/exceptions/DMaaPConsumerFailure.java b/common/src/main/java/org/onap/so/client/dmaap/exceptions/DMaaPConsumerFailure.java
index b1ae2b7e89..f845f7e6ef 100644
--- a/common/src/main/java/org/openecomp/mso/client/dmaap/exceptions/DMaaPConsumerFailure.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/exceptions/DMaaPConsumerFailure.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.dmaap.exceptions;
+package org.onap.so.client.dmaap.exceptions;
public class DMaaPConsumerFailure extends Exception {
diff --git a/common/src/main/java/org/openecomp/mso/client/dmaap/exceptions/ExceededMaximumPollingTime.java b/common/src/main/java/org/onap/so/client/dmaap/exceptions/ExceededMaximumPollingTime.java
index c0cda6b0ed..0002f878d8 100644
--- a/common/src/main/java/org/openecomp/mso/client/dmaap/exceptions/ExceededMaximumPollingTime.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/exceptions/ExceededMaximumPollingTime.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.dmaap.exceptions;
+package org.onap.so.client.dmaap.exceptions;
public class ExceededMaximumPollingTime extends RuntimeException {
diff --git a/common/src/main/java/org/openecomp/mso/client/dmaap/rest/DMaaPRestClient.java b/common/src/main/java/org/onap/so/client/dmaap/rest/DMaaPRestClient.java
index ad744ad31b..0438ff237a 100644
--- a/common/src/main/java/org/openecomp/mso/client/dmaap/rest/DMaaPRestClient.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/rest/DMaaPRestClient.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.
@@ -18,41 +18,33 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.dmaap.rest;
+package org.onap.so.client.dmaap.rest;
import java.net.URL;
import java.util.Base64;
import java.util.Map;
-import java.util.Optional;
-import java.util.UUID;
-import javax.ws.rs.client.ClientResponseFilter;
+import org.onap.so.client.RestClient;
+import org.onap.so.utils.TargetEntity;
-import org.openecomp.mso.client.ResponseExceptionMapperImpl;
-import org.openecomp.mso.client.policy.RestClient;
-
-public class DMaaPRestClient extends RestClient {
+public class DMaaPRestClient extends RestClient {
private final String username;
private final String password;
public DMaaPRestClient(URL url, String contentType, String username, String password) {
- super(url, UUID.randomUUID(), contentType);
+ super(url, contentType);
this.username = username;
this.password = password;
}
+ @Override
+ public TargetEntity getTargetEntity(){
+ return TargetEntity.DMAAP;
+ }
+
@Override
protected void initializeHeaderMap(Map<String, String> headerMap) {
headerMap.put("Authorization", "Basic " + Base64.getEncoder().encodeToString((username + ":" + password).getBytes()));
}
- @Override
- protected Optional<ClientResponseFilter> addResponseFilter() {
- return Optional.of(new ResponseExceptionMapperImpl());
- }
-
- @Override
- public RestClient addRequestId(UUID requestId) {
- return this;
- }
}
diff --git a/common/src/main/java/org/openecomp/mso/client/dmaap/rest/PropertiesBean.java b/common/src/main/java/org/onap/so/client/dmaap/rest/PropertiesBean.java
index e661dd87bd..f43c65808a 100644
--- a/common/src/main/java/org/openecomp/mso/client/dmaap/rest/PropertiesBean.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/rest/PropertiesBean.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.dmaap.rest;
+package org.onap.so.client.dmaap.rest;
import java.util.Properties;
diff --git a/common/src/main/java/org/openecomp/mso/client/dmaap/rest/RestConsumer.java b/common/src/main/java/org/onap/so/client/dmaap/rest/RestConsumer.java
index c2fb6f676f..39af15635a 100644
--- a/common/src/main/java/org/openecomp/mso/client/dmaap/rest/RestConsumer.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/rest/RestConsumer.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.
@@ -18,18 +18,19 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.dmaap.rest;
+package org.onap.so.client.dmaap.rest;
import java.net.MalformedURLException;
import java.net.URL;
+import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.UriBuilder;
-import org.openecomp.mso.client.dmaap.Consumer;
-import org.openecomp.mso.client.policy.RestClient;
+import org.onap.so.client.RestClient;
+import org.onap.so.client.dmaap.Consumer;
public class RestConsumer implements Consumer {
@@ -54,7 +55,7 @@ public class RestConsumer implements Consumer {
@Override
public Iterable<String> fetch() {
- return client.get(new GenericType<List<String>>() {});
+ return client.get(new GenericType<List<String>>() {}).orElse(new ArrayList<>());
}
}
diff --git a/common/src/main/java/org/openecomp/mso/client/dmaap/rest/RestPublisher.java b/common/src/main/java/org/onap/so/client/dmaap/rest/RestPublisher.java
index 3dab12f559..090e50543b 100644
--- a/common/src/main/java/org/openecomp/mso/client/dmaap/rest/RestPublisher.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/rest/RestPublisher.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.
@@ -18,17 +18,16 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.dmaap.rest;
+package org.onap.so.client.dmaap.rest;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Properties;
import javax.ws.rs.core.UriBuilder;
-import javax.ws.rs.core.UriBuilderException;
-import org.openecomp.mso.client.dmaap.Publisher;
-import org.openecomp.mso.client.policy.RestClient;
+import org.onap.so.client.RestClient;
+import org.onap.so.client.dmaap.Publisher;
public class RestPublisher implements Publisher {
diff --git a/common/src/main/java/org/openecomp/mso/client/exceptions/SDNOException.java b/common/src/main/java/org/onap/so/client/exceptions/SDNOException.java
index d55f962662..1e14308ad5 100644
--- a/common/src/main/java/org/openecomp/mso/client/exceptions/SDNOException.java
+++ b/common/src/main/java/org/onap/so/client/exceptions/SDNOException.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.exceptions;
+package org.onap.so.client.exceptions;
public class SDNOException extends Exception {
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/Format.java b/common/src/main/java/org/onap/so/client/graphinventory/Format.java
index e4008151ef..5cbf1320c1 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/Format.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/Format.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.graphinventory;
public enum Format {
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryClient.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryClient.java
new file mode 100644
index 0000000000..0d10c21886
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryClient.java
@@ -0,0 +1,48 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.graphinventory;
+
+import java.net.URI;
+
+import org.onap.so.client.RestClient;
+import org.onap.so.client.RestProperties;
+import org.onap.so.client.RestPropertiesLoader;
+import org.onap.so.client.graphinventory.entities.uri.GraphInventoryUri;
+
+public abstract class GraphInventoryClient {
+
+ private RestProperties props;
+ protected GraphInventoryClient(Class<? extends RestProperties> propertiesClass) {
+
+ RestProperties props = RestPropertiesLoader.getInstance().getNewImpl(propertiesClass);
+ this.props = props;
+ }
+ protected abstract URI constructPath(GraphInventoryUri uri);
+
+ protected abstract RestClient createClient(GraphInventoryUri uri);
+
+ protected <T extends RestProperties> T getRestProperties() {
+ if (props == null) {
+ throw new IllegalStateException("No RestProperty implementation found on classpath");
+ }
+ return (T)props;
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIObjectName.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectName.java
index c7459d31b5..4543d8523b 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAIObjectName.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectName.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.
@@ -18,11 +18,11 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.graphinventory;
import com.google.common.base.CaseFormat;
-public interface AAIObjectName {
+public interface GraphInventoryObjectName {
public String typeName();
public String typeName(CaseFormat format);
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectPlurals.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectPlurals.java
new file mode 100644
index 0000000000..ba48eb279f
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectPlurals.java
@@ -0,0 +1,25 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.graphinventory;
+
+public interface GraphInventoryObjectPlurals extends GraphInventoryObjectName, GraphInventoryObjectUriTemplate, GraphInventoryObjectUriPartial {
+
+}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectType.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectType.java
new file mode 100644
index 0000000000..453becb75a
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectType.java
@@ -0,0 +1,25 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.graphinventory;
+
+public interface GraphInventoryObjectType extends GraphInventoryObjectName, GraphInventoryObjectUriTemplate, GraphInventoryObjectUriPartial {
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIObjectUriPartial.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectUriPartial.java
index 3fb867d6fa..0987221b0d 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAIObjectUriPartial.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectUriPartial.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.
@@ -18,9 +18,9 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.graphinventory;
-public interface AAIObjectUriPartial {
+public interface GraphInventoryObjectUriPartial {
public String partialUri();
}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIObjectUriTemplate.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectUriTemplate.java
index 397b66d547..e231ddb811 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAIObjectUriTemplate.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectUriTemplate.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.
@@ -18,9 +18,9 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai;
+package org.onap.so.client.graphinventory;
-public interface AAIObjectUriTemplate {
+public interface GraphInventoryObjectUriTemplate {
public String uriTemplate();
}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryVersion.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryVersion.java
new file mode 100644
index 0000000000..3b7dba70f8
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryVersion.java
@@ -0,0 +1,25 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.graphinventory;
+
+public interface GraphInventoryVersion {
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/Depth.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/Depth.java
index 7522ea33d1..1205511d11 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/Depth.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/Depth.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.entities.uri;
+package org.onap.so.client.graphinventory.entities.uri;
public enum Depth {
ZERO("0"),
@@ -41,5 +41,4 @@ public enum Depth {
public String toString() {
return this.depth;
}
-
}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryResourceUri.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryResourceUri.java
new file mode 100644
index 0000000000..08e7304978
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryResourceUri.java
@@ -0,0 +1,44 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.graphinventory.entities.uri;
+
+import org.onap.so.client.graphinventory.Format;
+import org.onap.so.client.graphinventory.entities.uri.Depth;
+import org.onap.so.client.graphinventory.GraphInventoryObjectPlurals;
+import org.onap.so.client.graphinventory.GraphInventoryObjectType;
+
+public interface GraphInventoryResourceUri extends GraphInventoryUri {
+ public GraphInventoryResourceUri relationshipAPI();
+ public GraphInventoryResourceUri relatedTo(GraphInventoryObjectPlurals plural);
+ public GraphInventoryResourceUri relatedTo(GraphInventoryObjectType type, String... values);
+ public GraphInventoryResourceUri resourceVersion(String version);
+ public GraphInventoryResourceUri format(Format format);
+ @Override
+ public GraphInventoryResourceUri depth(Depth depth);
+ @Override
+ public GraphInventoryResourceUri nodesOnly(boolean nodesOnly);
+ @Override
+ public GraphInventoryResourceUri queryParam(String name, String... values);
+ @Override
+ public GraphInventoryResourceUri replaceQueryParam(String name, String... values);
+ @Override
+ public GraphInventoryResourceUri clone();
+}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryUri.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryUri.java
new file mode 100644
index 0000000000..8a25c23895
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryUri.java
@@ -0,0 +1,60 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.graphinventory.entities.uri;
+
+import java.net.URI;
+import java.util.Map;
+
+import org.onap.so.client.graphinventory.entities.uri.Depth;
+import org.onap.so.client.graphinventory.GraphInventoryObjectType;
+
+public interface GraphInventoryUri {
+
+ public URI build();
+ /**
+ * By default GraphInventory enforces a depth of 1. Some objects can be told to retrieve objects
+ * nested beneath them by increasing this number.
+ *
+ * You can use 0 to restrict the returned information to only the object you requested
+ * You can use all to retrieve all nested objects (this should only be used if you really need a massive amount of information and are caching the retrieval)
+ * @param depth
+ * @return
+ */
+ public GraphInventoryUri depth(Depth depth);
+ /**
+ * Makes client only return object fields, no relationships
+ *
+ * @return
+ */
+ public GraphInventoryUri nodesOnly(boolean nodesOnly);
+ public GraphInventoryUri queryParam(String name, String... values);
+ public GraphInventoryUri replaceQueryParam(String name, String... values);
+ public GraphInventoryUri clone();
+
+ /**
+ * returns all key values of the URI as a map. Key names can be found in {@link GraphInventoryObjectType}
+ * @return
+ */
+ public Map<String, String> getURIKeys();
+ public GraphInventoryObjectType getObjectType();
+ public boolean equals(Object o);
+ public int hashCode();
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/SimpleUri.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java
index f3e6fad48b..9c86ec6348 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/SimpleUri.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.entities.uri;
+package org.onap.so.client.graphinventory.entities.uri;
import java.io.UnsupportedEncodingException;
import java.net.URI;
@@ -28,50 +28,60 @@ import java.util.Map;
import javax.ws.rs.core.UriBuilder;
-import org.openecomp.mso.client.aai.AAIObjectPlurals;
-import org.openecomp.mso.client.aai.AAIObjectType;
-import org.openecomp.mso.client.aai.entities.uri.parsers.UriParser;
-import org.openecomp.mso.client.aai.entities.uri.parsers.UriParserSpringImpl;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.onap.so.client.graphinventory.Format;
+import org.onap.so.client.aai.entities.uri.AAIUri;
+import org.onap.so.client.graphinventory.entities.uri.Depth;
+import org.onap.so.client.graphinventory.entities.uri.parsers.UriParser;
+import org.onap.so.client.graphinventory.entities.uri.parsers.UriParserSpringImpl;
+import org.onap.so.client.graphinventory.GraphInventoryObjectPlurals;
+import org.onap.so.client.graphinventory.GraphInventoryObjectType;
import org.springframework.web.util.UriUtils;
-public class SimpleUri implements AAIResourceUri {
+public class SimpleUri implements GraphInventoryResourceUri {
protected UriBuilder internalURI;
protected final static String relationshipAPI = "/relationship-list/relationship";
protected final static String relatedTo = "/related-to";
protected final Object[] values;
- protected final AAIObjectType type;
- protected final AAIObjectPlurals pluralType;
- protected SimpleUri(AAIObjectType type, Object... values) {
+ protected final GraphInventoryObjectType type;
+ protected final GraphInventoryObjectPlurals pluralType;
+ protected SimpleUri(GraphInventoryObjectType type, Object... values) {
this.type = type;
this.pluralType = null;
this.internalURI = UriBuilder.fromPath(this.getTemplate(type));
this.values = values;
}
- protected SimpleUri(AAIObjectType type, URI uri) {
+ protected SimpleUri(GraphInventoryObjectType type, URI uri) {
this.type = type;
this.pluralType = null;
this.internalURI = UriBuilder.fromPath(uri.getRawPath().replaceAll("/aai/v\\d+", ""));
this.values = new Object[0];
}
- protected SimpleUri(AAIObjectType type, UriBuilder builder, Object... values) {
+ protected SimpleUri(GraphInventoryObjectType type, UriBuilder builder, Object... values) {
this.internalURI = builder;
this.values = values;
this.type = type;
this.pluralType = null;
}
- protected SimpleUri(AAIObjectPlurals type, UriBuilder builder, Object... values) {
+ protected SimpleUri(GraphInventoryObjectPlurals type, UriBuilder builder, Object... values) {
this.internalURI = builder;
this.values = values;
this.type = null;
this.pluralType = type;
}
- protected SimpleUri(AAIObjectPlurals type) {
+ protected SimpleUri(GraphInventoryObjectPlurals type) {
this.type = null;
this.pluralType = type;
this.internalURI = UriBuilder.fromPath(this.getTemplate(type));
this.values = new Object[0];
}
+ protected SimpleUri(GraphInventoryObjectPlurals type, Object... values) {
+ this.type = null;
+ this.pluralType = type;
+ this.internalURI = UriBuilder.fromPath(this.getTemplate(type));
+ this.values = values;
+ }
@Override
public SimpleUri relationshipAPI() {
@@ -80,20 +90,20 @@ public class SimpleUri implements AAIResourceUri {
}
@Override
- public SimpleUri relatedTo(AAIObjectPlurals plural) {
+ public SimpleUri relatedTo(GraphInventoryObjectPlurals plural) {
this.internalURI = internalURI.path(relatedTo).path(plural.partialUri());
return this;
}
@Override
- public SimpleUri relatedTo(AAIObjectType type, String... values) {
+ public SimpleUri relatedTo(GraphInventoryObjectType type, String... values) {
this.internalURI = internalURI.path(relatedTo).path(UriBuilder.fromPath(type.partialUri()).build(values).toString());
return this;
}
@Override
public SimpleUri resourceVersion(String version) {
- this.internalURI = internalURI.queryParam("resource-version", version);
+ this.internalURI = internalURI.replaceQueryParam("resource-version", version);
return this;
}
@@ -104,6 +114,12 @@ public class SimpleUri implements AAIResourceUri {
}
@Override
+ public SimpleUri replaceQueryParam(String name, String... values) {
+ this.internalURI = internalURI.replaceQueryParam(name, values);
+ return this;
+ }
+
+ @Override
public URI build() {
return build(this.values);
}
@@ -152,7 +168,7 @@ public class SimpleUri implements AAIResourceUri {
}
@Override
- public AAIObjectType getObjectType() {
+ public GraphInventoryObjectType getObjectType() {
return this.type;
}
@@ -163,24 +179,37 @@ public class SimpleUri implements AAIResourceUri {
}
return false;
}
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(this.build()).toHashCode();
+ }
+
+
@Override
public SimpleUri depth(Depth depth) {
- this.internalURI.queryParam("depth", depth.toString());
+ this.internalURI.replaceQueryParam("depth", depth.toString());
return this;
}
@Override
public SimpleUri nodesOnly(boolean nodesOnly) {
if (nodesOnly) {
- this.internalURI.queryParam("nodes-only", "");
+ this.internalURI.replaceQueryParam("nodes-only", "");
}
return this;
}
- protected String getTemplate(AAIObjectType type) {
+ @Override
+ public SimpleUri format(Format format) {
+ this.internalURI.replaceQueryParam("format", format);
+ return this;
+ }
+
+ protected String getTemplate(GraphInventoryObjectType type) {
return type.uriTemplate();
}
- protected String getTemplate(AAIObjectPlurals type) {
+ protected String getTemplate(GraphInventoryObjectPlurals type) {
return type.uriTemplate();
}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/parsers/UriParser.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParser.java
index 8e37d595b0..03d83ebfb6 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/parsers/UriParser.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParser.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.entities.uri.parsers;
+package org.onap.so.client.graphinventory.entities.uri.parsers;
import java.util.Map;
import java.util.Set;
@@ -26,4 +26,4 @@ import java.util.Set;
public interface UriParser {
public Set<String> getVariables();
public Map<String, String> parse(final String uri);
-} \ No newline at end of file
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/parsers/UriParserSpringImpl.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParserSpringImpl.java
index 75f9005125..aeaa923d1b 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/entities/uri/parsers/UriParserSpringImpl.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParserSpringImpl.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.entities.uri.parsers;
+package org.onap.so.client.graphinventory.entities.uri.parsers;
import java.io.UnsupportedEncodingException;
import java.util.Collections;
import java.util.LinkedHashMap;
@@ -65,4 +65,4 @@ public class UriParserSpringImpl implements UriParser {
return result;
}
-} \ No newline at end of file
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/exceptions/BulkProcessFailed.java b/common/src/main/java/org/onap/so/client/graphinventory/exceptions/BulkProcessFailed.java
index ea64f54c33..0c973a8457 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/exceptions/BulkProcessFailed.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/exceptions/BulkProcessFailed.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.exceptions;
+package org.onap.so.client.graphinventory.exceptions;
public class BulkProcessFailed extends Exception {
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryPatchDepthExceededException.java b/common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryPatchDepthExceededException.java
new file mode 100644
index 0000000000..07af13049c
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryPatchDepthExceededException.java
@@ -0,0 +1,31 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.graphinventory.exceptions;
+
+public class GraphInventoryPatchDepthExceededException extends RuntimeException {
+
+ private static final long serialVersionUID = -3740429832086738907L;
+
+
+ public GraphInventoryPatchDepthExceededException(String payload) {
+ super("Object exceeds allowed depth for update action: " + payload);
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/exceptions/AAIPayloadException.java b/common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryPayloadException.java
index 35842204ac..24a6e5ccf9 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/exceptions/AAIPayloadException.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryPayloadException.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.
@@ -18,21 +18,21 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.exceptions;
+package org.onap.so.client.graphinventory.exceptions;
-public class AAIPayloadException extends Exception {
+public class GraphInventoryPayloadException extends Exception {
private static final long serialVersionUID = -5712783905947711065L;
- public AAIPayloadException(Throwable t) {
+ public GraphInventoryPayloadException(Throwable t) {
super(t);
}
- public AAIPayloadException(String s, Throwable t) {
+ public GraphInventoryPayloadException(String s, Throwable t) {
super(s, t);
}
- public AAIPayloadException(String s) {
+ public GraphInventoryPayloadException(String s) {
super(s);
}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/exceptions/AAIUriComputationException.java b/common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryUriComputationException.java
index 4d9f320cc8..51747d495a 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/exceptions/AAIUriComputationException.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryUriComputationException.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.
@@ -18,17 +18,17 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.exceptions;
+package org.onap.so.client.graphinventory.exceptions;
-public class AAIUriComputationException extends RuntimeException {
+public class GraphInventoryUriComputationException extends RuntimeException {
private static final long serialVersionUID = 5187931752227522034L;
- public AAIUriComputationException(String s) {
+ public GraphInventoryUriComputationException(String s) {
super(s);
}
- public AAIUriComputationException(Throwable t) {
+ public GraphInventoryUriComputationException(Throwable t) {
super(t);
}
}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/exceptions/AAIUriNotFoundException.java b/common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryUriNotFoundException.java
index 3e373946ce..d2f47a5b00 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/exceptions/AAIUriNotFoundException.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryUriNotFoundException.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.
@@ -18,12 +18,12 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.aai.exceptions;
+package org.onap.so.client.graphinventory.exceptions;
-public class AAIUriNotFoundException extends Exception {
+public class GraphInventoryUriNotFoundException extends Exception {
private static final long serialVersionUID = 2789643165122257833L;
- public AAIUriNotFoundException(String message) {
+ public GraphInventoryUriNotFoundException(String message) {
super(message);
}
}
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/GRMAction.java b/common/src/main/java/org/onap/so/client/grm/GRMAction.java
index 50544bab70..376c736037 100644
--- a/common/src/main/java/org/openecomp/mso/client/grm/GRMAction.java
+++ b/common/src/main/java/org/onap/so/client/grm/GRMAction.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.grm;
+package org.onap.so.client.grm;
public enum GRMAction {
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/GRMClient.java b/common/src/main/java/org/onap/so/client/grm/GRMClient.java
index 5b5f269731..84e25b9ce4 100644
--- a/common/src/main/java/org/openecomp/mso/client/grm/GRMClient.java
+++ b/common/src/main/java/org/onap/so/client/grm/GRMClient.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.
@@ -18,14 +18,14 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.grm;
+package org.onap.so.client.grm;
-import org.openecomp.mso.client.grm.beans.ServiceEndPointList;
-import org.openecomp.mso.client.grm.beans.ServiceEndPointLookup;
-import org.openecomp.mso.client.grm.beans.ServiceEndPointLookupRequest;
-import org.openecomp.mso.client.grm.beans.ServiceEndPointRequest;
-import org.openecomp.mso.client.grm.beans.VersionLookup;
-import org.openecomp.mso.client.grm.exceptions.GRMClientCallFailed;
+import org.onap.so.client.grm.beans.ServiceEndPointList;
+import org.onap.so.client.grm.beans.ServiceEndPointLookup;
+import org.onap.so.client.grm.beans.ServiceEndPointLookupRequest;
+import org.onap.so.client.grm.beans.ServiceEndPointRequest;
+import org.onap.so.client.grm.beans.VersionLookup;
+import org.onap.so.client.grm.exceptions.GRMClientCallFailed;
public class GRMClient {
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/GRMDefaultPropertiesImpl.java b/common/src/main/java/org/onap/so/client/grm/GRMDefaultPropertiesImpl.java
index 3bdc769321..b38072e769 100644
--- a/common/src/main/java/org/openecomp/mso/client/grm/GRMDefaultPropertiesImpl.java
+++ b/common/src/main/java/org/onap/so/client/grm/GRMDefaultPropertiesImpl.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.grm;
+package org.onap.so.client.grm;
import java.net.MalformedURLException;
import java.net.URL;
@@ -32,7 +32,7 @@ public class GRMDefaultPropertiesImpl implements GRMProperties {
@Override
public URL getEndpoint() throws MalformedURLException {
- return new URL("http://localhost:28090");
+ return new URL("http://localhost:47389");
}
@Override
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/GRMProperties.java b/common/src/main/java/org/onap/so/client/grm/GRMProperties.java
index 6fbbb21a8a..da9f215aac 100644
--- a/common/src/main/java/org/openecomp/mso/client/grm/GRMProperties.java
+++ b/common/src/main/java/org/onap/so/client/grm/GRMProperties.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.
@@ -18,9 +18,9 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.grm;
+package org.onap.so.client.grm;
-import org.openecomp.mso.client.RestProperties;
+import org.onap.so.client.RestProperties;
public interface GRMProperties extends RestProperties {
public String getDefaultVersion();
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/GRMPropertiesLoader.java b/common/src/main/java/org/onap/so/client/grm/GRMPropertiesLoader.java
index 9323e22065..485b9b0d15 100644
--- a/common/src/main/java/org/openecomp/mso/client/grm/GRMPropertiesLoader.java
+++ b/common/src/main/java/org/onap/so/client/grm/GRMPropertiesLoader.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.grm;
+package org.onap.so.client.grm;
import java.util.Iterator;
import java.util.ServiceLoader;
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/GRMRestClient.java b/common/src/main/java/org/onap/so/client/grm/GRMRestClient.java
index 7a81d7e7ec..ce16ccaaaa 100644
--- a/common/src/main/java/org/openecomp/mso/client/grm/GRMRestClient.java
+++ b/common/src/main/java/org/onap/so/client/grm/GRMRestClient.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.
@@ -18,20 +18,17 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.grm;
+package org.onap.so.client.grm;
import java.net.URI;
import java.util.Base64;
import java.util.Map;
import java.util.Optional;
-import java.util.UUID;
-import javax.ws.rs.client.ClientResponseFilter;
-
-import org.openecomp.mso.client.ResponseExceptionMapperImpl;
-import org.openecomp.mso.client.RestProperties;
-import org.openecomp.mso.client.policy.RestClient;
+import org.onap.so.client.RestClient;
+import org.onap.so.client.RestProperties;
+import org.onap.so.utils.TargetEntity;
public class GRMRestClient extends RestClient {
@@ -39,23 +36,19 @@ public class GRMRestClient extends RestClient {
private final String password;
public GRMRestClient(RestProperties props, URI path, String username, String password) {
- super(props, UUID.randomUUID(), Optional.of(path));
+ super(props, Optional.of(path));
this.username = username;
this.password = password;
}
+ @Override
+ public TargetEntity getTargetEntity(){
+ return TargetEntity.GRM;
+ }
+
@Override
protected void initializeHeaderMap(Map<String, String> headerMap) {
headerMap.put("Authorization", "Basic " + Base64.getEncoder().encodeToString(new String(username + ":" + password).getBytes()));
}
- @Override
- protected Optional<ClientResponseFilter> addResponseFilter() {
- return Optional.of(new ResponseExceptionMapperImpl());
- }
-
- @Override
- public RestClient addRequestId(UUID requestId) {
- return this;
- }
}
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/GRMRestInvoker.java b/common/src/main/java/org/onap/so/client/grm/GRMRestInvoker.java
index d706be3f16..3045cb35f4 100644
--- a/common/src/main/java/org/openecomp/mso/client/grm/GRMRestInvoker.java
+++ b/common/src/main/java/org/onap/so/client/grm/GRMRestInvoker.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.
@@ -18,14 +18,14 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.grm;
+package org.onap.so.client.grm;
import java.net.URI;
import java.util.Base64;
import javax.ws.rs.core.UriBuilder;
-import org.openecomp.mso.client.RestPropertiesLoader;
-import org.openecomp.mso.client.policy.RestClient;
+
+import org.onap.so.client.RestClient;
public class GRMRestInvoker {
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/beans/OperationalInfo.java b/common/src/main/java/org/onap/so/client/grm/beans/OperationalInfo.java
index c5f5a7a7af..85e15f597c 100644
--- a/common/src/main/java/org/openecomp/mso/client/grm/beans/OperationalInfo.java
+++ b/common/src/main/java/org/onap/so/client/grm/beans/OperationalInfo.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.
@@ -18,7 +18,9 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.grm.beans;
+package org.onap.so.client.grm.beans;
+
+import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
@@ -28,8 +30,12 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonPropertyOrder({ "createdBy", "updatedBy", "createdTimestamp", "updatedTimestamp" })
-public class OperationalInfo {
+public class OperationalInfo implements Serializable{
+ /**
+ *
+ */
+ private static final long serialVersionUID = -7213334079745439793L;
@JsonProperty("createdBy")
private String createdBy;
@JsonProperty("updatedBy")
@@ -79,4 +85,4 @@ public class OperationalInfo {
this.updatedTimestamp = updatedTimestamp;
}
-} \ No newline at end of file
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/beans/Property.java b/common/src/main/java/org/onap/so/client/grm/beans/Property.java
index eff1659102..705db95222 100644
--- a/common/src/main/java/org/openecomp/mso/client/grm/beans/Property.java
+++ b/common/src/main/java/org/onap/so/client/grm/beans/Property.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.
@@ -18,7 +18,9 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.grm.beans;
+package org.onap.so.client.grm.beans;
+
+import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
@@ -28,8 +30,12 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonPropertyOrder({ "name", "value" })
-public class Property {
+public class Property implements Serializable{
+ /**
+ *
+ */
+ private static final long serialVersionUID = -6060749559638446881L;
@JsonProperty("name")
private String name;
@JsonProperty("value")
@@ -55,4 +61,4 @@ public class Property {
this.value = value;
}
-} \ No newline at end of file
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPoint.java b/common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPoint.java
index a753afbe90..e739f00c9a 100644
--- a/common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPoint.java
+++ b/common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPoint.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.grm.beans;
+package org.onap.so.client.grm.beans;
import java.io.Serializable;
import java.util.List;
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPointList.java b/common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointList.java
index 0faf1fb826..19bbe69cf2 100644
--- a/common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPointList.java
+++ b/common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointList.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.grm.beans;
+package org.onap.so.client.grm.beans;
import java.util.List;
@@ -45,4 +45,4 @@ public class ServiceEndPointList {
this.serviceEndPointList = serviceEndPointList;
}
-} \ No newline at end of file
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPointLookup.java b/common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointLookup.java
index 37e23795e9..cab10e64f4 100644
--- a/common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPointLookup.java
+++ b/common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointLookup.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.grm.beans;
+package org.onap.so.client.grm.beans;
import java.io.Serializable;
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPointLookupRequest.java b/common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointLookupRequest.java
index fc1992c763..5e886300dd 100644
--- a/common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPointLookupRequest.java
+++ b/common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointLookupRequest.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.
@@ -18,13 +18,8 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.grm.beans;
+package org.onap.so.client.grm.beans;
-import java.util.HashMap;
-import java.util.Map;
-import com.fasterxml.jackson.annotation.JsonAnyGetter;
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -60,4 +55,4 @@ public class ServiceEndPointLookupRequest {
this.env = env;
}
-} \ No newline at end of file
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPointRequest.java b/common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointRequest.java
index 324fe9f32a..f7ea352f21 100644
--- a/common/src/main/java/org/openecomp/mso/client/grm/beans/ServiceEndPointRequest.java
+++ b/common/src/main/java/org/onap/so/client/grm/beans/ServiceEndPointRequest.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.
@@ -18,13 +18,8 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.grm.beans;
+package org.onap.so.client.grm.beans;
-import java.util.HashMap;
-import java.util.Map;
-import com.fasterxml.jackson.annotation.JsonAnyGetter;
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -60,4 +55,4 @@ public class ServiceEndPointRequest {
this.env = env;
}
-} \ No newline at end of file
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/beans/Status.java b/common/src/main/java/org/onap/so/client/grm/beans/Status.java
index 3c66c50a5c..8794139b67 100644
--- a/common/src/main/java/org/openecomp/mso/client/grm/beans/Status.java
+++ b/common/src/main/java/org/onap/so/client/grm/beans/Status.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.
@@ -18,7 +18,9 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.grm.beans;
+package org.onap.so.client.grm.beans;
+
+import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
@@ -28,8 +30,12 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonPropertyOrder({ "status", "statusReasonCode", "statusReasonDescription", "statusCheckTime" })
-public class Status {
+public class Status implements Serializable {
+ /**
+ *
+ */
+ private static final long serialVersionUID = -3555636617671062648L;
@JsonProperty("status")
private String status;
@JsonProperty("statusReasonCode")
@@ -79,4 +85,4 @@ public class Status {
this.statusCheckTime = statusCheckTime;
}
-} \ No newline at end of file
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/beans/Version.java b/common/src/main/java/org/onap/so/client/grm/beans/Version.java
index 1d4d959f02..fd1e5803ab 100644
--- a/common/src/main/java/org/openecomp/mso/client/grm/beans/Version.java
+++ b/common/src/main/java/org/onap/so/client/grm/beans/Version.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.
@@ -18,7 +18,9 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.grm.beans;
+package org.onap.so.client.grm.beans;
+
+import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
@@ -28,8 +30,12 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonPropertyOrder({ "major", "minor", "patch" })
-public class Version {
+public class Version implements Serializable{
+ /**
+ *
+ */
+ private static final long serialVersionUID = 7509573030831487410L;
@JsonProperty("major")
private Integer major;
@JsonProperty("minor")
@@ -66,4 +72,4 @@ public class Version {
public void setPatch(String patch) {
this.patch = patch;
}
-} \ No newline at end of file
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/beans/VersionLookup.java b/common/src/main/java/org/onap/so/client/grm/beans/VersionLookup.java
index b9d5a63450..0dc86b04d6 100644
--- a/common/src/main/java/org/openecomp/mso/client/grm/beans/VersionLookup.java
+++ b/common/src/main/java/org/onap/so/client/grm/beans/VersionLookup.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.grm.beans;
+package org.onap.so.client.grm.beans;
import java.io.Serializable;
@@ -46,4 +46,4 @@ public class VersionLookup implements Serializable {
public void setMajor(Integer major) {
this.major = major;
}
-} \ No newline at end of file
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/grm/exceptions/GRMClientCallFailed.java b/common/src/main/java/org/onap/so/client/grm/exceptions/GRMClientCallFailed.java
index 60de57286d..7107d4027f 100644
--- a/common/src/main/java/org/openecomp/mso/client/grm/exceptions/GRMClientCallFailed.java
+++ b/common/src/main/java/org/onap/so/client/grm/exceptions/GRMClientCallFailed.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.grm.exceptions;
+package org.onap.so.client.grm.exceptions;
public class GRMClientCallFailed extends Exception {
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/CommonObjectMapperProvider.java b/common/src/main/java/org/onap/so/client/policy/CommonObjectMapperProvider.java
index 4f41b6441e..f2f6f0362f 100644
--- a/common/src/main/java/org/openecomp/mso/client/policy/CommonObjectMapperProvider.java
+++ b/common/src/main/java/org/onap/so/client/policy/CommonObjectMapperProvider.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.
@@ -18,9 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.policy;
-
-import javax.ws.rs.ext.ContextResolver;
+package org.onap.so.client.policy;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.databind.DeserializationFeature;
@@ -28,9 +26,9 @@ import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-public class CommonObjectMapperProvider implements ContextResolver<ObjectMapper> {
+public class CommonObjectMapperProvider {
- final ObjectMapper mapper;
+ protected ObjectMapper mapper;
public CommonObjectMapperProvider() {
@@ -42,8 +40,7 @@ public class CommonObjectMapperProvider implements ContextResolver<ObjectMapper>
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
}
- @Override
- public ObjectMapper getContext(Class<?> type) {
+ public ObjectMapper getMapper() {
return mapper;
}
} \ No newline at end of file
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/DecisionAttributes.java b/common/src/main/java/org/onap/so/client/policy/DecisionAttributes.java
index 7b765ebb5f..951372db42 100644
--- a/common/src/main/java/org/openecomp/mso/client/policy/DecisionAttributes.java
+++ b/common/src/main/java/org/onap/so/client/policy/DecisionAttributes.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.policy;
+package org.onap.so.client.policy;
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/JettisonStyleMapperProvider.java b/common/src/main/java/org/onap/so/client/policy/JettisonStyleMapperProvider.java
index 19579e810b..23b984a3d0 100644
--- a/common/src/main/java/org/openecomp/mso/client/policy/JettisonStyleMapperProvider.java
+++ b/common/src/main/java/org/onap/so/client/policy/JettisonStyleMapperProvider.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.
@@ -18,32 +18,28 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.policy;
+package org.onap.so.client.policy;
-import javax.ws.rs.ext.ContextResolver;
+import org.springframework.stereotype.Component;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
+import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule;
-public class JettisonStyleMapperProvider implements ContextResolver<ObjectMapper> {
+@Component
+public class JettisonStyleMapperProvider extends CommonObjectMapperProvider {
- final ObjectMapper mapper;
-
public JettisonStyleMapperProvider() {
mapper = new ObjectMapper();
+ JaxbAnnotationModule jaxbModule = new JaxbAnnotationModule();
mapper.setSerializationInclusion(Include.NON_NULL);
- mapper.enable(MapperFeature.USE_ANNOTATIONS);
mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ mapper.registerModule(jaxbModule);
}
- @Override
- public ObjectMapper getContext(Class<?> type) {
- return mapper;
- }
}
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/LoggingFilter.java b/common/src/main/java/org/onap/so/client/policy/LoggingFilter.java
index b04069697e..83cf08f77f 100644
--- a/common/src/main/java/org/openecomp/mso/client/policy/LoggingFilter.java
+++ b/common/src/main/java/org/onap/so/client/policy/LoggingFilter.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.policy;
+package org.onap.so.client.policy;
import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
@@ -39,14 +39,14 @@ import javax.ws.rs.ext.Provider;
import javax.ws.rs.ext.WriterInterceptor;
import javax.ws.rs.ext.WriterInterceptorContext;
-import org.openecomp.mso.logger.MsoLogger;
+import org.onap.so.logger.MsoLogger;
@Provider
@Priority(0)
public class LoggingFilter implements ClientRequestFilter, ClientResponseFilter, WriterInterceptor {
- private static final MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
+ private static final MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, LoggingFilter.class);
private static final String ENTITY_STREAM_PROPERTY = "LoggingFilter.entityStream";
private static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8;
private final int maxEntitySize;
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/PolicyClient.java b/common/src/main/java/org/onap/so/client/policy/PolicyClient.java
index defd11bc99..74c1e398db 100644
--- a/common/src/main/java/org/openecomp/mso/client/policy/PolicyClient.java
+++ b/common/src/main/java/org/onap/so/client/policy/PolicyClient.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.
@@ -18,11 +18,10 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.policy;
+package org.onap.so.client.policy;
-import org.openecomp.mso.client.policy.entities.AllowedTreatments;
-import org.openecomp.mso.client.policy.entities.DictionaryData;
-import org.openecomp.mso.client.policy.entities.PolicyDecision;
+import org.onap.so.client.policy.entities.DictionaryData;
+import org.onap.so.client.policy.entities.PolicyDecision;
public interface PolicyClient {
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/PolicyClientImpl.java b/common/src/main/java/org/onap/so/client/policy/PolicyClientImpl.java
index 0ce1911c82..1fd01e65ed 100644
--- a/common/src/main/java/org/openecomp/mso/client/policy/PolicyClientImpl.java
+++ b/common/src/main/java/org/onap/so/client/policy/PolicyClientImpl.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.
@@ -18,33 +18,35 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.policy;
-
-import org.openecomp.mso.client.RestPropertiesLoader;
-import org.openecomp.mso.client.defaultproperties.PolicyRestPropertiesImpl;
-import org.openecomp.mso.client.policy.entities.AllowedTreatments;
-import org.openecomp.mso.client.policy.entities.Bbid;
-import org.openecomp.mso.client.policy.entities.DecisionAttributes;
-import org.openecomp.mso.client.policy.entities.DictionaryData;
-import org.openecomp.mso.client.policy.entities.DictionaryItemsRequest;
-import org.openecomp.mso.client.policy.entities.DictionaryJson;
-import org.openecomp.mso.client.policy.entities.PolicyDecision;
-import org.openecomp.mso.client.policy.entities.PolicyDecisionRequest;
-import org.openecomp.mso.client.policy.entities.PolicyServiceType;
-import org.openecomp.mso.client.policy.entities.Workstep;
+package org.onap.so.client.policy;
import java.util.List;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
+
+import org.onap.so.client.RestClient;
+import org.onap.so.client.RestPropertiesLoader;
+import org.onap.so.client.defaultproperties.PolicyRestPropertiesImpl;
+import org.onap.so.client.policy.entities.AllowedTreatments;
+import org.onap.so.client.policy.entities.Bbid;
+import org.onap.so.client.policy.entities.DecisionAttributes;
+import org.onap.so.client.policy.entities.DictionaryData;
+import org.onap.so.client.policy.entities.DictionaryItemsRequest;
+import org.onap.so.client.policy.entities.DictionaryJson;
+import org.onap.so.client.policy.entities.PolicyDecision;
+import org.onap.so.client.policy.entities.PolicyDecisionRequest;
+import org.onap.so.client.policy.entities.PolicyServiceType;
+import org.onap.so.client.policy.entities.Workstep;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
public class PolicyClientImpl implements PolicyClient {
- protected final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger();
+ private static Logger logger = LoggerFactory.getLogger(PolicyClientImpl.class);
private PolicyRestProperties props;
public PolicyClientImpl() {
props = RestPropertiesLoader.getInstance().getNewImpl(PolicyRestProperties.class);
if (props == null) {
- metricsLogger.error("No RestProperty.PolicyRestProperties implementation found on classpath");
+ logger.error("No RestProperty.PolicyRestProperties implementation found on classpath");
props = new PolicyRestPropertiesImpl();
}
}
@@ -52,8 +54,8 @@ public class PolicyClientImpl implements PolicyClient {
String errorCode) {
DecisionAttributes decisionAttributes = new DecisionAttributes();
decisionAttributes.setServiceType(serviceType);
- decisionAttributes.setVNFType(vnfType);
- decisionAttributes.setBBID(bbID);
+ decisionAttributes.setvNFType(vnfType);
+ decisionAttributes.setBbID(bbID);
decisionAttributes.setWorkStep(workStep);
decisionAttributes.setErrorCode(errorCode);
@@ -87,7 +89,7 @@ public class PolicyClientImpl implements PolicyClient {
return dictData;
}
}
- metricsLogger.error("There is no AllowedTreatments with that specified parameter set");
+ logger.error("There is no AllowedTreatments with that specified parameter set");
return null;
}
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/PolicyRestClient.java b/common/src/main/java/org/onap/so/client/policy/PolicyRestClient.java
index 77fec34de6..9427fa7eb9 100644
--- a/common/src/main/java/org/openecomp/mso/client/policy/PolicyRestClient.java
+++ b/common/src/main/java/org/onap/so/client/policy/PolicyRestClient.java
@@ -18,49 +18,37 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.policy;
+package org.onap.so.client.policy;
+
-import java.net.MalformedURLException;
import java.util.Map;
import java.util.Optional;
-import java.util.UUID;
-import javax.ws.rs.client.ClientResponseFilter;
import javax.ws.rs.core.UriBuilder;
-import javax.ws.rs.core.UriBuilderException;
-import org.openecomp.mso.client.ResponseExceptionMapperImpl;
-import org.openecomp.mso.client.RestProperties;
-import org.openecomp.mso.client.policy.entities.PolicyServiceType;
-import org.springframework.stereotype.Service;
+import org.onap.so.client.RestClient;
+import org.onap.so.client.policy.entities.PolicyServiceType;
+import org.onap.so.utils.TargetEntity;
-@Service
public class PolicyRestClient extends RestClient {
- private static final UUID X_ECOMP_REQUESTID = UUID.randomUUID();
private final PolicyRestProperties properties;
+
public PolicyRestClient(PolicyRestProperties props, PolicyServiceType serviceType) {
- super(props, UUID.randomUUID(), Optional.of(UriBuilder.fromPath(serviceType.toString()).build()));
+ super(props, Optional.of(UriBuilder.fromPath(serviceType.toString()).build()));
this.properties = props;
- this.getClient();
}
+ @Override
+ public TargetEntity getTargetEntity(){
+ return TargetEntity.POLICY;
+ }
+
@Override
protected void initializeHeaderMap(Map<String, String> headerMap) {
headerMap.put("ClientAuth", properties.getClientAuth());
headerMap.put("Authorization", properties.getAuth());
headerMap.put("Environment", properties.getEnvironment());
- this.addRequestId(X_ECOMP_REQUESTID);
- }
-
- @Override
- protected Optional<ClientResponseFilter> addResponseFilter() {
- return Optional.of(new ResponseExceptionMapperImpl());
}
- @Override
- public RestClient addRequestId(UUID requestId) {
- this.headerMap.put("X-ECOMP-RequestID", requestId.toString());
- return this;
- }
-}
+} \ No newline at end of file
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/PolicyRestProperties.java b/common/src/main/java/org/onap/so/client/policy/PolicyRestProperties.java
index d89bd54f66..1de6e8cd97 100644
--- a/common/src/main/java/org/openecomp/mso/client/policy/PolicyRestProperties.java
+++ b/common/src/main/java/org/onap/so/client/policy/PolicyRestProperties.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.
@@ -18,13 +18,9 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.policy;
+package org.onap.so.client.policy;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Map;
-
-import org.openecomp.mso.client.RestProperties;
+import org.onap.so.client.RestProperties;
public interface PolicyRestProperties extends RestProperties {
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/entities/AllowedTreatments.java b/common/src/main/java/org/onap/so/client/policy/entities/AllowedTreatments.java
index 50db843416..e82eca56b8 100644
--- a/common/src/main/java/org/openecomp/mso/client/policy/entities/AllowedTreatments.java
+++ b/common/src/main/java/org/onap/so/client/policy/entities/AllowedTreatments.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.policy.entities;
+package org.onap.so.client.policy.entities;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -102,4 +102,4 @@ this.responseMessage = responseMessage;
return this;
}
-} \ No newline at end of file
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/entities/Bbid.java b/common/src/main/java/org/onap/so/client/policy/entities/Bbid.java
index 382b27a04b..34faa7df09 100644
--- a/common/src/main/java/org/openecomp/mso/client/policy/entities/Bbid.java
+++ b/common/src/main/java/org/onap/so/client/policy/entities/Bbid.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.
@@ -18,70 +18,70 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.policy.entities;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"valueType",
-"string",
-"chars"
-})
-public class Bbid {
-
-@JsonProperty("valueType")
-private String valueType;
-@JsonProperty("string")
-private String string;
-@JsonProperty("chars")
-private String chars;
-
-@JsonProperty("valueType")
-public String getValueType() {
-return valueType;
- }
-
-@JsonProperty("valueType")
-public void setValueType(String valueType) {
-this.valueType = valueType;
- }
-
-public Bbid withValueType(String valueType) {
-this.valueType = valueType;
-return this;
- }
-
-@JsonProperty("string")
-public String getString() {
-return string;
- }
-
-@JsonProperty("string")
-public void setString(String string) {
-this.string = string;
- }
-
-public Bbid withString(String string) {
-this.string = string;
-return this;
- }
-
-@JsonProperty("chars")
-public String getChars() {
-return chars;
- }
-
-@JsonProperty("chars")
-public void setChars(String chars) {
-this.chars = chars;
- }
-
-public Bbid withChars(String chars) {
-this.chars = chars;
-return this;
- }
-
-} \ No newline at end of file
+package org.onap.so.client.policy.entities;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"valueType",
+"string",
+"chars"
+})
+public class Bbid {
+
+@JsonProperty("valueType")
+private String valueType;
+@JsonProperty("string")
+private String string;
+@JsonProperty("chars")
+private String chars;
+
+@JsonProperty("valueType")
+public String getValueType() {
+return valueType;
+ }
+
+@JsonProperty("valueType")
+public void setValueType(String valueType) {
+this.valueType = valueType;
+ }
+
+public Bbid withValueType(String valueType) {
+this.valueType = valueType;
+return this;
+ }
+
+@JsonProperty("string")
+public String getString() {
+return string;
+ }
+
+@JsonProperty("string")
+public void setString(String string) {
+this.string = string;
+ }
+
+public Bbid withString(String string) {
+this.string = string;
+return this;
+ }
+
+@JsonProperty("chars")
+public String getChars() {
+return chars;
+ }
+
+@JsonProperty("chars")
+public void setChars(String chars) {
+this.chars = chars;
+ }
+
+public Bbid withChars(String chars) {
+this.chars = chars;
+return this;
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/entities/DecisionAttributes.java b/common/src/main/java/org/onap/so/client/policy/entities/DecisionAttributes.java
index 655f71f823..07db7d8568 100644
--- a/common/src/main/java/org/openecomp/mso/client/policy/entities/DecisionAttributes.java
+++ b/common/src/main/java/org/onap/so/client/policy/entities/DecisionAttributes.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.
@@ -18,8 +18,7 @@
* ============LICENSE_END=========================================================
*/
-
-package org.openecomp.mso.client.policy.entities;
+package org.onap.so.client.policy.entities;
@@ -34,9 +33,9 @@ public class DecisionAttributes {
@JsonProperty("ServiceType")
private String serviceType;
@JsonProperty("VNFType")
- private String VNFType;
+ private String vNFType;
@JsonProperty("BB_ID")
- private String BBID;
+ private String bbID;
@JsonProperty("WorkStep")
private String workStep;
@JsonProperty("ErrorCode")
@@ -52,26 +51,6 @@ public class DecisionAttributes {
this.serviceType = serviceType;
}
- @JsonProperty("VNFType")
- public String getVNFType() {
- return VNFType;
- }
-
- @JsonProperty("VNFType")
- public void setVNFType(String vNFType) {
- this.VNFType = vNFType;
- }
-
- @JsonProperty("BB_ID")
- public String getBBID() {
- return BBID;
- }
-
- @JsonProperty("BB_ID")
- public void setBBID(String bBID) {
- this.BBID = bBID;
- }
-
@JsonProperty("WorkStep")
public String getWorkStep() {
return workStep;
@@ -91,4 +70,25 @@ public class DecisionAttributes {
public void setErrorCode(String errorCode) {
this.errorCode = errorCode;
}
+
+ @JsonProperty("VNFType")
+ public String getvNFType() {
+ return vNFType;
+ }
+
+ @JsonProperty("VNFType")
+ public void setvNFType(String vNFType) {
+ this.vNFType = vNFType;
+ }
+
+ @JsonProperty("BB_ID")
+ public String getBbID() {
+ return bbID;
+ }
+
+ @JsonProperty("BB_ID")
+ public void setBbID(String bbID) {
+ this.bbID = bbID;
+ }
+
}
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/entities/DictionaryData.java b/common/src/main/java/org/onap/so/client/policy/entities/DictionaryData.java
index 1ecf3366c7..8207999a80 100644
--- a/common/src/main/java/org/openecomp/mso/client/policy/entities/DictionaryData.java
+++ b/common/src/main/java/org/onap/so/client/policy/entities/DictionaryData.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.
@@ -18,88 +18,88 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.policy.entities;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"id",
-"bbid",
-"workstep",
-"treatments"
-})
-public class DictionaryData {
-
-@JsonProperty("id")
-private Id id;
-@JsonProperty("bbid")
-private Bbid bbid;
-@JsonProperty("workstep")
-private Workstep workstep;
-@JsonProperty("treatments")
-private Treatments treatments;
-
-@JsonProperty("id")
-public Id getId() {
-return id;
- }
-
-@JsonProperty("id")
-public void setId(Id id) {
-this.id = id;
- }
-
-public DictionaryData withId(Id id) {
-this.id = id;
-return this;
- }
-
-@JsonProperty("bbid")
-public Bbid getBbid() {
-return bbid;
- }
-
-@JsonProperty("bbid")
-public void setBbid(Bbid bbid) {
-this.bbid = bbid;
- }
-
-public DictionaryData withBbid(Bbid bbid) {
-this.bbid = bbid;
-return this;
- }
-
-@JsonProperty("workstep")
-public Workstep getWorkstep() {
-return workstep;
- }
-
-@JsonProperty("workstep")
-public void setWorkstep(Workstep workstep) {
-this.workstep = workstep;
- }
-
-public DictionaryData withWorkstep(Workstep workstep) {
-this.workstep = workstep;
-return this;
- }
-
-@JsonProperty("treatments")
-public Treatments getTreatments() {
-return treatments;
- }
-
-@JsonProperty("treatments")
-public void setTreatments(Treatments treatments) {
-this.treatments = treatments;
- }
-
-public DictionaryData withTreatments(Treatments treatments) {
-this.treatments = treatments;
-return this;
- }
-
-} \ No newline at end of file
+package org.onap.so.client.policy.entities;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"id",
+"bbid",
+"workstep",
+"treatments"
+})
+public class DictionaryData {
+
+@JsonProperty("id")
+private Id id;
+@JsonProperty("bbid")
+private Bbid bbid;
+@JsonProperty("workstep")
+private Workstep workstep;
+@JsonProperty("treatments")
+private Treatments treatments;
+
+@JsonProperty("id")
+public Id getId() {
+return id;
+ }
+
+@JsonProperty("id")
+public void setId(Id id) {
+this.id = id;
+ }
+
+public DictionaryData withId(Id id) {
+this.id = id;
+return this;
+ }
+
+@JsonProperty("bbid")
+public Bbid getBbid() {
+return bbid;
+ }
+
+@JsonProperty("bbid")
+public void setBbid(Bbid bbid) {
+this.bbid = bbid;
+ }
+
+public DictionaryData withBbid(Bbid bbid) {
+this.bbid = bbid;
+return this;
+ }
+
+@JsonProperty("workstep")
+public Workstep getWorkstep() {
+return workstep;
+ }
+
+@JsonProperty("workstep")
+public void setWorkstep(Workstep workstep) {
+this.workstep = workstep;
+ }
+
+public DictionaryData withWorkstep(Workstep workstep) {
+this.workstep = workstep;
+return this;
+ }
+
+@JsonProperty("treatments")
+public Treatments getTreatments() {
+return treatments;
+ }
+
+@JsonProperty("treatments")
+public void setTreatments(Treatments treatments) {
+this.treatments = treatments;
+ }
+
+public DictionaryData withTreatments(Treatments treatments) {
+this.treatments = treatments;
+return this;
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/entities/DictionaryItemsRequest.java b/common/src/main/java/org/onap/so/client/policy/entities/DictionaryItemsRequest.java
index d37d0c6f13..8b063e83c7 100644
--- a/common/src/main/java/org/openecomp/mso/client/policy/entities/DictionaryItemsRequest.java
+++ b/common/src/main/java/org/onap/so/client/policy/entities/DictionaryItemsRequest.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.
@@ -18,8 +18,7 @@
* ============LICENSE_END=========================================================
*/
-
-package org.openecomp.mso.client.policy.entities;
+package org.onap.so.client.policy.entities;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/entities/DictionaryJson.java b/common/src/main/java/org/onap/so/client/policy/entities/DictionaryJson.java
index b6a95ae12a..097c9a5cb9 100644
--- a/common/src/main/java/org/openecomp/mso/client/policy/entities/DictionaryJson.java
+++ b/common/src/main/java/org/onap/so/client/policy/entities/DictionaryJson.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.
@@ -18,36 +18,37 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.policy.entities;
-
-import java.util.ArrayList;
-import java.util.List;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"DictionaryDatas"
-})
-public class DictionaryJson {
-
-@JsonProperty("DictionaryDatas")
-private List<DictionaryData> dictionaryDatas = new ArrayList<DictionaryData>();
-
-@JsonProperty("DictionaryDatas")
-public List<DictionaryData> getDictionaryDatas() {
-return dictionaryDatas;
- }
-
-@JsonProperty("DictionaryDatas")
-public void setDictionaryDatas(List<DictionaryData> dictionaryDatas) {
-this.dictionaryDatas = dictionaryDatas;
- }
-
-public DictionaryJson withDictionaryDatas(List<DictionaryData> dictionaryDatas) {
-this.dictionaryDatas = dictionaryDatas;
-return this;
- }
-
-} \ No newline at end of file
+package org.onap.so.client.policy.entities;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"DictionaryDatas"
+})
+public class DictionaryJson {
+
+@JsonProperty("DictionaryDatas")
+private List<DictionaryData> dictionaryDatas = new ArrayList<DictionaryData>();
+
+@JsonProperty("DictionaryDatas")
+public List<DictionaryData> getDictionaryDatas() {
+return dictionaryDatas;
+ }
+
+@JsonProperty("DictionaryDatas")
+public void setDictionaryDatas(List<DictionaryData> dictionaryDatas) {
+this.dictionaryDatas = dictionaryDatas;
+ }
+
+public DictionaryJson withDictionaryDatas(List<DictionaryData> dictionaryDatas) {
+this.dictionaryDatas = dictionaryDatas;
+return this;
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/entities/Id.java b/common/src/main/java/org/onap/so/client/policy/entities/Id.java
index 728381a60b..af164d6866 100644
--- a/common/src/main/java/org/openecomp/mso/client/policy/entities/Id.java
+++ b/common/src/main/java/org/onap/so/client/policy/entities/Id.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.
@@ -18,52 +18,52 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.policy.entities;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"integral",
-"valueType"
-})
-public class Id {
-
-@JsonProperty("integral")
-private Boolean integral;
-@JsonProperty("valueType")
-private String valueType;
-
-@JsonProperty("integral")
-public Boolean getIntegral() {
-return integral;
- }
-
-@JsonProperty("integral")
-public void setIntegral(Boolean integral) {
-this.integral = integral;
- }
-
-public Id withIntegral(Boolean integral) {
-this.integral = integral;
-return this;
- }
-
-@JsonProperty("valueType")
-public String getValueType() {
-return valueType;
- }
-
-@JsonProperty("valueType")
-public void setValueType(String valueType) {
-this.valueType = valueType;
- }
-
-public Id withValueType(String valueType) {
-this.valueType = valueType;
-return this;
- }
-
-} \ No newline at end of file
+package org.onap.so.client.policy.entities;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"integral",
+"valueType"
+})
+public class Id {
+
+@JsonProperty("integral")
+private Boolean integral;
+@JsonProperty("valueType")
+private String valueType;
+
+@JsonProperty("integral")
+public Boolean getIntegral() {
+return integral;
+ }
+
+@JsonProperty("integral")
+public void setIntegral(Boolean integral) {
+this.integral = integral;
+ }
+
+public Id withIntegral(Boolean integral) {
+this.integral = integral;
+return this;
+ }
+
+@JsonProperty("valueType")
+public String getValueType() {
+return valueType;
+ }
+
+@JsonProperty("valueType")
+public void setValueType(String valueType) {
+this.valueType = valueType;
+ }
+
+public Id withValueType(String valueType) {
+this.valueType = valueType;
+return this;
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/PolicyDecision.java b/common/src/main/java/org/onap/so/client/policy/entities/PolicyDecision.java
index 98c7e1558d..57c93927cb 100644
--- a/common/src/main/java/org/openecomp/mso/client/policy/PolicyDecision.java
+++ b/common/src/main/java/org/onap/so/client/policy/entities/PolicyDecision.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.policy;
+package org.onap.so.client.policy.entities;
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/PolicyDecisionRequest.java b/common/src/main/java/org/onap/so/client/policy/entities/PolicyDecisionRequest.java
index c83fb19e34..b402e85e32 100644
--- a/common/src/main/java/org/openecomp/mso/client/policy/PolicyDecisionRequest.java
+++ b/common/src/main/java/org/onap/so/client/policy/entities/PolicyDecisionRequest.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.policy;
+package org.onap.so.client.policy.entities;
import com.fasterxml.jackson.annotation.JsonInclude;
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/entities/PolicyServiceType.java b/common/src/main/java/org/onap/so/client/policy/entities/PolicyServiceType.java
index 01f6738947..83dc6b7862 100644
--- a/common/src/main/java/org/openecomp/mso/client/policy/entities/PolicyServiceType.java
+++ b/common/src/main/java/org/onap/so/client/policy/entities/PolicyServiceType.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.policy.entities;
+package org.onap.so.client.policy.entities;
public enum PolicyServiceType {
GET_CONFIG("getConfig"),
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/entities/Treatments.java b/common/src/main/java/org/onap/so/client/policy/entities/Treatments.java
index 13af8932aa..433d32756c 100644
--- a/common/src/main/java/org/openecomp/mso/client/policy/entities/Treatments.java
+++ b/common/src/main/java/org/onap/so/client/policy/entities/Treatments.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.
@@ -18,70 +18,70 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.policy.entities;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"valueType",
-"string",
-"chars"
-})
-public class Treatments {
-
-@JsonProperty("valueType")
-private String valueType;
-@JsonProperty("string")
-private String string;
-@JsonProperty("chars")
-private String chars;
-
-@JsonProperty("valueType")
-public String getValueType() {
-return valueType;
- }
-
-@JsonProperty("valueType")
-public void setValueType(String valueType) {
-this.valueType = valueType;
- }
-
-public Treatments withValueType(String valueType) {
-this.valueType = valueType;
-return this;
- }
-
-@JsonProperty("string")
-public String getString() {
-return string;
- }
-
-@JsonProperty("string")
-public void setString(String string) {
-this.string = string;
- }
-
-public Treatments withString(String string) {
-this.string = string;
-return this;
- }
-
-@JsonProperty("chars")
-public String getChars() {
-return chars;
- }
-
-@JsonProperty("chars")
-public void setChars(String chars) {
-this.chars = chars;
- }
-
-public Treatments withChars(String chars) {
-this.chars = chars;
-return this;
- }
-
-} \ No newline at end of file
+package org.onap.so.client.policy.entities;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"valueType",
+"string",
+"chars"
+})
+public class Treatments {
+
+@JsonProperty("valueType")
+private String valueType;
+@JsonProperty("string")
+private String string;
+@JsonProperty("chars")
+private String chars;
+
+@JsonProperty("valueType")
+public String getValueType() {
+return valueType;
+ }
+
+@JsonProperty("valueType")
+public void setValueType(String valueType) {
+this.valueType = valueType;
+ }
+
+public Treatments withValueType(String valueType) {
+this.valueType = valueType;
+return this;
+ }
+
+@JsonProperty("string")
+public String getString() {
+return string;
+ }
+
+@JsonProperty("string")
+public void setString(String string) {
+this.string = string;
+ }
+
+public Treatments withString(String string) {
+this.string = string;
+return this;
+ }
+
+@JsonProperty("chars")
+public String getChars() {
+return chars;
+ }
+
+@JsonProperty("chars")
+public void setChars(String chars) {
+this.chars = chars;
+ }
+
+public Treatments withChars(String chars) {
+this.chars = chars;
+return this;
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/entities/Workstep.java b/common/src/main/java/org/onap/so/client/policy/entities/Workstep.java
index 9d2adfe2c0..4fbd6e2f8a 100644
--- a/common/src/main/java/org/openecomp/mso/client/policy/entities/Workstep.java
+++ b/common/src/main/java/org/onap/so/client/policy/entities/Workstep.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.
@@ -18,71 +18,70 @@
* ============LICENSE_END=========================================================
*/
-
-package org.openecomp.mso.client.policy.entities;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
-"valueType",
-"string",
-"chars"
-})
-public class Workstep {
-
-@JsonProperty("valueType")
-private String valueType;
-@JsonProperty("string")
-private String string;
-@JsonProperty("chars")
-private String chars;
-
-@JsonProperty("valueType")
-public String getValueType() {
-return valueType;
- }
-
-@JsonProperty("valueType")
-public void setValueType(String valueType) {
-this.valueType = valueType;
- }
-
-public Workstep withValueType(String valueType) {
-this.valueType = valueType;
-return this;
- }
-
-@JsonProperty("string")
-public String getString() {
-return string;
- }
-
-@JsonProperty("string")
-public void setString(String string) {
-this.string = string;
- }
-
-public Workstep withString(String string) {
-this.string = string;
-return this;
- }
-
-@JsonProperty("chars")
-public String getChars() {
-return chars;
- }
-
-@JsonProperty("chars")
-public void setChars(String chars) {
-this.chars = chars;
- }
-
-public Workstep withChars(String chars) {
-this.chars = chars;
-return this;
- }
-
-}
+package org.onap.so.client.policy.entities;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"valueType",
+"string",
+"chars"
+})
+public class Workstep {
+
+@JsonProperty("valueType")
+private String valueType;
+@JsonProperty("string")
+private String string;
+@JsonProperty("chars")
+private String chars;
+
+@JsonProperty("valueType")
+public String getValueType() {
+return valueType;
+ }
+
+@JsonProperty("valueType")
+public void setValueType(String valueType) {
+this.valueType = valueType;
+ }
+
+public Workstep withValueType(String valueType) {
+this.valueType = valueType;
+return this;
+ }
+
+@JsonProperty("string")
+public String getString() {
+return string;
+ }
+
+@JsonProperty("string")
+public void setString(String string) {
+this.string = string;
+ }
+
+public Workstep withString(String string) {
+this.string = string;
+return this;
+ }
+
+@JsonProperty("chars")
+public String getChars() {
+return chars;
+ }
+
+@JsonProperty("chars")
+public void setChars(String chars) {
+this.chars = chars;
+ }
+
+public Workstep withChars(String chars) {
+this.chars = chars;
+return this;
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/ruby/RubyClient.java b/common/src/main/java/org/onap/so/client/ruby/RubyClient.java
index a4adcb23f7..15b232475b 100644
--- a/common/src/main/java/org/openecomp/mso/client/ruby/RubyClient.java
+++ b/common/src/main/java/org/onap/so/client/ruby/RubyClient.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.
@@ -18,18 +18,18 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.ruby;
+package org.onap.so.client.ruby;
import java.io.IOException;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
-import org.openecomp.mso.client.dmaap.DmaapPublisher;
-import org.openecomp.mso.client.ruby.beans.Event;
-import org.openecomp.mso.client.ruby.beans.MsoRequest;
-import org.openecomp.mso.client.ruby.beans.Ruby;
-import org.openecomp.mso.client.ruby.dmaap.RubyCreateTicketRequestPublisher;
+import org.onap.so.client.dmaap.DmaapPublisher;
+import org.onap.so.client.ruby.beans.Event;
+import org.onap.so.client.ruby.beans.MsoRequest;
+import org.onap.so.client.ruby.beans.Ruby;
+import org.onap.so.client.ruby.dmaap.RubyCreateTicketRequestPublisher;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -87,4 +87,4 @@ public class RubyClient {
final DmaapPublisher publisher = this.getPublisher();
publisher.send(request);
}
-} \ No newline at end of file
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/ruby/beans/Event.java b/common/src/main/java/org/onap/so/client/ruby/beans/Event.java
index b9263596be..93745ff55e 100644
--- a/common/src/main/java/org/openecomp/mso/client/ruby/beans/Event.java
+++ b/common/src/main/java/org/onap/so/client/ruby/beans/Event.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.ruby.beans;
+package org.onap.so.client.ruby.beans;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -64,4 +64,4 @@ this.msoRequest = msoRequest;
return this;
}
-} \ No newline at end of file
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/ruby/beans/MsoRequest.java b/common/src/main/java/org/onap/so/client/ruby/beans/MsoRequest.java
index d00adae88a..f2c004ea6e 100644
--- a/common/src/main/java/org/openecomp/mso/client/ruby/beans/MsoRequest.java
+++ b/common/src/main/java/org/onap/so/client/ruby/beans/MsoRequest.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.ruby.beans;
+package org.onap.so.client.ruby.beans;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -204,4 +204,4 @@ this.notification = notification;
return this;
}
-} \ No newline at end of file
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/ruby/beans/Ruby.java b/common/src/main/java/org/onap/so/client/ruby/beans/Ruby.java
index 1b81043faf..725e6a3a94 100644
--- a/common/src/main/java/org/openecomp/mso/client/ruby/beans/Ruby.java
+++ b/common/src/main/java/org/onap/so/client/ruby/beans/Ruby.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.
@@ -18,8 +18,7 @@
* ============LICENSE_END=========================================================
*/
-
-package org.openecomp.mso.client.ruby.beans;
+package org.onap.so.client.ruby.beans;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
diff --git a/common/src/main/java/org/openecomp/mso/client/ruby/dmaap/RubyCreateTicketRequestPublisher.java b/common/src/main/java/org/onap/so/client/ruby/dmaap/RubyCreateTicketRequestPublisher.java
index 521318f822..1d4e014300 100644
--- a/common/src/main/java/org/openecomp/mso/client/ruby/dmaap/RubyCreateTicketRequestPublisher.java
+++ b/common/src/main/java/org/onap/so/client/ruby/dmaap/RubyCreateTicketRequestPublisher.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.
@@ -18,13 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.ruby.dmaap;
+package org.onap.so.client.ruby.dmaap;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Optional;
-import org.openecomp.mso.client.dmaap.DmaapPublisher;
+import org.onap.so.client.dmaap.DmaapPublisher;
public class RubyCreateTicketRequestPublisher extends DmaapPublisher{
public RubyCreateTicketRequestPublisher() throws FileNotFoundException, IOException {
diff --git a/common/src/main/java/org/openecomp/mso/client/sdno/SDNOHealthCheckClient.java b/common/src/main/java/org/onap/so/client/sdno/SDNOHealthCheckClient.java
index 3ba75bb2b4..93a35f34b0 100644
--- a/common/src/main/java/org/openecomp/mso/client/sdno/SDNOHealthCheckClient.java
+++ b/common/src/main/java/org/onap/so/client/sdno/SDNOHealthCheckClient.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.sdno;
+package org.onap.so.client.sdno;
import java.io.FileNotFoundException;
import java.io.IOException;
@@ -27,15 +27,15 @@ import java.util.Collections;
import java.util.List;
import java.util.Optional;
-import org.openecomp.mso.client.dmaap.DmaapConsumer;
-import org.openecomp.mso.client.dmaap.DmaapPublisher;
-import org.openecomp.mso.client.sdno.beans.AAIParamList;
-import org.openecomp.mso.client.sdno.beans.Body;
-import org.openecomp.mso.client.sdno.beans.Input;
-import org.openecomp.mso.client.sdno.beans.RequestHdCustom;
-import org.openecomp.mso.client.sdno.beans.SDNO;
-import org.openecomp.mso.client.sdno.dmaap.SDNOHealthCheckDmaapConsumer;
-import org.openecomp.mso.client.sdno.dmaap.SDNOHealthCheckDmaapPublisher;
+import org.onap.so.client.dmaap.DmaapConsumer;
+import org.onap.so.client.dmaap.DmaapPublisher;
+import org.onap.so.client.sdno.beans.AAIParamList;
+import org.onap.so.client.sdno.beans.Body;
+import org.onap.so.client.sdno.beans.Input;
+import org.onap.so.client.sdno.beans.RequestHdCustom;
+import org.onap.so.client.sdno.beans.SDNO;
+import org.onap.so.client.sdno.dmaap.SDNOHealthCheckDmaapConsumer;
+import org.onap.so.client.sdno.dmaap.SDNOHealthCheckDmaapPublisher;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
diff --git a/common/src/main/java/org/openecomp/mso/client/sdno/SDNOValidator.java b/common/src/main/java/org/onap/so/client/sdno/SDNOValidator.java
index 534186b7ef..f3cab1e3e8 100644
--- a/common/src/main/java/org/openecomp/mso/client/sdno/SDNOValidator.java
+++ b/common/src/main/java/org/onap/so/client/sdno/SDNOValidator.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.
@@ -18,21 +18,38 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.sdno;
+package org.onap.so.client.sdno;
import java.io.IOException;
import java.util.UUID;
+import org.onap.aai.domain.yang.GenericVnf;
+
public interface SDNOValidator {
/**
* Issues a health diagnostic request for a given vnf to SDN-O
*
* @param vnfId
+ * @param uuid
+ * @param requestingUserId
+ * @return diagnostic result
+ * @throws IOException
+ * @throws Exception
+ */
+ public boolean healthDiagnostic(String vnfId, UUID uuid, String requestingUserId) throws IOException, Exception;
+
+
+ /**
+ * Issues a health diagnostic request for a given GenericVnf to SDN-O
+ *
+ * @param genericVnf
+ * @param uuid
* @param requestingUserId
+ * @return diagnostic result
* @throws IOException
* @throws Exception
*/
- public void healthDiagnostic(String vnfId, UUID uuid, String requestingUserId) throws IOException, Exception;
+ public boolean healthDiagnostic(GenericVnf genericVnf, UUID uuid, String requestingUserId) throws IOException, Exception;
}
diff --git a/common/src/main/java/org/openecomp/mso/client/sdno/SDNOValidatorImpl.java b/common/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java
index e6955f57fc..be79c8b927 100644
--- a/common/src/main/java/org/openecomp/mso/client/sdno/SDNOValidatorImpl.java
+++ b/common/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.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.
@@ -18,48 +18,60 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.sdno;
+package org.onap.so.client.sdno;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Optional;
import java.util.UUID;
+import javax.ws.rs.NotFoundException;
+
import org.onap.aai.domain.yang.GenericVnf;
-import org.openecomp.mso.client.aai.AAIObjectType;
-import org.openecomp.mso.client.aai.AAIResourcesClient;
-import org.openecomp.mso.client.aai.AAIVersion;
-import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
-import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory;
-import org.openecomp.mso.client.dmaap.DmaapConsumer;
-import org.openecomp.mso.client.dmaap.DmaapPublisher;
-import org.openecomp.mso.client.sdno.beans.Body;
-import org.openecomp.mso.client.sdno.beans.Input;
-import org.openecomp.mso.client.sdno.beans.RequestHealthDiagnostic;
-import org.openecomp.mso.client.sdno.beans.SDNO;
-import org.openecomp.mso.client.sdno.dmaap.SDNOHealthCheckDmaapConsumer;
-import org.openecomp.mso.client.sdno.dmaap.SDNOHealthCheckDmaapPublisher;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.AAIVersion;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.client.dmaap.DmaapConsumer;
+import org.onap.so.client.dmaap.DmaapPublisher;
+import org.onap.so.client.sdno.beans.Body;
+import org.onap.so.client.sdno.beans.Input;
+import org.onap.so.client.sdno.beans.RequestHealthDiagnostic;
+import org.onap.so.client.sdno.beans.SDNO;
+import org.onap.so.client.sdno.dmaap.SDNOHealthCheckDmaapConsumer;
+import org.onap.so.client.sdno.dmaap.SDNOHealthCheckDmaapPublisher;
import com.fasterxml.jackson.databind.ObjectMapper;
-
public class SDNOValidatorImpl implements SDNOValidator {
private final static String clientName = "MSO";
@Override
- public void healthDiagnostic(String vnfId, UUID uuid, String requestingUserId) throws IOException, Exception {
+ public boolean healthDiagnostic(String vnfId, UUID uuid, String requestingUserId) throws IOException, Exception {
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId);
- AAIResourcesClient client = new AAIResourcesClient(AAIVersion.V10, uuid);
- GenericVnf vnf = client.get(GenericVnf.class, uri);
+ AAIResourcesClient client = new AAIResourcesClient(AAIVersion.V10);
+ GenericVnf vnf = client.get(GenericVnf.class, uri).orElseThrow(() -> new NotFoundException(vnfId + " not found in A&AI"));
SDNO requestDiagnostic = buildRequestDiagnostic(vnf, uuid, requestingUserId);
ObjectMapper mapper = new ObjectMapper();
String json = mapper.writeValueAsString(requestDiagnostic);
this.submitRequest(json);
- this.pollForResponse(uuid.toString());
+ boolean status = this.pollForResponse(uuid.toString());
+ return status;
+ }
+
+ @Override
+ public boolean healthDiagnostic(GenericVnf genericVnf, UUID uuid, String requestingUserId) throws IOException, Exception {
+ SDNO requestDiagnostic = buildRequestDiagnostic(genericVnf, uuid, requestingUserId);
+ ObjectMapper mapper = new ObjectMapper();
+ String json = mapper.writeValueAsString(requestDiagnostic);
+ this.submitRequest(json);
+ boolean status = this.pollForResponse(uuid.toString());
+ return status;
}
protected SDNO buildRequestDiagnostic(GenericVnf vnf, UUID uuid, String requestingUserId) {
@@ -80,8 +92,10 @@ public class SDNOValidatorImpl implements SDNOValidator {
body.setInput(input);
RequestHealthDiagnostic request = new RequestHealthDiagnostic();
+
request.setRequestClientName(clientName);
request.setRequestNodeName(vnf.getVnfName());
+ request.setRequestNodeUuid(vnf.getVnfId());
request.setRequestNodeIp(vnf.getIpv4OamAddress()); //generic-vnf oam ip
request.setRequestUserId(requestingUserId); //mech id?
request.setRequestId(uuid.toString()); //something to identify this request by for polling
diff --git a/common/src/main/java/org/openecomp/mso/client/sdno/beans/AAIParamList.java b/common/src/main/java/org/onap/so/client/sdno/beans/AAIParamList.java
index bab37c0685..0de9b90d66 100644
--- a/common/src/main/java/org/openecomp/mso/client/sdno/beans/AAIParamList.java
+++ b/common/src/main/java/org/onap/so/client/sdno/beans/AAIParamList.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.sdno.beans;
+package org.onap.so.client.sdno.beans;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -84,4 +84,4 @@ this.value = value;
return this;
}
-} \ No newline at end of file
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/sdno/beans/Body.java b/common/src/main/java/org/onap/so/client/sdno/beans/Body.java
index 0898f3ca36..dfca9ec124 100644
--- a/common/src/main/java/org/openecomp/mso/client/sdno/beans/Body.java
+++ b/common/src/main/java/org/onap/so/client/sdno/beans/Body.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.sdno.beans;
+package org.onap.so.client.sdno.beans;
import java.io.Serializable;
import java.util.HashMap;
@@ -41,7 +41,7 @@ public class Body implements Serializable
@JsonProperty("input")
private Input input;
@JsonIgnore
- private Map<String, Object> additionalProperties = new HashMap<>();
+ private Map<String, Object> additionalProperties = new HashMap<String, Object>();
private final static long serialVersionUID = 9101706044452851559L;
@JsonProperty("input")
diff --git a/common/src/main/java/org/openecomp/mso/client/sdno/beans/Input.java b/common/src/main/java/org/onap/so/client/sdno/beans/Input.java
index 9626ff06b4..e565f71445 100644
--- a/common/src/main/java/org/openecomp/mso/client/sdno/beans/Input.java
+++ b/common/src/main/java/org/onap/so/client/sdno/beans/Input.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.sdno.beans;
+package org.onap.so.client.sdno.beans;
import java.io.Serializable;
import java.util.HashMap;
@@ -45,7 +45,7 @@ public class Input implements Serializable
private RequestHdCustom requestHdCustom;
@JsonIgnore
- private Map<String, Object> additionalProperties = new HashMap<>();
+ private Map<String, Object> additionalProperties = new HashMap<String, Object>();
private final static long serialVersionUID = 7155546785389227528L;
@JsonProperty("request-healthdiagnostic")
diff --git a/common/src/main/java/org/openecomp/mso/client/sdno/beans/RequestHdCustom.java b/common/src/main/java/org/onap/so/client/sdno/beans/RequestHdCustom.java
index a0d00a7e6e..b3a6a4815e 100644
--- a/common/src/main/java/org/openecomp/mso/client/sdno/beans/RequestHdCustom.java
+++ b/common/src/main/java/org/onap/so/client/sdno/beans/RequestHdCustom.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.
@@ -18,11 +18,12 @@
* ============LICENSE_END=========================================================
*/
+package org.onap.so.client.sdno.beans;
-package org.openecomp.mso.client.sdno.beans;
-
+import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
+
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@@ -34,10 +35,15 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
"request-id",
"health-diagnostic-code",
"operation-type",
+"send-detailed-cmd-response",
"aai-param-list"
})
-public class RequestHdCustom {
+public class RequestHdCustom implements Serializable {
+/**
+ *
+ */
+ private static final long serialVersionUID = -206110458275127710L;
@JsonProperty("request-client-name")
private String requestClientName;
@JsonProperty("request-user-id")
@@ -48,6 +54,8 @@ private String requestId;
private String healthDiagnosticCode;
@JsonProperty("operation-type")
private String operationType;
+@JsonProperty("send-detailed-cmd-response")
+private String sendDetailedCmdResponse = "false";
@JsonProperty("aai-param-list")
private List<AAIParamList> aaiParamList = new ArrayList<AAIParamList>();
@@ -152,6 +160,19 @@ this.operationType = operationType;
return this;
}
+public void setSendDetailedCmdResponse(String sendDetailedCmdResponse) {
+ this.sendDetailedCmdResponse = sendDetailedCmdResponse;
+}
+
+public String getSendDetailedCmdResponse() {
+ return sendDetailedCmdResponse;
+}
+
+public RequestHdCustom withSendDetailedCmdResponse(String sendDetailedCmdResponse) {
+ this.sendDetailedCmdResponse = sendDetailedCmdResponse;
+ return this;
+}
+
@JsonProperty("aai-param-list")
public List<AAIParamList> getAaiParamList() {
return aaiParamList;
diff --git a/common/src/main/java/org/openecomp/mso/client/sdno/beans/RequestHealthDiagnostic.java b/common/src/main/java/org/onap/so/client/sdno/beans/RequestHealthDiagnostic.java
index 5ff47fa4be..69745d6bfb 100644
--- a/common/src/main/java/org/openecomp/mso/client/sdno/beans/RequestHealthDiagnostic.java
+++ b/common/src/main/java/org/onap/so/client/sdno/beans/RequestHealthDiagnostic.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.sdno.beans;
+package org.onap.so.client.sdno.beans;
import java.io.Serializable;
import java.util.HashMap;
@@ -35,6 +35,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonPropertyOrder({
"request-client-name",
"request-node-name",
+ "request-node-uuid",
"request-node-ip",
"request-id",
"request-user-id",
@@ -48,6 +49,8 @@ public class RequestHealthDiagnostic implements Serializable
private String requestClientName;
@JsonProperty("request-node-name")
private String requestNodeName;
+ @JsonProperty("request-node-uuid")
+ private String requestNodeUuid;
@JsonProperty("request-node-ip")
private String requestNodeIp;
@JsonProperty("request-id")
@@ -59,7 +62,7 @@ public class RequestHealthDiagnostic implements Serializable
@JsonProperty("health-diagnostic-code")
private String healthDiagnosticCode;
@JsonIgnore
- private Map<String, Object> additionalProperties = new HashMap<>();
+ private Map<String, Object> additionalProperties = new HashMap<String, Object>();
private final static long serialVersionUID = 1166788526178388021L;
@JsonProperty("request-client-name")
@@ -91,6 +94,21 @@ public class RequestHealthDiagnostic implements Serializable
this.requestNodeName = requestNodeName;
return this;
}
+
+ @JsonProperty("request-node-uuid")
+ public String getRequestNodeUuid() {
+ return requestNodeUuid;
+ }
+
+ @JsonProperty("request-node-uuid")
+ public void setRequestNodeUuid(String requestNodeUuid) {
+ this.requestNodeUuid = requestNodeUuid;
+ }
+
+ public RequestHealthDiagnostic withRequestNodeUuid(String requestNodeUuid) {
+ this.requestNodeUuid = requestNodeUuid;
+ return this;
+ }
@JsonProperty("request-node-ip")
public String getRequestNodeIp() {
diff --git a/common/src/main/java/org/openecomp/mso/client/sdno/beans/ResultInfo.java b/common/src/main/java/org/onap/so/client/sdno/beans/ResultInfo.java
index 1fdc9b2484..7cf9c7cb06 100644
--- a/common/src/main/java/org/openecomp/mso/client/sdno/beans/ResultInfo.java
+++ b/common/src/main/java/org/onap/so/client/sdno/beans/ResultInfo.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.sdno.beans;
+package org.onap.so.client.sdno.beans;
import java.util.HashMap;
import java.util.Map;
@@ -51,7 +51,7 @@ private String requestId;
@JsonProperty("status")
private String status;
@JsonIgnore
-private Map<String, Object> additionalProperties = new HashMap<>();
+private Map<String, Object> additionalProperties = new HashMap<String, Object>();
@JsonProperty("client-name")
public String getClientName() {
diff --git a/common/src/main/java/org/openecomp/mso/client/sdno/beans/SDNO.java b/common/src/main/java/org/onap/so/client/sdno/beans/SDNO.java
index fa3a26a9ef..7c728a7bab 100644
--- a/common/src/main/java/org/openecomp/mso/client/sdno/beans/SDNO.java
+++ b/common/src/main/java/org/onap/so/client/sdno/beans/SDNO.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.sdno.beans;
+package org.onap.so.client.sdno.beans;
import java.io.Serializable;
import java.util.HashMap;
@@ -50,7 +50,7 @@ public class SDNO implements Serializable
@JsonProperty("body")
private Body body;
@JsonIgnore
- private Map<String, Object> additionalProperties = new HashMap<>();
+ private Map<String, Object> additionalProperties = new HashMap<String, Object>();
private final static long serialVersionUID = -5303297382564282650L;
@JsonProperty("operation")
diff --git a/common/src/main/java/org/openecomp/mso/client/sdno/dmaap/SDNOHealthCheckDmaapConsumer.java b/common/src/main/java/org/onap/so/client/sdno/dmaap/SDNOHealthCheckDmaapConsumer.java
index ca5888caca..6f415af8b0 100644
--- a/common/src/main/java/org/openecomp/mso/client/sdno/dmaap/SDNOHealthCheckDmaapConsumer.java
+++ b/common/src/main/java/org/onap/so/client/sdno/dmaap/SDNOHealthCheckDmaapConsumer.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.
@@ -18,13 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.sdno.dmaap;
+package org.onap.so.client.sdno.dmaap;
import java.io.IOException;
import java.util.Optional;
-import org.openecomp.mso.client.dmaap.DmaapConsumer;
-import org.openecomp.mso.client.exceptions.SDNOException;
-import org.openecomp.mso.jsonpath.JsonPathUtil;
+import org.onap.so.client.dmaap.DmaapConsumer;
+import org.onap.so.client.exceptions.SDNOException;
+import org.onap.so.jsonpath.JsonPathUtil;
public class SDNOHealthCheckDmaapConsumer extends DmaapConsumer {
@@ -81,7 +81,7 @@ public class SDNOHealthCheckDmaapConsumer extends DmaapConsumer {
throw new SDNOException("failed with no status message");
}
} else {
- auditLogger.info("successful health diagnostic found for request: " + this.getRequestId());
+ logger.info("successful health diagnostic found for request: {}" ,getRequestId());
stopProcessingMessages();
}
}
diff --git a/common/src/main/java/org/openecomp/mso/client/sdno/dmaap/SDNOHealthCheckDmaapPublisher.java b/common/src/main/java/org/onap/so/client/sdno/dmaap/SDNOHealthCheckDmaapPublisher.java
index ef19bb7921..2556e67e3c 100644
--- a/common/src/main/java/org/openecomp/mso/client/sdno/dmaap/SDNOHealthCheckDmaapPublisher.java
+++ b/common/src/main/java/org/onap/so/client/sdno/dmaap/SDNOHealthCheckDmaapPublisher.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.
@@ -18,13 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.client.sdno.dmaap;
+package org.onap.so.client.sdno.dmaap;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Optional;
-import org.openecomp.mso.client.dmaap.DmaapPublisher;
+import org.onap.so.client.dmaap.DmaapPublisher;
public class SDNOHealthCheckDmaapPublisher extends DmaapPublisher {
diff --git a/common/src/main/java/org/openecomp/mso/entity/MsoRequest.java b/common/src/main/java/org/onap/so/entity/MsoRequest.java
index 39ba8dc175..c61684bec7 100644
--- a/common/src/main/java/org/openecomp/mso/entity/MsoRequest.java
+++ b/common/src/main/java/org/onap/so/entity/MsoRequest.java
@@ -18,9 +18,10 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.entity;
+package org.onap.so.entity;
+import java.io.Serializable;
/**
* This simple bean holds tracking information for MSO requests within
@@ -29,8 +30,9 @@ package org.openecomp.mso.entity;
*
*
*/
-public class MsoRequest
+public class MsoRequest implements Serializable
{
+ private static final long serialVersionUID = 1797142528913733469L;
private String requestId;
private String serviceInstanceId;
@@ -38,11 +40,12 @@ public class MsoRequest
this.requestId = null;
this.serviceInstanceId = null;
}
+
public MsoRequest(String r, String s) {
this.requestId = r;
this.serviceInstanceId = s;
}
-
+
public String getRequestId() {
return requestId;
}
diff --git a/common/src/main/java/org/openecomp/mso/entity/package-info.java b/common/src/main/java/org/onap/so/entity/package-info.java
index bf7201c15d..c4f5a16aee 100644
--- a/common/src/main/java/org/openecomp/mso/entity/package-info.java
+++ b/common/src/main/java/org/onap/so/entity/package-info.java
@@ -22,5 +22,5 @@
* Entities used for logging.
*/
-package org.openecomp.mso.entity;
+package org.onap.so.entity;
diff --git a/common/src/main/java/org/openecomp/mso/utils/RootIgnoringObjectMapper.java b/common/src/main/java/org/onap/so/exceptions/MarshallerException.java
index 6f3c5b7d99..8b06a8519f 100644
--- a/common/src/main/java/org/openecomp/mso/utils/RootIgnoringObjectMapper.java
+++ b/common/src/main/java/org/onap/so/exceptions/MarshallerException.java
@@ -18,22 +18,32 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.utils;
+package org.onap.so.exceptions;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.module.SimpleModule;
-/**
- * An ObjectMapper for a specific class that ignores the root element
- * if it is present.
- */
-public class RootIgnoringObjectMapper<T> extends ObjectMapper {
+public class MarshallerException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+ private String message;
+ private int errorCode;
+
+ public MarshallerException(String message) {
+ super(message);
+ }
+
+ public MarshallerException(String message, int errorCode, Exception e) {
+ super (e);
+ this.message = message;
+ this.errorCode = errorCode;
+
+ }
- private static final long serialVersionUID = 6812584067195377395L;
+ @Override
+ public String getMessage() {
+ return message;
+ }
- public RootIgnoringObjectMapper(Class<T> clazz) {
- SimpleModule module = new SimpleModule();
- module.addDeserializer(clazz, new RootIgnoringJsonDeserializer<T>(clazz));
- registerModule(module);
- }
-} \ No newline at end of file
+ public int getErrorCode() {
+ return errorCode;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/exceptions/ValidationException.java b/common/src/main/java/org/onap/so/exceptions/ValidationException.java
new file mode 100644
index 0000000000..713fac70f3
--- /dev/null
+++ b/common/src/main/java/org/onap/so/exceptions/ValidationException.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.exceptions;
+
+
+public class ValidationException extends Exception {
+
+ /**
+ * This class simply extends Exception (without addition additional functionality)
+ * to provide an identifier for RequestsDB related exceptions on create, delete, query.
+ *
+ *
+ **/
+
+ private static final long serialVersionUID = 1L;
+ private static final String VALIDATION_FAIL = "No valid $ELEMENT is specified";
+ private static final String INVALID_ELEMENT = "$ELEMENT is not valid in the $VERSION version";
+ private static final String REPLACE_ELEMENT_KEY = "\\$ELEMENT";
+ private static final String REPLACE_VERSION_KEY = "\\$VERSION";
+
+ @Deprecated
+ public ValidationException (String msg) {
+ super (VALIDATION_FAIL.replaceAll (REPLACE_ELEMENT_KEY, msg));
+ }
+
+ public ValidationException(String msg, boolean overrideExistingMessage) {
+ super(overrideExistingMessage ? VALIDATION_FAIL.replaceAll(REPLACE_ELEMENT_KEY, msg) : msg);
+ }
+
+ public ValidationException (String msg, Exception cause) {
+ super (VALIDATION_FAIL.replaceAll (REPLACE_ELEMENT_KEY, msg), cause);
+ }
+ public ValidationException(String msg, String version) {
+ super(INVALID_ELEMENT.replaceAll(REPLACE_ELEMENT_KEY, msg).replaceAll(REPLACE_VERSION_KEY, version));
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/jsonpath/JsonPathUtil.java b/common/src/main/java/org/onap/so/jsonpath/JsonPathUtil.java
index 148eb74068..cb0de998ba 100644
--- a/common/src/main/java/org/openecomp/mso/jsonpath/JsonPathUtil.java
+++ b/common/src/main/java/org/onap/so/jsonpath/JsonPathUtil.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.jsonpath;
+package org.onap.so.jsonpath;
import java.util.ArrayList;
import java.util.List;
@@ -35,9 +35,10 @@ public class JsonPathUtil {
private final Configuration conf;
-
+ private final Configuration pathListConf;
private JsonPathUtil() {
conf = Configuration.defaultConfiguration().jsonProvider(new JacksonJsonNodeJsonProvider()).addOptions(Option.ALWAYS_RETURN_LIST, Option.SUPPRESS_EXCEPTIONS);
+ pathListConf = Configuration.defaultConfiguration().addOptions(Option.AS_PATH_LIST, Option.SUPPRESS_EXCEPTIONS,Option.ALWAYS_RETURN_LIST);
}
private static class Helper {
@@ -79,4 +80,8 @@ public class JsonPathUtil {
}
return result;
}
+
+ public List<String> getPathList(String json, String jsonPath) {
+ return JsonPath.using(pathListConf).parse(json).read(jsonPath);
+ }
}
diff --git a/common/src/main/java/org/onap/so/logger/LoggerStartupListener.java b/common/src/main/java/org/onap/so/logger/LoggerStartupListener.java
new file mode 100644
index 0000000000..0d20dd8bf9
--- /dev/null
+++ b/common/src/main/java/org/onap/so/logger/LoggerStartupListener.java
@@ -0,0 +1,87 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.logger;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+
+import org.springframework.stereotype.Component;
+
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.Logger;
+import ch.qos.logback.classic.LoggerContext;
+import ch.qos.logback.classic.spi.LoggerContextListener;
+import ch.qos.logback.core.Context;
+import ch.qos.logback.core.spi.ContextAwareBase;
+import ch.qos.logback.core.spi.LifeCycle;
+
+@Component
+public class LoggerStartupListener extends ContextAwareBase implements LoggerContextListener, LifeCycle {
+
+ private boolean started = false;
+
+ @Override
+ public void start() {
+ if (started)
+ return;
+ InetAddress addr= null;
+ try {
+ addr = InetAddress.getLocalHost();
+ } catch (UnknownHostException e) {
+ e.printStackTrace();
+ }
+ Context context = getContext();
+ if (addr != null) {
+ context.putProperty("server.name", addr.getHostName());
+ }
+ started = true;
+ }
+
+ @Override
+ public void stop() {
+ }
+
+ @Override
+ public boolean isStarted() {
+ return started;
+ }
+
+ @Override
+ public boolean isResetResistant() {
+ return true;
+ }
+
+ @Override
+ public void onLevelChange(Logger arg0, Level arg1) {
+ }
+
+ @Override
+ public void onReset(LoggerContext arg0) {
+ }
+
+ @Override
+ public void onStart(LoggerContext arg0) {
+ }
+
+ @Override
+ public void onStop(LoggerContext arg0) {
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/logger/MessageEnum.java b/common/src/main/java/org/onap/so/logger/MessageEnum.java
index 419bbf8ca6..fcaa52024b 100644
--- a/common/src/main/java/org/openecomp/mso/logger/MessageEnum.java
+++ b/common/src/main/java/org/onap/so/logger/MessageEnum.java
@@ -1,233 +1,223 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.logger;
-
-
-import com.att.eelf.i18n.EELFResolvableErrorEnum;
-import com.att.eelf.i18n.EELFResourceManager;
-
-public enum MessageEnum implements EELFResolvableErrorEnum{
- // Api Handler Messages
- APIH_REQUEST_NULL,
- APIH_QUERY_FOUND,
- APIH_QUERY_NOT_FOUND,
- APIH_QUERY_PARAM_WRONG,
- APIH_DB_ACCESS_EXC,
- APIH_DB_ACCESS_EXC_REASON,
- APIH_VALIDATION_ERROR,
- APIH_REQUEST_VALIDATION_ERROR,
- APIH_SERVICE_VALIDATION_ERROR,
- APIH_GENERAL_EXCEPTION_ARG,
- APIH_GENERAL_EXCEPTION,
- APIH_GENERAL_WARNING,
- APIH_AUDIT_EXEC,
- APIH_GENERAL_METRICS,
- APIH_DUPLICATE_CHECK_EXC,
- APIH_DUPLICATE_FOUND,
- APIH_BAD_ORDER,
- APIH_DB_ATTRIBUTE_NOT_FOUND,
- APIH_BPEL_COMMUNICATE_ERROR,
- APIH_BPEL_RESPONSE_ERROR,
- APIH_WARP_REQUEST,
- APIH_ERROR_FROM_BPEL_SERVER,
- APIH_DB_INSERT_EXC,
- APIH_DB_UPDATE_EXC,
- APIH_NO_PROPERTIES,
- APIH_PROPERTY_LOAD_SUC,
- APIH_LOAD_PROPERTIES_FAIL,
- APIH_SDNC_COMMUNICATE_ERROR,
- APIH_SDNC_RESPONSE_ERROR,
- APIH_CANNOT_READ_SCHEMA,
- APIH_HEALTH_CHECK_EXCEPTION,
- APIH_REQUEST_VALIDATION_ERROR_REASON,
- APIH_JAXB_MARSH_ERROR,
- APIH_JAXB_UNMARSH_ERROR,
- APIH_VNFREQUEST_VALIDATION_ERROR,
- APIH_DOM2STR_ERROR,
- APIH_READ_VNFOUTPUT_CLOB_EXCEPTION,
- APIH_DUPLICATE_CHECK_EXC_ATT,
- APIH_GENERATED_REQUEST_ID,
- APIH_GENERATED_SERVICE_INSTANCE_ID,
- APIH_REPLACE_REQUEST_ID,
- // Resource Adapter Messages
- RA_GENERAL_EXCEPTION_ARG,
- RA_GENERAL_EXCEPTION,
- RA_GENERAL_WARNING,
- RA_MISSING_PARAM,
- RA_AUDIT_EXEC,
- RA_GENERAL_METRICS,
- RA_CREATE_STACK_TIMEOUT,
- RA_DELETE_STACK_TIMEOUT,
- RA_UPDATE_STACK_TIMEOUT,
- RA_CONNECTION_EXCEPTION,
- RA_PARSING_ERROR,
- RA_PROPERTIES_NOT_FOUND,
- RA_LOAD_PROPERTIES_SUC,
- RA_NETWORK_ALREADY_EXIST,
- RA_UPDATE_NETWORK_ERR,
- RA_CREATE_STACK_ERR,
- RA_UPDATE_STACK_ERR,
- RA_CREATE_TENANT_ERR,
- RA_NETWORK_NOT_FOUND,
- RA_NETWORK_ORCHE_MODE_NOT_SUPPORT,
- RA_CREATE_NETWORK_EXC,
- RA_NS_EXC,
- RA_PARAM_NOT_FOUND,
- RA_CONFIG_EXC,
- RA_UNKOWN_PARAM,
- RA_VLAN_PARSE,
- RA_DELETE_NETWORK_EXC,
- RA_ROLLBACK_NULL,
- RA_TENANT_NOT_FOUND,
- RA_QUERY_NETWORK_EXC,
- RA_CREATE_NETWORK_NOTIF_EXC,
- RA_ASYNC_ROLLBACK,
- RA_WSDL_NOT_FOUND,
- RA_WSDL_URL_CONVENTION_EXC,
- RA_INIT_NOTIF_EXC,
- RA_SET_CALLBACK_AUTH_EXC,
- RA_FAULT_INFO_EXC,
- RA_MARSHING_ERROR,
- RA_PARSING_REQUEST_ERROR,
- RA_SEND_REQUEST_SDNC,
- RA_RESPONSE_FROM_SDNC,
- RA_EXCEPTION_COMMUNICATE_SDNC,
- RA_EVALUATE_XPATH_ERROR,
- RA_ANALYZE_ERROR_EXC,
- RA_ERROR_GET_RESPONSE_SDNC,
- RA_CALLBACK_BPEL,
- RA_INIT_CALLBACK_WSDL_ERR,
- RA_CALLBACK_BPEL_EXC,
- RA_CALLBACK_BPEL_COMPLETE,
- RA_SDNC_MISS_CONFIG_PARAM,
- RA_SDNC_INVALID_CONFIG,
- RA_PRINT_URL,
- RA_ERROR_CREATE_SDNC_REQUEST,
- RA_ERROR_CREATE_SDNC_RESPONSE,
- RA_ERROR_CONVERT_XML2STR,
- RA_RECEIVE_SDNC_NOTIF,
- RA_INIT_SDNC_ADAPTER,
- RA_SEND_REQUEST_APPC_ERR,
- RA_SEND_REQUEST_SDNC_ERR,
- RA_RECEIVE_BPEL_REQUEST,
- RA_TENANT_ALREADY_EXIST,
- RA_UPDATE_TENANT_ERR,
- RA_DELETE_TEMAMT_ERR,
- RA_ROLLBACK_TENANT_ERR,
- RA_QUERY_VNF_ERR,
- RA_VNF_ALREADY_EXIST,
- RA_VNF_UNKNOWN_PARAM,
- RA_VNF_EXTRA_PARAM,
- RA_CREATE_VNF_ERR,
- RA_VNF_NOT_EXIST,
- RA_UPDATE_VNF_ERR,
- RA_DELETE_VNF_ERR,
- RA_ASYNC_CREATE_VNF,
- RA_SEND_VNF_NOTIF_ERR,
- RA_ASYNC_CREATE_VNF_COMPLETE,
- RA_ASYNC_UPDATE_VNF,
- RA_ASYNC_UPDATE_VNF_COMPLETE,
- RA_ASYNC_QUERY_VNF,
- RA_ASYNC_QUERY_VNF_COMPLETE,
- RA_ASYNC_DELETE_VNF,
- RA_ASYNC_DELETE_VNF_COMPLETE,
- RA_ASYNC_ROLLBACK_VNF,
- RA_ASYNC_ROLLBACK_VNF_COMPLETE,
- RA_ROLLBACK_VNF_ERR,
- RA_DB_INVALID_STATUS,
- RA_CANT_UPDATE_REQUEST,
- RA_DB_REQUEST_NOT_EXIST,
- RA_CONFIG_NOT_FOUND,
- RA_CONFIG_LOAD,
- RA_RECEIVE_WORKFLOW_MESSAGE,
- // BPEL engine Messages
- BPMN_GENERAL_INFO,
- BPMN_GENERAL_EXCEPTION_ARG,
- BPMN_GENERAL_EXCEPTION,
- BPMN_GENERAL_WARNING,
- BPMN_AUDIT_EXEC,
- BPMN_GENERAL_METRICS,
- BPMN_URN_MAPPING_FAIL,
- BPMN_VARIABLE_NULL,
- BPMN_CALLBACK_EXCEPTION,
- // ASDC Messages
- ASDC_GENERAL_EXCEPTION_ARG,
- ASDC_GENERAL_EXCEPTION,
- ASDC_GENERAL_WARNING,
- ASDC_GENERAL_INFO,
- ASDC_AUDIT_EXEC,
- ASDC_GENERAL_METRICS,
- ASDC_CREATE_SERVICE,
- ASDC_ARTIFACT_ALREADY_DEPLOYED,
- ASDC_CREATE_ARTIFACT,
- ASDC_ARTIFACT_INSTALL_EXC,
- ASDC_ARTIFACT_ALREADY_DEPLOYED_DETAIL,
- ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL,
- ASDC_ARTIFACT_CHECK_EXC,
- ASDC_INIT_ASDC_CLIENT_EXC,
- ASDC_INIT_ASDC_CLIENT_SUC,
- ASDC_LOAD_ASDC_CLIENT_EXC,
- ASDC_SINGLETON_CHECKT_EXC,
- ASDC_SHUTDOWN_ASDC_CLIENT_EXC,
- ASDC_CHECK_HEAT_TEMPLATE,
- ASDC_START_INSTALL_ARTIFACT,
- ASDC_ARTIFACT_TYPE_NOT_SUPPORT,
- ASDC_ARTIFACT_ALREADY_EXIST,
- ASDC_ARTIFACT_DOWNLOAD_SUC,
- ASDC_ARTIFACT_DOWNLOAD_FAIL,
- ASDC_START_DEPLOY_ARTIFACT,
- ASDC_SEND_NOTIF_ASDC,
- ASDC_SEND_NOTIF_ASDC_EXEC,
- ASDC_RECEIVE_CALLBACK_NOTIF,
- ASDC_RECEIVE_SERVICE_NOTIF,
- ASDC_ARTIFACT_NULL,
- ASDC_SERVICE_NOT_SUPPORT,
- ASDC_ARTIFACT_DEPLOY_SUC,
- ASDC_PROPERTIES_NOT_FOUND,
- ASDC_PROPERTIES_LOAD_SUCCESS,
- // Default Messages, in case Log catalog is not defined
- GENERAL_EXCEPTION_ARG,
- GENERAL_EXCEPTION,
- GENERAL_WARNING,
- AUDIT_EXEC,
- GENERAL_METRICS,
- LOGGER_SETUP,
- LOGGER_NOT_FOUND,
- LOGGER_UPDATE_SUC,
- LOGGER_UPDATE_DEBUG,
- LOGGER_UPDATE_DEBUG_SUC,
- LOAD_PROPERTIES_SUC,
- NO_PROPERTIES,
- MADATORY_PARAM_MISSING,
- LOAD_PROPERTIES_FAIL,
- INIT_LOGGER,
- INIT_LOGGER_FAIL,
- JAXB_EXCEPTION,
- IDENTITY_SERVICE_NOT_FOUND;
-
- static {
- EELFResourceManager.loadMessageBundle("GenericMessages");
- EELFResourceManager.loadMessageBundle("ApiHandler");
- EELFResourceManager.loadMessageBundle("BPMN");
- EELFResourceManager.loadMessageBundle("ResourceAdapter");
- EELFResourceManager.loadMessageBundle("ASDC");
- }
-}
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.logger;
+
+
+
+public enum MessageEnum{
+ // Api Handler Messages
+ APIH_REQUEST_NULL,
+ APIH_QUERY_FOUND,
+ APIH_QUERY_NOT_FOUND,
+ APIH_QUERY_PARAM_WRONG,
+ APIH_DB_ACCESS_EXC,
+ APIH_DB_ACCESS_EXC_REASON,
+ APIH_VALIDATION_ERROR,
+ APIH_REQUEST_VALIDATION_ERROR,
+ APIH_SERVICE_VALIDATION_ERROR,
+ APIH_GENERAL_EXCEPTION_ARG,
+ APIH_GENERAL_EXCEPTION,
+ APIH_GENERAL_WARNING,
+ APIH_AUDIT_EXEC,
+ APIH_GENERAL_METRICS,
+ APIH_DUPLICATE_CHECK_EXC,
+ APIH_DUPLICATE_FOUND,
+ APIH_BAD_ORDER,
+ APIH_DB_ATTRIBUTE_NOT_FOUND,
+ APIH_BPEL_COMMUNICATE_ERROR,
+ APIH_BPEL_RESPONSE_ERROR,
+ APIH_WARP_REQUEST,
+ APIH_ERROR_FROM_BPEL_SERVER,
+ APIH_DB_INSERT_EXC,
+ APIH_DB_UPDATE_EXC,
+ APIH_NO_PROPERTIES,
+ APIH_PROPERTY_LOAD_SUC,
+ APIH_LOAD_PROPERTIES_FAIL,
+ APIH_SDNC_COMMUNICATE_ERROR,
+ APIH_SDNC_RESPONSE_ERROR,
+ APIH_CANNOT_READ_SCHEMA,
+ APIH_HEALTH_CHECK_EXCEPTION,
+ APIH_REQUEST_VALIDATION_ERROR_REASON,
+ APIH_JAXB_MARSH_ERROR,
+ APIH_JAXB_UNMARSH_ERROR,
+ APIH_VNFREQUEST_VALIDATION_ERROR,
+ APIH_DOM2STR_ERROR,
+ APIH_READ_VNFOUTPUT_CLOB_EXCEPTION,
+ APIH_DUPLICATE_CHECK_EXC_ATT,
+ APIH_GENERATED_REQUEST_ID,
+ APIH_GENERATED_SERVICE_INSTANCE_ID,
+ APIH_REPLACE_REQUEST_ID,
+ // Resource Adapter Messages
+ RA_GENERAL_EXCEPTION_ARG,
+ RA_GENERAL_EXCEPTION,
+ RA_GENERAL_WARNING,
+ RA_MISSING_PARAM,
+ RA_AUDIT_EXEC,
+ RA_GENERAL_METRICS,
+ RA_CREATE_STACK_TIMEOUT,
+ RA_DELETE_STACK_TIMEOUT,
+ RA_UPDATE_STACK_TIMEOUT,
+ RA_CONNECTION_EXCEPTION,
+ RA_PARSING_ERROR,
+ RA_PROPERTIES_NOT_FOUND,
+ RA_LOAD_PROPERTIES_SUC,
+ RA_NETWORK_ALREADY_EXIST,
+ RA_UPDATE_NETWORK_ERR,
+ RA_CREATE_STACK_ERR,
+ RA_UPDATE_STACK_ERR,
+ RA_CREATE_TENANT_ERR,
+ RA_NETWORK_NOT_FOUND,
+ RA_NETWORK_ORCHE_MODE_NOT_SUPPORT,
+ RA_CREATE_NETWORK_EXC,
+ RA_NS_EXC,
+ RA_PARAM_NOT_FOUND,
+ RA_CONFIG_EXC,
+ RA_UNKOWN_PARAM,
+ RA_VLAN_PARSE,
+ RA_DELETE_NETWORK_EXC,
+ RA_ROLLBACK_NULL,
+ RA_TENANT_NOT_FOUND,
+ RA_QUERY_NETWORK_EXC,
+ RA_CREATE_NETWORK_NOTIF_EXC,
+ RA_ASYNC_ROLLBACK,
+ RA_WSDL_NOT_FOUND,
+ RA_WSDL_URL_CONVENTION_EXC,
+ RA_INIT_NOTIF_EXC,
+ RA_SET_CALLBACK_AUTH_EXC,
+ RA_FAULT_INFO_EXC,
+ RA_MARSHING_ERROR,
+ RA_PARSING_REQUEST_ERROR,
+ RA_SEND_REQUEST_SDNC,
+ RA_RESPONSE_FROM_SDNC,
+ RA_EXCEPTION_COMMUNICATE_SDNC,
+ RA_EVALUATE_XPATH_ERROR,
+ RA_ANALYZE_ERROR_EXC,
+ RA_ERROR_GET_RESPONSE_SDNC,
+ RA_CALLBACK_BPEL,
+ RA_INIT_CALLBACK_WSDL_ERR,
+ RA_CALLBACK_BPEL_EXC,
+ RA_CALLBACK_BPEL_COMPLETE,
+ RA_SDNC_MISS_CONFIG_PARAM,
+ RA_SDNC_INVALID_CONFIG,
+ RA_PRINT_URL,
+ RA_ERROR_CREATE_SDNC_REQUEST,
+ RA_ERROR_CREATE_SDNC_RESPONSE,
+ RA_ERROR_CONVERT_XML2STR,
+ RA_RECEIVE_SDNC_NOTIF,
+ RA_INIT_SDNC_ADAPTER,
+ RA_SEND_REQUEST_APPC_ERR,
+ RA_SEND_REQUEST_SDNC_ERR,
+ RA_RECEIVE_BPEL_REQUEST,
+ RA_TENANT_ALREADY_EXIST,
+ RA_UPDATE_TENANT_ERR,
+ RA_DELETE_TEMAMT_ERR,
+ RA_ROLLBACK_TENANT_ERR,
+ RA_QUERY_VNF_ERR,
+ RA_VNF_ALREADY_EXIST,
+ RA_VNF_UNKNOWN_PARAM,
+ RA_VNF_EXTRA_PARAM,
+ RA_CREATE_VNF_ERR,
+ RA_VNF_NOT_EXIST,
+ RA_UPDATE_VNF_ERR,
+ RA_DELETE_VNF_ERR,
+ RA_ASYNC_CREATE_VNF,
+ RA_SEND_VNF_NOTIF_ERR,
+ RA_ASYNC_CREATE_VNF_COMPLETE,
+ RA_ASYNC_UPDATE_VNF,
+ RA_ASYNC_UPDATE_VNF_COMPLETE,
+ RA_ASYNC_QUERY_VNF,
+ RA_ASYNC_QUERY_VNF_COMPLETE,
+ RA_ASYNC_DELETE_VNF,
+ RA_ASYNC_DELETE_VNF_COMPLETE,
+ RA_ASYNC_ROLLBACK_VNF,
+ RA_ASYNC_ROLLBACK_VNF_COMPLETE,
+ RA_ROLLBACK_VNF_ERR,
+ RA_DB_INVALID_STATUS,
+ RA_CANT_UPDATE_REQUEST,
+ RA_DB_REQUEST_NOT_EXIST,
+ RA_CONFIG_NOT_FOUND,
+ RA_CONFIG_LOAD,
+ RA_RECEIVE_WORKFLOW_MESSAGE,
+ // BPEL engine Messages
+ BPMN_GENERAL_INFO,
+ BPMN_GENERAL_EXCEPTION_ARG,
+ BPMN_GENERAL_EXCEPTION,
+ BPMN_GENERAL_WARNING,
+ BPMN_AUDIT_EXEC,
+ BPMN_GENERAL_METRICS,
+ BPMN_URN_MAPPING_FAIL,
+ BPMN_VARIABLE_NULL,
+ BPMN_CALLBACK_EXCEPTION,
+ // ASDC Messages
+ ASDC_GENERAL_EXCEPTION_ARG,
+ ASDC_GENERAL_EXCEPTION,
+ ASDC_GENERAL_WARNING,
+ ASDC_GENERAL_INFO,
+ ASDC_AUDIT_EXEC,
+ ASDC_GENERAL_METRICS,
+ ASDC_CREATE_SERVICE,
+ ASDC_ARTIFACT_ALREADY_DEPLOYED,
+ ASDC_CREATE_ARTIFACT,
+ ASDC_ARTIFACT_INSTALL_EXC,
+ ASDC_ARTIFACT_ALREADY_DEPLOYED_DETAIL,
+ ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL,
+ ASDC_ARTIFACT_CHECK_EXC,
+ ASDC_INIT_ASDC_CLIENT_EXC,
+ ASDC_INIT_ASDC_CLIENT_SUC,
+ ASDC_LOAD_ASDC_CLIENT_EXC,
+ ASDC_SINGLETON_CHECKT_EXC,
+ ASDC_SHUTDOWN_ASDC_CLIENT_EXC,
+ ASDC_CHECK_HEAT_TEMPLATE,
+ ASDC_START_INSTALL_ARTIFACT,
+ ASDC_ARTIFACT_TYPE_NOT_SUPPORT,
+ ASDC_ARTIFACT_ALREADY_EXIST,
+ ASDC_ARTIFACT_DOWNLOAD_SUC,
+ ASDC_ARTIFACT_DOWNLOAD_FAIL,
+ ASDC_START_DEPLOY_ARTIFACT,
+ ASDC_SEND_NOTIF_ASDC,
+ ASDC_SEND_NOTIF_ASDC_EXEC,
+ ASDC_RECEIVE_CALLBACK_NOTIF,
+ ASDC_RECEIVE_SERVICE_NOTIF,
+ ASDC_ARTIFACT_NULL,
+ ASDC_SERVICE_NOT_SUPPORT,
+ ASDC_ARTIFACT_DEPLOY_SUC,
+ ASDC_PROPERTIES_NOT_FOUND,
+ ASDC_PROPERTIES_LOAD_SUCCESS,
+ // Default Messages, in case Log catalog is not defined
+ GENERAL_EXCEPTION_ARG,
+ GENERAL_EXCEPTION,
+ GENERAL_WARNING,
+ AUDIT_EXEC,
+ GENERAL_METRICS,
+ LOGGER_SETUP,
+ LOGGER_NOT_FOUND,
+ LOGGER_UPDATE_SUC,
+ LOGGER_UPDATE_DEBUG,
+ LOGGER_UPDATE_DEBUG_SUC,
+ LOAD_PROPERTIES_SUC,
+ NO_PROPERTIES,
+ MADATORY_PARAM_MISSING,
+ LOAD_PROPERTIES_FAIL,
+ INIT_LOGGER,
+ INIT_LOGGER_FAIL,
+ JAXB_EXCEPTION,
+ IDENTITY_SERVICE_NOT_FOUND;
+}
diff --git a/common/src/main/java/org/openecomp/mso/logger/MsoAlarmLogger.java b/common/src/main/java/org/onap/so/logger/MsoAlarmLogger.java
index b2b8d0aa33..890aac93c0 100644
--- a/common/src/main/java/org/openecomp/mso/logger/MsoAlarmLogger.java
+++ b/common/src/main/java/org/onap/so/logger/MsoAlarmLogger.java
@@ -18,10 +18,11 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.logger;
+package org.onap.so.logger;
import java.io.File;
+
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
@@ -145,6 +146,11 @@ public class MsoAlarmLogger implements ServletContextListener {
alarmLogger.setAdditive (false);
}
+ public void resetAppender() {
+ synchronized (MsoAlarmLogger.class) {
+ fileAppender = null;
+ }
+ }
private static RollingFileAppender<ILoggingEvent> getAppender (String msoAlarmFile) {
// Create a Logger for alarms. Just use a default Pattern that outputs
diff --git a/common/src/main/java/org/openecomp/mso/logger/MsoLogger.java b/common/src/main/java/org/onap/so/logger/MsoLogger.java
index 9f918805c0..10f572e772 100644
--- a/common/src/main/java/org/openecomp/mso/logger/MsoLogger.java
+++ b/common/src/main/java/org/onap/so/logger/MsoLogger.java
@@ -19,82 +19,91 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.logger;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
+package org.onap.so.logger;
+
+
import java.io.PrintWriter;
import java.io.StringWriter;
+import java.lang.invoke.MethodHandles;
import java.net.InetAddress;
import java.net.UnknownHostException;
-import java.util.UUID;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.slf4j.MDC;
-
-import org.openecomp.mso.entity.MsoRequest;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import com.att.eelf.i18n.EELFResolvableErrorEnum;
-
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
+import org.onap.so.entity.MsoRequest;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
+
+
/**
- * Simple wrapper around the EELF Logger class for MSO usage. This class
- * supports all of the normal logging functions (debug, info, etc.), prepending
+ * This class supports all of the normal logging functions (debug, info, etc.), prepending
* a string of format "[<requestId>|<serviceId]" to each message.
*
- * MSO code should initialize with these IDs when available, so that individual
+ * SO code should initialize with these IDs when available, so that individual
* requests and/or services can be tracked throughout the various MSO component
* logs (API Handler, BPEL, and Adapters).
*
*
*/
+
public class MsoLogger {
// MDC parameters
- public static final String REQUEST_ID = "RequestId";
- public static final String SERVICE_INSTANCE_ID = "ServiceInstanceId";
- public static final String SERVICE_NAME = "ServiceName";
- private static final String SERVICE_NAME_IS_METHOD_NAME = "ServiceNameIsMethodName";
- private static final String INSTANCE_UUID = "InstanceUUID";
- private static final String SERVER_IP = "ServerIPAddress";
- private static final String FQDN = "ServerFQDN";
- public static final String REMOTE_HOST = "RemoteHost";
- public static final String ALERT_SEVERITY = "AlertSeverity";
- public static final String TIMER = "Timer";
- private static final String USER = "User";
- private static final String DUMMY_VALUE = "trace-#";
- public static final String UNKNOWN = "UNKNOWN";
+ public static final String REQUEST_ID = "RequestId";
+ public static final String SERVICE_INSTANCE_ID = "ServiceInstanceId";
+ public static final String SERVICE_NAME = "ServiceName";
+ public static final String SERVICE_NAME_IS_METHOD_NAME = "ServiceNameIsMethodName";
+ public static final String INSTANCE_UUID = "InstanceUUID";
+ public static final String SERVER_IP = "ServerIPAddress";
+
+ public static final String FQDN = "ServerFQDN";
+ public static final String REMOTE_HOST = "RemoteHost";
+ public static final String ALERT_SEVERITY = "AlertSeverity";
+ public static final String TIMER = "Timer";
+ public static final String USER = "User";
+ public static final String DUMMY_VALUE = "trace-#";
+ public static final String UNKNOWN = "UNKNOWN";
+ public static final String CAT_LOG_LEVEL = "CategoryLogLevel";
+ public static final String AUDI_CAT_LOG_LEVEL = "AuditCategoryLogLevel";
+
//For getting an identity of calling application
- public static final String HEADER_FROM_APP_ID = "X-FromAppId";
- public static final String FROM_APP_ID = "FromAppId";
+ public static final String HEADER_FROM_APP_ID = "X-FromAppId";
+ public static final String FROM_APP_ID = "FromAppId";
+ public static final String HEADER_REQUEST_ID = "X-RequestId";
+ public static final String TRANSACTION_ID = "X-TransactionID";
+ public static final String ECOMP_REQUEST_ID = "X-ECOMP-RequestID";
+ public static final String CLIENT_ID = "X-ClientID";
+
// Audit/Metric log specific
- private static final String BEGINTIME = "BeginTimestamp";
- private static final String ENDTIME = "EndTimestamp";
- public static final String PARTNERNAME = "PartnerName";
- private static final String STATUSCODE = "StatusCode";
- private static final String RESPONSECODE = "ResponseCode";
- private static final String RESPONSEDESC = "ResponseDesc";
+ public static final String BEGINTIME = "BeginTimestamp";
+ public static final String STARTTIME = "StartTimeMilis";
+ public static final String ENDTIME = "EndTimestamp";
+ public static final String PARTNERNAME = "PartnerName";
+ public static final String STATUSCODE = "StatusCode";
+ public static final String RESPONSECODE = "ResponseCode";
+ public static final String RESPONSEDESC = "ResponseDesc";
+
+
// Metric log specific
- private static final String TARGETENTITY = "TargetEntity";
- private static final String TARGETSERVICENAME = "TargetServiceName";
- private static final String TARGETVIRTUALENTITY = "TargetVirtualEntity";
-
- private static final String FATAL_LEVEL = "FATAL";
- private static final String ERROR_LEVEL = "ERROR";
- private static final String WARN_LEVEL = "WARN";
- private static final String INFO_LEVEL = "INFO";
- private static final String DEBUG_LEVEL = "DEBUG";
-
- private static final String ERRORCODE = "ErrorCode";
- private static final String ERRORDESC = "ErrorDesc";
+ public static final String METRIC_BEGIN_TIME = "MetricBeginTime";
+ public static final String METRIC_START_TIME = "MetricStartTime";
+ public static final String METRIC_END_TIME = "MetricEndTime";
+ public static final String METRIC_TIMER = "MetricEndTime";
+ public static final String TARGETENTITY = "TargetEntity";
+ public static final String TARGETSERVICENAME = "TargetServiceName";
+ public static final String TARGETVIRTUALENTITY = "TargetVirtualEntity";
+
+ public static final String FATAL_LEVEL = "FATAL";
+ public static final String ERROR_LEVEL = "ERROR";
+ public static final String WARN_LEVEL = "WARN";
+ public static final String INFO_LEVEL = "INFO";
+ public static final String DEBUG_LEVEL = "DEBUG";
+
+ public static final String ERRORCODE = "ErrorCode";
+ public static final String ERRORDESC = "ErrorDesc";
+
+ public static final String COMPLETE = "COMPLETE";
public enum Catalog {
APIH, BPEL, RA, ASDC, GENERAL
@@ -103,6 +112,20 @@ public class MsoLogger {
public enum StatusCode {
COMPLETE, ERROR
}
+
+ public enum TargetEntity {
+ CAMUNDA("Camunda");
+
+ private String name;
+
+ TargetEntity(String name) {
+ this.name = name;
+ }
+
+ public String getUrl() {
+ return name;
+ }
+ }
public enum ResponseCode {
Suc(0), PermissionError(100), DataError(300), DataNotFound(301), BadRequest(302), SchemaError(
@@ -115,7 +138,7 @@ public class MsoLogger {
return this.value;
}
- ResponseCode(int value) {
+ private ResponseCode(int value) {
this.value = value;
}
}
@@ -130,30 +153,37 @@ public class MsoLogger {
return this.value;
}
- ErrorCode(int value) {
+ private ErrorCode(int value) {
this.value = value;
}
}
- private EELFLogger logger, auditLogger, metricsLogger;
- private static final String CONFIG_FILE = System.getProperty("jboss.home.dir") + "/mso-config/uuid/uuid_"
- + System.getProperty("jboss.server.name");
+ private Logger logger;
+ private Logger metricsLogger;
+ private Logger auditLogger;
private static String instanceUUID, serverIP, serverName;
private MessageEnum exceptionArg, defaultException, defaultWarning, defaultAudit, defaultMetrics;
// For internal logging of the initialization of MSO logs
- private static final Logger LOGGER = Logger.getLogger(MsoLogger.class.getName());
-
+ private static final Logger initLOGGER = LoggerFactory.getLogger(MsoLogger.class.getName());
- // Since four adaptors are using the instance of MsoLogger which will be referenced everywhere
- // hence limiting the number of MsoLogger instances to five.
- private static final MsoLogger generalMsoLogger = new MsoLogger(Catalog.GENERAL);
- private static final MsoLogger apihLogger = new MsoLogger(Catalog.APIH);
- private static final MsoLogger asdcLogger = new MsoLogger(Catalog.ASDC);
- private static final MsoLogger raLogger = new MsoLogger(Catalog.RA);
- private static final MsoLogger bpelLogger = new MsoLogger(Catalog.BPEL);
+ private MsoLogger() {
+ this(MsoLogger.Catalog.GENERAL);
+ }
+
+ private MsoLogger(MsoLogger.Catalog cat) {
+ this(cat, MethodHandles.lookup().lookupClass());
+ }
+
+ private MsoLogger(MsoLogger.Catalog cat, Class<?> clazz) {
+ this.logger = LoggerFactory.getLogger(clazz);
+ this.auditLogger = LoggerFactory.getLogger("AUDIT");
+ this.metricsLogger = LoggerFactory.getLogger("METRIC");
+ MsoLogger.initialization();
+ setDefaultLogCatalog(cat);
+ }
- static {
+ private static synchronized void initialization() {
if (instanceUUID == null || ("").equals(instanceUUID)) {
instanceUUID = getInstanceUUID();
}
@@ -164,48 +194,20 @@ public class MsoLogger {
serverIP = server.getHostAddress();
serverName = server.getHostName();
} catch (UnknownHostException e) {
- LOGGER.log(Level.SEVERE, "Could not get local hostname", e);
+ initLOGGER.error("Could not get local hostname", e);
serverIP = "";
serverName = "";
}
}
}
- // Singleton instances of the EELFLogger of all types are referenced by MsoLogger
- private MsoLogger(Catalog cat) {
- this.logger = EELFManager.getInstance().getErrorLogger();
- this.auditLogger = EELFManager.getInstance().getAuditLogger();
- this.metricsLogger = EELFManager.getInstance().getMetricsLogger();
- this.setDefaultLogCatalog(cat);
- }
-
-
- /**
- * Get the MsoLogger based on the catalog
- * This method is fixed now to resolve the total number of objects that are getting created
- * everytime this function gets called. Its supposed to have fixed number of instance per java process.
- *
- * @param cat
- * Catalog of the logger
- * @return the MsoLogger
- */
- public static synchronized MsoLogger getMsoLogger(MsoLogger.Catalog cat) {
- switch (cat) {
- case GENERAL:
- return generalMsoLogger;
- case APIH:
- return apihLogger;
- case RA:
- return raLogger;
- case BPEL:
- return bpelLogger;
- case ASDC:
- return asdcLogger;
- default:
- return generalMsoLogger;
- }
+
+ public static MsoLogger getMsoLogger(MsoLogger.Catalog cat, Class<?> clazz) {
+ return new MsoLogger(cat,clazz);
}
+
+
/**
* Record the Metrics event with no argument
@@ -225,6 +227,13 @@ public class MsoLogger {
* @param targetVEntity
* Target VNF or VM acted opon by the component, if available
*/
+ public void recordMetricEvent() {
+ metricsLogger.info("");
+ MDC.remove(TIMER);
+ MDC.remove(TARGETENTITY);
+ MDC.remove(TARGETSERVICENAME);
+ }
+
public void recordMetricEvent(Long startTime, StatusCode statusCode, ResponseCode responseCode, String responseDesc,
String targetEntity, String targetServiceName, String targetVEntity) {
prepareMetricMsg(startTime, statusCode, responseCode.getValue(), responseDesc, targetEntity, targetServiceName,
@@ -235,6 +244,7 @@ public class MsoLogger {
MDC.remove(TARGETSERVICENAME);
}
+
/**
* Record the Audit event
*
@@ -247,8 +257,13 @@ public class MsoLogger {
* @param responseDesc
* Human redable description of the application response code
*/
+ public void recordAuditEvent(){
+ auditLogger.info("");
+ }
+
public void recordAuditEvent(Long startTime, StatusCode statusCode, ResponseCode responseCode,
String responseDesc) {
+ MDC.put(MsoLogger.PARTNERNAME, "UNKNOWN");
prepareAuditMsg(startTime, statusCode, responseCode.getValue(), responseDesc);
auditLogger.info("");
MDC.remove(TIMER);
@@ -278,7 +293,23 @@ public class MsoLogger {
prepareMsg(DEBUG_LEVEL);
logger.debug(msg, t);
}
-
+
+ public void info(String msg) {
+ prepareMsg(DEBUG_LEVEL);
+ logger.info(msg);
+ }
+
+
+ /**
+ * Log error message with the details of the exception that caused the error.
+ * @param msg
+ * @param throwable
+ */
+ public void error(String msg) {
+ prepareMsg(ERROR_LEVEL);
+ logger.error(msg);
+ }
+
/**
* Log error message with the details of the exception that caused the error.
* @param msg
@@ -296,7 +327,7 @@ public class MsoLogger {
* @param msg
* The log message to put
*/
- public void info(EELFResolvableErrorEnum msg, String targetEntity, String targetServiceName) {
+ public void info(String msg, String targetEntity, String targetServiceName) {
prepareErrorMsg(INFO_LEVEL, targetEntity, targetServiceName, null, "");
logger.info(msg);
@@ -312,10 +343,10 @@ public class MsoLogger {
* @param arg0
* The argument used in the log message
*/
- public void info(EELFResolvableErrorEnum msg, String arg0, String targetEntity, String targetServiceName) {
+ public void info(MessageEnum msg, String arg0, String targetEntity, String targetServiceName) {
prepareErrorMsg(INFO_LEVEL, targetEntity, targetServiceName, null, "");
- logger.info(msg, normalize(arg0));
+ logger.info(msg.toString(), normalize(arg0));
MDC.remove(TARGETENTITY);
MDC.remove(TARGETSERVICENAME);
}
@@ -328,7 +359,7 @@ public class MsoLogger {
* @param arg0,arg1
* The arguments used in the log message
*/
- public void info(EELFResolvableErrorEnum msg, String arg0, String arg1, String targetEntity,
+ public void info(String msg, String arg0, String arg1, String targetEntity,
String targetServiceName) {
prepareErrorMsg(INFO_LEVEL, targetEntity, targetServiceName, null, "");
@@ -345,11 +376,11 @@ public class MsoLogger {
* @param arg0,arg1,arg2
* The arguments used in the log message
*/
- public void info(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String targetEntity,
+ public void info(MessageEnum msg, String arg0, String arg1, String arg2, String targetEntity,
String targetServiceName) {
prepareErrorMsg(INFO_LEVEL, targetEntity, targetServiceName, null, "");
- logger.info(msg, normalize(arg0), normalize(arg1), normalize(arg2));
+ logger.info(msg.toString(), normalize(arg0), normalize(arg1), normalize(arg2));
MDC.remove(TARGETENTITY);
MDC.remove(TARGETSERVICENAME);
}
@@ -362,7 +393,7 @@ public class MsoLogger {
* @param arg0,arg1,arg2,arg3
* The arguments used in the log message
*/
- public void info(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String arg3,
+ public void info(String msg, String arg0, String arg1, String arg2, String arg3,
String targetEntity, String targetServiceName) {
prepareErrorMsg(INFO_LEVEL, targetEntity, targetServiceName, null, "");
@@ -379,7 +410,7 @@ public class MsoLogger {
* @param arg0,arg1,arg2,arg3,arg4
* The arguments used in the log message
*/
- public void info(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String arg3, String arg4,
+ public void info(String msg, String arg0, String arg1, String arg2, String arg3, String arg4,
String targetEntity, String targetServiceName) {
prepareErrorMsg(INFO_LEVEL, targetEntity, targetServiceName, null, "");
@@ -396,7 +427,7 @@ public class MsoLogger {
* @param arg0,arg1,arg2,arg3,arg4,arg5
* The arguments used in the log message
*/
- public void info(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String arg3, String arg4,
+ public void info(String msg, String arg0, String arg1, String arg2, String arg3, String arg4,
String arg5, String targetEntity, String targetServiceName) {
prepareErrorMsg(INFO_LEVEL, targetEntity, targetServiceName, null, "");
@@ -407,17 +438,28 @@ public class MsoLogger {
}
// Warning methods
+
+
/**
* Record the Warning event
*
* @param msg
* The log message to put
*/
- public void warn(EELFResolvableErrorEnum msg, String targetEntity, String targetServiceName, ErrorCode errorCode,
+ public void warnSimple( String targetServiceName, String errorDesc) {
+ logger.warn("Service Name: {} Error: {}" , targetServiceName, errorDesc);
+ }
+ /**
+ * Record the Warning event
+ *
+ * @param msg
+ * The log message to put
+ */
+ public void warn(MessageEnum msg, String targetEntity, String targetServiceName, ErrorCode errorCode,
String errorDesc) {
prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.warn(msg);
+ logger.warn(msg.toString());
MDC.remove(TARGETENTITY);
MDC.remove(TARGETSERVICENAME);
}
@@ -430,12 +472,10 @@ public class MsoLogger {
* @param t
* The exception info
*/
- public void warn(EELFResolvableErrorEnum msg, String targetEntity, String targetServiceName, ErrorCode errorCode,
+ public void warn(MessageEnum msg, String targetEntity, String targetServiceName, ErrorCode errorCode,
String errorDesc, Throwable t) {
prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.warn(msg);
- logger.warn("Exception raised: " + getNormalizedStackTrace(t));
- logger.debug("Exception raised", t);
+ logger.warn("Warning: "+msg, t);
MDC.remove(TARGETENTITY);
MDC.remove(TARGETSERVICENAME);
}
@@ -448,10 +488,10 @@ public class MsoLogger {
* @param arg
* The argument used in the log message
*/
- public void warn(EELFResolvableErrorEnum msg, String arg, String targetEntity, String targetServiceName,
+ public void warn(MessageEnum msg, String arg, String targetEntity, String targetServiceName,
ErrorCode errorCode, String errorDesc) {
prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.warn(msg, arg);
+ logger.warn(msg.toString(), arg);
MDC.remove(TARGETENTITY);
MDC.remove(TARGETSERVICENAME);
}
@@ -466,11 +506,10 @@ public class MsoLogger {
* @param t
* The exception info
*/
- public void warn(EELFResolvableErrorEnum msg, String arg, String targetEntity, String targetServiceName,
+ public void warn(MessageEnum msg, String arg, String targetEntity, String targetServiceName,
ErrorCode errorCode, String errorDesc, Throwable t) {
prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.warn(msg, arg);
- logger.warn("Exception raised: " + getNormalizedStackTrace(t));
+ logger.warn(msg.toString(), arg);
logger.debug("Exception raised", t);
MDC.remove(TARGETENTITY);
MDC.remove(TARGETSERVICENAME);
@@ -484,10 +523,10 @@ public class MsoLogger {
* @param arg0,arg1
* The arguments used in the log message
*/
- public void warn(EELFResolvableErrorEnum msg, String arg0, String arg1, String targetEntity,
+ public void warn(MessageEnum msg, String arg0, String arg1, String targetEntity,
String targetServiceName, ErrorCode errorCode, String errorDesc) {
prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.warn(msg, normalize(arg0), normalize(arg1));
+ logger.warn(msg.toString(), normalize(arg0), normalize(arg1));
MDC.remove(TARGETENTITY);
MDC.remove(TARGETSERVICENAME);
}
@@ -502,12 +541,11 @@ public class MsoLogger {
* @param t
* The exception info
*/
- public void warn(EELFResolvableErrorEnum msg, String arg0, String arg1, String targetEntity,
+ public void warn(String msg, String arg0, String arg1, String targetEntity,
String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) {
prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
logger.warn(msg, normalize(arg0), normalize(arg1));
- logger.warn("Exception raised: " + getNormalizedStackTrace(t));
- logger.debug("Exception raised", t);
+ logger.warn(msg, t);
MDC.remove(TARGETENTITY);
MDC.remove(TARGETSERVICENAME);
}
@@ -520,7 +558,7 @@ public class MsoLogger {
* @param arg0,arg1,arg2
* The arguments used in the log message
*/
- public void warn(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String targetEntity,
+ public void warn(String msg, String arg0, String arg1, String arg2, String targetEntity,
String targetServiceName, ErrorCode errorCode, String errorDesc) {
prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
logger.warn(msg, normalize(arg0), normalize(arg1), normalize(arg2));
@@ -538,12 +576,11 @@ public class MsoLogger {
* @param t
* The exception info
*/
- public void warn(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String targetEntity,
+ public void warn(String msg, String arg0, String arg1, String arg2, String targetEntity,
String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) {
prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
logger.warn(msg, normalize(arg0), normalize(arg1), normalize(arg2));
- logger.warn("Exception raised: " + getNormalizedStackTrace(t));
- logger.debug("Exception raised", t);
+ logger.warn(msg, t);
MDC.remove(TARGETENTITY);
MDC.remove(TARGETSERVICENAME);
}
@@ -556,7 +593,7 @@ public class MsoLogger {
* @param arg0,arg1,arg2,arg3
* The arguments used in the log message
*/
- public void warn(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String arg3,
+ public void warn(String msg, String arg0, String arg1, String arg2, String arg3,
String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc) {
prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
logger.warn(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3));
@@ -574,12 +611,11 @@ public class MsoLogger {
* @param t
* The exception info
*/
- public void warn(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String arg3,
+ public void warn(String msg, String arg0, String arg1, String arg2, String arg3,
String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) {
prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
logger.warn(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3));
- logger.warn("Exception raised: " + getNormalizedStackTrace(t));
- logger.debug("Exception raised", t);
+ logger.warn(msg, t);
MDC.remove(TARGETENTITY);
MDC.remove(TARGETSERVICENAME);
}
@@ -592,7 +628,7 @@ public class MsoLogger {
* @param arg0,arg1,arg2,arg3,arg4
* The arguments used in the log message
*/
- public void warn(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String arg3, String arg4,
+ public void warn(String msg, String arg0, String arg1, String arg2, String arg3, String arg4,
String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc) {
prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
logger.warn(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3), normalize(arg4));
@@ -610,30 +646,58 @@ public class MsoLogger {
* @param t
* The exception info
*/
- public void warn(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String arg3, String arg4,
+ public void warn(String msg, String arg0, String arg1, String arg2, String arg3, String arg4,
String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) {
prepareErrorMsg(WARN_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
logger.warn(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3), normalize(arg4));
- logger.warn("Exception raised: " + getNormalizedStackTrace(t));
- logger.debug("Exception raised", t);
+ logger.warn(msg, t);
MDC.remove(TARGETENTITY);
MDC.remove(TARGETSERVICENAME);
}
+
+
// Error methods
/**
* Record the Error event
*
- * @param msg
+ * @param generalException
* The log message to put
*/
- public void error(EELFResolvableErrorEnum msg, String targetEntity, String targetServiceName, ErrorCode errorCode,
+ public void error(MessageEnum generalException, String targetEntity, String targetServiceName, ErrorCode errorCode,
String errorDesc) {
prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.error(msg);
+ logger.error(generalException.toString() + ": " +errorDesc);
MDC.remove(TARGETENTITY);
MDC.remove(TARGETSERVICENAME);
}
+
+
+ /**
+ * Record the Error event
+ *
+ * @param msg
+ * The log message to put
+ * @param t
+ * The exception info
+ */
+ public void trace(String traceMessage) {
+ logger.trace(traceMessage);
+ }
+
+
+ /**
+ * Record the Error event
+ *
+ * @param msg
+ * The log message to put
+ * @param t
+ * The exception info
+ */
+ public void error( Throwable t) {
+ logger.error(t.getMessage(), t);
+ }
+
/**
* Record the Error event
@@ -643,16 +707,14 @@ public class MsoLogger {
* @param t
* The exception info
*/
- public void error(EELFResolvableErrorEnum msg, String targetEntity, String targetServiceName, ErrorCode errorCode,
+ public void error(MessageEnum msg, String targetEntity, String targetServiceName, ErrorCode errorCode,
String errorDesc, Throwable t) {
prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.error(msg);
- logger.error(exceptionArg, getNormalizedStackTrace(t));
- logger.debug("Exception raised", t);
+ logger.error(msg.toString(), t);
MDC.remove(TARGETENTITY);
MDC.remove(TARGETSERVICENAME);
}
-
+
/**
* Record the Error event with 1 argument
*
@@ -661,10 +723,10 @@ public class MsoLogger {
* @param arg0
* The arguments used in the log message
*/
- public void error(EELFResolvableErrorEnum msg, String arg0, String targetEntity, String targetServiceName,
+ public void error(MessageEnum msg, String arg0, String targetEntity, String targetServiceName,
ErrorCode errorCode, String errorDesc) {
prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.error(msg, normalize(arg0));
+ logger.error(msg.toString(), normalize(arg0));
MDC.remove(TARGETENTITY);
MDC.remove(TARGETSERVICENAME);
}
@@ -679,12 +741,10 @@ public class MsoLogger {
* @param t
* The exception info
*/
- public void error(EELFResolvableErrorEnum msg, String arg0, String targetEntity, String targetServiceName,
+ public void error(MessageEnum msg, String arg0, String targetEntity, String targetServiceName,
ErrorCode errorCode, String errorDesc, Throwable t) {
prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.error(msg, normalize(arg0));
- logger.error(exceptionArg, getNormalizedStackTrace(t));
- logger.debug("Exception raised", t);
+ logger.error(msg.toString(), normalize(arg0), t);
MDC.remove(TARGETENTITY);
MDC.remove(TARGETSERVICENAME);
}
@@ -697,10 +757,10 @@ public class MsoLogger {
* @param arg0,arg1
* The arguments used in the log message
*/
- public void error(EELFResolvableErrorEnum msg, String arg0, String arg1, String targetEntity,
+ public void error(MessageEnum msg, String arg0, String arg1, String targetEntity,
String targetServiceName, ErrorCode errorCode, String errorDesc) {
prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.error(msg, normalize(arg0), normalize(arg1));
+ logger.error(msg.toString(), normalize(arg0), normalize(arg1));
MDC.remove(TARGETENTITY);
MDC.remove(TARGETSERVICENAME);
}
@@ -715,11 +775,10 @@ public class MsoLogger {
* @param t
* The exception info
*/
- public void error(EELFResolvableErrorEnum msg, String arg0, String arg1, String targetEntity,
+ public void error(MessageEnum msg, String arg0, String arg1, String targetEntity,
String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) {
prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.error(msg, normalize(arg0), normalize(arg1));
- logger.error(exceptionArg, getNormalizedStackTrace(t));
+ logger.error(msg.toString(), normalize(arg0), normalize(arg1), t);
logger.debug("Exception raised", t);
MDC.remove(TARGETENTITY);
MDC.remove(TARGETSERVICENAME);
@@ -733,10 +792,10 @@ public class MsoLogger {
* @param arg0,arg1,arg2
* The arguments used in the log message
*/
- public void error(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String targetEntity,
+ public void error(MessageEnum msg, String arg0, String arg1, String arg2, String targetEntity,
String targetServiceName, ErrorCode errorCode, String errorDesc) {
prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.error(msg, normalize(arg0), normalize(arg1), normalize(arg2));
+ logger.error(msg.toString(), normalize(arg0), normalize(arg1), normalize(arg2));
MDC.remove(TARGETENTITY);
MDC.remove(TARGETSERVICENAME);
}
@@ -751,12 +810,10 @@ public class MsoLogger {
* @param t
* The exception info
*/
- public void error(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String targetEntity,
+ public void error(MessageEnum msg, String arg0, String arg1, String arg2, String targetEntity,
String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) {
prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.error(msg, normalize(arg0), normalize(arg1), normalize(arg2));
- logger.error(exceptionArg, getNormalizedStackTrace(t));
- logger.debug("Exception raised", t);
+ logger.error(msg.toString(), normalize(arg0), normalize(arg1), normalize(arg2), t);
MDC.remove(TARGETENTITY);
MDC.remove(TARGETSERVICENAME);
}
@@ -769,10 +826,10 @@ public class MsoLogger {
* @param arg0,arg1,arg2,arg3
* The arguments used in the log message
*/
- public void error(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String arg3,
+ public void error(MessageEnum msg, String arg0, String arg1, String arg2, String arg3,
String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc) {
prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.error(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3));
+ logger.error(msg.toString(), normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3));
MDC.remove(TARGETENTITY);
MDC.remove(TARGETSERVICENAME);
}
@@ -787,11 +844,11 @@ public class MsoLogger {
* @param t
* The exception info
*/
- public void error(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String arg3,
+ public void error(MessageEnum msg, String arg0, String arg1, String arg2, String arg3,
String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) {
prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.error(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3));
- logger.error(exceptionArg, getNormalizedStackTrace(t));
+ logger.error(msg.toString(), normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3), t);
+
logger.debug("Exception raised", t);
MDC.remove(TARGETENTITY);
MDC.remove(TARGETSERVICENAME);
@@ -805,10 +862,10 @@ public class MsoLogger {
* @param arg0,arg1,arg2,arg3,arg4
* The arguments used in the log message
*/
- public void error(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String arg3, String arg4,
+ public void error(MessageEnum msg, String arg0, String arg1, String arg2, String arg3, String arg4,
String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc) {
prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.error(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3), normalize(arg4));
+ logger.error(msg.toString(), normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3), normalize(arg4));
MDC.remove(TARGETENTITY);
MDC.remove(TARGETSERVICENAME);
}
@@ -823,15 +880,29 @@ public class MsoLogger {
* @param t
* The exception info
*/
- public void error(EELFResolvableErrorEnum msg, String arg0, String arg1, String arg2, String arg3, String arg4,
+ public void error(MessageEnum msg, String arg0, String arg1, String arg2, String arg3, String arg4,
String targetEntity, String targetServiceName, ErrorCode errorCode, String errorDesc, Throwable t) {
prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorDesc);
- logger.error(msg, normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3), normalize(arg4));
- logger.error(exceptionArg, getNormalizedStackTrace(t));
+ logger.error(msg.toString(), normalize(arg0), normalize(arg1), normalize(arg2), normalize(arg3), normalize(arg4), t);
logger.debug("Exception raised", t);
MDC.remove(TARGETENTITY);
MDC.remove(TARGETSERVICENAME);
}
+
+ public void error(String errorMessage, String errorSource, String targetEntity, String targetServiceName,
+ ErrorCode errorCode, String errorText) {
+ prepareErrorMsg(ERROR_LEVEL, targetEntity, targetServiceName, errorCode, errorText);
+ logger.error(errorMessage);
+ MDC.remove(TARGETENTITY);
+ MDC.remove(TARGETSERVICENAME);
+
+ }
+
+ public void logStackTrace(Exception ex){
+ StringWriter errors = new StringWriter();
+ ex.printStackTrace(new PrintWriter(errors));
+ logger.error(errors.toString());
+ }
public boolean isDebugEnabled() {
return logger.isDebugEnabled();
@@ -851,23 +922,24 @@ public class MsoLogger {
MDC.put(REQUEST_ID, DUMMY_VALUE);
}
- if (svcId == null || svcId.isEmpty()) {
- MDC.put(SERVICE_INSTANCE_ID, DUMMY_VALUE);
- }
-
if (timer != null) {
MDC.put(TIMER, timer);
- } else {
- MDC.remove(TIMER);
- }
-
- MDC.put(SERVICE_NAME, getFinalServiceName(serviceNamep));
- MDC.put(ALERT_SEVERITY, getSeverityLevel(loggingLevel));
- MDC.put(INSTANCE_UUID, instanceUUID);
- MDC.put(SERVER_IP, serverIP);
- MDC.put(FQDN, serverName);
+ }
+
+ writeIfNotNullorEmpty(SERVICE_NAME,getFinalServiceName(serviceNamep));
+ writeIfNotNullorEmpty(ALERT_SEVERITY,getSeverityLevel(loggingLevel));
+ writeIfNotNullorEmpty(INSTANCE_UUID,instanceUUID);
+ writeIfNotNullorEmpty(SERVER_IP,serverIP);
+ writeIfNotNullorEmpty(FQDN,serverName);
+
}
+ private void writeIfNotNullorEmpty(String Key, String value) {
+ if (MDC.get(Key) == null|| MDC.get(Key).isEmpty()) {
+ MDC.put(Key, value);
+ }
+ }
+
private void prepareAuditMsg(long startTime, StatusCode statusCode, int responseCode, String responseDesc) {
long endTime = System.currentTimeMillis();
prepareMsg(INFO_LEVEL, null, String.valueOf(endTime - startTime));
@@ -890,7 +962,9 @@ public class MsoLogger {
private void prepareErrorMsg(String loggingLevel, String targetEntity, String targetServiceName,
ErrorCode errorCode, String errorDesc) {
MDC.put(ALERT_SEVERITY, getSeverityLevel(loggingLevel));
- MDC.put(ERRORCODE, String.valueOf(errorCode));
+ if(errorCode != null) {
+ MDC.put(ERRORCODE, Integer.toString(errorCode.getValue()));
+ }
MDC.put(ERRORDESC, errorDesc);
MDC.put(TARGETENTITY, targetEntity);
MDC.put(TARGETSERVICENAME, targetServiceName);
@@ -968,8 +1042,7 @@ public class MsoLogger {
limit = classArr.length;
}
for (int i = 1; i < limit; i++) {
- String className = classArr[i].getClassName();
- if (!className.equals(this.getClass().getName())) {
+ if (!classArr[i].getClassName().equals(this.getClass().getName())) {
return classArr[i].getMethodName();
}
}
@@ -981,55 +1054,8 @@ public class MsoLogger {
// it is generated during mso instance initialization period
// The same mso instnace will use the same instanceUUID value, even after
// restart
- private static String getInstanceUUID() {
- // Avoid creation during build and tests
- if (System.getProperty("jboss.server.name") == null) {
- return "Test UUID as JBoss not found";
- }
- File configFile = new File(CONFIG_FILE);
- String uuid = "";
- BufferedReader in = null;
- try{
- // Verify whether instanceUUID file exist,
- // If yes, read the content; if not, generate the instanceUUID and
- // write to the file
- if (configFile.exists()) {
- // read the content of the file
- in = new BufferedReader(new FileReader(CONFIG_FILE));
- if ((uuid = in.readLine()) == null) {
- // the file is empty, regenerate the file
- uuid = UUID.randomUUID().toString();
- try(BufferedWriter bw = new BufferedWriter(new FileWriter(configFile.getAbsoluteFile()))) {
- bw.write(uuid);
- } catch (IOException e) {
- LOGGER.log(Level.SEVERE, "Error trying to write UUID file", e);
- }
- }
- in.close();
- } else {
- // file doesn't exist yet -> create the file and generate the
- // instanceUUID
- uuid = UUID.randomUUID().toString();
- configFile.getParentFile().mkdirs();
- configFile.createNewFile();
- try(BufferedWriter bw1 = new BufferedWriter(new FileWriter(configFile.getAbsoluteFile()))){
- bw1.write(uuid);
- } catch (IOException e) {
- LOGGER.log(Level.SEVERE, "Error trying to write UUID file", e);
- }
- }
- } catch (IOException e) {
- LOGGER.log(Level.SEVERE, "Error trying to read UUID file", e);
- } finally {
- try {
- if (in != null) {
- in.close();
- }
- } catch (IOException ex) {
- LOGGER.log(Level.SEVERE, "Error trying to close UUID file", ex);
- }
- }
- return uuid;
+ private static String getInstanceUUID() {
+ return System.getProperty("mso-instance-id");
}
/**
@@ -1121,13 +1147,6 @@ public class MsoLogger {
return result;
}
- private String getNormalizedStackTrace(Throwable t) {
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
- t.printStackTrace(pw);
- return sw.toString().replace('|', '!').replace("\n", " - ");
- }
-
private void setDefaultLogCatalog(MsoLogger.Catalog cat) {
if ("APIH".equals(cat.toString())) {
exceptionArg = MessageEnum.APIH_GENERAL_EXCEPTION_ARG;
@@ -1161,4 +1180,14 @@ public class MsoLogger {
defaultMetrics = MessageEnum.GENERAL_METRICS;
}
}
+
+ public void warnSimple(String message, Exception e) {
+ logger.warn(message,e);
+
+ }
+
+
+
+
+
}
diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/jersey/JaxRsClientLogging.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/jersey/JaxRsClientLogging.java
new file mode 100644
index 0000000000..2888cbf3a1
--- /dev/null
+++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/jersey/JaxRsClientLogging.java
@@ -0,0 +1,135 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.logging.jaxrs.filter.jersey;
+
+
+import org.apache.commons.io.IOUtils;
+import org.onap.so.logger.MsoLogger;
+import org.onap.so.utils.TargetEntity;
+import org.slf4j.MDC;
+import org.springframework.stereotype.Component;
+
+import javax.ws.rs.client.ClientRequestContext;
+import javax.ws.rs.client.ClientRequestFilter;
+import javax.ws.rs.client.ClientResponseContext;
+import javax.ws.rs.client.ClientResponseFilter;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Response;
+
+import java.io.*;
+
+import java.time.Instant;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
+import java.util.Locale;
+import java.util.UUID;
+
+@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
+@Component
+public class JaxRsClientLogging implements ClientRequestFilter,ClientResponseFilter {
+
+ private static MsoLogger logger = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,JaxRsClientLogging.class);
+
+ private TargetEntity targetEntity;
+
+ public void setTargetService(TargetEntity targetEntity){
+ this.targetEntity = targetEntity;
+ }
+
+ @Override
+ public void filter(ClientRequestContext clientRequest) {
+ try{
+ MultivaluedMap<String, Object> headers = clientRequest.getHeaders();
+
+
+ Instant instant = Instant.now();
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSXXX" )
+ .withLocale( Locale.US )
+ .withZone( ZoneId.systemDefault() );
+
+ String requestId = MDC.get(MsoLogger.REQUEST_ID);
+ if(requestId == null || requestId.isEmpty()){
+ requestId = UUID.randomUUID().toString();
+ logger.warnSimple(clientRequest.getUri().getPath(),"Could not Find Request ID Generating New One");
+ }
+
+ MDC.put(MsoLogger.METRIC_BEGIN_TIME, formatter.format(instant));
+ MDC.put(MsoLogger.METRIC_START_TIME, String.valueOf(System.currentTimeMillis()));
+ MDC.put(MsoLogger.REQUEST_ID,requestId);
+ MDC.put(MsoLogger.TARGETSERVICENAME, clientRequest.getUri().toString());
+ } catch (Exception e) {
+ logger.warnSimple("Error in incoming JAX-RS Inteceptor", e);
+ }
+ }
+
+
+ @Override
+ public void filter(ClientRequestContext requestContext, ClientResponseContext responseContext) {
+
+ try {
+ Instant instant = Instant.now();
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSXXX" )
+ .withLocale( Locale.US )
+ .withZone( ZoneId.systemDefault() );
+ String startTime= MDC.get(MsoLogger.METRIC_START_TIME);
+
+ long elapsedTime = System.currentTimeMillis()-Long.parseLong(startTime);
+ String statusCode;
+ if(Response.Status.Family.familyOf(responseContext.getStatus()).equals(Response.Status.Family.SUCCESSFUL)){
+ statusCode=MsoLogger.COMPLETE;
+ }else{
+ statusCode=MsoLogger.StatusCode.ERROR.toString();
+ }
+ MultivaluedMap<String, String> headers = responseContext.getHeaders();
+
+ String partnerName = headers.getFirst(MsoLogger.HEADER_FROM_APP_ID );
+ if(partnerName == null || partnerName.isEmpty())
+ partnerName="UNKNOWN";
+ MDC.put(MsoLogger.RESPONSEDESC,getStringFromInputStream(responseContext));
+ MDC.put(MsoLogger.STATUSCODE, statusCode);
+ MDC.put(MsoLogger.RESPONSECODE,String.valueOf(responseContext.getStatus()));
+ MDC.put(MsoLogger.METRIC_TIMER, String.valueOf(elapsedTime));
+ MDC.put(MsoLogger.METRIC_END_TIME,formatter.format(instant));
+ MDC.put(MsoLogger.PARTNERNAME,partnerName);
+ MDC.put(MsoLogger.TARGETENTITY, targetEntity.toString());
+ logger.recordMetricEvent();
+ } catch ( Exception e) {
+ logger.warnSimple("Error in outgoing JAX-RS Inteceptor", e);
+ }
+ }
+
+ private static String getStringFromInputStream(ClientResponseContext clientResponseContext) {
+
+ InputStream is = clientResponseContext.getEntityStream();
+ ByteArrayOutputStream boas = new ByteArrayOutputStream();
+
+ try {
+ IOUtils.copy(is,boas);
+ InputStream copiedStream = new ByteArrayInputStream(boas.toByteArray());
+ clientResponseContext.setEntityStream(copiedStream);
+ return boas.toString();
+
+ } catch (IOException e) {
+ logger.warnSimple("Failed to read response body", e);
+ }
+ return "Unable to read input stream";
+ }
+}
diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/jersey/JaxRsFilterLogging.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/jersey/JaxRsFilterLogging.java
new file mode 100644
index 0000000000..9fab4ff0df
--- /dev/null
+++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/jersey/JaxRsFilterLogging.java
@@ -0,0 +1,180 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.logging.jaxrs.filter.jersey;
+
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.time.Instant;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
+import java.util.Locale;
+import java.util.UUID;
+
+import javax.annotation.Priority;
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.ContainerRequestFilter;
+import javax.ws.rs.container.ContainerResponseContext;
+import javax.ws.rs.container.ContainerResponseFilter;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.MessageBodyWriter;
+import javax.ws.rs.ext.Provider;
+import javax.ws.rs.ext.Providers;
+
+import org.onap.so.logger.MsoLogger;
+import org.slf4j.MDC;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@Priority(1)
+@Provider
+@Component
+public class JaxRsFilterLogging implements ContainerRequestFilter,ContainerResponseFilter {
+
+ private static MsoLogger logger = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,JaxRsFilterLogging.class);
+
+ @Context
+ private HttpServletRequest httpServletRequest;
+
+ @Context
+ private Providers providers;
+
+ @Autowired
+ ObjectMapper objectMapper;
+
+ @Override
+ public void filter(ContainerRequestContext containerRequest) {
+
+ try {
+ String clientID = null;
+ //check headers for request id
+ MultivaluedMap<String, String> headers = containerRequest.getHeaders();
+ String requestId = (String) headers.getFirst(MsoLogger.HEADER_REQUEST_ID );
+ if(requestId == null || requestId.isEmpty()){
+ if(headers.containsKey(MsoLogger.TRANSACTION_ID)){
+ requestId = headers.getFirst(MsoLogger.TRANSACTION_ID);
+ }else if(headers.containsKey(MsoLogger.ECOMP_REQUEST_ID)){
+ requestId = headers.getFirst(MsoLogger.ECOMP_REQUEST_ID);
+ }else{
+ requestId = UUID.randomUUID().toString();
+ logger.warnSimple(containerRequest.getUriInfo().getPath(),"Generating RequestId for Request");
+ }
+ }
+ containerRequest.setProperty("requestId", requestId);
+ if(headers.containsKey(MsoLogger.CLIENT_ID)){
+ clientID = headers.getFirst(MsoLogger.CLIENT_ID);
+ }else{
+ clientID = "UNKNOWN";
+ headers.add(MsoLogger.CLIENT_ID, clientID);
+ }
+ String remoteIpAddress = "";
+ if (httpServletRequest != null) {
+ remoteIpAddress = httpServletRequest.getRemoteAddr();
+ }
+ Instant instant = Instant.now();
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSXXX" )
+ .withLocale( Locale.US )
+ .withZone( ZoneId.systemDefault() );
+
+ String partnerName = headers.getFirst(MsoLogger.HEADER_FROM_APP_ID );
+ if(partnerName == null || partnerName.isEmpty())
+ partnerName="UNKNOWN";
+
+ MDC.put(MsoLogger.FROM_APP_ID,partnerName);
+ MDC.put(MsoLogger.SERVICE_NAME, containerRequest.getUriInfo().getPath());
+ MDC.put(MsoLogger.BEGINTIME, formatter.format(instant));
+ MDC.put(MsoLogger.REQUEST_ID,requestId);
+ MDC.put(MsoLogger.PARTNERNAME,partnerName);
+ MDC.put(MsoLogger.REMOTE_HOST, String.valueOf(remoteIpAddress));
+ MDC.put(MsoLogger.STARTTIME, String.valueOf(System.currentTimeMillis()));
+ MDC.put(MsoLogger.CLIENT_ID, clientID);
+ } catch (Exception e) {
+ logger.warnSimple("Error in incoming JAX-RS Inteceptor", e);
+ }
+ }
+
+
+ @Override
+ public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext)
+ throws IOException {
+ try {
+ Instant instant = Instant.now();
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSXXX" )
+ .withLocale( Locale.US )
+ .withZone( ZoneId.systemDefault() );
+ String startTime= MDC.get(MsoLogger.STARTTIME);
+ long elapsedTime;
+ try {
+ elapsedTime = System.currentTimeMillis() - Long.parseLong(startTime);
+ }catch(NumberFormatException e){
+ elapsedTime = 0;
+ }
+ String statusCode;
+ if(Response.Status.Family.familyOf(responseContext.getStatus()).equals(Response.Status.Family.SUCCESSFUL)){
+ statusCode=MsoLogger.COMPLETE;
+ }else{
+ statusCode= MsoLogger.StatusCode.ERROR.toString();
+ }
+
+ MDC.put(MsoLogger.RESPONSEDESC,payloadMessage(responseContext));
+ MDC.put(MsoLogger.STATUSCODE, statusCode);
+ MDC.put(MsoLogger.RESPONSECODE,String.valueOf(responseContext.getStatus()));
+ MDC.put(MsoLogger.TIMER, String.valueOf(elapsedTime));
+ MDC.put(MsoLogger.ENDTIME,formatter.format(instant));
+ logger.recordAuditEvent();
+ } catch ( Exception e) {
+ logger.warnSimple("Error in outgoing JAX-RS Inteceptor", e);
+ }
+ }
+
+ private String payloadMessage(ContainerResponseContext responseContext) throws IOException {
+ String message = new String();
+ if (responseContext.hasEntity()) {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ Class<?> entityClass = responseContext.getEntityClass();
+ Type entityType = responseContext.getEntityType();
+ Annotation[] entityAnnotations = responseContext.getEntityAnnotations();
+ MediaType mediaType = responseContext.getMediaType();
+ @SuppressWarnings("unchecked")
+ MessageBodyWriter<Object> bodyWriter = (MessageBodyWriter<Object>) providers.getMessageBodyWriter(entityClass,
+ entityType,
+ entityAnnotations,
+ mediaType);
+ bodyWriter.writeTo(responseContext.getEntity(),
+ entityClass,
+ entityType,
+ entityAnnotations,
+ mediaType,
+ responseContext.getHeaders(),
+ baos);
+ message = message.concat(new String(baos.toByteArray()));
+ }
+ return message;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/jersey/SpringClientFilter.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/jersey/SpringClientFilter.java
new file mode 100644
index 0000000000..0477c9a429
--- /dev/null
+++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/jersey/SpringClientFilter.java
@@ -0,0 +1,67 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.logging.jaxrs.filter.jersey;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.http.HttpRequest;
+import org.springframework.http.client.ClientHttpRequestExecution;
+import org.springframework.http.client.ClientHttpRequestInterceptor;
+import org.springframework.http.client.ClientHttpResponse;
+import org.springframework.util.StreamUtils;
+
+import java.io.IOException;
+import java.nio.charset.Charset;
+
+public class SpringClientFilter implements ClientHttpRequestInterceptor {
+
+ private final Logger log = LoggerFactory.getLogger(this.getClass());
+
+ @Override
+ public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException {
+ logRequest(request, body);
+ ClientHttpResponse response = execution.execute(request, body);
+ logResponse(response);
+ return response;
+ }
+
+ private void logRequest(HttpRequest request, byte[] body) throws IOException {
+ if (log.isDebugEnabled()) {
+ log.debug("===========================request begin================================================");
+ log.debug("URI : {}", request.getURI());
+ log.debug("Method : {}", request.getMethod());
+ log.debug("Headers : {}", request.getHeaders());
+ log.debug("Request body: {}", new String(body, "UTF-8"));
+ log.debug("==========================request end================================================");
+ }
+ }
+
+ private void logResponse(ClientHttpResponse response) throws IOException {
+ if (log.isDebugEnabled()) {
+ log.debug("============================response begin==========================================");
+ log.debug("Status code : {}", response.getStatusCode());
+ log.debug("Status text : {}", response.getStatusText());
+ log.debug("Headers : {}", response.getHeaders());
+ log.debug("Response body: {}", StreamUtils.copyToString(response.getBody(), Charset.defaultCharset()));
+ log.debug("=======================response end=================================================");
+ }
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/openpojo/rules/CustomSetterMustExistRule.java b/common/src/main/java/org/onap/so/openpojo/rules/CustomSetterMustExistRule.java
index fa24662d69..2c6590afb3 100644
--- a/common/src/main/java/org/openecomp/mso/openpojo/rules/CustomSetterMustExistRule.java
+++ b/common/src/main/java/org/onap/so/openpojo/rules/CustomSetterMustExistRule.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.openpojo.rules;
+package org.onap.so.openpojo.rules;
import static org.hamcrest.CoreMatchers.anyOf;
import static org.hamcrest.CoreMatchers.anything;
@@ -33,7 +33,7 @@ import com.openpojo.validation.rule.Rule;
public class CustomSetterMustExistRule implements Rule {
- private Matcher<PojoField>[] excludeMatchers = new Matcher[]{not(anything())};
+ private Matcher[] excludeMatchers = new Matcher[]{not(anything())};
private Matcher<PojoField>[] includeMatchers = new Matcher[]{anything()};
public CustomSetterMustExistRule() {
}
@@ -45,7 +45,7 @@ public class CustomSetterMustExistRule implements Rule {
}
}
}
- public CustomSetterMustExistRule exclude(Matcher<PojoField>... excludeMatchers) {
+ public CustomSetterMustExistRule exclude(Matcher... excludeMatchers) {
this.excludeMatchers = excludeMatchers;
return this;
}
diff --git a/common/src/main/java/org/openecomp/mso/openpojo/rules/EqualsAndHashCodeTester.java b/common/src/main/java/org/onap/so/openpojo/rules/EqualsAndHashCodeTester.java
index 9540409e16..5433681b83 100644
--- a/common/src/main/java/org/openecomp/mso/openpojo/rules/EqualsAndHashCodeTester.java
+++ b/common/src/main/java/org/onap/so/openpojo/rules/EqualsAndHashCodeTester.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.openpojo.rules;
+package org.onap.so.openpojo.rules;
import static org.hamcrest.CoreMatchers.anyOf;
import static org.hamcrest.CoreMatchers.anything;
@@ -29,6 +29,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import org.hamcrest.Matcher;
@@ -118,6 +119,7 @@ public class EqualsAndHashCodeTester implements Tester {
fields.addAll(pojoClass.getPojoFieldsAnnotatedWith(BusinessKey.class));
fields.addAll(pojoClass.getPojoFieldsAnnotatedWith(Id.class));
+ fields.removeAll(pojoClass.getPojoFieldsAnnotatedWith(GeneratedValue.class));
return fields;
diff --git a/common/src/main/java/org/openecomp/mso/openpojo/rules/HasAnnotationMatcher.java b/common/src/main/java/org/onap/so/openpojo/rules/HasAnnotationMatcher.java
index fdfb9695e7..6a06834d87 100644
--- a/common/src/main/java/org/openecomp/mso/openpojo/rules/HasAnnotationMatcher.java
+++ b/common/src/main/java/org/onap/so/openpojo/rules/HasAnnotationMatcher.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.openpojo.rules;
+package org.onap.so.openpojo.rules;
import static org.hamcrest.CoreMatchers.anything;
@@ -29,18 +29,20 @@ import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeDiagnosingMatcher;
-public class HasAnnotationMatcher<T extends Annotation> extends TypeSafeDiagnosingMatcher<AnnotatedElement> {
- private final Class<T> annotationType;
+import com.openpojo.reflection.PojoField;
+
+public class HasAnnotationMatcher<T extends PojoField> extends TypeSafeDiagnosingMatcher<T> {
+ private final Class<? extends Annotation> annotationType;
private final Matcher<? super T> annotationMatcher;
- public HasAnnotationMatcher(final Class<T> annotationType, final Matcher<? super T> annotationMatcher) {
+ public HasAnnotationMatcher(final Class<? extends Annotation> annotationType, final Matcher<? super T> annotationMatcher) {
this.annotationType = annotationType;
this.annotationMatcher = annotationMatcher;
}
@Override
- protected boolean matchesSafely(final AnnotatedElement item, final Description mismatchDescription) {
- final T annotation = item.getAnnotation(this.annotationType);
+ protected boolean matchesSafely(final PojoField item, final Description mismatchDescription) {
+ final Annotation annotation = item.getAnnotation(this.annotationType);
if (annotation == null) {
mismatchDescription.appendText("does not have annotation ").appendText(this.annotationType.getName());
return false;
@@ -59,11 +61,11 @@ public class HasAnnotationMatcher<T extends Annotation> extends TypeSafeDiagnosi
// Intentionally left blank.
}
- public static Matcher<AnnotatedElement> hasAnnotation(final Class<? extends Annotation> annotationType) {
+ public static <T extends PojoField> Matcher<T> hasAnnotation(final Class<? extends Annotation> annotationType) {
return hasAnnotation(annotationType, anything(""));
}
- public static <T extends Annotation> Matcher<AnnotatedElement> hasAnnotation(final Class<T> annotationType, final Matcher<? super T> annotationMatcher) {
+ public static <T extends PojoField> Matcher<T> hasAnnotation(final Class<? extends Annotation> annotationType, final Matcher<? super T> annotationMatcher) {
return new HasAnnotationMatcher<T>(annotationType, annotationMatcher);
}
}
diff --git a/common/src/main/java/org/openecomp/mso/openpojo/rules/HasAnnotationPropertyWithValueMatcher.java b/common/src/main/java/org/onap/so/openpojo/rules/HasAnnotationPropertyWithValueMatcher.java
index d1b2fb1d11..551305c14a 100644
--- a/common/src/main/java/org/openecomp/mso/openpojo/rules/HasAnnotationPropertyWithValueMatcher.java
+++ b/common/src/main/java/org/onap/so/openpojo/rules/HasAnnotationPropertyWithValueMatcher.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.openpojo.rules;
+package org.onap.so.openpojo.rules;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
@@ -28,12 +28,12 @@ import java.lang.reflect.Method;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeDiagnosingMatcher;
-import org.openecomp.mso.logger.MsoLogger;
+import org.onap.so.logger.MsoLogger;
import com.openpojo.reflection.PojoField;
public class HasAnnotationPropertyWithValueMatcher<T extends PojoField> extends TypeSafeDiagnosingMatcher<T> {
- private MsoLogger logger=MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL);
+ private MsoLogger logger=MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL, HasAnnotationPropertyWithValueMatcher.class);
private final String attribute;
private final Matcher<?> annotationMatcher;
private final Class<? extends Annotation> annotationClass;
diff --git a/common/src/main/java/org/openecomp/mso/openpojo/rules/HasEqualsAndHashCodeRule.java b/common/src/main/java/org/onap/so/openpojo/rules/HasEqualsAndHashCodeRule.java
index 4ef560721f..0c7d6add73 100644
--- a/common/src/main/java/org/openecomp/mso/openpojo/rules/HasEqualsAndHashCodeRule.java
+++ b/common/src/main/java/org/onap/so/openpojo/rules/HasEqualsAndHashCodeRule.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.openpojo.rules;
+package org.onap.so.openpojo.rules;
import static org.hamcrest.CoreMatchers.anyOf;
import static org.hamcrest.CoreMatchers.anything;
diff --git a/common/src/main/java/org/openecomp/mso/openpojo/rules/HasToStringRule.java b/common/src/main/java/org/onap/so/openpojo/rules/HasToStringRule.java
index f866650d66..8a4333e0e2 100644
--- a/common/src/main/java/org/openecomp/mso/openpojo/rules/HasToStringRule.java
+++ b/common/src/main/java/org/onap/so/openpojo/rules/HasToStringRule.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.openpojo.rules;
+package org.onap.so.openpojo.rules;
import static org.hamcrest.CoreMatchers.anyOf;
import static org.hamcrest.CoreMatchers.anything;
diff --git a/common/src/main/java/org/openecomp/mso/openpojo/rules/ToStringTester.java b/common/src/main/java/org/onap/so/openpojo/rules/ToStringTester.java
index bd582d45dc..ff1a139768 100644
--- a/common/src/main/java/org/openecomp/mso/openpojo/rules/ToStringTester.java
+++ b/common/src/main/java/org/onap/so/openpojo/rules/ToStringTester.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.openpojo.rules;
+package org.onap.so.openpojo.rules;
import static org.hamcrest.CoreMatchers.anyOf;
import static org.hamcrest.CoreMatchers.anything;
diff --git a/common/src/main/java/org/openecomp/mso/properties/MsoDatabaseException.java b/common/src/main/java/org/onap/so/properties/MsoDatabaseException.java
index 9583e519f5..84216af6e8 100644
--- a/common/src/main/java/org/openecomp/mso/properties/MsoDatabaseException.java
+++ b/common/src/main/java/org/onap/so/properties/MsoDatabaseException.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.properties;
+package org.onap.so.properties;
/**
diff --git a/common/src/main/java/org/onap/so/security/MSOSpringFirewall.java b/common/src/main/java/org/onap/so/security/MSOSpringFirewall.java
new file mode 100644
index 0000000000..82a30f05be
--- /dev/null
+++ b/common/src/main/java/org/onap/so/security/MSOSpringFirewall.java
@@ -0,0 +1,34 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.security;
+
+import org.springframework.security.web.firewall.StrictHttpFirewall;
+
+public class MSOSpringFirewall extends StrictHttpFirewall {
+
+
+ public MSOSpringFirewall() {
+ super();
+ this.setAllowUrlEncodedSlash(true);
+ this.setAllowSemicolon(true);
+ this.setAllowUrlEncodedPercent(true);
+ }
+}
diff --git a/common/src/main/java/org/onap/so/security/UserCredentials.java b/common/src/main/java/org/onap/so/security/UserCredentials.java
new file mode 100644
index 0000000000..f411789e00
--- /dev/null
+++ b/common/src/main/java/org/onap/so/security/UserCredentials.java
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.security;
+
+public class UserCredentials {
+
+ private String username;
+ private String password;
+ private String role;
+
+ 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;
+ }
+
+ public String getRole() {
+ return role;
+ }
+
+ public void setRole(String role) {
+ this.role = role;
+ }
+
+}
diff --git a/common/src/main/java/org/onap/so/security/UserDetailsServiceImpl.java b/common/src/main/java/org/onap/so/security/UserDetailsServiceImpl.java
new file mode 100644
index 0000000000..90d484ebf4
--- /dev/null
+++ b/common/src/main/java/org/onap/so/security/UserDetailsServiceImpl.java
@@ -0,0 +1,56 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.security;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.security.core.userdetails.User;
+import org.springframework.security.core.userdetails.UserDetails;
+import org.springframework.security.core.userdetails.UserDetailsService;
+import org.springframework.security.core.userdetails.UsernameNotFoundException;
+import java.util.List;
+
+@ConfigurationProperties(prefix = "spring.security")
+public class UserDetailsServiceImpl implements UserDetailsService {
+
+ private List<UserCredentials> usercredentials;
+
+ public List<UserCredentials> getUsercredentials() {
+ return usercredentials;
+ }
+
+ public void setUsercredentials(List<UserCredentials> usercredentials) {
+ this.usercredentials = usercredentials;
+ }
+
+ @Override
+ public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
+
+ for (int i = 0; usercredentials != null && i < usercredentials.size(); i++) {
+ if (usercredentials.get(i).getUsername().equals(username)) {
+ return User.withUsername(username).password(usercredentials.get(i).getPassword())
+ .roles(usercredentials.get(i).getRole()).build();
+ }
+ }
+
+ throw new UsernameNotFoundException("User not found, username: " + username);
+ }
+
+}
diff --git a/common/src/main/java/org/onap/so/security/WebSecurityConfig.java b/common/src/main/java/org/onap/so/security/WebSecurityConfig.java
new file mode 100644
index 0000000000..11eec46f41
--- /dev/null
+++ b/common/src/main/java/org/onap/so/security/WebSecurityConfig.java
@@ -0,0 +1,76 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.security;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.annotation.PostConstruct;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
+import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
+import org.springframework.security.core.userdetails.UserDetailsService;
+import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
+
+
+@ConfigurationProperties(prefix = "spring.security")
+public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
+
+ private List<UserCredentials> credentials;
+ private List<String> roles = new ArrayList<>();
+
+ public List<String> getRoles() {
+ return roles;
+ }
+
+ @PostConstruct
+ private void addRoles() {
+ for(int i=0; i <credentials.size(); i++) {
+ roles.add(credentials.get(i).getRole());
+ }
+ }
+
+ public List<UserCredentials> getUsercredentials() {
+ return credentials;
+ }
+
+ public void setUsercredentials(List<UserCredentials> usercredentials) {
+ this.credentials = usercredentials;
+ }
+
+ @Bean
+ public UserDetailsService userDetailsService() {
+ return new UserDetailsServiceImpl();
+ }
+
+ @Bean
+ public BCryptPasswordEncoder passwordEncoder() {
+ return new BCryptPasswordEncoder();
+ }
+
+ @Override
+ protected void configure(AuthenticationManagerBuilder auth) throws Exception {
+ auth.userDetailsService(userDetailsService()).passwordEncoder(passwordEncoder());
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/CloudConfiguration.java b/common/src/main/java/org/onap/so/serviceinstancebeans/CloudConfiguration.java
index cb5a1018ad..a58949e498 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/CloudConfiguration.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/CloudConfiguration.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import java.io.Serializable;
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ExceptionType.java b/common/src/main/java/org/onap/so/serviceinstancebeans/ExceptionType.java
index 84518cf160..e5d586f165 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ExceptionType.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/ExceptionType.java
@@ -26,15 +26,17 @@
//
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import java.util.ArrayList;
import java.util.List;
+
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlType;
+
import org.apache.commons.lang3.builder.ToStringBuilder;
@@ -153,15 +155,14 @@ public class ExceptionType {
}
return this.variables;
}
-
- public void setVariables(List<String> variables) {
- this.variables = variables;
- }
+
+ public void setVariables(List<String> variables) {
+ this.variables = variables;
+ }
@Override
public String toString() {
return new ToStringBuilder(this).append("messageId", messageId).append("text", text)
.append("variables", variables).toString();
}
-
}
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/GetOrchestrationListResponse.java b/common/src/main/java/org/onap/so/serviceinstancebeans/GetOrchestrationListResponse.java
index adb1d38464..7be03e635f 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/GetOrchestrationListResponse.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/GetOrchestrationListResponse.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * ONAP - SO
+ * OPENECOMP - MSO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import java.util.List;
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/GetOrchestrationResponse.java b/common/src/main/java/org/onap/so/serviceinstancebeans/GetOrchestrationResponse.java
index 8d57d57513..788cdd973d 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/GetOrchestrationResponse.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/GetOrchestrationResponse.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/InstanceDirection.java b/common/src/main/java/org/onap/so/serviceinstancebeans/InstanceDirection.java
index b49825ee60..ad796b21f9 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/InstanceDirection.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/InstanceDirection.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
public enum InstanceDirection {
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/InstanceReferences.java b/common/src/main/java/org/onap/so/serviceinstancebeans/InstanceReferences.java
index 17f09556c3..69d21c41ac 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/InstanceReferences.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/InstanceReferences.java
@@ -1,15 +1,15 @@
/*-
* ============LICENSE_START=======================================================
- * ONAP - SO
+ * OPENECOMP - MSO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import org.apache.commons.lang3.builder.ToStringBuilder;
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/LineOfBusiness.java b/common/src/main/java/org/onap/so/serviceinstancebeans/LineOfBusiness.java
index ce46291da6..27bc0e84a4 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/LineOfBusiness.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/LineOfBusiness.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import java.io.Serializable;
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ModelInfo.java b/common/src/main/java/org/onap/so/serviceinstancebeans/ModelInfo.java
index f91dd10f38..6976fb6791 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ModelInfo.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/ModelInfo.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,7 +26,7 @@
//
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import java.io.Serializable;
@@ -46,6 +46,8 @@ public class ModelInfo implements Serializable {
protected String modelInvariantId;
@JsonProperty("modelType")
protected ModelType modelType;
+ @JsonProperty("modelId")
+ protected String modelId;
//v2
@JsonProperty("modelNameVersionId")
protected String modelNameVersionId;
@@ -60,6 +62,7 @@ public class ModelInfo implements Serializable {
protected String modelVersionId;
@JsonProperty("modelCustomizationId")
protected String modelCustomizationId;
+
//Decomposition fields
@JsonProperty("modelUuid")
protected String modelUuid;
@@ -72,6 +75,7 @@ public class ModelInfo implements Serializable {
return modelCustomizationName;
}
public void setModelCustomizationName(String modelCustomizationName) {
+ modelInstanceName = modelCustomizationName;
this.modelCustomizationName = modelCustomizationName;
}
public String getModelNameVersionId() {
@@ -102,6 +106,7 @@ public class ModelInfo implements Serializable {
return modelInvariantId;
}
public void setModelInvariantId(String modelInvariantId) {
+ this.modelInvariantUuid = modelInvariantId;
this.modelInvariantId = modelInvariantId;
}
public String getModelCustomizationUuid() {
@@ -114,19 +119,29 @@ public class ModelInfo implements Serializable {
return modelVersionId;
}
public void setModelVersionId(String modelVersionId) {
+ this.modelUuid=modelVersionId;
this.modelVersionId = modelVersionId;
}
public String getModelCustomizationId() {
return modelCustomizationId;
}
public void setModelCustomizationId(String modelCustomizationId) {
+ this.modelCustomizationUuid = modelCustomizationId;
this.modelCustomizationId = modelCustomizationId;
}
public String getModelUuid() {
return modelUuid;
}
+ public String getModelId() {
+ return modelId;
+ }
public void setModelUuid(String modelUuid) {
+ this.modelId = modelUuid;
this.modelUuid = modelUuid;
+
+ }
+ public void setModelId(String modelId) {
+ this.modelId = modelId;
}
public String getModelInvariantUuid() {
return modelInvariantUuid;
@@ -151,4 +166,4 @@ public class ModelInfo implements Serializable {
}
-}
+} \ No newline at end of file
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ModelType.java b/common/src/main/java/org/onap/so/serviceinstancebeans/ModelType.java
index 1080c57976..2ddad20346 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ModelType.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/ModelType.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
/*
* Enum for Model Type values returned by API Handler to BPMN
@@ -31,5 +31,6 @@ public enum ModelType {
network,
configuration,
connectionPoint,
- pnf
+ pnf,
+ networkCollection
}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/Networks.java b/common/src/main/java/org/onap/so/serviceinstancebeans/Networks.java
new file mode 100644
index 0000000000..386078a60b
--- /dev/null
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/Networks.java
@@ -0,0 +1,98 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.serviceinstancebeans;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonRootName;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+
+@JsonRootName(value = "networks")
+@JsonInclude(Include.NON_DEFAULT)
+public class Networks implements Serializable{
+
+ private static final long serialVersionUID = 8081495240474276501L;
+ @JsonProperty("modelInfo")
+ protected ModelInfo modelInfo;
+ @JsonProperty("cloudConfiguration")
+ protected CloudConfiguration cloudConfiguration;
+ @JsonProperty("instanceName")
+ protected String instanceName;
+ @JsonProperty("productFamilyId")
+ protected String productFamilyId;
+ @JsonProperty("instanceParams")
+ private List<Map<String, String>> instanceParams = new ArrayList<>();
+
+ public ModelInfo getModelInfo() {
+ return modelInfo;
+ }
+
+ public void setModelInfo(ModelInfo modelInfo) {
+ this.modelInfo = modelInfo;
+ }
+
+ public CloudConfiguration getCloudConfiguration() {
+ return cloudConfiguration;
+ }
+
+ public void setCloudConfiguration(CloudConfiguration cloudConfiguration) {
+ this.cloudConfiguration = cloudConfiguration;
+ }
+
+ public String getInstanceName() {
+ return instanceName;
+ }
+
+ public void setInstanceName(String instanceName) {
+ this.instanceName = instanceName;
+ }
+
+ public String getProductFamilyId() {
+ return productFamilyId;
+ }
+
+ public void setProductFamilyId(String productFamilyId) {
+ this.productFamilyId = productFamilyId;
+ }
+
+ public List<Map<String, String>> getInstanceParams() {
+ return instanceParams;
+ }
+
+ public void setInstanceParams(List<Map<String, String>> instanceParams) {
+ this.instanceParams = instanceParams;
+ }
+
+ @Override
+ public String toString() {
+ return "Networks [modelInfo=" + modelInfo +
+ ", cloudConfiguration=" + cloudConfiguration +
+ ", instanceName=" + instanceName + ", productFamilyId=" + productFamilyId +
+ ", instanceParams=" + instanceParams + "]";
+ }
+
+} \ No newline at end of file
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/OwningEntity.java b/common/src/main/java/org/onap/so/serviceinstancebeans/OwningEntity.java
index 985de7d41a..f552554ad4 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/OwningEntity.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/OwningEntity.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import java.io.Serializable;
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/Platform.java b/common/src/main/java/org/onap/so/serviceinstancebeans/Platform.java
index a7a34cc39b..961062299f 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/Platform.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/Platform.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import java.io.Serializable;
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/PolicyException.java b/common/src/main/java/org/onap/so/serviceinstancebeans/PolicyException.java
index dfa23f6490..263089e5c1 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/PolicyException.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/PolicyException.java
@@ -26,7 +26,7 @@
//
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
@@ -41,7 +41,7 @@ import javax.xml.bind.annotation.XmlType;
* <pre>
* &lt;complexType name="policyException">
* &lt;complexContent>
- * &lt;extension base="{http://org.openecomp/mso/request/types/v1}exceptionType">
+ * &lt;extension base="{http://org.onap/so/request/types/v1}exceptionType">
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/Project.java b/common/src/main/java/org/onap/so/serviceinstancebeans/Project.java
index b7e80162ff..47bd2bb802 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/Project.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/Project.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import java.io.Serializable;
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RelatedInstance.java b/common/src/main/java/org/onap/so/serviceinstancebeans/RelatedInstance.java
index 60e7d9b69a..cfdba18fe1 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RelatedInstance.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/RelatedInstance.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * ONAP - SO
+ * OPENECOMP - MSO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import java.io.Serializable;
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RelatedInstanceList.java b/common/src/main/java/org/onap/so/serviceinstancebeans/RelatedInstanceList.java
index b11acccf2a..9d10865e24 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RelatedInstanceList.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/RelatedInstanceList.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import java.io.Serializable;
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/Request.java b/common/src/main/java/org/onap/so/serviceinstancebeans/Request.java
index 0671089d99..bda3096f05 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/Request.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/Request.java
@@ -18,13 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import org.apache.commons.lang3.builder.ToStringBuilder;
-//@JsonRootName(value = "request")
+
@JsonInclude(Include.NON_DEFAULT)
public class Request {
@@ -32,7 +32,6 @@ public class Request {
protected String startTime;
protected String requestScope;
protected String requestType;
- //protected String requestDetails;
protected RequestDetails requestDetails;
protected InstanceReferences instanceReferences;
protected RequestStatus requestStatus;
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestDetails.java b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestDetails.java
index 2bae526efa..d71334288e 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestDetails.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestDetails.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.
@@ -18,10 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import java.io.Serializable;
+import java.util.ArrayList;
import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
@@ -53,7 +56,11 @@ public class RequestDetails implements Serializable {
protected Platform platform;
@JsonProperty("lineOfBusiness")
protected LineOfBusiness lineOfBusiness;
- /**
+ @JsonProperty("instanceName")
+ private List<Map<String, String>> instanceName = new ArrayList<>();
+
+
+ /**
* Gets the value of the serviceInfo property.
*
* @return
@@ -268,6 +275,21 @@ public class RequestDetails implements Serializable {
public void setLineOfBusiness(LineOfBusiness value){
this.lineOfBusiness = value;
}
+ /**
+ * Gets the value of the instanceName property.
+ */
+ public List<Map<String, String>> getInstanceName() {
+ return instanceName;
+ }
+ /**
+ * Sets the value of the instanceName property.
+ *
+ * @param value
+ *
+ */
+ public void setInstanceName(List<Map<String, String>> instanceName) {
+ this.instanceName = instanceName;
+ }
@Override
public String toString() {
return "RequestDetails [modelInfo=" + modelInfo + ", requestInfo="
@@ -275,6 +297,7 @@ public class RequestDetails implements Serializable {
+ Arrays.toString(relatedInstanceList) + ", subscriberInfo="
+ subscriberInfo + ", cloudConfiguration=" + cloudConfiguration
+ ", requestParameters=" + requestParameters + ", platform=" + platform
- + ", lineOfBusiness=" + ", project=" + project + ", owningEntity=" + owningEntity + "]";
+ + ", lineOfBusiness=" + ", project=" + project + ", owningEntity=" + owningEntity
+ + ", instanceName" + instanceName + "]";
}
}
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestError.java b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestError.java
index efd5358073..76137d0f58 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestError.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestError.java
@@ -26,7 +26,7 @@
//
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
@@ -34,6 +34,8 @@ import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import org.apache.commons.lang3.builder.ToStringBuilder;
+import com.fasterxml.jackson.annotation.JsonRootName;
+
/**
* <p>Java class for anonymous complex type.
@@ -46,8 +48,8 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;choice>
- * &lt;element name="policyException" type="{http://org.openecomp/mso/request/types/v1}policyException"/>
- * &lt;element name="serviceException" type="{http://org.openecomp/mso/request/types/v1}serviceException"/>
+ * &lt;element name="policyException" type="{http://org.onap/so/request/types/v1}policyException"/>
+ * &lt;element name="serviceException" type="{http://org.onap/so/request/types/v1}serviceException"/>
* &lt;/choice>
* &lt;/sequence>
* &lt;/restriction>
@@ -63,6 +65,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
"serviceException"
})
@XmlRootElement(name = "requestError")
+@JsonRootName(value = "requestError")
public class RequestError {
protected PolicyException policyException;
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestInfo.java b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestInfo.java
index d1e489a174..158ca7a819 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestInfo.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestInfo.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import java.io.Serializable;
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestList.java b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestList.java
index 799e2f8c60..a4c0ddfcf2 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestList.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestList.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import java.util.List;
import org.apache.commons.lang3.builder.ToStringBuilder;
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestParameters.java b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestParameters.java
index 06d53285b0..1697a4eb5f 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestParameters.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestParameters.java
@@ -1,15 +1,15 @@
/*-
* ============LICENSE_START=======================================================
- * ONAP - SO
+ * OPENECOMP - MSO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,13 +18,15 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import javax.persistence.Transient;
+
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -41,18 +43,23 @@ public class RequestParameters implements Serializable {
private List<Map<String, Object>> userParams = new ArrayList<>();
@JsonProperty("aLaCarte")
private Boolean aLaCarte;
+
+ // DONOT USE. It is intended to handle older VID requests(prior to 1802)
+ @Deprecated
+ @JsonProperty("alaCarte")
+ private Boolean alaCarte;
@JsonProperty("autoBuildVfModules")
private Boolean autoBuildVfModules;
@JsonProperty("cascadeDelete")
private Boolean cascadeDelete;
+ @JsonProperty("testApi")
+ private String testApi; // usePreload would always be true for Update
@JsonProperty("usePreload")
private Boolean usePreload; // usePreload would always be true for Update
@JsonProperty("rebuildVolumeGroups")
private Boolean rebuildVolumeGroups;
@JsonProperty("payload")
private String payload;
- @JsonProperty("controllerType")
- private String controllerType;
public String getSubscriptionServiceType() {
return subscriptionServiceType;
@@ -61,11 +68,11 @@ public class RequestParameters implements Serializable {
public void setSubscriptionServiceType(String subscriptionServiceType) {
this.subscriptionServiceType = subscriptionServiceType;
}
-
+ @JsonProperty("aLaCarte")
public Boolean getALaCarte() {
return aLaCarte;
}
-
+ @JsonProperty("aLaCarte")
public void setaLaCarte(Boolean aLaCarte) {
this.aLaCarte = aLaCarte;
}
@@ -74,6 +81,27 @@ public class RequestParameters implements Serializable {
return aLaCarte;
}
+ @Deprecated
+ @Transient
+ @JsonProperty("alaCarte")
+ public Boolean getAlaCarte() {
+ return alaCarte;
+ }
+
+ @Deprecated
+ @JsonProperty("alaCarte")
+ public void setAlaCarte(Boolean alaCarte) {
+ this.alaCarte = alaCarte;
+ }
+
+ public String getTestApi() {
+ return testApi;
+ }
+
+ public void setTestApi(String testApi) {
+ this.testApi = testApi;
+ }
+
public List<Map<String, Object>> getUserParams() {
return userParams;
}
@@ -92,11 +120,11 @@ public class RequestParameters implements Serializable {
}
return null;
}
-
+
public Boolean getAutoBuildVfModules() {
return autoBuildVfModules;
}
-
+
public void setAutoBuildVfModules(Boolean autoBuildVfModules) {
this.autoBuildVfModules = autoBuildVfModules;
}
@@ -117,13 +145,10 @@ public class RequestParameters implements Serializable {
this.usePreload = usePreload;
}
- public Boolean rebuildVolumeGroups() {
+ public Boolean getRebuildVolumeGroups() {
return rebuildVolumeGroups;
}
- public Boolean isRebuildVolumeGroups() {
- return rebuildVolumeGroups;
- }
public void setRebuildVolumeGroups(Boolean rebuildVolumeGroups) {
this.rebuildVolumeGroups = rebuildVolumeGroups;
}
@@ -134,19 +159,13 @@ public class RequestParameters implements Serializable {
this.payload = value;
}
- public String getControllerType() {
- return controllerType;
- }
-
- public void setControllerType(String controllerType) {
- this.controllerType = controllerType;
- }
-
@Override
public String toString() {
- return "RequestParameters [subscriptionServiceType=" + subscriptionServiceType + ", userParams=" + userParams
- + ", aLaCarte=" + aLaCarte + ", autoBuildVfModules=" + autoBuildVfModules + ", cascadeDelete="
- + cascadeDelete + ", usePreload=" + usePreload + ", rebuildVolumeGroups=" + rebuildVolumeGroups
- + ", payload=" + payload + ", controllerType=" + controllerType + "]";
- }
-}
+ return "RequestParameters [subscriptionServiceType="
+ + subscriptionServiceType + ", userParams=" + userParams
+ + ", aLaCarte=" + aLaCarte + ", testApi= " + testApi + ", autoBuildVfModules="
+ + autoBuildVfModules + ", usePreload="
+ + usePreload + ", rebuildVolumeGroups="
+ + rebuildVolumeGroups + ", payload=" + payload + "]";
+ }
+} \ No newline at end of file
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestReferences.java b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestReferences.java
index d4d70190ff..c30e39a028 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestReferences.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestReferences.java
@@ -18,10 +18,16 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import org.apache.commons.lang3.builder.ToStringBuilder;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonRootName;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+
+@JsonRootName(value = "requestReferences")
+@JsonInclude(Include.NON_DEFAULT)
public class RequestReferences {
String requestId;
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestStatus.java b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestStatus.java
index d6a8fc0084..527aa037ed 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/RequestStatus.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestStatus.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/entities/PolicyDecisionRequest.java b/common/src/main/java/org/onap/so/serviceinstancebeans/Resources.java
index bc20b9c143..68fd95c293 100644
--- a/common/src/main/java/org/openecomp/mso/client/policy/entities/PolicyDecisionRequest.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/Resources.java
@@ -3,13 +3,14 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,41 +19,42 @@
* ============LICENSE_END=========================================================
*/
+package org.onap.so.serviceinstancebeans;
-package org.openecomp.mso.client.policy.entities;
-
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({ "decisionAttributes", "ecompcomponentName" })
-public class PolicyDecisionRequest {
-
- @JsonProperty("decisionAttributes")
- private DecisionAttributes decisionAttributes;
- @JsonProperty("ecompcomponentName")
- private String ecompcomponentName;
-
- @JsonProperty("decisionAttributes")
- public DecisionAttributes getDecisionAttributes() {
- return decisionAttributes;
+import com.fasterxml.jackson.annotation.JsonRootName;
+
+@JsonRootName(value = "resources")
+@JsonInclude(Include.NON_DEFAULT)
+public class Resources implements Serializable{
+
+ private static final long serialVersionUID = 2194797231782624520L;
+ @JsonProperty("vnfs")
+ private List<Vnfs> vnfs = new ArrayList<>();
+ @JsonProperty("networks")
+ private List<Networks> networks = new ArrayList<>();
+
+ public List<Vnfs> getVnfs() {
+ return vnfs;
}
-
- @JsonProperty("decisionAttributes")
- public void setDecisionAttributes(DecisionAttributes decisionAttributes) {
- this.decisionAttributes = decisionAttributes;
+ public void setVnfs(List<Vnfs> vnfs) {
+ this.vnfs = vnfs;
}
-
- @JsonProperty("ecompcomponentName")
- public String getEcompcomponentName() {
- return ecompcomponentName;
+ public List<Networks> getNetworks() {
+ return networks;
}
-
- @JsonProperty("ecompcomponentName")
- public void setEcompcomponentName(String ecompcomponentName) {
- this.ecompcomponentName = ecompcomponentName;
+ public void setNetworks(List<Networks> networks) {
+ this.networks = networks;
}
-
-}
+ @Override
+ public String toString() {
+ return "Resources [vnfs=" + vnfs + ", networks=" + networks + "]";
+ }
+} \ No newline at end of file
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/Service.java b/common/src/main/java/org/onap/so/serviceinstancebeans/Service.java
new file mode 100644
index 0000000000..66848d343c
--- /dev/null
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/Service.java
@@ -0,0 +1,98 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.serviceinstancebeans;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonRootName;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+
+@JsonRootName(value = "service")
+@JsonInclude(Include.NON_DEFAULT)
+public class Service implements Serializable{
+
+ private static final long serialVersionUID = 2194797231782624520L;
+ @JsonProperty("modelInfo")
+ protected ModelInfo modelInfo;
+ @JsonProperty("cloudConfiguration")
+ protected CloudConfiguration cloudConfiguration;
+ @JsonProperty("instanceName")
+ protected String instanceName;
+ @JsonProperty("instanceParams")
+ private List<Map<String, String>> instanceParams = new ArrayList<>();
+ @JsonProperty("resources")
+ protected Resources resources;
+
+ public ModelInfo getModelInfo() {
+ return modelInfo;
+ }
+
+ public void setModelInfo(ModelInfo modelInfo) {
+ this.modelInfo = modelInfo;
+ }
+
+ public CloudConfiguration getCloudConfiguration() {
+ return cloudConfiguration;
+ }
+
+ public void setCloudConfiguration(CloudConfiguration cloudConfiguration) {
+ this.cloudConfiguration = cloudConfiguration;
+ }
+
+ public String getInstanceName() {
+ return instanceName;
+ }
+
+ public void setInstanceName(String instanceName) {
+ this.instanceName = instanceName;
+ }
+
+ public List<Map<String, String>> getInstanceParams() {
+ return instanceParams;
+ }
+
+ public void setInstanceParams(List<Map<String, String>> instanceParams) {
+ this.instanceParams = instanceParams;
+ }
+
+ public Resources getResources() {
+ return resources;
+ }
+
+ public void setResources(Resources resources) {
+ this.resources = resources;
+ }
+
+ @Override
+ public String toString() {
+ return "Service [modelInfo=" + modelInfo +
+ ", cloudConfiguration=" + cloudConfiguration
+ + ", instanceName=" + instanceName +
+ ", instanceParams=" + instanceParams +
+ ", resources=" + resources + "]";
+ }
+} \ No newline at end of file
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ServiceException.java b/common/src/main/java/org/onap/so/serviceinstancebeans/ServiceException.java
index 0fe8b5f0cf..7efb7f0bff 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ServiceException.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/ServiceException.java
@@ -26,12 +26,14 @@
//
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
+import com.fasterxml.jackson.annotation.JsonRootName;
+
/**
* <p>Java class for serviceException complex type.
@@ -41,7 +43,7 @@ import javax.xml.bind.annotation.XmlType;
* <pre>
* &lt;complexType name="serviceException">
* &lt;complexContent>
- * &lt;extension base="{http://org.openecomp/mso/request/types/v1}exceptionType">
+ * &lt;extension base="{http://org.onap/so/request/types/v1}exceptionType">
* &lt;/extension>
* &lt;/complexContent>
* &lt;/complexType>
@@ -51,6 +53,7 @@ import javax.xml.bind.annotation.XmlType;
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "serviceException")
+@JsonRootName(value = "serviceException")
public class ServiceException
extends ExceptionType
{
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ServiceInstancesRequest.java b/common/src/main/java/org/onap/so/serviceinstancebeans/ServiceInstancesRequest.java
index d06c532f88..3ccf29127f 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ServiceInstancesRequest.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/ServiceInstancesRequest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import java.io.Serializable;
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ServiceInstancesResponse.java b/common/src/main/java/org/onap/so/serviceinstancebeans/ServiceInstancesResponse.java
index 614a87d009..db3add8d47 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/ServiceInstancesResponse.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/ServiceInstancesResponse.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import org.apache.commons.lang3.builder.ToStringBuilder;
diff --git a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/SubscriberInfo.java b/common/src/main/java/org/onap/so/serviceinstancebeans/SubscriberInfo.java
index 47cb1f2d26..03780231fc 100644
--- a/common/src/main/java/org/openecomp/mso/serviceinstancebeans/SubscriberInfo.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/SubscriberInfo.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.
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.serviceinstancebeans;
+package org.onap.so.serviceinstancebeans;
import java.io.Serializable;
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/VfModules.java b/common/src/main/java/org/onap/so/serviceinstancebeans/VfModules.java
new file mode 100644
index 0000000000..74f8af80a7
--- /dev/null
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/VfModules.java
@@ -0,0 +1,99 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.serviceinstancebeans;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonRootName;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+
+@JsonRootName(value = "vfmodules")
+@JsonInclude(Include.NON_DEFAULT)
+public class VfModules implements Serializable{
+
+ private static final long serialVersionUID = 8081495240474276501L;
+ @JsonProperty("modelInfo")
+ protected ModelInfo modelInfo;
+ @JsonProperty("cloudConfiguration")
+ protected CloudConfiguration cloudConfiguration;
+ @JsonProperty("instanceName")
+ protected String instanceName;
+ @JsonProperty("volumeGroupInstanceName")
+ protected String volumeGroupInstanceName;
+ @JsonProperty("instanceParams")
+ private List<Map<String, String>> instanceParams = new ArrayList<>();
+
+
+ public ModelInfo getModelInfo() {
+ return modelInfo;
+ }
+
+ public void setModelInfo(ModelInfo modelInfo) {
+ this.modelInfo = modelInfo;
+ }
+
+ public CloudConfiguration getCloudConfiguration() {
+ return cloudConfiguration;
+ }
+
+ public void setCloudConfiguration(CloudConfiguration cloudConfiguration) {
+ this.cloudConfiguration = cloudConfiguration;
+ }
+
+ public String getInstanceName() {
+ return instanceName;
+ }
+
+ public void setInstanceName(String instanceName) {
+ this.instanceName = instanceName;
+ }
+
+ public String getVolumeGroupInstanceName() {
+ return volumeGroupInstanceName;
+ }
+
+ public void setVolumeGroupInstanceName(String volumeGroupInstanceName) {
+ this.volumeGroupInstanceName = volumeGroupInstanceName;
+ }
+
+ public List<Map<String, String>> getInstanceParams() {
+ return instanceParams;
+ }
+
+ public void setInstanceParams(List<Map<String, String>> instanceParams) {
+ this.instanceParams = instanceParams;
+ }
+
+ @Override
+ public String toString() {
+ return "VfModules [modelInfo=" + modelInfo +
+ ", cloudConfiguration=" + cloudConfiguration +
+ ", instanceName=" + instanceName + ", volumeGroupInstanceName="
+ + volumeGroupInstanceName + ", instanceParams=" + instanceParams + "]";
+ }
+
+} \ No newline at end of file
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/Vnfs.java b/common/src/main/java/org/onap/so/serviceinstancebeans/Vnfs.java
new file mode 100644
index 0000000000..b55a528935
--- /dev/null
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/Vnfs.java
@@ -0,0 +1,131 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.serviceinstancebeans;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonRootName;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+
+@JsonRootName(value = "vnfs")
+@JsonInclude(Include.NON_DEFAULT)
+public class Vnfs implements Serializable{
+
+ private static final long serialVersionUID = 8081495240474276501L;
+ @JsonProperty("modelInfo")
+ protected ModelInfo modelInfo;
+ @JsonProperty("cloudConfiguration")
+ protected CloudConfiguration cloudConfiguration;
+ @JsonProperty("instanceName")
+ protected String instanceName;
+ @JsonProperty("platform")
+ protected Platform platform;
+ @JsonProperty("lineOfBusiness")
+ protected LineOfBusiness lineOfBusiness;
+ @JsonProperty("productFamilyId")
+ protected String productFamilyId;
+ @JsonProperty("instanceParams")
+ private List<Map<String, String>> instanceParams = new ArrayList<>();
+ @JsonProperty("vfModules")
+ private List<VfModules> vfModules = new ArrayList<>();
+
+
+ public ModelInfo getModelInfo() {
+ return modelInfo;
+ }
+
+ public void setModelInfo(ModelInfo modelInfo) {
+ this.modelInfo = modelInfo;
+ }
+
+ public CloudConfiguration getCloudConfiguration() {
+ return cloudConfiguration;
+ }
+
+ public void setCloudConfiguration(CloudConfiguration cloudConfiguration) {
+ this.cloudConfiguration = cloudConfiguration;
+ }
+
+ public String getInstanceName() {
+ return instanceName;
+ }
+
+ public void setInstanceName(String instanceName) {
+ this.instanceName = instanceName;
+ }
+
+ public Platform getPlatform() {
+ return platform;
+ }
+
+ public void setPlatform(Platform platform) {
+ this.platform = platform;
+ }
+
+ public LineOfBusiness getLineOfBusiness() {
+ return lineOfBusiness;
+ }
+
+ public void setLineOfBusiness(LineOfBusiness lineOfBusiness) {
+ this.lineOfBusiness = lineOfBusiness;
+ }
+
+ public String getProductFamilyId() {
+ return productFamilyId;
+ }
+
+ public void setProductFamilyId(String productFamilyId) {
+ this.productFamilyId = productFamilyId;
+ }
+
+ public List<Map<String, String>> getInstanceParams() {
+ return instanceParams;
+ }
+
+ public void setInstanceParams(List<Map<String, String>> instanceParams) {
+ this.instanceParams = instanceParams;
+ }
+
+ public List<VfModules> getVfModules() {
+ return vfModules;
+ }
+
+ public void setVfModules(List<VfModules> vfModules) {
+ this.vfModules = vfModules;
+ }
+
+ @Override
+ public String toString() {
+ return "Vnfs [modelInfo=" + modelInfo +
+ ", cloudConfiguration=" + cloudConfiguration +
+ ", instanceName=" + instanceName + ", platform=" + platform + ", " +
+ "lineOfBusiness=" + lineOfBusiness +
+ ", productFamilyId=" + productFamilyId + ", instanceParams=" + instanceParams +
+ ", vfModules=" + vfModules + "]";
+ }
+
+} \ No newline at end of file
diff --git a/common/src/main/java/org/onap/so/test/categories/SlowTests.java b/common/src/main/java/org/onap/so/test/categories/SlowTests.java
new file mode 100644
index 0000000000..58a14041d0
--- /dev/null
+++ b/common/src/main/java/org/onap/so/test/categories/SlowTests.java
@@ -0,0 +1,25 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.test.categories;
+
+public interface SlowTests {
+/* category marker */
+}
diff --git a/common/src/main/java/org/openecomp/mso/utils/CheckResults.java b/common/src/main/java/org/onap/so/utils/CheckResults.java
index ad0344d028..4f6089d0e3 100644
--- a/common/src/main/java/org/openecomp/mso/utils/CheckResults.java
+++ b/common/src/main/java/org/onap/so/utils/CheckResults.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.utils;
+package org.onap.so.utils;
diff --git a/common/src/main/java/org/openecomp/mso/utils/CryptoUtils.java b/common/src/main/java/org/onap/so/utils/CryptoUtils.java
index 5d0ff5b79e..11d464a85c 100644
--- a/common/src/main/java/org/openecomp/mso/utils/CryptoUtils.java
+++ b/common/src/main/java/org/onap/so/utils/CryptoUtils.java
@@ -18,17 +18,19 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.utils;
+package org.onap.so.utils;
-import java.io.IOException;
import java.security.GeneralSecurityException;
import java.security.NoSuchAlgorithmException;
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
+
/**
* CryptoUtils adapted from RTTP client.
@@ -36,8 +38,10 @@ import javax.crypto.spec.SecretKeySpec;
*/
public final class CryptoUtils {
- public static final String AES = "AES";
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, CryptoUtils.class);
+ public static final String AES = "AES";
+ private static final String CLOUD_KEY = "aa3871669d893c7fb8abbcda31b88b4f";
/**
* encrypt a value and generate a keyfile
* if the keyfile is not found then a new one is created
@@ -65,6 +69,36 @@ public final class CryptoUtils {
return new String (decrypted);
}
+ /**
+ * decrypt a value or return defaultValue
+ *
+ */
+ public static String decryptProperty (String prop, String defaultValue, String encryptionKey) {
+ try {
+ return CryptoUtils.decrypt(prop, encryptionKey);
+ }
+ catch (GeneralSecurityException e) {
+ LOGGER.debug("Security exception", e);
+ }
+ return defaultValue;
+ }
+
+ public static String encryptCloudConfigPassword(String message) {
+ try {
+ return CryptoUtils.encrypt(message, CryptoUtils.CLOUD_KEY);
+ } catch (GeneralSecurityException e) {
+ LOGGER.error (MessageEnum.RA_GENERAL_EXCEPTION, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in encryptPassword", e);
+ return null;
+ }
+ }
+ public static String decryptCloudConfigPassword(String message) {
+ try {
+ return CryptoUtils.decrypt(message, CryptoUtils.CLOUD_KEY);
+ } catch (GeneralSecurityException e) {
+ LOGGER.error (MessageEnum.RA_GENERAL_EXCEPTION, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in encryptPassword", e);
+ return null;
+ }
+ }
private static SecretKeySpec getSecretKeySpec (String keyString) throws NoSuchAlgorithmException {
byte[] key = hexStringToByteArray (keyString);
SecretKeySpec sks = new SecretKeySpec (key, CryptoUtils.AES);
diff --git a/common/src/main/java/org/openecomp/mso/properties/MsoPropertiesParameters.java b/common/src/main/java/org/onap/so/utils/TargetEntity.java
index b89a5d4791..ad76e56a56 100644
--- a/common/src/main/java/org/openecomp/mso/properties/MsoPropertiesParameters.java
+++ b/common/src/main/java/org/onap/so/utils/TargetEntity.java
@@ -18,16 +18,15 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.properties;
+package org.onap.so.utils;
-public class MsoPropertiesParameters {
-
- protected enum MsoPropertiesType {JSON_PROP,JAVA_PROP}
+public enum TargetEntity {
+ OPENSTACK_ADAPTER, BPMN, GRM ,AAI, DMAAP, POLICY, CATALOG_DB, REQUEST_DB, VNF_ADAPTER, SDNC_ADAPTER, NARAD;
- protected MsoPropertiesType msoPropertiesType;
-
- protected int refreshCounter;
-
- protected AbstractMsoProperties msoProperties;
+ private static final String PREFIX = "MSO";
+ @Override
+ public String toString(){
+ return TargetEntity.PREFIX + "." + this.name();
+ }
}
diff --git a/common/src/main/java/org/openecomp/mso/utils/UUIDChecker.java b/common/src/main/java/org/onap/so/utils/UUIDChecker.java
index b715717924..fac73e84f9 100644
--- a/common/src/main/java/org/openecomp/mso/utils/UUIDChecker.java
+++ b/common/src/main/java/org/onap/so/utils/UUIDChecker.java
@@ -19,18 +19,18 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.utils;
-
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
+package org.onap.so.utils;
import java.util.UUID;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
+
/**
*/
public class UUIDChecker {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL);
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL, UUIDChecker.class);
private UUIDChecker() {
@@ -49,7 +49,7 @@ public class UUIDChecker {
}
}
- private static String getUUID () {
+ public static String getUUID () {
return UUID.randomUUID().toString();
}
diff --git a/common/src/main/java/org/onap/so/utils/XmlMarshaller.java b/common/src/main/java/org/onap/so/utils/XmlMarshaller.java
new file mode 100644
index 0000000000..903d055548
--- /dev/null
+++ b/common/src/main/java/org/onap/so/utils/XmlMarshaller.java
@@ -0,0 +1,84 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.utils;
+
+
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import javax.xml.XMLConstants;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.sax.SAXSource;
+
+import org.onap.so.exceptions.MarshallerException;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLReader;
+
+public class XmlMarshaller {
+
+ private static MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL, XmlMarshaller.class);
+
+ public static String marshal(Object object) throws MarshallerException {
+
+ StringWriter stringWriter = new StringWriter();
+ try {
+ JAXBContext jaxbContext = JAXBContext.newInstance(object.getClass());
+ Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
+ jaxbMarshaller.marshal(object, stringWriter);
+ } catch (JAXBException e) {
+ logger.error(MessageEnum.GENERAL_EXCEPTION, "", "", "", MsoLogger.ErrorCode.SchemaError, e.getMessage(), e);
+ throw new MarshallerException(e.getMessage(), MsoLogger.ErrorCode.SchemaError.getValue(), e);
+ }
+
+ return stringWriter.toString();
+ }
+
+ public static Object unMarshal(String input, Object object) throws MarshallerException {
+
+ try {
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ spf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ spf.setFeature("http://xml.org/sax/features/external-general-entities", false);
+ spf.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
+ spf.setNamespaceAware(true);
+ XMLReader xmlReader = spf.newSAXParser().getXMLReader();
+
+ JAXBContext jaxbContext = JAXBContext.newInstance(object.getClass());
+ Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
+
+ InputSource inputSource = new InputSource(new StringReader(input));
+ SAXSource source = new SAXSource(xmlReader, inputSource);
+ object = jaxbUnmarshaller.unmarshal(source, object.getClass()).getValue();
+ } catch (Exception e) {
+ logger.error(MessageEnum.GENERAL_EXCEPTION, "", "", "", MsoLogger.ErrorCode.SchemaError, e.getMessage(), e);
+ throw new MarshallerException(e.getMessage(), MsoLogger.ErrorCode.SchemaError.getValue(), e);
+ }
+
+ return object;
+ }
+
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/entities/PolicyDecision.java b/common/src/main/java/org/onap/so/web/exceptions/ExceptionResponse.java
index fbc8e23151..048634190a 100644
--- a/common/src/main/java/org/openecomp/mso/client/policy/entities/PolicyDecision.java
+++ b/common/src/main/java/org/onap/so/web/exceptions/ExceptionResponse.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,41 +18,29 @@
* ============LICENSE_END=========================================================
*/
-
-package org.openecomp.mso.client.policy.entities;
-
-
+package org.onap.so.web.exceptions;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({ "decision", "details" })
-public class PolicyDecision {
-
- @JsonProperty("decision")
- private String decision;
- @JsonProperty("details")
- private String details;
-
- @JsonProperty("decision")
- public String getDecision() {
- return decision;
+@JsonPropertyOrder({
+ "message"
+})
+public class ExceptionResponse {
+ @JsonProperty("message")
+ private String message;
+
+ public ExceptionResponse(String message) {
+ this.message = message;
}
-
- @JsonProperty("decision")
- public void setDecision(String decision) {
- this.decision = decision;
+ public String getMessage() {
+ return message;
}
- @JsonProperty("details")
- public String getDetails() {
- return details;
+ public void setMessage(String message) {
+ this.message = message;
}
- @JsonProperty("details")
- public void setDetails(String details) {
- this.details = details;
- }
}
diff --git a/common/src/main/java/org/onap/so/web/exceptions/RuntimeExceptionMapper.java b/common/src/main/java/org/onap/so/web/exceptions/RuntimeExceptionMapper.java
new file mode 100644
index 0000000000..72e609acbd
--- /dev/null
+++ b/common/src/main/java/org/onap/so/web/exceptions/RuntimeExceptionMapper.java
@@ -0,0 +1,46 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.web.exceptions;
+
+import javax.ws.rs.NotFoundException;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+import javax.ws.rs.ext.ExceptionMapper;
+
+import org.onap.so.logger.MsoAlarmLogger;
+import org.onap.so.logger.MsoLogger;
+
+public class RuntimeExceptionMapper implements ExceptionMapper<RuntimeException> {
+
+ private static MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL, RuntimeExceptionMapper.class);
+ private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger();
+ @Override
+ public Response toResponse(RuntimeException exception) {
+
+ if (exception instanceof NotFoundException) {
+ return Response.status(Status.NOT_FOUND).build();
+ } else {
+ alarmLogger.sendAlarm("MsoApplicationError", MsoAlarmLogger.CRITICAL, exception.getMessage());
+ logger.error(exception);
+ return Response.status(Status.INTERNAL_SERVER_ERROR).entity(new ExceptionResponse("Unexpected Internal Exception")).build();
+ }
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIClient.java b/common/src/main/java/org/openecomp/mso/client/aai/AAIClient.java
deleted file mode 100644
index 9150dcab15..0000000000
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAIClient.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.client.aai;
-
-import java.net.URI;
-import java.util.UUID;
-
-import javax.ws.rs.core.UriBuilder;
-
-import org.openecomp.mso.client.RestPropertiesLoader;
-import org.openecomp.mso.client.aai.entities.uri.AAIUri;
-import org.openecomp.mso.client.defaultproperties.DefaultAAIPropertiesImpl;
-import org.openecomp.mso.client.policy.RestClient;
-
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-public abstract class AAIClient {
-
- protected final AAIVersion defaultVersion;
- private static final String AAI_ROOT = "/aai";
- protected final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger();
- private final AAIProperties properties;
- protected final UUID requestId;
- public AAIClient(UUID requestId) {
- AAIProperties props = RestPropertiesLoader.getInstance().getNewImpl(AAIProperties.class);
- if (props == null) {
- metricsLogger.error("No RestProperty.AAIProperties implementation found on classpath");
- props = new DefaultAAIPropertiesImpl();
- }
- this.properties = props;
- this.defaultVersion = props.getDefaultVersion();
- this.requestId = requestId;
- }
- protected URI constructPath(AAIUri uri) {
-
- return UriBuilder.fromUri(AAI_ROOT + "/" + this.getVersion().toString() + uri.build().toString()).build();
- }
-
- protected RestClient createClient(AAIUri uri) {
- return new AAIRestClient(properties, this.getRequestId(), constructPath(uri)).addRequestId(this.getRequestId());
-
- }
-
- protected UUID getRequestId() {
- return this.requestId;
- }
- protected AAIVersion getVersion() {
- return defaultVersion;
- }
-} \ No newline at end of file
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIRestClient.java b/common/src/main/java/org/openecomp/mso/client/aai/AAIRestClient.java
deleted file mode 100644
index e36033faa0..0000000000
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAIRestClient.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.client.aai;
-
-import java.net.URI;
-import java.util.Map;
-import java.util.Optional;
-import java.util.UUID;
-
-import javax.ws.rs.client.ClientResponseFilter;
-import javax.ws.rs.ext.ContextResolver;
-
-import org.openecomp.mso.client.policy.RestClient;
-import org.openecomp.mso.client.policy.RestClientSSL;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-public class AAIRestClient extends RestClientSSL {
-
- private final AAIProperties props;
-
- protected AAIRestClient(AAIProperties props, UUID requestId, URI uri) {
- super(props, requestId, Optional.of(uri));
- this.props = props;
- headerMap.put("X-TransactionId", requestId.toString());
- }
-
- @Override
- protected void initializeHeaderMap(Map<String, String> headerMap) {
- headerMap.put("X-FromAppId", "MSO");
-
- String auth = props.getAuth();
- String key = props.getKey();
-
- if (auth != null && !auth.isEmpty() && key != null && !key.isEmpty()) {
- addBasicAuthHeader(auth, key);
- }
- }
-
- @Override
- protected Optional<ClientResponseFilter> addResponseFilter() {
-
- return Optional.of(new AAIClientResponseExceptionMapper(this.getRequestId()));
- }
-
- @Override
- public RestClient addRequestId(UUID requestId) {
- headerMap.put("X-TransactionId", requestId.toString());
- this.requestId = requestId;
- return this;
- }
-
- @Override
- protected ContextResolver<ObjectMapper> getMapper() {
- return new AAICommonObjectMapperProvider();
- }
-
-}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/objects/AAIOwningEntity.java b/common/src/main/java/org/openecomp/mso/client/aai/objects/AAIOwningEntity.java
deleted file mode 100644
index b0b3d06669..0000000000
--- a/common/src/main/java/org/openecomp/mso/client/aai/objects/AAIOwningEntity.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.client.aai.objects;
-
-import org.openecomp.mso.client.aai.AAIObjectType;
-import org.openecomp.mso.client.aai.entities.AAIEntityObject;
-import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
-import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-public class AAIOwningEntity implements AAIEntityObject {
-
- @JsonProperty("owning-entity-name")
- private String owningEntityName;
-
- @JsonProperty("owning-entity-id")
- private String owningEntityId;
-
- public String getOwningEntityName() {
- return owningEntityName;
- }
-
- public void setOwningEntityName(String owningEntityName) {
- this.owningEntityName = owningEntityName;
- }
-
- public String getOwningEntityId() {
- return owningEntityId;
- }
-
- public void setOwningEntityId(String owningEntityId) {
- this.owningEntityId = owningEntityId;
- }
-
- public AAIOwningEntity withOwningEntity(String owningEntityName, String owningEntityId) {
- this.setOwningEntityName(owningEntityName);
- this.setOwningEntityId(owningEntityId);
- return this;
- }
-
- @Override
- public AAIResourceUri getUri() {
- final AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, this.owningEntityId);
- return uri;
- }
-
-
-}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/objects/AAIProject.java b/common/src/main/java/org/openecomp/mso/client/aai/objects/AAIProject.java
deleted file mode 100644
index 34f715d98a..0000000000
--- a/common/src/main/java/org/openecomp/mso/client/aai/objects/AAIProject.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.client.aai.objects;
-
-import org.openecomp.mso.client.aai.AAIObjectType;
-import org.openecomp.mso.client.aai.entities.AAIEntityObject;
-import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
-import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-public class AAIProject implements AAIEntityObject {
-
- @JsonProperty("project-name")
- private String projectName;
-
- public String getProjectName() {
- return projectName;
- }
-
- public void setProjectName(String projectName) {
- this.projectName = projectName;
- }
-
- public AAIProject withProjectName(String projectName) {
- this.setProjectName(projectName);
- return this;
- }
-
- @Override
- public AAIResourceUri getUri() {
- final AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, this.projectName);
- return uri;
- }
-
-
-}
diff --git a/common/src/main/java/org/openecomp/mso/client/defaultproperties/DefaultAAIPropertiesImpl.java b/common/src/main/java/org/openecomp/mso/client/defaultproperties/DefaultAAIPropertiesImpl.java
deleted file mode 100644
index ce08759dd9..0000000000
--- a/common/src/main/java/org/openecomp/mso/client/defaultproperties/DefaultAAIPropertiesImpl.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.client.defaultproperties;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-
-import org.openecomp.mso.client.aai.AAIProperties;
-import org.openecomp.mso.client.aai.AAIVersion;
-
-public class DefaultAAIPropertiesImpl implements AAIProperties {
-
-
- final Map<Object, Object> props;
- public DefaultAAIPropertiesImpl() {
- File initialFile = new File("src/test/resources/aai.properties");
- Map<Object, Object> temp;
- try(InputStream targetStream = new FileInputStream(initialFile)) {
- Properties properties = new Properties();
- properties.load(targetStream);
- temp = properties;
- } catch (IOException e) {
- temp = new HashMap<>();
- }
- this.props = temp;
-
- }
- @Override
- public URL getEndpoint() throws MalformedURLException {
- return new URL(props.get("aai.endpoint").toString());
- }
-
- @Override
- public String getSystemName() {
- return "MSO";
- }
- @Override
- public AAIVersion getDefaultVersion() {
- return AAIVersion.LATEST;
- }
-
- @Override
- public String getAuth() {
- Object value = props.get("aai.auth");
- return value == null ? null : value.toString();
- }
-
- @Override
- public String getKey() {
- Object value = props.get("mso.msoKey");
- return value == null ? null : value.toString();
- }
-}
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/RestClient.java b/common/src/main/java/org/openecomp/mso/client/policy/RestClient.java
deleted file mode 100644
index 77afe82758..0000000000
--- a/common/src/main/java/org/openecomp/mso/client/policy/RestClient.java
+++ /dev/null
@@ -1,243 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.client.policy;
-
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URL;
-import java.security.GeneralSecurityException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Optional;
-import java.util.UUID;
-
-import javax.ws.rs.client.Client;
-import javax.ws.rs.client.ClientBuilder;
-import javax.ws.rs.client.ClientResponseFilter;
-import javax.ws.rs.client.Entity;
-import javax.ws.rs.client.Invocation.Builder;
-import javax.ws.rs.client.WebTarget;
-import javax.ws.rs.core.GenericType;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriBuilder;
-import javax.ws.rs.ext.ContextResolver;
-
-import org.apache.commons.codec.binary.Base64;
-import org.apache.log4j.Logger;
-import org.openecomp.mso.client.RestProperties;
-import org.openecomp.mso.logger.MsoLogger;
-import org.openecomp.mso.utils.CryptoUtils;
-import org.springframework.stereotype.Service;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-@Service
-public abstract class RestClient {
- protected static final String ECOMP_COMPONENT_NAME = "MSO";
-
- private static final int MAX_PAYLOAD_SIZE = 1024 * 1024;
- private WebTarget webTarget;
-
- protected final Map<String, String> headerMap;
- protected final MsoLogger msoLogger;
- protected URL host;
- protected Optional<URI> path;
- protected Logger logger;
- protected String accept;
- protected String contentType;
- protected UUID requestId;
-
- protected RestClient(RestProperties props, UUID requestId, Optional<URI> path) {
- logger = Logger.getLogger(getClass().getName());
- msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL);
- this.requestId = requestId;
- headerMap = new HashMap<>();
- try {
- host = props.getEndpoint();
- } catch (MalformedURLException e) {
- logger.error("url not valid", e);
- throw new RuntimeException(e);
- }
-
- this.path = path;
- initializeClient(getClient());
- }
-
- protected RestClient(RestProperties props, UUID requestId, Optional<URI> path, String accept, String contentType) {
- this(props, requestId, path);
- this.accept = accept;
- this.contentType = contentType;
- }
-
- protected RestClient(URL host, UUID requestId, String contentType) {
- headerMap = new HashMap<>();
- logger = Logger.getLogger(getClass().getName());
- msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL);
- this.path = Optional.empty();
- this.host = host;
- this.contentType = contentType;
- this.requestId = requestId;
- initializeClient(getClient());
- }
-
- /**
- * Override method to return false to disable logging.
- *
- * @return true - to enable logging, false otherwise
- */
- protected boolean enableLogging() {
- return true;
- }
-
- /**
- * Override method to return custom value for max payload size.
- *
- * @return Default value for MAX_PAYLOAD_SIZE = 1024 * 1024
- */
- protected int getMaxPayloadSize()
- {
- return MAX_PAYLOAD_SIZE;
- }
-
- protected Builder getBuilder() {
-
- Builder builder = webTarget.request();
- initializeHeaderMap(headerMap);
-
- for (Entry<String, String> entry : headerMap.entrySet()) {
- builder.header(entry.getKey(), entry.getValue());
- }
- return builder;
- }
-
- protected abstract void initializeHeaderMap(Map<String, String> headerMap);
-
- protected abstract Optional<ClientResponseFilter> addResponseFilter();
-
- public abstract RestClient addRequestId(UUID requestId);
-
- /**
- * Adds a basic authentication header to the request.
- * @param auth the encrypted credentials
- * @param key the key for decrypting the credentials
- */
- protected void addBasicAuthHeader(String auth, String key) {
- try {
- byte[] decryptedAuth = CryptoUtils.decrypt(auth, key).getBytes();
- String authHeaderValue = "Basic " + new String(Base64.encodeBase64(decryptedAuth));
- headerMap.put("Authorization", authHeaderValue);
- } catch (GeneralSecurityException e) {
- logger.warn(e.getMessage(), e);
- }
- }
-
- protected ContextResolver<ObjectMapper> getMapper() {
- return new CommonObjectMapperProvider();
- }
-
- protected String getAccept() {
- return accept;
- }
-
- protected String getContentType() {
- return contentType;
- }
-
- protected String getMergeContentType() {
- return "application/merge-patch+json";
- }
-
- protected Client getClient() {
- return ClientBuilder.newBuilder().build();
- }
-
- protected UUID getRequestId() {
- return this.requestId;
- }
- protected void initializeClient(Client client) {
- if (this.enableLogging()) {
- client.register(logger).register(new LoggingFilter(this.getMaxPayloadSize()));
- }
- client.register(this.getMapper());
- Optional<ClientResponseFilter> responseFilter = this.addResponseFilter();
- responseFilter.ifPresent(clientResponseFilter -> client.register(clientResponseFilter));
- webTarget = path.<WebTarget>map(uri -> client.target(UriBuilder.fromUri(host + uri.toString())))
- .orElseGet(() -> client.target(host.toString()));
- this.accept = MediaType.APPLICATION_JSON;
- this.contentType = MediaType.APPLICATION_JSON;
- }
-
- public Response get() {
- return this.getBuilder().accept(this.getAccept()).get();
- }
-
- public Response post(Object obj) {
- return this.getBuilder().accept(this.getAccept()).post(Entity.entity(obj, this.getContentType()));
- }
-
- public Response patch(Object obj) {
- return this.getBuilder().header("X-HTTP-Method-Override", "PATCH").accept(this.getAccept())
- .post(Entity.entity(obj, this.getMergeContentType()));
- }
-
- public Response put(Object obj) {
- return this.getBuilder().accept(this.getAccept()).put(Entity.entity(obj, this.getContentType()));
- }
-
- public Response delete() {
- return this.getBuilder().accept(this.getAccept()).delete();
- }
-
- public Response delete(Object obj) {
- return this.getBuilder().header("X-HTTP-Method-Override", "DELETE").accept(this.getAccept())
- .put(Entity.entity(obj, this.getContentType()));
- }
-
- public <T> T get(Class<T> resultClass) {
- return this.get().readEntity(resultClass);
- }
-
- public <T> T get(GenericType<T> resultClass) {
- return this.get().readEntity(resultClass);
- }
-
- public <T> T post(Object obj, Class<T> resultClass) {
- return this.post(obj).readEntity(resultClass);
- }
-
- public <T> T patch(Object obj, Class<T> resultClass) {
- return this.patch(obj).readEntity(resultClass);
- }
-
- public <T> T put(Object obj, Class<T> resultClass) {
- return this.put(obj).readEntity(resultClass);
- }
-
- public <T> T delete(Class<T> resultClass) {
- return this.delete().readEntity(resultClass);
- }
-
- public <T> T delete(Object obj, Class<T> resultClass) {
- return this.delete(obj).readEntity(resultClass);
- }
-}
diff --git a/common/src/main/java/org/openecomp/mso/db/AbstractSessionFactoryManager.java b/common/src/main/java/org/openecomp/mso/db/AbstractSessionFactoryManager.java
deleted file mode 100644
index 2988e30254..0000000000
--- a/common/src/main/java/org/openecomp/mso/db/AbstractSessionFactoryManager.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.db;
-
-import org.hibernate.cfg.Configuration;
-import org.hibernate.SessionFactory;
-import org.hibernate.service.ServiceRegistry;
-import org.openecomp.mso.properties.MsoDatabaseException;
-import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
-import java.net.URL;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-public abstract class AbstractSessionFactoryManager {
-
- protected static Map<String, SessionFactory> sessionFactories = new ConcurrentHashMap<>();
-
- protected synchronized SessionFactory initializeSessionFactory(URL hibernateConfigFile)
- throws MsoDatabaseException {
- try {
- if (hibernateConfigFile != null) {
- SessionFactory tempFactory = sessionFactories.get(hibernateConfigFile.getPath());
- // Already initialized, skip
- if (tempFactory != null) {
- return tempFactory;
- }
-
- Configuration conf = new Configuration().configure(hibernateConfigFile);
- ServiceRegistry sr = new StandardServiceRegistryBuilder().applySettings(conf.getProperties()).build();
- tempFactory = conf.buildSessionFactory(sr);
- if (tempFactory == null) {
- throw new MsoDatabaseException(
- "SessionFactory can't be initialized, method buildSessionFactory returned null !");
- }
- sessionFactories.put(hibernateConfigFile.getPath(), tempFactory);
- return tempFactory;
- } else {
- throw new MsoDatabaseException(
- "HibernateConfigFile provided is null, therefore Hibernate can't be initialized !");
- }
- } catch (Exception e) {
- throw new MsoDatabaseException("Exception occurred during the SessionFactory Build", e);
- }
- }
-
- public SessionFactory getSessionFactory() throws MsoDatabaseException {
- URL hibernateConfigFile = getHibernateConfigFile();
- SessionFactory factory = sessionFactories.get(hibernateConfigFile.getPath());
- if (factory == null) {
- factory = initializeSessionFactory(hibernateConfigFile);
- }
- return factory;
- }
-
- protected abstract URL getHibernateConfigFile();
-}
diff --git a/common/src/main/java/org/openecomp/mso/logger/LogFilter.java b/common/src/main/java/org/openecomp/mso/logger/LogFilter.java
deleted file mode 100644
index d799b47e15..0000000000
--- a/common/src/main/java/org/openecomp/mso/logger/LogFilter.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.logger;
-
-
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.slf4j.MDC;
-
-import java.io.IOException;
-import java.security.Principal;
-
-public class LogFilter implements Filter {
- @Override
- public void destroy() {
- // Nothing to do.
- }
-
- @Override
- public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain) throws IOException, ServletException {
- final HttpServletRequest httpRequest = (HttpServletRequest) request;
- final HttpServletResponse httpResponse = (HttpServletResponse) response;
-
- MDC.clear ();
- MDC.put (MsoLogger.REMOTE_HOST, httpRequest.getRemoteAddr());
-
- Principal userPrincipal = httpRequest.getUserPrincipal();
- if (null != userPrincipal) {
- MDC.put (MsoLogger.PARTNERNAME, userPrincipal.getName ());
- }
- //Set identity of calling application / component
- String fromAppId = httpRequest.getHeader(MsoLogger.HEADER_FROM_APP_ID);
- if(fromAppId != null && !fromAppId.isEmpty()) {
- MDC.put (MsoLogger.FROM_APP_ID, fromAppId);
- }
- chain.doFilter(httpRequest, httpResponse);
- }
-
- @Override
- public void init(final FilterConfig config) throws ServletException {
- // Nothing to do
- }
-}
diff --git a/common/src/main/java/org/openecomp/mso/logger/MsoLogInitializer.java b/common/src/main/java/org/openecomp/mso/logger/MsoLogInitializer.java
deleted file mode 100644
index 6ed2786f35..0000000000
--- a/common/src/main/java/org/openecomp/mso/logger/MsoLogInitializer.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.logger;
-
-
-import java.io.File;
-
-import javax.servlet.ServletContextEvent;
-import javax.servlet.ServletContextListener;
-import javax.servlet.annotation.WebListener;
-
-import org.slf4j.LoggerFactory;
-
-import ch.qos.logback.classic.LoggerContext;
-import ch.qos.logback.classic.joran.JoranConfigurator;
-
-
-/**
- * This class will attempt to initialize MSO log4j when part of a web application.
- * It will look for the logback configuration file logback.xml in the
- * following order:
- * 1. In an init-param "log.configuration" in web.xml
- * 2. TODO: In a property "log.configuration" in an "application.properties" file
- * 3. In the default location "/etc/ecomp/mso/config"
- * 4. Using the log4j default (check system property log.configuration or
- * just look on the classpath for logback.xml)
- *
- *
- */
-@WebListener
-public class MsoLogInitializer implements ServletContextListener
-{
- private static String DEFAULT_LOG4J_PROPERTIES_FILE = "/etc/ecomp/mso/config/logback.xml";
- private static String prefixMsoPropertiesPath = System.getProperty("mso.config.path");
- static {
- if (prefixMsoPropertiesPath == null) {
- prefixMsoPropertiesPath = "/";
- } else if (!(prefixMsoPropertiesPath.charAt(prefixMsoPropertiesPath.length() - 1) == '/')) {
- prefixMsoPropertiesPath = prefixMsoPropertiesPath + "/";
- }
- }
-
- public MsoLogInitializer () {
- }
-
-
- @Override
- public void contextDestroyed(ServletContextEvent event) {
- // Nothing to do...
- }
-
- @Override
- public void contextInitialized(ServletContextEvent event)
- {
- String logPropertiesFile = null;
- try {
- // Look first in the init-parameters
- String initParam = event.getServletContext().getInitParameter("log.configuration");
- if (initParam != null && fileIsReadable(prefixMsoPropertiesPath + initParam)) {
- logPropertiesFile = prefixMsoPropertiesPath + initParam;
- }
- else if (fileIsReadable(DEFAULT_LOG4J_PROPERTIES_FILE)) {
- logPropertiesFile = DEFAULT_LOG4J_PROPERTIES_FILE;
- }
-
- if (logPropertiesFile != null) {
- // Initialize loggers with the specified file. If no such file was
- // specified, will use the default Log4j resolution.
- LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
- JoranConfigurator jc = new JoranConfigurator();
- jc.setContext(context);
- context.reset();
- jc.doConfigure(logPropertiesFile);
- // Try it out
- MsoLogger initLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL);
- initLogger.info(MessageEnum.INIT_LOGGER, logPropertiesFile, "", "");
- }
- } catch (Exception e) {
- MsoLogger initLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL);
- initLogger.error (MessageEnum.INIT_LOGGER_FAIL, "", "", MsoLogger.ErrorCode.UnknownError, "", e);
- }
- }
-
- private boolean fileIsReadable (String filePath) {
- File f = new File(filePath);
- if (f.exists() && f.canRead())
- return true;
- return false;
- }
-}
diff --git a/common/src/main/java/org/openecomp/mso/logger/MsoLoggingServlet.java b/common/src/main/java/org/openecomp/mso/logger/MsoLoggingServlet.java
deleted file mode 100644
index dd42efbfda..0000000000
--- a/common/src/main/java/org/openecomp/mso/logger/MsoLoggingServlet.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.logger;
-
-
-import java.util.List;
-
-import javax.ws.rs.DefaultValue;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.Response;
-
-import org.slf4j.LoggerFactory;
-
-import ch.qos.logback.classic.Level;
-import ch.qos.logback.classic.Logger;
-import ch.qos.logback.classic.LoggerContext;
-import ch.qos.logback.classic.joran.JoranConfigurator;
-import ch.qos.logback.core.Appender;
-
-import com.wordnik.swagger.annotations.Api;
-import com.wordnik.swagger.annotations.ApiOperation;
-
-@Path("/logging")
-@Api(value="/logging",description="logging")
-public class MsoLoggingServlet {
-
- private static final String DEBUGLOG = "asyncEELFDebug";
- private MsoLogger logger = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL);
- private static final String GENERAL_LOGGER = "com.att.eelf.error";
- private static final String AUDIT_LOGGER = "com.att.eelf.audit";
- private static final String METRICS_LOGGER = "com.att.eelf.metrics";
-
- @GET
- @Path("/setLevel/{logContext}/{level}")
- @Produces("text/plain")
- @ApiOperation(value="message print",response=Response.class)
- public Response setLogLevel (@PathParam("logContext") String logContext, @PathParam("level") String level) {
- logger.info (MessageEnum.LOGGER_SETUP, "", "");
-
- LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
- JoranConfigurator jc = new JoranConfigurator();
- jc.setContext(context);
- Logger updateLogger = context.getLogger (logContext);
-
- if (updateLogger == null) {
- logger.info (MessageEnum.LOGGER_NOT_FOUND, logContext, "", "");
- String response = "Unknown logger: " + logContext;
- return Response.status (200).entity (response).build ();
- }
-
- Level currentLevel = updateLogger.getLevel();
- if (!currentLevel.equals(Level.toLevel(level))) {
- Level newLevel = Level.toLevel (level);
- updateLogger.setLevel (newLevel);
- logger.info (MessageEnum.LOGGER_UPDATE_SUC, updateLogger.getName (), currentLevel.toString(), newLevel.toString());
- }
-
- String response = "Log level set to: " + level + " for " + updateLogger.getName ();
- return Response.status (200).entity (response).build ();
-
- }
-
- @GET
- @Path("/loggers")
- @Produces("text/plain")
- @SuppressWarnings("rawtypes")
- @ApiOperation(value="message print",response=Response.class)
- public Response getLoggers () {
- StringBuilder response = new StringBuilder ();
- LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
- JoranConfigurator jc = new JoranConfigurator();
- jc.setContext(context);
- List <Logger> loggerList = context.getLoggerList();
- for (Logger logger:loggerList) {
- //if (logger.getLevel() != null) {
- response.append(logger.getName()).append(":").append(logger.getLevel()).append(" (")
- .append(logger.getEffectiveLevel()).append(")\n");
- //}
- }
- return Response.status (200).entity (response).build ();
-
- }
-
- @GET
- @Path("/debug")
- @Produces("text/plain")
- @ApiOperation(value="message print",response=Response.class)
- @SuppressWarnings("rawtypes")
- /*
- * Debug log is used as a general log to store all the logs events, including events generated by MSO code or by
- * components used by MSO.
- * This method will only enable/disable the function to store MSO generated events into debug log,
- * since those events will also be generated to error, audit, metrics log.
- * The events generated by other components will not be affected by this interface.
- */
- public Response updateDebugAppender (@DefaultValue("true") @QueryParam("enable") Boolean enable) {
- String response;
-
- LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
- JoranConfigurator jc = new JoranConfigurator();
- jc.setContext(context);
- List <Logger> loggerList = context.getLoggerList();
- Logger rootLogger = context.getLogger("ROOT");
- Appender appender = rootLogger.getAppender(DEBUGLOG);
-
- if (null == appender) {
- return Response.status (500).entity ("Not able to found Debug appender. Please verify to make sure the needed logback file is present in the config folder.").build ();
- }
-
- if (enable) {
- logger.info (MessageEnum.LOGGER_UPDATE_DEBUG, "", "");
-
- for (Logger logger: loggerList) {
- if (isMsoLogger (logger.getName ()) && logger.getAppender (DEBUGLOG) == null && logger.getLevel () != null) {
- logger.addAppender (appender);
- logger.setAdditive(false);
- }
- }
- logger.info (MessageEnum.LOGGER_UPDATE_DEBUG_SUC, "enabled", "", "");
- response = "Debuglog successfully enabled.";
- } else {
- logger.info (MessageEnum.LOGGER_UPDATE_DEBUG, "", "");
- for (Logger logger: loggerList) {
- if (isMsoLogger (logger.getName ())) {
- logger.detachAppender (appender);
- }
- }
- logger.info (MessageEnum.LOGGER_UPDATE_DEBUG_SUC, "disabled", "", "");
- response = "Debuglog successfully disabled.";
- }
- return Response.status (200).entity (response).build ();
-
-
- }
-
- private boolean isMsoLogger (String loggerName) {
- return loggerName.contains (GENERAL_LOGGER) || loggerName.equals (AUDIT_LOGGER)
- || loggerName.equals (METRICS_LOGGER);
- }
-
-}
diff --git a/common/src/main/java/org/openecomp/mso/properties/AbstractMsoProperties.java b/common/src/main/java/org/openecomp/mso/properties/AbstractMsoProperties.java
deleted file mode 100644
index 8ab275e734..0000000000
--- a/common/src/main/java/org/openecomp/mso/properties/AbstractMsoProperties.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.properties;
-
-
-import java.io.IOException;
-import java.util.Properties;
-
-import org.openecomp.mso.logger.MsoLogger;
-
-public abstract class AbstractMsoProperties {
-
- public static final int DEFAULT_RELOAD_TIME_MIN=1;
-
- public static final String RELOAD_TIME_PROPERTY="mso.properties.reload.time.minutes";
-
- protected static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL);
-
- protected String propertiesFileName;
-
- protected int automaticRefreshInMinutes=0;
-
- public String getPropertiesFileName() {
- return propertiesFileName;
- }
-
- public int getAutomaticRefreshInMinutes() {
- return automaticRefreshInMinutes;
- }
-
- protected synchronized void reloadPropertiesFile() throws IOException {
- this.loadPropertiesFile(this.propertiesFileName);
- }
-
- /**
- * This method load a properties file from a source path.
- *
- * @param propertiesPath The path to the file
- * @throws IOException In case of issues during the opening
- */
-
- protected abstract void loadPropertiesFile(String propertiesPath) throws IOException;
-
- @Override
- protected abstract AbstractMsoProperties clone();
-
- @Override
- public abstract int hashCode();
-
- @Override
- public abstract boolean equals(Object obj);
-
- @Override
- public abstract String toString();
-
-
-}
diff --git a/common/src/main/java/org/openecomp/mso/properties/MsoJavaProperties.java b/common/src/main/java/org/openecomp/mso/properties/MsoJavaProperties.java
deleted file mode 100644
index c13b9e0b53..0000000000
--- a/common/src/main/java/org/openecomp/mso/properties/MsoJavaProperties.java
+++ /dev/null
@@ -1,228 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.properties;
-
-
-import java.io.FileReader;
-import java.io.IOException;
-import java.security.GeneralSecurityException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-
-import org.apache.commons.codec.binary.Base64;
-import org.openecomp.mso.utils.CryptoUtils;
-
-public class MsoJavaProperties extends AbstractMsoProperties {
-
-
- private Properties msoProperties = new Properties();
-
-
- public MsoJavaProperties() {
-
- }
-
- public synchronized void setProperty(String key,String value) {
- msoProperties.setProperty(key, value);
- }
-
- public synchronized String getProperty(String key, String defaultValue) {
- if (msoProperties.containsKey(key)) {
- return msoProperties.getProperty(key);
- } else {
- return defaultValue;
- }
- }
-
- public synchronized int getIntProperty(String key, int defaultValue) {
-
- int value = defaultValue;
- if (msoProperties.containsKey(key)) {
- try {
- value = Integer.parseInt(msoProperties.getProperty(key));
- } catch (NumberFormatException e) {
- LOGGER.debug("Exception while parsing integer: " + msoProperties.getProperty(key), e);
- }
- }
- return value;
-
- }
-
- public synchronized boolean getBooleanProperty(String key, boolean defaultValue) {
-
- if (msoProperties.containsKey(key)) {
- return Boolean.parseBoolean(msoProperties.getProperty(key));
- } else {
- return defaultValue;
- }
-
- }
-
- public synchronized String getEncryptedProperty(String key, String defaultValue, String encryptionKey) {
-
- if (msoProperties.containsKey(key)) {
- try {
- return CryptoUtils.decrypt(msoProperties.getProperty(key), encryptionKey);
- } catch (GeneralSecurityException e) {
- LOGGER.debug("Exception while decrypting property: " + msoProperties.getProperty(key), e);
- }
- }
- return defaultValue;
-
- }
-
- /**
- * @param encryptedAuth: encrypted credentials from properties
- * @param msoKey: key to use to decrypt from properties
- * @return base 64 encoded basic auth credentials
- */
- public synchronized String getBasicAuth(String encryptedAuth, String msoKey){
- String encodedString = null;
- if ((encryptedAuth == null || encryptedAuth.isEmpty()) || (msoKey == null || msoKey.isEmpty()))
- return null;
- try {
- String auth = decrypt(encryptedAuth, msoKey);
- byte[] encoded = Base64.encodeBase64(auth.getBytes());
- encodedString = new String(encoded);
- encodedString = "Basic " + encodedString;
-
- } catch (Exception ex) {
- LOGGER.debug("Exception while getBasicAuth " + encryptedAuth, ex);
- }
- return encodedString;
- }
-
- public synchronized int size() {
- return this.msoProperties.size();
- }
-
- public synchronized String decrypt(String toDecrypt, String msokey){
- String result = null;
- try {
- result = CryptoUtils.decrypt(toDecrypt, msokey);
-
- }
- catch (Exception e) {
- LOGGER.debug("Failed to decrypt credentials: " + toDecrypt, e);
- }
- return result;
- }
-
- @Override
- protected synchronized void reloadPropertiesFile() throws IOException {
- this.loadPropertiesFile(this.propertiesFileName);
- }
-
- /**
- * This method load a properties file from a source path.
- *
- * @param propertiesPath The path to the file
- * @throws IOException In case of issues during the opening
- */
- @Override
- protected synchronized void loadPropertiesFile(String propertiesPath) throws IOException {
-
- FileReader reader = null;
-
- propertiesFileName = propertiesPath;
- try {
- msoProperties.clear();
- reader = new FileReader(propertiesPath);
- msoProperties.load(reader);
-
- } finally {
- this.automaticRefreshInMinutes = this.getIntProperty(RELOAD_TIME_PROPERTY, DEFAULT_RELOAD_TIME_MIN);
- try {
- if (reader != null) {
- reader.close();
- }
- } catch (IOException e) {
- LOGGER.debug("Exception while closing reader for file:" + propertiesPath, e);
- }
- }
- }
-
- @Override
- public synchronized MsoJavaProperties clone() {
- MsoJavaProperties msoCopy = new MsoJavaProperties();
- msoCopy.msoProperties.putAll(msoProperties);
- msoCopy.propertiesFileName = this.propertiesFileName;
- msoCopy.automaticRefreshInMinutes = this.automaticRefreshInMinutes;
- return msoCopy;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((msoProperties == null) ? 0 : msoProperties.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;
- }
- MsoJavaProperties other = (MsoJavaProperties) obj;
-
- return msoProperties.equals(other.msoProperties);
- }
-
- @Override
- public String toString() {
-
- StringBuilder response = new StringBuilder();
- response.append("Config file ")
- .append(propertiesFileName)
- .append("(Timer:")
- .append(automaticRefreshInMinutes)
- .append("mins):")
- .append(System.lineSeparator());
-
- for (Object key : this.msoProperties.keySet()) {
- String propertyName = (String) key;
- response.append(propertyName);
- response.append("=");
- response.append(this.msoProperties.getProperty(propertyName));
- response.append(System.lineSeparator());
- }
- response.append(System.lineSeparator());
- response.append(System.lineSeparator());
-
- return response.toString();
- }
-
- public Map<String, String> asMap() {
- final Map<String, String> result = new HashMap<>();
- msoProperties.forEach((key, value) -> result.put(key.toString(), value.toString()));
-
- return result;
- }
-
-}
diff --git a/common/src/main/java/org/openecomp/mso/properties/MsoJsonProperties.java b/common/src/main/java/org/openecomp/mso/properties/MsoJsonProperties.java
deleted file mode 100644
index ec0b54a14f..0000000000
--- a/common/src/main/java/org/openecomp/mso/properties/MsoJsonProperties.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.properties;
-
-
-import java.io.FileReader;
-import java.io.IOException;
-import java.security.GeneralSecurityException;
-
-import org.openecomp.mso.utils.CryptoUtils;
-
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.databind.JsonMappingException;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-
-public class MsoJsonProperties extends AbstractMsoProperties {
-
- protected ObjectMapper mapper = new ObjectMapper();
-
- protected JsonNode jsonRootNode = mapper.createObjectNode();
-
- protected MsoJsonProperties() {
-
- }
-
- public synchronized JsonNode getJsonRootNode () {
- return this.jsonRootNode;
- }
-
- /**
- * This method is used to get the text encrypted in the string value of the node.
- * @param jsonNode The JsonNode containing the strig to decode
- * @param defaultValue The default value in case of issue
- * @param encryptionKey The encryption Key in AES 128 bits
- * @return the String decrypted
- */
- public synchronized String getEncryptedProperty(JsonNode jsonNode, String defaultValue, String encryptionKey) {
-
- if (jsonNode.isTextual()) {
- try {
- return CryptoUtils.decrypt(jsonNode.asText(), encryptionKey);
- } catch (GeneralSecurityException e) {
- LOGGER.debug("Exception while decrypting property: " + jsonNode.asText(), e);
- }
- }
-
- return defaultValue;
- }
-
- /**
- * This method load a properties file from a source path.
- *
- * @param propertiesPath The path to the file
- * @throws IOException In case of issues during the opening
- */
- @Override
- protected synchronized void loadPropertiesFile(String propertiesPath) throws IOException {
-
- FileReader reader = null;
-
- this.propertiesFileName = propertiesPath;
-
- try {
- // Clean
- this.jsonRootNode = mapper.createObjectNode();
-
- reader = new FileReader(propertiesPath);
-
- // Try a tree load
- this.jsonRootNode = mapper.readValue(reader, JsonNode.class);
-
-
- } finally {
- JsonNode reloadJsonProp = this.jsonRootNode.get(RELOAD_TIME_PROPERTY);
- if (reloadJsonProp != null) {
- this.automaticRefreshInMinutes = reloadJsonProp.asInt(DEFAULT_RELOAD_TIME_MIN);
- } else {
- this.automaticRefreshInMinutes = DEFAULT_RELOAD_TIME_MIN;
- }
-
- // Always close the file
- try {
- if (reader != null) {
- reader.close();
- }
- } catch (IOException e) {
- LOGGER.debug("Exception while closing reader for file:" + propertiesFileName, e);
- }
- }
- }
-
- @Override
- public synchronized MsoJsonProperties clone() {
- MsoJsonProperties msoCopy = new MsoJsonProperties();
-
- ObjectMapper newMapper = new ObjectMapper();
- try {
- msoCopy.jsonRootNode = newMapper.createObjectNode();
- msoCopy.jsonRootNode = newMapper.readValue(this.jsonRootNode.toString(), JsonNode.class);
- } catch (JsonParseException e) {
- LOGGER.debug("JsonParseException when cloning the object:" + this.propertiesFileName, e);
- } catch (JsonMappingException e) {
- LOGGER.debug("JsonMappingException when cloning the object:" + this.propertiesFileName, e);
- } catch (IOException e) {
- LOGGER.debug("IOException when cloning the object:" + this.propertiesFileName, e);
- }
-
- msoCopy.propertiesFileName = this.propertiesFileName;
- msoCopy.automaticRefreshInMinutes = this.automaticRefreshInMinutes;
- return msoCopy;
- }
-
-
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((jsonRootNode == null) ? 0 : jsonRootNode.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;
- MsoJsonProperties other = (MsoJsonProperties) obj;
- if (jsonRootNode == null) {
- if (other.jsonRootNode != null)
- return false;
- } else if (!jsonRootNode.equals(other.jsonRootNode))
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- return "Config file " + propertiesFileName + "(Timer:" + automaticRefreshInMinutes + "mins):" + System
- .getProperty("line.separator") + this.jsonRootNode.toString() + System.getProperty("line.separator")
- + System.getProperty("line.separator");
- }
-
-}
diff --git a/common/src/main/java/org/openecomp/mso/properties/MsoPropertiesException.java b/common/src/main/java/org/openecomp/mso/properties/MsoPropertiesException.java
deleted file mode 100644
index 1563ca556c..0000000000
--- a/common/src/main/java/org/openecomp/mso/properties/MsoPropertiesException.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.properties;
-
-
-/**
- * Exception during artifact installation.
- */
-public class MsoPropertiesException extends Exception {
-
- /**
- * serialization id.
- */
- private static final long serialVersionUID = 4095937499475915021L;
-
- /**
- * @param message The message to dump
- * @param cause The Throwable cause object
- */
- public MsoPropertiesException (final String message) {
- super (message);
-
- }
-
- /**
- * @param message The message to dump
- * @param cause The Throwable cause object
- */
- public MsoPropertiesException (final String message, final Throwable cause) {
- super (message, cause);
-
- }
-}
diff --git a/common/src/main/java/org/openecomp/mso/properties/MsoPropertiesFactory.java b/common/src/main/java/org/openecomp/mso/properties/MsoPropertiesFactory.java
deleted file mode 100644
index 3f81734796..0000000000
--- a/common/src/main/java/org/openecomp/mso/properties/MsoPropertiesFactory.java
+++ /dev/null
@@ -1,395 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.properties;
-
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map.Entry;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-
-import javax.ejb.ConcurrencyManagement;
-import javax.ejb.ConcurrencyManagementType;
-import javax.ejb.LocalBean;
-import javax.ejb.Schedule;
-import javax.ejb.Singleton;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Response;
-
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-import org.openecomp.mso.utils.CryptoUtils;
-
-/**
- * This EJB Singleton class returns an instance of the mso properties for a specified file.
- * This class can handle many config at the same time and is thread safe.
- * This instance is a copy of the one cached so it can be modified or reloaded without impacting the others class using
- * it.
- * The mso properties files loaded and cached here will be reloaded every X second (it's configurable with the init
- * method)
- * This class can be used as an EJB or can be instantiated directly as long as the EJB has been initialized for the current
- * module. Locks are made manually and not using EJB locks to allow this.
- *
- *
- */
-@Singleton(name = "MsoPropertiesFactory")
-@ConcurrencyManagement(ConcurrencyManagementType.BEAN)
-@LocalBean
-@Path("/properties")
-public class MsoPropertiesFactory implements Serializable {
-
- private static final long serialVersionUID = 4365495305496742113L;
-
- protected static String prefixMsoPropertiesPath = System.getProperty ("mso.config.path");
-
- private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL);
-
- // Keep a static copy of properties for global usage
- private static final ConcurrentHashMap <String, MsoPropertiesParameters> msoPropertiesCache;
-
- static {
- if (prefixMsoPropertiesPath == null) {
- // Hardcode if nothing is received
- prefixMsoPropertiesPath = "";
- }
- msoPropertiesCache = new ConcurrentHashMap<>();
- }
-
- private static final ReentrantReadWriteLock rwl = new ReentrantReadWriteLock ();
-
- public MsoPropertiesFactory () {
-
- }
-
- private boolean isJsonFile(String propertiesFilePath) {
- return propertiesFilePath.endsWith(".json");
- }
-
-
- private boolean isJavaPropertiesFile (String propertiesFilePath) {
- return propertiesFilePath.endsWith(".properties");
- }
-
- private MsoPropertiesParameters createObjectType (MsoPropertiesParameters msoPropParams, String propertiesFilePath) throws MsoPropertiesException, IOException {
-
- try {
- if (this.isJavaPropertiesFile(propertiesFilePath)) {
-
- msoPropParams.msoProperties = new MsoJavaProperties();
- msoPropParams.msoPropertiesType = MsoPropertiesParameters.MsoPropertiesType.JAVA_PROP;
- } else if (this.isJsonFile(propertiesFilePath)) {
-
- msoPropParams.msoProperties = new MsoJsonProperties();
- msoPropParams.msoPropertiesType = MsoPropertiesParameters.MsoPropertiesType.JSON_PROP;
- } else {
- throw new MsoPropertiesException("Unable to load the MSO properties file because format is not recognized (only .json or .properties): " + propertiesFilePath);
- }
-
- msoPropParams.msoProperties.loadPropertiesFile (propertiesFilePath);
-
- return msoPropParams;
- } finally {
- if (msoPropParams.msoProperties!=null) {
- msoPropParams.refreshCounter = msoPropParams.msoProperties.getAutomaticRefreshInMinutes();
- }
- }
-
- }
-
- /**
- * This method is used to create a MsoProperties file cache and factory.
- * The ID is kept in cache even if the config fails to be loaded.
- * This is used to maintain the config ID until someone fixes the config file.
- *
- * @param msoPropertiesID A string representing the key of the config
- * @param propertiesFilePath The mso properties file to load
- *
- * @throws MsoPropertiesException In case of issues with the mso properties loading
- *
- * @see MsoPropertiesFactory#getMsoJavaProperties()
- * @see MsoPropertiesFactory#getMsoJsonProperties()
- */
- public void initializeMsoProperties (String msoPropertiesID,
- String propertiesFilePath) throws MsoPropertiesException {
-
- rwl.writeLock ().lock ();
-
- String msoPropPath="none";
- MsoPropertiesParameters msoPropertiesParams=new MsoPropertiesParameters();
- try {
- msoPropPath = prefixMsoPropertiesPath + propertiesFilePath;
- if (msoPropertiesCache.get (msoPropertiesID) != null) {
- throw new MsoPropertiesException ("The factory contains already an instance of this mso properties: "
- + msoPropPath);
- }
- // Create the global MsoProperties object
- msoPropertiesParams = createObjectType(msoPropertiesParams, msoPropPath);
-
- } catch (FileNotFoundException e) {
- throw new MsoPropertiesException ("Unable to load the MSO properties file because it has not been found:"
- + msoPropPath, e);
-
- } catch (IOException e) {
- throw new MsoPropertiesException ("Unable to load the MSO properties file because IOException occurs: "
- + msoPropPath, e);
- } finally {
- // put it in all cases, just to not forget about him and attempt a default reload
- msoPropertiesCache.put (msoPropertiesID, msoPropertiesParams);
- rwl.writeLock ().unlock ();
- }
- }
-
- public void removeMsoProperties (String msoPropertiesID) throws MsoPropertiesException {
-
- rwl.writeLock ().lock ();
- try {
- if (MsoPropertiesFactory.msoPropertiesCache.remove (msoPropertiesID) == null) {
- throw new MsoPropertiesException ("Mso properties not found in cache:" + msoPropertiesID);
- }
- } finally {
- rwl.writeLock ().unlock ();
- }
- }
-
- /**
- * This method clears all the configs in cache, the factory will then be free of any config.
- *
- * @see MsoPropertiesFactory#initializeMsoProperties(String, String)
- */
- public void removeAllMsoProperties () {
-
- rwl.writeLock ().lock ();
- try {
- MsoPropertiesFactory.msoPropertiesCache.clear ();
- } finally {
- rwl.writeLock ().unlock ();
- }
- }
-
- /**
- * THis method can be used to change the file and timer fields of an existing MSO properties file.
- *
- * @param msoPropertiesID The MSO properties ID
- * @param newMsoPropPath The new file Path
- * @throws MsoPropertiesException In case of the MSO Properties is not found in cache
- */
- public void changeMsoPropertiesFilePath (String msoPropertiesID,
- String newMsoPropPath) throws MsoPropertiesException {
-
- rwl.writeLock ().lock ();
- try {
- MsoPropertiesParameters msoPropInCache = MsoPropertiesFactory.msoPropertiesCache.get (msoPropertiesID);
-
- if (msoPropInCache != null) {
- msoPropInCache.msoProperties.propertiesFileName = prefixMsoPropertiesPath + newMsoPropPath;
-
- } else {
- throw new MsoPropertiesException ("Mso properties not found in cache:" + msoPropertiesID);
- }
- } finally {
- rwl.writeLock ().unlock ();
- }
- }
-
- private AbstractMsoProperties getAndCloneProperties(String msoPropertiesID, MsoPropertiesParameters.MsoPropertiesType type) throws MsoPropertiesException {
- rwl.readLock ().lock ();
- try {
- MsoPropertiesParameters msoPropInCache = MsoPropertiesFactory.msoPropertiesCache.get (msoPropertiesID);
- if (msoPropInCache == null) {
- throw new MsoPropertiesException ("Mso properties not found in cache:" + msoPropertiesID);
- } else {
- if (type.equals(msoPropInCache.msoPropertiesType)) {
- return msoPropInCache.msoProperties.clone ();
- } else {
- throw new MsoPropertiesException ("Mso properties is not "+type.name()+" properties type:" + msoPropertiesID);
- }
-
- }
- } finally {
- rwl.readLock ().unlock ();
- }
- }
-
- /**
- * Get the MSO Properties (As Java Properties) as a copy of the mso properties cache.
- * The object returned can therefore be modified.
- *
- * @return A copy of the mso properties, properties class can be empty if the file has not been read properly
- * @throws MsoPropertiesException If the mso properties does not exist in the cache
- */
- public MsoJavaProperties getMsoJavaProperties (String msoPropertiesID) throws MsoPropertiesException {
-
- return (MsoJavaProperties)getAndCloneProperties(msoPropertiesID,MsoPropertiesParameters.MsoPropertiesType.JAVA_PROP);
- }
-
- /**
- * Get the MSO Properties (As JSON Properties) as a copy of the mso properties cache.
- * The object returned can therefore be modified.
- *
- * @return A copy of the mso properties, properties class can be empty if the file has not been read properly
- * @throws MsoPropertiesException If the mso properties does not exist in the cache
- */
- public MsoJsonProperties getMsoJsonProperties (String msoPropertiesID) throws MsoPropertiesException {
-
- return (MsoJsonProperties)getAndCloneProperties(msoPropertiesID,MsoPropertiesParameters.MsoPropertiesType.JSON_PROP);
- }
-
- /**
- * Get all MSO Properties as a copy of the mso properties cache.
- * The objects returned can therefore be modified.
- *
- * @return A List of copies of the mso properties, can be empty
- */
- public List <AbstractMsoProperties> getAllMsoProperties () {
-
- List <AbstractMsoProperties> resultList = new LinkedList<>();
- rwl.readLock ().lock ();
- try {
-
- for (MsoPropertiesParameters msoProp:MsoPropertiesFactory.msoPropertiesCache.values ()) {
- resultList.add(msoProp.msoProperties.clone());
- }
- return resultList;
-
- } finally {
- rwl.readLock ().unlock ();
- }
-
- }
-
- /**
- * This method is not intended to be called, it's used to refresh the config automatically
- *
- * @return true if Properties have been reloaded, false otherwise
- */
- @Schedule(minute = "*/1", hour = "*", persistent = false)
- public boolean reloadMsoProperties () {
- AbstractMsoProperties msoPropInCache = null;
- try {
- if (!rwl.writeLock ().tryLock () && !rwl.writeLock ().tryLock (30L, TimeUnit.SECONDS)) {
- LOGGER.debug ("Busy write lock on mso properties factory, skipping the reloading");
- return false;
- }
- } catch (InterruptedException e1) {
- LOGGER.debug ("Interrupted while trying to acquire write lock on mso properties factory, skipping the reloading");
- Thread.currentThread ().interrupt ();
- return false;
- }
- try {
- for (Entry <String, MsoPropertiesParameters> entryMsoPropTimer : MsoPropertiesFactory.msoPropertiesCache.entrySet ()) {
-
- if (entryMsoPropTimer.getValue ().refreshCounter <= 1) {
- // It's time to reload the config
- msoPropInCache = MsoPropertiesFactory.msoPropertiesCache.get (entryMsoPropTimer.getKey ()).msoProperties;
- try {
- AbstractMsoProperties oldProps = msoPropInCache.clone ();
- msoPropInCache.reloadPropertiesFile ();
- entryMsoPropTimer.getValue().refreshCounter=entryMsoPropTimer.getValue().msoProperties.getAutomaticRefreshInMinutes();
-
- if (!msoPropInCache.equals (oldProps)) {
- LOGGER.info (MessageEnum.LOAD_PROPERTIES_SUC, msoPropInCache.getPropertiesFileName (), "", "");
- }
- } catch (FileNotFoundException ef) {
- LOGGER.error (MessageEnum.NO_PROPERTIES, msoPropInCache.propertiesFileName, "", "", MsoLogger.ErrorCode.PermissionError, "", ef);
- } catch (Exception e) {
- LOGGER.error (MessageEnum.LOAD_PROPERTIES_FAIL, msoPropInCache.propertiesFileName, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "", e);
- }
-
- } else {
- --entryMsoPropTimer.getValue().refreshCounter;
- }
- }
- return true;
- } catch (Exception e) {
- LOGGER.error (MessageEnum.LOAD_PROPERTIES_FAIL, "Unknown. Global issue while reloading", "", "", MsoLogger.ErrorCode.BusinessProcesssError, "", e);
- return false;
- } finally {
- rwl.writeLock ().unlock ();
- }
- }
-
- /**
- * This method can be used to known if the MSO properties instance hold is different from the one in cache
- *
- * @param msoPropertiesID The MSO properties ID
- * @param oldMsoProperties The MSO Properties instance that must be compared to
- * @return True if they are the same, false otherwise
- * @throws MsoPropertiesException
- */
- public boolean propertiesHaveChanged (String msoPropertiesID, AbstractMsoProperties oldMsoProperties) throws MsoPropertiesException {
- rwl.readLock ().lock ();
- try {
- if (MsoPropertiesFactory.msoPropertiesCache.get (msoPropertiesID) == null) {
- throw new MsoPropertiesException ("Mso properties not found in cache:" + msoPropertiesID);
- }
-
- AbstractMsoProperties msoPropInCache = MsoPropertiesFactory.msoPropertiesCache.get (msoPropertiesID).msoProperties;
- if (oldMsoProperties != null) {
- return !oldMsoProperties.equals (msoPropInCache);
- } else {
- return msoPropInCache != null;
- }
- } finally {
- rwl.readLock ().unlock ();
- }
- }
-
- @GET
- @Path("/show")
- @Produces("text/plain")
- public Response showProperties () {
-
- List <AbstractMsoProperties> listMsoProp = this.getAllMsoProperties ();
- StringBuffer response = new StringBuffer ();
-
- if (listMsoProp.isEmpty ()) {
- response.append ("No file defined");
- }
-
- for (AbstractMsoProperties properties : listMsoProp) {
-
- response.append(properties.toString());
- }
-
- return Response.status (200).entity (response).build ();
- }
-
- @GET
- @Path("/encrypt/{value}/{cryptKey}")
- @Produces("text/plain")
- public Response encryptProperty (@PathParam("value") String value, @PathParam("cryptKey") String cryptKey) {
- try {
- String encryptedValue = CryptoUtils.encrypt (value, cryptKey);
- return Response.status (200).entity (encryptedValue).build ();
- } catch (Exception e) {
- LOGGER.error (MessageEnum.GENERAL_EXCEPTION_ARG, "Encryption error", "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Error in encrypting property", e);
- return Response.status (500).entity (e.getMessage ()).build ();
- }
- }
-}
diff --git a/common/src/main/java/org/openecomp/mso/properties/MsoPropertyInitializer.java b/common/src/main/java/org/openecomp/mso/properties/MsoPropertyInitializer.java
deleted file mode 100644
index 8490ff8afa..0000000000
--- a/common/src/main/java/org/openecomp/mso/properties/MsoPropertyInitializer.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.properties;
-
-
-import javax.servlet.ServletContextEvent;
-import javax.servlet.ServletContextListener;
-import javax.servlet.annotation.WebListener;
-
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-
-/**
- * This class will attempt to initialize MSO Properties when part of a web application.
- * It will look for the configuration file mso.properties in the
- * following order:
- * 1. In an init-param "mso.configuration" in web.xml
- * 2. In a system property "mso.configuration"
- * 3. In the default location "/etc/ecomp/mso/config/mso.properties"
- *
- * If all else fails, the MSO Properties will go uninitialized, and will
- * attempt to use the default constructors within the MsoProperties class.
- *
- *
- */
-@WebListener
-public class MsoPropertyInitializer implements ServletContextListener
-{
-
- private MsoPropertiesFactory msoPropertiesFactory=new MsoPropertiesFactory();
-
- public MsoPropertyInitializer () {
- }
-
- @Override
- public void contextDestroyed(ServletContextEvent event) {
- // Nothing to do...
- }
-
-
- @Override
- public void contextInitialized(ServletContextEvent event)
- {
-
- // Note - this logger may be before or after MSO Logging configuration applied
- MsoLogger initLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL);
- try {
- // Look first in the init-parameters
- String msoPropConfigParam = event.getServletContext().getInitParameter("mso.configuration");
- if (msoPropConfigParam != null && !msoPropConfigParam.isEmpty() ) {
- String[] configFileSplit = msoPropConfigParam.split(",");
- for (String msoPropConfig:configFileSplit) {
- String[] msoPropDecoded = msoPropConfig.split("=");
-
- try {
- msoPropertiesFactory.initializeMsoProperties(msoPropDecoded[0], msoPropDecoded[1]);
- initLogger.info(MessageEnum.LOAD_PROPERTIES_SUC, msoPropDecoded[1], "", "");
- initLogger.debug("Mso properties successfully loaded:"+msoPropDecoded[1]+",ID:"+msoPropDecoded[0]+")");
- } catch (MsoPropertiesException e) {
- initLogger.error(MessageEnum.LOAD_PROPERTIES_FAIL, msoPropDecoded[1] + ". MSO Properties failed due to an mso properties exception", "", "", MsoLogger.ErrorCode.DataError, "Error in contextInitialized", e);
- }
- }
- }
- }
- catch (Exception e) {
- initLogger.error(MessageEnum.LOAD_PROPERTIES_FAIL, "Unknown. MSO Properties failed to initialize completely", "", "", MsoLogger.ErrorCode.DataError, "", e);
- }
- }
-}
diff --git a/common/src/main/java/org/openecomp/mso/utils/RootIgnoringJsonDeserializer.java b/common/src/main/java/org/openecomp/mso/utils/RootIgnoringJsonDeserializer.java
deleted file mode 100644
index 95f72c4dd4..0000000000
--- a/common/src/main/java/org/openecomp/mso/utils/RootIgnoringJsonDeserializer.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.utils;
-
-import java.io.IOException;
-import java.util.Map;
-
-import com.fasterxml.jackson.annotation.JsonRootName;
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.JsonDeserializer;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-/**
- * A JSON deserializer that ignores the root element if it is present.
- */
-public class RootIgnoringJsonDeserializer<T> extends JsonDeserializer<T> {
-
- private final ObjectMapper mapper = new ObjectMapper();
- private final Class<T> clazz;
- private final String jsonRootName;
-
- public RootIgnoringJsonDeserializer(Class<T> clazz) {
- this.clazz = clazz;
-
- JsonRootName annotation = clazz.getAnnotation(JsonRootName.class);
-
- if (annotation == null || annotation.value() == null || annotation.value().equals("")) {
- jsonRootName = clazz.getSimpleName();
- } else {
- jsonRootName = annotation.value();
- }
- }
-
- @Override
- public T deserialize(JsonParser jp, DeserializationContext dc)
- throws IOException, JsonProcessingException {
- JsonNode rootNode = jp.getCodec().readTree(jp);
- Map.Entry<String,JsonNode> field = rootNode.fields().next();
-
- if (jsonRootName.equals(field.getKey())) {
- rootNode = field.getValue();
- }
-
- return mapper.convertValue(rootNode, clazz);
- }
-} \ No newline at end of file
diff --git a/common/src/main/resources/Policy.properties b/common/src/main/resources/Policy.properties
index b5b38c465b..b82b7e4084 100644
--- a/common/src/main/resources/Policy.properties
+++ b/common/src/main/resources/Policy.properties
@@ -1,7 +1,7 @@
-HOST = https://mtanjvsgcvm02.nvp.cip.att.com:8081/pdp/api/getDecision
-CLIENT_AUTH = Basic bTAzNzQzOnBvbGljeVIwY2sk
-AUTHORIZATION = Basic dGVzdHBkcDphbHBoYTEyMw==
-ENVIRONMENT = TEST
-X_ECOMP_REQUESTID = 1234567h
-ECOMP_COMPONENT_NAME = MSO
+HOST = https://localhost:8081/pdp/api/getDecision
+CLIENT_AUTH = Basic bTAzNzQzOnBvbGljeVIwY2sk
+AUTHORIZATION = Basic dGVzdHBkcDphbHBoYTEyMw==
+ENVIRONMENT = TEST
+X_ECOMP_REQUESTID = 1234567h
+ECOMP_COMPONENT_NAME = MSO
ssl.key.store.password.key = javax.net.ssl.keyStorePassword \ No newline at end of file
diff --git a/common/src/main/resources/dmaap/default-consumer.properties b/common/src/main/resources/dmaap/default-consumer.properties
index 4d2ecce068..f19b64242d 100644
--- a/common/src/main/resources/dmaap/default-consumer.properties
+++ b/common/src/main/resources/dmaap/default-consumer.properties
@@ -10,7 +10,7 @@ SubContextPath=/events/
Protocol=http
MethodType=GET
contenttype=application/json
-host=http://olsd005.wnsnet.attws.com:3904
+host=http://localhost:3904
partition=MSO
maxBatchSize=100
maxAgeMs=250
diff --git a/common/src/main/resources/dmaap/default-publisher.properties b/common/src/main/resources/dmaap/default-publisher.properties
index af1b481165..6d9be7528d 100644
--- a/common/src/main/resources/dmaap/default-publisher.properties
+++ b/common/src/main/resources/dmaap/default-publisher.properties
@@ -10,7 +10,7 @@ SubContextPath=/events/
Protocol=http
MethodType=POST
contenttype=application/json
-host=http://olsd005.wnsnet.attws.com:3904
+host=http://localhost:3904
partition=MSO
maxBatchSize=100
maxAgeMs=250
diff --git a/common/src/main/resources/test b/common/src/main/resources/test
new file mode 100644
index 0000000000..7a8e433b1e
--- /dev/null
+++ b/common/src/main/resources/test
@@ -0,0 +1,159 @@
+
+ 1 <configuration debug="false" scan="true" scanPeriod="3 seconds">
+ 2 <!--<jmxConfigurator /> -->
+ 3 <!-- directory path for all other type logs -->
+ 4 <property name="logDir" value="/var/log/onap" />
+ 5 <property name="componentName" value="logging-demo"></property>
+ 6 <property name="subComponentName" value="demo"></property>
+ 7 <property name="logDirectory" value="${logDir}/${componentName}/${subComponentName}" /> 8
+ 9 <property name="generalLogName" value="error" />
+ 10 <property name="metricsLogName" value="metric" />
+ 11 <property name="auditLogName" value="audit" />
+ 12 <property name="debugLogName" value="debug" />
+ 13 <property name="queueSize" value="256" />
+ 14 <property name="maxFileSize" value="50MB" />
+ 15 <property name="maxHistory" value="30" />
+ 16 <property name="totalSizeCap" value="10GB" />
+ 17 <property name="pattern" value="%nopexception%logger|%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX,UTC}|%level|%replace(%replace(%replace(%message){'\t','\\\\t'}){'\n','\\\\n'}){'|','\\\\|'}|%replace(%replace(%replace(%mdc){'\t','\\\\t'}){'\n','\\\\n'}){'|','\\\\|'}|%replace(%replace(%replace(%rootException){'\t','\\\\t'}){'\n','\\\\n'}){'|','\\\\|'}|%replace(%replace(%replace(%marker){'\t','\\\\t'}){'\n','\\\\n'}){'|','\\\\|'}|%thread|%n"/>
+ 18 <!-- Example evaluator filter applied against console appender -->
+ 19 <appender class="ch.qos.logback.core.ConsoleAppender" name="STDOUT">
+ 20 <encoder>
+ 21 <pattern>${pattern}</pattern>
+ 22 </encoder>
+ 23 </appender>
+ 24 <!-- ============================================================================ -->
+ 25 <!-- EELF Appenders -->
+ 26 <!-- ============================================================================ -->
+ 27 <!-- The EELFAppender is used to record events to the general application
+ 28 log -->
+ 29 <appender class="ch.qos.logback.core.rolling.RollingFileAppender" name="EELF">
+ 30 <file>${logDirectory}/${generalLogName}.log</file>
+ 31 <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+ 32 <fileNamePattern>${logDirectory}/${generalLogName}.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+ 33 <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+ 34 <maxFileSize>${maxFileSize}</maxFileSize>
+ 35 </timeBasedFileNamingAndTriggeringPolicy>
+ 36 <maxHistory>${maxHistory}</maxHistory>
+ 37 <totalSizeCap>${totalSizeCap}</totalSizeCap>
+ 38 </rollingPolicy>
+ 39 <encoder>
+ 40 <pattern>${pattern}</pattern>
+ 41 </encoder>
+ 42 </appender>
+ 43 <appender class="ch.qos.logback.classic.AsyncAppender" name="asyncEELF">
+ 44 <!-- deny all events with a level below INFO, that is TRACE and DEBUG -->
+ 45 <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+ 46 <level>INFO</level>
+ 47 </filter>
+ 48 <queueSize>${queueSize}</queueSize>
+ 49 <appender-ref ref="EELF" />
+ 50 </appender>
+ 51 <appender class="ch.qos.logback.core.rolling.RollingFileAppender" name="EELFAudit">
+ 52 <file>${logDirectory}/${auditLogName}.log</file>
+ 53 <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+ 54 <fileNamePattern>${logDirectory}/${auditLogName}.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+ 55 <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+ 56 <maxFileSize>${maxFileSize}</maxFileSize>
+ 57 </timeBasedFileNamingAndTriggeringPolicy>
+ 58 <maxHistory>${maxHistory}</maxHistory>
+ 59 <totalSizeCap>${totalSizeCap}</totalSizeCap>
+ 60 </rollingPolicy>
+ 61 <encoder>
+ 62 <pattern>${pattern}</pattern>
+ 63 </encoder>
+ 64 </appender>
+ 65 <appender class="ch.qos.logback.classic.AsyncAppender" name="asyncEELFAudit">
+ 66 <queueSize>${queueSize}</queueSize>
+ 67 <appender-ref ref="EELFAudit" />
+ 68 </appender>
+ 69 <appender class="ch.qos.logback.core.rolling.RollingFileAppender" name="EELFMetrics">
+ 70 <file>${logDirectory}/${metricsLogName}.log</file>
+ 71 <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+ 72 <fileNamePattern>${logDirectory}/${metricsLogName}.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+ 73 <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+ 74 <maxFileSize>${maxFileSize}</maxFileSize>
+ 75 </timeBasedFileNamingAndTriggeringPolicy>
+ 76 <maxHistory>${maxHistory}</maxHistory>
+ 77 <totalSizeCap>${totalSizeCap}</totalSizeCap>
+ 78 </rollingPolicy>
+ 79 <encoder>
+ 80 <pattern>${pattern}</pattern>
+ 81 </encoder>
+ 82 </appender>
+ 83 <appender class="ch.qos.logback.classic.AsyncAppender" name="asyncEELFMetrics">
+ 84 <queueSize>${queueSize}</queueSize>
+ 85 <appender-ref ref="EELFMetrics" />
+ 86 </appender>
+ 87 <appender class="ch.qos.logback.core.rolling.RollingFileAppender" name="EELFDebug">
+ 88 <file>${logDirectory}/${debugLogName}.log</file>
+ 89 <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+ 90 <fileNamePattern>${logDirectory}/${debugLogName}.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+ 91 <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+ 92 <maxFileSize>${maxFileSize}</maxFileSize>
+ 93 </timeBasedFileNamingAndTriggeringPolicy>
+ 94 <maxHistory>${maxHistory}</maxHistory>
+ 95 <totalSizeCap>${totalSizeCap}</totalSizeCap>
+ 96 </rollingPolicy>
+ 97 <encoder>
+ 98 <pattern>${pattern}</pattern>
+ 99 </encoder>
+ 100 </appender>
+ 101 <appender class="ch.qos.logback.classic.AsyncAppender" name="asyncEELFDebug">
+ 102 <queueSize>${queueSize}</queueSize>
+ 103 <appender-ref ref="EELFDebug" />
+ 104 <includeCallerData>true</includeCallerData>
+ 105 </appender>
+ 106 <!-- ============================================================================ -->
+ 107 <!-- EELF loggers -->
+ 108 <!-- ============================================================================ -->
+ 109 <logger additivity="false" level="info" name="com.att.eelf">
+ 110 <appender-ref ref="asyncEELF" />
+ 111 <appender-ref ref="asyncEELFDebug" />
+ 112 </logger>
+ 113 <logger additivity="false" level="info" name="com.att.eelf.security">
+ 114 <appender-ref ref="asyncEELFSecurity" />
+ 115 </logger>
+ 116 <logger additivity="false" level="info" name="com.att.eelf.perf">
+ 117 <appender-ref ref="asyncEELFPerformance" />
+ 118 </logger>
+ 119 <logger additivity="false" level="info" name="com.att.eelf.server">
+ 120 <appender-ref ref="asyncEELFServer" />
+ 121 </logger>
+ 122 <logger additivity="false" level="info" name="com.att.eelf.policy">
+ 123 <appender-ref ref="asyncEELFPolicy" />
+ 124 </logger>
+ 125 <logger additivity="false" level="info" name="com.att.eelf.audit">
+ 126 <appender-ref ref="asyncEELFAudit" />
+ 127 </logger>
+ 128 <logger additivity="false" level="info" name="com.att.eelf.metrics">
+ 129 <appender-ref ref="asyncEELFMetrics" />
+ 130 </logger>
+ 131 <!-- Spring related loggers -->
+ 132 <logger level="WARN" name="org.springframework" />
+ 133 <logger level="WARN" name="org.springframework.beans" />
+ 134 <logger level="WARN" name="org.springframework.web" />
+ 135 <logger level="WARN" name="com.blog.spring.jms" />
+ 136 <logger level="INFO" name="com.att" />
+ 137 <!-- Other Loggers that may help troubleshoot -->
+ 138 <logger level="WARN" name="net.sf" />
+ 139 <logger level="WARN" name="org.apache.commons.httpclient" />
+ 140 <logger level="WARN" name="org.apache.commons" />
+ 141 <logger level="WARN" name="org.apache.coyote" />
+ 142 <logger level="WARN" name="org.apache.jasper" />
+ 143 <!-- Camel Related Loggers (including restlet/servlet/jaxrs/cxf logging.
+ 144 May aid in troubleshooting) -->
+ 145 <logger level="WARN" name="org.apache.camel" />
+ 146 <logger level="WARN" name="org.apache.cxf" />
+ 147 <logger level="WARN" name="org.apache.camel.processor.interceptor" />
+ 148 <logger level="WARN" name="org.apache.cxf.jaxrs.interceptor" />
+ 149 <logger level="WARN" name="org.apache.cxf.service" />
+ 150 <logger level="WARN" name="org.restlet" />
+ 151 <logger level="WARN" name="org.apache.camel.component.restlet" />
+ 152 <!-- logback internals logging -->
+ 153 <logger level="WARN" name="ch.qos.logback.classic" />
+ 154 <logger level="WARN" name="ch.qos.logback.core" />
+ 155 <root>
+ 156 <appender-ref ref="asyncEELF" />
+ 157 <!-- <appender-ref ref="asyncEELFDebug" /> -->
+ 158 </root>
+ 159 </configuration>