FileDocCategorySizeDatePackage
RPObject.javaAPI DocAzureus 3.0.3.45836Tue Jan 10 13:50:50 GMT 2006org.gudy.azureus2.pluginsimpl.remote

RPObject

public class RPObject extends Object implements Serializable
author
parg

Fields Summary
protected static Map
object_registry
protected static Map
object_registry_reverse
protected static long
next_key
public Long
_object_id
protected transient Object
__delegate
protected transient RPRequestDispatcher
_dispatcher
private transient Class
plugin_class
Constructors Summary
public RPObject()

    
protected RPObject(Object key)

        synchronized( object_registry ){

            RPObject    existing = (RPObject)object_registry.get(key);

            if ( existing != null ){

                _object_id  = existing._object_id;

            }else{

                _object_id  = new Long(next_key++);

                object_registry.put( key, this );

                object_registry_reverse.put( _object_id, key );
            }
        }

        __delegate  = key;

        _setDelegate( __delegate );
    
Methods Summary
protected java.lang.Object_fixupLocal()

        Object  res = object_registry_reverse.get( _object_id );

        if ( res == null ){
            throw new RPObjectNoLongerExistsException();
        }


        _setDelegate( res );

        return( res );
    
public java.lang.Object_getDelegate()

        return( __delegate );
    
public java.lang.String_getName()

        String  str = this.getClass().getName();

        int dp = str.lastIndexOf('.");

        if ( dp != -1 ){

            str = str.substring(dp+1);
        }

        if ( str.startsWith("RP")){

            str = str.substring(2);
        }

        return( str );
    
public long_getOID()

        return( _object_id.longValue());
    
public java.lang.Class_getPluginClass()

        if (plugin_class == null) {
            plugin_class = RPUtils.getPluginAPIInterfaceForClass(this.__delegate.getClass());
            if (plugin_class == null) {
                /* Shouldn't happen */
                throw new RuntimeException("no plugin class for " + RPUtils.describeObject(this.__delegate));
            }
        }
        return plugin_class;
    
protected static org.gudy.azureus2.pluginsimpl.remote.RPObject_lookupLocal(java.lang.Object key)


    // **** Don't try using AEMOnitor for synchronisations here as this object is serialised

      
    
               
    
        synchronized( object_registry ){

            RPObject    res = (RPObject)object_registry.get(key);

            if ( res != null ){

                res._setLocal();
            }

            return( res );
        }
    
public static org.gudy.azureus2.pluginsimpl.remote.RPObject_lookupLocal(long object_id)

        synchronized( object_registry ){

            Object  res = object_registry_reverse.get( new Long(object_id ));

            if ( res == null ){
                throw new RPObjectNoLongerExistsException();
            }

            RPObject obj = (RPObject)object_registry.get( res );
            if (obj == null){
                throw new RPObjectNoLongerExistsException();
            }

            return( obj );
        }
    
public RPReply_process(RPRequest request)

        throw( new RuntimeException( "you've got to implement this - " + request ));
    
public void_refresh()

        RPObject    res = (RPObject)_dispatcher.dispatch( new RPRequest( this, "_refresh", null )).getResponse();

        _setDelegate( res );
    
protected void_setDelegate(java.lang.Object _delegate)

        throw( new RuntimeException( "you've got to implement this - " + _delegate ));
    
public java.lang.Object_setLocal()

        throw( new RuntimeException( "you've got to implement this"));
    
public void_setRemote(RPRequestDispatcher __dispatcher)

        _dispatcher = __dispatcher;
    
protected RPRequestDispatchergetDispatcher()

        return( _dispatcher );
    
public voidnotSupported()

        throw( new RuntimeException( "RPObject:: method not supported"));
    
public voidnotSupported(java.lang.Object o)

        throw( new RuntimeException( "RPObject:: method not supported - " + o ));
    
public java.lang.StringtoString()

        return RPUtils.getName(this.getClass()) + "@" + Integer.toHexString(System.identityHashCode(this));