@Override protected void processFileItem(final WalkerContext context, final StorageFileItem item) throws Exception { if (!item.getPath().equals("/" + Yum.PATH_OF_REPOMD_XML) && !locations.contains(item.getPath().substring(1))) { log.trace("Removing obsolete {}:{}", repository.getId(), item.getPath()); repository.deleteItem(true, item.getResourceStoreRequest()); } } });
@Override protected void setItemAttributes(final StorageFileItem item, final RequestContext context, final P2GroupRepository repository) { if (P2Constants.ARTIFACTS_JAR.equals(item.getPath()) || P2Constants.ARTIFACTS_XML.equals(item.getPath())) { item.getRepositoryItemAttributes().putAll(getMemberHash(P2Constants.ARTIFACTS_XML, context, repository)); } else if (P2Constants.CONTENT_JAR.equals(item.getPath()) || P2Constants.CONTENT_XML.equals(item.getPath())) { item.getRepositoryItemAttributes().putAll(getMemberHash(P2Constants.CONTENT_XML, context, repository)); } }
private Map<String, StorageItem> cacheMetadataItems(final Map<String, StorageFileItem> metadataItems, final RequestContext context, final E repository) throws IOException { Map<String, StorageItem> cached = Maps.newHashMap(); for (Entry<String, StorageFileItem> entry : metadataItems.entrySet()) { setItemAttributes(entry.getValue(), context, repository); log.debug("Repository " + repository.getId() + ": Created metadata item " + entry.getValue().getPath()); cached.put(entry.getKey(), doCacheItem(entry.getValue(), repository)); } return cached; }
protected Map<String, StorageItem> doRetrieveArtifactsItems(final RequestContext context, final E repository) throws IOException, ItemNotFoundException { final Map<String, StorageFileItem> fileItems = doRetrieveArtifactsFileItems(context, repository); try { log.debug("Repository " + repository.getId() + ": Deleting p2 artifacts metadata items."); for (StorageFileItem fileItem : fileItems.values()) { deleteItemSilently(repository, new ResourceStoreRequest(fileItem.getPath())); } return cacheMetadataItems(fileItems, context, repository); } catch (final IOException e) { throw new LocalStorageException(e.getMessage(), e); } }
protected Map<String, StorageItem> doRetrieveContentItems(final RequestContext context, final E repository) throws IOException, ItemNotFoundException { final Map<String, StorageFileItem> fileItems = doRetrieveContentFileItems(context, repository); try { log.debug("Repository " + repository.getId() + ": Deleting p2 content metadata items."); for (StorageFileItem fileItem : fileItems.values()) { deleteItemSilently(repository, new ResourceStoreRequest(fileItem.getPath())); } return cacheMetadataItems(fileItems, context, repository); } catch (final IOException e) { throw new LocalStorageException(e.getMessage(), e); } }
@Override public void processFileItem( WalkerContext ctx, StorageFileItem item ) throws StorageException { // expiring found files try { if ( item.getLastRequested() < getTimestamp() ) { doDelete( ctx, item ); getFiles().add( item.getPath() ); } } catch ( IllegalOperationException e ) { // simply stop if set during processing ctx.stop( e ); } catch ( UnsupportedStorageOperationException e ) { // if op not supported (R/O repo?) ctx.stop( e ); } catch ( ItemNotFoundException e ) { // will not happen } }
final String filePath = file.getPath().toLowerCase(); if ( filePath.endsWith( ".pom" ) )
ai.setPath(pomItem.getPath()); ai.setRemoteUrl(pomItem.getRemoteUrl());