Package org.sonatype.nexus.proxy.events

Examples of org.sonatype.nexus.proxy.events.RepositoryConfigurationUpdatedEvent


    return super.rollbackChanges();
  }

  protected RepositoryConfigurationUpdatedEvent getRepositoryConfigurationUpdatedEvent() {
    RepositoryConfigurationUpdatedEvent event = new RepositoryConfigurationUpdatedEvent(this);

    event.setLocalUrlChanged(this.localUrlChanged);
    event.setMadeSearchable(this.madeSearchable);
    event.setLocalStatusChanged(localStatusChanged);

    return event;
  }
View Full Code Here


    return super.rollbackChanges();
  }

  @Override
  protected RepositoryConfigurationUpdatedEvent getRepositoryConfigurationUpdatedEvent() {
    RepositoryConfigurationUpdatedEvent event = super.getRepositoryConfigurationUpdatedEvent();

    event.setRemoteUrlChanged(this.remoteUrlChanged);

    return event;
  }
View Full Code Here

          // Create the initial index for the repository
          reindexRepo(repository, false, "Creating initial index, repositoryId=" + repository.getId());
        }
      }
      else if (evt instanceof RepositoryConfigurationUpdatedEvent) {
        RepositoryConfigurationUpdatedEvent event = (RepositoryConfigurationUpdatedEvent) evt;

        // we need to do a full reindex of a Maven2 Proxy repository if:
        // a) if remoteUrl changed
        // b) if download remote index enabled (any repo type)
        // c) if repository is made searchable
        // TODO: are we sure only a) needs a check for Maven2? I think all of them need
        if (event.isRemoteUrlChanged() || event.isDownloadRemoteIndexEnabled() || event.isMadeSearchable()) {
          String taskName = null;

          String logMessage = null;

          if (event.isRemoteUrlChanged()) {
            taskName = append(taskName, "remote URL changed");

            logMessage = append(logMessage, "remote URL changed");
          }

          if (event.isDownloadRemoteIndexEnabled()) {
            taskName = append(taskName, "enabled download of indexes");

            logMessage = append(logMessage, "enabled download of indexes");
          }

          if (event.isMadeSearchable()) {
            taskName = append(taskName, "enabled searchable");

            logMessage = append(logMessage, "enabled searchable");
          }

          taskName = taskName + ", repositoryId=" + event.getRepository().getId() + ".";

          logMessage =
              logMessage + " on repository \"" + event.getRepository().getName() + "\" (id="
                  + event.getRepository().getId() + "), doing full reindex of it.";

          reindexRepo(event.getRepository(), true, taskName);

          log.info(logMessage);
        }
      }
    }
View Full Code Here

    return super.rollbackChanges();
  }

  @Override
  protected RepositoryConfigurationUpdatedEvent getRepositoryConfigurationUpdatedEvent() {
    RepositoryConfigurationUpdatedEvent event = super.getRepositoryConfigurationUpdatedEvent();

    event.setDownloadRemoteIndexEnabled(this.downloadRemoteIndexEnabled);

    return event;
  }
View Full Code Here

  @Test
  public void unsatisfiedWhenRepositoryIsOutOfService() {
    assertThat(underTest.isSatisfied(), is(true));

    when(repository.getLocalStatus()).thenReturn(LocalStatus.OUT_OF_SERVICE);
    RepositoryConfigurationUpdatedEvent event = new RepositoryConfigurationUpdatedEvent(repository);
    event.setLocalStatusChanged(true);
    underTest.handle(event);
    assertThat(underTest.isSatisfied(), is(false));

    verifyEventBusEvents(satisfied(underTest), unsatisfied(underTest));
  }
View Full Code Here

  @Test
  public void satisfiedWhenRepositoryIsBackToService() {
    assertThat(underTest.isSatisfied(), is(true));

    when(repository.getLocalStatus()).thenReturn(LocalStatus.OUT_OF_SERVICE);
    RepositoryConfigurationUpdatedEvent event = new RepositoryConfigurationUpdatedEvent(repository);
    event.setLocalStatusChanged(true);
    underTest.handle(event);

    when(repository.getLocalStatus()).thenReturn(LocalStatus.IN_SERVICE);
    underTest.handle(event);
    assertThat(underTest.isSatisfied(), is(true));
View Full Code Here

    else if (evt instanceof RepositoryRegistryEventRemove) {
      action = FeedRecorder.REPO_DROPPED;
    }
    else {
      action = FeedRecorder.REPO_UPDATED;
      final RepositoryConfigurationUpdatedEvent configured = (RepositoryConfigurationUpdatedEvent) evt;
      putIfNotNull(data, "localUrlChanged", String.valueOf(configured.isLocalUrlChanged()));
      putIfNotNull(data, "remoteUrlChanged", String.valueOf(configured.isRemoteUrlChanged()));
      putIfNotNull(data, "downloadRemoteIndexEnabled", String.valueOf(configured.isDownloadRemoteIndexEnabled()));
      putIfNotNull(data, "madeSearchable", String.valueOf(configured.isMadeSearchable()));
      putIfNotNull(data, "localStatusChanged", String.valueOf(configured.isLocalStatusChanged()));
    }

    putIfNotNull(data, "repoId", repository.getId());
    putIfNotNull(data, "repoName", repository.getName());
    // TODO: who changed it?
View Full Code Here

TOP

Related Classes of org.sonatype.nexus.proxy.events.RepositoryConfigurationUpdatedEvent

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.