final class ConstrainableSpaceProxy2 extends SpaceProxy2 implements RemoteMethodControl
SpaceProxy2
Modifier and Type | Field and Description |
---|---|
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
SpaceProxy2 . |
(package private) static long |
serialVersionUID |
serverMaxServerQueryTimeout, space, spaceUuid
Constructor and Description |
---|
ConstrainableSpaceProxy2(OutriggerServer space,
Uuid spaceUuid,
long serverMaxServerQueryTimeout,
MethodConstraints methodConstraints)
Create a new
ConstrainableSpaceProxy2 . |
Modifier and Type | Method and Description |
---|---|
private static OutriggerServer |
constrainServer(OutriggerServer server,
MethodConstraints constraints)
Returns a copy of the given
OutriggerServer proxy
having the client method constraints that result after
mapping defined by methodMapArray is applied. |
protected Lease |
constructLease(Uuid uuid,
long expiration)
Create a new lease with the specified id and initial expiration
|
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.
|
contents, entryFrom, equals, getAdmin, getReferentUuid, hashCode, newLease, notify, read, readIfExists, registerForAvailabilityEvent, repFor, repFor, snapshot, take, take, takeIfExists, toString, write, write
static final long serialVersionUID
private static final Method[] methodMapArray
SpaceProxy2
.
private final MethodConstraints methodConstraints
null
ConstrainableSpaceProxy2(OutriggerServer space, Uuid spaceUuid, long serverMaxServerQueryTimeout, MethodConstraints methodConstraints)
ConstrainableSpaceProxy2
.space
- The OutriggerServer
for the
space.spaceUuid
- The universally unique ID for the
spaceserverMaxServerQueryTimeout
- The value this proxy
should use for the maxServerQueryTimeout
if no local value is provided.methodConstraints
- the client method constraints to place on
this proxy (may be null
).NullPointerException
- if space
or
spaceUuid
is null
.IllegalArgumentException
- if
serverMaxServerQueryTimeout
is not
larger than zero.ClassCastException
- if server
does not implement RemoteMethodControl
.private static OutriggerServer constrainServer(OutriggerServer server, MethodConstraints constraints)
OutriggerServer
proxy
having the client method constraints that result after
mapping defined by methodMapArray is applied.server
- The proxy to attach constrains too.constraints
- The source method constraints.NullPointerException
- if server
is
null
.ClassCastException
- if server
does not implement RemoteMethodControl
.public RemoteMethodControl setConstraints(MethodConstraints constraints)
RemoteMethodControl
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.
setConstraints
in interface RemoteMethodControl
constraints
- client constraints, or null
RemoteMethodControl.getConstraints()
public MethodConstraints getConstraints()
RemoteMethodControl
null
, which is interpreted as mapping all
methods to empty constraints (one that has no requirements and no
preferences).getConstraints
in interface RemoteMethodControl
null
RemoteMethodControl.setConstraints(net.jini.core.constraint.MethodConstraints)
private ProxyTrustIterator getProxyTrustIterator()
ProxyTrustVerifier
to retrieve this object's
trust verifier.private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
protected Lease constructLease(Uuid uuid, long expiration)
SpaceProxy2
constructLease
in class SpaceProxy2
Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.