You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by sh...@apache.org on 2020/06/26 13:12:12 UTC
[unomi] branch UNOMI-356-refactor-rest-api created (now d977661)
This is an automated email from the ASF dual-hosted git repository.
shuber pushed a change to branch UNOMI-356-refactor-rest-api
in repository https://gitbox.apache.org/repos/asf/unomi.git.
at d977661 UNOMI-356 Refactor REST API - A new RestServer class is responsible for creating a single JAX RS Server - Service beans must register with the OSGi service registry and setup the following property: osgi.jaxrs.resource=true (this property comes from OSGi R7 so that we can then migrate to OSGi R6 JAX RS whiteboard once we are on OSGI R7) - All JAX RS service beans are now register, not just the ones in the "rest" subproject - Swagger UI is integrated by default, although [...]
This branch includes the following new commits:
new d977661 UNOMI-356 Refactor REST API - A new RestServer class is responsible for creating a single JAX RS Server - Service beans must register with the OSGi service registry and setup the following property: osgi.jaxrs.resource=true (this property comes from OSGi R7 so that we can then migrate to OSGi R6 JAX RS whiteboard once we are on OSGI R7) - All JAX RS service beans are now register, not just the ones in the "rest" subproject - Swagger UI is integrated by default, although [...]
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[unomi] 01/01: UNOMI-356 Refactor REST API - A new RestServer class
is responsible for creating a single JAX RS Server - Service beans must
register with the OSGi service registry and setup the following property:
osgi.jaxrs.resource=true (this property comes from OSGi R7 so that we can
then migrate to OSGi R6 JAX RS whiteboard once we are on OSGI R7) - All JAX
RS service beans are now register,
not just the ones in the "rest" subproject - Swagger UI is integrated by
default, although we might make it op [...]
Posted by sh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
shuber pushed a commit to branch UNOMI-356-refactor-rest-api
in repository https://gitbox.apache.org/repos/asf/unomi.git
commit d9776614d6a5a9b8558dd7dfc969cc3a82d92003
Author: Serge Huber <sh...@apache.org>
AuthorDate: Fri Jun 26 15:12:05 2020 +0200
UNOMI-356 Refactor REST API
- A new RestServer class is responsible for creating a single JAX RS Server
- Service beans must register with the OSGi service registry and setup the following property: osgi.jaxrs.resource=true (this property comes from OSGi R7 so that we can then migrate to OSGi R6 JAX RS whiteboard once we are on OSGI R7)
- All JAX RS service beans are now register, not just the ones in the "rest" subproject
- Swagger UI is integrated by default, although we might make it optional in the future.
- Upgraded all OSGi JARs from version 4.3.1 to 6
- Remove usage of Blueprint in the "rest" subproject as it is no longer needed, it is replaced by OSGi DS annotations
- Removal of Miredot Maven plugin to generate REST API documentation as it is replaced by Swagger/OpenAPI generation.
Despite these changes the REST API is 100% compatible with the previous integration, which was by design a requirement.
---
api/pom.xml | 29 --
extensions/geonames/rest/pom.xml | 5 +
.../unomi/geonames/rest/GeonamesEndPoint.java | 5 +
.../resources/OSGI-INF/blueprint/blueprint.xml | 75 -----
extensions/groovy-actions/services/pom.xml | 4 +-
extensions/lists-extension/rest/pom.xml | 5 +
.../unomi/lists/rest/UserListServiceEndPoint.java | 5 +
.../resources/OSGI-INF/blueprint/blueprint.xml | 75 -----
extensions/privacy-extension/rest/pom.xml | 5 +
.../unomi/privacy/rest/PrivacyServiceEndPoint.java | 6 +-
.../resources/OSGI-INF/blueprint/blueprint.xml | 75 -----
extensions/privacy-extension/services/pom.xml | 2 +-
extensions/router/router-core/pom.xml | 4 +-
extensions/router/router-rest/pom.xml | 5 +
.../rest/AbstractConfigurationServiceEndpoint.java | 14 -
.../router/rest/ConfigRestExceptionMapper.java | 5 +
.../rest/ExportConfigurationServiceEndPoint.java | 8 +
.../rest/ImportConfigurationServiceEndPoint.java | 14 +
.../resources/OSGI-INF/blueprint/blueprint.xml | 98 -------
extensions/router/router-service/pom.xml | 4 +-
extensions/salesforce-connector/rest/pom.xml | 7 +-
.../org/apache/unomi/sfdc/rest/SFDCEndPoint.java | 13 +-
.../resources/OSGI-INF/blueprint/blueprint.xml | 76 -----
extensions/unomi-mailchimp/rest/pom.xml | 7 +-
.../unomi/mailchimp/rest/MailChimpEndPoint.java | 6 +
.../resources/OSGI-INF/blueprint/blueprint.xml | 75 -----
itests/README.md | 35 +++
itests/pom.xml | 2 +-
kar/src/main/feature/feature.xml | 2 +
lifecycle-watcher/pom.xml | 2 +-
metrics/pom.xml | 2 +-
persistence-elasticsearch/core/pom.xml | 4 +-
pom.xml | 52 +---
rest/pom.xml | 307 +++------------------
.../unomi/rest/CampaignsServiceEndPoint.java | 5 +
.../apache/unomi/rest/ClusterServiceEndPoint.java | 5 +
.../unomi/rest/DefinitionsServiceEndPoint.java | 7 +
.../apache/unomi/rest/EventServiceEndpoint.java | 5 +
.../apache/unomi/rest/GoalsServiceEndPoint.java | 5 +
.../org/apache/unomi/rest/LocalizationHelper.java | 12 +
.../apache/unomi/rest/PatchServiceEndPoint.java | 5 +
.../apache/unomi/rest/ProfileServiceEndPoint.java | 8 +
.../apache/unomi/rest/QueryServiceEndPoint.java | 6 +
.../apache/unomi/rest/ResourceBundleHelper.java | 9 +
.../java/org/apache/unomi/rest/RestServer.java | 176 ++++++++++++
.../apache/unomi/rest/RulesServiceEndPoint.java | 5 +
.../apache/unomi/rest/ScoringServiceEndPoint.java | 5 +
.../apache/unomi/rest/SegmentServiceEndPoint.java | 5 +
.../apache/unomi/rest/UserListServiceEndPoint.java | 5 +
.../resources/OSGI-INF/blueprint/blueprint.xml | 280 -------------------
services/pom.xml | 4 +-
.../META-INF/cxs/events/updateProperties.json | 2 +-
tools/shell-commands/pom.xml | 4 +-
tools/shell-dev-commands/pom.xml | 4 +-
54 files changed, 452 insertions(+), 1138 deletions(-)
diff --git a/api/pom.xml b/api/pom.xml
index f8bf780..5394ff1 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -45,35 +45,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
- <configuration>
- <tags>
- <tag>
- <name>summary</name>
- <placement>a</placement>
- <head>MireDot summary (resource title)</head>
- </tag>
- <tag>
- <name>title</name>
- <placement>a</placement>
- <head>MireDot title (resource title)</head>
- </tag>
- <tag>
- <name>servicetag</name>
- <placement>a</placement>
- <head>MireDot resource tag (label)</head>
- </tag>
- <tag>
- <name>statuscode</name>
- <placement>a</placement>
- <head>MireDot resource status code(s)</head>
- </tag>
- <tag>
- <name>responseheader</name>
- <placement>a</placement>
- <head>MireDot response header</head>
- </tag>
- </tags>
- </configuration>
</plugin>
</plugins>
</reporting>
diff --git a/extensions/geonames/rest/pom.xml b/extensions/geonames/rest/pom.xml
index ba0a410..1ac2098 100644
--- a/extensions/geonames/rest/pom.xml
+++ b/extensions/geonames/rest/pom.xml
@@ -79,6 +79,11 @@
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>osgi.cmpn</artifactId>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
diff --git a/extensions/geonames/rest/src/main/java/org/apache/unomi/geonames/rest/GeonamesEndPoint.java b/extensions/geonames/rest/src/main/java/org/apache/unomi/geonames/rest/GeonamesEndPoint.java
index 206018c..e53216f 100644
--- a/extensions/geonames/rest/src/main/java/org/apache/unomi/geonames/rest/GeonamesEndPoint.java
+++ b/extensions/geonames/rest/src/main/java/org/apache/unomi/geonames/rest/GeonamesEndPoint.java
@@ -22,6 +22,8 @@ import org.apache.cxf.rs.security.cors.CrossOriginResourceSharing;
import org.apache.unomi.api.PartialList;
import org.apache.unomi.geonames.services.GeonameEntry;
import org.apache.unomi.geonames.services.GeonamesService;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -40,10 +42,13 @@ import java.util.Locale;
allowAllOrigins = true,
allowCredentials = true
)
+@Path("/geonames")
+@Component(service=GeonamesEndPoint.class,property = "osgi.jaxrs.resource=true")
public class GeonamesEndPoint {
private static final Logger logger = LoggerFactory.getLogger(GeonamesEndPoint.class.getName());
+ @Reference
private GeonamesService geonamesService;
public GeonamesEndPoint() {
diff --git a/extensions/geonames/rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/extensions/geonames/rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml
deleted file mode 100644
index 6e43ac3..0000000
--- a/extensions/geonames/rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You 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.
- -->
-
-<blueprint xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:cxf="http://cxf.apache.org/blueprint/core"
- xmlns:jaxrs="http://cxf.apache.org/blueprint/jaxrs"
- 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
- http://cxf.apache.org/blueprint/jaxrs http://cxf.apache.org/schemas/blueprint/jaxrs.xsd
- http://cxf.apache.org/blueprint/core http://cxf.apache.org/schemas/blueprint/core.xsd">
-
- <cxf:bus>
- <cxf:features>
- <cxf:logging/>
- <bean class="org.apache.cxf.metrics.MetricsFeature"/>
- </cxf:features>
- </cxf:bus>
-
- <bean id="cors-filter" class="org.apache.cxf.rs.security.cors.CrossOriginResourceSharingFilter"/>
- <bean id="jacksonMapper" class="org.apache.unomi.persistence.spi.CustomObjectMapper"/>
- <bean id="jaxb-provider" class="com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider">
- <argument index="0" ref="jacksonMapper" type="com.fasterxml.jackson.databind.ObjectMapper "/>
- <argument index="1" type="com.fasterxml.jackson.jaxrs.cfg.Annotations[]">
- <array>
- <value>JACKSON</value>
- <value>JAXB</value>
- </array>
- </argument>
- </bean>
- <bean id="jaas-filter" class="org.apache.cxf.jaxrs.security.JAASAuthenticationFilter">
- <!-- Name of the JAAS Context -->
- <property name="contextName" value="karaf"/>
- <!-- Hint to the filter on how to have Principals representing users and roles separated
- while initializing a SecurityContext -->
- <property name="rolePrefix" value="ROLE_"/>
-
- <property name="realmName" value="cxs"/>
- <!-- Activate this if you want to force a redirect if auth is missing, by default it will trigger a 403 which
- is usually preferred -->
- <!--property name="redirectURI" value="/login.jsp"/-->
- </bean>
-
- <jaxrs:server address="/geonames" id="restGeonamesService">
- <jaxrs:providers>
- <ref component-id="jaxb-provider"/>
- <ref component-id="cors-filter"/>
- <ref component-id="jaas-filter"/>
- </jaxrs:providers>
-
- <jaxrs:serviceBeans>
- <ref component-id="geonamesServiceEndPoint"/>
- </jaxrs:serviceBeans>
- </jaxrs:server>
-
- <reference id="geonamesService" interface="org.apache.unomi.geonames.services.GeonamesService"/>
-
- <bean id="geonamesServiceEndPoint" class="org.apache.unomi.geonames.rest.GeonamesEndPoint">
- <property name="geonamesService" ref="geonamesService"/>
- </bean>
-</blueprint>
diff --git a/extensions/groovy-actions/services/pom.xml b/extensions/groovy-actions/services/pom.xml
index 3bc3a6a..2658a0e 100644
--- a/extensions/groovy-actions/services/pom.xml
+++ b/extensions/groovy-actions/services/pom.xml
@@ -39,13 +39,13 @@
</dependency>
<dependency>
<groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
+ <artifactId>osgi.core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
+ <artifactId>osgi.cmpn</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
diff --git a/extensions/lists-extension/rest/pom.xml b/extensions/lists-extension/rest/pom.xml
index 7323ec7..bca7a3a 100644
--- a/extensions/lists-extension/rest/pom.xml
+++ b/extensions/lists-extension/rest/pom.xml
@@ -80,6 +80,11 @@
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>osgi.cmpn</artifactId>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
diff --git a/extensions/lists-extension/rest/src/main/java/org/apache/unomi/lists/rest/UserListServiceEndPoint.java b/extensions/lists-extension/rest/src/main/java/org/apache/unomi/lists/rest/UserListServiceEndPoint.java
index 492bc45..98ca0f1 100644
--- a/extensions/lists-extension/rest/src/main/java/org/apache/unomi/lists/rest/UserListServiceEndPoint.java
+++ b/extensions/lists-extension/rest/src/main/java/org/apache/unomi/lists/rest/UserListServiceEndPoint.java
@@ -23,6 +23,8 @@ import org.apache.unomi.api.PartialList;
import org.apache.unomi.api.query.Query;
import org.apache.unomi.lists.UserList;
import org.apache.unomi.services.UserListService;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -41,10 +43,13 @@ import javax.ws.rs.core.MediaType;
allowAllOrigins = true,
allowCredentials = true
)
+@Path("/lists")
+@Component(service=UserListServiceEndPoint.class,property = "osgi.jaxrs.resource=true")
public class UserListServiceEndPoint {
private static final Logger logger = LoggerFactory.getLogger(UserListServiceEndPoint.class.getName());
+ @Reference
private UserListService userListService;
public UserListServiceEndPoint() {
diff --git a/extensions/lists-extension/rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/extensions/lists-extension/rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml
deleted file mode 100644
index 8815e95..0000000
--- a/extensions/lists-extension/rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You 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.
- -->
-
-<blueprint xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:cxf="http://cxf.apache.org/blueprint/core"
- xmlns:jaxrs="http://cxf.apache.org/blueprint/jaxrs"
- 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
- http://cxf.apache.org/blueprint/jaxrs http://cxf.apache.org/schemas/blueprint/jaxrs.xsd
- http://cxf.apache.org/blueprint/core http://cxf.apache.org/schemas/blueprint/core.xsd">
-
- <cxf:bus>
- <cxf:features>
- <cxf:logging/>
- <bean class="org.apache.cxf.metrics.MetricsFeature"/>
- </cxf:features>
- </cxf:bus>
-
- <bean id="cors-filter" class="org.apache.cxf.rs.security.cors.CrossOriginResourceSharingFilter"/>
- <bean id="jacksonMapper" class="org.apache.unomi.persistence.spi.CustomObjectMapper"/>
- <bean id="jaxb-provider" class="com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider">
- <argument index="0" ref="jacksonMapper" type="com.fasterxml.jackson.databind.ObjectMapper "/>
- <argument index="1" type="com.fasterxml.jackson.jaxrs.cfg.Annotations[]">
- <array>
- <value>JACKSON</value>
- <value>JAXB</value>
- </array>
- </argument>
- </bean>
- <bean id="jaas-filter" class="org.apache.cxf.jaxrs.security.JAASAuthenticationFilter">
- <!-- Name of the JAAS Context -->
- <property name="contextName" value="karaf"/>
- <!-- Hint to the filter on how to have Principals representing users and roles separated
- while initializing a SecurityContext -->
- <property name="rolePrefix" value="ROLE_"/>
-
- <property name="realmName" value="cxs"/>
- <!-- Activate this if you want to force a redirect if auth is missing, by default it will trigger a 403 which
- is usually preferred -->
- <!--property name="redirectURI" value="/login.jsp"/-->
- </bean>
-
- <jaxrs:server address="/lists" id="restUserListService">
- <jaxrs:providers>
- <ref component-id="jaxb-provider"/>
- <ref component-id="cors-filter"/>
- <ref component-id="jaas-filter"/>
- </jaxrs:providers>
-
- <jaxrs:serviceBeans>
- <ref component-id="userListServiceEndPoint"/>
- </jaxrs:serviceBeans>
- </jaxrs:server>
-
- <reference id="userListService" interface="org.apache.unomi.services.UserListService"/>
-
- <bean id="userListServiceEndPoint" class="org.apache.unomi.lists.rest.UserListServiceEndPoint">
- <property name="userListService" ref="userListService"/>
- </bean>
-</blueprint>
diff --git a/extensions/privacy-extension/rest/pom.xml b/extensions/privacy-extension/rest/pom.xml
index 4f27d0f..2af4e24 100644
--- a/extensions/privacy-extension/rest/pom.xml
+++ b/extensions/privacy-extension/rest/pom.xml
@@ -79,6 +79,11 @@
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>osgi.cmpn</artifactId>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
<build>
diff --git a/extensions/privacy-extension/rest/src/main/java/org/apache/unomi/privacy/rest/PrivacyServiceEndPoint.java b/extensions/privacy-extension/rest/src/main/java/org/apache/unomi/privacy/rest/PrivacyServiceEndPoint.java
index 40b1160..c4c990a 100644
--- a/extensions/privacy-extension/rest/src/main/java/org/apache/unomi/privacy/rest/PrivacyServiceEndPoint.java
+++ b/extensions/privacy-extension/rest/src/main/java/org/apache/unomi/privacy/rest/PrivacyServiceEndPoint.java
@@ -20,6 +20,8 @@ package org.apache.unomi.privacy.rest;
import org.apache.cxf.rs.security.cors.CrossOriginResourceSharing;
import org.apache.unomi.api.ServerInfo;
import org.apache.unomi.api.services.PrivacyService;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
import javax.jws.WebMethod;
import javax.jws.WebService;
@@ -37,9 +39,11 @@ import java.util.List;
allowAllOrigins = true,
allowCredentials = true
)
-@Path("/")
+@Path("/privacy")
+@Component(service=PrivacyServiceEndPoint.class,property = "osgi.jaxrs.resource=true")
public class PrivacyServiceEndPoint {
+ @Reference
private PrivacyService privacyService;
@WebMethod(exclude = true)
diff --git a/extensions/privacy-extension/rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/extensions/privacy-extension/rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml
deleted file mode 100644
index a3b29b2..0000000
--- a/extensions/privacy-extension/rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You 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.
- -->
-
-<blueprint xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:cxf="http://cxf.apache.org/blueprint/core"
- xmlns:jaxrs="http://cxf.apache.org/blueprint/jaxrs"
- 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
- http://cxf.apache.org/blueprint/jaxrs http://cxf.apache.org/schemas/blueprint/jaxrs.xsd
- http://cxf.apache.org/blueprint/core http://cxf.apache.org/schemas/blueprint/core.xsd">
-
- <cxf:bus>
- <cxf:features>
- <cxf:logging/>
- <bean class="org.apache.cxf.metrics.MetricsFeature"/>
- </cxf:features>
- </cxf:bus>
-
- <bean id="cors-filter" class="org.apache.cxf.rs.security.cors.CrossOriginResourceSharingFilter"/>
- <bean id="jacksonMapper" class="org.apache.unomi.persistence.spi.CustomObjectMapper"/>
- <bean id="jaxb-provider" class="com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider">
- <argument index="0" ref="jacksonMapper" type="com.fasterxml.jackson.databind.ObjectMapper "/>
- <argument index="1" type="com.fasterxml.jackson.jaxrs.cfg.Annotations[]">
- <array>
- <value>JACKSON</value>
- <value>JAXB</value>
- </array>
- </argument>
- </bean>
- <bean id="jaas-filter" class="org.apache.cxf.jaxrs.security.JAASAuthenticationFilter">
- <!-- Name of the JAAS Context -->
- <property name="contextName" value="karaf"/>
- <!-- Hint to the filter on how to have Principals representing users and roles separated
- while initializing a SecurityContext -->
- <property name="rolePrefix" value="ROLE_"/>
-
- <property name="realmName" value="cxs"/>
- <!-- Activate this if you want to force a redirect if auth is missing, by default it will trigger a 403 which
- is usually preferred -->
- <!--property name="redirectURI" value="/login.jsp"/-->
- </bean>
-
- <jaxrs:server address="/privacy" id="restPrivacyService">
- <jaxrs:providers>
- <ref component-id="jaxb-provider"/>
- <ref component-id="cors-filter"/>
- <ref component-id="jaas-filter"/>
- </jaxrs:providers>
-
- <jaxrs:serviceBeans>
- <ref component-id="privacyServiceEndPoint"/>
- </jaxrs:serviceBeans>
- </jaxrs:server>
-
- <reference id="privacyService" interface="org.apache.unomi.api.services.PrivacyService"/>
-
- <bean id="privacyServiceEndPoint" class="org.apache.unomi.privacy.rest.PrivacyServiceEndPoint">
- <property name="privacyService" ref="privacyService"/>
- </bean>
-</blueprint>
diff --git a/extensions/privacy-extension/services/pom.xml b/extensions/privacy-extension/services/pom.xml
index dcb9375..5a0ede7 100644
--- a/extensions/privacy-extension/services/pom.xml
+++ b/extensions/privacy-extension/services/pom.xml
@@ -50,7 +50,7 @@
</dependency>
<dependency>
<groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
+ <artifactId>osgi.core</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
diff --git a/extensions/router/router-core/pom.xml b/extensions/router/router-core/pom.xml
index 1af6d44..3db95cb 100644
--- a/extensions/router/router-core/pom.xml
+++ b/extensions/router/router-core/pom.xml
@@ -31,12 +31,12 @@
<dependencies>
<dependency>
<groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
+ <artifactId>osgi.core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
+ <artifactId>osgi.cmpn</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
diff --git a/extensions/router/router-rest/pom.xml b/extensions/router/router-rest/pom.xml
index c14e10f..9213f42 100644
--- a/extensions/router/router-rest/pom.xml
+++ b/extensions/router/router-rest/pom.xml
@@ -80,6 +80,11 @@
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>osgi.cmpn</artifactId>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
diff --git a/extensions/router/router-rest/src/main/java/org/apache/unomi/router/rest/AbstractConfigurationServiceEndpoint.java b/extensions/router/router-rest/src/main/java/org/apache/unomi/router/rest/AbstractConfigurationServiceEndpoint.java
index 54d72ab..7d180ee 100644
--- a/extensions/router/router-rest/src/main/java/org/apache/unomi/router/rest/AbstractConfigurationServiceEndpoint.java
+++ b/extensions/router/router-rest/src/main/java/org/apache/unomi/router/rest/AbstractConfigurationServiceEndpoint.java
@@ -16,18 +16,10 @@
*/
package org.apache.unomi.router.rest;
-import org.apache.cxf.jaxrs.ext.MessageContext;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.unomi.api.services.ConfigSharingService;
import org.apache.unomi.router.api.services.ImportExportConfigurationService;
-import javax.jws.WebMethod;
import javax.ws.rs.*;
-import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
-import java.security.KeyManagementException;
-import java.security.KeyStoreException;
-import java.security.NoSuchAlgorithmException;
import java.util.List;
/**
@@ -36,12 +28,6 @@ import java.util.List;
public abstract class AbstractConfigurationServiceEndpoint<T> {
protected ImportExportConfigurationService<T> configurationService;
- protected ConfigSharingService configSharingService;
-
- @WebMethod(exclude = true)
- public void setConfigSharingService(ConfigSharingService configSharingService) {
- this.configSharingService = configSharingService;
- }
/**
* Retrieves all the configurations.
diff --git a/extensions/router/router-rest/src/main/java/org/apache/unomi/router/rest/ConfigRestExceptionMapper.java b/extensions/router/router-rest/src/main/java/org/apache/unomi/router/rest/ConfigRestExceptionMapper.java
index 179f3d4..9c266d7 100644
--- a/extensions/router/router-rest/src/main/java/org/apache/unomi/router/rest/ConfigRestExceptionMapper.java
+++ b/extensions/router/router-rest/src/main/java/org/apache/unomi/router/rest/ConfigRestExceptionMapper.java
@@ -16,13 +16,18 @@
*/
package org.apache.unomi.router.rest;
+import org.osgi.service.component.annotations.Component;
+
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
+import javax.ws.rs.ext.Provider;
/**
* Created by amidani on 06/07/2017.
*/
+@Provider
+@Component(service=ExceptionMapper.class)
public class ConfigRestExceptionMapper implements ExceptionMapper<PartialContentException> {
@Override
diff --git a/extensions/router/router-rest/src/main/java/org/apache/unomi/router/rest/ExportConfigurationServiceEndPoint.java b/extensions/router/router-rest/src/main/java/org/apache/unomi/router/rest/ExportConfigurationServiceEndPoint.java
index 5d1635b..ff31a89 100644
--- a/extensions/router/router-rest/src/main/java/org/apache/unomi/router/rest/ExportConfigurationServiceEndPoint.java
+++ b/extensions/router/router-rest/src/main/java/org/apache/unomi/router/rest/ExportConfigurationServiceEndPoint.java
@@ -21,6 +21,8 @@ import org.apache.unomi.api.services.ProfileService;
import org.apache.unomi.router.api.ExportConfiguration;
import org.apache.unomi.router.api.services.ImportExportConfigurationService;
import org.apache.unomi.router.api.services.ProfileExportService;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -46,11 +48,16 @@ import java.util.Date;
allowAllOrigins = true,
allowCredentials = true
)
+@Path("/exportConfiguration")
+@Component(service=ExportConfigurationServiceEndPoint.class,property = "osgi.jaxrs.resource=true")
public class ExportConfigurationServiceEndPoint extends AbstractConfigurationServiceEndpoint<ExportConfiguration> {
private static final Logger logger = LoggerFactory.getLogger(ExportConfigurationServiceEndPoint.class.getName());
+ @Reference
private ProfileExportService profileExportService;
+
+ @Reference
private ProfileService profileService;
public ExportConfigurationServiceEndPoint() throws KeyStoreException, NoSuchAlgorithmException, KeyManagementException {
@@ -58,6 +65,7 @@ public class ExportConfigurationServiceEndPoint extends AbstractConfigurationSer
}
@WebMethod(exclude = true)
+ @Reference(target="(configDiscriminator=EXPORT)")
public void setExportConfigurationService(ImportExportConfigurationService<ExportConfiguration> exportConfigurationService) {
configurationService = exportConfigurationService;
}
diff --git a/extensions/router/router-rest/src/main/java/org/apache/unomi/router/rest/ImportConfigurationServiceEndPoint.java b/extensions/router/router-rest/src/main/java/org/apache/unomi/router/rest/ImportConfigurationServiceEndPoint.java
index 7f9363c..a21404b 100644
--- a/extensions/router/router-rest/src/main/java/org/apache/unomi/router/rest/ImportConfigurationServiceEndPoint.java
+++ b/extensions/router/router-rest/src/main/java/org/apache/unomi/router/rest/ImportConfigurationServiceEndPoint.java
@@ -19,9 +19,12 @@ package org.apache.unomi.router.rest;
import org.apache.cxf.jaxrs.ext.multipart.Attachment;
import org.apache.cxf.jaxrs.ext.multipart.Multipart;
import org.apache.cxf.rs.security.cors.CrossOriginResourceSharing;
+import org.apache.unomi.api.services.ConfigSharingService;
import org.apache.unomi.router.api.ImportConfiguration;
import org.apache.unomi.router.api.RouterConstants;
import org.apache.unomi.router.api.services.ImportExportConfigurationService;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -49,15 +52,26 @@ import java.security.NoSuchAlgorithmException;
allowAllOrigins = true,
allowCredentials = true
)
+@Path("/importConfiguration")
+@Component(service=ImportConfigurationServiceEndPoint.class,property = "osgi.jaxrs.resource=true")
public class ImportConfigurationServiceEndPoint extends AbstractConfigurationServiceEndpoint<ImportConfiguration> {
private static final Logger logger = LoggerFactory.getLogger(ImportConfigurationServiceEndPoint.class.getName());
+ @Reference
+ protected ConfigSharingService configSharingService;
+
+ @WebMethod(exclude = true)
+ public void setConfigSharingService(ConfigSharingService configSharingService) {
+ this.configSharingService = configSharingService;
+ }
+
public ImportConfigurationServiceEndPoint() throws KeyStoreException, NoSuchAlgorithmException, KeyManagementException {
logger.info("Initializing import configuration service endpoint...");
}
@WebMethod(exclude = true)
+ @Reference(target="(configDiscriminator=IMPORT)")
public void setImportConfigurationService(ImportExportConfigurationService<ImportConfiguration> importConfigurationService) {
configurationService = importConfigurationService;
}
diff --git a/extensions/router/router-rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/extensions/router/router-rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml
deleted file mode 100644
index c114f4a..0000000
--- a/extensions/router/router-rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ /dev/null
@@ -1,98 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You 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.
- -->
-
-<blueprint xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:cxf="http://cxf.apache.org/blueprint/core"
- xmlns:jaxrs="http://cxf.apache.org/blueprint/jaxrs"
- 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
- http://cxf.apache.org/blueprint/jaxrs http://cxf.apache.org/schemas/blueprint/jaxrs.xsd
- http://cxf.apache.org/blueprint/core http://cxf.apache.org/schemas/blueprint/core.xsd">
-
- <cxf:bus>
- <cxf:features>
- <cxf:logging/>
- <bean class="org.apache.cxf.metrics.MetricsFeature"/>
- </cxf:features>
- </cxf:bus>
-
- <bean id="cors-filter" class="org.apache.cxf.rs.security.cors.CrossOriginResourceSharingFilter"/>
- <bean id="jacksonMapper" class="com.fasterxml.jackson.databind.ObjectMapper"/>
- <bean id="json-provider" class="com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider">
- <argument index="0" ref="jacksonMapper" type="com.fasterxml.jackson.databind.ObjectMapper"/>
- </bean>
- <bean id="jaas-filter" class="org.apache.cxf.jaxrs.security.JAASAuthenticationFilter">
- <!-- Name of the JAAS Context -->
- <property name="contextName" value="karaf"/>
- <!-- Hint to the filter on how to have Principals representing users and roles separated
- while initializing a SecurityContext -->
- <property name="rolePrefix" value="ROLE_"/>
- <property name="realmName" value="cxs"/>
- </bean>
-
- <bean id="exceptionMapper" class="org.apache.unomi.router.rest.ConfigRestExceptionMapper"/>
-
- <jaxrs:server address="/importConfiguration" id="restImportConfigurationService">
- <jaxrs:providers>
- <ref component-id="json-provider"/>
- <ref component-id="cors-filter"/>
- <ref component-id="jaas-filter"/>
- <ref component-id="exceptionMapper"/>
- </jaxrs:providers>
-
- <jaxrs:serviceBeans>
- <ref component-id="importConfigurationServiceEndPoint"/>
- </jaxrs:serviceBeans>
- </jaxrs:server>
-
- <jaxrs:server address="/exportConfiguration" id="restExportConfigurationService">
- <jaxrs:providers>
- <ref component-id="json-provider"/>
- <ref component-id="cors-filter"/>
- <ref component-id="jaas-filter"/>
- <ref component-id="exceptionMapper"/>
- </jaxrs:providers>
-
- <jaxrs:serviceBeans>
- <ref component-id="exportConfigurationServiceEndPoint"/>
- </jaxrs:serviceBeans>
- </jaxrs:server>
-
- <reference id="importConfigurationService" interface="org.apache.unomi.router.api.services.ImportExportConfigurationService"
- filter="(configDiscriminator=IMPORT)"/>
-
- <reference id="exportConfigurationService" interface="org.apache.unomi.router.api.services.ImportExportConfigurationService"
- filter="(configDiscriminator=EXPORT)"/>
-
- <reference id="configSharingService" interface="org.apache.unomi.api.services.ConfigSharingService"/>
- <reference id="profileExportService" interface="org.apache.unomi.router.api.services.ProfileExportService"/>
- <reference id="profileService" interface="org.apache.unomi.api.services.ProfileService"/>
-
- <bean id="importConfigurationServiceEndPoint" class="org.apache.unomi.router.rest.ImportConfigurationServiceEndPoint">
- <property name="importConfigurationService" ref="importConfigurationService"/>
- <property name="configSharingService" ref="configSharingService"/>
- </bean>
-
- <bean id="exportConfigurationServiceEndPoint" class="org.apache.unomi.router.rest.ExportConfigurationServiceEndPoint">
- <property name="exportConfigurationService" ref="exportConfigurationService"/>
- <property name="configSharingService" ref="configSharingService"/>
- <property name="profileExportService" ref="profileExportService"/>
- <property name="profileService" ref="profileService"/>
- </bean>
-
-</blueprint>
diff --git a/extensions/router/router-service/pom.xml b/extensions/router/router-service/pom.xml
index aa85805..fc0d3d7 100644
--- a/extensions/router/router-service/pom.xml
+++ b/extensions/router/router-service/pom.xml
@@ -71,13 +71,13 @@
<dependency>
<groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
+ <artifactId>osgi.core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
+ <artifactId>osgi.cmpn</artifactId>
<scope>provided</scope>
</dependency>
diff --git a/extensions/salesforce-connector/rest/pom.xml b/extensions/salesforce-connector/rest/pom.xml
index bf2dec2..be1796c 100644
--- a/extensions/salesforce-connector/rest/pom.xml
+++ b/extensions/salesforce-connector/rest/pom.xml
@@ -89,7 +89,12 @@
<dependency>
<groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
+ <artifactId>osgi.core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>osgi.cmpn</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
diff --git a/extensions/salesforce-connector/rest/src/main/java/org/apache/unomi/sfdc/rest/SFDCEndPoint.java b/extensions/salesforce-connector/rest/src/main/java/org/apache/unomi/sfdc/rest/SFDCEndPoint.java
index e10c9f4..85158e2 100644
--- a/extensions/salesforce-connector/rest/src/main/java/org/apache/unomi/sfdc/rest/SFDCEndPoint.java
+++ b/extensions/salesforce-connector/rest/src/main/java/org/apache/unomi/sfdc/rest/SFDCEndPoint.java
@@ -20,6 +20,10 @@ package org.apache.unomi.sfdc.rest;
import org.apache.cxf.rs.security.cors.CrossOriginResourceSharing;
import org.apache.unomi.sfdc.services.SFDCService;
import org.osgi.framework.BundleContext;
+import org.osgi.service.component.ComponentContext;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
import javax.jws.WebMethod;
import javax.jws.WebService;
@@ -38,9 +42,11 @@ import java.util.Map;
allowAllOrigins = true,
allowCredentials = true
)
-@Path("/")
+@Path("/sfdc")
+@Component(service=SFDCEndPoint.class,property = "osgi.jaxrs.resource=true")
public class SFDCEndPoint {
+ @Reference
private SFDCService sfdcService;
private BundleContext bundleContext;
@@ -48,6 +54,11 @@ public class SFDCEndPoint {
System.out.println("Initializing SFDC service endpoint...");
}
+ @Activate
+ public void activate(ComponentContext componentContext) {
+ this.bundleContext = componentContext.getBundleContext();
+ }
+
@WebMethod(exclude = true)
public void setSFDCService(SFDCService sfdcService) {
this.sfdcService = sfdcService;
diff --git a/extensions/salesforce-connector/rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/extensions/salesforce-connector/rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml
deleted file mode 100644
index 59c1ed4..0000000
--- a/extensions/salesforce-connector/rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ /dev/null
@@ -1,76 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You 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.
- -->
-
-<blueprint xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:cxf="http://cxf.apache.org/blueprint/core"
- xmlns:jaxrs="http://cxf.apache.org/blueprint/jaxrs"
- 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
- http://cxf.apache.org/blueprint/jaxrs http://cxf.apache.org/schemas/blueprint/jaxrs.xsd
- http://cxf.apache.org/blueprint/core http://cxf.apache.org/schemas/blueprint/core.xsd">
-
- <cxf:bus>
- <cxf:features>
- <cxf:logging/>
- <bean class="org.apache.cxf.metrics.MetricsFeature"/>
- </cxf:features>
- </cxf:bus>
-
- <bean id="cors-filter" class="org.apache.cxf.rs.security.cors.CrossOriginResourceSharingFilter"/>
- <bean id="jacksonMapper" class="org.apache.unomi.persistence.spi.CustomObjectMapper"/>
- <bean id="jaxb-provider" class="com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider">
- <argument index="0" ref="jacksonMapper" type="com.fasterxml.jackson.databind.ObjectMapper "/>
- <argument index="1" type="com.fasterxml.jackson.jaxrs.cfg.Annotations[]">
- <array>
- <value>JACKSON</value>
- <value>JAXB</value>
- </array>
- </argument>
- </bean>
- <bean id="jaas-filter" class="org.apache.cxf.jaxrs.security.JAASAuthenticationFilter">
- <!-- Name of the JAAS Context -->
- <property name="contextName" value="karaf"/>
- <!-- Hint to the filter on how to have Principals representing users and roles separated
- while initializing a SecurityContext -->
- <property name="rolePrefix" value="ROLE_"/>
-
- <property name="realmName" value="cxs"/>
- <!-- Activate this if you want to force a redirect if auth is missing, by default it will trigger a 403 which
- is usually preferred -->
- <!--property name="redirectURI" value="/login.jsp"/-->
- </bean>
-
- <jaxrs:server address="/sfdc" id="restSFDCService">
- <jaxrs:providers>
- <ref component-id="jaxb-provider"/>
- <ref component-id="cors-filter"/>
- <ref component-id="jaas-filter"/>
- </jaxrs:providers>
-
- <jaxrs:serviceBeans>
- <ref component-id="sfdcServiceEndPoint"/>
- </jaxrs:serviceBeans>
- </jaxrs:server>
-
- <reference id="sfdcService" interface="org.apache.unomi.sfdc.services.SFDCService"/>
-
- <bean id="sfdcServiceEndPoint" class="org.apache.unomi.sfdc.rest.SFDCEndPoint">
- <property name="sfdcService" ref="sfdcService"/>
- <property name="bundleContext" ref="blueprintBundleContext" />
- </bean>
-</blueprint>
diff --git a/extensions/unomi-mailchimp/rest/pom.xml b/extensions/unomi-mailchimp/rest/pom.xml
index 9a4f700..1f63a8d 100644
--- a/extensions/unomi-mailchimp/rest/pom.xml
+++ b/extensions/unomi-mailchimp/rest/pom.xml
@@ -66,7 +66,12 @@
</dependency>
<dependency>
<groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
+ <artifactId>osgi.core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>osgi.cmpn</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
diff --git a/extensions/unomi-mailchimp/rest/src/main/java/org/apache/unomi/mailchimp/rest/MailChimpEndPoint.java b/extensions/unomi-mailchimp/rest/src/main/java/org/apache/unomi/mailchimp/rest/MailChimpEndPoint.java
index 4624874..1802548 100644
--- a/extensions/unomi-mailchimp/rest/src/main/java/org/apache/unomi/mailchimp/rest/MailChimpEndPoint.java
+++ b/extensions/unomi-mailchimp/rest/src/main/java/org/apache/unomi/mailchimp/rest/MailChimpEndPoint.java
@@ -18,6 +18,8 @@ package org.apache.unomi.mailchimp.rest;
import org.apache.cxf.rs.security.cors.CrossOriginResourceSharing;
import org.apache.unomi.mailchimp.services.MailChimpService;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
import javax.jws.WebMethod;
import javax.jws.WebService;
@@ -35,7 +37,11 @@ import java.util.List;
allowAllOrigins = true,
allowCredentials = true
)
+@Path("/mailchimp")
+@Component(service=MailChimpEndPoint.class,property = "osgi.jaxrs.resource=true")
public class MailChimpEndPoint {
+
+ @Reference
private MailChimpService mailChimpService;
public MailChimpEndPoint() {
diff --git a/extensions/unomi-mailchimp/rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/extensions/unomi-mailchimp/rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml
deleted file mode 100644
index adbcbc0..0000000
--- a/extensions/unomi-mailchimp/rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You 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.
- -->
-
-<blueprint xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:cxf="http://cxf.apache.org/blueprint/core"
- xmlns:jaxrs="http://cxf.apache.org/blueprint/jaxrs"
- 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
- http://cxf.apache.org/blueprint/jaxrs http://cxf.apache.org/schemas/blueprint/jaxrs.xsd
- http://cxf.apache.org/blueprint/core http://cxf.apache.org/schemas/blueprint/core.xsd">
-
- <cxf:bus>
- <cxf:features>
- <cxf:logging/>
- <bean class="org.apache.cxf.metrics.MetricsFeature"/>
- </cxf:features>
- </cxf:bus>
-
- <bean id="cors-filter" class="org.apache.cxf.rs.security.cors.CrossOriginResourceSharingFilter"/>
- <bean id="jacksonMapper" class="org.apache.unomi.persistence.spi.CustomObjectMapper"/>
- <bean id="jaxb-provider" class="com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider">
- <argument index="0" ref="jacksonMapper" type="com.fasterxml.jackson.databind.ObjectMapper "/>
- <argument index="1" type="com.fasterxml.jackson.jaxrs.cfg.Annotations[]">
- <array>
- <value>JACKSON</value>
- <value>JAXB</value>
- </array>
- </argument>
- </bean>
- <bean id="jaas-filter" class="org.apache.cxf.jaxrs.security.JAASAuthenticationFilter">
- <!-- Name of the JAAS Context -->
- <property name="contextName" value="karaf"/>
- <!-- Hint to the filter on how to have Principals representing users and roles separated
- while initializing a SecurityContext -->
- <property name="rolePrefix" value="ROLE_"/>
-
- <property name="realmName" value="cxs"/>
- <!-- Activate this if you want to force a redirect if auth is missing, by default it will trigger a 403 which
- is usually preferred -->
- <!--property name="redirectURI" value="/login.jsp"/-->
- </bean>
-
- <jaxrs:server address="/mailchimp" id="restMCService">
- <jaxrs:providers>
- <ref component-id="jaxb-provider"/>
- <ref component-id="cors-filter"/>
- <ref component-id="jaas-filter"/>
- </jaxrs:providers>
-
- <jaxrs:serviceBeans>
- <ref component-id="mailChimpEndPoint"/>
- </jaxrs:serviceBeans>
- </jaxrs:server>
-
- <reference id="mailChimpService" interface="org.apache.unomi.mailchimp.services.MailChimpService"/>
-
- <bean id="mailChimpEndPoint" class="org.apache.unomi.mailchimp.rest.MailChimpEndPoint">
- <property name="mailChimpService" ref="mailChimpService"/>
- </bean>
-</blueprint>
diff --git a/itests/README.md b/itests/README.md
index 5a3236c..845ea66 100644
--- a/itests/README.md
+++ b/itests/README.md
@@ -48,3 +48,38 @@ This will ensure the service is available before starting the test and if you ne
@Inject @Filter(value="(configDiscriminator=IMPORT)", timeout = 60000)
protected ImportExportConfigurationService<ImportConfiguration> importConfigurationService;
```
+## Running integration tests
+
+You can run the integration tests along with the build by doing:
+
+ mvn clean install -P integration-tests
+
+from the project's root directory
+
+If you want to run the tests with a debugger, you can use the `it.karaf.debug` system property.
+Here's an example:
+
+ cd itests
+ mvn clean install -Dit.karaf.debug=hold:true
+
+The `hold:true` will tell the JVM to pause for you to connect a debugger. You can simply connect a remote debugger on $
+port 5006 to debug the integration tests.
+
+Here are the parameters supported by the `it.karaf.debug` property:
+
+ hold:true - forces a wait for a remote debugger to connect
+ hold:false - continues even with no remote debugger connected
+ port:XXXX allows to configure the binding port to XXXX
+
+You can combine both parameters using a comma as a separator, as in the following example:
+
+ mvn clean install -Dit.karaf.debug=hold:true,port=5006
+
+## Running a single test
+
+If you want to run a single test or single methods, following the instructions given here:
+https://maven.apache.org/surefire/maven-failsafe-plugin/examples/single-test.html
+
+Here's an example:
+
+ mvn clean install -Dit.karaf.debug=hold:true -Dit.test=org.apache.unomi.itests.graphql.GraphQLEventIT
\ No newline at end of file
diff --git a/itests/pom.xml b/itests/pom.xml
index b24c7d4..4356471 100644
--- a/itests/pom.xml
+++ b/itests/pom.xml
@@ -120,7 +120,7 @@
</dependency>
<dependency>
<groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
+ <artifactId>osgi.core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
diff --git a/kar/src/main/feature/feature.xml b/kar/src/main/feature/feature.xml
index c2c15a7..69ecb29 100644
--- a/kar/src/main/feature/feature.xml
+++ b/kar/src/main/feature/feature.xml
@@ -26,6 +26,7 @@
<feature>war</feature>
<feature>cxf-jaxrs</feature>
<feature>cxf-features-metrics</feature>
+ <feature>cxf-rs-description-openapi-v3</feature>
<feature>cellar</feature>
<feature>eventadmin</feature>
<feature>shell-compat</feature>
@@ -81,6 +82,7 @@
<bundle start-level="85" start="false">mvn:org.apache.unomi/unomi-web-tracker-wab/${project.version}</bundle>
<bundle start-level="99">mvn:org.apache.unomi/shell-commands/${project.version}</bundle>
+ <bundle start-level="85">mvn:org.webjars/swagger-ui/3.23.8</bundle>
</feature>
<feature name="unomi-documentation" description="Documentation of Unomi in HTML" version="${project.version}">
diff --git a/lifecycle-watcher/pom.xml b/lifecycle-watcher/pom.xml
index 2fc2073..93a60ec 100644
--- a/lifecycle-watcher/pom.xml
+++ b/lifecycle-watcher/pom.xml
@@ -32,7 +32,7 @@
<dependencies>
<dependency>
<groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
+ <artifactId>osgi.core</artifactId>
</dependency>
</dependencies>
diff --git a/metrics/pom.xml b/metrics/pom.xml
index a79096e..5b0b1d5 100644
--- a/metrics/pom.xml
+++ b/metrics/pom.xml
@@ -72,7 +72,7 @@
<dependency>
<groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
+ <artifactId>osgi.core</artifactId>
<scope>provided</scope>
</dependency>
diff --git a/persistence-elasticsearch/core/pom.xml b/persistence-elasticsearch/core/pom.xml
index 2c9a442..c903640 100644
--- a/persistence-elasticsearch/core/pom.xml
+++ b/persistence-elasticsearch/core/pom.xml
@@ -33,12 +33,12 @@
<dependencies>
<dependency>
<groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
+ <artifactId>osgi.core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
+ <artifactId>osgi.cmpn</artifactId>
<scope>provided</scope>
</dependency>
diff --git a/pom.xml b/pom.xml
index 759cfff..29798d9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -679,14 +679,14 @@
<dependency>
<groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- <version>4.3.1</version>
+ <artifactId>osgi.core</artifactId>
+ <version>6.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- <version>4.3.1</version>
+ <artifactId>osgi.cmpn</artifactId>
+ <version>6.0.0</version>
<scope>provided</scope>
</dependency>
@@ -1153,17 +1153,6 @@
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
</plugin>
- <!--
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-scm-publish-plugin</artifactId>
- <version>1.1</version>
- <configuration>
- <checkinComment>[scm-publish] Updating Unomi website</checkinComment>
- <pubScmUrl>scm:svn:https://svn.apache.org/repos/asf/incubator/unomi/website/</pubScmUrl>
- </configuration>
- </plugin>
- -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
@@ -1188,39 +1177,6 @@
<version>0.11</version>
</plugin>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <configuration>
- <tags>
- <tag>
- <name>summary</name>
- <placement>a</placement>
- <head>MireDot summary (resource title)</head>
- </tag>
- <tag>
- <name>title</name>
- <placement>a</placement>
- <head>MireDot title (resource title)</head>
- </tag>
- <tag>
- <name>servicetag</name>
- <placement>a</placement>
- <head>MireDot resource tag (label)</head>
- </tag>
- <tag>
- <name>statuscode</name>
- <placement>a</placement>
- <head>MireDot resource status code(s)</head>
- </tag>
- <tag>
- <name>responseheader</name>
- <placement>a</placement>
- <head>MireDot response header</head>
- </tag>
- </tags>
- </configuration>
- </plugin>
- <plugin>
<groupId>external.atlassian.jgitflow</groupId>
<artifactId>jgitflow-maven-plugin</artifactId>
<version>1.0-m5.1</version>
diff --git a/rest/pom.xml b/rest/pom.xml
index 96e5cd1..8ed6e07 100644
--- a/rest/pom.xml
+++ b/rest/pom.xml
@@ -30,14 +30,6 @@
<description>Apache Unomi Context Server REST API</description>
<packaging>bundle</packaging>
- <pluginRepositories>
- <pluginRepository>
- <id>miredot</id>
- <name>Miredot Releases</name>
- <url>https://secure-nexus.miredot.com/content/repositories/miredot/</url>
- </pluginRepository>
- </pluginRepositories>
-
<dependencies>
<dependency>
<groupId>org.apache.unomi</groupId>
@@ -48,7 +40,13 @@
<dependency>
<groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
+ <artifactId>osgi.core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>osgi.cmpn</artifactId>
<scope>provided</scope>
</dependency>
@@ -92,267 +90,36 @@
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
- <!--<dependency>
- <groupId>io.swagger</groupId>
- <artifactId>swagger-core</artifactId>
- <scope>compile</scope>
- <version>1.5.3</version>
- <exclusions>
- <exclusion>
- <groupId>javax.ws.rs</groupId>
- <artifactId>jsr311-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>-->
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-rs-service-description-openapi-v3</artifactId>
+ <version>${cxf.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-features-metrics</artifactId>
+ <version>${cxf.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-features-logging</artifactId>
+ <version>${cxf.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-rs-security-cors</artifactId>
+ <version>${cxf.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-jaxrs</artifactId>
+ <version>${cxf.version}</version>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
- <profiles>
- <profile>
- <id>rest-doc-jdk8</id>
- <activation>
- <os>
- <family>!windows</family>
- </os>
- <jdk>
- [1.6,1.10)
- </jdk>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>com.qmino</groupId>
- <artifactId>miredot-plugin</artifactId>
- <version>2.1.2</version>
- <executions>
- <execution>
- <goals>
- <goal>restdoc</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <licence>cHJvamVjdHxvcmcuYXBhY2hlLnVub21pLnVub21pLXJlc3R8MjAyNS0wMS0wMXxmYWxzZXwtMSNNQ3dDRkhNUlNaYVM0c2lFOHpjcnhUM1N5R2RVc3VuREFoUmNTV2lYa0RLNmJOSmtab2cxY21udWc0VDFnQT09</licence>
- <output>
- <title>Documentation for Apache Unomi's RESTful API ${project.version}</title>
- <html>
- <!-- optional html configuration -->
- <location>${project.parent.build.directory}/staging/rest-api-doc</location>
- </html>
- <raml />
- </output>
- <restModel>
- <restFramework>
- <name>jax-rs</name>
- <cxfServiceConfig>
- <item>src/main/resources/OSGI-INF/blueprint/blueprint.xml</item>
- </cxfServiceConfig>
- </restFramework>
- <httpStatusCodes>
- <httpStatusCode>
- <httpCode>200</httpCode>
- <document>always</document>
- <defaultMessage>The service call has completed successfully.</defaultMessage>
- </httpStatusCode>
- <httpStatusCode>
- <httpCode>401</httpCode>
- <document>explicit: com.acme.exceptions.AuthorizationException</document>
- <defaultMessage>The user is not authorized to use this service.</defaultMessage>
- </httpStatusCode>
- <httpStatusCode>
- <httpCode>412</httpCode>
- <document>put,post</document>
- <defaultMessage>Invalid JSON/XML input.</defaultMessage>
- </httpStatusCode>
- <httpStatusCode>
- <httpCode>500</httpCode>
- <document>always</document>
- <defaultMessage>The service call has not succeeded.</defaultMessage>
- <sticky>true</sticky> <!-- Document always, even if there is an @statuscode tag -->
- </httpStatusCode>
- </httpStatusCodes>
- <externalSources>
- <sourceDirs>
- <sourceDir>../api/src/main/java</sourceDir>
- </sourceDirs>
- </externalSources>
- </restModel>
- <analysis>
- <checks>
- <JAVADOC_MISSING_SUMMARY>warn</JAVADOC_MISSING_SUMMARY>
- <JAVADOC_MISSING_INTERFACEDOCUMENTATION>warn</JAVADOC_MISSING_INTERFACEDOCUMENTATION>
- <JAVADOC_MISSING_PARAMETER_DOCUMENTATION>warn</JAVADOC_MISSING_PARAMETER_DOCUMENTATION>
- <JAVADOC_MISSING_EXCEPTION_DOCUMENTATION>warn</JAVADOC_MISSING_EXCEPTION_DOCUMENTATION>
- <JAVADOC_MISSING_AUTHORS>ignore</JAVADOC_MISSING_AUTHORS>
- <JAXRS_MISSING_PRODUCES>warn</JAXRS_MISSING_PRODUCES>
- <JAXRS_MISSING_CONSUMES>warn</JAXRS_MISSING_CONSUMES>
- <JAXRS_MISSING_PATH_PARAM>warn</JAXRS_MISSING_PATH_PARAM>
- <REST_UNMAPPED_EXCEPTION>warn</REST_UNMAPPED_EXCEPTION>
- <UNREACHABLE_RESOURCE>warn</UNREACHABLE_RESOURCE>
- <PARTIAL_RESOURCE_OVERLAP>warn</PARTIAL_RESOURCE_OVERLAP>
- </checks>
- </analysis>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <configuration>
- <tags>
- <tag>
- <name>summary</name>
- <placement>a</placement>
- <head>MireDot summary (resource title)</head>
- </tag>
- <tag>
- <name>title</name>
- <placement>a</placement>
- <head>MireDot title (resource title)</head>
- </tag>
- <tag>
- <name>servicetag</name>
- <placement>a</placement>
- <head>MireDot resource tag (label)</head>
- </tag>
- <tag>
- <name>statuscode</name>
- <placement>a</placement>
- <head>MireDot resource status code(s)</head>
- </tag>
- <tag>
- <name>responseheader</name>
- <placement>a</placement>
- <head>MireDot response header</head>
- </tag>
- </tags>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>rest-doc-jdk10</id>
- <activation>
- <os>
- <family>!windows</family>
- </os>
- <jdk>
- 1.10
- </jdk>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>com.qmino</groupId>
- <artifactId>miredot-plugin</artifactId>
- <version>2.2.1-Java10</version>
- <executions>
- <execution>
- <goals>
- <goal>restdoc</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <licence>cHJvamVjdHxvcmcuYXBhY2hlLnVub21pLnVub21pLXJlc3R8MjAyMC0wMi0yOHx0cnVlfC0xI01Dd0NGQ01pMDRxTFZ6LzJ4SG82MjAranZITnRLYWovQWhRcG4vS01jdTU2NXpOWkRpUzcwQXMrdC96bVdRPT0=</licence>
- <output>
- <title>Documentation for Apache Unomi's RESTful API ${project.version}</title>
- <html>
- <!-- optional html configuration -->
- <location>${project.parent.build.directory}/staging/rest-api-doc</location>
- </html>
- <raml />
- </output>
- <restModel>
- <restFramework>
- <name>jax-rs</name>
- <cxfServiceConfig>
- <item>src/main/resources/OSGI-INF/blueprint/blueprint.xml</item>
- </cxfServiceConfig>
- </restFramework>
- <httpStatusCodes>
- <httpStatusCode>
- <httpCode>200</httpCode>
- <document>always</document>
- <defaultMessage>The service call has completed successfully.</defaultMessage>
- </httpStatusCode>
- <httpStatusCode>
- <httpCode>401</httpCode>
- <document>explicit: com.acme.exceptions.AuthorizationException</document>
- <defaultMessage>The user is not authorized to use this service.</defaultMessage>
- </httpStatusCode>
- <httpStatusCode>
- <httpCode>412</httpCode>
- <document>put,post</document>
- <defaultMessage>Invalid JSON/XML input.</defaultMessage>
- </httpStatusCode>
- <httpStatusCode>
- <httpCode>500</httpCode>
- <document>always</document>
- <defaultMessage>The service call has not succeeded.</defaultMessage>
- <sticky>true</sticky> <!-- Document always, even if there is an @statuscode tag -->
- </httpStatusCode>
- </httpStatusCodes>
- <externalSources>
- <sourceDirs>
- <sourceDir>../api/src/main/java</sourceDir>
- </sourceDirs>
- </externalSources>
- </restModel>
- <analysis>
- <checks>
- <JAVADOC_MISSING_SUMMARY>warn</JAVADOC_MISSING_SUMMARY>
- <JAVADOC_MISSING_INTERFACEDOCUMENTATION>warn</JAVADOC_MISSING_INTERFACEDOCUMENTATION>
- <JAVADOC_MISSING_PARAMETER_DOCUMENTATION>warn</JAVADOC_MISSING_PARAMETER_DOCUMENTATION>
- <JAVADOC_MISSING_EXCEPTION_DOCUMENTATION>warn</JAVADOC_MISSING_EXCEPTION_DOCUMENTATION>
- <JAVADOC_MISSING_AUTHORS>ignore</JAVADOC_MISSING_AUTHORS>
- <JAXRS_MISSING_PRODUCES>warn</JAXRS_MISSING_PRODUCES>
- <JAXRS_MISSING_CONSUMES>warn</JAXRS_MISSING_CONSUMES>
- <JAXRS_MISSING_PATH_PARAM>warn</JAXRS_MISSING_PATH_PARAM>
- <REST_UNMAPPED_EXCEPTION>warn</REST_UNMAPPED_EXCEPTION>
- <UNREACHABLE_RESOURCE>warn</UNREACHABLE_RESOURCE>
- <PARTIAL_RESOURCE_OVERLAP>warn</PARTIAL_RESOURCE_OVERLAP>
- </checks>
- </analysis>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <configuration>
- <tags>
- <tag>
- <name>summary</name>
- <placement>a</placement>
- <head>MireDot summary (resource title)</head>
- </tag>
- <tag>
- <name>title</name>
- <placement>a</placement>
- <head>MireDot title (resource title)</head>
- </tag>
- <tag>
- <name>servicetag</name>
- <placement>a</placement>
- <head>MireDot resource tag (label)</head>
- </tag>
- <tag>
- <name>statuscode</name>
- <placement>a</placement>
- <head>MireDot resource status code(s)</head>
- </tag>
- <tag>
- <name>responseheader</name>
- <placement>a</placement>
- <head>MireDot response header</head>
- </tag>
- </tags>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-
- <build>
- </build>
</project>
diff --git a/rest/src/main/java/org/apache/unomi/rest/CampaignsServiceEndPoint.java b/rest/src/main/java/org/apache/unomi/rest/CampaignsServiceEndPoint.java
index 28d275a..5dbace2 100644
--- a/rest/src/main/java/org/apache/unomi/rest/CampaignsServiceEndPoint.java
+++ b/rest/src/main/java/org/apache/unomi/rest/CampaignsServiceEndPoint.java
@@ -26,6 +26,8 @@ import org.apache.unomi.api.campaigns.events.CampaignEvent;
import org.apache.unomi.api.query.Query;
import org.apache.unomi.api.rules.Rule;
import org.apache.unomi.api.services.GoalsService;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -45,10 +47,13 @@ import java.util.Set;
allowAllOrigins = true,
allowCredentials = true
)
+@Path("/campaigns")
+@Component(service=CampaignsServiceEndPoint.class,property = "osgi.jaxrs.resource=true")
public class CampaignsServiceEndPoint {
private static final Logger logger = LoggerFactory.getLogger(CampaignsServiceEndPoint.class.getName());
+ @Reference
private GoalsService goalsService;
public CampaignsServiceEndPoint() {
diff --git a/rest/src/main/java/org/apache/unomi/rest/ClusterServiceEndPoint.java b/rest/src/main/java/org/apache/unomi/rest/ClusterServiceEndPoint.java
index 21134e2..9cc869e 100644
--- a/rest/src/main/java/org/apache/unomi/rest/ClusterServiceEndPoint.java
+++ b/rest/src/main/java/org/apache/unomi/rest/ClusterServiceEndPoint.java
@@ -21,6 +21,8 @@ import org.apache.cxf.jaxrs.ext.MessageContext;
import org.apache.cxf.rs.security.cors.CrossOriginResourceSharing;
import org.apache.unomi.api.ClusterNode;
import org.apache.unomi.api.services.ClusterService;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -42,12 +44,15 @@ import java.util.List;
allowAllOrigins = true,
allowCredentials = true
)
+@Path("/cluster")
+@Component(service=ClusterServiceEndPoint.class,property = "osgi.jaxrs.resource=true")
public class ClusterServiceEndPoint {
private static final Logger logger = LoggerFactory.getLogger(ClusterServiceEndPoint.class.getName());
@Context
private MessageContext messageContext;
+ @Reference
private ClusterService clusterService;
public ClusterServiceEndPoint() {
diff --git a/rest/src/main/java/org/apache/unomi/rest/DefinitionsServiceEndPoint.java b/rest/src/main/java/org/apache/unomi/rest/DefinitionsServiceEndPoint.java
index b2afa07..8b2c7c0 100644
--- a/rest/src/main/java/org/apache/unomi/rest/DefinitionsServiceEndPoint.java
+++ b/rest/src/main/java/org/apache/unomi/rest/DefinitionsServiceEndPoint.java
@@ -24,6 +24,8 @@ import org.apache.unomi.api.ValueType;
import org.apache.unomi.api.actions.ActionType;
import org.apache.unomi.api.conditions.ConditionType;
import org.apache.unomi.api.services.DefinitionsService;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -42,10 +44,15 @@ import java.util.*;
allowAllOrigins = true,
allowCredentials = true
)
+@Path("/definitions")
+@Component(service=DefinitionsServiceEndPoint.class,property = "osgi.jaxrs.resource=true")
public class DefinitionsServiceEndPoint {
private static final Logger logger = LoggerFactory.getLogger(DefinitionsServiceEndPoint.class.getName());
+ @Reference
private DefinitionsService definitionsService;
+
+ @Reference
private LocalizationHelper localizationHelper;
@WebMethod(exclude = true)
diff --git a/rest/src/main/java/org/apache/unomi/rest/EventServiceEndpoint.java b/rest/src/main/java/org/apache/unomi/rest/EventServiceEndpoint.java
index affb0c6..a1bd69b 100644
--- a/rest/src/main/java/org/apache/unomi/rest/EventServiceEndpoint.java
+++ b/rest/src/main/java/org/apache/unomi/rest/EventServiceEndpoint.java
@@ -22,6 +22,8 @@ import org.apache.unomi.api.EventType;
import org.apache.unomi.api.PartialList;
import org.apache.unomi.api.query.Query;
import org.apache.unomi.api.services.EventService;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
import javax.jws.WebMethod;
import javax.jws.WebService;
@@ -42,8 +44,11 @@ import java.util.Set;
allowAllOrigins = true,
allowCredentials = true
)
+@Path("/events")
+@Component(service=EventServiceEndpoint.class,property = "osgi.jaxrs.resource=true")
public class EventServiceEndpoint {
+ @Reference
private EventService eventService;
@WebMethod(exclude = true)
diff --git a/rest/src/main/java/org/apache/unomi/rest/GoalsServiceEndPoint.java b/rest/src/main/java/org/apache/unomi/rest/GoalsServiceEndPoint.java
index 120507d..0063640 100644
--- a/rest/src/main/java/org/apache/unomi/rest/GoalsServiceEndPoint.java
+++ b/rest/src/main/java/org/apache/unomi/rest/GoalsServiceEndPoint.java
@@ -25,6 +25,8 @@ import org.apache.unomi.api.query.AggregateQuery;
import org.apache.unomi.api.query.Query;
import org.apache.unomi.api.rules.Rule;
import org.apache.unomi.api.services.GoalsService;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
import javax.jws.WebMethod;
import javax.jws.WebService;
@@ -42,8 +44,11 @@ import java.util.Set;
allowAllOrigins = true,
allowCredentials = true
)
+@Path("/goals")
+@Component(service=GoalsServiceEndPoint.class,property = "osgi.jaxrs.resource=true")
public class GoalsServiceEndPoint {
+ @Reference
private GoalsService goalsService;
@WebMethod(exclude = true)
diff --git a/rest/src/main/java/org/apache/unomi/rest/LocalizationHelper.java b/rest/src/main/java/org/apache/unomi/rest/LocalizationHelper.java
index 38a1203..148a425 100644
--- a/rest/src/main/java/org/apache/unomi/rest/LocalizationHelper.java
+++ b/rest/src/main/java/org/apache/unomi/rest/LocalizationHelper.java
@@ -22,6 +22,10 @@ import org.apache.unomi.api.ValueType;
import org.apache.unomi.api.actions.ActionType;
import org.apache.unomi.api.conditions.ConditionType;
import org.osgi.framework.BundleContext;
+import org.osgi.service.component.ComponentContext;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -33,13 +37,21 @@ import java.util.ResourceBundle;
/**
* A helper class to provide localized versions of context server entities.
*/
+@Component(service=LocalizationHelper.class)
public class LocalizationHelper {
private static final Logger logger = LoggerFactory.getLogger(LocalizationHelper.class.getName());
private BundleContext bundleContext;
+
+ @Reference
private ResourceBundleHelper resourceBundleHelper;
+ @Activate
+ public void activate(ComponentContext componentContext) {
+ this.bundleContext = componentContext.getBundleContext();
+ }
+
/**
* Creates {@link RESTConditionType}s, localized using the specified language, based on the specified {@link ConditionType}s.
*
diff --git a/rest/src/main/java/org/apache/unomi/rest/PatchServiceEndPoint.java b/rest/src/main/java/org/apache/unomi/rest/PatchServiceEndPoint.java
index b7d7a9c..81033d8 100644
--- a/rest/src/main/java/org/apache/unomi/rest/PatchServiceEndPoint.java
+++ b/rest/src/main/java/org/apache/unomi/rest/PatchServiceEndPoint.java
@@ -20,6 +20,8 @@ package org.apache.unomi.rest;
import org.apache.cxf.rs.security.cors.CrossOriginResourceSharing;
import org.apache.unomi.api.Patch;
import org.apache.unomi.api.services.PatchService;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
import javax.jws.WebService;
import javax.ws.rs.*;
@@ -35,8 +37,11 @@ import javax.ws.rs.core.MediaType;
allowAllOrigins = true,
allowCredentials = true
)
+@Path("/patches")
+@Component(service=PatchServiceEndPoint.class,property = "osgi.jaxrs.resource=true")
public class PatchServiceEndPoint {
+ @Reference
private PatchService patchService;
public void setPatchService(PatchService patchService) {
diff --git a/rest/src/main/java/org/apache/unomi/rest/ProfileServiceEndPoint.java b/rest/src/main/java/org/apache/unomi/rest/ProfileServiceEndPoint.java
index 0e47106..3ff36a9 100644
--- a/rest/src/main/java/org/apache/unomi/rest/ProfileServiceEndPoint.java
+++ b/rest/src/main/java/org/apache/unomi/rest/ProfileServiceEndPoint.java
@@ -26,6 +26,8 @@ import org.apache.unomi.api.services.EventService;
import org.apache.unomi.api.services.ProfileService;
import org.apache.unomi.api.services.SegmentService;
import org.apache.unomi.persistence.spi.CustomObjectMapper;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -51,16 +53,22 @@ import java.util.*;
allowAllOrigins = true,
allowCredentials = true
)
+@Path("/profiles")
+@Component(service=ProfileServiceEndPoint.class,property = "osgi.jaxrs.resource=true")
public class ProfileServiceEndPoint {
private static final Logger logger = LoggerFactory.getLogger(ProfileServiceEndPoint.class.getName());
+ @Reference
private ProfileService profileService;
+ @Reference
private EventService eventService;
+ @Reference
private SegmentService segmentService;
+ @Reference
private LocalizationHelper localizationHelper;
public ProfileServiceEndPoint() {
diff --git a/rest/src/main/java/org/apache/unomi/rest/QueryServiceEndPoint.java b/rest/src/main/java/org/apache/unomi/rest/QueryServiceEndPoint.java
index 25e2456..c533e7d 100644
--- a/rest/src/main/java/org/apache/unomi/rest/QueryServiceEndPoint.java
+++ b/rest/src/main/java/org/apache/unomi/rest/QueryServiceEndPoint.java
@@ -22,6 +22,8 @@ import org.apache.unomi.api.Item;
import org.apache.unomi.api.conditions.Condition;
import org.apache.unomi.api.query.AggregateQuery;
import org.apache.unomi.api.services.QueryService;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -44,11 +46,15 @@ import java.util.Map;
allowAllOrigins = true,
allowCredentials = true
)
+@Path("/query")
+@Component(service=QueryServiceEndPoint.class,property = "osgi.jaxrs.resource=true")
public class QueryServiceEndPoint {
private static final Logger logger = LoggerFactory.getLogger(QueryServiceEndPoint.class.getName());
+ @Reference
private QueryService queryService;
+ @Reference
private LocalizationHelper localizationHelper;
@WebMethod(exclude = true)
diff --git a/rest/src/main/java/org/apache/unomi/rest/ResourceBundleHelper.java b/rest/src/main/java/org/apache/unomi/rest/ResourceBundleHelper.java
index 760a27e..abc375b 100644
--- a/rest/src/main/java/org/apache/unomi/rest/ResourceBundleHelper.java
+++ b/rest/src/main/java/org/apache/unomi/rest/ResourceBundleHelper.java
@@ -21,12 +21,16 @@ import org.apache.unomi.api.PluginType;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.wiring.BundleWiring;
+import org.osgi.service.component.ComponentContext;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.regex.Pattern;
+@Component(service=ResourceBundleHelper.class)
public class ResourceBundleHelper {
private static final Pattern COMMA = Pattern.compile(",", Pattern.LITERAL);
@@ -35,6 +39,11 @@ public class ResourceBundleHelper {
private BundleContext bundleContext;
+ @Activate
+ public void activate(ComponentContext componentContext) {
+ this.bundleContext = componentContext.getBundleContext();
+ }
+
private ResourceBundle getBundle(String lang, Bundle bundle, ClassLoader loader) {
Locale locale = getLocale(lang);
try {
diff --git a/rest/src/main/java/org/apache/unomi/rest/RestServer.java b/rest/src/main/java/org/apache/unomi/rest/RestServer.java
new file mode 100644
index 0000000..48fae61
--- /dev/null
+++ b/rest/src/main/java/org/apache/unomi/rest/RestServer.java
@@ -0,0 +1,176 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+package org.apache.unomi.rest;
+
+import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.feature.LoggingFeature;
+import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
+import org.apache.cxf.jaxrs.openapi.OpenApiFeature;
+import org.apache.cxf.jaxrs.security.JAASAuthenticationFilter;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Filter;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.component.ComponentContext;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Deactivate;
+import org.osgi.service.component.annotations.Reference;
+import org.osgi.util.tracker.ServiceTracker;
+import org.osgi.util.tracker.ServiceTrackerCustomizer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.ws.rs.ext.ExceptionMapper;
+import java.util.*;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+@Component
+public class RestServer {
+
+ private static final Logger logger = LoggerFactory.getLogger(RestServer.class.getName());
+
+ private Server server;
+ private BundleContext bundleContext;
+ ServiceTracker jaxRSServiceTracker;
+ private List<ExceptionMapper> exceptionMappers = new ArrayList<>();
+ private long timeOfLastUpdate = System.currentTimeMillis();
+ private Timer refreshTimer = null;
+ private long startupDelay = 1000L;
+
+ final List<Object> serviceBeans = new CopyOnWriteArrayList<>();
+
+ @Reference
+ public void addExceptionMapper(ExceptionMapper exceptionMapper) {
+ this.exceptionMappers.add(exceptionMapper);
+ timeOfLastUpdate = System.currentTimeMillis();
+ refreshServer();
+ }
+
+ public void removeExceptionMapper(ExceptionMapper exceptionMapper) {
+ this.exceptionMappers.remove(exceptionMapper);
+ timeOfLastUpdate = System.currentTimeMillis();
+ refreshServer();
+ }
+
+ @Activate
+ public void activate(ComponentContext componentContext) throws Exception {
+ this.bundleContext = componentContext.getBundleContext();
+
+ Filter filter = bundleContext.createFilter("(osgi.jaxrs.resource=true)");
+ jaxRSServiceTracker = new ServiceTracker(bundleContext, filter, new ServiceTrackerCustomizer() {
+ @Override
+ public Object addingService(ServiceReference reference) {
+ Object serviceBean = bundleContext.getService(reference);
+ logger.info("Registering JAX RS service " + serviceBean.getClass().getName());
+ serviceBeans.add(serviceBean);
+ timeOfLastUpdate = System.currentTimeMillis();
+ refreshServer();
+ return serviceBean;
+ }
+
+ @Override
+ public void modifiedService(ServiceReference reference, Object service) {
+ logger.info("Refreshing JAX RS server because service " + service.getClass().getName() + " was modified.");
+ timeOfLastUpdate = System.currentTimeMillis();
+ refreshServer();
+ }
+
+ @Override
+ public void removedService(ServiceReference reference, Object service) {
+ Object serviceBean = bundleContext.getService(reference);
+ logger.info("Removing JAX RS service " + serviceBean.getClass().getName());
+ serviceBeans.remove(serviceBean);
+ timeOfLastUpdate = System.currentTimeMillis();
+ refreshServer();
+ }
+ });
+ jaxRSServiceTracker.open();
+ }
+
+ @Deactivate
+ public void deactivate() throws Exception {
+ jaxRSServiceTracker.close();
+ if (server != null) {
+ server.destroy();
+ }
+ }
+
+ private synchronized void refreshServer() {
+ long now = System.currentTimeMillis();
+ logger.info("Time (millis) since last update: {}", now - timeOfLastUpdate);
+ if (now - timeOfLastUpdate < startupDelay) {
+ if (refreshTimer != null) {
+ return;
+ }
+ TimerTask task = new TimerTask() {
+ public void run() {
+ refreshTimer = null;
+ refreshServer();
+ logger.info("Refreshed server task performed on: " + new Date() +
+ " Thread's name: " + Thread.currentThread().getName());
+ }
+ };
+ refreshTimer = new Timer("Timer-Refresh-REST-API");
+
+ refreshTimer.schedule(task, startupDelay);
+ return;
+ }
+
+ if (server != null) {
+ logger.info("Shutting down JAX RS Endpoint... ");
+ server.destroy();
+ }
+
+ final OpenApiFeature openApiFeature = new OpenApiFeature();
+ openApiFeature.setContactEmail("dev@unomi.apache.org");
+ openApiFeature.setLicense("Apache 2.0 License");
+ openApiFeature.setLicenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html");
+ openApiFeature.setScan(false);
+ openApiFeature.setUseContextBasedConfig(true); //Set<String> resourceClasses = serviceBeans.stream().map(service -> service.getClass().getName()).collect(toSet());
+
+ JAXRSServerFactoryBean jaxrsServerFactoryBean = new JAXRSServerFactoryBean();
+ jaxrsServerFactoryBean.setAddress("/");
+ Bus bus = BusFactory.getDefaultBus();
+ // bus.getFeatures().add(new LoggingFeature());
+ bus.getFeatures().add(new LoggingFeature());
+ bus.getFeatures().add(new org.apache.cxf.metrics.MetricsFeature());
+ jaxrsServerFactoryBean.setBus(bus);
+ jaxrsServerFactoryBean.setProvider(
+ new JacksonJaxbJsonProvider(
+ new org.apache.unomi.persistence.spi.CustomObjectMapper(),
+ JacksonJaxbJsonProvider.DEFAULT_ANNOTATIONS));
+ jaxrsServerFactoryBean.setProvider(new org.apache.cxf.rs.security.cors.CrossOriginResourceSharingFilter());
+ JAASAuthenticationFilter jaasFilter = new org.apache.cxf.jaxrs.security.JAASAuthenticationFilter();
+ jaasFilter.setContextName("karaf");
+ jaasFilter.setRoleClassifier("ROLE_");
+ jaasFilter.setRealmName("cxs");
+ jaxrsServerFactoryBean.setProvider(jaasFilter);
+ for (ExceptionMapper exceptionMapper : exceptionMappers) {
+ jaxrsServerFactoryBean.setProvider(exceptionMapper);
+ }
+ jaxrsServerFactoryBean.setServiceBeans(serviceBeans);
+ jaxrsServerFactoryBean.getFeatures().add(openApiFeature);
+ if (serviceBeans.size() > 0) {
+ logger.info("Starting JAX RS Endpoint...");
+ server = jaxrsServerFactoryBean.create();
+ }
+ }
+
+}
diff --git a/rest/src/main/java/org/apache/unomi/rest/RulesServiceEndPoint.java b/rest/src/main/java/org/apache/unomi/rest/RulesServiceEndPoint.java
index f27a95e..b52ed79 100644
--- a/rest/src/main/java/org/apache/unomi/rest/RulesServiceEndPoint.java
+++ b/rest/src/main/java/org/apache/unomi/rest/RulesServiceEndPoint.java
@@ -24,6 +24,8 @@ import org.apache.unomi.api.query.Query;
import org.apache.unomi.api.rules.Rule;
import org.apache.unomi.api.rules.RuleStatistics;
import org.apache.unomi.api.services.RulesService;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -44,10 +46,13 @@ import java.util.Set;
allowAllOrigins = true,
allowCredentials = true
)
+@Path("/rules")
+@Component(service=RulesServiceEndPoint.class,property = "osgi.jaxrs.resource=true")
public class RulesServiceEndPoint {
private static final Logger logger = LoggerFactory.getLogger(RulesServiceEndPoint.class.getName());
+ @Reference
private RulesService rulesService;
public RulesServiceEndPoint() {
diff --git a/rest/src/main/java/org/apache/unomi/rest/ScoringServiceEndPoint.java b/rest/src/main/java/org/apache/unomi/rest/ScoringServiceEndPoint.java
index c7b83cc..fc0ca72 100644
--- a/rest/src/main/java/org/apache/unomi/rest/ScoringServiceEndPoint.java
+++ b/rest/src/main/java/org/apache/unomi/rest/ScoringServiceEndPoint.java
@@ -25,6 +25,8 @@ import org.apache.unomi.api.query.Query;
import org.apache.unomi.api.segments.DependentMetadata;
import org.apache.unomi.api.segments.Scoring;
import org.apache.unomi.api.services.SegmentService;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -44,10 +46,13 @@ import java.util.List;
allowAllOrigins = true,
allowCredentials = true
)
+@Path("/scoring")
+@Component(service=ScoringServiceEndPoint.class,property = "osgi.jaxrs.resource=true")
public class ScoringServiceEndPoint {
private static final Logger logger = LoggerFactory.getLogger(ScoringServiceEndPoint.class.getName());
+ @Reference
private SegmentService segmentService;
public ScoringServiceEndPoint() {
diff --git a/rest/src/main/java/org/apache/unomi/rest/SegmentServiceEndPoint.java b/rest/src/main/java/org/apache/unomi/rest/SegmentServiceEndPoint.java
index 240c9a0..0c7f9c9 100644
--- a/rest/src/main/java/org/apache/unomi/rest/SegmentServiceEndPoint.java
+++ b/rest/src/main/java/org/apache/unomi/rest/SegmentServiceEndPoint.java
@@ -25,6 +25,8 @@ import org.apache.unomi.api.query.Query;
import org.apache.unomi.api.segments.DependentMetadata;
import org.apache.unomi.api.segments.Segment;
import org.apache.unomi.api.services.SegmentService;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -44,10 +46,13 @@ import java.util.List;
allowAllOrigins = true,
allowCredentials = true
)
+@Path("/segments")
+@Component(service=SegmentServiceEndPoint.class,property = "osgi.jaxrs.resource=true")
public class SegmentServiceEndPoint {
private static final Logger logger = LoggerFactory.getLogger(SegmentServiceEndPoint.class.getName());
+ @Reference
private SegmentService segmentService;
public SegmentServiceEndPoint() {
diff --git a/rest/src/main/java/org/apache/unomi/rest/UserListServiceEndPoint.java b/rest/src/main/java/org/apache/unomi/rest/UserListServiceEndPoint.java
index 6a4c264..33484ff 100644
--- a/rest/src/main/java/org/apache/unomi/rest/UserListServiceEndPoint.java
+++ b/rest/src/main/java/org/apache/unomi/rest/UserListServiceEndPoint.java
@@ -25,6 +25,8 @@ import org.apache.cxf.rs.security.cors.CrossOriginResourceSharing;
import org.apache.unomi.api.Metadata;
import org.apache.unomi.api.lists.UserList;
import org.apache.unomi.api.services.UserListService;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -44,10 +46,13 @@ import java.util.List;
allowAllOrigins = true,
allowCredentials = true
)
+@Path("/userList")
+@Component(service=UserListServiceEndPoint.class,property = "osgi.jaxrs.resource=true")
public class UserListServiceEndPoint {
private static final Logger logger = LoggerFactory.getLogger(UserListServiceEndPoint.class.getName());
+ @Reference
private UserListService userListService;
public UserListServiceEndPoint() {
diff --git a/rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml
deleted file mode 100644
index dba20eb..0000000
--- a/rest/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ /dev/null
@@ -1,280 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You 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.
- -->
-
-<blueprint xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
- xmlns:cxf="http://cxf.apache.org/blueprint/core"
- xmlns:jaxrs="http://cxf.apache.org/blueprint/jaxrs"
- 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
- http://cxf.apache.org/blueprint/jaxrs http://cxf.apache.org/schemas/blueprint/jaxrs.xsd
- http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0 http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.1.0.xsd
- http://cxf.apache.org/blueprint/core http://cxf.apache.org/schemas/blueprint/core.xsd">
- <cm:property-placeholder persistent-id="org.apache.unomi.rest.segmentserviceendpoint"
- update-strategy="reload">
- </cm:property-placeholder>
-
- <cxf:bus>
- <cxf:features>
- <cxf:logging/>
- <bean class="org.apache.cxf.metrics.MetricsFeature"/>
- </cxf:features>
- </cxf:bus>
-
- <bean id="cors-filter" class="org.apache.cxf.rs.security.cors.CrossOriginResourceSharingFilter"/>
- <bean id="jacksonMapper" class="org.apache.unomi.persistence.spi.CustomObjectMapper"/>
- <bean id="jaxb-provider" class="com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider">
- <argument index="0" ref="jacksonMapper" type="com.fasterxml.jackson.databind.ObjectMapper "/>
- <argument index="1" type="com.fasterxml.jackson.jaxrs.cfg.Annotations[]">
- <array>
- <value>JACKSON</value>
- <value>JAXB</value>
- </array>
- </argument>
- </bean>
- <bean id="jaas-filter" class="org.apache.cxf.jaxrs.security.JAASAuthenticationFilter">
- <!-- Name of the JAAS Context -->
- <property name="contextName" value="karaf"/>
- <!-- Hint to the filter on how to have Principals representing users and roles separated
- while initializing a SecurityContext -->
- <property name="rolePrefix" value="ROLE_"/>
-
- <property name="realmName" value="cxs"/>
- <!-- Activate this if you want to force a redirect if auth is missing, by default it will trigger a 403 which
- is usually preferred -->
- <!--property name="redirectURI" value="/login.jsp"/-->
- </bean>
-
- <jaxrs:server address="/segments" id="restSegmentService">
- <jaxrs:providers>
- <ref component-id="jaxb-provider"/>
- <ref component-id="cors-filter"/>
- <ref component-id="jaas-filter"/>
- </jaxrs:providers>
-
- <jaxrs:serviceBeans>
- <ref component-id="segmentServiceEndPoint"/>
- </jaxrs:serviceBeans>
- </jaxrs:server>
-
- <jaxrs:server address="/userList" id="restUserListService">
- <jaxrs:providers>
- <ref component-id="jaxb-provider"/>
- <ref component-id="cors-filter"/>
- <ref component-id="jaas-filter"/>
- </jaxrs:providers>
-
- <jaxrs:serviceBeans>
- <ref component-id="userListServiceEndPoint"/>
- </jaxrs:serviceBeans>
- </jaxrs:server>
-
- <jaxrs:server address="/scoring" id="restScoringService">
- <jaxrs:providers>
- <ref component-id="jaxb-provider"/>
- <ref component-id="cors-filter"/>
- <ref component-id="jaas-filter"/>
- </jaxrs:providers>
-
- <jaxrs:serviceBeans>
- <ref component-id="scoringServiceEndPoint"/>
- </jaxrs:serviceBeans>
- </jaxrs:server>
-
- <jaxrs:server address="/definitions" id="restDefinitionsService">
- <jaxrs:providers>
- <ref component-id="jaxb-provider"/>
- <ref component-id="cors-filter"/>
- <ref component-id="jaas-filter"/>
- </jaxrs:providers>
-
- <jaxrs:serviceBeans>
- <ref component-id="definitionsServiceEndPoint"/>
- </jaxrs:serviceBeans>
- </jaxrs:server>
-
- <jaxrs:server address="/goals" id="restGoalsService">
- <jaxrs:providers>
- <ref component-id="jaxb-provider"/>
- <ref component-id="cors-filter"/>
- <ref component-id="jaas-filter"/>
- </jaxrs:providers>
-
- <jaxrs:serviceBeans>
- <ref component-id="goalsServiceEndPoint"/>
- </jaxrs:serviceBeans>
- </jaxrs:server>
-
- <jaxrs:server address="/campaigns" id="restCampaignsService">
- <jaxrs:providers>
- <ref component-id="jaxb-provider"/>
- <ref component-id="cors-filter"/>
- <ref component-id="jaas-filter"/>
- </jaxrs:providers>
-
- <jaxrs:serviceBeans>
- <ref component-id="campaignServiceEndPoint"/>
- </jaxrs:serviceBeans>
- </jaxrs:server>
-
- <jaxrs:server address="/rules" id="restRulesService">
- <jaxrs:providers>
- <ref component-id="jaxb-provider"/>
- <ref component-id="cors-filter"/>
- <ref component-id="jaas-filter"/>
- </jaxrs:providers>
-
- <jaxrs:serviceBeans>
- <ref component-id="rulesServiceEndPoint"/>
- </jaxrs:serviceBeans>
- </jaxrs:server>
-
- <jaxrs:server address="/profiles" id="restProfileService">
- <jaxrs:providers>
- <ref component-id="jaxb-provider"/>
- <ref component-id="cors-filter"/>
- <ref component-id="jaas-filter"/>
- </jaxrs:providers>
-
- <jaxrs:serviceBeans>
- <ref component-id="profileServiceEndPoint"/>
- </jaxrs:serviceBeans>
- </jaxrs:server>
-
- <jaxrs:server address="/cluster" id="restClusterService">
- <jaxrs:providers>
- <ref component-id="jaxb-provider"/>
- <ref component-id="cors-filter"/>
- <ref component-id="jaas-filter"/>
- </jaxrs:providers>
-
- <jaxrs:serviceBeans>
- <ref component-id="clusterServiceEndPoint"/>
- </jaxrs:serviceBeans>
- </jaxrs:server>
-
- <jaxrs:server address="/query" id="restQueryService">
- <jaxrs:providers>
- <ref component-id="jaxb-provider"/>
- <ref component-id="cors-filter"/>
- <ref component-id="jaas-filter"/>
- </jaxrs:providers>
-
- <jaxrs:serviceBeans>
- <ref component-id="queryServiceEndPoint"/>
- </jaxrs:serviceBeans>
- </jaxrs:server>
-
- <jaxrs:server address="/patches" id="restPatchService">
- <jaxrs:providers>
- <ref component-id="jaxb-provider"/>
- <ref component-id="cors-filter"/>
- <ref component-id="jaas-filter"/>
- </jaxrs:providers>
-
- <jaxrs:serviceBeans>
- <ref component-id="patchServiceEndPoint"/>
- </jaxrs:serviceBeans>
- </jaxrs:server>
-
- <jaxrs:server address="/events" id="restEventService">
- <jaxrs:providers>
- <ref component-id="jaxb-provider"/>
- <ref component-id="cors-filter"/>
- <ref component-id="jaas-filter"/>
- </jaxrs:providers>
-
- <jaxrs:serviceBeans>
- <ref component-id="eventServiceEndPoint"/>
- </jaxrs:serviceBeans>
- </jaxrs:server>
-
- <reference id="segmentService" interface="org.apache.unomi.api.services.SegmentService"/>
- <reference id="userListService" interface="org.apache.unomi.api.services.UserListService"/>
- <reference id="definitionsService" interface="org.apache.unomi.api.services.DefinitionsService"/>
- <reference id="goalsService" interface="org.apache.unomi.api.services.GoalsService"/>
- <reference id="rulesService" interface="org.apache.unomi.api.services.RulesService"/>
- <reference id="profileService" interface="org.apache.unomi.api.services.ProfileService"/>
- <reference id="clusterService" interface="org.apache.unomi.api.services.ClusterService"/>
- <reference id="queryService" interface="org.apache.unomi.api.services.QueryService"/>
- <reference id="eventService" interface="org.apache.unomi.api.services.EventService"/>
- <reference id="patchService" interface="org.apache.unomi.api.services.PatchService"/>
-
- <bean id="segmentServiceEndPoint" class="org.apache.unomi.rest.SegmentServiceEndPoint">
- <property name="segmentService" ref="segmentService"/>
- </bean>
-
- <bean id="userListServiceEndPoint" class="org.apache.unomi.rest.UserListServiceEndPoint">
- <property name="userListService" ref="userListService"/>
- </bean>
-
- <bean id="scoringServiceEndPoint" class="org.apache.unomi.rest.ScoringServiceEndPoint">
- <property name="segmentService" ref="segmentService"/>
- </bean>
-
- <bean id="definitionsServiceEndPoint" class="org.apache.unomi.rest.DefinitionsServiceEndPoint">
- <property name="definitionsService" ref="definitionsService"/>
- <property name="localizationHelper" ref="localizationHelper"/>
- </bean>
-
- <bean id="goalsServiceEndPoint" class="org.apache.unomi.rest.GoalsServiceEndPoint">
- <property name="goalsService" ref="goalsService"/>
- </bean>
-
- <bean id="campaignServiceEndPoint" class="org.apache.unomi.rest.CampaignsServiceEndPoint">
- <property name="goalsService" ref="goalsService"/>
- </bean>
-
- <bean id="rulesServiceEndPoint" class="org.apache.unomi.rest.RulesServiceEndPoint">
- <property name="rulesService" ref="rulesService"/>
- </bean>
-
- <bean id="profileServiceEndPoint" class="org.apache.unomi.rest.ProfileServiceEndPoint">
- <property name="profileService" ref="profileService"/>
- <property name="eventService" ref="eventService"/>
- <property name="segmentService" ref="segmentService"/>
- <property name="localizationHelper" ref="localizationHelper"/>
- </bean>
-
- <bean id="clusterServiceEndPoint" class="org.apache.unomi.rest.ClusterServiceEndPoint">
- <property name="clusterService" ref="clusterService"/>
- </bean>
-
- <bean id="queryServiceEndPoint" class="org.apache.unomi.rest.QueryServiceEndPoint">
- <property name="queryService" ref="queryService"/>
- <property name="localizationHelper" ref="localizationHelper"/>
- </bean>
-
- <bean id="patchServiceEndPoint" class="org.apache.unomi.rest.PatchServiceEndPoint">
- <property name="patchService" ref="patchService"/>
- </bean>
-
- <bean id="eventServiceEndPoint" class="org.apache.unomi.rest.EventServiceEndpoint">
- <property name="eventService" ref="eventService"/>
- </bean>
-
- <bean id="resourceBundleHelper" class="org.apache.unomi.rest.ResourceBundleHelper">
- <property name="bundleContext" ref="blueprintBundleContext"/>
- </bean>
-
- <bean id="localizationHelper" class="org.apache.unomi.rest.LocalizationHelper">
- <property name="bundleContext" ref="blueprintBundleContext"/>
- <property name="resourceBundleHelper" ref="resourceBundleHelper"/>
- </bean>
-
-</blueprint>
diff --git a/services/pom.xml b/services/pom.xml
index d4c15c0..2400db7 100644
--- a/services/pom.xml
+++ b/services/pom.xml
@@ -40,13 +40,13 @@
<dependency>
<groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
+ <artifactId>osgi.core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
+ <artifactId>osgi.cmpn</artifactId>
<scope>provided</scope>
</dependency>
diff --git a/services/src/main/resources/META-INF/cxs/events/updateProperties.json b/services/src/main/resources/META-INF/cxs/events/updateProperties.json
index cb763b7..f0f785c 100644
--- a/services/src/main/resources/META-INF/cxs/events/updateProperties.json
+++ b/services/src/main/resources/META-INF/cxs/events/updateProperties.json
@@ -1,5 +1,5 @@
{
- "type": "updatePropertiesEvent",
+ "type": "updateProperties",
"propertyTypes" : [
{
"itemId": "properties",
diff --git a/tools/shell-commands/pom.xml b/tools/shell-commands/pom.xml
index 1de122b..2f45755 100644
--- a/tools/shell-commands/pom.xml
+++ b/tools/shell-commands/pom.xml
@@ -57,13 +57,13 @@
<dependency>
<groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
+ <artifactId>osgi.core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
+ <artifactId>osgi.cmpn</artifactId>
<scope>provided</scope>
</dependency>
diff --git a/tools/shell-dev-commands/pom.xml b/tools/shell-dev-commands/pom.xml
index f12c744..a05e6f6 100644
--- a/tools/shell-dev-commands/pom.xml
+++ b/tools/shell-dev-commands/pom.xml
@@ -89,13 +89,13 @@
<dependency>
<groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
+ <artifactId>osgi.core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
+ <artifactId>osgi.cmpn</artifactId>
<scope>provided</scope>
</dependency>