@Override public String getUpdateDate() { if (!isStorageUpdated()) { return NEED_UPDATE; } return new SimpleDateFormat().format(updateStatus.getLastUpdateDate()); }
@Override public String getServerVersion() { if (!isStorageUpdated()) { return NEED_UPDATE; } return updateStatus.getServerVersion(); }
public void start() { setLogging(null); rwl.writeLock().lock(); storageContainer = StorageContainer.create(globalConfig); try { storageContainer.startComponents(); if (getHandler().getGlobalStorageStatus() == null) { changeState(State.NEVER_UPDATED); } else if (getHandler().getGlobalStorageStatus().isStale()) { changeState(State.NEED_UPDATE); } else { changeState(State.UPDATED); } } catch (StorageException e) { LOG.debug(e.getMessage(), e); changeState(State.NEED_UPDATE); } catch (RuntimeException e) { LOG.error("Unable to start the SonarLint engine", e); changeState(State.UNKNOW); } finally { rwl.writeLock().unlock(); } }
@Override public void start(boolean forceUpdate) { GlobalStorageStatus globalStorageStatus = engine.getGlobalStorageStatus(); if (forceUpdate) { LOGGER.info("Updating binding.."); update(); } else if (globalStorageStatus == null) { LOGGER.info("No binding storage found. Updating.."); update(); } else if (globalStorageStatus.isStale()) { LOGGER.info("Binding storage is stale. Updating.."); update(); } else { checkModuleStatus(); } }
private void setStatus(ConnectedSonarLintEngine.State state) { ConnectedSonarLintEngine.State currentState = engine.getState(); StringBuilder builder = new StringBuilder(); switch (currentState) { case NEVER_UPDATED: builder.append("never updated"); break; case UPDATED: GlobalStorageStatus storageStatus = engine.getGlobalStorageStatus(); if (storageStatus != null) { builder.append(DateUtils.toAge(storageStatus.getLastUpdateDate().getTime())); } else { builder.append("up to date"); } break; case UPDATING: builder.append("updating.."); break; case NEED_UPDATE: builder.append("needs update"); break; case UNKNOW: default: builder.append("unknown"); break; } serverStatus.setText(builder.toString()); updateServerButton.setEnabled(state != ConnectedSonarLintEngine.State.UPDATING); }
@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(); }