FileDocCategorySizeDatePackage
RPPluginConfig.javaAPI DocAzureus 3.0.3.413356Wed Feb 07 12:00:48 GMT 2007org.gudy.azureus2.pluginsimpl.remote

RPPluginConfig

public class RPPluginConfig extends RPObject implements PluginConfig
author
parg

Fields Summary
protected transient PluginConfig
delegate
protected transient Properties
property_cache
public String[]
cached_property_names
public Object[]
cached_property_values
Constructors Summary
protected RPPluginConfig(PluginConfig _delegate)

		super( _delegate );
	
Methods Summary
public RPReply_process(RPRequest request)

		String	method = request.getMethod();
		
		Object[] params = (Object[])request.getParams();
		
		if ( method.equals( "getPluginIntParameter[String,int]")){
			
			return( new RPReply( new Integer( delegate.getPluginIntParameter((String)params[0],((Integer)params[1]).intValue()))));
			
		}else if ( method.equals( "getPluginStringParameter[String,String]")){
				
			return( new RPReply( delegate.getPluginStringParameter((String)params[0],(String)params[1])));
		
		}else if ( method.equals( "setPluginParameter[String,int]")){
				
			delegate.setPluginParameter((String)params[0],((Integer)params[1]).intValue());
				
			return( null );
			
		}else if ( 	method.equals( "getIntParameter[String,int]") ||
				 	method.equals( "getParameter[String,int]")){
				
			return( new RPReply( new Integer( delegate.getIntParameter((String)params[0],((Integer)params[1]).intValue()))));
				
		}else if ( method.equals( "setParameter[String,int]")){
					
			delegate.setIntParameter((String)params[0],((Integer)params[1]).intValue());
			
			return( null );
			
		}else if ( method.equals( "save")){
			
			try{ 
				delegate.save();
				
				return( null );
				
			}catch( PluginException e ){
				
				return( new RPReply( e ));
			}
		}			
	
			
		throw( new RPException( "Unknown method: " + method ));
	
protected void_setDelegate(java.lang.Object _delegate)

		delegate = (PluginConfig)_delegate;
		
		cached_property_names 	= new String[]{
				CORE_PARAM_INT_MAX_UPLOAD_SPEED_KBYTES_PER_SEC,
				CORE_PARAM_INT_MAX_UPLOAD_SPEED_SEEDING_KBYTES_PER_SEC,
				CORE_PARAM_INT_MAX_DOWNLOAD_SPEED_KBYTES_PER_SEC,
				CORE_PARAM_INT_MAX_CONNECTIONS_PER_TORRENT,
				CORE_PARAM_INT_MAX_CONNECTIONS_GLOBAL,
				CORE_PARAM_INT_MAX_DOWNLOADS,
				CORE_PARAM_INT_MAX_ACTIVE,
				CORE_PARAM_INT_MAX_ACTIVE_SEEDING,
				CORE_PARAM_INT_MAX_UPLOADS,
				CORE_PARAM_INT_MAX_UPLOADS_SEEDING
			};
		
		cached_property_values 	= new Object[]{
				new Integer( delegate.getIntParameter( cached_property_names[0] )),
				new Integer( delegate.getIntParameter( cached_property_names[1] )),
				new Integer( delegate.getIntParameter( cached_property_names[2] )),
				new Integer( delegate.getIntParameter( cached_property_names[3] )),
				new Integer( delegate.getIntParameter( cached_property_names[4] )),
				new Integer( delegate.getIntParameter( cached_property_names[5] )),
				new Integer( delegate.getIntParameter( cached_property_names[6] )),
				new Integer( delegate.getIntParameter( cached_property_names[7] )),
				new Integer( delegate.getIntParameter( cached_property_names[8] )),
				new Integer( delegate.getIntParameter( cached_property_names[9] ))
		};		
	
public java.lang.Object_setLocal()

		return( _fixupLocal());
	
public void_setRemote(RPRequestDispatcher _dispatcher)

		super._setRemote( _dispatcher );
		
		property_cache	= new Properties();
		
		for (int i=0;i<cached_property_names.length;i++){
			
			// System.out.println( "cache:" + cached_property_names[i] + "=" + cached_property_values[i] );
			
			property_cache.put(cached_property_names[i],cached_property_values[i]);
		}
	
public voidaddListener(PluginConfigListener l)

			notSupported();
		
public static PluginConfigcreate(PluginConfig _delegate)

		RPPluginConfig	res =(RPPluginConfig)_lookupLocal( _delegate );
		
		if ( res == null ){
			
			res = new RPPluginConfig( _delegate );
		}
			
		return( res );
	
public booleangetBooleanParameter(java.lang.String key)

	
	  	notSupported();
	  	
	  	return(false);
	  
public booleangetBooleanParameter(java.lang.String key, boolean _default)

	  	notSupported();
	  	
	  	return( false );
	  
public byte[]getByteParameter(java.lang.String name, byte[] _default)

	  	notSupported();
	  	
	  	return( null );
	  
public byte[]getByteParameter(java.lang.String key)

notSupported(); return null;
public floatgetFloatParameter(java.lang.String key, float default_value)

notSupported(); return 0;
public floatgetFloatParameter(java.lang.String key)

	  	notSupported();
	  	
	  	return(0);
    
public intgetIntParameter(java.lang.String key)

	  	notSupported();
	  	
	  	return(0);
	  
public intgetIntParameter(java.lang.String key, int default_value)

		Integer	res = (Integer)property_cache.get( key );
		
		if ( res == null ){
			
			res = (Integer)_dispatcher.dispatch( new RPRequest( this, "getIntParameter[String,int]", new Object[]{key,new Integer(default_value)} )).getResponse();
		}
		
		return( res.intValue());
	  
public longgetLongParameter(java.lang.String key)

notSupported(); return 0;
public longgetLongParameter(java.lang.String key, long default_value)

notSupported(); return 0;
public org.gudy.azureus2.plugins.config.ConfigParametergetParameter(java.lang.String key)

	  	notSupported();
	  	
	  	return( null );
	  
public booleangetPluginBooleanParameter(java.lang.String key)

	  	notSupported();
	  	
	  	return(false);
	  
public booleangetPluginBooleanParameter(java.lang.String key, boolean defaultValue)

	  	notSupported();
	  	
	  	return(false);
	  
public byte[]getPluginByteParameter(java.lang.String key, byte[] defaultValue)

	  	notSupported();
	  	
	  	return(null);
	  
public byte[]getPluginByteParameter(java.lang.String key)

notSupported(); return null;
public java.lang.StringgetPluginConfigKeyPrefix()

	  	notSupported();
	  	
	  	return(null);
	
public floatgetPluginFloatParameter(java.lang.String key)

notSupported(); return 0;
public floatgetPluginFloatParameter(java.lang.String key, float default_value)

notSupported(); return 0;
public intgetPluginIntParameter(java.lang.String key)

	
	  	notSupported();
	  	
	  	return(0);
	  
public intgetPluginIntParameter(java.lang.String key, int defaultValue)

		Integer	res = (Integer)_dispatcher.dispatch( new RPRequest( this, "getPluginIntParameter[String,int]", new Object[]{key,new Integer(defaultValue)} )).getResponse();
		
		return( res.intValue());
	  
public java.util.ListgetPluginListParameter(java.lang.String key, java.util.List default_value)

		  	notSupported();
		  	
		  	return( null );		  
	  
public longgetPluginLongParameter(java.lang.String key)

notSupported(); return 0;
public longgetPluginLongParameter(java.lang.String key, long default_value)

notSupported(); return 0;
public java.util.MapgetPluginMapParameter(java.lang.String key, java.util.Map default_value)

		  	notSupported();
		  	
		  	return( null );		  
	  
public org.gudy.azureus2.plugins.config.ConfigParametergetPluginParameter(java.lang.String key)

	  	notSupported();
	  	
	  	return( null );
	  
public java.lang.StringgetPluginStringParameter(java.lang.String key)

	  	notSupported();
	  	
	  	return(null);
	  
public java.lang.StringgetPluginStringParameter(java.lang.String key, java.lang.String defaultValue)

		String	res = (String)_dispatcher.dispatch( new RPRequest( this, "getPluginStringParameter[String,String]", new Object[]{key,defaultValue} )).getResponse();
		
		return( res );
	  
public java.io.FilegetPluginUserFile(java.lang.String name)

			notSupported();
			
			return( null );
		
public java.lang.StringgetStringParameter(java.lang.String key)

	  	notSupported();
	  	
	  	return(null);
	  
public java.lang.StringgetStringParameter(java.lang.String name, java.lang.String _default)

	  	notSupported();
	  	
	  	return(null);
	  
public booleangetUnsafeBooleanParameter(java.lang.String key, boolean default_value)

		  notSupported();

		  return( false );
	  
public booleangetUnsafeBooleanParameter(java.lang.String key)

notSupported(); return false;
public byte[]getUnsafeByteParameter(java.lang.String key)

notSupported(); return null;
public byte[]getUnsafeByteParameter(java.lang.String key, byte[] default_value)

notSupported(); return null;
public floatgetUnsafeFloatParameter(java.lang.String key, float default_value)

		  notSupported();

		  return( 0 );
	  
public floatgetUnsafeFloatParameter(java.lang.String key)

notSupported(); return 0;
public intgetUnsafeIntParameter(java.lang.String key, int default_value)

		  notSupported();

		  return( 0 );
	  
public intgetUnsafeIntParameter(java.lang.String key)

notSupported(); return 0;
public longgetUnsafeLongParameter(java.lang.String key, long default_value)

		  notSupported();

		  return( 0 );
	  
public longgetUnsafeLongParameter(java.lang.String key)

notSupported(); return 0;
public java.util.MapgetUnsafeParameterList()

		  notSupported();

		  return( null );
	  
public java.lang.StringgetUnsafeStringParameter(java.lang.String key, java.lang.String default_value)

		  notSupported();

		  return( null );
	  
public java.lang.StringgetUnsafeStringParameter(java.lang.String key)

notSupported(); return null;
public booleanhasParameter(java.lang.String x)

notSupported(); return false;
public booleanhasPluginParameter(java.lang.String x)

notSupported(); return false;
public booleanisNewInstall()

	  	notSupported();
	  	
	  	return( false );
	
public booleanremovePluginParameter(java.lang.String x)

notSupported(); return false;
public voidsave()

	  	try{
	  		_dispatcher.dispatch( new RPRequest( this, "save", null)).getResponse();
	  		
		}catch( RPException e ){
			
			Throwable cause = e.getCause();
			
			if ( cause instanceof PluginException ){
				
				throw((PluginException)cause);
			}
			
			throw( e );
		}
	  
public voidsetBooleanParameter(java.lang.String key, boolean value)

	
	  	notSupported();
	  
public voidsetByteParameter(java.lang.String key, byte[] value)

notSupported();
public voidsetFloatParameter(java.lang.String key, float value)

notSupported();
public voidsetIntParameter(java.lang.String key, int value)

	  	property_cache.put( key, new Integer( value ));
	  	
		_dispatcher.dispatch( new RPRequest( this, "setParameter[String,int]", new Object[]{key,new Integer(value)} )).getResponse();
	  
public voidsetLongParameter(java.lang.String key, long value)

notSupported();
public voidsetPluginConfigKeyPrefix(java.lang.String _key)

			// TODO Auto-generated method stub
			
		
public voidsetPluginListParameter(java.lang.String key, java.util.List value)

		  notSupported();
	  
public voidsetPluginMapParameter(java.lang.String key, java.util.Map value)

		  notSupported();
	  
public voidsetPluginParameter(java.lang.String key, int value)

		_dispatcher.dispatch( new RPRequest( this, "setPluginParameter[String,int]", new Object[]{key,new Integer(value)} ));
	  
public voidsetPluginParameter(java.lang.String key, int value, boolean global)

		  notSupported();
	  
public voidsetPluginParameter(java.lang.String key, java.lang.String value)

	  	
	  	notSupported();
	  
public voidsetPluginParameter(java.lang.String key, boolean value)

  	
	  	notSupported();
	  
public voidsetPluginParameter(java.lang.String key, byte[] value)

	  	notSupported();
	  
public voidsetPluginParameter(java.lang.String key, float value)

notSupported();
public voidsetPluginParameter(java.lang.String key, long value)

notSupported();
public voidsetStringParameter(java.lang.String key, java.lang.String value)

notSupported();
public voidsetUnsafeBooleanParameter(java.lang.String key, boolean value)

		  notSupported();
	  
public voidsetUnsafeByteParameter(java.lang.String key, byte[] value)

notSupported();
public voidsetUnsafeFloatParameter(java.lang.String key, float value)

		  notSupported();
	  
public voidsetUnsafeIntParameter(java.lang.String key, int value)

		  notSupported();
	  
public voidsetUnsafeLongParameter(java.lang.String key, long value)

		  notSupported();
	  
public voidsetUnsafeStringParameter(java.lang.String key, java.lang.String value)

		  notSupported();