|
GigaSpaces XAP 9.7.2 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.jini.core.discovery.LookupLocator net.jini.discovery.ConstrainableLookupLocator
public final class ConstrainableLookupLocator
LookupLocator
subclass which supports constraint operations
through the RemoteMethodControl
interface. The constraints of a
ConstrainableLookupLocator
instance control how it performs
unicast discovery, and apply only to its getRegistrar()
and getRegistrar(int)
methods. The constraints may also be used by other
utilities, such as LookupLocatorDiscovery
, to determine how unicast
discovery should be performed on behalf of a given
ConstrainableLookupLocator
instance. Untrusted
ConstrainableLookupLocator
instances can be verified using the
ConstrainableLookupLocatorTrustVerifier
trust verifier.
Field Summary |
---|
Fields inherited from class net.jini.core.discovery.LookupLocator |
---|
host, port |
Constructor Summary | |
---|---|
ConstrainableLookupLocator(String host,
int port,
MethodConstraints constraints)
Constructs a new ConstrainableLookupLocator instance which
can be used to perform unicast discovery to the given host and port with
the provided constraints applied. |
|
ConstrainableLookupLocator(String url,
MethodConstraints constraints)
Constructs a new ConstrainableLookupLocator instance which
can be used to perform unicast discovery to the host and port named by
the given URL with the provided constraints applied. |
Method Summary | |
---|---|
MethodConstraints |
getConstraints()
Returns the client constraints placed on this proxy. |
ServiceRegistrar |
getRegistrar()
Performs unicast discovery as specified by LookupLocator.getRegistrar() with the following differences. |
ServiceRegistrar |
getRegistrar(int timeout)
Performs unicast discovery as specified by LookupLocator.getRegistrar(int) , additionally applying the
supplied discovery constraints. |
RemoteMethodControl |
setConstraints(MethodConstraints constraints)
Returns a new copy of this proxy with the client constraints set to the specified constraints. |
String |
toString()
Returns a string representation of this object. |
Methods inherited from class net.jini.core.discovery.LookupLocator |
---|
equals, getHost, getPort, hashCode |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ConstrainableLookupLocator(String url, MethodConstraints constraints) throws MalformedURLException
ConstrainableLookupLocator
instance which
can be used to perform unicast discovery to the host and port named by
the given URL with the provided constraints applied. This constructor
invokes its superclass LookupLocator.LookupLocator(String)
constructor. Any exceptions thrown by the superclass constructor are
rethrown.
The url
must be a valid URL of scheme "jini"
as
described in LookupLocator(String)
. A null
constraints
value is interpreted as mapping both
getRegistrar
methods to empty constraints.
url
- the URL to useconstraints
- the constraints to apply to unicast discovery, or
null
MalformedURLException
- if url
cannot be parsed
NullPointerException
- if url
is null
public ConstrainableLookupLocator(String host, int port, MethodConstraints constraints)
ConstrainableLookupLocator
instance which
can be used to perform unicast discovery to the given host and port with
the provided constraints applied. This constructor invokes its
superclass LookupLocator.LookupLocator(String, int)
constructor. Any exceptions thrown by the superclass constructor are
rethrown.
A null constraints
value is interpreted as mapping both
getRegistrar
methods to empty constraints. The
host
and port
must satisfy the requirements of
the LookupLocator(String, int)
constructor.
host
- the name of the host to contactport
- the number of the port to connect toconstraints
- the constraints to apply to unicast discovery, or
null
NullPointerException
- if host
is null
IllegalArgumentException
- if the port and host do not meet the
requirements of LookupLocator(String, int)
.Method Detail |
---|
public ServiceRegistrar getRegistrar() throws IOException, ClassNotFoundException
LookupLocator.getRegistrar()
with the following differences.
getRegistrar(int)
method.
net.jini.discovery.timeout
system property is ignored.
ConstrainableLookupLocator
implements this method to use the
values of the host
and port
field in
determining the host and port to connect to.
getRegistrar
in class LookupLocator
UnsupportedConstraintException
- if the
discovery-related constraints contain conflicts, or otherwise cannot be
processed
IOException
- an error occurred during discovery
ClassNotFoundException
- if a class required to unmarshal the
ServiceRegistrar
proxy cannot be foundpublic ServiceRegistrar getRegistrar(int timeout) throws IOException, ClassNotFoundException
LookupLocator.getRegistrar(int)
, additionally applying the
supplied discovery constraints. The timeout
is considered a
requirement with respect to other constraints specified for this
instance.
getRegistrar
in class LookupLocator
timeout
- the maximum time to wait for a response, in
milliseconds. A value of 0
specifies an infinite timeout.
UnsupportedConstraintException
- if the
discovery-related constraints contain conflicts, or otherwise cannot be
processed
IOException
- an error occurred during discovery
ClassNotFoundException
- if a class required to unmarshal the
ServiceRegistrar
proxy cannot be foundpublic String toString()
toString
in class LookupLocator
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)
|
GigaSpaces XAP 9.7.2 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |