com.sun.jini.fiddler
Class FiddlerLease.ConstrainableFiddlerLease

java.lang.Object
  extended by com.sun.jini.lease.AbstractLease
      extended by com.sun.jini.fiddler.FiddlerLease
          extended by com.sun.jini.fiddler.FiddlerLease.ConstrainableFiddlerLease
All Implemented Interfaces:
Serializable, RemoteMethodControl, Lease, ReferentUuid
Enclosing class:
FiddlerLease

static final class FiddlerLease.ConstrainableFiddlerLease
extends FiddlerLease
implements RemoteMethodControl

The constrainable version of the class FiddlerLease.

When a client obtains an instance of this proxy class, the client should not attempt to use the proxy until the client is assured that the proxy can be trusted. In addition to implementing the methods and mechanisms required by RemoteMethodControl, this class - in conjunction with the service's ProxyVerifier class, helps provide a mechanism for verifying trust in the proxy on behalf of a client.

In order to verify that an instance of this class is trusted, trust must be verified in all subsidiary objects (contained in that instance) through which the client ultimately makes calls (local or remote). With respect to this class, the server field is a proxy object through which the client makes remote calls to the service's backend. Therefore, trust in that object must be verified. Additionally, this class also contains a field of type Uuid (registrationID which should be tested for trust. Consider the following diagram:

    FiddlerLease {
        Fiddler server
        Uuid registrationID
    }//end FiddlerLease
  

Thus, in order to verify that an instance of this class is trusted, trust must be verified in the following objects from the diagram above:

When a client obtains an instance of this proxy class, the deserialization process which delivers the proxy to the client invokes the readObject method of this class. Part of trust verification is performed in the readObject method, and part is performed when the client prepares the proxy. Thus, this class' participation in the trust verification process can be summarized as follows:

Since:
2.0

Nested Class Summary
 
Nested classes/interfaces inherited from class com.sun.jini.fiddler.FiddlerLease
FiddlerLease.ConstrainableFiddlerLease
 
Field Summary
private static Method[] canBatchMethodMapArray
          In order to determine if this lease can be batched with another given lease, the method canBatch must verify that the corresponding methods of each lease have equivalent constraints.
private static Method cancelMethod
           
private  MethodConstraints methodConstraints
          Client constraints placed on this proxy (may be null).
private static Method[] methodMapArray
          Array containing element pairs in which each pair of elements represents a correspondence 'mapping' between two methods having the following characteristics: - the first element in the pair is one of the public, remote method(s) that may be invoked by the client through the proxy class that this class extends - the second element in the pair is the method, implemented in the backend server class, that is ultimately executed in the server's backend when the client invokes the corresponding method in this proxy
private static Method renewMethod
           
(package private) static long serialVersionUID
           
 
Fields inherited from class com.sun.jini.fiddler.FiddlerLease
leaseID, registrationID, server, serverID
 
Fields inherited from class com.sun.jini.lease.AbstractLease
expiration, serialFormat
 
Fields inherited from interface net.jini.core.lease.Lease
ABSOLUTE, ANY, DURATION, FOREVER
 
Constructor Summary
private FiddlerLease.ConstrainableFiddlerLease(Fiddler server, Uuid serverID, Uuid registrationID, Uuid leaseID, long expiration, MethodConstraints methodConstraints)
          Constructs a new ConstrainableFiddlerLease instance.
 
Method Summary
 boolean canBatch(Lease lease)
          Examines the input parameter to determine if that parameter, along with the current lease (the current instance of this class), can be batched in a LeaseMap.
private static Fiddler constrainServer(Fiddler server, MethodConstraints constraints)
          Returns a copy of the given server proxy having the client method constraints that result after the specified method mapping is applied to the given client method constraints.
 MethodConstraints getConstraints()
          Returns the client constraints placed on the current instance of this proxy class (ConstrainableFiddlerLease).
private  ProxyTrustIterator getProxyTrustIterator()
          Returns a proxy trust iterator that is used in ProxyTrustVerifier to retrieve this object's trust verifier.
private  void readObject(ObjectInputStream s)
          Performs various functions related to the trust verification process for the current instance of this proxy class, as detailed in the description for this class.
 RemoteMethodControl setConstraints(MethodConstraints constraints)
          Returns a new copy of this proxy class (ConstrainableFiddlerLease) with its client constraints set to the specified constraints.
 
Methods inherited from class com.sun.jini.fiddler.FiddlerLease
cancel, createLease, createLeaseMap, doRenew, equals, getLeaseID, getReferentUuid, getRegistrationID, getServer, getServerID, hashCode, setExpiration
 
Methods inherited from class com.sun.jini.lease.AbstractLease
getExpiration, getSerialFormat, renew, setSerialFormat
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

renewMethod

private static final Method renewMethod

cancelMethod

private static final Method cancelMethod

methodMapArray

private static final Method[] methodMapArray
Array containing element pairs in which each pair of elements represents a correspondence 'mapping' between two methods having the following characteristics: - the first element in the pair is one of the public, remote method(s) that may be invoked by the client through the proxy class that this class extends - the second element in the pair is the method, implemented in the backend server class, that is ultimately executed in the server's backend when the client invokes the corresponding method in this proxy


canBatchMethodMapArray

private static final Method[] canBatchMethodMapArray
In order to determine if this lease can be batched with another given lease, the method canBatch must verify that the corresponding methods of each lease have equivalent constraints. The array defined here contains the set of methods whose constraints will be compared in canBatch.


methodConstraints

private MethodConstraints methodConstraints
Client constraints placed on this proxy (may be null).

Constructor Detail

FiddlerLease.ConstrainableFiddlerLease

private FiddlerLease.ConstrainableFiddlerLease(Fiddler server,
                                               Uuid serverID,
                                               Uuid registrationID,
                                               Uuid leaseID,
                                               long expiration,
                                               MethodConstraints methodConstraints)
Constructs a new ConstrainableFiddlerLease instance.

For a description of all but the methodConstraints argument (provided below), refer to the description for the constructor of this class' super class.

Parameters:
methodConstraints - the client method constraints to place on this proxy (may be null).
Method Detail

canBatch

public boolean canBatch(Lease lease)
Examines the input parameter to determine if that parameter, along with the current lease (the current instance of this class), can be batched in a LeaseMap.

For this implementation of the service, two leases can be batched (placed in the same service-specific instance of LeaseMap) if those leases satisfy the following conditions:


constrainServer

private static Fiddler constrainServer(Fiddler server,
                                       MethodConstraints constraints)
Returns a copy of the given server proxy having the client method constraints that result after the specified method mapping is applied to the given client method constraints.


setConstraints

public RemoteMethodControl setConstraints(MethodConstraints constraints)
Returns a new copy of this proxy class (ConstrainableFiddlerLease) with its client constraints set to the specified constraints. A null value is interpreted as mapping all methods to empty constraints.

Specified by:
setConstraints in interface RemoteMethodControl
Parameters:
constraints - client constraints, or null
Returns:
a new copy of this proxy with the client constraints set to the specified constraints
See Also:
RemoteMethodControl.getConstraints()

getConstraints

public MethodConstraints getConstraints()
Returns the client constraints placed on the current instance of this proxy class (ConstrainableFiddlerLease). The value returned by this method can be null, which is interpreted as mapping all methods to empty constraints.

Specified by:
getConstraints in interface RemoteMethodControl
Returns:
the client constraints, or null
See Also:
RemoteMethodControl.setConstraints(net.jini.core.constraint.MethodConstraints)

getProxyTrustIterator

private ProxyTrustIterator getProxyTrustIterator()
Returns a proxy trust iterator that is used in ProxyTrustVerifier to retrieve this object's trust verifier.


readObject

private void readObject(ObjectInputStream s)
                 throws IOException,
                        ClassNotFoundException
Performs various functions related to the trust verification process for the current instance of this proxy class, as detailed in the description for this class.

Throws:
InvalidObjectException - if any of the requirements for trust verification (as detailed in the class description) are not satisfied.
IOException
ClassNotFoundException


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