Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.jini.core.discovery
Class LookupLocator

    java.lang.Object
      net.jini.core.discovery.LookupLocator

All Implemented Interfaces:
  Serializable

Direct Known Subclasses:
  ConstrainableLookupLocator

public class LookupLocator
extends Object
implements Serializable

A utility class that performs unicast discovery.

Since:
  1.0
See Also:
  Serialized Form

Field Summary
`protected String` | `host` The name of the host at which to perform discovery.
`protected int` | `port` The port number on the host at which to perform discovery.

Constructor Summary
`LookupLocator(String url)` Construct a new LookupLocator object, set up to perform discovery to the given URL.
`LookupLocator(String host, int port)` Construct a new LookupLocator object, set to perform unicast discovery to the given host and port.

Method Summary
`boolean` | `equals(Object o)` Two locators are equal if they have the same host and port.
`String` | `getHost()` Return the name of the host this LookupLocator object should contact.
`int` | `getPort()` Return the number of the port to which this LookupLocator object should connect.
`ServiceRegistrar` | `getRegistrar()` Perform unicast discovery and return the ServiceRegistrar object for the given lookup service.
`ServiceRegistrar` | `getRegistrar(int timeout)` Perform unicast discovery and return the ServiceRegistrar object for the given lookup service.
`int` | `hashCode()`
`String` | `toString()` Return the string form of this LookupLocator, as a `jini`-scheme URL.

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### host

    protected String host

  The name of the host at which to perform discovery.

### port

    protected int port

  The port number on the host at which to perform discovery.

Constructor Detail

### LookupLocator

    public LookupLocator(String url)
                  throws MalformedURLException

  Construct a new LookupLocator object, set up to perform discovery to the given URL.

  The URL in question must be of the form `jini://host/` or `jini://host:port/`.

Parameters:
  `url` - the URL to use
Throws:
  `MalformedURLException` - the URL passed in could not be parsed

### LookupLocator

    public LookupLocator(String host,
                         int port)

  Construct a new LookupLocator object, set to perform unicast discovery to the given host and port.

Parameters:
  `host` - the name of the host to contact
  `port` - the number of the port to connect to

Method Detail

### getHost

    public String getHost()

  Return the name of the host this LookupLocator object should contact.

  Returns:
    a String representing the host value

### getPort

    public int getPort()

  Return the number of the port to which this LookupLocator object should connect.

  Returns:
    an int representing the port value

### getRegistrar

    public ServiceRegistrar getRegistrar()
                                  throws IOException,
                                         ClassNotFoundException

  Perform unicast discovery and return the ServiceRegistrar object for the given lookup service. Unicast discovery is performed anew each time this method is called.

  Returns:
    the ServiceRegistrar for the lookup service denoted by this LookupLocator object
  Throws:
    `IOException` - an error occurred during discovery
    `ClassNotFoundException` - some discovery-related classes could not be found

### getRegistrar

    public ServiceRegistrar getRegistrar(int timeout)
                                  throws IOException,
                                         ClassNotFoundException

  Perform unicast discovery and return the ServiceRegistrar object for the given lookup service. Unicast discovery is performed anew each time this method is called.

  If a connection can be established to start unicast discovery but the remote end fails to respond within the given time limit, an exception is thrown.

  Parameters:
    `timeout` - the maximum time to wait for a response, in milliseconds
  Returns:
    the ServiceRegistrar for the lookup service denoted by this LookupLocator object
  Throws:
    `IOException` - an error occurred during discovery
    `ClassNotFoundException` - some discovery-related classes could not be found

### toString

    public String toString()

  Return the string form of this LookupLocator, as a `jini`-scheme URL.

### equals

    public boolean equals(Object o)

  Two locators are equal if they have the same host and port.

### hashCode

    public int hashCode()

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004 Sun Microsystems, Inc. All rights reserved