@VisibleForTesting StringBuilder ua( final RemoteStorageContext ctx, final ProxyRepository repository ) { final StringBuilder buf = new StringBuilder( getUserAgentPlatformInfo() ); if ( repository != null ) { final RemoteRepositoryStorage rrs = repository.getRemoteStorage(); buf.append( " " ).append( rrs.getProviderId() ).append( "/" ).append( rrs.getVersion() ); } // user customization RemoteConnectionSettings remoteConnectionSettings = ctx.getRemoteConnectionSettings(); if ( !StringUtils.isEmpty( remoteConnectionSettings.getUserAgentCustomizationString() ) ) { buf.append( " " ).append( remoteConnectionSettings.getUserAgentCustomizationString() ); } // plugin customization for ( UserAgentContributor contributor : contributors ) { final String contribution = contributor.getUserAgent( ctx, repository ); if ( !StringUtils.isEmpty( contribution ) ) { buf.append( " " ).append( contribution ); } } return buf; }
prepository.getRemoteStorage().getProviderId() ) )
private DefaultStorageFileItem doRetriveRemoteChecksumItem( ProxyRepository proxy, ResourceStoreRequest request ) throws ItemNotFoundException { try { return (DefaultStorageFileItem) proxy.getRemoteStorage().retrieveItem( proxy, request, proxy.getRemoteUrl() ); } catch ( RemoteAccessException e ) { throw new ItemNotFoundException( request, proxy, e ); } catch ( RemoteStorageException e ) { throw new ItemNotFoundException( request, proxy, e ); } } }
(StorageFileItem) proxy.getRemoteStorage().retrieveItem( proxy, req, proxy.getRemoteUrl() );
public InputStream retrieve(String name) throws IOException { TaskUtil.checkInterruption(); ResourceStoreRequest req = new ResourceStoreRequest(PUBLISHING_PATH_PREFIX + "/" + name); try { StorageFileItem item = null; // XXX: ensure it goes to remote only and throws FileNotFoundException if nothing found on remote // kinda turn off transparent proxying for this method // We need to use ProxyRepository and get it's RemoteStorage stuff to completely // avoid "transparent" proxying, and even the slightest possibility to return // some stale file from cache to the updater. if (ISPROXY(repository) && REMOTEACCESSALLOWED(repository)) { item = (StorageFileItem) repository.getRemoteStorage() .retrieveItem(repository, req, repository.getRemoteUrl()); } else { throw new ItemNotFoundException(req, repository); } return item.getInputStream(); } catch (ItemNotFoundException ex) { final FileNotFoundException fne = new FileNotFoundException(name + " (remote item not found)"); fne.initCause(ex); throw fne; } } });
RemoteRepositoryStorage oldRemoteStorage = prepository.getRemoteStorage();