summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/onap
diff options
context:
space:
mode:
authorxg353y <xg353y@intl.att.com>2018-05-18 17:59:06 +0200
committerxg353y <xg353y@intl.att.com>2018-05-22 14:46:36 +0200
commit2aad6d681dcbea5564425648375f7ddca2080940 (patch)
tree34a3c864b1369c961b0998a1f3e808713f62bb3c /src/main/java/org/onap
parentf172e9d4656c960e81f72cc6d6e52770271df9c9 (diff)
Generate API documents
Adding maven plugins to scan Clamp code automatically and generate swagger.json, html and pdf documents with the exposed Clamp API information. Issue-ID: CLAMP-169 Change-Id: Ia46cd2aa7000251b30c9eaaa040f1f8d9246af45 Signed-off-by: xg353y <xg353y@intl.att.com>
Diffstat (limited to 'src/main/java/org/onap')
-rw-r--r--src/main/java/org/onap/clamp/clds/service/JaxrsApplication.java39
1 files changed, 0 insertions, 39 deletions
diff --git a/src/main/java/org/onap/clamp/clds/service/JaxrsApplication.java b/src/main/java/org/onap/clamp/clds/service/JaxrsApplication.java
index 3f9db33a8..56fbca8da 100644
--- a/src/main/java/org/onap/clamp/clds/service/JaxrsApplication.java
+++ b/src/main/java/org/onap/clamp/clds/service/JaxrsApplication.java
@@ -23,51 +23,12 @@
package org.onap.clamp.clds.service;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Optional;
-import java.util.Set;
-import java.util.function.Function;
-import java.util.stream.Collectors;
-
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
-import org.springframework.beans.factory.config.BeanDefinition;
-import org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider;
-import org.springframework.core.type.filter.AnnotationTypeFilter;
import org.springframework.stereotype.Component;
-
@Component
@ApplicationPath("/restservices/clds/v1")
public class JaxrsApplication extends Application {
- private static final EELFLogger logger = EELFManager.getInstance().getLogger(JaxrsApplication.class);
- private Function<BeanDefinition, Optional<Class<?>>> beanDefinitionToClass = b -> {
- try {
- return Optional.of(Class.forName(b.getBeanClassName()));
- } catch (ClassNotFoundException e) {
- logger.error("Could not get class annotated with @Path for swagger documentation generation", e);
- return Optional.empty();
- }
- };
-
- @Override
- public Set<Class<?>> getClasses() {
- Set<Class<?>> resources = new HashSet<>();
- resources.add(JacksonObjectMapperProvider.class);
- resources.add(io.swagger.v3.jaxrs2.integration.resources.OpenApiResource.class);
- resources.addAll(scan());
- return resources;
- }
-
- private List<Class<?>> scan() {
- ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(false);
- scanner.addIncludeFilter(new AnnotationTypeFilter(javax.ws.rs.Path.class));
- return scanner.findCandidateComponents("org.onap.clamp.clds").stream().map(beanDefinitionToClass)
- .filter(Optional::isPresent).map(Optional::get).collect(Collectors.toList());
- }
} \ No newline at end of file