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


Java Repository类代码示例

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


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

示例1: testBadRepo

import org.apache.maven.wagon.repository.Repository; //导入依赖的package包/类
@Test
public void testBadRepo() throws Exception
{
  expectedException.expect(new CustomMatcher<Object>(IllegalArgumentException.class.getName())
  {
    @Override
    public boolean matches(Object item)
    {
      return item instanceof IllegalArgumentException;
    }
  });
  new GSWagon()
  {
    public Repository getRepository()
    {
      return new Repository("id", "http://bucket/key");
    }
  }.openConnectionInternal();
}
 
开发者ID:drcrallen,项目名称:gswagon-maven-plugin,代码行数:20,代码来源:GSWagonTest.java

示例2: testBuildStorage

import org.apache.maven.wagon.repository.Repository; //导入依赖的package包/类
@Test
public void testBuildStorage()
{
  final GSWagon gsWagon = new GSWagon()
  {
    public Repository getRepository()
    {
      return new Repository(repoId, "url");
    }
  };
  gsWagon.swapAndCloseConnection(connectionPOJO);
  final String property = gsWagon.getPropertyString(repoId);
  final String pre = System.getProperty(property);
  try {
    System.setProperty(property, "fakeproject");
    assertNotNull(gsWagon.buildStorage(connectionPOJO.client));
  }
  finally {
    if (pre != null) {
      System.setProperty(property, pre);
    } else {
      System.clearProperty(property);
    }
  }
}
 
开发者ID:drcrallen,项目名称:gswagon-maven-plugin,代码行数:26,代码来源:GSWagonTest.java

示例3: createWagon

import org.apache.maven.wagon.repository.Repository; //导入依赖的package包/类
Wagon createWagon(String serverId, String url) throws WagonException {
  Repository repository = new Repository(serverId, url);
  Wagon wagon = wagonManager.getWagon(repository);

  if (getLog().isDebugEnabled()) {
    Debug debug = new Debug();
    wagon.addSessionListener(debug);
    wagon.addTransferListener(debug);
  }

  ProxyInfo proxyInfo = getProxyInfo();
  if (proxyInfo != null) {
    wagon
        .connect(repository, wagonManager.getAuthenticationInfo(repository.getId()), proxyInfo);
  } else {
    wagon.connect(repository, wagonManager.getAuthenticationInfo(repository.getId()));
  }
  return wagon;
}
 
开发者ID:chonton,项目名称:exists-maven-plugin,代码行数:20,代码来源:RemoteExistsMojo.java

示例4: createHelper

import org.apache.maven.wagon.repository.Repository; //导入依赖的package包/类
private DefaultVersionsHelper createHelper( String rulesUri, ArtifactMetadataSource metadataSource )
    throws MojoExecutionException
{
    final DefaultWagonManager wagonManager = new DefaultWagonManager()
    {
        public Wagon getWagon( Repository repository )
            throws UnsupportedProtocolException, WagonConfigurationException
        {
            return new FileWagon();
        }
    };

    DefaultVersionsHelper helper =
        new DefaultVersionsHelper( new DefaultArtifactFactory(), new DefaultArtifactResolver(), metadataSource, new ArrayList(),
                                   new ArrayList(),
                                   new DefaultArtifactRepository( "", "", new DefaultRepositoryLayout() ),
                                   wagonManager, new Settings(), "", rulesUri, mock( Log.class ), mock( MavenSession.class ),
                                   new DefaultPathTranslator());
    return helper;
}
 
开发者ID:mojohaus,项目名称:versions-maven-plugin,代码行数:21,代码来源:DefaultVersionsHelperTest.java

示例5: createWagon

import org.apache.maven.wagon.repository.Repository; //导入依赖的package包/类
/**
 * Convenience method to create a wagon.
 *
 * @param serverId     The serverId to use if the wagonManager needs help.
 * @param url          The url to create a wagon for.
 * @param wagonManager The wgaon manager to use.
 * @param settings     The settings to use.
 * @param logger       The logger to use.
 * @return The wagon to connect to the url.
 * @throws org.apache.maven.wagon.UnsupportedProtocolException
 *          if the protocol is not supported.
 * @throws org.apache.maven.artifact.manager.WagonConfigurationException
 *          if the wagon cannot be configured.
 * @throws org.apache.maven.wagon.ConnectionException
 *          If the connection cannot be established.
 * @throws org.apache.maven.wagon.authentication.AuthenticationException
 *          If the connection cannot be authenticated.
 */
public static Wagon createWagon( String serverId, String url, WagonManager wagonManager, Settings settings,
                                 Log logger )
    throws UnsupportedProtocolException, WagonConfigurationException, ConnectionException, AuthenticationException
{
    Repository repository = new Repository( serverId, url );
    Wagon wagon = wagonManager.getWagon( repository );

    if ( logger.isDebugEnabled() )
    {
        Debug debug = new Debug();
        wagon.addSessionListener( debug );
        wagon.addTransferListener( debug );
    }

    ProxyInfo proxyInfo = getProxyInfo( settings );
    if ( proxyInfo != null )
    {
        wagon.connect( repository, wagonManager.getAuthenticationInfo( repository.getId() ), proxyInfo );
    }
    else
    {
        wagon.connect( repository, wagonManager.getAuthenticationInfo( repository.getId() ) );
    }
    return wagon;
}
 
开发者ID:petr-ujezdsky,项目名称:versions-maven-plugin-svn-clone,代码行数:44,代码来源:WagonUtils.java

示例6: createHelper

import org.apache.maven.wagon.repository.Repository; //导入依赖的package包/类
private VersionsHelper createHelper( String rulesUri, ArtifactMetadataSource metadataSource )
    throws MojoExecutionException
{
    final DefaultWagonManager wagonManager = new DefaultWagonManager()
    {
        public Wagon getWagon( Repository repository )
            throws UnsupportedProtocolException, WagonConfigurationException
        {
            return new FileWagon();
        }
    };

    VersionsHelper helper =
        new DefaultVersionsHelper( new DefaultArtifactFactory(), new DefaultArtifactResolver(), metadataSource, new ArrayList(),
                                   new ArrayList(),
                                   new DefaultArtifactRepository( "", "", new DefaultRepositoryLayout() ),
                                   wagonManager, new Settings(), "", rulesUri, mock( Log.class ), mock( MavenSession.class ),
                                   new DefaultPathTranslator());
    return helper;
}
 
开发者ID:petr-ujezdsky,项目名称:versions-maven-plugin-svn-clone,代码行数:21,代码来源:DefaultVersionsHelperTest.java

示例7: executeInternal

import org.apache.maven.wagon.repository.Repository; //导入依赖的package包/类
@Override
protected void executeInternal(SiteConfigImpl config, SiteImpl site) throws MojoExecutionException, MojoFailureException {
    File destination = site.getDestination();
    getLog().info("Destination [" + destination + "]");
    getLog().info("Site root [" + site.getRoot() + "]");

    if (!destination.exists()) {
        throw new MojoFailureException("The site output folder does not exist, please run mvn op:build first");
    }

    List<Map<String, String>> deployList = getDeployRepositoryList(config); //config.get("deploy");

    if (deployList == null || deployList.isEmpty()) {
        throw new MojoFailureException("Deploy configuration not found in config.yml");
    }

    for (Map<String, String> deployRepo : deployList) {
        Repository repository = createRepository(deployRepo);
        deploy(site, destination, repository);
    }
}
 
开发者ID:opoo,项目名称:opoopress,代码行数:22,代码来源:AbstractDeployMojo.java

示例8: createRepository

import org.apache.maven.wagon.repository.Repository; //导入依赖的package包/类
private Repository createRepository(Map<String, String> repo) throws MojoExecutionException, MojoFailureException {
    String id = repo.get("id");
    String url = repo.get("url");

    if (id == null || url == null) {
        throw new MojoFailureException("Deploy configuration must contains 'id' and 'url': " + repo);
    }

    url = resolveRepositoryURL(id, url);

    Properties props = new Properties();
    for (String key : repo.keySet()) {
        if ("id".equals(key) || "url".equals(key)) {
            continue;
        }
        props.setProperty(key, repo.get(key));
    }

    Repository repository = new Repository(id, appendSlash(url));
    if (!props.isEmpty()) {
        repository.setParameters(props);
    }
    return repository;
}
 
开发者ID:opoo,项目名称:opoopress,代码行数:25,代码来源:AbstractDeployMojo.java

示例9: wrap

import org.apache.maven.wagon.repository.Repository; //导入依赖的package包/类
private ArtifactTransferResource wrap( Repository repository, Resource resource )
{
    if ( resource == null )
    {
        return null;
    }
    else
    {
        synchronized ( artifacts )
        {
            ArtifactTransferResource artifact = artifacts.get( resource );

            if ( artifact == null )
            {
                artifact = new MavenArtifact( repository.getUrl(), resource );
                artifacts.put( resource, artifact );
            }

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

示例10: setRepository

import org.apache.maven.wagon.repository.Repository; //导入依赖的package包/类
private void setRepository(Repository repository)
{
  this.repository = repository;

  String url = repository.getUrl();
  Pattern p = Pattern.compile("([^:]*):(([^/:]*):|)(.*)");
  Matcher m = p.matcher(url);
  if (!m.matches()) {
    System.err.println("Error: Couldn't decode url '"+url+"'");
  } else {
    protocol = m.group(1);
    host = m.group(3);
    path = m.group(4);
    System.out.println("Decoded url '"+url+"' to:");
    System.out.println(" Protocol '"+protocol+"'");
    System.out.println(" Host '"+host+"'");
    System.out.println(" Path '"+path+"'");
  }
}
 
开发者ID:dunlop-lello,项目名称:rsync-maven-wagon,代码行数:20,代码来源:RsyncWagon.java

示例11: openConnectionInternal

import org.apache.maven.wagon.repository.Repository; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
protected void openConnectionInternal() throws ConnectionException, AuthenticationException
{
  final Repository repository = getRepository();
  if (!"gs".equals(repository.getProtocol())) {
    throw new IllegalArgumentException(String.format("Unsupported protocol [%s]", repository.getProtocol()));
  }
  final HttpClient client = buildClient();
  swapAndCloseConnection(new ConnectionPOJO(
      buildStorage(client),
      BlobId.of(repository.getHost(), repository.getBasedir().substring(1)),
      client
  ));
}
 
开发者ID:drcrallen,项目名称:gswagon-maven-plugin,代码行数:17,代码来源:GSWagon.java

示例12: testBuildStorageFailsWithoutProjectID

import org.apache.maven.wagon.repository.Repository; //导入依赖的package包/类
@Test
public void testBuildStorageFailsWithoutProjectID()
{
  final GSWagon gsWagon = new GSWagon()
  {
    public Repository getRepository()
    {
      return new Repository("id", "url");
    }
  };
  gsWagon.swapAndCloseConnection(connectionPOJO);
  final String property = gsWagon.getPropertyString(gsWagon.getRepository().getId());
  final String pre = System.getProperty(property);
  try {
    expectedException.expect(new CustomMatcher<Object>(NullPointerException.class.getName())
    {
      @Override
      public boolean matches(Object item)
      {
        return item instanceof NullPointerException;
      }
    });
    System.clearProperty(property);
    gsWagon.swapAndCloseConnection(connectionPOJO);
    assertNotNull(gsWagon.buildStorage(connectionPOJO.client));
  }
  finally {
    if (pre != null) {
      System.setProperty(property, pre);
    } else {
      System.clearProperty(property);
    }
  }
}
 
开发者ID:drcrallen,项目名称:gswagon-maven-plugin,代码行数:35,代码来源:GSWagonTest.java

示例13: connect

import org.apache.maven.wagon.repository.Repository; //导入依赖的package包/类
@Override
public void connect( Repository repository, AuthenticationInfo authenticationInfo,
                     ProxyInfoProvider proxyInfoProvider )
    throws ConnectionException, AuthenticationException
{

}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:8,代码来源:MockWagon.java

示例14: getBaseDirectory

import org.apache.maven.wagon.repository.Repository; //导入依赖的package包/类
static String getBaseDirectory(Repository repository) {
    StringBuilder sb = new StringBuilder(repository.getBasedir()).deleteCharAt(0);

    if ((sb.length() != 0) && (sb.charAt(sb.length() - 1) != '/')) {
        sb.append('/');
    }

    return sb.toString();
}
 
开发者ID:lambadaframework,项目名称:lambadaframework,代码行数:10,代码来源:S3Utils.java

示例15: connectToRepository

import org.apache.maven.wagon.repository.Repository; //导入依赖的package包/类
@Override
protected void connectToRepository(Repository repository, AuthenticationInfo authenticationInfo,
                                   ProxyInfoProvider proxyInfoProvider) throws AuthenticationException {
    if (this.amazonS3 == null) {

        ClientConfiguration clientConfiguration = S3Utils.getClientConfiguration(proxyInfoProvider);

        this.bucketName = S3Utils.getBucketName(repository);
        this.baseDirectory = S3Utils.getBaseDirectory(repository);

        this.amazonS3 = new AmazonS3Client(new DefaultAWSCredentialsProviderChain(), clientConfiguration);
        Region region = Region.fromLocationConstraint(this.amazonS3.getBucketLocation(this.bucketName));
        this.amazonS3.setEndpoint(region.getEndpoint());
    }
}
 
开发者ID:lambadaframework,项目名称:lambadaframework,代码行数:16,代码来源:SimpleStorageServiceWagon.java


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