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

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

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

Repository.storeItem介绍

暂无

代码示例

代码示例来源:origin: org.sonatype.nexus/nexus-test-harness-capability-plugin

private void doIt( final Map<String, String> properties )
  {
    final Repository repo = getRepository( TouchTestCapabilityDescriptor.FIELD_REPO_OR_GROUP_ID, properties );

    try
    {
      repo.storeItem(
        new ResourceStoreRequest( "/capability/test.txt" ),
        new ByteArrayInputStream(
          ( "capabilities test!\n" + properties.get( TouchTestCapabilityDescriptor.FIELD_MSG_ID ) + "\n" + properties.get( TouchTestCapabilityDescriptor.FIELD_REPO_OR_GROUP_ID ) ).getBytes() ),
        null );
    }
    catch ( Exception e )
    {
      throw new RuntimeException( e.getMessage(), e );
    }

  }
}

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

/**
 * Store repository item.
 *
 * @param repository containing item to be stored
 * @param path       of item to be stored
 * @param content    of item to be stored
 * @param mimeType   of item to be stored
 */
private static void storeItem(final Repository repository,
               final String path,
               final byte[] content,
               final String mimeType)
  throws Exception
{
 log.debug("Storing {}:{}", repository.getId(), path);
 DefaultStorageFileItem item = new DefaultStorageFileItem(
   repository,
   new ResourceStoreRequest("/" + path),
   true,
   true,
   new PreparedContentLocator(new ByteArrayInputStream(content), mimeType, ContentLocator.UNKNOWN_LENGTH)
 );
 repository.storeItem(false, item);
}

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

getResourceStoreRequest(request, basePath + "/" + entry.getName());
try (InputStream is = zip.getInputStream(entry)) {
 repository.storeItem(storeRequest, is, null);

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

new StringContentLocator(ArchetypeContentGenerator.ID));
file.setContentGeneratorId(ArchetypeContentGenerator.ID);
repository.storeItem(false, file);

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

public void writeRawData( String path, byte[] data )
  throws Exception
{
  DefaultStorageFileItem file = new DefaultStorageFileItem(
    repository,
    new ResourceStoreRequest( path ),
    true,
    true,
    new ByteArrayContentLocator( data, "text/xml" ) );
  repository.storeItem( false, file );
  lastWriteFile = file;
}

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

public static void storeItem(final Repository repository, final ResourceStoreRequest request, final InputStream in,
               final String mimeType, final Map<String, String> userAttributes)
  throws Exception
{
 final DefaultStorageFileItem fItem =
   new DefaultStorageFileItem(repository, request, true, true,
     new PreparedContentLocator(in, mimeType, ContentLocator.UNKNOWN_LENGTH));
 if (userAttributes != null) {
  fItem.getRepositoryItemAttributes().putAll(userAttributes);
 }
 repository.storeItem(false, fItem);
}

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

static void createLink(final Repository repository, final StorageItem item, final String path)
  throws Exception
{
 final ResourceStoreRequest req = new ResourceStoreRequest(path);
 req.getRequestContext().setParentContext(item.getItemContext());
 final DefaultStorageLinkItem link =
   new DefaultStorageLinkItem(repository, req, true, true, item.getRepositoryItemUid());
 repository.storeItem(false, link);
}

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

protected void storeIndexItem(Repository repository, File file, IndexingContext context) {
 String path = PUBLISHING_PATH_PREFIX + "/" + file.getName();
 try {
  ResourceStoreRequest request = new ResourceStoreRequest(path);
  DefaultStorageFileItem fItem =
    new DefaultStorageFileItem(repository, request, true, true, new FileContentLocator(file,
      mimeSupport.guessMimeTypeFromPath(repository.getMimeRulesSource(), file.getAbsolutePath())));
  if (context.getTimestamp() == null) {
   fItem.setModified(0);
   fItem.setCreated(0);
  }
  else {
   fItem.setModified(context.getTimestamp().getTime());
   fItem.setCreated(context.getTimestamp().getTime());
  }
  if (repository instanceof MavenRepository) {
   // this is maven repo, so use the checksumming facility
   ((MavenRepository) repository).storeItemWithChecksums(false, fItem);
  }
  else {
   // simply store it
   repository.storeItem(false, fItem);
  }
 }
 catch (Exception e) {
  log.error("Cannot store index file " + path, e);
 }
}

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

repository.storeItem( false, fItem );

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

public void storeItem( ResourceStoreRequest request, InputStream is, Map<String, String> userAttributes )
  throws UnsupportedStorageOperationException, ItemNotFoundException, IllegalOperationException,
  StorageException, AccessDeniedException
{
  RequestRoute route = getRequestRouteForRequest( request );
  if ( route.isRepositoryHit() )
  {
    // it hits a repository, mangle path and call it
    try
    {
      request.pushRequestPath( route.getRepositoryPath() );
      route.getTargetedRepository().storeItem( request, is, userAttributes );
    }
    finally
    {
      request.popRequestPath();
    }
  }
  else
  {
    // this is "above" repositories
    throw new IllegalRequestException( request, "The path '" + request.getRequestPath()
      + "' does not points to any repository!" );
  }
}

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

toRoute.getTargetedRepository().storeItem( to, ( (StorageFileItem) item ).getInputStream(),
  item.getRepositoryItemAttributes().asMap() );

相关文章