summaryrefslogtreecommitdiffstats
path: root/sli
diff options
context:
space:
mode:
authorTimoney, Dan (dt5972) <dtimoney@att.com>2019-08-29 11:11:24 -0400
committerTimoney, Dan (dt5972) <dtimoney@att.com>2019-08-29 11:12:11 -0400
commite1b15a3b62259a0a7e8da3561b044dabf3c5e9d4 (patch)
tree950be407a977db8174d98b62bebef86e3b84b150 /sli
parentc4ed9e1fce217d171afd569676e625b0be51cbfb (diff)
Revert "Proposal to remove OSGi dependencies from the CCSDK project"
This reverts commit 85041dd8795b84a48d0b48dd746bfbcb230c8794. This needs to be reverted due to insufficient testing (no jUnit tests provided) Change-Id: I011f3eb7ab27ba9946f04d4d528dd4d91b593685 Signed-off-by: Timoney, Dan (dt5972) <dtimoney@att.com>
Diffstat (limited to 'sli')
-rwxr-xr-xsli/lighty/pom.xml47
-rw-r--r--sli/lighty/src/main/java/org/onap/ccsdk/sli/core/sli/lighty/SliModule.java77
-rw-r--r--sli/lighty/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicAdaptorFactoryLighty.java53
-rw-r--r--sli/lighty/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicClassResolverLighty.java51
-rw-r--r--sli/lighty/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicPropertiesProviderImplLighty.java172
-rwxr-xr-xsli/lighty/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicServiceImplLighty.java110
-rwxr-xr-xsli/pom.xml1
7 files changed, 0 insertions, 511 deletions
diff --git a/sli/lighty/pom.xml b/sli/lighty/pom.xml
deleted file mode 100755
index 74581a10..00000000
--- a/sli/lighty/pom.xml
+++ /dev/null
@@ -1,47 +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.core</groupId>
- <artifactId>sli-lighty</artifactId>
- <version>0.6.1-SNAPSHOT</version>
- <packaging>jar</packaging>
-
- <name>ccsdk-sli-core :: sli :: ${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.core</groupId>
- <artifactId>sli-provider</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
-</project>
diff --git a/sli/lighty/src/main/java/org/onap/ccsdk/sli/core/sli/lighty/SliModule.java b/sli/lighty/src/main/java/org/onap/ccsdk/sli/core/sli/lighty/SliModule.java
deleted file mode 100644
index d4846932..00000000
--- a/sli/lighty/src/main/java/org/onap/ccsdk/sli/core/sli/lighty/SliModule.java
+++ /dev/null
@@ -1,77 +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.core.sli.lighty;
-
-import io.lighty.core.controller.api.AbstractLightyModule;
-import org.onap.ccsdk.sli.core.dblib.DbLibService;
-import org.onap.ccsdk.sli.core.sli.SvcLogicAdaptor;
-import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
-import org.onap.ccsdk.sli.core.sli.SvcLogicRecorder;
-import org.onap.ccsdk.sli.core.sli.SvcLogicResource;
-import org.onap.ccsdk.sli.core.sli.provider.SvcLogicClassResolverLighty;
-import org.onap.ccsdk.sli.core.sli.provider.SvcLogicPropertiesProviderImpl;
-import org.onap.ccsdk.sli.core.sli.provider.SvcLogicService;
-import org.onap.ccsdk.sli.core.sli.provider.SvcLogicServiceImplLighty;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * The implementation of the {@link io.lighty.core.controller.api.LightyModule} that manages and provides services from
- * the sli-provider artifact.
- */
-public class SliModule extends AbstractLightyModule {
-
- private static final Logger LOG = LoggerFactory.getLogger(SliModule.class);
-
- private final DbLibService dbLibService;
- private final SvcLogicResource svcLogicResource;
- private final SvcLogicRecorder svcLogicRecorder;
- private final SvcLogicJavaPlugin svcLogicJavaPlugin;
- private final SvcLogicAdaptor svcLogicAdaptor;
-
- private SvcLogicPropertiesProviderImpl svcLogicPropertiesImpl;
- private SvcLogicServiceImplLighty svcLogicImpl;
- private SvcLogicClassResolverLighty svcLogicClassResolver;
-
- public SliModule(DbLibService dbLibService, SvcLogicResource svcLogicResource, SvcLogicRecorder svcLogicRecorder,
- SvcLogicJavaPlugin svcLogicJavaPlugin, SvcLogicAdaptor svcLogicAdaptor) {
- this.dbLibService = dbLibService;
- this.svcLogicResource = svcLogicResource;
- this.svcLogicRecorder = svcLogicRecorder;
- this.svcLogicJavaPlugin = svcLogicJavaPlugin;
- this.svcLogicAdaptor = svcLogicAdaptor;
- }
-
- @Override
- protected boolean initProcedure() {
- this.svcLogicPropertiesImpl = new SvcLogicPropertiesProviderImpl();
- this.svcLogicClassResolver = new SvcLogicClassResolverLighty(svcLogicResource, svcLogicRecorder,
- svcLogicJavaPlugin, svcLogicAdaptor);
- this.svcLogicImpl = new SvcLogicServiceImplLighty(this.svcLogicPropertiesImpl, dbLibService,
- svcLogicClassResolver);
- return true;
- }
-
- @Override
- protected boolean stopProcedure() {
- return true;
- }
-
- public SvcLogicService getSvcLogicServiceImpl() {
- return this.svcLogicImpl;
- }
-}
diff --git a/sli/lighty/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicAdaptorFactoryLighty.java b/sli/lighty/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicAdaptorFactoryLighty.java
deleted file mode 100644
index d60e4311..00000000
--- a/sli/lighty/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicAdaptorFactoryLighty.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : CCSDK
- * ================================================================================
- * 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.ccsdk.sli.core.sli.provider;
-
-import java.util.HashMap;
-import org.onap.ccsdk.sli.core.sli.SvcLogicAdaptor;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * THIS CLASS IS A COPY OF {@link SvcLogicAdaptorFactory} WITH REMOVED OSGi DEPENDENCIES
- */
-public class SvcLogicAdaptorFactoryLighty {
-
- private static final Logger LOG = LoggerFactory
- .getLogger(SvcLogicAdaptorFactoryLighty.class);
-
- private static HashMap<String, SvcLogicAdaptor> adaptorMap = new HashMap<>();
-
- public static void registerAdaptor(SvcLogicAdaptor adaptor) {
- String name = adaptor.getClass().getName();
- LOG.info("Registering adaptor " + name);
- adaptorMap.put(name, adaptor);
-
- }
-
- public static void unregisterAdaptor(String name) {
- if (adaptorMap.containsKey(name)) {
- LOG.info("Unregistering " + name);
- adaptorMap.remove(name);
- }
- }
-
-}
diff --git a/sli/lighty/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicClassResolverLighty.java b/sli/lighty/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicClassResolverLighty.java
deleted file mode 100644
index 7b730a8e..00000000
--- a/sli/lighty/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicClassResolverLighty.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package org.onap.ccsdk.sli.core.sli.provider;
-
-import org.onap.ccsdk.sli.core.sli.SvcLogicAdaptor;
-import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
-import org.onap.ccsdk.sli.core.sli.SvcLogicRecorder;
-import org.onap.ccsdk.sli.core.sli.SvcLogicResource;
-import org.onap.ccsdk.sli.core.sli.provider.base.SvcLogicResolver;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * THIS CLASS IS A COPY OF {@link SvcLogicClassResolver} WITH REMOVED OSGi DEPENDENCIES
- */
-public class SvcLogicClassResolverLighty implements SvcLogicResolver {
-
- private static final Logger LOG = LoggerFactory.getLogger(SvcLogicClassResolverLighty.class);
-
- private final SvcLogicResource svcLogicResource;
- private final SvcLogicRecorder svcLogicRecorder;
- private final SvcLogicJavaPlugin svcLogicJavaPlugin;
- private final SvcLogicAdaptor svcLogicAdaptor;
-
- public SvcLogicClassResolverLighty(SvcLogicResource svcLogicResource, SvcLogicRecorder svcLogicRecorder,
- SvcLogicJavaPlugin svcLogicJavaPlugin, SvcLogicAdaptor svcLogicAdaptor) {
- this.svcLogicResource = svcLogicResource;
- this.svcLogicRecorder = svcLogicRecorder;
- this.svcLogicJavaPlugin = svcLogicJavaPlugin;
- this.svcLogicAdaptor = svcLogicAdaptor;
- }
-
- @Override
- public SvcLogicResource getSvcLogicResource(String resourceName) {
- return svcLogicResource;
- }
-
- @Override
- public SvcLogicRecorder getSvcLogicRecorder(String recorderName) {
- return svcLogicRecorder;
- }
-
- @Override
- public SvcLogicJavaPlugin getSvcLogicJavaPlugin(String pluginName) {
- return svcLogicJavaPlugin;
- }
-
- @Override
- public SvcLogicAdaptor getSvcLogicAdaptor(String adaptorName) {
- return svcLogicAdaptor;
- }
-
-}
diff --git a/sli/lighty/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicPropertiesProviderImplLighty.java b/sli/lighty/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicPropertiesProviderImplLighty.java
deleted file mode 100644
index dfc5855f..00000000
--- a/sli/lighty/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicPropertiesProviderImplLighty.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * onap
- * ================================================================================
- * Copyright (C) 2016 - 2017 ONAP
- * Modifications Copyright (C) 2018 IBM.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in 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.core.sli.provider;
-
-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.core.sli.ConfigurationException;
-import org.onap.ccsdk.sli.core.sli.provider.base.SvcLogicPropertiesProvider;
-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 SvcLogicPropertiesProviderImpl} WITH REMOVED OSGi DEPENDENCIES
- */
-public class SvcLogicPropertiesProviderImplLighty implements SvcLogicPropertiesProvider {
-
- private static final Logger log = LoggerFactory.getLogger(SvcLogicPropertiesProviderImplLighty.class);
-
- /**
- * The name of the properties file for database configuration
- */
- private static final String SVCLOGIC_PROP_FILE_NAME = "svclogic.properties";
-
- /**
- * A prioritized list of strategies for resolving dblib properties files.
- */
- private Vector<PropertiesFileResolver> sliPropertiesFileResolvers = 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 SvcLogicPropertiesProviderImplLighty() {
- sliPropertiesFileResolvers
- .add(new SdncConfigEnvVarFileResolver("Using property file (1) from environment variable"));
- sliPropertiesFileResolvers.add(new CoreDefaultFileResolver("Using property file (2) from default directory"));
- sliPropertiesFileResolvers.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("/" + SVCLOGIC_PROP_FILE_NAME);
- if (propStr != null) {
- properties = new Properties();
- try {
- properties.load(propStr);
- propStr.close();
- } catch (IOException e) {
- log.error("IO Exception",e);
- properties = null;
- }
- }
-
- }
-
- if (properties == null) {
- reportFailure("Missing configuration properties resource(3)", new ConfigurationException(
- "Missing configuration properties resource(3): " + SVCLOGIC_PROP_FILE_NAME));
- }
- }
-
- /**
- * 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 dblib 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>dblib.properties</code></li>
- * <li>A <code>dblib.properties</code> file located in the karaf root
- * directory</li>
- * </ol>
- */
- File determinePropertiesFile(final SvcLogicPropertiesProviderImplLighty resourceProvider) {
-
- for (final PropertiesFileResolver sliPropertiesFileResolver : sliPropertiesFileResolvers) {
- final Optional<File> fileOptional = sliPropertiesFileResolver.resolveFile(SVCLOGIC_PROP_FILE_NAME);
- if (fileOptional.isPresent()) {
- return reportSuccess(sliPropertiesFileResolver.getSuccessfulResolutionMessage(), fileOptional);
- }
- }
-
- return null;
- }
-}
diff --git a/sli/lighty/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicServiceImplLighty.java b/sli/lighty/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicServiceImplLighty.java
deleted file mode 100755
index b9740c58..00000000
--- a/sli/lighty/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicServiceImplLighty.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : CCSDK
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * Modifications Copyright (C) 2018 IBM.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in 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.core.sli.provider;
-
-import java.util.Properties;
-import org.onap.ccsdk.sli.core.dblib.DbLibService;
-import org.onap.ccsdk.sli.core.sli.ConfigurationException;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.core.sli.SvcLogicDblibStore;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import org.onap.ccsdk.sli.core.sli.SvcLogicGraph;
-import org.onap.ccsdk.sli.core.sli.SvcLogicStore;
-import org.onap.ccsdk.sli.core.sli.SvcLogicStoreFactory;
-import org.onap.ccsdk.sli.core.sli.provider.base.SvcLogicPropertiesProvider;
-import org.onap.ccsdk.sli.core.sli.provider.base.SvcLogicResolver;
-import org.onap.ccsdk.sli.core.sli.provider.base.SvcLogicServiceImplBase;
-import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.slf4j.MDC;
-
-/**
- * THIS CLASS IS A COPY OF {@link SvcLogicServiceImpl} WITH REMOVED OSGi DEPENDENCIES
- */
-public class SvcLogicServiceImplLighty extends SvcLogicServiceImplBase implements SvcLogicService {
-
- private static final Logger LOG = LoggerFactory.getLogger(SvcLogicServiceImplLighty.class);
-
- public SvcLogicServiceImplLighty(SvcLogicPropertiesProvider resourceProvider, DbLibService dbSvc,
- SvcLogicResolver resolver) {
- super(null);
- this.resolver = resolver;
- properties = resourceProvider.getProperties();
- this.store = new SvcLogicDblibStore(dbSvc);
- }
-
- @Override
- public Properties execute(String module, String rpc, String version, String mode, Properties props)
- throws SvcLogicException {
- return (execute(module, rpc, version, mode, props, null));
- }
-
- @Override
- public Properties execute(String module, String rpc, String version, String mode, Properties props,
- DOMDataBroker domDataBroker) throws SvcLogicException {
- LOG.info("Fetching service logic from data store");
- SvcLogicGraph graph = store.fetch(module, rpc, version, mode);
-
- if (graph == null) {
- Properties retProps = new Properties();
- retProps.setProperty("error-code", "401");
- retProps.setProperty("error-message",
- "No service logic found for [" + module + "," + rpc + "," + version + "," + mode + "]");
- return (retProps);
- }
-
- SvcLogicContext ctx = new SvcLogicContext(props);
- ctx.setAttribute(CURRENT_GRAPH, graph.toString());
- ctx.setAttribute("X-ECOMP-RequestID", MDC.get("X-ECOMP-RequestID"));
- ctx.setDomDataBroker(domDataBroker);
- execute(graph, ctx);
- return (ctx.toProperties());
- }
-
- @Override
- public SvcLogicStore getStore() throws SvcLogicException {
- // Create and initialize SvcLogicStore object - used to access
- // saved service logic.
- if (store != null) {
- return store;
- }
-
- try {
- store = SvcLogicStoreFactory.getSvcLogicStore(properties);
- } catch (Exception e) {
- throw new ConfigurationException("Could not get service logic store", e);
-
- }
-
- try {
- store.init(properties);
- } catch (SvcLogicException e) {
- throw new ConfigurationException("Could not get service logic store", e);
- }
-
- return store;
- }
-
-}
diff --git a/sli/pom.xml b/sli/pom.xml
index add94ce9..91c52020 100755
--- a/sli/pom.xml
+++ b/sli/pom.xml
@@ -28,6 +28,5 @@
<module>recording</module>
<module>features</module>
<module>installer</module>
- <module>lighty</module>
</modules>
</project>