public ConnectedGlobalConfiguration build() { return new ConnectedGlobalConfiguration(this); } }
public PluginCacheLoader(PluginVersionChecker pluginVersionChecker, PluginCache fileCache, PluginIndex pluginIndex, ConnectedGlobalConfiguration globalConfiguration) { this.pluginVersionChecker = pluginVersionChecker; this.fileCache = fileCache; this.pluginIndex = pluginIndex; this.excludedPlugins = globalConfiguration.getExcludedCodeAnalyzers(); }
public StoragePaths(ConnectedGlobalConfiguration configuration) { serverStorageRoot = configuration.getStorageRoot().resolve(encodeForFs(configuration.getServerId())); globalStorageRoot = serverStorageRoot.resolve("global"); projectStorageRoot = serverStorageRoot.resolve("projects"); }
public String validate(String serverId, boolean editExisting) { if (StringUtils.isBlank(serverId)) { return "Connection name must be specified"; } if (!editExisting && serversById.containsKey(serverId)) { return "Connection name already exists"; } try { // Validate server ID format ConnectedGlobalConfiguration.builder() .setServerId(serverId) .build(); } catch (Exception e) { return e.getMessage(); } return null; }
private StorageContainerHandler getHandler() { if (storageContainer == null) { throw new IllegalStateException("SonarLint Engine for server '" + globalConfig.getServerId() + "' is stopped."); } return storageContainer.getHandler(); }
private ConnectedGlobalConfiguration(Builder builder) { super(builder); this.serverId = builder.serverId; this.excludedCodeAnalyzers = builder.excludedCodeAnalyzers; this.storageRoot = builder.storageRoot != null ? builder.storageRoot : getSonarLintUserHome().resolve(DEFAULT_STORAGE_DIR); }
public ConnectedSonarLintEngineImpl(ConnectedGlobalConfiguration globalConfig) { this.globalConfig = globalConfig; this.logOutput = globalConfig.getLogOutput(); start(); }
private static SonarLint createConnected(SonarQubeServer server, String projectKey, boolean verbose) { LOGGER.info(String.format("Connected mode (%s)", projectKey)); ConnectedGlobalConfiguration config = ConnectedGlobalConfiguration.builder() .setLogOutput(new DefaultLogOutput(LOGGER, verbose)) .setServerId(server.id()) .build(); ConnectedSonarLintEngineImpl engine = new ConnectedSonarLintEngineImpl(config); return new ConnectedSonarLint(engine, server, projectKey); }
private void checkUpdateStatus() { if (state != State.UPDATED) { throw new GlobalStorageUpdateRequiredException(globalConfig.getServerId()); } }
private ConnectedGlobalConfiguration(Builder builder) { super(builder); this.serverId = builder.serverId; this.excludedCodeAnalyzers = builder.excludedCodeAnalyzers; this.storageRoot = builder.storageRoot != null ? builder.storageRoot : getSonarLintUserHome().resolve(DEFAULT_STORAGE_DIR); }
@Override public void start(ConnectedConfiguration requestConfig, StreamObserver<Void> response) { if (engine != null) { engine.stop(false); engine = null; } try { Builder builder = ConnectedGlobalConfiguration.builder(); if (requestConfig.getHomePath() != null) { builder.setSonarLintUserHome(Paths.get(requestConfig.getHomePath())); } builder.setLogOutput(logOutput) .setServerId(requestConfig.getStorageId()); engine = new ConnectedSonarLintEngineImpl(builder.build()); response.onNext(Void.newBuilder().build()); response.onCompleted(); } catch (Exception e) { LOGGER.error("Error registering", e); response.onError(e); } }
@Override protected void doAfterStart() { ConnectedGlobalConfiguration config = getComponentByType(ConnectedGlobalConfiguration.class); GlobalStorageStatus updateStatus = getComponentByType(StorageContainerHandler.class).getGlobalStorageStatus(); if (updateStatus != null) { LOG.info("Using storage for server '{}' (last update {})", config.getServerId(), DATE_FORMAT.format(updateStatus.getLastUpdateDate())); installPlugins(); } else { LOG.warn("No storage for server '{}'. Please update.", config.getServerId()); } this.globalExtensionContainer = new GlobalExtensionContainer(this); globalExtensionContainer.startComponents(); }
public PluginListDownloader(ConnectedGlobalConfiguration globalConfiguration, SonarLintWsClient wsClient, PluginVersionChecker pluginVersionChecker) { this.wsClient = wsClient; this.pluginVersionChecker = pluginVersionChecker; this.excludedPlugins = globalConfiguration.getExcludedCodeAnalyzers(); }
public ConnectedGlobalConfiguration build() { return new ConnectedGlobalConfiguration(this); } }
ConnectedSonarLintEngine createEngine(String serverId) { ConnectedGlobalConfiguration config = ConnectedGlobalConfiguration.builder() .setLogOutput(globalLogOutput) .setSonarLintUserHome(getSonarLintHome()) .addExcludedCodeAnalyzers(UNSUPPORTED_ANALYZERS) .setWorkDir(getWorkDir()) .setServerId(serverId) .build(); // it will also start it return new ConnectedSonarLintEngineImpl(config); }
public void updateProject(String projectKey, ProgressWrapper progress) { GlobalStorageStatus updateStatus = getComponentByType(StorageReader.class).getGlobalStorageStatus(); if (updateStatus == null) { throw new GlobalStorageUpdateRequiredException(globalConfig.getServerId()); } getComponentByType(ProjectStorageUpdateExecutor.class).update(projectKey, progress); }
Server(String id) { this.id = id; ConnectedGlobalConfiguration globalConfig = ConnectedGlobalConfiguration.builder() .setServerId(getId()) .setWorkDir(StoragePathManager.getServerWorkDir(getId())) .setStorageRoot(StoragePathManager.getServerStorageRoot()) .setLogOutput(new SonarLintAnalyzerLogOutput()) .build(); this.client = new ConnectedSonarLintEngineImpl(globalConfig); this.client.addStateListener(this); this.updateStatus = client.getGlobalStorageStatus(); if (client.getState().equals(State.UPDATED)) { reloadProjects(); } }