<commit_before>package de.factoryfx.docu.monitoring;

import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.jetty9.InstrumentedHandler;
import de.factoryfx.factory.FactoryBase;
import de.factoryfx.factory.atrribute.FactoryReferenceAttribute;
import de.factoryfx.factory.atrribute.FactoryReferenceListAttribute;
import de.factoryfx.server.rest.server.HttpServerConnectorCreator;
import de.factoryfx.server.rest.server.HttpServerConnectorFactory;
import de.factoryfx.server.rest.server.JettyServer;
import de.factoryfx.server.rest.server.JettyServerFactory;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.function.Consumer;

/*
    connect ServerVisitor with InstrumentedJettyServer
 */
public class InstrumentedJettyServerFactory extends FactoryBase<InstrumentedJettyServer,ServerVisitor> {
    public final FactoryReferenceAttribute<SimpleResource,SimpleResourceFactory> factoryReferenceAttribute = new FactoryReferenceAttribute<>();
    public final FactoryReferenceListAttribute<HttpServerConnectorCreator,HttpServerConnectorFactory<ServerVisitor>> connectors = new FactoryReferenceListAttribute<HttpServerConnectorCreator,HttpServerConnectorFactory<ServerVisitor>>().setupUnsafe(HttpServerConnectorFactory.class).labelText("connectors").userNotSelectable();

    public InstrumentedJettyServerFactory(){
        super();
        configLiveCycle().setCreator(() -> {
            MetricRegistry metricRegistry=new MetricRegistry();
            JettyServer jettyServer = new JettyServer(
                    connectors.instances(),
                    getResourcesInstances(),
                    Collections.singletonList(new InstrumentedHandler(metricRegistry, "monitoring example"))
            );
            return new InstrumentedJettyServer(jettyServer, metricRegistry);


        });
        configLiveCycle().setReCreator(currentLiveObject->currentLiveObject.recreate(connectors.instances(),getResourcesInstances()));<commit_msg>compilefix<commit_after>package de.factoryfx.docu.monitoring;

import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.jetty9.InstrumentedHandler;
import de.factoryfx.data.jackson.ObjectMapperBuilder;
import de.factoryfx.factory.FactoryBase;
import de.factoryfx.factory.atrribute.FactoryReferenceAttribute;
import de.factoryfx.factory.atrribute.FactoryReferenceListAttribute;
import de.factoryfx.server.rest.server.HttpServerConnectorCreator;
import de.factoryfx.server.rest.server.HttpServerConnectorFactory;
import de.factoryfx.server.rest.server.JettyServer;
import de.factoryfx.server.rest.server.JettyServerFactory;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.function.Consumer;

/*
    connect ServerVisitor with InstrumentedJettyServer
 */
public class InstrumentedJettyServerFactory extends FactoryBase<InstrumentedJettyServer,ServerVisitor> {
    public final FactoryReferenceAttribute<SimpleResource,SimpleResourceFactory> factoryReferenceAttribute = new FactoryReferenceAttribute<>();
    public final FactoryReferenceListAttribute<HttpServerConnectorCreator,HttpServerConnectorFactory<ServerVisitor>> connectors = new FactoryReferenceListAttribute<HttpServerConnectorCreator,HttpServerConnectorFactory<ServerVisitor>>().setupUnsafe(HttpServerConnectorFactory.class).labelText("connectors").userNotSelectable();

    public InstrumentedJettyServerFactory(){
        super();
        configLiveCycle().setCreator(() -> {
            MetricRegistry metricRegistry=new MetricRegistry();
            JettyServer jettyServer = new JettyServer(
                    connectors.instances(),
                    getResourcesInstances(),
                    Collections.singletonList(new InstrumentedHandler(metricRegistry, "monitoring example")),
                    ObjectMapperBuilder.buildNewObjectMapper()
            );
            return new InstrumentedJettyServer(jettyServer, metricRegistry);


        });
        configLiveCycle().setReCreator(currentLiveObject->currentLiveObject.recreate(connectors.instances(),getResourcesInstances()));
{'fraction_non_alphanumeric': 0.08557575757575757, 'fraction_numerical': 0.00048484848484848484, 'mean_word_length': 5.416796267496112, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5566950', 'n_tokens_mistral': 1037, 'n_tokens_neox': 1014, 'n_words': 144}