1 <?xml version="1.0" encoding="UTF-8"?>
3 ~ ===============================LICENSE_START======================================
5 ~ ================================================================================
6 ~ Copyright (c) 2017-2019 AT&T Intellectual Property. All rights reserved.
7 ~ ================================================================================
8 ~ Licensed under the Apache License, Version 2.0 (the "License");
9 ~ you may not use this file except in compliance with the License.
10 ~ You may obtain a copy of the License at
12 ~ http://www.apache.org/licenses/LICENSE-2.0
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===========================================
22 <project xmlns="http://maven.apache.org/POM/4.0.0"
23 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
24 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
26 <modelVersion>4.0.0</modelVersion>
29 <artifactId>dcae-analytics</artifactId>
30 <groupId>org.onap.dcaegen2.analytics.tca</groupId>
31 <version>2.3.0-SNAPSHOT</version>
34 <artifactId>dcae-analytics-cdap-plugins</artifactId>
35 <packaging>jar</packaging>
37 <!-- THIS MODULE CONTAINS CDAP CODE FOR PLUGINS -->
38 <name>DCAE Analytics CDAP Plugins</name>
39 <description>DCAE Analytics CDAP Plugins to build CDAP Pipelines</description>
42 <main.basedir>${project.parent.basedir}</main.basedir>
43 <main.basedir.plugins>${project.basedir}</main.basedir.plugins>
44 <widgets.dir>widgets</widgets.dir>
45 <docs.dir>docs</docs.dir>
47 system:cdap-etl-batch[4.0.0,4.2.0-SNAPSHOT),system:cdap-etl-realtime[4.0.0,4.2.0-SNAPSHOT),system:cdap-data-pipeline[4.0.0,4.2.0-SNAPSHOT),system:cdap-data-streams[4.0.0,4.2.0-SNAPSHOT)
53 <!-- DCAE DEPENDENCIES -->
55 <groupId>org.onap.dcaegen2.analytics.tca</groupId>
56 <artifactId>dcae-analytics-cdap-common</artifactId>
57 <version>${project.parent.version}</version>
61 <groupId>org.onap.dcaegen2.analytics.tca</groupId>
62 <artifactId>dcae-analytics-tca</artifactId>
63 <version>${project.parent.version}</version>
69 <groupId>co.cask.cdap</groupId>
70 <artifactId>cdap-api</artifactId>
74 <groupId>co.cask.cdap</groupId>
75 <artifactId>cdap-etl-api</artifactId>
79 <groupId>co.cask.cdap</groupId>
80 <artifactId>cdap-etl-api-spark</artifactId>
84 <groupId>co.cask.cdap</groupId>
85 <artifactId>cdap-etl-realtime</artifactId>
89 <groupId>co.cask.cdap</groupId>
90 <artifactId>cdap-data-pipeline</artifactId>
94 <groupId>co.cask.cdap</groupId>
95 <artifactId>cdap-data-streams</artifactId>
99 <groupId>org.apache.spark</groupId>
100 <artifactId>spark-streaming_2.10</artifactId>
105 <groupId>co.cask.http</groupId>
106 <artifactId>netty-http</artifactId>
109 <groupId>co.cask.common</groupId>
110 <artifactId>common-http</artifactId>
115 <groupId>org.apache.hadoop</groupId>
116 <artifactId>hadoop-mapreduce-client-core</artifactId>
119 <groupId>org.apache.hadoop</groupId>
120 <artifactId>hadoop-common</artifactId>
125 <groupId>org.apache.spark</groupId>
126 <artifactId>spark-core_2.10</artifactId>
131 <groupId>org.slf4j</groupId>
132 <artifactId>slf4j-api</artifactId>
136 <groupId>ch.qos.logback</groupId>
137 <artifactId>logback-core</artifactId>
141 <groupId>ch.qos.logback</groupId>
142 <artifactId>logback-classic</artifactId>
147 <groupId>com.google.code.findbugs</groupId>
148 <artifactId>jsr305</artifactId>
149 <version>${findbugs.jsr305.version}</version>
150 <scope>provided</scope>
154 <groupId>com.google.code.findbugs</groupId>
155 <artifactId>annotations</artifactId>
156 <version>${findbugs.annotations.version}</version>
157 <scope>provided</scope>
160 <!-- TEST DEPENDENCIES -->
162 <groupId>org.onap.dcaegen2.analytics.tca</groupId>
163 <artifactId>dcae-analytics-test</artifactId>
164 <version>${project.parent.version}</version>
169 <groupId>co.cask.cdap</groupId>
170 <artifactId>hydrator-test</artifactId>
174 <groupId>co.cask.cdap</groupId>
175 <artifactId>cdap-unit-test</artifactId>
178 <artifactId>org.apache.httpcomponents</artifactId>
179 <groupId>httpcore</groupId>
191 <groupId>org.apache.felix</groupId>
192 <artifactId>maven-bundle-plugin</artifactId>
195 <!-- List of packages that are scanned for plugins -->
197 org.onap.dcae.apod.analytics.dmaap.domain.response.*,
198 org.onap.dcae.apod.analytics.dmaap.domain.config.*;
199 org.onap.dcae.apod.analytics.dmaap.service.subscriber.*;
200 org.onap.dcae.apod.analytics.dmaap.service.*;
201 org.onap.dcae.apod.analytics.cdap.common.settings.*;
202 org.onap.dcae.apod.analytics.cdap.plugins.common.*;
203 org.onap.dcae.apod.analytics.cdap.plugins.batch.sink.dmaap.*;
204 org.onap.dcae.apod.analytics.cdap.plugins.domain.config.dmaap.*;
205 org.onap.dcae.apod.analytics.cdap.plugins.domain.config.filter.*;
206 org.onap.dcae.apod.analytics.cdap.plugins.domain.config.tca.*;
207 org.onap.dcae.apod.analytics.cdap.plugins.sparkcompute.tca.*;
208 org.onap.dcae.apod.analytics.cdap.plugins.streaming.dmaap.*;
209 org.onap.dcae.apod.analytics.cdap.plugins.transform.filter.*;
210 com.google.common.base.*;
223 <groupId>org.apache.maven.plugins</groupId>
224 <artifactId>maven-antrun-plugin</artifactId>
226 <!-- Create the config file for artifact which can be used to deploy the artifact.
227 Sets the parents field to system:cdap-etl-batch and system:cdap-etl-realtime with whatever
228 version range is set in the app.parents property.
229 also sets a widget and doc property for each file contained in the widgets and docs directories. -->
231 <id>create-artifact-config</id>
232 <phase>prepare-package</phase>
235 <script language="javascript"> <![CDATA[
236 // for some reason, project.basedir evaluates to null if we just get the property here.
237 // so we set main.basedir to project.basedir in the pom properties, then main.basedir is used here
238 // where it evaluates correctly for whatever reason
239 var baseDir = project.getProperty("main.basedir.plugins");
240 var targetDir = project.getProperty("project.build.directory");
241 var artifactId = project.getProperty("project.artifactId");
242 var version = project.getProperty("project.version");
244 var cfgFile = new java.io.File(targetDir, artifactId + "-" + version + ".json");
245 if (!cfgFile.exists()) {
246 cfgFile.createNewFile();
249 var parents = project.getProperty("app.parents").split(",");
254 for (i = 0; i < parents.length; i+=2) {
255 // because name1[lo,hi],name2[lo,hi] gets split into "name1[lo", "hi]", "name2[lo", "hi]"
256 // so we have to combine them again
257 config.parents.push(parents[i] + "," + parents[i+1]);
260 // look in widgets directory for widget config for each plugin
261 var widgetsDir = new java.io.File(baseDir, project.getProperty("widgets.dir"));
262 if (widgetsDir.isDirectory()) {
263 var widgetsFiles = widgetsDir.listFiles();
264 for (i = 0; i < widgetsFiles.length; i++) {
265 var widgetsFile = widgetsFiles[i];
266 if (widgetsFile.isFile()) {
267 var propertyName = "widgets." + widgetsFile.getName();
268 // if the filename ends with .json
269 if (propertyName.indexOf(".json", propertyName.length - 5) !== -1) {
271 propertyName = propertyName.slice(0, -5);
272 var contents = new java.lang.String(java.nio.file.Files.readAllBytes(widgetsFile.toPath()), java.nio.charset.StandardCharsets.UTF_8);
273 var contentsAsJson = JSON.parse(contents);
274 config.properties[propertyName] = JSON.stringify(contentsAsJson);
280 // look in the docs directory for docs for each plugin
281 var docsDir = new java.io.File(baseDir, project.getProperty("docs.dir"));
282 if (docsDir.isDirectory()) {
283 var docFiles = docsDir.listFiles();
284 for (i = 0; i < docFiles.length; i++) {
285 var docFile = docFiles[i];
286 if (docFile.isFile()) {
287 var propertyName = "doc." + docFile.getName();
288 // if the filename ends with .md
289 if (propertyName.indexOf(".md", propertyName.length - 3) !== -1) {
290 // strip the extension
291 propertyName = propertyName.slice(0, -3);
292 var contents = new java.lang.String(java.nio.file.Files.readAllBytes(docFile.toPath()), java.nio.charset.StandardCharsets.UTF_8);
293 config.properties[propertyName] = contents + "";
299 var fw = new java.io.BufferedWriter(new java.io.FileWriter(cfgFile.getAbsoluteFile()));
300 fw.write(JSON.stringify(config, null, 2));