Package org.sonatype.nexus

Examples of org.sonatype.nexus.SystemStatus


  {
    return containsItem(0, repository, request);
  }

  public String getVersion() {
    final SystemStatus status = systemStatusProvider.get();

    return status.getVersion();
  }
View Full Code Here


    return buff;
  }

  private synchronized String getUserAgentPlatformInfo() {
    SystemStatus status = systemStatusProvider.get();

    // Cache platform details or re-cache if the edition has changed
    if (userAgentPlatformInfo == null || !status.getEditionShort().equals(platformEditionShort)) {
      // track edition for cache invalidation
      platformEditionShort = status.getEditionShort();

      userAgentPlatformInfo =
          String.format("Nexus/%s (%s; %s; %s; %s; %s)",
              status.getVersion(),
              platformEditionShort,
              System.getProperty("os.name"),
              System.getProperty("os.version"),
              System.getProperty("os.arch"),
              System.getProperty("java.version"));
View Full Code Here

    return values;
  }

  private StatusXO getStatus() {
    SystemStatus systemStatus = systemStatusProvider.get();
    StatusXO status = new StatusXO();
    status.setEdition(systemStatus.getEditionShort());
    status.setVersion(systemStatus.getVersion());
    return status;
  }
View Full Code Here

    return shouldSend;
  }

  public LicenseXO getLicense() {
    LicenseXO licenseXO = new LicenseXO();
    SystemStatus status = systemStatusProvider.get();

    licenseXO.setRequired(!"OSS".equals(status.getEditionShort()));
    licenseXO.setInstalled(status.isLicenseInstalled());

    return licenseXO;
  }
View Full Code Here

  @Override
  @GET
  public StatusResourceResponse get(Context context, Request request, Response response, Variant variant)
      throws ResourceException
  {
    final SystemStatus status = systemStatusProvider.get();

    final StatusResource resource = new StatusResource();

    resource.setAppName(status.getAppName());

    resource.setFormattedAppName(status.getFormattedAppName());

    resource.setVersion(status.getVersion());

    resource.setApiVersion(status.getApiVersion());

    resource.setEditionLong(status.getEditionLong());

    resource.setEditionShort(status.getEditionShort());

    resource.setAttributionsURL(status.getAttributionsURL());

    resource.setPurchaseURL(status.getPurchaseURL());

    resource.setUserLicenseURL(status.getUserLicenseURL());

    resource.setState(status.getState().toString());

    resource.setInitializedAt(status.getInitializedAt());

    resource.setStartedAt(status.getStartedAt());

    resource.setLastConfigChange(status.getLastConfigChange());

    resource.setFirstStart(status.isFirstStart());

    resource.setInstanceUpgraded(status.isInstanceUpgraded());

    resource.setConfigurationUpgraded(status.isConfigurationUpgraded());

    resource.setErrorCause(spit(status.getErrorCause()));

    // if ( status.getConfigurationValidationResponse() != null )
    // {
    // resource.setConfigurationValidationResponse( new StatusConfigurationValidationResponse() );
    //
    // resource.getConfigurationValidationResponse().setValid(
    // status.getConfigurationValidationResponse().isValid() );
    //
    // resource.getConfigurationValidationResponse().setModified(
    // status.getConfigurationValidationResponse().isModified() );
    //
    // for ( ValidationMessage msg : status.getConfigurationValidationResponse().getValidationErrors() )
    // {
    // resource.getConfigurationValidationResponse().addValidationError( msg.toString() );
    // }
    // for ( ValidationMessage msg : status.getConfigurationValidationResponse().getValidationWarnings() )
    // {
    // resource.getConfigurationValidationResponse().addValidationWarning( msg.toString() );
    // }
    // }

    final Form form = request.getResourceRef().getQueryAsForm();
    if (form.getFirst("perms") != null) {
      resource.setClientPermissions(getClientPermissions(request));
    }

    resource.setBaseUrl(BaseUrlHolder.get());

    resource.setLicenseInstalled(status.isLicenseInstalled());

    resource.setLicenseExpired(status.isLicenseExpired());

    resource.setTrialLicense(status.isTrialLicense());

    StatusResourceResponse result = new StatusResourceResponse();

    result.setData(resource);
View Full Code Here

  }

  public Representation getRepresentation(final Status status, final Request request, final Response response) {
    final HashMap<String, Object> dataModel = new HashMap<String, Object>();

    final SystemStatus systemStatus = systemStatusProvider.get();
    dataModel.put("request", request);
    dataModel.put("nexusVersion", systemStatus.getVersion());
    dataModel.put("nexusRoot", BaseUrlHolder.get());

    dataModel.put("statusCode", status.getCode());
    dataModel.put("statusName", status.getName());
    dataModel.put("errorDescription", StringEscapeUtils.escapeHtml(status.getDescription()));
View Full Code Here

  private String userAgent;

  private String platformEditionShort;
 
  private synchronized String getUserAgent() {
    SystemStatus status = systemStatusProvider.get();

    // Cache platform details or re-cache if the edition has changed
    if (userAgent == null || !status.getEditionShort().equals(platformEditionShort)) {
      // track edition for cache invalidation
      platformEditionShort = status.getEditionShort();

      userAgent =
          String.format("Nexus/%s (%s; %s; %s; %s; %s)",
              status.getVersion(),
              platformEditionShort,
              System.getProperty("os.name"),
              System.getProperty("os.version"),
              System.getProperty("os.arch"),
              System.getProperty("java.version"));
View Full Code Here

   * The lazily calculated invariant part of the UserAgentString.
   */
  private String userAgentPlatformInfo;

  protected String getSenderId() {
    SystemStatus status = systemStatusProvider.get();

    if (platformEditionShort == null || !platformEditionShort.equals(status.getEditionShort())
        || userAgentPlatformInfo == null) {
      // make it "remember" to be able to detect license changes later
      platformEditionShort = status.getEditionShort();

      userAgentPlatformInfo =
          new StringBuilder("Nexus/").append(status.getVersion()).append(" (")
              .append(status.getEditionShort()).append("; ").append(System.getProperty("os.name"))
              .append("; ").append(System.getProperty("os.version")).append("; ")
              .append(System.getProperty("os.arch")).append("; ")
              .append(System.getProperty("java.version")).append(") ").toString();
    }

View Full Code Here

    this.upgrader = checkNotNull(upgrader);
  }

  @Subscribe
  public void inspect(final NexusStartedEvent startedEvent) {
    final SystemStatus systemStatus = systemStatusProvider.get();

    if (systemStatus.isConfigurationUpgraded() || systemStatus.isInstanceUpgraded()) {
      try {
        // re/load the config from file
        realmConfigSource.loadConfiguration();

        // if Nexus was upgraded and the security version is 2.0.2 we need to update the model
View Full Code Here

{
  private WebUtils underTest;

  @Before
  public void setUp() throws Exception {
    SystemStatus systemStatus = mock(SystemStatus.class);
    doReturn("version").when(systemStatus).getVersion();

    Provider<SystemStatus> systemStatusProvider = (Provider<SystemStatus>)mock(Provider.class);
    doReturn(systemStatus).when(systemStatusProvider).get();
View Full Code Here

TOP

Related Classes of org.sonatype.nexus.SystemStatus

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.