You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by GitBox <gi...@apache.org> on 2020/06/26 13:14:56 UTC

[GitHub] [unomi] sergehuber opened a new pull request #171: UNOMI-356 Refactor REST API

sergehuber opened a new pull request #171:
URL: https://github.com/apache/unomi/pull/171


   - 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.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [unomi] sergehuber merged pull request #171: UNOMI-356 Refactor REST API

Posted by GitBox <gi...@apache.org>.
sergehuber merged pull request #171:
URL: https://github.com/apache/unomi/pull/171


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [unomi] Taybou commented on a change in pull request #171: UNOMI-356 Refactor REST API

Posted by GitBox <gi...@apache.org>.
Taybou commented on a change in pull request #171:
URL: https://github.com/apache/unomi/pull/171#discussion_r446188556



##########
File path: 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;

Review comment:
       ```suggestion
       private ServiceTracker jaxRSServiceTracker;
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org