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

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

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

Repository.retrieveItem介绍

暂无

代码示例

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

static StorageItem retrieveItem(final Repository repository, final String path)
  throws Exception
{
 final ResourceStoreRequest request = new ResourceStoreRequest(path);
 final StorageItem item = repository.retrieveItem(request);
 return item;
}

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

/**
 * Read content of repomd.xml.
 *
 * @param repository repository containing repomd.xml
 * @return parsed repomd.xml
 */
private static Document parseRepoMD(final Repository repository)
  throws Exception
{
 StorageFileItem repoMDItem = (StorageFileItem) repository.retrieveItem(
   false, new ResourceStoreRequest("/" + PATH_OF_REPOMD_XML)
 );
 try (InputStream in = repoMDItem.getInputStream()) {
  DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
  DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
  return documentBuilder.parse(in);
 }
}

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

private boolean anyOfRepositoriesHasYumRepository(final List<String> repositoryIds) {
 if (repositoryIds != null) {
  for (final String repositoryId : repositoryIds) {
   try {
    repositoryRegistryProvider.get().getRepository(repositoryId).retrieveItem(
      new ResourceStoreRequest(Yum.PATH_OF_REPOMD_XML)
    );
    return true;
   }
   catch (final Exception ignore) {
    // we could not get the repository or repomd.xml so looks like we do not have an yum repository
   }
  }
 }
 return false;
}

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

protected StorageItem doRetrieveItemFromMaster( final ResourceStoreRequest request )
    throws IllegalOperationException, ItemNotFoundException, StorageException
  {
    try
    {
      return getMasterRepository().retrieveItem( request );
    }
    catch ( AccessDeniedException e )
    {
      // if client has no access to content over shadow, we just hide the fact
      throw new ItemNotFoundException( request, this, e );
    }
  }
}

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

StorageItem item = repository.retrieveItem( false, request );

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

DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
StorageFileItem primaryItem = (StorageFileItem) repository.retrieveItem(
  false, new ResourceStoreRequest("/" + primaryHref)
);

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

StorageFileItem primaryItem = (StorageFileItem) repository.retrieveItem(
  false, new ResourceStoreRequest("/" + primaryPath)
);
primaryItem = (StorageFileItem) repository.retrieveItem(
  false, new ResourceStoreRequest("/" + primaryPath)
);

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

try {
 log.trace("Retrieving {}:{}", memberRepository.getId(), "/" + PATH_OF_REPOMD_XML);
 repomdItem = memberRepository.retrieveItem(
   new ResourceStoreRequest("/" + PATH_OF_REPOMD_XML)
 );
   if (!retrieveLocation.matches("/" + PATH_OF_REPODATA + "/.*\\.sqlite\\.bz2")) {
    log.trace("Retrieving {}:{}", memberRepository.getId(), retrieveLocation);
    memberRepository.retrieveItem(new ResourceStoreRequest(retrieveLocation));

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

StorageItem item = uid.getRepository().retrieveItem( false, request );

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

@SuppressWarnings("deprecation")
 public StorageItem retrieveDirectItem(ResourceStoreRequest request)
   throws IllegalOperationException, ItemNotFoundException, IOException
 {
  for (Repository repo : getMemberRepositories()) {
   try {
    return repo.retrieveItem(false, request);
   }
   catch (ItemNotFoundException e) {
    // ignore
   }
  }
  throw new ItemNotFoundException(reasonFor(request, this,
    "Could not find content for path %s in local storage of repository %s",
    request.getRequestPath(),
    RepositoryStringUtils.getHumanizedNameString(this)));
 }
}

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

public StorageItem dereferenceLink( StorageLinkItem link, boolean localOnly, boolean remoteOnly )
  throws AccessDeniedException, ItemNotFoundException, IllegalOperationException, StorageException
{
  logger.debug( "Dereferencing link {}", link.getTarget() );
  ResourceStoreRequest req = new ResourceStoreRequest( link.getTarget().getPath(), localOnly, remoteOnly );
  req.getRequestContext().setParentContext( link.getItemContext() );
  return link.getTarget().getRepository().retrieveItem( req );
}

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

private void copyIndexPropertiesToTempDir( Repository repository, File tempDir )
{
  InputStream is = null;
  try
  {
    // Need to use RepositoryUID to get around security
    ResourceStoreRequest req =
      new ResourceStoreRequest( "/.index/" + IndexingContext.INDEX_FILE + ".properties" );
    req.setRequestLocalOnly( true );
    StorageFileItem item = (StorageFileItem) repository.retrieveItem( true, req );
    // Hack to make sure that group properties isn't retrieved from child repo
    if ( repository.getId().equals( item.getRepositoryId() ) )
    {
      is = item.getInputStream();
      // FileUtils.copyStreamToFile closes the stream!
      FileUtils.copyStreamToFile( new RawInputStreamFacade( is ), new File( tempDir,
        IndexingContext.INDEX_FILE + ".properties" ) );
    }
  }
  catch ( Exception e )
  {
    getLogger().debug( "Unable to copy index properties file, continuing without it", e );
  }
}

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

@Override
public String renderStatus() {
 if (isConfigured()) {
  try {
   final Repository repository = repositoryRegistry.getRepository(getConfig().repository());
   final StorageItem storageItem = repository.retrieveItem(
     new ResourceStoreRequest(YumConfigContentGenerator.configFilePath(repository.getId()), true)
   );
   if (storageItem instanceof StorageFileItem) {
    try (InputStream in = ((StorageFileItem) storageItem).getInputStream()) {
     return
       "<b>Example Yum configuration file:</b><br/><br/>"
         + "<pre>"
         + IOUtils.toString(in)
         + "</pre>";
    }
   }
  }
  catch (Exception e) {
   return null;
  }
 }
 return null;
}

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

try {
 log.trace("Checking if {}:{} should be processed", repository.getId(), request.getRequestPath());
 StorageFileItem repoMDItem = (StorageFileItem) repository.retrieveItem(
   false, new ResourceStoreRequest(REPOMD_XML_PATH)
 );

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

try {
 log.debug("Fetching {}:{} member of {}", member.getId(), PATH_OF_REPOMD_XML, groupRepository.getId());
 member.retrieveItem(new ResourceStoreRequest(PATH_OF_REPOMD_XML));

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

public StorageItem retrieveItem( ResourceStoreRequest request )
  throws ItemNotFoundException, IllegalOperationException, StorageException, AccessDeniedException
{
  RequestRoute route = getRequestRouteForRequest( request );
  if ( route.isRepositoryHit() )
  {
    // it hits a repository, mangle path and call it
    StorageItem item;
    try
    {
      request.pushRequestPath( route.getRepositoryPath() );
      item = route.getTargetedRepository().retrieveItem( request );
    }
    finally
    {
      request.popRequestPath();
    }
    return mangle( false, request, route, item );
  }
  else
  {
    // this is "above" repositories
    return retrieveVirtualPath( request, route );
  }
}

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

StorageItem item = getRepository().retrieveItem( request );

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

@Override
public StorageItem call()
  throws IllegalOperationException, ItemNotFoundException, IOException
{
  final ResourceStoreRequest newreq = new ResourceStoreRequest( getRequest() );
  newreq.setRequestLocalOnly( getRequest().isRequestLocalOnly() );
  newreq.setRequestRemoteOnly( getRequest().isRequestRemoteOnly() );
  try
  {
    return getRepository().retrieveItem( false, newreq );
  }
  finally
  {
    getRequest().addProcessedRepository( getRepository() );
  }
}

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

@Override
public StorageItem call()
  throws ItemNotFoundException, IllegalOperationException, IOException, AccessDeniedException
{
  final ResourceStoreRequest newreq = new ResourceStoreRequest( getRequest() );
  newreq.setRequestLocalOnly( getRequest().isRequestLocalOnly() );
  newreq.setRequestRemoteOnly( getRequest().isRequestRemoteOnly() );
  StorageItem item = getRepository().retrieveItem( newreq );
  getRequest().addProcessedRepository( getRepository() );
  if ( item instanceof StorageCollectionItem )
  {
    item = new DefaultStorageCollectionItem( groupRepository, newreq, true, false );
  }
  return item;
}

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

final StorageItem item = getRepository().retrieveItem(request);
if (item instanceof StorageFileItem) {
 mnode.setLocallyAvailable(true);

相关文章