com.sun.jini.fiddler
Class FiddlerProxy

java.lang.Object
  extended by com.sun.jini.fiddler.FiddlerProxy
All Implemented Interfaces:
Serializable, Administrable, LookupDiscoveryService, ReferentUuid
Direct Known Subclasses:
FiddlerProxy.ConstrainableFiddlerProxy

 class FiddlerProxy
extends Object
implements Administrable, LookupDiscoveryService, ReferentUuid, Serializable

This class is a proxy for a lookup discovery service. Clients only see instances of this class via the LookupDiscoveryService interface (and the FiddlerAdmin interface if needed).

Author:
Sun Microsystems, Inc.

Nested Class Summary
(package private) static class FiddlerProxy.ConstrainableFiddlerProxy
          The constrainable version of the class FiddlerProxy.
 
Field Summary
(package private)  Uuid proxyID
          The unique identifier assigned to the current instance of this proxy class by the lookup discovery service.
private static long serialVersionUID
           
(package private)  Fiddler server
          The reference through which communication occurs between the client-side and the server-side of the lookup discovery service
 
Constructor Summary
private FiddlerProxy(Fiddler server, Uuid proxyID)
          Constructs a new instance of FiddlerProxy.
 
Method Summary
static FiddlerProxy createServiceProxy(Fiddler server, Uuid proxyID)
          Public static factory method that creates and returns an instance of FiddlerProxy.
 boolean equals(Object obj)
          For any instance of this class, indicates whether the object input to this method is equal to the current instance of this class; where equality of proxies to a lookup discovery service is defined by reference equality.
 Object getAdmin()
          Returns a proxy object through which the lookup discovery service for which the object on which this method is invoked serves as proxy may be administered
 Uuid getReferentUuid()
          Returns the universally unique identifier that has been assigned to the resource this proxy represents.
 int hashCode()
          For any instance of this class, returns the hashcode value generated by the hashCode method of the proxy ID associated with the current instance of this proxy.
private  void readObject(ObjectInputStream s)
          When an instance of this class is deserialized, this method is automatically invoked.
private  void readObjectNoData()
          During deserialization of an instance of this class, if it is found that the stream contains no data, this method is automatically invoked.
 LookupDiscoveryRegistration register(String[] groups, LookupLocator[] locators, RemoteEventListener listener, MarshalledObject handback, long leaseDuration)
          Registers with the lookup discovery service.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

server

final Fiddler server
The reference through which communication occurs between the client-side and the server-side of the lookup discovery service


proxyID

final Uuid proxyID
The unique identifier assigned to the current instance of this proxy class by the lookup discovery service. This ID is used to determine equality between proxies.

Constructor Detail

FiddlerProxy

private FiddlerProxy(Fiddler server,
                     Uuid proxyID)
Constructs a new instance of FiddlerProxy.

Parameters:
server - reference to the server object through which communication occurs between the client-side and server-side of the associated service
proxyID - the unique identifier assigned by the service to each instance of this proxy
Method Detail

createServiceProxy

public static FiddlerProxy createServiceProxy(Fiddler server,
                                              Uuid proxyID)
Public static factory method that creates and returns an instance of FiddlerProxy. If the server associated with this proxy implements RemoteMethodControl, then the object returned by this method will also implement RemoteMethodControl.

Parameters:
server - reference to the server object through which communication occurs between the client-side and server-side of the associated service.
proxyID - the unique identifier assigned by the service to each instance of this proxy
Returns:
an instance of FiddlerProxy that implements RemoteMethodControl if the given server does.

getAdmin

public Object getAdmin()
                throws RemoteException
Returns a proxy object through which the lookup discovery service for which the object on which this method is invoked serves as proxy may be administered

Specified by:
getAdmin in interface Administrable
Returns:
a proxy object through which the lookup discovery service may be administered.
Throws:
RemoteException - typically, this exception occurs when there is a communication failure between the client and the server.
See Also:
Administrable

register

public LookupDiscoveryRegistration register(String[] groups,
                                            LookupLocator[] locators,
                                            RemoteEventListener listener,
                                            MarshalledObject handback,
                                            long leaseDuration)
                                     throws RemoteException
Registers with the lookup discovery service. When a client invokes this method, it requests that the lookup discovery service perform discovery processing on its behalf.

Specified by:
register in interface LookupDiscoveryService
Parameters:
groups - String array, none of whose elements may be null, consisting of zero or more names of groups to which lookup services to discover belong. A null value or an empty array (net.jini.discovery.LookupDiscovery.ALL_GROUPS or net.jini.discovery.LookupDiscovery.NO_GROUPS) are both acceptable.
locators - array of zero or more non-null LookupLocator objects, each corresponding to a specific lookup service to discover. If either the empty array or null is passed to this argument, then no locator discovery will be performed for the associated registration.
listener - a non-null instance of RemoteEventListener. This argument specifies the entity that will receive events notifying the registration that a lookup service of interest has been discovered. A non-null value must be passed to this argument, otherwise a NullPointerException will be thrown and the registration.
handback - null or an instance of MarshalledObject. This argument specifies an object that will be included in the notification event that the lookup discovery service sends to the registered listener.
leaseDuration - long value representing the amount of time (in milliseconds) for which the resources of the lookup discovery service are being requested.
Returns:
an instance of the LookupDiscoveryRegistration interface.
Throws:
RemoteException - typically, this exception occurs when there is a communication failure between the client and the server. When this exception does occur, the registration may or may not have completed successfully.
NullPointerException - this exception occurs when null is input to the listener parameter.
See Also:
LookupDiscoveryService

getReferentUuid

public Uuid getReferentUuid()
Returns the universally unique identifier that has been assigned to the resource this proxy represents.

Specified by:
getReferentUuid in interface ReferentUuid
Returns:
the instance of Uuid that is associated with the resource this proxy represents. This method will not return null.
See Also:
ReferentUuid

hashCode

public int hashCode()
For any instance of this class, returns the hashcode value generated by the hashCode method of the proxy ID associated with the current instance of this proxy.

Overrides:
hashCode in class Object
Returns:
int value representing the hashcode for an instance of this class.

equals

public boolean equals(Object obj)
For any instance of this class, indicates whether the object input to this method is equal to the current instance of this class; where equality of proxies to a lookup discovery service is defined by reference equality. That is, two proxies are equal if they reference (are proxies to) the same backend server.

Overrides:
equals in class Object
Parameters:
obj - reference to the object that is to be compared to the object on which this method is invoked.
Returns:
true if the object input is referentially equal to the object on which this method is invoked; false otherwise.

readObject

private void readObject(ObjectInputStream s)
                 throws IOException,
                        ClassNotFoundException
When an instance of this class is deserialized, this method is automatically invoked. This implementation of this method validates the state of the deserialized instance.

Throws:
InvalidObjectException - if the state of the deserialized instance of this class is found to be invalid.
IOException
ClassNotFoundException

readObjectNoData

private void readObjectNoData()
                       throws InvalidObjectException
During deserialization of an instance of this class, if it is found that the stream contains no data, this method is automatically invoked. Because it is expected that the stream should always contain data, this implementation of this method simply declares that something must be wrong.

Throws:
InvalidObjectException - to indicate that there was no data in the stream during deserialization of an instance of this class; declaring that something is wrong.
InvalidObjectException


Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.