Revert "Renaming Files having BluePrint to have Blueprint"
[ccsdk/cds.git] / ms / blueprintsprocessor / functions / python-executor / src / main / kotlin / org / onap / ccsdk / cds / blueprintsprocessor / functions / python / executor / scripts / PythonExecutorConfiguration.kt
1 /*
2  * Copyright © 2017-2018 AT&T Intellectual Property.
3  *
4  * Modifications Copyright © 2019 IBM, Bell Canada.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *     http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18
19 package org.onap.ccsdk.cds.blueprintsprocessor.functions.python.executor.scripts
20
21 import org.springframework.beans.factory.annotation.Value
22 import org.springframework.boot.context.properties.EnableConfigurationProperties
23 import org.springframework.context.annotation.ComponentScan
24 import org.springframework.context.annotation.Configuration
25 import java.io.File
26 import java.util.Properties
27
28 @Deprecated("CDS won't support JythonService")
29 @Configuration
30 @ComponentScan
31 @EnableConfigurationProperties
32 open class PythonExecutorConfiguration
33
34 @Deprecated("CDS won't support JythonService")
35 @Configuration
36 open class PythonExecutorProperty {
37
38     @Value("\${blueprints.processor.functions.python.executor.executionPath}")
39     lateinit var executionPath: String
40
41     @Value("#{'\${blueprints.processor.functions.python.executor.modulePaths}'.split(',')}")
42     lateinit var modulePaths: List<String>
43 }
44
45 @Deprecated("CDS won't support JythonService")
46 class PythonExecutorConstants {
47
48     companion object {
49
50         const val INPUT_INSTANCE_DEPENDENCIES = "instance-dependencies"
51     }
52 }
53
54 @Deprecated("CDS won't support JythonService")
55 open class BluePrintPython(
56     executablePath: String,
57     blueprintPythonPlatform: MutableList<String>,
58     val argv: MutableList<String>
59 ) {
60
61     lateinit var moduleName: String
62     lateinit var pythonClassName: String
63     lateinit var content: String
64     var props: Properties = Properties()
65
66     init {
67         // Build up the python.path
68         val sb = StringBuilder()
69         sb.append(System.getProperty("java.class.path"))
70
71         for (p in blueprintPythonPlatform) {
72             sb.append(File.pathSeparator).append(p)
73         }
74
75         props["python.import.site"] = "true"
76         props.setProperty("python.path", sb.toString())
77         props.setProperty("python.verbose", "error")
78         props.setProperty("python.executable", executablePath)
79     }
80 }