/** * Returns {@code true} if only and only if we are positive that remote peer (remote URL of passed in * ProxyRepository) points to a remote repository that is hosted by Amazon S3 Storage. This method will return false * as long as we don't make very 1st HTTP request to remote peer. After that 1st request, we retain the status until * ProxyRepository configuration changes. See NEXUS-3338 for more. * * @param repository that needs to be checked. * @return true only if we know that ProxyRepository in question points to Amazon S3 storage. * @throws RemoteStorageException in case of some error. */ public boolean isRemotePeerAmazonS3Storage( final ProxyRepository repository ) throws RemoteStorageException { RemoteStorageContext ctx = getRemoteStorageContext( repository ); // it is S3 if we have CTX_KEY_S3_FLAG set, the flag value is not null, and flag value is true // if flag is False, we know it is not S3 // if flag is null, we still did not contact remote, so we were not able to tell yet return ctx.hasContextObject( getS3FlagKey() ) && ( (DefaultRemoteStorageContext.BooleanFlagHolder) ctx.getContextObject( getS3FlagKey() ) ).isFlag(); }