aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src')
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/site-docs/adoc/fragments/ct-restserver-io.adoc134
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/site/asciidoc/engine-config.adoc14
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/site/css/site.css100
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/site/images/logos.pngbin0 -> 162383 bytes
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/site/site.xml29
5 files changed, 277 insertions, 0 deletions
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/site-docs/adoc/fragments/ct-restserver-io.adoc b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/site-docs/adoc/fragments/ct-restserver-io.adoc
new file mode 100644
index 000000000..c6c9a0865
--- /dev/null
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/site-docs/adoc/fragments/ct-restserver-io.adoc
@@ -0,0 +1,134 @@
+//
+// ============LICENSE_START=======================================================
+// Copyright (C) 2016-2018 Ericsson. All rights reserved.
+// ================================================================================
+// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE
+// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode
+//
+// SPDX-License-Identifier: CC-BY-4.0
+// ============LICENSE_END=========================================================
+//
+// @author Sven van der Meer (sven.van.der.meer@ericsson.com)
+//
+
+== REST Server IO
+
+APEX supports a REST server for input and output.
+
+The REST server plugin always uses a synchronous mode.
+A client does a HTTP GET on the APEX REST server with the input event and receives the generated output event in the server reply.
+This means that for the REST server there has to always to be an input with an associated output.
+Input or output only are not permitted.
+
+The plugin will start a Grizzly server as REST server for a normal APEX engine.
+If the APEX engine is executed as a servlet, for instance inside Tomcat, then Tomcat will be used as REST server (this case requires configuration on Tomcat as well).
+
+Some configuration restrictions apply for all scenarios:
+
+- Minimum port: 1024
+- Maximum port: 65535
+- The media type is `application/json`, so this plugin does only work with the JSON Event protocol.
+
+The URL the client calls is created using
+
+- the configured host and port, e.g. `http://localhost:12345`
+- the standard path, e.g. `/apex/`
+- the name of the input/output, e.g. `FirstConsumer/`
+- the input or output name, e.g. `EventIn`.
+
+The examples above lead to the URL `http://localhost:12345/apex/FirstConsumer/EventIn`.
+
+A client can also get status information of the REST server using `/Status`, e.g. `http://localhost:12345/apex/FirstConsumer/Status`.
+
+
+=== REST Server Stand-alone
+
+We need to configure a REST server input and a REST server output.
+Input and output are associated with each other via there name.
+
+Timeouts for REST calls need to be set carefully.
+If they are too short, the call might timeout before a policy finished creating an event.
+
+The following example configures the input named as `MyConsumer` and associates an output named `MyProducer` with it.
+
+[source%nowrap,json]
+----
+"eventInputParameters": {
+ "MyConsumer": {
+ "carrierTechnologyParameters" : {
+ "carrierTechnology" : "RESTSERVER", <1>
+ "parameterClassName" :
+ "org.onap.policy.apex.plugins.event.carrier.restserver.RESTServerCarrierTechnologyParameters",
+ "parameters" : {
+ "standalone" : true, <2>
+ "host" : "localhost", <3>
+ "port" : 12345 <4>
+ }
+ },
+ "eventProtocolParameters":{
+ "eventProtocol" : "JSON" <5>
+ },
+ "synchronousMode" : true, <6>
+ "synchronousPeer" : "MyProducer", <7>
+ "synchronousTimeout" : 500 <8>
+ }
+}
+----
+<1> set REST server as carrier technology
+<2> set the server as stand-alone
+<3> set the server host
+<4> set the server listen port
+<5> use JSON event protocol
+<6> activate synchronous mode
+<7> associate an output `MyProducer`
+<8> set a timeout of 500 milliseconds
+
+
+The following example configures the output named as `MyProducer` and associates the input `MyConsumer` with it.
+Note that for the output there are no more paramters (such as host or port), since they are already configured in the associated input
+
+[source%nowrap,json]
+----
+"eventOutputParameters": {
+ "MyProducer": {
+ "carrierTechnologyParameters":{
+ "carrierTechnology" : "RESTSERVER",
+ "parameterClassName" :
+ "org.onap.policy.apex.plugins.event.carrier.restserver.RESTServerCarrierTechnologyParameters"
+ },
+ "eventProtocolParameters":{
+ "eventProtocol" : "JSON"
+ },
+ "synchronousMode" : true,
+ "synchronousPeer" : "MyConsumer",
+ "synchronousTimeout" : 500
+ }
+}
+----
+
+
+=== REST Server Stand-alone, multi input
+
+Any number of input/output pairs for REST servers can be configured.
+For instance, we can configure an input `FirstConsumer` with output `FirstProducer` and an input `SecondConsumer` with output `SecondProducer`.
+Important is that there is always one pair of input/output.
+
+
+=== REST Server Stand-alone in Servlet
+
+If APEX is executed as a servlet, e.g. inside Tomcat, the configuration becomes easier since the plugin can now use Tomcat as the REST server.
+In this scenario, there are not parameters (port, host, etc.) and the key `standalone` must not be used (or set to false).
+
+For the Tomcat configuration, we need to add the REST server plugin, e.g.
+
+[source%nowrap,xml]
+----
+<servlet>
+ ...
+ <init-param>
+ ...
+ <param-value>org.onap.policy.apex.plugins.event.carrier.restserver</param-value>
+ </init-param>
+ ...
+</servlet>
+----
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/site/asciidoc/engine-config.adoc b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/site/asciidoc/engine-config.adoc
new file mode 100644
index 000000000..043ed04d1
--- /dev/null
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/site/asciidoc/engine-config.adoc
@@ -0,0 +1,14 @@
+//
+// ============LICENSE_START=======================================================
+// Copyright (C) 2016-2018 Ericsson. All rights reserved.
+// ================================================================================
+// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE
+// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode
+//
+// SPDX-License-Identifier: CC-BY-4.0
+// ============LICENSE_END=========================================================
+//
+// @author Sven van der Meer (sven.van.der.meer@ericsson.com)
+//
+
+include::{adsite-plugins-event-carrier-restserver-dir}/site-docs/adoc/fragments/ct-restserver-io.adoc[]
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/site/css/site.css b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/site/css/site.css
new file mode 100644
index 000000000..ef8bd4d15
--- /dev/null
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/site/css/site.css
@@ -0,0 +1,100 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2016-2018 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+@import url(http://cdnjs.cloudflare.com/ajax/libs/font-awesome/3.2.0/css/font-awesome.css);
+
+
+/*************** Table definitions *******************/
+
+tableblock > .title, .tableblock > caption { line-height: 1.4; color: #7a2518; font-weight: 300; margin-top: 0.2em; margin-bottom: 0.5em; }
+
+.tableblock > caption { text-align: left; font-weight: bold; white-space: nowrap; overflow: visible; max-width: 0; }
+
+table.tableblock { background: white; margin-bottom: 1.25em; border: solid 1px #dddddd; }
+table.tableblock thead, table.tableblock tfoot { background: whitesmoke; font-weight: bold; }
+table.tableblock thead tr th, table.tableblock thead tr td, table tfoot tr th, table tfoot tr td { padding: 0.5em 0.625em 0.625em; font-size: inherit; color: #222222; text-align: left; }
+table.tableblock tr th, table.tableblock tr td { padding: 0.5625em 0.625em; font-size: inherit; color: #222222; }
+table.tableblock tr.even, table.tableblock tr.alt, table.tableblock tr:nth-of-type(even) { background: #f9f9f9; }
+table.tableblock thead tr th, table.tableblock tfoot tr th, table.tableblock tbody tr td, table.tableblock tr td, table.tableblock tfoot tr td { display: table-cell; line-height: 1.6; }
+
+table.tableblock #preamble > .sectionbody > .paragraph:first-of-type p { font-size: inherit; }
+
+table.tableblock.grid-all { border-collapse: separate; border-spacing: 1px; -webkit-border-radius: 4px; border-radius: 4px; border-top: 1px solid #dddddd; border-bottom: 1px solid #dddddd; }
+
+table.tableblock.frame-topbot, table.tableblock.frame-none { border-left: 0; border-right: 0; }
+
+table.tableblock.frame-sides, table.tableblock.frame-none { border-top: 0; border-bottom: 0; }
+
+table.tableblock td .paragraph:last-child p, table.tableblock td > p:last-child { margin-bottom: 0; }
+
+th.tableblock.halign-left, td.tableblock.halign-left { text-align: left; }
+
+th.tableblock.halign-right, td.tableblock.halign-right { text-align: right; }
+
+th.tableblock.halign-center, td.tableblock.halign-center { text-align: center; }
+
+th.tableblock.valign-top, td.tableblock.valign-top { vertical-align: top; }
+
+th.tableblock.valign-bottom, td.tableblock.valign-bottom { vertical-align: bottom; }
+
+th.tableblock.valign-middle, td.tableblock.valign-middle { vertical-align: middle; }
+
+p.tableblock.header { color: #222222; font-weight: bold; }
+
+
+
+/*************** KBD Macro definitions *******************/
+
+kbd.keyseq { color: #555555; }
+
+kbd:not(.keyseq) { display: inline-block; color: #222222; font-size: 0.75em; line-height: 1.4; background-color: #F7F7F7; border: 1px solid #ccc; -webkit-border-radius: 3px; border-radius: 3px; -webkit-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2), 0 0 0 2px white inset; box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2), 0 0 0 2px white inset; margin: -0.15em 0.15em 0 0.15em; padding: 0.2em 0.6em 0.2em 0.5em; vertical-align: middle; white-space: nowrap; }
+
+kbd kbd:first-child { margin-left: 0; }
+
+kbd kbd:last-child { margin-right: 0; }
+
+
+/*************** Admontion Blocks definitions *******************/
+.admonitionblock td.content > .title, .exampleblock > .title, .imageblock > .title, .videoblock > .title, .listingblock > .title, .literalblock > .title, .openblock > .title, .paragraph > .title, .quoteblock > .title, .sidebarblock > .title, .tableblock > .title, .verseblock > .title, .dlist > .title, .olist > .title, .ulist > .title, .qlist > .title, .hdlist > .title { text-align: left; font-weight: bold; }
+
+.admonitionblock > table { border: 0; background: none; width: 100%; margin-top: 1em; margin-bottom: 1em;}
+.admonitionblock > table td.icon { text-align: center; width: 80px; }
+.admonitionblock > table td.icon img { max-width: none; }
+.admonitionblock > table td.icon .title { font-weight: bold; text-transform: uppercase; }
+.admonitionblock > table td.content { padding-left: 1.125em; padding-right: 1.25em; border-left: 1px solid #dddddd; color: #6f6f6f; }
+.admonitionblock > table td.content > :last-child > :last-child { margin-bottom: 0; }
+
+.admonitionblock td.icon [class^="fa icon-"]:before {font-size:2.5em;text-shadow:1px 1px 2px rgba(0,0,0,.5);cursor:default}
+.admonitionblock td.icon .icon-note:before { content: "\f05a"; color: #005498; color: #003f72; }
+.admonitionblock td.icon .icon-tip:before { content: "\f0eb"; text-shadow: 1px 1px 2px rgba(155, 155, 0, 0.8); color: #111; }
+.admonitionblock td.icon .icon-warning:before { content: "\f071"; color: #bf6900; }
+.admonitionblock td.icon .icon-caution:before { content: "\f06d"; color: #bf3400; }
+.admonitionblock td.icon .icon-important:before { content: "\f06a"; color: #bf0000; }
+
+
+
+/*************** Misc definitions *******************/
+
+*:not(pre) > code { font-size: 0.9375em; padding: 1px 3px 0; white-space: nowrap; background-color: #f2f2f2; border: 1px solid #cccccc; -webkit-border-radius: 4px; border-radius: 4px; text-shadow: none; }
+
+pre, pre > code { line-height: 1.4; color: inherit; font-family: Consolas, "Liberation Mono", Courier, monospace; font-weight: normal; }
+
+code { font-family: Consolas, "Liberation Mono", Courier, monospace; font-weight: normal; color: #6d180b; }
+
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/site/images/logos.png b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/site/images/logos.png
new file mode 100644
index 000000000..915d6e59d
--- /dev/null
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/site/images/logos.png
Binary files differ
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/site/site.xml b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/site/site.xml
new file mode 100644
index 000000000..84c094eec
--- /dev/null
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restserver/src/site/site.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============LICENSE_START=======================================================
+ Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ ================================================================================
+ This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE
+ Full license text at https://creativecommons.org/licenses/by/4.0/legalcode
+
+ SPDX-License-Identifier: CC-BY-4.0
+ ============LICENSE_END=========================================================
+
+ @author Sven van der Meer (sven.van.der.meer@ericsson.com)
+
+-->
+
+<project name="APEX Plugins Event Carrier REST-Server">
+ <body>
+ <menu name="APEX Plugins Event Carrier REST-Server">
+ <item href="engine-config.html" name="Engine Configuration" />
+ <item href="javadocs/index.html" name="API Doc" />
+ </menu>
+ <menu ref="reports" inherit="top" />
+ <menu ref="modules" />
+
+ <breadcrumbs>
+ <item name="REST-Server" href="index.html" />
+ </breadcrumbs>
+ </body>
+</project> \ No newline at end of file