public void setRemoteAuthenticationSettings( RemoteAuthenticationSettings settings ) { getRemoteStorageContext().setRemoteAuthenticationSettings( settings ); if ( getProxyMode() != null && getProxyMode().shouldAutoUnblock() ) { // perm changes? retry if autoBlocked setProxyMode( ProxyMode.ALLOW ); } }
public void setRemoteProxySettings( RemoteProxySettings settings ) { getRemoteStorageContext().setRemoteProxySettings( settings ); if ( getProxyMode() != null && getProxyMode().shouldAutoUnblock() ) { // perm changes? retry if autoBlocked setProxyMode( ProxyMode.ALLOW ); } }
/** * Beside original behavior, only add to NFC when we are not in BLOCKED mode. * * @since 2.0 */ @Override protected boolean shouldAddToNotFoundCache( final ResourceStoreRequest request ) { boolean shouldAddToNFC = super.shouldAddToNotFoundCache( request ); if ( shouldAddToNFC ) { shouldAddToNFC = getProxyMode() == null || getProxyMode().shouldProxy(); if ( !shouldAddToNFC && getLogger().isDebugEnabled() ) { getLogger().debug( String.format( "Proxy repository '%s' is is not allowed to issue remote requests (%s), not adding path '%s' to NFC", getId(), getProxyMode(), request.getRequestPath() ) ); } } return shouldAddToNFC; }
public RemoteStatus getRemoteStatus( ResourceStoreRequest request, boolean forceCheck ) { // if the last known status is old, simply reset it if ( forceCheck || System.currentTimeMillis() - remoteStatusUpdated > REMOTE_STATUS_RETAIN_TIME ) { remoteStatus = RemoteStatus.UNKNOWN; } if ( getProxyMode() != null && RemoteStatus.UNKNOWN.equals( remoteStatus ) && !_remoteStatusChecking ) { // check for thread and go check it _remoteStatusChecking = true; poolManager.getRepositoryThreadPool( this ).submit( new RemoteStatusUpdateCallable( request ) ); } return remoteStatus; }
public void setAutoBlockActive( boolean val ) { // NEXUS-3516: if user disables autoblock, and repo is auto-blocked, unblock it if ( !val && ProxyMode.BLOCKED_AUTO.equals( getProxyMode() ) ) { getLogger().warn( String.format( "Proxy Repository %s was auto-blocked, but user disabled this feature. Unblocking repository, but this MAY cause Nexus to leak connections (if remote repository is still down)!", RepositoryStringUtils.getHumanizedNameString( this ) ) ); setProxyMode( ProxyMode.ALLOW ); } getExternalConfiguration( true ).setAutoBlockActive( val ); }
/** * This method should be called by AbstractProxyRepository and it's descendants only. Since this method modifies the * ProxyMode property of this repository, and this property is part of configuration, this call will result in * configuration flush too (potentially saving any other unsaved changes)! */ protected void autoUnBlockProxying() { setRemoteStatus( RemoteStatus.AVAILABLE, null ); ProxyMode oldProxyMode = getProxyMode(); if ( oldProxyMode.shouldAutoUnblock() ) { // log the event getLogger().warn( String.format( "Remote peer of proxy repository %s detected as healthy, un-blocking the proxy repository (it was AutoBlocked by Nexus).", RepositoryStringUtils.getHumanizedNameString( this ) ) ); setProxyMode( ProxyMode.ALLOW, true, null ); } // NEXUS-3552: Do NOT save configuration, just make it applied (see setProxyMode() how it is done) // try // { // getApplicationConfiguration().saveConfiguration(); // } // catch ( IOException e ) // { // getLogger().warn( // "Cannot save configuration after AutoBlocking repository \"" + getName() + "\" (id=" + getId() + ")", e ); // } }
ProxyMode oldProxyMode = getProxyMode();
db.append( ", remoteOnly=" ).append( request.isRequestRemoteOnly() ); if ( getProxyMode() != null ) db.append( ", ProxyMode=" + getProxyMode().toString() );
boolean shouldProxy = !request.isRequestLocalOnly() && getProxyMode() != null && getProxyMode().shouldProxy();
if ( !getProxyMode().shouldCheckRemoteStatus() )
ProxyMode oldProxyMode = getProxyMode();