org.sonatype.nexus.proxy.repository.Repository.getLocalUrl()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(177)

本文整理了Java中org.sonatype.nexus.proxy.repository.Repository.getLocalUrl方法的一些代码示例,展示了Repository.getLocalUrl的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Repository.getLocalUrl方法的具体详情如下:
包路径:org.sonatype.nexus.proxy.repository.Repository
类名称:Repository
方法名:getLocalUrl

Repository.getLocalUrl介绍

[英]Returns the local URL of this repository, if any.
[中]返回此存储库的本地URL(如果有)。

代码示例

代码示例来源:origin: org.sonatype.nexus.plugins/nexus-yum-repository-plugin

public static File getBaseDir(Repository repository)
  throws URISyntaxException, MalformedURLException
{
 String localUrl = repository.getLocalUrl();
 if (isFile(localUrl)) {
  return new File(localUrl);
 }
 return new File(new URL(localUrl).toURI());
}

代码示例来源:origin: org.sonatype.nexus/nexus-indexer-lucene-app

if ( repository.getLocalUrl() != null
  && repository.getLocalStorage() instanceof DefaultFSLocalRepositoryStorage )
    URL url = new URL( repository.getLocalUrl() );
    try
    repoRoot = new File( repository.getLocalUrl() );

代码示例来源:origin: org.sonatype.nexus/nexus-proxy

public void cleanRepositoryFolders( final Repository repository, boolean deleteForever )
    throws IOException
  {
    File defaultStorageFolder =
      new File( new File( getApplicationConfiguration().getWorkingDirectory(), "storage" ), repository.getId() );

    String defaultStorageURI = defaultStorageFolder.toURI().toURL().toString();
    defaultStorageURI = defaultStorageURI.endsWith( "/" ) ? defaultStorageURI : defaultStorageURI + "/";

    String localURI = repository.getLocalUrl();

    localURI = localURI.endsWith( "/" ) ? localURI : localURI + "/";

    boolean defaultLocation = defaultStorageURI.equals( localURI );

    // we do this _only_ if storage is not user-customized
    if ( defaultLocation )
    {
      delete( defaultStorageFolder, deleteForever );
    }
  }
}

代码示例来源:origin: org.sonatype.nexus/nexus-proxy

throws LocalStorageException
StringBuilder urlStr = new StringBuilder( repository.getLocalUrl() );

代码示例来源:origin: org.sonatype.nexus.plugins/nexus-indexer-lucene-plugin

@Nullable
 private File getRepositoryLocalStorageFile(final Repository repository, final String path) {
  if (repository.getLocalUrl() != null && repository.getLocalStorage() instanceof DefaultFSLocalRepositoryStorage) {
   try {
    return
      ((DefaultFSLocalRepositoryStorage) repository.getLocalStorage())
        .getBaseDir(repository, new ResourceStoreRequest(path));
   }
   catch (LocalStorageException e) {
    log.warn("Cannot get {} file from {} repository's LS", path, repository.getId(), e);
   }
  }
  return null;
 }
}

代码示例来源:origin: org.sonatype.nexus.plugins/nexus-indexer-lucene-plugin

/**
 * Extracts the repo root on local FS as File. It may return null!
 */
protected File getRepositoryLocalStorageAsFile(Repository repository) {
 if (repository.getLocalUrl() != null
   && repository.getLocalStorage() instanceof DefaultFSLocalRepositoryStorage) {
  try {
   File baseDir =
     ((DefaultFSLocalRepositoryStorage) repository.getLocalStorage()).getBaseDir(repository,
       new ResourceStoreRequest(RepositoryItemUid.PATH_ROOT));
   return baseDir;
  }
  catch (LocalStorageException e) {
   log.warn(String.format("Cannot determine \"%s\" (ID=%s) repository's basedir:",
     repository.getName(), repository.getId()), e);
  }
 }
 return null;
}

代码示例来源:origin: org.sonatype.nexus.plugins/nexus-p2-repository-plugin

static File localStorageOfRepositoryAsFile(final Repository repository)
  throws LocalStorageException
{
 if (repository.getLocalUrl() != null
   && repository.getLocalStorage() instanceof DefaultFSLocalRepositoryStorage) {
  final File baseDir =
    ((DefaultFSLocalRepositoryStorage) repository.getLocalStorage()).getBaseDir(repository,
      new ResourceStoreRequest(
        RepositoryItemUid.PATH_ROOT));
  return baseDir;
 }
 throw new LocalStorageException(String.format("Repository [%s] does not have an local storage",
   repository.getId()));
}

代码示例来源:origin: saleemshafi/nexus-artifact-usage-plugin

public Collection<GAV> resolveDependencies(GAV artifact) throws IOException {
  Collection<GAV> artifactDependencies = new ArrayList<GAV>();
  ArtifactDescriptorRequest descriptorRequest = new ArtifactDescriptorRequest();
  descriptorRequest.setArtifact(new DefaultArtifact(artifact.toString()));
  for (Repository repo : this.repositoryRegistry.getRepositories()) {
    if (repo.getLocalUrl() != null) {
      descriptorRequest.addRepository(new RemoteRepository(repo
          .getId(), "default", repo.getLocalUrl()));
    }
  }
  try {
    ArtifactDescriptorResult descriptorResult = this
        .getRepositorySystem().readArtifactDescriptor(
            this.getRepositorySession(), descriptorRequest);
    for (org.sonatype.aether.graph.Dependency dependency : descriptorResult
        .getDependencies()) {
  getLogger().debug("{} depends on {}", artifact, dependency.getArtifact());
  artifactDependencies.add(new GAV(dependency.getArtifact()
          .getGroupId(),
          dependency.getArtifact().getArtifactId(), dependency
              .getArtifact().getVersion()));
    }
  } catch (ArtifactDescriptorException e) {
    throw new IOException(e);
  }
  return artifactDependencies;
}

代码示例来源:origin: org.sonatype.nexus.plugins/nexus-restlet1x-plugin

repoRes.setEffectiveLocalStorageUrl(repository.getLocalUrl());

代码示例来源:origin: org.sonatype.nexus/nexus-rest-api

repoRes.setEffectiveLocalStorageUrl( repository.getLocalUrl() );

相关文章