com.sun.jini.outrigger
Class ConstrainableAdminProxy

java.lang.Object
  extended by com.sun.jini.outrigger.AdminProxy
      extended by com.sun.jini.outrigger.ConstrainableAdminProxy
All Implemented Interfaces:
DestroyAdmin, ConstrainableJavaSpaceAdmin, JavaSpaceAdmin, Serializable, JoinAdmin, RemoteMethodControl, ReferentUuid

final class ConstrainableAdminProxy
extends AdminProxy
implements RemoteMethodControl, ConstrainableJavaSpaceAdmin

Constrainable subclass of AdminProxy

Since:
2.0
Author:
Sun Microsystems, Inc.

Field Summary
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 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 AdminProxy.
(package private) static long serialVersionUID
           
 
Fields inherited from class com.sun.jini.outrigger.AdminProxy
admin, spaceUuid
 
Fields inherited from interface com.sun.jini.outrigger.JavaSpaceAdmin
USE_DEFAULT
 
Constructor Summary
ConstrainableAdminProxy(OutriggerAdmin admin, Uuid spaceUuid, MethodConstraints methodConstraints)
          Create a new ConstrainableAdminProxy.
 
Method Summary
private static OutriggerAdmin constrainServer(OutriggerAdmin server, MethodConstraints constraints)
          Returns a copy of the given OutriggerAdmin proxy having the client method constraints that result after mapping defined by methodMapArray is applied.
 AdminIterator contents(Entry tmpl, Transaction tr, int fetchSize)
          Override super class to create secure IteratorProxys
 AdminIterator contents(Entry tmpl, Transaction txn, int fetchSize, MethodConstraints constraints)
          Return an AdminIterator that will iterate over all the entries in the space that match the given template and are visible under the given transaction.
 MethodConstraints getConstraints()
          Returns the client constraints placed on this proxy.
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)
           
 RemoteMethodControl setConstraints(MethodConstraints constraints)
          Returns a new copy of this proxy with the client constraints set to the specified constraints.
 
Methods inherited from class com.sun.jini.outrigger.AdminProxy
addLookupAttributes, addLookupGroups, addLookupLocators, contents, destroy, equals, getLookupAttributes, getLookupGroups, getLookupLocators, getReferentUuid, hashCode, modifyLookupAttributes, removeLookupGroups, removeLookupLocators, setLookupGroups, setLookupLocators, space, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.sun.jini.outrigger.ConstrainableJavaSpaceAdmin
contents
 
Methods inherited from interface com.sun.jini.outrigger.JavaSpaceAdmin
space
 
Methods inherited from interface net.jini.admin.JoinAdmin
addLookupAttributes, addLookupGroups, addLookupLocators, getLookupAttributes, getLookupGroups, getLookupLocators, modifyLookupAttributes, removeLookupGroups, removeLookupLocators, setLookupGroups, setLookupLocators
 
Methods inherited from interface com.sun.jini.admin.DestroyAdmin
destroy
 

Field Detail

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

methodMapArray

private static final Method[] methodMapArray
Array containing element pairs in which each pair of elements represents a mapping between two methods having the following characteristics:


methodConstraints

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

Constructor Detail

ConstrainableAdminProxy

ConstrainableAdminProxy(OutriggerAdmin admin,
                        Uuid spaceUuid,
                        MethodConstraints methodConstraints)
Create a new ConstrainableAdminProxy.

Parameters:
admin - reference to remote server for the space.
spaceUuid - universal unique ID for the space.
methodConstraints - the client method constraints to place on this proxy (may be null).
Throws:
NullPointerException - if admin or spaceUuid is null.
ClassCastException - if admin does not implement RemoteMethodControl.
Method Detail

constrainServer

private static OutriggerAdmin constrainServer(OutriggerAdmin server,
                                              MethodConstraints constraints)
Returns a copy of the given OutriggerAdmin proxy having the client method constraints that result after mapping defined by methodMapArray is applied.

Parameters:
server - The proxy to attach constrains too.
constraints - The source method constraints.
Throws:
NullPointerException - if server is null.
ClassCastException - if server does not implement RemoteMethodControl.

setConstraints

public RemoteMethodControl setConstraints(MethodConstraints constraints)
Description copied from interface: RemoteMethodControl
Returns a new copy of this proxy with the client constraints set to the specified constraints. These constraints completely replace (in the copy) any client constraints previously placed on this proxy; calling the getConstraints method of the copy returns the identical constraints instance. The original proxy is not modified. A null value is interpreted as mapping all methods to empty constraints (one that has no requirements and no preferences). For any given remote call, the specific client requirements and preferences to be satisfied are given by the return value of invoking the getConstraints method of the specified MethodConstraints instance with a Method object representing the remote method.

Client constraints placed on a proxy are included in the serialized state of the proxy. This allows third-party services to be transparent to the client's needs. For example, if remote object s1 obtains a proxy for remote object s2, and passes that proxy to remote object s3, expecting s3 to invoke a remote method on s2, then s1 can control that call by placing its constraints directly on the proxy before passing it to s3. If s3 does not wish to be transparent in this way, then it should explicitly replace the client constraints on received proxies with whatever constraints are appropriate to implement its own policy.

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()
Description copied from interface: RemoteMethodControl
Returns the client constraints placed on this proxy. The return value can be null, which is interpreted as mapping all methods to empty constraints (one that has no requirements and no preferences).

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
Throws:
IOException
ClassNotFoundException

contents

public AdminIterator contents(Entry tmpl,
                              Transaction tr,
                              int fetchSize)
                       throws TransactionException,
                              RemoteException
Override super class to create secure IteratorProxys

Specified by:
contents in interface ConstrainableJavaSpaceAdmin
Specified by:
contents in interface JavaSpaceAdmin
Overrides:
contents in class AdminProxy
Parameters:
tmpl - The iterator should return only entries that match tmpl
tr - The iterator should return only entries that match this transaction
fetchSize - advice on how many entries to fetch when the iterator has to go to the server for more entries.
Throws:
TransactionException - if there is a problem with txn.
RemoteException - if communications with the server is necessary and it can not be completed.

contents

public AdminIterator contents(Entry tmpl,
                              Transaction txn,
                              int fetchSize,
                              MethodConstraints constraints)
                       throws TransactionException,
                              RemoteException
Description copied from interface: ConstrainableJavaSpaceAdmin
Return an AdminIterator that will iterate over all the entries in the space that match the given template and are visible under the given transaction. The returned iterator will support proxy trust verification and will enforce the specified MethodConstraints.

The interactions between other operations on the space and the returned iterator are undefined

Specified by:
contents in interface ConstrainableJavaSpaceAdmin
Parameters:
tmpl - The iterator should return only entries that match tmpl
txn - The iterator should return only entries that match this transaction
fetchSize - advice on how many entries to fetch when the iterator has to go to the server for more entries.
constraints - the MethodConstraints the returned proxy should enforce.
Returns:
An object that can be used to iterate over entries in the space.
Throws:
TransactionException - if there is a problem with txn.
RemoteException - if communications with the server is necessary and it can not be completed.


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