Search in sources :

Example 1 with OpenApiConfiguration

use of fish.payara.microprofile.openapi.impl.config.OpenApiConfiguration in project Payara by payara.

the class OpenAPISupplier method filterLibTypes.

private Set<Type> filterLibTypes(OpenApiConfiguration config, Types hk2Types, ReadableArchive archive) {
    Set<Type> types = new HashSet<>();
    if (config != null && config.getScanLib()) {
        Enumeration<String> subArchiveItr = archive.entries();
        while (subArchiveItr.hasMoreElements()) {
            String subArchiveName = subArchiveItr.nextElement();
            if (subArchiveName.startsWith("WEB-INF/lib/") && subArchiveName.endsWith(".jar")) {
                try {
                    ReadableArchive subArchive = archive.getSubArchive(subArchiveName);
                    types.addAll(Collections.list(subArchive.entries()).stream().filter(clazz -> clazz.endsWith(".class")).map(clazz -> clazz.replace("/", ".").replace(".class", "")).map(clazz -> hk2Types.getBy(clazz)).filter(Objects::nonNull).collect(toSet()));
                } catch (IOException ex) {
                    throw new IllegalStateException(ex);
                }
            }
        }
    }
    return types;
}
Also used : StructuredDeploymentTracing(org.glassfish.internal.deployment.analysis.StructuredDeploymentTracing) OpenApiConfiguration(fish.payara.microprofile.openapi.impl.config.OpenApiConfiguration) ConfigPropertyProcessor(fish.payara.microprofile.openapi.impl.processor.ConfigPropertyProcessor) Enumeration(java.util.Enumeration) Globals(org.glassfish.internal.api.Globals) URL(java.net.URL) ApplicationProcessor(fish.payara.microprofile.openapi.impl.processor.ApplicationProcessor) Supplier(java.util.function.Supplier) ArrayList(java.util.ArrayList) InetAddress(java.net.InetAddress) HashSet(java.util.HashSet) ReadableArchive(org.glassfish.api.deployment.archive.ReadableArchive) ServerEnvironment(org.glassfish.api.admin.ServerEnvironment) FileProcessor(fish.payara.microprofile.openapi.impl.processor.FileProcessor) NetworkListener(org.glassfish.grizzly.config.dom.NetworkListener) Collectors.toSet(java.util.stream.Collectors.toSet) Types(org.glassfish.hk2.classmodel.reflect.Types) MalformedURLException(java.net.MalformedURLException) ApplicationLifecycle(com.sun.enterprise.v3.server.ApplicationLifecycle) Set(java.util.Set) IOException(java.io.IOException) OpenAPIImpl(fish.payara.microprofile.openapi.impl.model.OpenAPIImpl) Logger(java.util.logging.Logger) UnknownHostException(java.net.UnknownHostException) Parser(org.glassfish.hk2.classmodel.reflect.Parser) Objects(java.util.Objects) OpenAPI(org.eclipse.microprofile.openapi.models.OpenAPI) ServerContext(org.glassfish.internal.api.ServerContext) List(java.util.List) FilterProcessor(fish.payara.microprofile.openapi.impl.processor.FilterProcessor) GrizzlyService(com.sun.enterprise.v3.services.impl.GrizzlyService) MultiException(org.glassfish.hk2.api.MultiException) BaseProcessor(fish.payara.microprofile.openapi.impl.processor.BaseProcessor) ModelReaderProcessor(fish.payara.microprofile.openapi.impl.processor.ModelReaderProcessor) Collections(java.util.Collections) Type(org.glassfish.hk2.classmodel.reflect.Type) Type(org.glassfish.hk2.classmodel.reflect.Type) Objects(java.util.Objects) IOException(java.io.IOException) ReadableArchive(org.glassfish.api.deployment.archive.ReadableArchive) HashSet(java.util.HashSet)

Aggregations

ApplicationLifecycle (com.sun.enterprise.v3.server.ApplicationLifecycle)1 GrizzlyService (com.sun.enterprise.v3.services.impl.GrizzlyService)1 OpenApiConfiguration (fish.payara.microprofile.openapi.impl.config.OpenApiConfiguration)1 OpenAPIImpl (fish.payara.microprofile.openapi.impl.model.OpenAPIImpl)1 ApplicationProcessor (fish.payara.microprofile.openapi.impl.processor.ApplicationProcessor)1 BaseProcessor (fish.payara.microprofile.openapi.impl.processor.BaseProcessor)1 ConfigPropertyProcessor (fish.payara.microprofile.openapi.impl.processor.ConfigPropertyProcessor)1 FileProcessor (fish.payara.microprofile.openapi.impl.processor.FileProcessor)1 FilterProcessor (fish.payara.microprofile.openapi.impl.processor.FilterProcessor)1 ModelReaderProcessor (fish.payara.microprofile.openapi.impl.processor.ModelReaderProcessor)1 IOException (java.io.IOException)1 InetAddress (java.net.InetAddress)1 MalformedURLException (java.net.MalformedURLException)1 URL (java.net.URL)1 UnknownHostException (java.net.UnknownHostException)1 ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1 Enumeration (java.util.Enumeration)1 HashSet (java.util.HashSet)1 List (java.util.List)1