Package org.sonatype.nexus.rest.model

Examples of org.sonatype.nexus.rest.model.RoutingConfigMessageWrapper


   */
  public static final String RESOURCE_URI = "/repositories/{" + REPOSITORY_ID_KEY + "}/routing/config";

  @Override
  public Object getPayloadInstance() {
    return new RoutingConfigMessageWrapper();
  }
View Full Code Here


    final MavenProxyRepository mavenProxyRepository = getMavenRepository(request, MavenProxyRepository.class);
    final DiscoveryConfig config = getManager().getRemoteDiscoveryConfig(mavenProxyRepository);
    final RoutingConfigMessage payload = new RoutingConfigMessage();
    payload.setDiscoveryEnabled(config.isEnabled());
    payload.setDiscoveryIntervalHours(Ints.saturatedCast(TimeUnit.MILLISECONDS.toHours(config.getDiscoveryInterval())));
    final RoutingConfigMessageWrapper responseNessage = new RoutingConfigMessageWrapper();
    responseNessage.setData(payload);
    return responseNessage;
  }
View Full Code Here

      throws ResourceException
  {
    try {
      final MavenProxyRepository mavenProxyRepository = getMavenRepository(request, MavenProxyRepository.class);
      final DiscoveryConfig oldConfig = getManager().getRemoteDiscoveryConfig(mavenProxyRepository);
      final RoutingConfigMessageWrapper wrapper = RoutingConfigMessageWrapper.class.cast(payload);
      // NEXUS-5567 related and some other cases (like scripting and sending partial message to enable/disable only).
      // The error range of the interval value is (>0) since it's defined in hours, and 0 or negative value would be
      // undefined. But still, due to unmarshalling, the field in the bean would be 0 (or is -1 like in NEXUS-5567).
      // Hence, if non valid value sent, we use the "old" value to keep it.
      final DiscoveryConfig config =
          new DiscoveryConfig(
              wrapper.getData().isDiscoveryEnabled(),
              wrapper.getData().getDiscoveryIntervalHours() > 0 ? TimeUnit.HOURS
                  .toMillis(wrapper.getData().getDiscoveryIntervalHours())
                  : oldConfig.getDiscoveryInterval());
      getManager().setRemoteDiscoveryConfig(mavenProxyRepository, config);
      return wrapper;
    }
    catch (ClassCastException e) {
View Full Code Here

  {
    try {
      final RoutingConfigMessage message = new RoutingConfigMessage();
      message.setDiscoveryEnabled(configuration.isEnabled());
      message.setDiscoveryIntervalHours(configuration.getIntervalHours());
      final RoutingConfigMessageWrapper wrapper = new RoutingConfigMessageWrapper();
      wrapper.setData(message);
      getNexusClient().serviceResource(routingConfigPath(mavenProxyRepositoryId)).put(wrapper);
    }
    catch (UniformInterfaceException e) {
      throw getNexusClient().convert(e);
    }
View Full Code Here

TOP

Related Classes of org.sonatype.nexus.rest.model.RoutingConfigMessageWrapper

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.