当前位置: 首页>>代码示例>>Java>>正文


Java Mirror类代码示例

本文整理汇总了Java中org.apache.maven.settings.Mirror的典型用法代码示例。如果您正苦于以下问题:Java Mirror类的具体用法?Java Mirror怎么用?Java Mirror使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Mirror类属于org.apache.maven.settings包,在下文中一共展示了Mirror类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getMirrorInfo

import org.apache.maven.settings.Mirror; //导入依赖的package包/类
/**
 * if the repository has a mirror, then create a repositoryinfo object for it..
 */

private RepositoryInfo getMirrorInfo(RepositoryInfo info, MirrorSelector selector, Settings settings) {
    RemoteRepository original = new RemoteRepository.Builder(info.getId(), /* XXX do we even support any other layout?*/"default", info.getRepositoryUrl()).build();
    RemoteRepository mirror = selector.getMirror(original);
    if (mirror != null) {
        try {
            String name = mirror.getId();
            //#213078 need to lookup name for mirror
            for (Mirror m : settings.getMirrors()) {
                if (m.getId() != null && m.getId().equals(mirror.getId())) {
                    name = m.getName();
                    break;
                }
            }
            RepositoryInfo toret = new RepositoryInfo(mirror.getId(), name, null, mirror.getUrl());
            toret.setMirrorStrategy(RepositoryInfo.MirrorStrategy.NONE);
            return toret;
        } catch (URISyntaxException ex) {
            Exceptions.printStackTrace(ex);
        }
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:RepositoryPreferences.java

示例2: getMirror

import org.apache.maven.settings.Mirror; //导入依赖的package包/类
private Mirror getMirror( RepositorySystemSession session, ArtifactRepository repository )
{
    if ( session != null )
    {
        org.sonatype.aether.repository.MirrorSelector selector = session.getMirrorSelector();
        if ( selector != null )
        {
            RemoteRepository repo = selector.getMirror( RepositoryUtils.toRepo( repository ) );
            if ( repo != null )
            {
                Mirror mirror = new Mirror();
                mirror.setId( repo.getId() );
                mirror.setUrl( repo.getUrl() );
                mirror.setLayout( repo.getContentType() );
                return mirror;
            }
        }
    }
    return null;
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:21,代码来源:LegacyRepositorySystem.java

示例3: injectMirror

import org.apache.maven.settings.Mirror; //导入依赖的package包/类
private void injectMirror( ArtifactRepository repository, Mirror mirror )
{
    if ( mirror != null )
    {
        ArtifactRepository original =
            createArtifactRepository( repository.getId(), repository.getUrl(), repository.getLayout(),
                                      repository.getSnapshots(), repository.getReleases() );

        repository.setMirroredRepositories( Collections.singletonList( original ) );

        repository.setId( mirror.getId() );
        repository.setUrl( mirror.getUrl() );

        if ( StringUtils.isNotEmpty( mirror.getLayout() ) )
        {
            repository.setLayout( getLayout( mirror.getLayout() ) );
        }
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:20,代码来源:LegacyRepositorySystem.java

示例4: getMirrorRepository

import org.apache.maven.settings.Mirror; //导入依赖的package包/类
@Deprecated
public ArtifactRepository getMirrorRepository( ArtifactRepository repository )
{

    Mirror mirror = mirrorSelector.getMirror( repository, legacySupport.getSession().getSettings().getMirrors() );

    if ( mirror != null )
    {
        String id = mirror.getId();
        if ( id == null )
        {
            // TODO: this should be illegal in settings.xml
            id = repository.getId();
        }

        log.debug( "Using mirror: " + mirror.getUrl() + " (id: " + id + ")" );

        repository = artifactRepositoryFactory.createArtifactRepository( id, mirror.getUrl(),
                                                                 repository.getLayout(), repository.getSnapshots(),
                                                                 repository.getReleases() );
    }
    return repository;
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:24,代码来源:DefaultWagonManager.java

示例5: testMirrorLayoutConsideredForMatching

import org.apache.maven.settings.Mirror; //导入依赖的package包/类
public void testMirrorLayoutConsideredForMatching()
{
    ArtifactRepository repo = getRepo( "a" );

    Mirror mirrorA = newMirror( "a", "a", null, "http://a" );
    Mirror mirrorB = newMirror( "b", "a", "p2", "http://b" );

    Mirror mirrorC = newMirror( "c", "*", null, "http://c" );
    Mirror mirrorD = newMirror( "d", "*", "p2", "http://d" );

    assertSame( mirrorA, mirrorSelector.getMirror( repo, Arrays.asList( mirrorA ) ) );
    assertNull( mirrorSelector.getMirror( repo, Arrays.asList( mirrorB ) ) );

    assertSame( mirrorC, mirrorSelector.getMirror( repo, Arrays.asList( mirrorC ) ) );
    assertNull( mirrorSelector.getMirror( repo, Arrays.asList( mirrorD ) ) );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:17,代码来源:MirrorProcessorTest.java

示例6: addMirror

import org.apache.maven.settings.Mirror; //导入依赖的package包/类
public MavenExecutionRequest addMirror( Mirror mirror )
{
    if ( mirror == null )
    {
        throw new IllegalArgumentException( "mirror missing" );
    }

    for ( Mirror p : getMirrors() )
    {
        if ( p.getId() != null && p.getId().equals( mirror.getId() ) )
        {
            return this;
        }
    }

    getMirrors().add( mirror );

    return this;
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:20,代码来源:DefaultMavenExecutionRequest.java

示例7: createMirrorSelector

import org.apache.maven.settings.Mirror; //导入依赖的package包/类
private MirrorSelector createMirrorSelector(Settings settings) {
	DefaultMirrorSelector selector = new DefaultMirrorSelector();
	for (Mirror mirror : settings.getMirrors()) {
		selector.add(mirror.getId(), mirror.getUrl(), mirror.getLayout(), false,
				mirror.getMirrorOf(), mirror.getMirrorOfLayouts());
	}
	return selector;
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:9,代码来源:MavenSettings.java

示例8: addMirrors

import org.apache.maven.settings.Mirror; //导入依赖的package包/类
/**
 * Adds a list of mirror configurations to the maven settings object
 *
 * @param contextUrl System URL
 * @param settings   Maven Settings to append to
 * @param mirrors    Mirrors to add to the settings
 */
private void addMirrors(String contextUrl, Settings settings, List<MavenSettingsMirror> mirrors) {
    for (MavenSettingsMirror mirror : mirrors) {
        Mirror mirrorToAdd = new Mirror();
        String mirrorId = mirror.getId();
        mirrorToAdd.setId(mirrorId);
        mirrorToAdd.setName(mirrorId);
        mirrorToAdd.setUrl(contextUrl + mirrorId);
        mirrorToAdd.setMirrorOf(mirror.getMirrorOf());

        settings.addMirror(mirrorToAdd);
    }
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:20,代码来源:MavenServiceImpl.java

示例9: createMirrorSelector

import org.apache.maven.settings.Mirror; //导入依赖的package包/类
private DefaultMirrorSelector createMirrorSelector(Settings settings)
{
   final DefaultMirrorSelector mirrorSelector = new DefaultMirrorSelector();
   final List<Mirror> mirrors = settings.getMirrors();
   if (mirrors != null)
   {
      for (Mirror mirror : mirrors)
      {
         mirrorSelector.add(mirror.getId(), mirror.getUrl(), mirror.getLayout(), false, mirror.getMirrorOf(),
                  mirror.getMirrorOfLayouts());
      }
   }
   return mirrorSelector;
}
 
开发者ID:forge,项目名称:furnace,代码行数:15,代码来源:MavenContainer.java

示例10: getCentralMirrorURL

import org.apache.maven.settings.Mirror; //导入依赖的package包/类
static Optional<String> getCentralMirrorURL(Settings settings)
{
   return settings.getMirrors().stream()
            .filter(m -> "central".equals(m.getMirrorOf()) ||
                     "*".equals(m.getMirrorOf()) ||
                     MAVEN_CENTRAL_REPO.equals(m.getMirrorOf()))
            .map(Mirror::getUrl)
            .findFirst();
}
 
开发者ID:forge,项目名称:furnace,代码行数:10,代码来源:MavenRepositories.java

示例11: testMirrorWildcardLookup

import org.apache.maven.settings.Mirror; //导入依赖的package包/类
public void testMirrorWildcardLookup()
{
    Mirror mirrorA = newMirror( "a", "a", "http://a" );
    Mirror mirrorB = newMirror( "b", "b", "http://b" );
    Mirror mirrorC = newMirror( "c", "*", "http://wildcard" );

    List<Mirror> mirrors = Arrays.asList( mirrorA, mirrorB, mirrorC );

    assertSame( mirrorA, mirrorSelector.getMirror( getRepo( "a", "http://a.a" ), mirrors ) );

    assertSame( mirrorB, mirrorSelector.getMirror( getRepo( "b", "http://a.a" ), mirrors ) );

    assertSame( mirrorC, mirrorSelector.getMirror( getRepo( "c", "http://c.c" ), mirrors ) );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:15,代码来源:MirrorProcessorTest.java

示例12: testMirrorStopOnFirstMatch

import org.apache.maven.settings.Mirror; //导入依赖的package包/类
public void testMirrorStopOnFirstMatch()
{
    // exact matches win first
    Mirror mirrorA2 = newMirror( "a2", "a,b", "http://a2" );
    Mirror mirrorA = newMirror( "a", "a", "http://a" );
    // make sure repeated entries are skipped
    Mirror mirrorA3 = newMirror( "a", "a", "http://a3" );

    Mirror mirrorB = newMirror( "b", "b", "http://b" );
    Mirror mirrorC = newMirror( "c", "d,e", "http://de" );
    Mirror mirrorC2 = newMirror( "c", "*", "http://wildcard" );
    Mirror mirrorC3 = newMirror( "c", "e,f", "http://ef" );

    List<Mirror> mirrors = Arrays.asList( mirrorA2, mirrorA, mirrorA3, mirrorB, mirrorC, mirrorC2, mirrorC3 );

    assertSame( mirrorA, mirrorSelector.getMirror( getRepo( "a", "http://a.a" ), mirrors ) );

    assertSame( mirrorB, mirrorSelector.getMirror( getRepo( "b", "http://a.a" ), mirrors ) );

    assertSame( mirrorC2, mirrorSelector.getMirror( getRepo( "c", "http://c.c" ), mirrors ) );

    assertSame( mirrorC, mirrorSelector.getMirror( getRepo( "d", "http://d" ), mirrors ) );

    assertSame( mirrorC, mirrorSelector.getMirror( getRepo( "e", "http://e" ), mirrors ) );

    assertSame( mirrorC2, mirrorSelector.getMirror( getRepo( "f", "http://f" ), mirrors ) );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:28,代码来源:MirrorProcessorTest.java

示例13: newMirror

import org.apache.maven.settings.Mirror; //导入依赖的package包/类
private Mirror newMirror( String id, String mirrorOf, String layouts, String url )
{
    Mirror mirror = new Mirror();

    mirror.setId( id );
    mirror.setMirrorOf( mirrorOf );
    mirror.setMirrorOfLayouts( layouts );
    mirror.setUrl( url );

    return mirror;
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:12,代码来源:MirrorProcessorTest.java

示例14: getMirrors

import org.apache.maven.settings.Mirror; //导入依赖的package包/类
public List<Mirror> getMirrors()
{
    if ( mirrors == null )
    {
        mirrors = new ArrayList<Mirror>();
    }
    return mirrors;
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:9,代码来源:DefaultMavenExecutionRequest.java

示例15: setMirrors

import org.apache.maven.settings.Mirror; //导入依赖的package包/类
public MavenExecutionRequest setMirrors( List<Mirror> mirrors )
{
    if ( mirrors != null )
    {
        this.mirrors = new ArrayList<Mirror>( mirrors );
    }
    else
    {
        this.mirrors = null;
    }

    return this;
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:14,代码来源:DefaultMavenExecutionRequest.java


注:本文中的org.apache.maven.settings.Mirror类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。