diff options
Diffstat (limited to 'appc-dg/appc-dg-shared/appc-dg-mdsal-store/appc-dg-mdsal-bundle/src/main/java/org/onap')
5 files changed, 43 insertions, 29 deletions
diff --git a/appc-dg/appc-dg-shared/appc-dg-mdsal-store/appc-dg-mdsal-bundle/src/main/java/org/onap/appc/mdsal/impl/Constants.java b/appc-dg/appc-dg-shared/appc-dg-mdsal-store/appc-dg-mdsal-bundle/src/main/java/org/onap/appc/mdsal/impl/Constants.java index 908c42cb1..ba88be5a2 100644 --- a/appc-dg/appc-dg-shared/appc-dg-mdsal-store/appc-dg-mdsal-bundle/src/main/java/org/onap/appc/mdsal/impl/Constants.java +++ b/appc-dg/appc-dg-shared/appc-dg-mdsal-store/appc-dg-mdsal-bundle/src/main/java/org/onap/appc/mdsal/impl/Constants.java @@ -5,6 +5,8 @@ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Copyright (C) 2017 Amdocs + * ================================================================================ + * Modifications (C) 2019 Ericsson * ============================================================================= * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,47 +34,47 @@ public class Constants { /** * Manifest attribute for OSGI Bundle Name */ - public static final String MANIFEST_ATTR_BUNDLE_NAME= "Bundle-Name"; + public static final String MANIFEST_ATTR_BUNDLE_NAME = "Bundle-Name"; /** * Manifest attribute for OSGI Bundle Symbolic Name */ - public static final String MANIFEST_ATTR_BUNDLE_SYMBOLIC_NAME= "Bundle-SymbolicName"; + public static final String MANIFEST_ATTR_BUNDLE_SYMBOLIC_NAME = "Bundle-SymbolicName"; /** * Manifest attribute for OSGI Bundle Description */ - public static final String MANIFEST_ATTR_BUNDLE_DESCRIPTION= "Bundle-Description"; + public static final String MANIFEST_ATTR_BUNDLE_DESCRIPTION = "Bundle-Description"; /** * Manifest attribute for OSGI Bundle Manifest version */ - public static final String MANIFEST_ATTR_BUNDLE_MANIFEST_VERSION= "Bundle-ManifestVersion"; + public static final String MANIFEST_ATTR_BUNDLE_MANIFEST_VERSION = "Bundle-ManifestVersion"; /** * Manifest attribute for OSGI Bundle Version */ - public static final String MANIFEST_ATTR_BUNDLE_VERSION= "Bundle-Version"; + public static final String MANIFEST_ATTR_BUNDLE_VERSION = "Bundle-Version"; /** * Manifest attribute for OSGI Bundle Blueprint */ - public static final String MANIFEST_ATTR_BUNDLE_BLUEPRINT= "Bundle-Blueprint"; + public static final String MANIFEST_ATTR_BUNDLE_BLUEPRINT = "Bundle-Blueprint"; /** * Manifest value for Mainfest Version */ - public static final String MANIFEST_VALUE_VERSION= "1.0"; + public static final String MANIFEST_VALUE_VERSION = "1.0"; /** * Manifest value for OSGI Bundle Vesion */ - public static final String MANIFEST_VALUE_BUNDLE_MAN_VERSION= "2"; + public static final String MANIFEST_VALUE_BUNDLE_MAN_VERSION = "2"; /** * Manifest value for OSGI Bundle Blueprint location */ - public static final String MANIFEST_VALUE_BUNDLE_BLUEPRINT= "OSGI-INF/blueprint/blueprint.xml"; + public static final String MANIFEST_VALUE_BUNDLE_BLUEPRINT = "OSGI-INF/blueprint/blueprint.xml"; /** * Base URL for config actions exposed by RESTCONF API @@ -110,12 +112,12 @@ public class Constants { /** * HTTP Header attribute for Content type - JSON */ - public static final String OPERATION_APPLICATION_JSON= " application/json"; + public static final String OPERATION_APPLICATION_JSON = " application/json"; /** * HTTP protocol used for config operations */ - public static final String OPERATION_HTTPS= "https"; + public static final String OPERATION_HTTPS = "https"; /** * Constant for backslash to be used while formatting URL diff --git a/appc-dg/appc-dg-shared/appc-dg-mdsal-store/appc-dg-mdsal-bundle/src/main/java/org/onap/appc/mdsal/impl/MDSALStoreImpl.java b/appc-dg/appc-dg-shared/appc-dg-mdsal-store/appc-dg-mdsal-bundle/src/main/java/org/onap/appc/mdsal/impl/MDSALStoreImpl.java index 2ef1da36e..8f7bfabac 100644 --- a/appc-dg/appc-dg-shared/appc-dg-mdsal-store/appc-dg-mdsal-bundle/src/main/java/org/onap/appc/mdsal/impl/MDSALStoreImpl.java +++ b/appc-dg/appc-dg-shared/appc-dg-mdsal-store/appc-dg-mdsal-bundle/src/main/java/org/onap/appc/mdsal/impl/MDSALStoreImpl.java @@ -5,6 +5,8 @@ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Copyright (C) 2017 Amdocs + * ================================================================================ + * Modifications (C) 2019 Ericsson * ============================================================================= * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -83,7 +85,7 @@ public class MDSALStoreImpl implements MDSALStore { } if (configUrl != null) { try { - client = new RestClientInvoker(new URL(configUrl)); + client = getRestClientInvoker(new URL(configUrl)); client.setAuthentication(user, password); } catch (MalformedURLException e) { logger.error("Error initializing RestConf client: " + e.getMessage(), e); @@ -187,7 +189,7 @@ public class MDSALStoreImpl implements MDSALStore { URL configUrl = new URL(properties.getProperty(Constants.CONFIG_URL_PROPERTY, Constants.CONFIG_URL_DEFAULT)); String user = properties.getProperty(Constants.CONFIG_USER_PROPERTY); String password = properties.getProperty(Constants.CONFIG_PASS_PROPERTY); - RestClientInvoker remoteClient = new RestClientInvoker(new URL(configUrl.getProtocol(), leader, configUrl.getPort(), "")); + RestClientInvoker remoteClient = getRestClientInvoker(new URL(configUrl.getProtocol(), leader, configUrl.getPort(), "")); remoteClient.setAuthentication(user, password); remoteClientMap.put(leader, remoteClient); return remoteClient; @@ -350,4 +352,8 @@ public class MDSALStoreImpl implements MDSALStore { throw new MDSALStoreException(e); } } + + protected RestClientInvoker getRestClientInvoker(URL configUrl) throws MalformedURLException { + return new RestClientInvoker(configUrl); + } } diff --git a/appc-dg/appc-dg-shared/appc-dg-mdsal-store/appc-dg-mdsal-bundle/src/main/java/org/onap/appc/mdsal/objects/BundleInfo.java b/appc-dg/appc-dg-shared/appc-dg-mdsal-store/appc-dg-mdsal-bundle/src/main/java/org/onap/appc/mdsal/objects/BundleInfo.java index 2f11b887b..13999299b 100644 --- a/appc-dg/appc-dg-shared/appc-dg-mdsal-store/appc-dg-mdsal-bundle/src/main/java/org/onap/appc/mdsal/objects/BundleInfo.java +++ b/appc-dg/appc-dg-shared/appc-dg-mdsal-store/appc-dg-mdsal-bundle/src/main/java/org/onap/appc/mdsal/objects/BundleInfo.java @@ -5,6 +5,8 @@ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Copyright (C) 2017 Amdocs + * ================================================================================ + * Modifications (C) 2019 Ericsson * ============================================================================= * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +38,7 @@ package org.onap.appc.mdsal.objects; * Creates an object of BundleInfo with version initialized to 1 */ public BundleInfo(){ - version =1; + version = 1; } public String getName() { diff --git a/appc-dg/appc-dg-shared/appc-dg-mdsal-store/appc-dg-mdsal-bundle/src/main/java/org/onap/appc/mdsal/operation/ConfigOperationRequestFormatter.java b/appc-dg/appc-dg-shared/appc-dg-mdsal-store/appc-dg-mdsal-bundle/src/main/java/org/onap/appc/mdsal/operation/ConfigOperationRequestFormatter.java index 5ebe58b88..e565f2052 100644 --- a/appc-dg/appc-dg-shared/appc-dg-mdsal-store/appc-dg-mdsal-bundle/src/main/java/org/onap/appc/mdsal/operation/ConfigOperationRequestFormatter.java +++ b/appc-dg/appc-dg-shared/appc-dg-mdsal-store/appc-dg-mdsal-bundle/src/main/java/org/onap/appc/mdsal/operation/ConfigOperationRequestFormatter.java @@ -5,6 +5,8 @@ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Copyright (C) 2017 Amdocs + * ================================================================================ + * Modifications (C) 2019 Ericsson * ============================================================================= * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,7 +41,7 @@ public class ConfigOperationRequestFormatter { */ public String buildPath(String module, String containerName , String... subModules ) { - StringBuilder path = new StringBuilder( Constants.CONFIG_PATH + Constants.URL_BACKSLASH + module + ":"+containerName + Constants.URL_BACKSLASH); + StringBuilder path = new StringBuilder( Constants.CONFIG_PATH + Constants.URL_BACKSLASH + module + ":" + containerName + Constants.URL_BACKSLASH); if(subModules.length >0){ for(String subModule : subModules){ path.append(subModule); diff --git a/appc-dg/appc-dg-shared/appc-dg-mdsal-store/appc-dg-mdsal-bundle/src/main/java/org/onap/appc/mdsal/provider/MdsalStoreProvider.java b/appc-dg/appc-dg-shared/appc-dg-mdsal-store/appc-dg-mdsal-bundle/src/main/java/org/onap/appc/mdsal/provider/MdsalStoreProvider.java index 18ff52242..545bd32a9 100644 --- a/appc-dg/appc-dg-shared/appc-dg-mdsal-store/appc-dg-mdsal-bundle/src/main/java/org/onap/appc/mdsal/provider/MdsalStoreProvider.java +++ b/appc-dg/appc-dg-shared/appc-dg-mdsal-store/appc-dg-mdsal-bundle/src/main/java/org/onap/appc/mdsal/provider/MdsalStoreProvider.java @@ -5,6 +5,8 @@ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Copyright (C) 2017 Amdocs + * ================================================================================ + * Modifications (C) 2019 Ericsson * ============================================================================= * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,9 +25,15 @@ package org.onap.appc.mdsal.provider; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; -import com.google.common.util.concurrent.Futures; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import org.onap.appc.Constants; +import org.onap.appc.mdsal.MDSALStore; +import org.onap.appc.mdsal.impl.MDSALStoreFactory; +import org.onap.appc.mdsal.objects.BundleInfo; import org.opendaylight.controller.md.sal.binding.api.DataBroker; import org.opendaylight.controller.sal.binding.api.BindingAwareBroker; import org.opendaylight.controller.sal.binding.api.NotificationProviderService; @@ -38,16 +46,9 @@ import org.opendaylight.yang.gen.v1.org.onap.appc.mdsal.store.rev170925.response import org.opendaylight.yang.gen.v1.org.onap.appc.mdsal.store.rev170925.response.StatusBuilder; import org.opendaylight.yangtools.yang.common.RpcResult; import org.opendaylight.yangtools.yang.common.RpcResultBuilder; -import org.onap.appc.Constants; -import org.onap.appc.mdsal.MDSALStore; -import org.onap.appc.mdsal.impl.MDSALStoreFactory; -import org.onap.appc.mdsal.objects.BundleInfo; - -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; +import com.google.common.util.concurrent.Futures; public class MdsalStoreProvider implements MdsalStoreService ,AutoCloseable{ @@ -90,7 +91,8 @@ public class MdsalStoreProvider implements MdsalStoreService ,AutoCloseable{ @Override public Future<RpcResult<StoreYangOutput>> storeYang(StoreYangInput input) { - Status status =null;String message=null; + Status status = null; + String message = null; try{ BundleInfo bundleInfo = new BundleInfo(); bundleInfo.setName(input.getModuleName()); |