| java.lang.Object org.xins.common.service.Descriptor org.xins.common.service.TargetDescriptor
TargetDescriptor | final public class TargetDescriptor extends Descriptor (Code) | | Descriptor for a single target service. A target descriptor defines a URL
that identifies the location of the service. Also, it may define 3 kinds of
time-outs:
- total time-out (
TargetDescriptor.getTotalTimeOut() )
- the maximum duration of a call, including connection time, time used
to send the request, time used to receive the response, etc.
- connection time-out (
TargetDescriptor.getConnectionTimeOut() )
- the maximum time for attempting to establish a connection.
- socket time-out (
TargetDescriptor.getSocketTimeOut() )
- the maximum time for attempting to receive data on a socket.
version: $Revision: 1.62 $ $Date: 2007/05/21 08:34:42 $ author: Ernst de Haan since: XINS 1.0.0 |
Constructor Summary | |
public | TargetDescriptor(String url) Constructs a new TargetDescriptor for the specified URL. | public | TargetDescriptor(String url, int timeOut) Constructs a new TargetDescriptor for the specified URL,
with the specifed total time-out. | public | 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. | public | 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. |
Method Summary | |
public boolean | equals(Object obj) Indicates whether some other object is "equal to" this one. | public int | getCRC() Returns the CRC-32 checksum for the URL of this target descriptor. | public int | getConnectionTimeOut() Returns the connection time-out for a call to the service. | public String | getProtocol() Returns the protocol in the URL for the service. | public int | getSocketTimeOut() Returns the socket time-out for a call to the service. | public TargetDescriptor | getTargetByCRC(int crc) Returns the TargetDescriptor that matches the specified
CRC-32 checksum. | public int | getTargetCount() Counts the total number of target descriptors in/under this descriptor. | public int | getTotalTimeOut() Returns the total time-out for a call to the service. | public String | getURL() Returns the URL for the service. | public int | hashCode() Returns a hash code value for the object. | public boolean | isGroup() Checks if this descriptor denotes a group of descriptors. | public java.util.Iterator | iterateTargets() Iterates over all leaves, the target descriptors. | public String | toString() Textual description of this object. |
TargetDescriptor | public TargetDescriptor(String url, int timeOut) throws IllegalArgumentException, MalformedURLException(Code) | | Constructs a new 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.
Parameters: url - the URL of the service, cannot be null . Parameters: timeOut - the total time-out for the service, in milliseconds; or anon-positive value for no total time-out. throws: IllegalArgumentException - if url == null . throws: MalformedURLException - if the specified URL is malformed. |
TargetDescriptor | public TargetDescriptor(String url, int timeOut, int connectionTimeOut) throws IllegalArgumentException, MalformedURLException(Code) | | Constructs a new 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.
Parameters: url - the URL of the service, cannot be null . Parameters: timeOut - the total time-out for the service, in milliseconds; or anon-positive value for no total time-out. Parameters: connectionTimeOut - the connection time-out for the service, in milliseconds; or anon-positive value if the connection time-out should equal the totaltime-out. throws: IllegalArgumentException - if url == null . throws: MalformedURLException - if the specified URL is malformed. |
TargetDescriptor | public TargetDescriptor(String url, int timeOut, int connectionTimeOut, int socketTimeOut) throws IllegalArgumentException, MalformedURLException(Code) | | Constructs a new 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.
Parameters: url - the URL of the service, cannot be null . Parameters: timeOut - the total time-out for the service, in milliseconds; or anon-positive value for no total time-out. Parameters: connectionTimeOut - the connection time-out for the service, in milliseconds; or anon-positive value if the connection time-out should equal the totaltime-out. Parameters: socketTimeOut - the socket time-out for the service, in milliseconds; or anon-positive value for no socket time-out. throws: IllegalArgumentException - if url == null . throws: MalformedURLException - if the specified URL is malformed. |
equals | public boolean equals(Object obj)(Code) | | Indicates whether some other object is "equal to" this one. This method
considers obj equals if and only if it matches the
following conditions:
obj instanceof TargetDescriptor
- URL is equal
- total time-out is equal
- connection time-out is equal
- socket time-out is equal
Parameters: obj - the reference object with which to compare.true if this object is the same as the obj argument; false otherwise. See Also: TargetDescriptor.hashCode() |
getCRC | public int getCRC()(Code) | | Returns the CRC-32 checksum for the URL of this target descriptor.
the CRC-32 checksum. |
getConnectionTimeOut | public int getConnectionTimeOut()(Code) | | Returns the connection time-out for a call to the service.
the connection time-out for the service; always greater than 0 andsmaller than or equal to the total time-out. |
getProtocol | public String getProtocol()(Code) | | Returns the protocol in the URL for the service.
the protocol in the URL, not null . since: XINS 1.2.0 |
getSocketTimeOut | public int getSocketTimeOut()(Code) | | Returns the socket time-out for a call to the service.
the socket time-out for the service; always greater than 0 andsmaller than or equal to the total time-out. |
getTargetByCRC | public TargetDescriptor getTargetByCRC(int crc)(Code) | | Returns the TargetDescriptor that matches the specified
CRC-32 checksum.
Parameters: crc - the CRC-32 checksum.the TargetDescriptor that matches the specified checksum, ornull , if none could be found in this descriptor. |
getTargetCount | public int getTargetCount()(Code) | | Counts the total number of target descriptors in/under this descriptor.
the total number of target descriptors, always 1. |
getTotalTimeOut | public int getTotalTimeOut()(Code) | | Returns the total time-out for a call to the service. The value 0
is returned if there is no total time-out.
the total time-out for the service, as a positive number, inmilli-seconds, or 0 if there is no total time-out. |
getURL | public String getURL()(Code) | | Returns the URL for the service.
the URL for the service, not null . |
isGroup | public boolean isGroup()(Code) | | Checks if this descriptor denotes a group of descriptors.
false , since this descriptor does not denote a group. |
iterateTargets | public java.util.Iterator iterateTargets()(Code) | | Iterates over all leaves, the target descriptors.
The returned
java.util.Iterator will only return this target
descriptor.
iterator that returns this target descriptor, nevernull . |
toString | public String toString()(Code) | | Textual description of this object. The string includes the URL and all
time-out values. For example:
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)
this TargetDescriptor as a String, nevernull . |
|
|