TCA: Support for VES/A&AI enrichment
[dcaegen2/analytics/tca.git] / dcae-analytics-cdap-plugins / pom.xml
1 <?xml version="1.0" encoding="UTF-8"?>\r
2 <!--\r
3   ~ ===============================LICENSE_START======================================\r
4   ~  dcae-analytics\r
5   ~ ================================================================================\r
6   ~    Copyright © 2017 AT&T Intellectual Property. All rights reserved.\r
7   ~ ================================================================================\r
8   ~  Licensed under the Apache License, Version 2.0 (the "License");\r
9   ~  you may not use this file except in compliance with the License.\r
10   ~   You may obtain a copy of the License at\r
11   ~\r
12   ~          http://www.apache.org/licenses/LICENSE-2.0\r
13   ~\r
14   ~  Unless required by applicable law or agreed to in writing, software\r
15   ~  distributed under the License is distributed on an "AS IS" BASIS,\r
16   ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
17   ~  See the License for the specific language governing permissions and\r
18   ~  limitations under the License.\r
19   ~  ============================LICENSE_END===========================================\r
20   -->\r
21 \r
22 <project xmlns="http://maven.apache.org/POM/4.0.0"\r
23          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
24          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">\r
25 \r
26     <modelVersion>4.0.0</modelVersion>\r
27 \r
28     <parent>\r
29         <artifactId>dcae-analytics</artifactId>\r
30         <groupId>org.onap.dcaegen2.analytics.tca</groupId>\r
31         <version>2.0.0-SNAPSHOT</version>\r
32     </parent>\r
33 \r
34     <artifactId>dcae-analytics-cdap-plugins</artifactId>\r
35     <packaging>jar</packaging>\r
36 \r
37     <!-- THIS MODULE CONTAINS CDAP CODE FOR PLUGINS -->\r
38     <name>DCAE Analytics CDAP Plugins</name>\r
39     <description>DCAE Analytics CDAP Plugins to build CDAP Pipelines</description>\r
40 \r
41     <properties>\r
42         <main.basedir>${project.parent.basedir}</main.basedir>\r
43         <main.basedir.plugins>${project.basedir}</main.basedir.plugins>\r
44         <widgets.dir>widgets</widgets.dir>\r
45         <docs.dir>docs</docs.dir>\r
46         <app.parents>\r
47             system:cdap-etl-batch[4.0.0,4.1.0-SNAPSHOT),system:cdap-etl-realtime[4.0.0,4.1.0-SNAPSHOT),system:cdap-data-pipeline[4.0.0,4.1.0-SNAPSHOT),system:cdap-data-streams[4.0.0,4.1.0-SNAPSHOT)\r
48         </app.parents>\r
49     </properties>\r
50 \r
51     <dependencies>\r
52 \r
53         <!-- DCAE DEPENDENCIES -->\r
54         <dependency>\r
55             <groupId>org.onap.dcaegen2.analytics.tca</groupId>\r
56             <artifactId>dcae-analytics-cdap-common</artifactId>\r
57             <version>2.0.0-SNAPSHOT</version>\r
58         </dependency>\r
59 \r
60         <dependency>\r
61             <groupId>org.onap.dcaegen2.analytics.tca</groupId>\r
62             <artifactId>dcae-analytics-tca</artifactId>\r
63             <version>2.0.0-SNAPSHOT</version>\r
64         </dependency>\r
65 \r
66 \r
67         <!-- CDAP -->\r
68         <dependency>\r
69             <groupId>co.cask.cdap</groupId>\r
70             <artifactId>cdap-api</artifactId>\r
71         </dependency>\r
72 \r
73         <dependency>\r
74             <groupId>co.cask.cdap</groupId>\r
75             <artifactId>cdap-etl-api</artifactId>\r
76         </dependency>\r
77 \r
78         <dependency>\r
79             <groupId>co.cask.cdap</groupId>\r
80             <artifactId>cdap-etl-api-spark</artifactId>\r
81         </dependency>\r
82 \r
83         <dependency>\r
84             <groupId>co.cask.cdap</groupId>\r
85             <artifactId>cdap-etl-realtime</artifactId>\r
86         </dependency>\r
87 \r
88         <dependency>\r
89             <groupId>co.cask.cdap</groupId>\r
90             <artifactId>cdap-data-pipeline</artifactId>\r
91         </dependency>\r
92 \r
93         <dependency>\r
94             <groupId>co.cask.cdap</groupId>\r
95             <artifactId>cdap-data-streams</artifactId>\r
96         </dependency>\r
97 \r
98         <dependency>\r
99             <groupId>org.apache.spark</groupId>\r
100             <artifactId>spark-streaming_2.10</artifactId>\r
101         </dependency>\r
102 \r
103         <!-- CASK -->\r
104         <dependency>\r
105             <groupId>co.cask.http</groupId>\r
106             <artifactId>netty-http</artifactId>\r
107         </dependency>\r
108         <dependency>\r
109             <groupId>co.cask.common</groupId>\r
110             <artifactId>common-http</artifactId>\r
111         </dependency>\r
112 \r
113         <!-- HADOOP -->\r
114         <dependency>\r
115             <groupId>org.apache.hadoop</groupId>\r
116             <artifactId>hadoop-mapreduce-client-core</artifactId>\r
117         </dependency>\r
118         <dependency>\r
119             <groupId>org.apache.hadoop</groupId>\r
120             <artifactId>hadoop-common</artifactId>\r
121         </dependency>\r
122 \r
123         <!-- SPARK -->\r
124         <dependency>\r
125             <groupId>org.apache.spark</groupId>\r
126             <artifactId>spark-core_2.10</artifactId>\r
127         </dependency>\r
128 \r
129         <!-- LOGGING -->\r
130         <dependency>\r
131             <groupId>org.slf4j</groupId>\r
132             <artifactId>slf4j-api</artifactId>\r
133         </dependency>\r
134 \r
135         <dependency>\r
136             <groupId>ch.qos.logback</groupId>\r
137             <artifactId>logback-core</artifactId>\r
138         </dependency>\r
139 \r
140         <dependency>\r
141             <groupId>ch.qos.logback</groupId>\r
142             <artifactId>logback-classic</artifactId>\r
143         </dependency>\r
144 \r
145         <!-- FIND BUGS -->\r
146         <dependency>\r
147             <groupId>com.google.code.findbugs</groupId>\r
148             <artifactId>jsr305</artifactId>\r
149             <version>${findbugs.jsr305.version}</version>\r
150             <scope>provided</scope>\r
151         </dependency>\r
152 \r
153         <dependency>\r
154             <groupId>com.google.code.findbugs</groupId>\r
155             <artifactId>annotations</artifactId>\r
156             <version>${findbugs.annotations.version}</version>\r
157             <scope>provided</scope>\r
158         </dependency>\r
159 \r
160         <!-- TEST DEPENDENCIES -->\r
161         <dependency>\r
162             <groupId>org.onap.dcaegen2.analytics.tca</groupId>\r
163             <artifactId>dcae-analytics-test</artifactId>\r
164             <version>2.0.0-SNAPSHOT</version>\r
165             <scope>test</scope>\r
166         </dependency>\r
167 \r
168         <dependency>\r
169             <groupId>co.cask.cdap</groupId>\r
170             <artifactId>hydrator-test</artifactId>\r
171         </dependency>\r
172 \r
173         <dependency>\r
174             <groupId>co.cask.cdap</groupId>\r
175             <artifactId>cdap-unit-test</artifactId>\r
176             <exclusions>\r
177                 <exclusion>\r
178                     <artifactId>org.apache.httpcomponents</artifactId>\r
179                     <groupId>httpcore</groupId>\r
180                 </exclusion>\r
181             </exclusions>\r
182         </dependency>\r
183 \r
184     </dependencies>\r
185 \r
186 \r
187     <build>\r
188         <plugins>\r
189 \r
190             <plugin>\r
191                 <groupId>org.apache.felix</groupId>\r
192                 <artifactId>maven-bundle-plugin</artifactId>\r
193                 <configuration>\r
194                     <instructions>\r
195                         <!-- List of packages that are scanned for plugins -->\r
196                         <_exportcontents>\r
197                             org.openecomp.dcae.apod.analytics.dmaap.domain.response.*,\r
198                             org.openecomp.dcae.apod.analytics.dmaap.domain.config.*;\r
199                             org.openecomp.dcae.apod.analytics.dmaap.service.subscriber.*;\r
200                             org.openecomp.dcae.apod.analytics.dmaap.service.*;\r
201                             org.openecomp.dcae.apod.analytics.cdap.common.settings.*;\r
202                             org.openecomp.dcae.apod.analytics.cdap.plugins.common.*;\r
203                             org.openecomp.dcae.apod.analytics.cdap.plugins.batch.sink.dmaap.*;\r
204                             org.openecomp.dcae.apod.analytics.cdap.plugins.domain.config.dmaap.*;\r
205                             org.openecomp.dcae.apod.analytics.cdap.plugins.domain.config.filter.*;\r
206                             org.openecomp.dcae.apod.analytics.cdap.plugins.domain.config.tca.*;\r
207                             org.openecomp.dcae.apod.analytics.cdap.plugins.sparkcompute.tca.*;\r
208                             org.openecomp.dcae.apod.analytics.cdap.plugins.streaming.dmaap.*;\r
209                             org.openecomp.dcae.apod.analytics.cdap.plugins.transform.filter.*;\r
210                             com.google.common.base.*;\r
211                             com.google.inject.*;\r
212                             org.apache.http.*;\r
213                             org.aopalliance.*;\r
214                             javax.inject.*;\r
215                             org.apache.commons.*\r
216                         </_exportcontents>\r
217                     </instructions>\r
218                 </configuration>\r
219             </plugin>\r
220 \r
221 \r
222             <plugin>\r
223                 <groupId>org.apache.maven.plugins</groupId>\r
224                 <artifactId>maven-antrun-plugin</artifactId>\r
225                 <executions>\r
226                     <!-- Create the config file for artifact which can be used to deploy the artifact.\r
227                          Sets the parents field to system:cdap-etl-batch and system:cdap-etl-realtime with whatever\r
228                          version range is set in the app.parents property.\r
229                          also sets a widget and doc property for each file contained in the widgets and docs directories. -->\r
230                     <execution>\r
231                         <id>create-artifact-config</id>\r
232                         <phase>prepare-package</phase>\r
233                         <configuration>\r
234                             <target>\r
235                                 <script language="javascript"> <![CDATA[\r
236                   // for some reason, project.basedir evaluates to null if we just get the property here.\r
237                   // so we set main.basedir to project.basedir in the pom properties, then main.basedir is used here\r
238                   // where it evaluates correctly for whatever reason\r
239                   var baseDir = project.getProperty("main.basedir.plugins");\r
240                   var targetDir = project.getProperty("project.build.directory");\r
241                   var artifactId = project.getProperty("project.artifactId");\r
242                   var version = project.getProperty("project.version");\r
243 \r
244                   var cfgFile = new java.io.File(targetDir, artifactId + "-" + version + ".json");\r
245                   if (!cfgFile.exists()) {\r
246                     cfgFile.createNewFile();\r
247                   }\r
248 \r
249                   var parents = project.getProperty("app.parents").split(",");\r
250                   var config = {\r
251                     "parents": [ ],\r
252                     "properties": {}\r
253                   }\r
254                   for (i = 0; i < parents.length; i+=2) {\r
255                     // because name1[lo,hi],name2[lo,hi] gets split into "name1[lo", "hi]", "name2[lo", "hi]"\r
256                     // so we have to combine them again\r
257                     config.parents.push(parents[i] + "," + parents[i+1]);\r
258                   }\r
259 \r
260                   // look in widgets directory for widget config for each plugin\r
261                   var widgetsDir = new java.io.File(baseDir, project.getProperty("widgets.dir"));\r
262                   if (widgetsDir.isDirectory()) {\r
263                     var widgetsFiles = widgetsDir.listFiles();\r
264                     for (i = 0; i < widgetsFiles.length; i++) {\r
265                       var widgetsFile = widgetsFiles[i];\r
266                       if (widgetsFile.isFile()) {\r
267                         var propertyName = "widgets." + widgetsFile.getName();\r
268                         // if the filename ends with .json\r
269                         if (propertyName.indexOf(".json", propertyName.length - 5) !== -1) {\r
270                           // strip the .json\r
271                           propertyName = propertyName.slice(0, -5);\r
272                           var contents = new java.lang.String(java.nio.file.Files.readAllBytes(widgetsFile.toPath()), java.nio.charset.StandardCharsets.UTF_8);\r
273                           var contentsAsJson = JSON.parse(contents);\r
274                           config.properties[propertyName] = JSON.stringify(contentsAsJson);\r
275                         }\r
276                       }\r
277                     }\r
278                   }\r
279 \r
280                   // look in the docs directory for docs for each plugin\r
281                   var docsDir = new java.io.File(baseDir, project.getProperty("docs.dir"));\r
282                   if (docsDir.isDirectory()) {\r
283                     var docFiles = docsDir.listFiles();\r
284                     for (i = 0; i < docFiles.length; i++) {\r
285                       var docFile = docFiles[i];\r
286                       if (docFile.isFile()) {\r
287                         var propertyName = "doc." + docFile.getName();\r
288                         // if the filename ends with .md\r
289                         if (propertyName.indexOf(".md", propertyName.length - 3) !== -1) {\r
290                           // strip the extension\r
291                           propertyName = propertyName.slice(0, -3);\r
292                           var contents = new java.lang.String(java.nio.file.Files.readAllBytes(docFile.toPath()), java.nio.charset.StandardCharsets.UTF_8);\r
293                           config.properties[propertyName] = contents + "";\r
294                         }\r
295                       }\r
296                     }\r
297                   }\r
298 \r
299                   var fw = new java.io.BufferedWriter(new java.io.FileWriter(cfgFile.getAbsoluteFile()));\r
300                   fw.write(JSON.stringify(config, null, 2));\r
301                   fw.close();\r
302                 ]]></script>\r
303                             </target>\r
304                         </configuration>\r
305                         <goals>\r
306                             <goal>run</goal>\r
307                         </goals>\r
308                     </execution>\r
309                 </executions>\r
310             </plugin>\r
311 \r
312         </plugins>\r
313     </build>\r
314 \r
315 \r
316 </project>\r