com.aol.micro.server.module.ConfigurableModule Maven / Gradle / Ivy
package com.aol.micro.server.module;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Consumer;
import java.util.function.Supplier;
import javax.servlet.Filter;
import javax.servlet.Servlet;
import javax.servlet.ServletContextListener;
import javax.servlet.ServletRequestListener;
import org.glassfish.grizzly.http.server.HttpServer;
import lombok.AllArgsConstructor;
import lombok.experimental.Builder;
import lombok.experimental.Wither;
import com.aol.micro.server.servers.model.ServerData;
import com.aol.micro.server.utility.HashMapBuilder;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
@Builder
@AllArgsConstructor
@Wither
public class ConfigurableModule implements Module{
private final List restResourceClasses;
private final List defaultResources;
private final List listeners;
private final List requestListeners;
private final Map filters;
private final Map servlets;
private final String jaxWsRsApplication;
private final String providers;
private final String context;
private final Set springConfigurationClasses;
private final Map propertyOverrides;
private final List defaultJaxRsPackages;
private final Consumer serverConfigManager;
private final boolean resetAll;
@Override
public Consumer getServerConfigManager(){
if(serverConfigManager!=null)
return serverConfigManager;
return Module.super.getServerConfigManager();
}
@Override
public List getDefaultJaxRsPackages() {
if(defaultJaxRsPackages!=null)
return ImmutableList.copyOf(Iterables.concat(defaultJaxRsPackages,extract(()->Module.super.getDefaultJaxRsPackages())));
return Module.super.getDefaultJaxRsPackages();
}
private Collection extract(Supplier> s) {
if(!resetAll)
return s.get();
return ImmutableList.of();
}
private Map extractMap(Supplier
© 2015 - 2025 Weber Informatics LLC | Privacy Policy