Search in sources :

Example 1 with ConnectedContainer

use of org.sonarsource.sonarlint.core.container.connected.ConnectedContainer in project sonarlint-core by SonarSource.

the class ConnectedSonarLintEngineImpl method updateModule.

@Override
public void updateModule(ServerConfiguration serverConfig, String moduleKey, @Nullable ProgressMonitor monitor) {
    checkNotNull(serverConfig);
    checkNotNull(moduleKey);
    setLogging(null);
    rwl.writeLock().lock();
    checkUpdateStatus();
    ConnectedContainer connectedContainer = new ConnectedContainer(globalConfig, serverConfig);
    try {
        changeState(State.UPDATING);
        connectedContainer.startComponents();
        connectedContainer.updateModule(moduleKey, new ProgressWrapper(monitor));
    } catch (RuntimeException e) {
        throw SonarLintWrappedException.wrap(e);
    } finally {
        try {
            connectedContainer.stopComponents(false);
        } catch (Exception e) {
        // Ignore
        }
        changeState(getHandler().getGlobalStorageStatus() != null ? State.UPDATED : State.NEVER_UPDATED);
        rwl.writeLock().unlock();
    }
}
Also used : ProgressWrapper(org.sonarsource.sonarlint.core.util.ProgressWrapper) ConnectedContainer(org.sonarsource.sonarlint.core.container.connected.ConnectedContainer) GlobalUpdateRequiredException(org.sonarsource.sonarlint.core.client.api.exceptions.GlobalUpdateRequiredException) StorageException(org.sonarsource.sonarlint.core.client.api.exceptions.StorageException) SonarLintWrappedException(org.sonarsource.sonarlint.core.client.api.exceptions.SonarLintWrappedException)

Aggregations

GlobalUpdateRequiredException (org.sonarsource.sonarlint.core.client.api.exceptions.GlobalUpdateRequiredException)1 SonarLintWrappedException (org.sonarsource.sonarlint.core.client.api.exceptions.SonarLintWrappedException)1 StorageException (org.sonarsource.sonarlint.core.client.api.exceptions.StorageException)1 ConnectedContainer (org.sonarsource.sonarlint.core.container.connected.ConnectedContainer)1 ProgressWrapper (org.sonarsource.sonarlint.core.util.ProgressWrapper)1