public Config() { classes = HashSet.empty(); properties = HashMap.empty(); dataSources = HashMap.empty(); defaultDataSourceName = "db"; propertiesName = "application.properties"; instancePropertiesName = "instance.properties"; serviceTypePropertiesName = "service-type.properties"; allowCircularReferences = false; basePackages = new String[0]; }
public ServerData(int port, PersistentList resources, ApplicationContext rootContext, String baseUrlPattern, Module module) { this.port = port; this.module = module; this.resources = resources==null ? Seq.of() :resources; this.rootContext = rootContext; this.baseUrlPattern = baseUrlPattern; } public ServerData(int port, List resources,
public MicroserverEnvironment(Properties propertyFactory) { modulePort = HashMap.empty(); this.properties = propertyFactory; }
public MicroserverEnvironment(Properties propertyFactory, Collection<ModuleBean> modules) { modulePort = HashMap.fromStream(modules.stream().map(m-> tuple(m.getModule().getContext(),m))); this.properties = propertyFactory; }
public BankersQueue<T> tail() { if(size()==1) return empty(); if(sizeFront==0){ return BankersQueue.ofAll(back.fold(s->s.fold((h, t)->t), n->n)); } if(sizeFront==1){ return ofAll(back); } return new BankersQueue.Cons<>(sizeFront-1,front.fold(s->s.fold((h, t)->t), n->n),sizeBack,back); } public BankersQueue<T> replace(T currentElement, T newElement) {
public void assureModule(Module module) { if (!modulePort.containsKey(module.getContext())) { HashMap<String, ModuleBean> builder = HashMap.empty(); builder = builder.putAll(modulePort); builder = builder.put(module.getContext(), ModuleBean.builder().host(getHost(module)).port(getPort(module)).build()); modulePort = builder; } }
public Application(final List<RegisterEntry> entries) { this.entries = Seq.fromIterable(entries); }
@Override public NonEmptyList<T> replaceFirst(T currentElement, T newElement){ return ImmutableList.Some.super.replaceFirst(currentElement,newElement) .fold(cons->cons(cons.head(),cons.tail()),nil->this); }
public Config buildConfig(Class class1) { Microserver microserver = (Microserver) class1.getAnnotation(Microserver.class); if (microserver == null){ microserver = Microserver.Instance.class.getAnnotation(Microserver.class); } String[] basePackages=microserver.basePackages(); if(basePackages.length==0){ String[] basePackagesFromClass ={class1.getPackage().getName()}; basePackages = basePackagesFromClass; } List<Class> classes = buildClasses(class1, microserver); Map<String, String> properties = buildProperties(microserver); return Config.instance().withBasePackages(basePackages).withEntityScan(microserver.entityScan()).withClasses(cyclops.data.HashSet.fromIterable(classes)) .withPropertiesName(microserver.propertiesName()).withInstancePropertiesName(microserver.instancePropertiesName()) .withServiceTypePropertiesName(microserver.serviceTypePropertiesName()) .withAllowCircularReferences(microserver.allowCircularDependencies()).withProperties(HashMap.fromMap(properties)).set(); }
resourceAnnotationClasses = SetX.of(Rest.class); servlets = new HashMap<>(); springConfigurationClasses = HashSet.of(this.getClass()); .restResourceClasses(resourceClasses) .servlets(servlets) .springConfigurationClasses(springConfigurationClasses.toSet()) .serverProperties(serverProperties) .build();
@Test public void testGetSpringConfigurationClassesReset() { assertThat(module.withResetAll(true).getSpringConfigurationClasses().size(),is(this.springConfigurationClasses.size())); } @Test
@Test public void testWithSpringConfigurationClasses() { assertThat(unchanged.withSpringConfigurationClasses(this.springConfigurationClasses.toSet()).getSpringConfigurationClasses(),is(module.getSpringConfigurationClasses())); }
public ServerRunner(ApplicationRegister register, List<ServerApplication> apps, CompletableFuture end) { this.apps = Seq.fromIterable(apps); this.register = Optional.of(register); this.end = end; } public ServerRunner(List<ServerApplication> apps, CompletableFuture end) {
public ServerRunner(List<ServerApplication> apps, CompletableFuture end) { this.apps = Seq.fromIterable(apps); this.register = Optional.empty(); this.end = end; }
public AllData(ServerData serverData, List<FilterData> filterDataList, List<ServletData> servletDataList, List<ServletContextListener> servletContextListeners, List<ServletRequestListener> servletRequestListeners ) { this.servletContextListeners = Seq.fromIterable(UsefulStaticMethods.either(servletContextListeners, new ArrayList<ServletContextListener>())); this.servletRequestListeners = Seq.fromIterable(UsefulStaticMethods.either(servletRequestListeners, new ArrayList<ServletRequestListener>())); this.filterDataList = Seq.fromIterable(UsefulStaticMethods.either(filterDataList, new ArrayList<FilterData>())); this.servletDataList = Seq.fromIterable(UsefulStaticMethods.either(servletDataList, new ArrayList<ServletData>())); this.serverData = serverData; } public AllData(ServerData serverData, PersistentList<FilterData> filterDataList,
public AllData(ServerData serverData, PersistentList<FilterData> filterDataList, PersistentList<ServletData> servletDataList, PersistentList<ServletContextListener> servletContextListeners, PersistentList<ServletRequestListener> servletRequestListeners ) { this.servletContextListeners = Seq.fromIterable(UsefulStaticMethods.either(servletContextListeners, new ArrayList<ServletContextListener>())); this.servletRequestListeners = Seq.fromIterable(UsefulStaticMethods.either(servletRequestListeners, new ArrayList<ServletRequestListener>())); this.filterDataList = Seq.fromIterable(UsefulStaticMethods.either(filterDataList, new ArrayList<FilterData>())); this.servletDataList = Seq.fromIterable(UsefulStaticMethods.either(servletDataList, new ArrayList<ServletData>())); this.serverData = serverData; }