Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Copyright 2012 Red Hat, Inc. and/or its affiliates.
  *
  * Licensed under the Eclipse Public License version 1.0, available at
  * http://www.eclipse.org/legal/epl-v10.html
  */
 package org.jboss.forge.arquillian.maven;
 
Repository Utils

Author(s):
George Gastaldi <gegastaldi@gmail.com>
public final class RepositoryUtils
   private RepositoryUtils()
   {
   }
   {
      org.eclipse.aether.repository.Proxy result = null;
      if (proxy != null)
      {
         Authentication auth = new AuthenticationBuilder().addUsername(proxy.getUsername())
                  .addPassword(proxy.getPassword()).build();
         result = new org.eclipse.aether.repository.Proxy(proxy.getProtocol(), proxy.getHost(), proxy.getPort(), auth);
      }
      return result;
   }
   {
      MavenArtifactRepository result = new MavenArtifactRepository();
      result.setId(repository.getId());
      result.setUrl(repository.getUrl());
      String layout = repository.getLayout();
      if ("default".equals(layout))
         result.setLayout(new DefaultRepositoryLayout());
      else if ("p2".equals(layout))
         result.setLayout(new P2ArtifactRepositoryLayout());
      RepositoryPolicy releases = repository.getReleases();
      if (releases != null)
         result.setReleaseUpdatePolicy(new ArtifactRepositoryPolicy(releases.isEnabled(), releases.getUpdatePolicy(),
                  releases.getChecksumPolicy()));
      RepositoryPolicy snapshots = repository.getSnapshots();
      if (snapshots != null)
         result.setSnapshotUpdatePolicy(new ArtifactRepositoryPolicy(snapshots.isEnabled(),
                  snapshots.getUpdatePolicy(),
                  snapshots.getChecksumPolicy()));
      return result;
   }
   public static ArtifactRepository toArtifactRepository(String idString urlString layout,
            boolean containsReleases,
            boolean containsSnapshots)
   {
      MavenArtifactRepository result = new MavenArtifactRepository();
      result.setId(id);
      result.setUrl(url);
      if (layout == null || layout.isEmpty() || "default".equals(layout))
      {
         result.setLayout(new DefaultRepositoryLayout());
      }
      else if ("p2".equals(layout))
      {
         result.setLayout(new P2ArtifactRepositoryLayout());
      }
      result.setReleaseUpdatePolicy(new ArtifactRepositoryPolicy(containsReleases,
               .,
               .));
      result.setSnapshotUpdatePolicy(new ArtifactRepositoryPolicy(containsSnapshots,
               .,
               .));
      return result;
   }
New to GrepCode? Check out our FAQ X