unomi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shu...@apache.org
Subject svn commit: r1841490 [3/5] - in /incubator/unomi/website: ./ WEB-INF/ assets/ css/ images/ js/ latest/ latest/connectors/ latest/images/ latest/samples/ rest-api-doc/
Date Thu, 20 Sep 2018 18:43:12 GMT
Added: incubator/unomi/website/latest/custom-extensions.html
URL: http://svn.apache.org/viewvc/incubator/unomi/website/latest/custom-extensions.html?rev=1841490&view=auto
==============================================================================
--- incubator/unomi/website/latest/custom-extensions.html (added)
+++ incubator/unomi/website/latest/custom-extensions.html Thu Sep 20 18:43:11 2018
@@ -0,0 +1,478 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+<meta charset="UTF-8">
+<!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge"><![endif]-->
+<meta name="viewport" content="width=device-width, initial-scale=1.0">
+<meta name="generator" content="Asciidoctor 1.5.6.1">
+<title>Custom extensions</title>
+<link rel="stylesheet" href="./apache.css">
+</head>
+<body class="article">
+<div id="header">
+<div id="toc" class="toc">
+<div id="toctitle">Table of Contents</div>
+<ul class="sectlevel2">
+<li><a href="#_custom_extensions">Custom extensions</a></li>
+</ul>
+</div>
+</div>
+<div id="content">
+<div class="sect2">
+<h3 id="_custom_extensions">Custom extensions</h3>
+<div class="paragraph">
+<p>Apache Unomi is a pluggeable server that may be extended in many ways. This document
assumes you are familiar with the
+<a href="concepts.html">Apache Unomi concepts</a> . This document is mostly a
reference document on the different things that may
+be used inside an extension. If you are looking for complete samples, please see the <a
href="samples.html">samples page</a>.</p>
+</div>
+<div class="sect3">
+<h4 id="_creating_an_extension">Creating an extension</h4>
+<div class="paragraph">
+<p>An extension is simply a Maven project, with a Maven pom that looks like this:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="highlight"><code>&lt;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"&gt;
+    &lt;parent&gt;
+        &lt;groupId&gt;org.apache.unomi&lt;/groupId&gt;
+        &lt;artifactId&gt;unomi-extensions&lt;/artifactId&gt;
+        &lt;version&gt;${project.version}&lt;/version&gt;
+    &lt;/parent&gt;
+
+    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
+
+    &lt;artifactId&gt;unomi-extension-example&lt;/artifactId&gt;
+    &lt;name&gt;Apache Unomi :: Extensions :: Example&lt;/name&gt;
+    &lt;description&gt;Service implementation for the Apache Unomi Context Server
extension that integrates with the Geonames database&lt;/description&gt;
+    &lt;version&gt;${project.version}&lt;/version&gt;
+    &lt;packaging&gt;bundle&lt;/packaging&gt;
+
+    &lt;dependencies&gt;
+        &lt;!-- This dependency is not required but generally used in extensions --&gt;
+        &lt;dependency&gt;
+            &lt;groupId&gt;org.apache.unomi&lt;/groupId&gt;
+            &lt;artifactId&gt;unomi-api&lt;/artifactId&gt;
+            &lt;version&gt;${project.version}&lt;/version&gt;
+            &lt;scope&gt;provided&lt;/scope&gt;
+        &lt;/dependency&gt;
+    &lt;/dependencies&gt;
+
+    &lt;build&gt;
+        &lt;plugins&gt;
+            &lt;plugin&gt;
+                &lt;groupId&gt;org.apache.felix&lt;/groupId&gt;
+                &lt;artifactId&gt;maven-bundle-plugin&lt;/artifactId&gt;
+                &lt;extensions&gt;true&lt;/extensions&gt;
+                &lt;configuration&gt;
+                    &lt;instructions&gt;
+                        &lt;Embed-Dependency&gt;*;scope=compile|runtime&lt;/Embed-Dependency&gt;
+                        &lt;Import-Package&gt;
+                            sun.misc;resolution:=optional,
+                            *
+                        &lt;/Import-Package&gt;
+                    &lt;/instructions&gt;
+                &lt;/configuration&gt;
+            &lt;/plugin&gt;
+        &lt;/plugins&gt;
+    &lt;/build&gt;
+&lt;/project&gt;</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>An extension may contain many different kinds of Apache Unomi objects, as well as
custom OSGi services or anything that
+is needed to build your application.</p>
+</div>
+</div>
+<div class="sect3">
+<h4 id="_deployment_and_custom_definition">Deployment and custom definition</h4>
+<div class="paragraph">
+<p>When you deploy a custom bundle with a custom definition (see "Predefined xxx" chapters
under) for the first time, the definition will automatically be deployed at your bundle start
event <strong>if it does not exist</strong>, after that if you redeploy the same
bundle there are two cases:
+1. Your bundle <strong>is a SNAPSHOT</strong> then every time you redeploy it
the definition will be redeployed
+2. Your bundle <strong>is NOT a SNAPSHOT</strong> then the definition will not
be redeployed, but you can redeploy it manually using the command <code>unomi:deploy-definition
&lt;bundleId&gt; &lt;fileName&gt;</code></p>
+</div>
+</div>
+<div class="sect3">
+<h4 id="_predefined_segments">Predefined segments</h4>
+<div class="paragraph">
+<p>You may provide pre-defined segments by simply adding a JSON file in the src/main/resources/META-INF/cxs/segments
directory of
+your Maven project. Here is an example of a pre-defined segment:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="highlight"><code>{
+  "metadata": {
+    "id": "leads",
+    "name": "Leads",
+    "scope": "systemscope",
+    "description": "You can customize the list below by editing the leads segment.",
+    "readOnly":true
+  },
+  "condition": {
+    "parameterValues": {
+      "subConditions": [
+        {
+          "parameterValues": {
+            "propertyName": "properties.leadAssignedTo",
+            "comparisonOperator": "exists"
+          },
+          "type": "profilePropertyCondition"
+        }
+      ],
+      "operator" : "and"
+    },
+    "type": "booleanCondition"
+  }
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>Basically this segment uses a condition to test if the profile has a property <code>leadAssignedTo</code>
that exists. All profiles
+that match this condition will be part of the pre-defined segment.</p>
+</div>
+</div>
+<div class="sect3">
+<h4 id="_predefined_rules">Predefined rules</h4>
+<div class="paragraph">
+<p>You may provide pre-defined rules by simply adding a JSON file in the src/main/resources/META-INF/cxs/rules
directory of
+your Maven project. Here is an example of a pre-defined rule:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="highlight"><code>{
+    "metadata" : {
+        "id": "evaluateProfileSegments",
+        "name": "Evaluate segments",
+        "description" : "Evaluate segments when a profile is modified",
+        "readOnly":true
+    },
+
+    "condition" : {
+        "type": "profileUpdatedEventCondition",
+        "parameterValues": {
+        }
+    },
+
+    "actions" : [
+        {
+            "type": "evaluateProfileSegmentsAction",
+            "parameterValues": {
+            }
+        }
+    ]
+
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>In this example we provide a rule that will execute when a predefined composed condition
of type
+"profileUpdatedEventCondition" is received. See below to see how predefined composed conditions
are declared.
+Once the condition is matched, the actions will be executed in sequence. In this example
there is only a single
+action of type "evaluateProfileSegmentsAction" that is defined so it will be executed by
Apache Unomi&#8217;s rule engine.
+You can also see below how custom actions may be defined.</p>
+</div>
+</div>
+<div class="sect3">
+<h4 id="_predefined_properties">Predefined properties</h4>
+<div class="paragraph">
+<p>By default Apache Unomi comes with a set of pre-defined properties, but in many
cases it is useful to add additional
+predefined property definitions. You can create property definitions for session or profile
properties by creating them
+in different directories.</p>
+</div>
+<div class="paragraph">
+<p>For session properties you must create a JSON file in the following directory in
your Maven project:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="highlight"><code>src/main/resources/META-INF/cxs/properties/sessions</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>For profile properties you must create the JSON file inside the directory in your
Maven project:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="highlight"><code>src/main/resources/META-INF/cxs/properties/profiles</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>Here is an example of a property definition JSON file</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="highlight"><code>{
+    "metadata": {
+        "id": "city",
+        "name": "City",
+        "systemTags": ["properties", "profileProperties", "contactProfileProperties"]
+    },
+    "type": "string",
+    "defaultValue": "",
+    "automaticMappingsFrom": [ ],
+    "rank": "304.0"
+}</code></pre>
+</div>
+</div>
+</div>
+<div class="sect3">
+<h4 id="_predefined_child_conditions">Predefined child conditions</h4>
+<div class="paragraph">
+<p>You can define new predefined conditions that are actually conditions inheriting
from a parent condition and setting
+pre-defined parameter values. You can do this by creating a JSON file in:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="highlight"><code>src/main/resources/META-INF/cxs/conditions</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>Here is an example of a JSON file that defines a profileUpdateEventCondition that
inherits from a parent condition of
+type eventTypeCondition.</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="highlight"><code>{
+  "metadata": {
+    "id": "profileUpdatedEventCondition",
+    "name": "profileUpdatedEventCondition",
+    "description": "",
+    "systemTags": [
+      "event",
+      "eventCondition"
+    ],
+    "readOnly": true
+  },
+  "parentCondition": {
+    "type": "eventTypeCondition",
+    "parameterValues": {
+      "eventTypeId": "profileUpdated"
+    }
+  },
+
+  "parameters": [
+  ]
+}</code></pre>
+</div>
+</div>
+</div>
+<div class="sect3">
+<h4 id="_predefined_personas">Predefined personas</h4>
+<div class="paragraph">
+<p>Personas may also be pre-defined by creating JSON files in the following directory:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="highlight"><code>src/main/resources/META-INF/cxs/personas</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>Here is an example of a persona definition JSON file:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="highlight"><code>{
+    "persona": {
+        "itemId": "usVisitor",
+        "properties": {
+            "description": "Represents a visitor browsing from inside the continental US",
+            "firstName": "U.S.",
+            "lastName": "Visitor"
+        },
+        "segments": []
+    },
+    "sessions": [
+        {
+            "itemId": "aa3b04bd-8f4d-4a07-8e96-d33ffa04d3d9",
+            "profileId": "usVisitor",
+            "properties": {
+                "operatingSystemName": "OS X 10.9 Mavericks",
+                "sessionCountryName": "United States",
+                "location": {
+                    "lat":37.422,
+                    "lon":-122.084058
+                },
+                "userAgentVersion": "37.0.2062.120",
+                "sessionCountryCode": "US",
+                "deviceCategory": "Personal computer",
+                "operatingSystemFamily": "OS X",
+                "userAgentName": "Chrome",
+                "sessionCity": "Mountain View"
+            },
+            "timeStamp": "2014-09-18T11:40:54Z",
+            "lastEventDate": "2014-09-18T11:40:59Z",
+            "duration": 4790
+        }
+    ]
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>You can see that it&#8217;s also possible to define sessions for personas.</p>
+</div>
+</div>
+<div class="sect3">
+<h4 id="_custom_actions">Custom actions</h4>
+<div class="paragraph">
+<p>Custom actions are a powerful way to integrate with external systems by being able
to define custom logic that will
+be executed by an Apache Unomi rule. An action is defined by a JSON file created in the following
directory:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="highlight"><code>src/main/resources/META-INF/cxs/actions</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>Here is an example of a JSON action definition:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="highlight"><code>{
+  "metadata": {
+    "id": "addToListsAction",
+    "name": "addToListsAction",
+    "description": "",
+    "systemTags": [
+      "demographic",
+      "availableToEndUser"
+    ],
+    "readOnly": true
+  },
+  "actionExecutor": "addToLists",
+  "parameters": [
+    {
+      "id": "listIdentifiers",
+      "type": "string",
+      "multivalued": true
+    }
+  ]
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>The <code>actionExecutor</code> identifier refers to a service property
that is defined in the OSGi Blueprint service registration.
+Note that any OSGi service registration may be used, but in these examples we use OSGi Blueprint.
The definition for the
+above JSON file will be found in a file called <code>src/main/resources/OSGI-INF/blueprint/blueprint.xml</code>
with the following
+content:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="highlight"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
+&lt;blueprint xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd"&gt;
+
+    &lt;reference id="profileService" interface="org.apache.unomi.api.services.ProfileService"/&gt;
+    &lt;reference id="eventService" interface="org.apache.unomi.api.services.EventService"/&gt;
+
+    &lt;!-- Action executors --&gt;
+
+    &lt;service interface="org.apache.unomi.api.actions.ActionExecutor"&gt;
+        &lt;service-properties&gt;
+            &lt;entry key="actionExecutorId" value="addToLists"/&gt;
+        &lt;/service-properties&gt;
+        &lt;bean class="org.apache.unomi.lists.actions.AddToListsAction"&gt;
+            &lt;property name="profileService" ref="profileService"/&gt;
+            &lt;property name="eventService" ref="eventService"/&gt;
+        &lt;/bean&gt;
+    &lt;/service&gt;
+
+&lt;/blueprint&gt;</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>You can note here the <code>actionExecutorId</code> that corresponds
to the <code>actionExecutor</code> in the JSON file.</p>
+</div>
+<div class="paragraph">
+<p>The implementation of the action is available here : <a href="https://github.com/apache/incubator-unomi/blob/master/extensions/lists-extension/actions/src/main/java/org/apache/unomi/lists/actions/AddToListsAction.java">org.apache.unomi.lists.actions.AddToListsAction</a></p>
+</div>
+</div>
+<div class="sect3">
+<h4 id="_custom_conditions">Custom conditions</h4>
+<div class="paragraph">
+<p>Custom conditions are different from predefined child conditions because they implement
their logic using Java classes.
+They are also declared by adding a JSON file into the conditions directory:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="highlight"><code>src/main/resources/META-INF/cxs/conditions</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>Here is an example of JSON custom condition definition:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="highlight"><code>{
+  "metadata": {
+    "id": "matchAllCondition",
+    "name": "matchAllCondition",
+    "description": "",
+    "systemTags": [
+      "logical",
+      "profileCondition",
+      "eventCondition",
+      "sessionCondition",
+      "sourceEventCondition"
+    ],
+    "readOnly": true
+  },
+  "conditionEvaluator": "matchAllConditionEvaluator",
+  "queryBuilder": "matchAllConditionESQueryBuilder",
+
+  "parameters": [
+  ]
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>Note the <code>conditionEvaluator</code> and the <code>queryBuilder</code>
values. These reference OSGi service properties that are declared
+in an OSGi Blueprint configuration file (other service definitions may also be used such
as Declarative Services or even
+Java registered services). Here is an example of an OSGi Blueprint definition corresponding
to the above JSON condition
+definition file.</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="highlight"><code>src/main/resources/OSGI-INF/blueprint/blueprint.xml
+
+&lt;blueprint xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd"&gt;
+
+    &lt;service
+            interface="org.apache.unomi.persistence.elasticsearch.conditions.ConditionESQueryBuilder"&gt;
+        &lt;service-properties&gt;
+            &lt;entry key="queryBuilderId" value="matchAllConditionESQueryBuilder"/&gt;
+        &lt;/service-properties&gt;
+        &lt;bean class="org.apache.unomi.plugins.baseplugin.conditions.MatchAllConditionESQueryBuilder"/&gt;
+    &lt;/service&gt;
+
+    &lt;service interface="org.apache.unomi.persistence.elasticsearch.conditions.ConditionEvaluator"&gt;
+        &lt;service-properties&gt;
+            &lt;entry key="conditionEvaluatorId" value="matchAllConditionEvaluator"/&gt;
+        &lt;/service-properties&gt;
+        &lt;bean class="org.apache.unomi.plugins.baseplugin.conditions.MatchAllConditionEvaluator"/&gt;
+    &lt;/service&gt;
+
+&lt;/blueprint&gt;</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>You can find the implementation of the two classes here :</p>
+</div>
+<div class="ulist">
+<ul>
+<li>
+<p><a href="https://github.com/apache/incubator-unomi/blob/master/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/MatchAllConditionESQueryBuilder.java">org.apache.unomi.plugins.baseplugin.conditions.MatchAllConditionESQueryBuilder</a></p>
+</li>
+<li>
+<p><a href="https://github.com/apache/incubator-unomi/blob/master/plugins/baseplugin/src/main/java/org/apache/unomi/plugins/baseplugin/conditions/MatchAllConditionEvaluator.java">org.apache.unomi.plugins.baseplugin.conditions.MatchAllConditionEvaluator</a></p>
+</li>
+</ul>
+</div>
+</div>
+</div>
+</div>
+<div id="footer">
+<div id="footer-text">
+Last updated 2018-09-10 11:30:03 CEST
+</div>
+</div>
+</body>
+</html>
\ No newline at end of file

Added: incubator/unomi/website/latest/extending-plugins.html
URL: http://svn.apache.org/viewvc/incubator/unomi/website/latest/extending-plugins.html?rev=1841490&view=auto
==============================================================================
--- incubator/unomi/website/latest/extending-plugins.html (added)
+++ incubator/unomi/website/latest/extending-plugins.html Thu Sep 20 18:43:11 2018
@@ -0,0 +1,206 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+<meta charset="UTF-8">
+<!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge"><![endif]-->
+<meta name="viewport" content="width=device-width, initial-scale=1.0">
+<meta name="generator" content="Asciidoctor 1.5.6.1">
+<title>Types vs. instances</title>
+<link rel="stylesheet" href="./apache.css">
+</head>
+<body class="article">
+<div id="header">
+<div id="toc" class="toc">
+<div id="toctitle">Table of Contents</div>
+<ul class="sectlevel2">
+<li><a href="#_types_vs_instances">Types vs. instances</a></li>
+<li><a href="#_plugin_structure">Plugin structure</a></li>
+<li><a href="#_extension_points">Extension points</a></li>
+<li><a href="#_other_unomi_entities">Other Unomi entities</a></li>
+</ul>
+</div>
+</div>
+<div id="content">
+<div class="paragraph">
+<p>Unomi is architected so that users can provided extensions in the form of plugins.</p>
+</div>
+<div class="sect2">
+<h3 id="_types_vs_instances">Types vs. instances</h3>
+<div class="paragraph">
+<p>Several extension points in Unomi rely on the concept of type: the extension defines
a prototype for what the actual items will be once parameterized with values known only at
runtime. This is similar to the concept of classes in object-oriented programming: types define
classes, providing the expected structure and which fields are expected to be provided at
runtime, that are then instantiated when needed with actual values.</p>
+</div>
+</div>
+<div class="sect2">
+<h3 id="_plugin_structure">Plugin structure</h3>
+<div class="paragraph">
+<p>Being built on top of Apache Karaf, Unomi leverages OSGi to support plugins. A Unomi
plugin is, thus, an OSGi bundle specifying some specific metadata to tell Unomi the kind of
entities it provides. A plugin can provide the following entities to extend Unomi, each with
its associated definition (as a JSON file), located in a specific spot within the <code>META-INF/cxs/</code>
directory of the bundle JAR file:</p>
+</div>
+<table class="tableblock frame-all grid-all spread">
+<colgroup>
+<col style="width: 50%;">
+<col style="width: 50%;">
+</colgroup>
+<thead>
+<tr>
+<th class="tableblock halign-left valign-top">Entity</th>
+<th class="tableblock halign-left valign-top">Location in <code>cxs</code>
directory</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td class="tableblock halign-left valign-top"><p class="tableblock">ActionType</p></td>
+<td class="tableblock halign-left valign-top"><p class="tableblock">actions</p></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-top"><p class="tableblock">ConditionType</p></td>
+<td class="tableblock halign-left valign-top"><p class="tableblock">conditions</p></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-top"><p class="tableblock">Persona</p></td>
+<td class="tableblock halign-left valign-top"><p class="tableblock">personas</p></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-top"><p class="tableblock">PropertyMergeStrategyType</p></td>
+<td class="tableblock halign-left valign-top"><p class="tableblock">mergers</p></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-top"><p class="tableblock">PropertyType</p></td>
+<td class="tableblock halign-left valign-top"><p class="tableblock">properties
then profiles or sessions subdirectory then <code>&lt;category name&gt;</code>
directory</p></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-top"><p class="tableblock">Rule</p></td>
+<td class="tableblock halign-left valign-top"><p class="tableblock">rules</p></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-top"><p class="tableblock">Scoring</p></td>
+<td class="tableblock halign-left valign-top"><p class="tableblock">scorings</p></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-top"><p class="tableblock">Segment</p></td>
+<td class="tableblock halign-left valign-top"><p class="tableblock">segments</p></td>
+</tr>
+<tr>
+<td class="tableblock halign-left valign-top"><p class="tableblock">ValueType</p></td>
+<td class="tableblock halign-left valign-top"><p class="tableblock">values</p></td>
+</tr>
+</tbody>
+</table>
+<div class="paragraph">
+<p><a href="http://aries.apache.org/modules/blueprint.html">Blueprint</a>
is used to declare what the plugin provides and inject any required dependency. The Blueprint
file is located, as usual, at <code>OSGI-INF/blueprint/blueprint.xml</code> in
the bundle JAR file.</p>
+</div>
+<div class="paragraph">
+<p>The plugin otherwise follows a regular maven project layout and should depend on
the Unomi API maven artifact:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="highlight"><code class="language-xml" data-lang="xml">&lt;dependency&gt;
+    &lt;groupId&gt;org.apache.unomi&lt;/groupId&gt;
+    &lt;artifactId&gt;unomi-api&lt;/artifactId&gt;
+    &lt;version&gt;...&lt;/version&gt;
+&lt;/dependency&gt;</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>Some plugins consists only of JSON definitions that are used to instantiate the
appropriate structures at runtime while some more involved plugins provide code that extends
Unomi in deeper ways.</p>
+</div>
+<div class="paragraph">
+<p>In both cases, plugins can provide more that one type of extension. For example,
a plugin could provide both `ActionType`s and `ConditionType`s.</p>
+</div>
+</div>
+<div class="sect2">
+<h3 id="_extension_points">Extension points</h3>
+<div class="sect3">
+<h4 id="_actiontype">ActionType</h4>
+<div class="paragraph">
+<p><code>ActionType`s define new actions that can be used as consequences of
Rules being triggered. When a rule triggers, it creates new actions based on the event data
and the rule internal processes, providing values for parameters defined in the associated
`ActionType</code>. Example actions include: “Set user property x to value y”
or “Send a message to service x”.</p>
+</div>
+</div>
+<div class="sect3">
+<h4 id="_conditiontype">ConditionType</h4>
+<div class="paragraph">
+<p>`ConditionType`s define new conditions that can be applied to items (for example
to decide whether a rule needs to be triggered or if a profile is considered as taking part
in a campaign) or to perform queries against the stored Unomi data. They may be implemented
in Java when attempting to define a particularly complex test or one that can better be optimized
by coding it. They may also be defined as combination of other conditions. A simple condition
could be: “User is male”, while a more generic condition with parameters may test
whether a given property has a specific value: “User property x has value y”.</p>
+</div>
+</div>
+<div class="sect3">
+<h4 id="_persona">Persona</h4>
+<div class="paragraph">
+<p>A persona is a "virtual" profile used to represent categories of profiles, and may
also be used to test how a personalized experience would look like using this virtual profile.
A persona can define predefined properties and sessions. Persona definition make it possible
to “emulate” a certain type of profile, e.g : US visitor, non-US visitor, etc.</p>
+</div>
+</div>
+<div class="sect3">
+<h4 id="_propertymergestrategytype">PropertyMergeStrategyType</h4>
+<div class="paragraph">
+<p>A strategy to resolve how to merge properties when merging profile together.</p>
+</div>
+</div>
+<div class="sect3">
+<h4 id="_propertytype">PropertyType</h4>
+<div class="paragraph">
+<p>Definition for a profile or session property, specifying how possible values are
constrained, if the value is multi-valued (a vector of values as opposed to a scalar value).
`PropertyType`s can also be categorized using systemTags or file system structure, using sub-directories
to organize definition files.</p>
+</div>
+</div>
+<div class="sect3">
+<h4 id="_rule">Rule</h4>
+<div class="paragraph">
+<p>`Rule`s are conditional sets of actions to be executed in response to incoming events.
Triggering of rules is guarded by a condition: the rule is only triggered if the associated
condition is satisfied. That condition can test the event itself, but also the profile or
the session. Once a rule triggers, a list of actions can be performed as consequences. Also,
when rules trigger, a specific event is raised so that other parts of Unomi can react accordingly.</p>
+</div>
+</div>
+<div class="sect3">
+<h4 id="_scoring">Scoring</h4>
+<div class="paragraph">
+<p>`Scoring`s are set of conditions associated with a value to assign to profiles when
matching so that the associated users can be scored along that dimension. Each scoring element
is evaluated and matching profiles' scores are incremented with the associated value.</p>
+</div>
+</div>
+<div class="sect3">
+<h4 id="_segments">Segments</h4>
+<div class="paragraph">
+<p>`Segment`s represent dynamically evaluated groups of similar profiles in order to
categorize the associated users. To be considered part of a given segment, users must satisfies
the segment’s condition. If they match, users are automatically added to the segment.
Similarly, if at any given point during, they cease to satisfy the segment’s condition,
they are automatically removed from it.</p>
+</div>
+</div>
+<div class="sect3">
+<h4 id="_tag">Tag</h4>
+<div class="paragraph">
+<p>`Tag`s are simple labels that are used to classify all other objects inside Unomi.</p>
+</div>
+</div>
+<div class="sect3">
+<h4 id="_valuetype">ValueType</h4>
+<div class="paragraph">
+<p>Definition for values that can be assigned to properties ("primitive" types).</p>
+</div>
+</div>
+</div>
+<div class="sect2">
+<h3 id="_other_unomi_entities">Other Unomi entities</h3>
+<div class="sect3">
+<h4 id="_userlist">UserList</h4>
+<div class="paragraph">
+<p>User list are simple static lists of users. The associated profile stores the lists
it belongs to in a specific property.</p>
+</div>
+</div>
+<div class="sect3">
+<h4 id="_goal">Goal</h4>
+<div class="paragraph">
+<p>Goals represent tracked activities / actions that can be accomplished by site (or
more precisely scope) visitors. These are tracked in general because they relate to specific
business objectives or are relevant to measure site/scope performance.</p>
+</div>
+<div class="paragraph">
+<p>Goals can be defined at the scope level or in the context of a particular <code>Campaign</code>.
Either types of goals behave exactly the same way with the exception of two notable differences:
+ - duration: scope-level goals are considered until removed while campaign-level goals are
only considered for the campaign duration
+ - audience filtering: any visitor is considered for scope-level goals while campaign-level
goals only consider visitors who match the campaign&#8217;s conditions</p>
+</div>
+</div>
+<div class="sect3">
+<h4 id="_campaign">Campaign</h4>
+<div class="paragraph">
+<p>A goal-oriented, time-limited marketing operation that needs to be evaluated for
return on investment performance by tracking the ratio of visits to conversions.</p>
+</div>
+</div>
+</div>
+</div>
+<div id="footer">
+<div id="footer-text">
+Last updated 2018-09-10 11:30:03 CEST
+</div>
+</div>
+</body>
+</html>
\ No newline at end of file

Added: incubator/unomi/website/latest/getting-started.html
URL: http://svn.apache.org/viewvc/incubator/unomi/website/latest/getting-started.html?rev=1841490&view=auto
==============================================================================
--- incubator/unomi/website/latest/getting-started.html (added)
+++ incubator/unomi/website/latest/getting-started.html Thu Sep 20 18:43:11 2018
@@ -0,0 +1,175 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+<meta charset="UTF-8">
+<!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge"><![endif]-->
+<meta name="viewport" content="width=device-width, initial-scale=1.0">
+<meta name="generator" content="Asciidoctor 1.5.6.1">
+<title>Getting started with Unomi</title>
+<link rel="stylesheet" href="./apache.css">
+</head>
+<body class="article">
+<div id="header">
+<div id="toc" class="toc">
+<div id="toctitle">Table of Contents</div>
+<ul class="sectlevel2">
+<li><a href="#_getting_started_with_unomi">Getting started with Unomi</a></li>
+</ul>
+</div>
+</div>
+<div id="content">
+<div class="sect2">
+<h3 id="_getting_started_with_unomi">Getting started with Unomi</h3>
+<div class="paragraph">
+<p>We will first get you up and running with an example. We will then lift the corner
of the cover somewhat and explain in greater details what just happened.</p>
+</div>
+<div class="sect3">
+<h4 id="_prerequisites">Prerequisites</h4>
+<div class="paragraph">
+<p>This document assumes that you are already familiar with Unomi&#8217;s <a
href="concepts.html">concepts</a>. On the technical side, we also assume working
knowledge of <a href="https://git-scm.com/">git</a> to be able to retrieve the
code for Unomi and the example. Additionnally, you will require a working Java 7 or above
install. Refer to <a href="http://www.oracle.com/technetwork/java/javase/">http://www.oracle.com/technetwork/java/javase/</a>
for details on how to download and install Java SE 7 or greater.</p>
+</div>
+</div>
+<div class="sect3">
+<h4 id="_running_unomi">Running Unomi</h4>
+<div class="sect4">
+<h5 id="_building_unomi">Building Unomi</h5>
+<div class="olist arabic">
+<ol class="arabic">
+<li>
+<p>Get the code: <code>git clone <a href="https://git-wip-us.apache.org/repos/asf/incubator-unomi.git"
class="bare">https://git-wip-us.apache.org/repos/asf/incubator-unomi.git</a></code></p>
+</li>
+<li>
+<p>Build and install according to the <a href="building-and-deploying.html">instructions</a>
and install Unomi.</p>
+</li>
+</ol>
+</div>
+</div>
+<div class="sect4">
+<h5 id="_start_unomi">Start Unomi</h5>
+<div class="paragraph">
+<p>Start Unomi according to the <a href="building-and-deploying.html#Deploying_the_generated_package">instructions</a>.
Once you have Karaf running,
+ you should wait until you see the following messages on the Karaf console:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="highlight"><code>Initializing user list service endpoint...
+Initializing geonames service endpoint...
+Initializing segment service endpoint...
+Initializing scoring service endpoint...
+Initializing campaigns service endpoint...
+Initializing rule service endpoint...
+Initializing profile service endpoint...
+Initializing cluster service endpoint...</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>This indicates that all the Unomi services are started and ready to react to requests.
You can then open a browser and go to <code><a href="http://localhost:8181/cxs" class="bare">http://localhost:8181/cxs</a></code>
to see the list of
+available RESTful services or retrieve an initial context at <code><a href="http://localhost:8181/context.json"
class="bare">http://localhost:8181/context.json</a></code> (which isn&#8217;t
very useful at this point).</p>
+</div>
+</div>
+<div class="sect4">
+<h5 id="_request_examples">Request examples</h5>
+<div class="sect5">
+<h6 id="_retrieving_your_first_context">Retrieving your first context</h6>
+<div class="paragraph">
+<p>You can retrieve a context using curl like this :</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="highlight"><code>curl http://localhost:8181/context.js?sessionId=1234</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>This will retrieve a JavaScript script that contains a <code>cxs</code>
object that contains the context with the current user
+profile, segments, scores as well as functions that makes it easier to perform further requests
(such as collecting
+events using the cxs.collectEvents() function).</p>
+</div>
+</div>
+<div class="sect5">
+<h6 id="_retrieving_a_context_as_a_json_object">Retrieving a context as a JSON object.</h6>
+<div class="paragraph">
+<p>If you prefer to retrieve a pure JSON object, you can simply use a request formed
like this:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="highlight"><code>curl http://localhost:8181/context.json?sessionId=1234</code></pre>
+</div>
+</div>
+</div>
+<div class="sect5">
+<h6 id="_accessing_profile_properties_in_a_context">Accessing profile properties in
a context</h6>
+<div class="paragraph">
+<p>By default, in order to optimize the amount of data sent over the network, Apache
Unomi will not send the content of
+the profile or session properties. If you need this data, you must send a JSON object to
configure the resulting output
+of the context.js(on) servlet.</p>
+</div>
+<div class="paragraph">
+<p>Here is an example that will retrieve all the session and profile properties.</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="highlight"><code>curl -H "Content-Type: application/json" -X POST
-d '{"source":{"itemId":"homepage","itemType":"page","scope":"example"},"requiredProfileProperties":["*"],"requiredSessionProperties":["*"],"requireSegments":true}'
http://localhost:8181/context.json?sessionId=1234</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>The <code>requiredProfileProperties</code> and <code>requiredSessionProperties</code>
are properties that take an array of property names
+that should be retrieved. In this case we use the wildcard character '*' to say we want to
retrieve all the available
+properties. The structure of the JSON object that you should send is a JSON-serialized version
of the <a href="http://unomi.incubator.apache.org/unomi-api/apidocs/org/apache/unomi/api/ContextRequest.html">ContextRequest</a>
+Java class.</p>
+</div>
+</div>
+<div class="sect5">
+<h6 id="_sending_events_using_the_context_servlet">Sending events using the context
servlet</h6>
+<div class="paragraph">
+<p>At the same time as you are retrieving the context, you can also directly send events
in the ContextRequest object as
+illustrated in the following example:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="highlight"><code>curl -H "Content-Type: application/json" -X POST
-d '{"source":{"itemId":"homepage","itemType":"page","scope":"example"},"events":[{"eventType":"view","scope":
"example","source":{"itemType": "site","scope":"example","itemId": "mysite"},"target":{"itemType":"page","scope":"example","itemId":"homepage","properties":{"pageInfo":{"referringURL":""}}}}]}'
http://localhost:8181/context.json?sessionId=1234</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>Upon received events, Apache Unomi will execute all the rules that match the current
context, and return an updated context.
+This way of sending events is usually used upon first loading of a page. If you want to send
events after the page has
+finished loading you could either do a second call and get an updating context, or if you
don&#8217;t need the context and want
+to send events in a network optimal way you can use the eventcollector servlet (see below).</p>
+</div>
+</div>
+<div class="sect5">
+<h6 id="_sending_events_using_the_eventcollector_servlet">Sending events using the
eventcollector servlet</h6>
+<div class="paragraph">
+<p>If you only need to send events without retrieving a context, you should use the
eventcollector servlet that is optimized
+respond quickly and minimize network traffic. Here is an example of using this servlet:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="highlight"><code>curl -H "Content-Type: application/json" -X POST
-d '{"events":[{"eventType":"view","scope": "example","source":{"itemType": "site","scope":"example","itemId":
"mysite"},"target":{"itemType":"page","scope":"example","itemId":"homepage","properties":{"pageInfo":{"referringURL":""}}}}]}'
http://localhost:8181/eventcollector?sessionId=1234</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>Note that the eventcollector executes the rules but does not return a context. If
is generally used after a page is loaded
+to send additional events.</p>
+</div>
+</div>
+</div>
+<div class="sect4">
+<h5 id="_where_to_go_from_here">Where to go from here</h5>
+<div class="ulist">
+<ul>
+<li>
+<p>Read the <a href="twitter-samples.html">Twitter samples</a> documentation
that contains a detailed example of how to integrate with Apache Unomi.</p>
+</li>
+</ul>
+</div>
+</div>
+</div>
+</div>
+</div>
+<div id="footer">
+<div id="footer-text">
+Last updated 2018-09-10 11:30:03 CEST
+</div>
+</div>
+</body>
+</html>
\ No newline at end of file

Added: incubator/unomi/website/latest/images/asf_logo_url.png
URL: http://svn.apache.org/viewvc/incubator/unomi/website/latest/images/asf_logo_url.png?rev=1841490&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/unomi/website/latest/images/asf_logo_url.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/unomi/website/latest/images/incubator-logo.png
URL: http://svn.apache.org/viewvc/incubator/unomi/website/latest/images/incubator-logo.png?rev=1841490&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/unomi/website/latest/images/incubator-logo.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/unomi/website/latest/images/unomi-request.png
URL: http://svn.apache.org/viewvc/incubator/unomi/website/latest/images/unomi-request.png?rev=1841490&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/unomi/website/latest/images/unomi-request.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream



Mime
View raw message