public CRemoteHttpProxySettings convertToModel( RemoteProxySettings settings ) { if ( settings == null ) { return null; } else { CRemoteHttpProxySettings model = new CRemoteHttpProxySettings(); model.setBlockInheritance( settings.isBlockInheritance() ); model.setProxyHostname( settings.getHostname() ); model.setProxyPort( settings.getPort() ); model.setAuthentication( authenticationInfoConverter.convertToModel( settings.getProxyAuthentication() ) ); model.setNonProxyHosts( new ArrayList<String>(settings.getNonProxyHosts() ) ); return model; } }
/** * Externalized Nexus object to DTO's conversion. * * @param resource */ public static RemoteHttpProxySettings convert( CRemoteHttpProxySettings settings ) { if ( settings == null ) { return null; } RemoteHttpProxySettings result = new RemoteHttpProxySettings(); result.setProxyHostname( settings.getProxyHostname() ); result.setProxyPort( settings.getProxyPort() ); result.setAuthentication( convert( settings.getAuthentication() ) ); result.setNonProxyHosts( settings.getNonProxyHosts() ); return result; }
public boolean isBlockInheritance() { if ( isEnabled() ) { return getCurrentConfiguration( false ).isBlockInheritance(); } return false; }
@Override protected void copyTransients( Object source, Object destination ) { super.copyTransients( source, destination ); // we need to manually set the authentication to null here, because of flawed overlay, where null objects do NOT // overwrite non-null objects if ( ( (CRemoteHttpProxySettings) source ).getAuthentication() == null ) { ( (CRemoteHttpProxySettings) destination ).setAuthentication( null ); } } }
protected CRemoteHttpProxySettings convertHttpProxySettings( RemoteHttpProxySettings remoteHttpProxySettings, String oldPassword ) { if ( remoteHttpProxySettings == null ) { return null; } CRemoteHttpProxySettings httpProxySettings = new CRemoteHttpProxySettings(); httpProxySettings.setProxyHostname( remoteHttpProxySettings.getProxyHostname() ); httpProxySettings.setProxyPort( remoteHttpProxySettings.getProxyPort() ); httpProxySettings.setAuthentication( convertAuthentication( remoteHttpProxySettings.getAuthentication(), oldPassword ) ); return httpProxySettings; }
/** * Externalized Nexus object to DTO's conversion. */ public static RemoteHttpProxySettingsDTO convert(CRemoteHttpProxySettings settings) { if (settings == null) { return null; } final RemoteHttpProxySettingsDTO result = new RemoteHttpProxySettingsDTO(); result.setProxyHostname(settings.getProxyHostname()); result.setProxyPort(settings.getProxyPort()); result.setAuthentication(convert(settings.getAuthentication())); return result; }
/** * Method upgradeCRemoteHttpProxySettings. * * @param cRemoteHttpProxySettings * @param value * @return CRemoteHttpProxySettings */ public org.sonatype.nexus.configuration.model.CRemoteHttpProxySettings upgradeCRemoteHttpProxySettings( org.sonatype.nexus.configuration.model.v2_7_0.CRemoteHttpProxySettings cRemoteHttpProxySettings, org.sonatype.nexus.configuration.model.CRemoteHttpProxySettings value ) { if ( cRemoteHttpProxySettings == null ) { return null; } // Convert field proxyHostname value.setProxyHostname( cRemoteHttpProxySettings.getProxyHostname() ); // Convert field proxyPort value.setProxyPort( cRemoteHttpProxySettings.getProxyPort() ); value.setAuthentication( upgradeCRemoteAuthentication( cRemoteHttpProxySettings.getAuthentication() ) ); return value; } //-- org.sonatype.nexus.configuration.model.CRemoteHttpProxySettings upgradeCRemoteHttpProxySettings( org.sonatype.nexus.configuration.model.v2_7_0.CRemoteHttpProxySettings, org.sonatype.nexus.configuration.model.CRemoteHttpProxySettings )
public ValidationResponse validateRemoteHttpProxySettings( ApplicationValidationContext ctx, CRemoteHttpProxySettings settings ) { ValidationResponse response = new ApplicationValidationResponse(); if ( ctx != null ) { response.setContext( ctx ); } if ( settings.getProxyPort() < 1 || settings.getProxyPort() > 65535 ) { response.addValidationError( "The proxy port must be an integer between 1 and 65535!" ); } response.append( validateRemoteAuthentication( ctx, settings.getAuthentication() ) ); return response; }
repoConfig.getRemoteStorage().setHttpProxySettings( new CRemoteHttpProxySettings() ); repoConfig.getRemoteStorage().getHttpProxySettings().setBlockInheritance( true );
/** * Method upgradeCRemoteHttpProxySettings. * * @param cRemoteHttpProxySettings * @return CRemoteHttpProxySettings */ public org.sonatype.nexus.configuration.model.CRemoteHttpProxySettings upgradeCRemoteHttpProxySettings( org.sonatype.nexus.configuration.model.v2_7_0.CRemoteHttpProxySettings cRemoteHttpProxySettings ) { return upgradeCRemoteHttpProxySettings( cRemoteHttpProxySettings, new org.sonatype.nexus.configuration.model.CRemoteHttpProxySettings() ); } //-- org.sonatype.nexus.configuration.model.CRemoteHttpProxySettings upgradeCRemoteHttpProxySettings( org.sonatype.nexus.configuration.model.v2_7_0.CRemoteHttpProxySettings )
public RemoteAuthenticationSettings getProxyAuthentication() { if ( isEnabled() ) { try { return authenticationInfoConverter.convertAndValidateFromModel( getCurrentConfiguration( false ) .getAuthentication() ); } catch ( ConfigurationException e ) { // FIXME: what here?? setProxyAuthentication( null ); return null; } } return null; }
public String getHostname() { if ( isEnabled() ) { return getCurrentConfiguration( false ).getProxyHostname(); } return null; }
public int getPort() { if ( isEnabled() ) { return getCurrentConfiguration( false ).getProxyPort(); } return -1; }
public void setPort( int port ) { if ( !isEnabled() ) { initConfig(); } getCurrentConfiguration( true ).setProxyPort( port ); }
public void setHostname( String hostname ) { if ( !isEnabled() ) { initConfig(); } getCurrentConfiguration( true ).setProxyHostname( hostname ); }
public void setProxyAuthentication( RemoteAuthenticationSettings proxyAuthentication ) { if ( !isEnabled() ) { initConfig(); } getCurrentConfiguration( true ).setAuthentication( authenticationInfoConverter .convertToModel( proxyAuthentication ) ); }
public Set<String> getNonProxyHosts() { if ( isEnabled() ) { return new HashSet<String>( getCurrentConfiguration( false ).getNonProxyHosts() ); } return Collections.emptySet(); }
public void setBlockInheritance( boolean val ) { if ( !isEnabled() ) { initConfig(); } getCurrentConfiguration( true ).setBlockInheritance( val ); }
CRemoteHttpProxySettings cRemoteHttpProxySettings = new CRemoteHttpProxySettings(); for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) cRemoteHttpProxySettings.setProxyHostname( getTrimmedValue( parser.nextText() ) ); cRemoteHttpProxySettings.setProxyPort( getIntegerValue( getTrimmedValue( parser.nextText() ), "proxyPort", parser, strict ) ); cRemoteHttpProxySettings.setAuthentication( parseCRemoteAuthentication( parser, strict ) );
/** * Method writeCRemoteHttpProxySettings. * * @param cRemoteHttpProxySettings * @param serializer * @param tagName * @throws java.io.IOException */ private void writeCRemoteHttpProxySettings( CRemoteHttpProxySettings cRemoteHttpProxySettings, String tagName, XmlSerializer serializer ) throws java.io.IOException { serializer.startTag( NAMESPACE, tagName ); if ( cRemoteHttpProxySettings.getProxyHostname() != null ) { serializer.startTag( NAMESPACE, "proxyHostname" ).text( cRemoteHttpProxySettings.getProxyHostname() ).endTag( NAMESPACE, "proxyHostname" ); } if ( cRemoteHttpProxySettings.getProxyPort() != 0 ) { serializer.startTag( NAMESPACE, "proxyPort" ).text( String.valueOf( cRemoteHttpProxySettings.getProxyPort() ) ).endTag( NAMESPACE, "proxyPort" ); } if ( cRemoteHttpProxySettings.getAuthentication() != null ) { writeCRemoteAuthentication( (CRemoteAuthentication) cRemoteHttpProxySettings.getAuthentication(), "authentication", serializer ); } serializer.endTag( NAMESPACE, tagName ); } //-- void writeCRemoteHttpProxySettings( CRemoteHttpProxySettings, String, XmlSerializer )