aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Brady <patrick.brady@att.com>2019-10-21 19:05:35 -0700
committerTakamune Cho <takamune.cho@att.com>2019-11-08 16:39:03 +0000
commit1843caa854f58b133e2c97e5d75a4705f2942280 (patch)
treececfc66b792e5cf64bddf4492afeeb89e78ddd5f
parent6a6d3afd489ea3b8945f1cdd8a8a74afdcc5221a (diff)
Feature for micro service communication
The appc-service-communicator feature will be responsible for communication between any appc microservices which are developed. The appc dmaap micro service connector is part of this feature. MessagingConnector.java is the main new class here. Some code is copied from appc event listener and dmaap adapter. Will be moved in a later commit. Change-Id: Ic57f5ee6a9ab1538c6ddaa3e7c25ac0c9797fae0 Signed-off-by: Patrick Brady <patrick.brady@att.com> Issue-ID: APPC-1744
-rw-r--r--appc-service-communicator/appc-service-communicator-bundle/.gitignore1
-rw-r--r--appc-service-communicator/appc-service-communicator-bundle/pom.xml166
-rw-r--r--appc-service-communicator/appc-service-communicator-bundle/src/main/java/org/onap/appc/srvcomm/messaging/AuthenticationException.java28
-rw-r--r--appc-service-communicator/appc-service-communicator-bundle/src/main/java/org/onap/appc/srvcomm/messaging/CommonHttpClient.java106
-rw-r--r--appc-service-communicator/appc-service-communicator-bundle/src/main/java/org/onap/appc/srvcomm/messaging/MessageDestination.java28
-rw-r--r--appc-service-communicator/appc-service-communicator-bundle/src/main/java/org/onap/appc/srvcomm/messaging/MessagingConnector.java154
-rw-r--r--appc-service-communicator/appc-service-communicator-bundle/src/main/java/org/onap/appc/srvcomm/messaging/event/EventHeader.java65
-rw-r--r--appc-service-communicator/appc-service-communicator-bundle/src/main/java/org/onap/appc/srvcomm/messaging/event/EventMessage.java98
-rw-r--r--appc-service-communicator/appc-service-communicator-bundle/src/main/java/org/onap/appc/srvcomm/messaging/event/EventSender.java97
-rw-r--r--appc-service-communicator/appc-service-communicator-bundle/src/main/java/org/onap/appc/srvcomm/messaging/event/EventStatus.java57
-rw-r--r--appc-service-communicator/appc-service-communicator-bundle/src/main/resources/org/onap/appc/default.properties27
-rw-r--r--appc-service-communicator/appc-service-communicator-bundle/src/test/resources/org/onap/appc/default.properties38
-rw-r--r--appc-service-communicator/appc-service-communicator-features/features-appc-service-communicator/.gitignore1
-rw-r--r--appc-service-communicator/appc-service-communicator-features/features-appc-service-communicator/pom.xml49
-rw-r--r--appc-service-communicator/appc-service-communicator-features/onap-appc-service-communicator/.gitignore1
-rw-r--r--appc-service-communicator/appc-service-communicator-features/onap-appc-service-communicator/pom.xml68
-rw-r--r--appc-service-communicator/appc-service-communicator-features/pom.xml43
-rw-r--r--appc-service-communicator/appc-service-communicator-installer/.gitignore24
-rw-r--r--appc-service-communicator/appc-service-communicator-installer/pom.xml164
-rw-r--r--appc-service-communicator/appc-service-communicator-installer/src/assembly/assemble_installer_zip.xml61
-rw-r--r--appc-service-communicator/appc-service-communicator-installer/src/assembly/assemble_mvnrepo_zip.xml49
-rwxr-xr-xappc-service-communicator/appc-service-communicator-installer/src/main/resources/scripts/install-feature.sh49
-rw-r--r--appc-service-communicator/pom.xml42
23 files changed, 1416 insertions, 0 deletions
diff --git a/appc-service-communicator/appc-service-communicator-bundle/.gitignore b/appc-service-communicator/appc-service-communicator-bundle/.gitignore
new file mode 100644
index 000000000..eacf31a67
--- /dev/null
+++ b/appc-service-communicator/appc-service-communicator-bundle/.gitignore
@@ -0,0 +1 @@
+/target-ide/
diff --git a/appc-service-communicator/appc-service-communicator-bundle/pom.xml b/appc-service-communicator/appc-service-communicator-bundle/pom.xml
new file mode 100644
index 000000000..b93b25685
--- /dev/null
+++ b/appc-service-communicator/appc-service-communicator-bundle/pom.xml
@@ -0,0 +1,166 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============LICENSE_START=======================================================
+ ONAP : APPC
+ ================================================================================
+ Copyright (C) 2019 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=========================================================
+ -->
+<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.appc.parent</groupId>
+ <artifactId>binding-parent</artifactId>
+ <version>2.6.2</version>
+ <relativePath />
+ </parent>
+ <groupId>org.onap.appc</groupId>
+ <artifactId>appc-service-communicator-bundle</artifactId>
+ <packaging>bundle</packaging>
+ <name>Service Communicator - bundle</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.appc</groupId>
+ <artifactId>appc-common-bundle</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <version>${logback.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.att.eelf</groupId>
+ <artifactId>eelf-core</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-annotations</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.core</groupId>
+ <artifactId>sli-common</artifactId>
+ <scope>compile</scope>
+ <!-- Added exclusion to prevent missing dependency issue on dblib -->
+ <exclusions>
+ <exclusion>
+ <groupId>org.onap.ccsdk.sli.core</groupId>
+ <artifactId>dblib-provider</artifactId>
+ </exclusion>
+ <exclusion>
+ <artifactId>slf4j-simple</artifactId>
+ <groupId>org.slf4j</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.core</groupId>
+ <artifactId>sli-provider</artifactId>
+ <scope>compile</scope>
+ <!-- Added exclusion to prevent missing dependency issue on dblib -->
+ <exclusions>
+ <exclusion>
+ <groupId>org.onap.ccsdk.sli.core</groupId>
+ <artifactId>dblib-provider</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.json</groupId>
+ <artifactId>json</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.ws.rs</groupId>
+ <artifactId>javax.ws.rs-api</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
+ <Bundle-Version>${project.version}</Bundle-Version>
+ <Export-Package>org.onap.appc.srvcomm.messaging,org.onap.appc.srvcomm.messaging.event</Export-Package>
+ <Import-Package>com.att.eelf.configuration,*;resolution:=optional</Import-Package>
+ <Embed-Dependency>logback-classic,
+ logback-core,dmaapClient;scope=compile|runtime;artifactId=!org.eclipse.osgi|slf4j-api|slf4j-simple|jcl-over-slf4j|</Embed-Dependency>
+ <Embed-Transitive>true</Embed-Transitive>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <version>1.7.0-SNAPSHOT</version>
+</project>
diff --git a/appc-service-communicator/appc-service-communicator-bundle/src/main/java/org/onap/appc/srvcomm/messaging/AuthenticationException.java b/appc-service-communicator/appc-service-communicator-bundle/src/main/java/org/onap/appc/srvcomm/messaging/AuthenticationException.java
new file mode 100644
index 000000000..c04e9bc2b
--- /dev/null
+++ b/appc-service-communicator/appc-service-communicator-bundle/src/main/java/org/onap/appc/srvcomm/messaging/AuthenticationException.java
@@ -0,0 +1,28 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2018 Nokia. 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.appc.srvcomm.messaging;
+
+class AuthenticationException extends Exception {
+
+ public AuthenticationException(String message) {
+ super(message);
+ }
+}
diff --git a/appc-service-communicator/appc-service-communicator-bundle/src/main/java/org/onap/appc/srvcomm/messaging/CommonHttpClient.java b/appc-service-communicator/appc-service-communicator-bundle/src/main/java/org/onap/appc/srvcomm/messaging/CommonHttpClient.java
new file mode 100644
index 000000000..6bfc553b3
--- /dev/null
+++ b/appc-service-communicator/appc-service-communicator-bundle/src/main/java/org/onap/appc/srvcomm/messaging/CommonHttpClient.java
@@ -0,0 +1,106 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * 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.appc.srvcomm.messaging;
+
+import java.net.URI;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.http.auth.AuthenticationException;
+import org.apache.http.client.config.RequestConfig;
+import org.apache.http.client.config.RequestConfig.Builder;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClientBuilder;
+
+abstract class CommonHttpClient {
+
+ private static final int HTTP_PORT = 3904;
+ private static final int HTTPS_PORT = 3905;
+ private static final int TIMEOUT_OFFSET = 5000;
+
+ private String authStr;
+
+ protected void setBasicAuth(String username, String password) {
+ if (username != null && password != null) {
+ String plain = String.format("%s:%s", username, password);
+ authStr = Base64.encodeBase64String(plain.getBytes());
+ } else {
+ authStr = null;
+ }
+ }
+
+ protected HttpGet getReq(URI uri, int timeoutMs) throws AuthenticationException {
+
+ HttpGet out = (uri == null) ? new HttpGet() : new HttpGet(uri);
+ if (authStr != null) {
+ out.setHeader("Authorization", String.format("Basic %s", authStr));
+ }
+
+ out.setConfig(getConfig(timeoutMs));
+ return out;
+ }
+
+ protected HttpPost postReq(String url) throws AuthenticationException {
+
+ HttpPost out = (url == null) ? new HttpPost() : new HttpPost(url);
+ if (authStr != null) {
+ out.setHeader("Authorization", String.format("Basic %s", authStr));
+ }
+ out.setConfig(getConfig(0));
+ return out;
+ }
+
+ private RequestConfig getConfig(int timeoutMs) {
+ Builder builder = RequestConfig.custom();
+ builder.setSocketTimeout(timeoutMs + TIMEOUT_OFFSET);
+ return builder.build();
+ }
+
+ protected CloseableHttpClient getClient() {
+ return HttpClientBuilder.create().build();
+ }
+
+ protected String formatHostString(String host) {
+ return formatHostString(host, host.contains(String.valueOf(HTTPS_PORT)));
+ }
+
+ private String formatHostString(String host, boolean useHttps) {
+ // Trim trailing slash
+ String out = host.endsWith("/") ? host.substring(0, host.length() - 1) : host;
+
+ boolean hasProtocol = out.startsWith("http");
+ boolean hasPort = out.contains(":");
+
+ // Add protocol
+ if (!hasProtocol) {
+ out = String.format("%s%s", (useHttps) ? "https://" : "http://", out);
+ }
+ // Add port
+ if (!hasPort) {
+ out = String.format("%s:%d", out, (useHttps) ? HTTPS_PORT : HTTP_PORT);
+ }
+ return out;
+ }
+}
diff --git a/appc-service-communicator/appc-service-communicator-bundle/src/main/java/org/onap/appc/srvcomm/messaging/MessageDestination.java b/appc-service-communicator/appc-service-communicator-bundle/src/main/java/org/onap/appc/srvcomm/messaging/MessageDestination.java
new file mode 100644
index 000000000..d71babc5b
--- /dev/null
+++ b/appc-service-communicator/appc-service-communicator-bundle/src/main/java/org/onap/appc/srvcomm/messaging/MessageDestination.java
@@ -0,0 +1,28 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * 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.appc.srvcomm.messaging;
+
+public enum MessageDestination {
+ DCAE
+}
diff --git a/appc-service-communicator/appc-service-communicator-bundle/src/main/java/org/onap/appc/srvcomm/messaging/MessagingConnector.java b/appc-service-communicator/appc-service-communicator-bundle/src/main/java/org/onap/appc/srvcomm/messaging/MessagingConnector.java
new file mode 100644
index 000000000..934317f1c
--- /dev/null
+++ b/appc-service-communicator/appc-service-communicator-bundle/src/main/java/org/onap/appc/srvcomm/messaging/MessagingConnector.java
@@ -0,0 +1,154 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2019 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.appc.srvcomm.messaging;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.util.Properties;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.onap.appc.configuration.ConfigurationFactory;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+
+public class MessagingConnector {
+
+ private static final EELFLogger LOG = EELFManager.getInstance().getLogger(MessagingConnector.class);
+
+ private final String URL;
+ private final String USER;
+ private final String PASSWORD;
+ private final String PROPERTIES_PREFIX = "appc.srvcomm.messaging";
+
+ public MessagingConnector() {
+ Properties props = ConfigurationFactory.getConfiguration().getProperties();
+ String url = props.getProperty(PROPERTIES_PREFIX + ".url");
+ if(!isNullOrEmpty(url)) {
+ this.URL = url;
+ } else {
+ this.URL = "localhost:8080";
+ }
+ String username = props.getProperty(PROPERTIES_PREFIX + ".username");
+ String password = props.getProperty(PROPERTIES_PREFIX + ".password");
+ //Both username and password properties need to be set. One or the other
+ //can't be set.
+ if(isNullOrEmpty(username, password)) {
+ USER = null;
+ PASSWORD = null;
+ } else {
+ USER = username;
+ PASSWORD = password;
+ }
+ }
+
+ public boolean isNullOrEmpty(String... strings) {
+ for(String s : strings) {
+ if(s == null || s.isEmpty()){
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public boolean publishMessage(String propertySet, String partition, String data) {
+ return publishMessage(propertySet, partition, null, data);
+ }
+
+ public boolean publishMessage(String propertySet, String partition, String topic, String data) {
+ HttpPost post = new HttpPost(URL);
+ //check if we need to enable authentication
+ if(USER != null) {
+ String authStr = getBasicAuth(USER, PASSWORD);
+ post.setHeader("Authorization", String.format("Basic %s", authStr));
+ }
+ //encode the message so it can be sent to the dmaap client jar
+ String body = bodyLine(propertySet, partition, topic, data);
+ try {
+ post.setEntity(new StringEntity(body));
+ } catch (UnsupportedEncodingException e) {
+ LOG.error("Error during publishMessage",e);
+ }
+ try {
+ CloseableHttpResponse response = getClient().execute(post);
+ if (response.getStatusLine().getStatusCode() == 200) {
+ return true;
+ } else {
+ LOG.error(response.getStatusLine().getStatusCode() +
+ " Error during publishMessage: " +
+ response.getStatusLine().getReasonPhrase() +
+ " See messaging service jar logs.");
+ return false;
+ }
+ } catch (ClientProtocolException e) {
+ LOG.error("Error during publishMessage",e);
+ } catch (IOException e) {
+ LOG.error("Error during publishMessage",e);
+ }
+ return false;
+
+ }
+
+ /**
+ * Format the body for the application/cambria content type with no partitioning. See
+ *
+ * @param propertySet
+ * The prefix of the properties that the dmaap service should look up in order to
+ * get the correct properties for the message being sent.
+ * @param partition
+ * The dmaap partition that the message should be published to
+ * @param topic
+ * The dmaap topic that the message should be published to. Leave this unset in order
+ * to use the topic that is in the property files.
+ * @param message
+ * The message to publish
+ * @return A string in the application/cambria content type
+ */
+ private String bodyLine(String propertySet, String partition, String topic, String message) {
+ String prop = (propertySet == null) ? "" : propertySet;
+ String prt = (partition == null) ? "" : partition;
+ String msg = (message == null) ? "" : message;
+ String top = (topic == null) ? "" : topic;
+ return String.format("%d.%d.%d.%d.%s%s%s%s", prop.length(),prt.length(), top.length(),
+ msg.length(), prop, prt, top, msg);
+ }
+
+ protected CloseableHttpClient getClient() {
+ return HttpClientBuilder.create().build();
+ }
+
+ protected String getBasicAuth(String username, String password) {
+ if (username != null && password != null) {
+ String plain = String.format("%s:%s", username, password);
+ return Base64.encodeBase64String(plain.getBytes());
+ } else {
+ return null;
+ }
+ }
+
+}
diff --git a/appc-service-communicator/appc-service-communicator-bundle/src/main/java/org/onap/appc/srvcomm/messaging/event/EventHeader.java b/appc-service-communicator/appc-service-communicator-bundle/src/main/java/org/onap/appc/srvcomm/messaging/event/EventHeader.java
new file mode 100644
index 000000000..0f74589ca
--- /dev/null
+++ b/appc-service-communicator/appc-service-communicator-bundle/src/main/java/org/onap/appc/srvcomm/messaging/event/EventHeader.java
@@ -0,0 +1,65 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * 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.appc.srvcomm.messaging.event;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class EventHeader {
+
+ @JsonProperty("eventTime")
+ private final String eventTime;
+
+ @JsonProperty("apiVer")
+ private final String apiVer;
+
+ @JsonProperty("eventId")
+ private final String eventId;
+
+ public EventHeader(String eventTime, String apiVer, String eventId) {
+ this.eventTime = eventTime;
+ this.apiVer = apiVer;
+ this.eventId = eventId;
+ }
+
+ public String getEventTime() {
+ return eventTime;
+ }
+
+ public String getApiVer() {
+ return apiVer;
+ }
+
+ public String getEventId() {
+ return eventId;
+ }
+
+ @Override
+ public String toString() {
+ return "EventHeader{" +
+ "eventTime='" + eventTime + '\'' +
+ ", apiVer='" + apiVer + '\'' +
+ ", eventId='" + eventId + '\'' +
+ '}';
+ }
+}
diff --git a/appc-service-communicator/appc-service-communicator-bundle/src/main/java/org/onap/appc/srvcomm/messaging/event/EventMessage.java b/appc-service-communicator/appc-service-communicator-bundle/src/main/java/org/onap/appc/srvcomm/messaging/event/EventMessage.java
new file mode 100644
index 000000000..ca6a2d22c
--- /dev/null
+++ b/appc-service-communicator/appc-service-communicator-bundle/src/main/java/org/onap/appc/srvcomm/messaging/event/EventMessage.java
@@ -0,0 +1,98 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * 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.appc.srvcomm.messaging.event;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize.Inclusion;
+import java.io.IOException;
+import java.io.Serializable;
+
+/*
+ {
+ "EventHeader": {
+ "eventTime": "2016-03-15T10:59:33.79Z",
+ "apiVer": "1.01",
+ "EventId": "<ECOMP_EVENT_ID>",
+ },
+ "EventStatus": {
+ "code": "NNN",
+ "reason": "A reason"
+ }
+ }
+*/
+
+
+@JsonSerialize(include = Inclusion.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class EventMessage implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
+
+ @JsonProperty("eventHeader")
+ private EventHeader eventHeader;
+ @JsonProperty("eventStatus")
+ private EventStatus eventStatus;
+
+ public EventMessage(EventHeader eventHeader, EventStatus eventStatus) {
+ this.eventHeader = eventHeader;
+ this.eventStatus = eventStatus;
+ }
+
+ public EventHeader getEventHeader() {
+ return eventHeader;
+ }
+
+ public void setEventHeader(EventHeader eventHeader) {
+ this.eventHeader = eventHeader;
+ }
+
+ public EventStatus getEventStatus() {
+ return eventStatus;
+ }
+
+ public void setEventStatus(EventStatus eventStatus) {
+ this.eventStatus = eventStatus;
+ }
+
+ public String toJson() {
+ try {
+ return OBJECT_MAPPER.writeValueAsString(this);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "EventMessage{" +
+ "eventHeader=" + eventHeader +
+ ", eventStatus=" + eventStatus +
+ '}';
+ }
+}
diff --git a/appc-service-communicator/appc-service-communicator-bundle/src/main/java/org/onap/appc/srvcomm/messaging/event/EventSender.java b/appc-service-communicator/appc-service-communicator-bundle/src/main/java/org/onap/appc/srvcomm/messaging/event/EventSender.java
new file mode 100644
index 000000000..c15670838
--- /dev/null
+++ b/appc-service-communicator/appc-service-communicator-bundle/src/main/java/org/onap/appc/srvcomm/messaging/event/EventSender.java
@@ -0,0 +1,97 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Copyright (C) 2017 Amdocs
+ * ================================================================================
+ * Modifications Copyright (C) 2019 Ericsson
+ * =============================================================================
+ * 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.appc.srvcomm.messaging.event;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
+import org.onap.appc.configuration.Configuration;
+import org.onap.appc.configuration.ConfigurationFactory;
+import org.onap.appc.exceptions.APPCException;
+import org.onap.appc.srvcomm.messaging.MessageDestination;
+import org.onap.appc.srvcomm.messaging.MessagingConnector;
+import java.util.Date;
+import java.util.Map;
+
+
+public class EventSender
+{
+ private final EELFLogger LOG = EELFManager.getInstance().getLogger(EventSender.class);
+ public static final String PROPERTY_PREFIX = "dmaap.event";
+
+ private static Configuration configuration = ConfigurationFactory.getConfiguration();
+
+ private MessagingConnector messagingConnector;
+
+ public EventSender(){
+ messagingConnector = new MessagingConnector();
+ }
+
+ public boolean sendEvent(MessageDestination destination, EventMessage msg) {
+ String jsonStr = msg.toJson();
+ String id = msg.getEventHeader().getEventId();
+ LOG.info(String.format("Posting Message [%s - %s]", id, jsonStr));
+ String propertyPrefix = destination.toString() + "." + PROPERTY_PREFIX;
+ return messagingConnector.publishMessage(propertyPrefix, id, jsonStr);
+ }
+
+ public boolean sendEvent(MessageDestination destination, EventMessage msg, String eventTopicName) {
+ String jsonStr = msg.toJson();
+ String id = msg.getEventHeader().getEventId();
+ LOG.info(String.format("Posting Message [%s - %s]", id, jsonStr));
+ String propertyPrefix = destination.toString() + "." + PROPERTY_PREFIX;
+ return messagingConnector.publishMessage(propertyPrefix, id, eventTopicName, jsonStr);
+ }
+
+ public boolean sendEvent(MessageDestination destination, Map<String, String> params, SvcLogicContext ctx) throws APPCException {
+
+ if (params == null) {
+ String message = "Parameters map is empty (null)";
+ LOG.error(message);
+ throw new APPCException(message);
+ }
+ String eventTime = new Date(System.currentTimeMillis()).toString();
+ String apiVer = params.get("apiVer");
+ String eventId = params.get("eventId");
+ String reason = params.get("reason");
+ String entityId = params.get("entityId");
+ if(entityId != null){
+ reason += "(" + entityId + ")";
+ }
+ Integer code = Integer.getInteger(params.get("code"), 500);
+
+ if (eventTime == null || apiVer == null || eventId == null || reason == null) {
+ String message = String.format("Missing input parameters: %s", params);
+ LOG.error(message);
+ throw new APPCException(message);
+ }
+ EventMessage eventMessage = new EventMessage(
+ new EventHeader(eventTime, apiVer, eventId),
+ new EventStatus(code, reason));
+
+ return sendEvent(destination, eventMessage);
+ }
+}
diff --git a/appc-service-communicator/appc-service-communicator-bundle/src/main/java/org/onap/appc/srvcomm/messaging/event/EventStatus.java b/appc-service-communicator/appc-service-communicator-bundle/src/main/java/org/onap/appc/srvcomm/messaging/event/EventStatus.java
new file mode 100644
index 000000000..eb99e347c
--- /dev/null
+++ b/appc-service-communicator/appc-service-communicator-bundle/src/main/java/org/onap/appc/srvcomm/messaging/event/EventStatus.java
@@ -0,0 +1,57 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * 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.appc.srvcomm.messaging.event;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class EventStatus {
+
+ @JsonProperty("code")
+ private final Integer code;
+
+ @JsonProperty("reason")
+ private final String reason;
+
+ public EventStatus(Integer code, String aReason) {
+ this.code = code;
+ reason = aReason;
+ }
+
+
+ public Integer getCode() {
+ return code;
+ }
+
+ public String getReason() {
+ return reason;
+ }
+
+ @Override
+ public String toString() {
+ return "EventStatus{" +
+ "code=" + code +
+ ", reason='" + reason + '\'' +
+ '}';
+ }
+}
diff --git a/appc-service-communicator/appc-service-communicator-bundle/src/main/resources/org/onap/appc/default.properties b/appc-service-communicator/appc-service-communicator-bundle/src/main/resources/org/onap/appc/default.properties
new file mode 100644
index 000000000..218cafe6e
--- /dev/null
+++ b/appc-service-communicator/appc-service-communicator-bundle/src/main/resources/org/onap/appc/default.properties
@@ -0,0 +1,27 @@
+###
+# ============LICENSE_START=======================================================
+# ONAP : APPC
+# ================================================================================
+# Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+# ================================================================================
+# Copyright (C) 2017 Amdocs
+# =============================================================================
+# 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=========================================================
+###
+
+# ${user.home} usually goes to /root if instantiation uses the appc-docker approach
+
+org.onap.appc.bootstrap.file=appc.properties
+org.onap.appc.bootstrap.path=/opt/onap/appc/data/properties,${user.home},.
diff --git a/appc-service-communicator/appc-service-communicator-bundle/src/test/resources/org/onap/appc/default.properties b/appc-service-communicator/appc-service-communicator-bundle/src/test/resources/org/onap/appc/default.properties
new file mode 100644
index 000000000..8dea0a61d
--- /dev/null
+++ b/appc-service-communicator/appc-service-communicator-bundle/src/test/resources/org/onap/appc/default.properties
@@ -0,0 +1,38 @@
+###
+# ============LICENSE_START=======================================================
+# ONAP : APPC
+# ================================================================================
+# Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+# ================================================================================
+# Copyright (C) 2017 Amdocs
+# =============================================================================
+# 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=========================================================
+###
+
+org.onap.appc.bootstrap.file=test.properties
+org.onap.appc.bootstrap.path=/opt/onap/appc/data/properties,${user.home},.
+
+# Properties commented out below are provided in appc.properties
+poolMembers=10.0.0.1
+#event.pool.members=<DMAAP_IP>:3904
+
+topic.read=APPC-CL
+topic.read.timeout=5
+topic.write=APPC-CL
+event.topic.write=APPC-CL
+client.name=APPC-CLIENT-DMAAP-ADAPTER-TEST
+client.name.id=0
+
+metric.enabled=false;
diff --git a/appc-service-communicator/appc-service-communicator-features/features-appc-service-communicator/.gitignore b/appc-service-communicator/appc-service-communicator-features/features-appc-service-communicator/.gitignore
new file mode 100644
index 000000000..eacf31a67
--- /dev/null
+++ b/appc-service-communicator/appc-service-communicator-features/features-appc-service-communicator/.gitignore
@@ -0,0 +1 @@
+/target-ide/
diff --git a/appc-service-communicator/appc-service-communicator-features/features-appc-service-communicator/pom.xml b/appc-service-communicator/appc-service-communicator-features/features-appc-service-communicator/pom.xml
new file mode 100644
index 000000000..cf30df89a
--- /dev/null
+++ b/appc-service-communicator/appc-service-communicator-features/features-appc-service-communicator/pom.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+============LICENSE_START=======================================================
+ONAP : APPC
+================================================================================
+Copyright (C) 2019 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=========================================================
+-->
+<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.appc.parent</groupId>
+ <artifactId>feature-repo-parent</artifactId>
+ <version>2.6.2</version>
+ <relativePath />
+ </parent>
+
+ <groupId>org.onap.appc</groupId>
+ <artifactId>features-appc-service-communicator</artifactId>
+ <version>1.7.0-SNAPSHOT</version>
+ <packaging>feature</packaging>
+
+ <name></name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.appc</groupId>
+ <artifactId>onap-appc-service-communicator</artifactId>
+ <version>${project.version}</version>
+ <type>xml</type>
+ <classifier>features</classifier>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/appc-service-communicator/appc-service-communicator-features/onap-appc-service-communicator/.gitignore b/appc-service-communicator/appc-service-communicator-features/onap-appc-service-communicator/.gitignore
new file mode 100644
index 000000000..eacf31a67
--- /dev/null
+++ b/appc-service-communicator/appc-service-communicator-features/onap-appc-service-communicator/.gitignore
@@ -0,0 +1 @@
+/target-ide/
diff --git a/appc-service-communicator/appc-service-communicator-features/onap-appc-service-communicator/pom.xml b/appc-service-communicator/appc-service-communicator-features/onap-appc-service-communicator/pom.xml
new file mode 100644
index 000000000..b0b5bd417
--- /dev/null
+++ b/appc-service-communicator/appc-service-communicator-features/onap-appc-service-communicator/pom.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+============LICENSE_START=======================================================
+ONAP : APPC
+================================================================================
+Copyright (C) 2019 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=========================================================
+-->
+<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.appc.parent</groupId>
+ <artifactId>single-feature-parent</artifactId>
+ <version>2.6.2</version>
+ <relativePath />
+ </parent>
+
+ <groupId>org.onap.appc</groupId>
+ <artifactId>onap-appc-service-communicator</artifactId>
+ <version>1.7.0-SNAPSHOT</version>
+ <packaging>feature</packaging>
+
+ <name></name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.appc</groupId>
+ <artifactId>appc-service-communicator-bundle</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.karaf.tooling</groupId>
+ <artifactId>karaf-maven-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <includeTransitiveDependency>false</includeTransitiveDependency>
+ <excludedArtifactIds>
+ <excludedArtifactId>slf4j-api</excludedArtifactId>
+ <excludedArtifactId>tomcat-jdbc</excludedArtifactId>
+ <excludedArtifactId>tomcat-juli</excludedArtifactId>
+ <excludedArtifactId>httpcore</excludedArtifactId>
+ <excludedArtifactId>httpclient</excludedArtifactId>
+ <excludedArtifactId>org.eclipse.osgi</excludedArtifactId>
+
+ </excludedArtifactIds>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/appc-service-communicator/appc-service-communicator-features/pom.xml b/appc-service-communicator/appc-service-communicator-features/pom.xml
new file mode 100644
index 000000000..29ca05c54
--- /dev/null
+++ b/appc-service-communicator/appc-service-communicator-features/pom.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+============LICENSE_START=======================================================
+ONAP : APPC
+================================================================================
+Copyright (C) 2019 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=========================================================
+-->
+<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.appc.parent</groupId>
+ <artifactId>odlparent-lite</artifactId>
+ <version>2.6.2</version>
+ <relativePath />
+ </parent>
+
+ <groupId>org.onap.appc</groupId>
+ <artifactId>appc-service-communicator-feature-aggregator</artifactId>
+ <version>1.7.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <name></name>
+
+ <modules>
+ <module>onap-appc-service-communicator</module>
+ <module>features-appc-service-communicator</module>
+ </modules>
+</project>
diff --git a/appc-service-communicator/appc-service-communicator-installer/.gitignore b/appc-service-communicator/appc-service-communicator-installer/.gitignore
new file mode 100644
index 000000000..8d5c481a8
--- /dev/null
+++ b/appc-service-communicator/appc-service-communicator-installer/.gitignore
@@ -0,0 +1,24 @@
+# ============LICENSE_START==========================================
+# ONAP : APPC
+# ===================================================================
+# Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+# ===================================================================
+#
+# Unless otherwise specified, all software contained herein is licensed
+# under the Apache License, Version 2.0 (the License);
+# you may not use this software 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.
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+# ============LICENSE_END============================================
+/target/
+/target-ide/
+/.settings/
diff --git a/appc-service-communicator/appc-service-communicator-installer/pom.xml b/appc-service-communicator/appc-service-communicator-installer/pom.xml
new file mode 100644
index 000000000..5cbd64dd1
--- /dev/null
+++ b/appc-service-communicator/appc-service-communicator-installer/pom.xml
@@ -0,0 +1,164 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============LICENSE_START=======================================================
+ ONAP : APPC
+ ================================================================================
+ Copyright (C) 2019 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=========================================================
+ -->
+<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>
+ <artifactId>odlparent-lite</artifactId>
+ <groupId>org.onap.appc.parent</groupId>
+ <version>2.6.2</version>
+ <relativePath />
+ </parent>
+ <groupId>org.onap.appc</groupId>
+ <artifactId>appc-service-communicator-installer</artifactId>
+ <name>dMaaP Adapter - Karaf Installer</name>
+ <packaging>pom</packaging>
+
+ <properties>
+ <application.name>appc-service-communicator</application.name>
+ <features.boot>appc-service-communicator</features.boot>
+ <features.repositories>mvn:org.onap.appc/onap-appc-service-communicator/${project.version}/xml/features</features.repositories>
+ <include.transitive.dependencies>false</include.transitive.dependencies>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.appc</groupId>
+ <artifactId>onap-appc-service-communicator</artifactId>
+ <version>${project.version}</version>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <exclusions>
+ <exclusion>
+ <groupId>*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.onap.appc</groupId>
+ <artifactId>appc-service-communicator-bundle</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>maven-repo-zip</id>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <appendAssemblyId>false</appendAssemblyId>
+ <attach>false</attach>
+ <finalName>stage/${application.name}-${project.version}</finalName>
+ <descriptors>
+ <descriptor>src/assembly/assemble_mvnrepo_zip.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </execution>
+ <execution>
+ <id>installer-zip</id>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <appendAssemblyId>false</appendAssemblyId>
+ <attach>true</attach>
+ <finalName>${application.name}-${project.version}</finalName>
+ <descriptors>
+ <descriptor>src/assembly/assemble_installer_zip.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-dependencies</id>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ <phase>prepare-package</phase>
+ <configuration>
+ <transitive>false</transitive>
+ <outputDirectory>${project.build.directory}/assembly/system</outputDirectory>
+ <overWriteReleases>false</overWriteReleases>
+ <overWriteSnapshots>true</overWriteSnapshots>
+ <overWriteIfNewer>true</overWriteIfNewer>
+ <useRepositoryLayout>true</useRepositoryLayout>
+ <addParentPoms>false</addParentPoms>
+ <copyPom>false</copyPom>
+ <excludeGroupIds>org.opendaylight</excludeGroupIds>
+ <scope>provided</scope>
+ <artifactItems>
+ <artifactItem>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-annotations</artifactId>
+ <version>2.5.4</version>
+ <type>jar</type>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-version</id>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <!-- here the phase you need -->
+ <phase>validate</phase>
+ <configuration>
+ <outputDirectory>${basedir}/target/stage</outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/resources/scripts</directory>
+ <includes>
+ <include>install-feature.sh</include>
+ </includes>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+ </build>
+
+ <version>1.7.0-SNAPSHOT</version>
+</project>
diff --git a/appc-service-communicator/appc-service-communicator-installer/src/assembly/assemble_installer_zip.xml b/appc-service-communicator/appc-service-communicator-installer/src/assembly/assemble_installer_zip.xml
new file mode 100644
index 000000000..d35f40d83
--- /dev/null
+++ b/appc-service-communicator/appc-service-communicator-installer/src/assembly/assemble_installer_zip.xml
@@ -0,0 +1,61 @@
+<!--
+ ============LICENSE_START=======================================================
+ ONAP : APPC
+ ================================================================================
+ Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ ================================================================================
+ Copyright (C) 2017 Amdocs
+ =============================================================================
+ 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=========================================================
+ -->
+
+<!-- Defines how we build the .zip file which is our distribution. -->
+
+<assembly
+ xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+ <id>adapter</id>
+ <formats>
+ <format>zip</format>
+ </formats>
+
+ <!-- we want "system" and related files right at the root level
+ as this file is suppose to be unzip on top of a karaf
+ distro. -->
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <fileSet>
+ <directory>target/stage/</directory>
+ <outputDirectory>${application.name}</outputDirectory>
+ <fileMode>755</fileMode>
+ <includes>
+ <include>*.sh</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>target/stage/</directory>
+ <outputDirectory>${application.name}</outputDirectory>
+ <fileMode>644</fileMode>
+ <excludes>
+ <exclude>*.sh</exclude>
+ </excludes>
+ </fileSet>
+ </fileSets>
+
+
+
+</assembly>
diff --git a/appc-service-communicator/appc-service-communicator-installer/src/assembly/assemble_mvnrepo_zip.xml b/appc-service-communicator/appc-service-communicator-installer/src/assembly/assemble_mvnrepo_zip.xml
new file mode 100644
index 000000000..46f5607aa
--- /dev/null
+++ b/appc-service-communicator/appc-service-communicator-installer/src/assembly/assemble_mvnrepo_zip.xml
@@ -0,0 +1,49 @@
+<!--
+ ============LICENSE_START=======================================================
+ ONAP : APPC
+ ================================================================================
+ Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ ================================================================================
+ Copyright (C) 2017 Amdocs
+ =============================================================================
+ 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=========================================================
+ -->
+
+<!-- Defines how we build the .zip file which is our distribution. -->
+
+<assembly
+ xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+ <id>adapter</id>
+ <formats>
+ <format>zip</format>
+ </formats>
+
+ <!-- we want "system" and related files right at the root level
+ as this file is suppose to be unzip on top of a karaf
+ distro. -->
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <fileSet>
+ <directory>target/assembly/</directory>
+ <outputDirectory>.</outputDirectory>
+ <excludes>
+ </excludes>
+ </fileSet>
+ </fileSets>
+
+</assembly>
diff --git a/appc-service-communicator/appc-service-communicator-installer/src/main/resources/scripts/install-feature.sh b/appc-service-communicator/appc-service-communicator-installer/src/main/resources/scripts/install-feature.sh
new file mode 100755
index 000000000..836910190
--- /dev/null
+++ b/appc-service-communicator/appc-service-communicator-installer/src/main/resources/scripts/install-feature.sh
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+###
+# ============LICENSE_START=======================================================
+# ONAP : APPC
+# ================================================================================
+# Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+# ================================================================================
+# Copyright (C) 2017 Amdocs
+# =============================================================================
+# 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=========================================================
+###
+
+ODL_HOME=${ODL_HOME:-/opt/opendaylight/current}
+ODL_KARAF_CLIENT=${ODL_KARAF_CLIENT:-${ODL_HOME}/bin/client}
+ODL_KARAF_CLIENT_OPTS=${ODL_KARAF_CLIENT_OPTS:-""}
+INSTALLERDIR=$(dirname $0)
+
+REPOZIP=${INSTALLERDIR}/${features.boot}-${project.version}.zip
+
+if [ -f ${REPOZIP} ]
+then
+ unzip -n -d ${ODL_HOME} ${REPOZIP}
+
+fi
+
+COUNT=0
+while [ $COUNT -lt 10 ]; do
+ ${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:repo-add ${features.repositories} 2> /tmp/installErr
+ cat /tmp/installErr
+ if grep -q 'Failed to get the session' /tmp/installErr; then
+ sleep 10
+ else
+ let COUNT=10
+ fi
+ let COUNT=COUNT+1
+done
diff --git a/appc-service-communicator/pom.xml b/appc-service-communicator/pom.xml
new file mode 100644
index 000000000..cedb308dd
--- /dev/null
+++ b/appc-service-communicator/pom.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============LICENSE_START=======================================================
+ ONAP : APPC
+ ================================================================================
+ Copyright (C) 2019 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=========================================================
+ -->
+<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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onap.appc.parent</groupId>
+ <artifactId>odlparent-lite</artifactId>
+ <version>2.6.2</version>
+ <relativePath />
+ </parent>
+ <groupId>org.onap.appc</groupId>
+ <artifactId>appc-service-communicator</artifactId>
+ <name>Service Communicator</name>
+ <description>Provides an interface between the main appc and appc microservices</description>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>appc-service-communicator-bundle</module>
+ <module>appc-service-communicator-features</module>
+ <module>appc-service-communicator-installer</module>
+ </modules>
+ <version>1.7.0-SNAPSHOT</version>
+</project>