public final class TargetDescriptor extends Descriptor
getTotalTimeOut()
)getConnectionTimeOut()
)getSocketTimeOut()
)Constructor and Description |
---|
TargetDescriptor(String url)
Constructs a new
TargetDescriptor for the specified URL. |
TargetDescriptor(String url,
int timeOut)
Constructs a new
TargetDescriptor for the specified URL,
with the specifed total time-out. |
TargetDescriptor(String url,
int timeOut,
int connectionTimeOut)
Constructs a new
TargetDescriptor for the specified URL,
with the specifed total time-out and connection time-out. |
TargetDescriptor(String url,
int timeOut,
int connectionTimeOut,
int socketTimeOut)
Constructs a new
TargetDescriptor for the specified URL,
with the specifed total time-out, connection time-out and socket
time-out. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
Indicates whether some other object is "equal to" this one.
|
int |
getConnectionTimeOut()
Returns the connection time-out for a call to the service.
|
int |
getCRC()
Returns the CRC-32 checksum for the URL of this target descriptor.
|
String |
getProtocol()
Returns the protocol in the URL for the service.
|
int |
getSocketTimeOut()
Returns the socket time-out for a call to the service.
|
TargetDescriptor |
getTargetByCRC(int crc)
Returns the
TargetDescriptor that matches the specified
CRC-32 checksum. |
int |
getTargetCount()
Counts the total number of target descriptors in/under this descriptor.
|
int |
getTotalTimeOut()
Returns the total time-out for a call to the service.
|
String |
getURL()
Returns the URL for the service.
|
int |
hashCode()
Returns a hash code value for the object.
|
boolean |
isGroup()
Checks if this descriptor denotes a group of descriptors.
|
Iterator |
iterateTargets()
Iterates over all leaves, the target descriptors.
|
Iterator<TargetDescriptor> |
iterator() |
String |
toString()
Textual description of this object.
|
public TargetDescriptor(String url) throws IllegalArgumentException, MalformedURLException
TargetDescriptor
for the specified URL.
Note: Both the connection time-out and the socket time-out will be set to the default time-out: 5 seconds.
url
- the URL of the service, cannot be null
.IllegalArgumentException
- if url == null
.MalformedURLException
- if the specified URL is malformed.public TargetDescriptor(String url, int timeOut) throws IllegalArgumentException, MalformedURLException
TargetDescriptor
for the specified URL,
with the specifed total time-out.
Note: Both the connection time-out and the socket time-out will be set to equal the total time-out.
url
- the URL of the service, cannot be null
.timeOut
- the total time-out for the service, in milliseconds; or a
non-positive value for no total time-out.IllegalArgumentException
- if url == null
.MalformedURLException
- if the specified URL is malformed.public TargetDescriptor(String url, int timeOut, int connectionTimeOut) throws IllegalArgumentException, MalformedURLException
TargetDescriptor
for the specified URL,
with the specifed total time-out and connection time-out.
Note: If the passed connection time-out is smaller than 1 ms, or greater than the total time-out, then it will be adjusted to equal the total time-out.
Note: The socket time-out will be set to equal the total time-out.
url
- the URL of the service, cannot be null
.timeOut
- the total time-out for the service, in milliseconds; or a
non-positive value for no total time-out.connectionTimeOut
- the connection time-out for the service, in milliseconds; or a
non-positive value if the connection time-out should equal the total
time-out.IllegalArgumentException
- if url == null
.MalformedURLException
- if the specified URL is malformed.public TargetDescriptor(String url, int timeOut, int connectionTimeOut, int socketTimeOut) throws IllegalArgumentException, MalformedURLException
TargetDescriptor
for the specified URL,
with the specifed total time-out, connection time-out and socket
time-out.
Note: If the passed connection time-out is smaller than 1 ms, or greater than the total time-out, then it will be adjusted to equal the total time-out.
Note: If the passed socket time-out is smaller than 1 ms or greater than the total time-out, then it will be adjusted to equal the total time-out.
url
- the URL of the service, cannot be null
.timeOut
- the total time-out for the service, in milliseconds; or a
non-positive value for no total time-out.connectionTimeOut
- the connection time-out for the service, in milliseconds; or a
non-positive value if the connection time-out should equal the total
time-out.socketTimeOut
- the socket time-out for the service, in milliseconds; or a
non-positive value for no socket time-out.IllegalArgumentException
- if url == null
.MalformedURLException
- if the specified URL is malformed.public boolean isGroup()
isGroup
in class Descriptor
false
, since this descriptor does not denote a group.public String getURL()
null
.public String getProtocol()
null
.public int getTotalTimeOut()
public int getConnectionTimeOut()
public int getSocketTimeOut()
public int getCRC()
public Iterator iterateTargets()
The returned Iterator
will only return this target
descriptor.
iterateTargets
in class Descriptor
null
.public Iterator<TargetDescriptor> iterator()
public int getTargetCount()
getTargetCount
in class Descriptor
public TargetDescriptor getTargetByCRC(int crc)
TargetDescriptor
that matches the specified
CRC-32 checksum.getTargetByCRC
in class Descriptor
crc
- the CRC-32 checksum.TargetDescriptor
that matches the specified checksum, or
null
, if none could be found in this descriptor.public int hashCode()
hashCode
in class Object
Object.hashCode()
,
equals(Object)
public boolean equals(Object obj)
obj
equals if and only if it matches the
following conditions:
obj instanceof TargetDescriptor
equals
in class Object
obj
- the reference object with which to compare.true
if this object is the same as the obj
argument; false
otherwise.hashCode()
public String toString()
TargetDescriptor(url="http://api.google.com/some_api/";
total-time-out is 5300 ms;
connection time-out is 1000 ms;
socket time-out is disabled)
See http://www.xins.org/.