Search in sources :

Example 1 with ServiceManagerLoggingRestService

use of com.peterphi.std.guice.common.logging.rest.iface.ServiceManagerLoggingRestService in project stdlib by petergeneric.

the class LogForwardDaemonPreGuice method start.

private void start() {
    final String instanceId = config.get(GuiceProperties.INSTANCE_ID);
    // TODO fix this!
    final String localEndpoint = config.get(GuiceProperties.LOCAL_REST_SERVICES_ENDPOINT, "http://unknown");
    final boolean useMoxy = config.getBoolean(GuiceProperties.MOXY_ENABLED, true);
    // Construct the necessary classes to create resteasy proxy clients.
    // We must do this independent of the guice creation path because we'll be running as Guice is starting up
    final JAXBContextResolver jaxb = new JAXBContextResolver(new JAXBSerialiserFactory(useMoxy));
    this.clientFactory = new ResteasyClientFactoryImpl(null, null, null, jaxb);
    ResteasyProxyClientFactoryImpl proxyFactory = new ResteasyProxyClientFactoryImpl(clientFactory, config);
    // Instantiate the services
    final ServiceManagerLoggingRestService logService = proxyFactory.getClient(ServiceManagerLoggingRestService.class);
    final ServiceManagerRegistryRestService registryService = proxyFactory.getClient(ServiceManagerRegistryRestService.class);
    this.daemon = new ServiceManagerLogForwardDaemon(instanceId, URI.create(localEndpoint), registryService, logService, this::guiceHasTakenOver);
    // Start the thread running
    this.daemon.startThread();
}
Also used : ServiceManagerLoggingRestService(com.peterphi.std.guice.common.logging.rest.iface.ServiceManagerLoggingRestService) ResteasyClientFactoryImpl(com.peterphi.std.guice.restclient.resteasy.impl.ResteasyClientFactoryImpl) ServiceManagerLogForwardDaemon(com.peterphi.std.guice.common.logging.appender.ServiceManagerLogForwardDaemon) JAXBSerialiserFactory(com.peterphi.std.util.jaxb.JAXBSerialiserFactory) ServiceManagerRegistryRestService(com.peterphi.std.guice.common.logging.rest.iface.ServiceManagerRegistryRestService) JAXBContextResolver(com.peterphi.std.guice.restclient.resteasy.impl.JAXBContextResolver) ResteasyProxyClientFactoryImpl(com.peterphi.std.guice.restclient.resteasy.impl.ResteasyProxyClientFactoryImpl)

Aggregations

ServiceManagerLogForwardDaemon (com.peterphi.std.guice.common.logging.appender.ServiceManagerLogForwardDaemon)1 ServiceManagerLoggingRestService (com.peterphi.std.guice.common.logging.rest.iface.ServiceManagerLoggingRestService)1 ServiceManagerRegistryRestService (com.peterphi.std.guice.common.logging.rest.iface.ServiceManagerRegistryRestService)1 JAXBContextResolver (com.peterphi.std.guice.restclient.resteasy.impl.JAXBContextResolver)1 ResteasyClientFactoryImpl (com.peterphi.std.guice.restclient.resteasy.impl.ResteasyClientFactoryImpl)1 ResteasyProxyClientFactoryImpl (com.peterphi.std.guice.restclient.resteasy.impl.ResteasyProxyClientFactoryImpl)1 JAXBSerialiserFactory (com.peterphi.std.util.jaxb.JAXBSerialiserFactory)1