
org.glowroot.ui.UiModule Maven / Gradle / Ivy
/*
* Copyright 2011-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.glowroot.ui;
import java.io.File;
import java.util.List;
import javax.annotation.Nullable;
import org.glowroot.agent.shaded.google.common.base.Ticker;
import org.glowroot.agent.shaded.google.common.collect.Lists;
import org.immutables.builder.Builder;
import org.glowroot.common.config.PluginDescriptor;
import org.glowroot.common.live.LiveAggregateRepository;
import org.glowroot.common.live.LiveJvmService;
import org.glowroot.common.live.LiveTraceRepository;
import org.glowroot.common.live.LiveWeavingService;
import org.glowroot.common.util.Clock;
import org.glowroot.common.util.OnlyUsedByTests;
import org.glowroot.storage.repo.AggregateRepository;
import org.glowroot.storage.repo.ConfigRepository;
import org.glowroot.storage.repo.GaugeValueRepository;
import org.glowroot.storage.repo.RepoAdmin;
import org.glowroot.storage.repo.TraceRepository;
import org.glowroot.storage.repo.TransactionTypeRepository;
import org.glowroot.storage.util.MailService;
public class UiModule {
private final LazyHttpServer lazyHttpServer;
@Builder.Factory
public static UiModule createUiModule(
boolean central,
Ticker ticker,
Clock clock,
@Nullable File logDir,
@Nullable LiveJvmService liveJvmService,
ConfigRepository configRepository,
TransactionTypeRepository transactionTypeRepository,
TraceRepository traceRepository,
AggregateRepository aggregateRepository,
GaugeValueRepository gaugeValueRepository,
RepoAdmin repoAdmin,
LiveTraceRepository liveTraceRepository,
LiveAggregateRepository liveAggregateRepository,
@Nullable LiveWeavingService liveWeavingService,
boolean viewerMode,
String bindAddress,
String version,
List pluginDescriptors) throws Exception {
LayoutService layoutService = new LayoutService(central, version, configRepository,
transactionTypeRepository, liveAggregateRepository);
HttpSessionManager httpSessionManager =
new HttpSessionManager(configRepository, clock, layoutService);
IndexHtmlHttpService indexHtmlHttpService =
new IndexHtmlHttpService(httpSessionManager, layoutService);
LayoutHttpService layoutHttpService =
new LayoutHttpService(httpSessionManager, layoutService);
TransactionCommonService transactionCommonService = new TransactionCommonService(
aggregateRepository, liveAggregateRepository, configRepository);
TraceCommonService traceCommonService =
new TraceCommonService(traceRepository, liveTraceRepository);
TransactionJsonService transactionJsonService =
new TransactionJsonService(transactionCommonService, traceRepository,
liveTraceRepository, aggregateRepository, clock);
TracePointJsonService tracePointJsonService = new TracePointJsonService(traceRepository,
liveTraceRepository, configRepository, ticker, clock);
TraceJsonService traceJsonService = new TraceJsonService(traceCommonService);
TraceDetailHttpService traceDetailHttpService =
new TraceDetailHttpService(traceCommonService);
TraceExportHttpService traceExportHttpService =
new TraceExportHttpService(traceCommonService, version);
GlowrootLogHttpService glowrootLogHttpService;
if (logDir == null) {
glowrootLogHttpService = null;
} else {
glowrootLogHttpService = new GlowrootLogHttpService(logDir);
}
ErrorCommonService errorCommonService = new ErrorCommonService(aggregateRepository,
liveAggregateRepository, configRepository.getRollupConfigs());
ErrorJsonService errorJsonService = new ErrorJsonService(errorCommonService,
traceRepository, aggregateRepository, clock);
ConfigJsonService configJsonService = new ConfigJsonService(configRepository, repoAdmin,
pluginDescriptors, httpSessionManager, new MailService(), liveWeavingService);
GaugeValueJsonService gaugeValueJsonService =
new GaugeValueJsonService(gaugeValueRepository, configRepository, clock);
AlertConfigJsonService alertJsonService = new AlertConfigJsonService(configRepository);
AdminJsonService adminJsonService = new AdminJsonService(aggregateRepository,
traceRepository, gaugeValueRepository, liveAggregateRepository,
liveWeavingService, repoAdmin);
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy