FileDocCategorySizeDatePackage
PasswordParameterImpl.javaAPI DocAzureus 3.0.3.42539Thu Feb 09 19:43:14 GMT 2006org.gudy.azureus2.pluginsimpl.local.ui.config

PasswordParameterImpl

public class PasswordParameterImpl extends ParameterImpl implements org.gudy.azureus2.plugins.ui.config.PasswordParameter
author
parg

Fields Summary
protected byte[]
defaultValue
protected int
encoding_type
Constructors Summary
public PasswordParameterImpl(org.gudy.azureus2.plugins.PluginConfig config, String key, String label, int _encoding_type, byte[] _defaultValue)

 
		super(config,key, label);
		
		if ( _defaultValue == null ){
			
			defaultValue = new byte[0];
			
		}else{
			
			defaultValue = _defaultValue;

			if ( _encoding_type == ET_SHA1 ){
				
		        SHA1Hasher hasher = new SHA1Hasher();
		        
		        defaultValue = hasher.calculateHash(defaultValue);
		        
			}else if ( _encoding_type == ET_MD5 ){
				
				try{
					defaultValue = MessageDigest.getInstance( "md5").digest( defaultValue );
					
				}catch( Throwable e ){
					
					Debug.printStackTrace(e);
				}
			}
		}
		
		COConfigurationManager.setByteDefault( getKey(), defaultValue );

		encoding_type	= _encoding_type;
	
Methods Summary
public byte[]getDefaultValue()

		return defaultValue;
	
public intgetEncodingType()

		return( encoding_type );
	
public byte[]getValue()

		return( config.getByteParameter( getKey(), getDefaultValue()));