c62694213a03ba8ca46671d4da08ea614596ed7f
[ccsdk/cds.git] /
1 /*
2 ============LICENSE_START==========================================
3 ===================================================================
4 Copyright (C) 2019 Orange. All rights reserved.
5 ===================================================================
6
7 Unless otherwise specified, all software contained herein is licensed
8 under the Apache License, Version 2.0 (the License);
9 you may not use this software except in compliance with the License.
10 You may obtain a copy of the License at
11
12     http://www.apache.org/licenses/LICENSE-2.0
13
14 Unless required by applicable law or agreed to in writing, software
15 distributed under the License is distributed on an "AS IS" BASIS,
16 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 See the License for the specific language governing permissions and
18 limitations under the License.
19 ============LICENSE_END============================================
20 */
21
22
23 export class MetaDataTabModel {
24
25     mode: string;
26     name: string;
27     description: string;
28     version: string;
29     tags: string;
30     mapOfCustomKey: Map<string, string> = new Map<string, string>();
31     entryFileName: string;
32     templateName: string;
33
34 }
35
36 /*TOSCA-Meta-File-Version: 1.0.0
37 CSAR-Version: 1.0
38 Created-By: PLATANIA, MARCO <platania@research.att.com>
39 Entry-Definitions: Definitions/vLB_CDS.json
40 Template-Name: baseconfiguration
41 Template-Version: 1.0.0
42 Template-Type: DEFAULT
43 Template-Tags: vDNS-CDS-test1
44 Content-Type: application/vnd.oasis.bpmn*/
45
46 export class MetaDataFile {
47
48     static getObjectInstance(metaDataTab: MetaDataTabModel): string {
49         return 'TOSCA-Meta-File-Version: 1.0.0\n' +
50             'CSAR-Version: 1.0\n' +
51             'Created-By: Shaaban Ebrahim <shaaban.eltanany.ext@orange.con>\n' +
52             'Entry-Definitions:' + metaDataTab.entryFileName + '\n' +
53             'Template-Name:' + metaDataTab.name + '\n' +
54             'Template-Version:' + metaDataTab.version + '\n' +
55             'Template-Type: ' + metaDataTab.mode + '\n' +
56             'Template-Tags:' + metaDataTab.tags;
57
58     }
59
60 }
61
62
63 export interface FolderNodes {
64     name: string;
65     children?: FolderNodes[];
66 }
67
68 export class FolderNodeElement {
69     TREE_DATA: FolderNodes[] = [
70         {
71             name: 'Definitions',
72             children: [
73                 {name: 'activation-blueprint.json'},
74                 {name: 'artifacts_types.json'},
75                 {name: 'data_types.json'},
76                 {name: 'vLB_CDS.json'},
77             ]
78         },
79         {
80             name: 'Scripts',
81             children: [
82                 {
83                     name: 'kotlin',
84                     children: [
85                         {name: 'ScriptComponent.cba.kts'},
86                         {name: 'ResourceAssignmentProcessor.cba.kts'},
87                     ]
88                 }
89             ]
90         },
91         {
92             name: 'Templates',
93             children: [
94                 {
95                     name: 'baseconfig-template'
96                 }
97             ]
98         },
99         {
100             name: 'TOSCA-Metadata',
101             children: [
102                 {
103                     name: 'TOSCA.meta'
104                 }
105             ]
106         },
107     ];
108 }
109
110 export class FilesContent {
111
112     public static mapOfFilesNamesAndContent: Map<string, string> = new Map<string, string>();
113
114     public static getMapOfFilesNamesAndContent(): Map<string, string> {
115         return FilesContent.mapOfFilesNamesAndContent;
116     }
117
118     public static putData(fileName: string, content: string) {
119         FilesContent.mapOfFilesNamesAndContent.set(fileName, content);
120     }
121 }