org.sblim.slp

Class ServiceURL

Implemented Interfaces:
Serializable

public class ServiceURL
extends java.lang.Object
implements Serializable

The ServiceURL object models the advertised SLP service URL. It can be either a service: URL or a regular URL. These objects are returned from service lookup requests, and describe the registered services. This class should be a subclass of java.net.URL but can't since that class is final.

Field Summary

static int
LIFETIME_DEFAULT
The default URL lifetime (3 hours) in seconds.
static int
LIFETIME_MAXIMUM
The maximum URL lifetime (about 18 hours) in seconds.
static int
LIFETIME_NONE
Indicates that the URL has a zero lifetime.
static int
LIFETIME_PERMANENT
Indicates that the API implementation should continuously re-register the URL until the application exits.
static int
NO_PORT
Indicates that no port information is required or was returned for this URL.

Constructor Summary

ServiceURL(String pServiceURL, int pLifetime)
Construct a service URL object having the specified lifetime.

Method Summary

boolean
equals(Object obj)
String
getHost()
Returns the host identifier.
int
getLifetime()
Returns the service advertisement lifetime.
int
getPort()
Returns the port number, if any.
ServiceType
getServiceType()
Returns the service type object representing the service type name of the URL.
String
getTransport()
Get the network layer transport identifier.
String
getURLPath()
Returns the URL path description, if any.
int
hashCode()
static void
main(String[] args)
void
setServiceType(ServiceType pServicetype)
Set the service type name to the object.
String
toString()

Field Details

LIFETIME_DEFAULT

public static final int LIFETIME_DEFAULT
The default URL lifetime (3 hours) in seconds.
Field Value:
10800

LIFETIME_MAXIMUM

public static final int LIFETIME_MAXIMUM
The maximum URL lifetime (about 18 hours) in seconds.
Field Value:
65535

LIFETIME_NONE

public static final int LIFETIME_NONE
Indicates that the URL has a zero lifetime. This value is never returned from the API, but can be used to create a ServiceURL object to deregister, delete attributes, or find attributes.
Field Value:
0

LIFETIME_PERMANENT

public static final int LIFETIME_PERMANENT
Indicates that the API implementation should continuously re-register the URL until the application exits.
Field Value:
-1

NO_PORT

public static final int NO_PORT
Indicates that no port information is required or was returned for this URL.
Field Value:
0

Constructor Details

ServiceURL

public ServiceURL(String pServiceURL,
                  int pLifetime)
Construct a service URL object having the specified lifetime.
Parameters:
pServiceURL - The URL as a string. Must be either a service: URL or a valid generic URL according to RFC 2396 [2].
pLifetime - The service advertisement lifetime in seconds. This value may be either between LIFETIME_NONE and LIFETIME_MAXIMUM or LIFETIME_PERMANENT.

Method Details

equals

public boolean equals(Object obj)

getHost

public String getHost()
Returns the host identifier. For IP, this will be the machine name or IP address.
Returns:
The host

getLifetime

public int getLifetime()
Returns the service advertisement lifetime. This will be a positive int between LIFETIME_NONE and LIFETIME_MAXIMUM.
Returns:
The lifetime

getPort

public int getPort()
Returns the port number, if any. For non-IP transports, always returns NO_PORT.
Returns:
The port

getServiceType

public ServiceType getServiceType()
Returns the service type object representing the service type name of the URL.
Returns:
The service type

getTransport

public String getTransport()
Get the network layer transport identifier. If the transport is IP, an empty string, "", is returned.
Returns:
The NLT identifier

getURLPath

public String getURLPath()
Returns the URL path description, if any.
Returns:
The URL path

hashCode

public int hashCode()

main

public static void main(String[] args)

setServiceType

public final void setServiceType(ServiceType pServicetype)
            throws ServiceLocationException
Set the service type name to the object. Ignored if the URL is a service: URL.
Parameters:
pServicetype - The service type object.

toString

public String toString()

Copyright © 2005, 2007 IBM Corporation. All Rights Reserved.