diff options
Diffstat (limited to 'ansible-adapter')
4 files changed, 0 insertions, 277 deletions
diff --git a/ansible-adapter/ansible-adapter-lighty/pom.xml b/ansible-adapter/ansible-adapter-lighty/pom.xml deleted file mode 100755 index 166a7b82..00000000 --- a/ansible-adapter/ansible-adapter-lighty/pom.xml +++ /dev/null @@ -1,48 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.onap.ccsdk.parent</groupId> - <artifactId>binding-parent</artifactId> - <version>1.4.1-SNAPSHOT</version> - <relativePath/> - </parent> - - <groupId>org.onap.ccsdk.sli.adaptors</groupId> - <artifactId>ansible-adapter-lighty</artifactId> - <version>0.6.1-SNAPSHOT</version> - <packaging>jar</packaging> - - <name>ccsdk-sli-adaptors :: aai-service :: ${project.artifactId}</name> - <url>http://maven.apache.org</url> - - <properties> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - </properties> - - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.onap.ccsdk.sli.core</groupId> - <artifactId>ccsdk-lighty-dependency-versions</artifactId> - <version>${project.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - - <dependencies> - <dependency> - <groupId>io.lighty.core</groupId> - <artifactId>lighty-controller</artifactId> - </dependency> - <dependency> - <groupId>org.onap.ccsdk.sli.adaptors</groupId> - <artifactId>ansible-adapter-bundle</artifactId> - <version>${project.version}</version> - <scope>compile</scope> - </dependency> - </dependencies> -</project> diff --git a/ansible-adapter/ansible-adapter-lighty/src/main/java/org/onap/ccsdk/sli/adaptors/ansible/impl/AnsibleAdapterPropertiesProviderImplLighty.java b/ansible-adapter/ansible-adapter-lighty/src/main/java/org/onap/ccsdk/sli/adaptors/ansible/impl/AnsibleAdapterPropertiesProviderImplLighty.java deleted file mode 100755 index 9690cd61..00000000 --- a/ansible-adapter/ansible-adapter-lighty/src/main/java/org/onap/ccsdk/sli/adaptors/ansible/impl/AnsibleAdapterPropertiesProviderImplLighty.java +++ /dev/null @@ -1,176 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * onap - * ================================================================================ - * Copyright (C) 2016 - 2017 ONAP - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in 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.ccsdk.sli.adaptors.ansible.impl; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.Optional; -import java.util.Properties; -import java.util.Vector; -import org.onap.ccsdk.sli.adaptors.ansible.AnsibleAdapterPropertiesProvider; -import org.onap.ccsdk.sli.core.sli.ConfigurationException; -import org.onap.ccsdk.sli.core.utils.KarafRootFileResolver; -import org.onap.ccsdk.sli.core.utils.PropertiesFileResolver; -import org.onap.ccsdk.sli.core.utils.common.CoreDefaultFileResolver; -import org.onap.ccsdk.sli.core.utils.common.SdncConfigEnvVarFileResolver; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * THIS CLASS IS A COPY OF {@link AnsibleAdapterPropertiesProviderImpl} WITH REMOVED OSGi DEPENDENCIES - */ -public class AnsibleAdapterPropertiesProviderImplLighty implements AnsibleAdapterPropertiesProvider { - - private static final Logger LOG = LoggerFactory.getLogger(AnsibleAdapterPropertiesProviderImplLighty.class); - - /** - * The name of the properties file for database configuration - */ - private static final String ANSIBLEADAPTER_PROP_FILE_NAME = "ansible-adapter.properties"; - - /** - * A prioritized list of strategies for resolving sql-resource properties files. - */ - private Vector<PropertiesFileResolver> ansibleAdapterPropertiesFileResolvers = new Vector<>(); - - /** - * The configuration properties for the db connection. - */ - private Properties properties; - - /** - * Set up the prioritized list of strategies for resolving dblib properties - * files. - */ - public AnsibleAdapterPropertiesProviderImplLighty() { - ansibleAdapterPropertiesFileResolvers - .add(new SdncConfigEnvVarFileResolver("Using property file (1) from environment variable")); - ansibleAdapterPropertiesFileResolvers.add(new CoreDefaultFileResolver("Using property file (2) from default directory")); - - ansibleAdapterPropertiesFileResolvers.add(new KarafRootFileResolver("Using property file (4) from karaf root", this)); - - // determines properties file as according to the priority described in the - // class header comment - final File propertiesFile = determinePropertiesFile(this); - if (propertiesFile != null) { - try (FileInputStream fileInputStream = new FileInputStream(propertiesFile)) { - properties = new Properties(); - properties.load(fileInputStream); - } catch (final IOException e) { - LOG.error("Failed to load properties for file: {}", propertiesFile.toString(), - new ConfigurationException("Failed to load properties for file: " + propertiesFile.toString(), - e)); - } - } else { - // Try to read properties as resource - - InputStream propStr = getClass().getResourceAsStream("/" + ANSIBLEADAPTER_PROP_FILE_NAME); - if (propStr != null) { - properties = new Properties(); - try { - properties.load(propStr); - propStr.close(); - } catch (IOException e) { - properties = null; - } - } - - } - - if (properties == null) { - reportFailure("Missing configuration properties resource(3)", new ConfigurationException( - "Missing configuration properties resource(3): " + ANSIBLEADAPTER_PROP_FILE_NAME)); - - LOG.info("Defaulting org.onap.appc.adapter.ansible.clientType to TRUST_ALL"); - - properties = new Properties(); - properties.setProperty("org.onap.appc.adapter.ansible.clientType", "TRUST_ALL"); - } - } - - /** - * Extract svclogic config properties. - * - * @return the svclogic config properties - */ - public Properties getProperties() { - return properties; - } - - /** - * Reports the method chosen for properties resolution to the - * <code>Logger</code>. - * - * @param message - * Some user friendly message - * @param fileOptional - * The file location of the chosen properties file - * @return the file location of the chosen properties file - */ - private static File reportSuccess(final String message, final Optional<File> fileOptional) { - if (fileOptional.isPresent()) { - final File file = fileOptional.get(); - LOG.info("{} {}", message, file.getPath()); - return file; - } - return null; - } - - /** - * Reports fatal errors. This is the case in which no properties file could be - * found. - * - * @param message - * An appropriate fatal error message - * @param configurationException - * An exception describing what went wrong during resolution - */ - private static void reportFailure(final String message, final ConfigurationException configurationException) { - - LOG.error("{}", message, configurationException); - } - - /** - * Determines the sql-resource properties file to use based on the following priority: - * <ol> - * <li>A directory identified by the system environment variable - * <code>SDNC_CONFIG_DIR</code></li> - * <li>The default directory <code>DEFAULT_DBLIB_PROP_DIR</code></li> - * <li>A directory identified by the JRE argument - * <code>sql-resource.properties</code></li> - * <li>A <code>sql-resource.properties</code> file located in the karaf root - * directory</li> - * </ol> - */ - File determinePropertiesFile(final AnsibleAdapterPropertiesProviderImplLighty resourceProvider) { - - for (final PropertiesFileResolver sliPropertiesFileResolver : ansibleAdapterPropertiesFileResolvers) { - final Optional<File> fileOptional = sliPropertiesFileResolver.resolveFile(ANSIBLEADAPTER_PROP_FILE_NAME); - if (fileOptional.isPresent()) { - return reportSuccess(sliPropertiesFileResolver.getSuccessfulResolutionMessage(), fileOptional); - } - } - - return null; - } -} diff --git a/ansible-adapter/ansible-adapter-lighty/src/main/java/org/onap/ccsdk/sli/adaptors/ansible/lighty/AnsibleAdapterModule.java b/ansible-adapter/ansible-adapter-lighty/src/main/java/org/onap/ccsdk/sli/adaptors/ansible/lighty/AnsibleAdapterModule.java deleted file mode 100644 index ae49542b..00000000 --- a/ansible-adapter/ansible-adapter-lighty/src/main/java/org/onap/ccsdk/sli/adaptors/ansible/lighty/AnsibleAdapterModule.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * ============LICENSE_START========================================== - * Copyright (c) 2019 PANTHEON.tech s.r.o. - * =================================================================== - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in 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.ccsdk.sli.adaptors.ansible.lighty; - -import io.lighty.core.controller.api.AbstractLightyModule; -import org.onap.ccsdk.sli.adaptors.ansible.AnsibleAdapter; -import org.onap.ccsdk.sli.adaptors.ansible.impl.AnsibleAdapterImpl; -import org.onap.ccsdk.sli.adaptors.ansible.impl.AnsibleAdapterPropertiesProviderImplLighty; - -/** - * The implementation of the {@link io.lighty.core.controller.api.LightyModule} that manages and provides services from - * the ansible-adaptor artifact. - */ -public class AnsibleAdapterModule extends AbstractLightyModule { - - private AnsibleAdapterPropertiesProviderImplLighty ansibleProviderImpl; - private AnsibleAdapterImpl ansibleAdapterImpl; - - @Override - protected boolean initProcedure() { - this.ansibleProviderImpl = new AnsibleAdapterPropertiesProviderImplLighty(); - this.ansibleAdapterImpl = new AnsibleAdapterImpl(ansibleProviderImpl); - return true; - } - - @Override - protected boolean stopProcedure() { - return true; - } - - public AnsibleAdapterPropertiesProviderImplLighty getAnsibleAdapterPropertiesProviderImpl() { - return this.ansibleProviderImpl; - } - - public AnsibleAdapter getAnsibleAdapterImpl() { - return ansibleAdapterImpl; - } -} diff --git a/ansible-adapter/pom.xml b/ansible-adapter/pom.xml index 7ffac67e..8ab564a7 100644 --- a/ansible-adapter/pom.xml +++ b/ansible-adapter/pom.xml @@ -185,6 +185,5 @@ <module>ansible-adapter-bundle</module> <module>ansible-adapter-features</module> <module>ansible-adapter-installer</module> - <module>ansible-adapter-lighty</module> </modules> </project> |