public final class ServiceURL extends AuthenticatedURL implements Serializable
Modifier and Type | Field and Description |
---|---|
static int |
LIFETIME_DEFAULT |
static int |
LIFETIME_MAXIMUM |
static int |
LIFETIME_NONE |
static int |
LIFETIME_PERMANENT |
static int |
NO_PORT |
authBlocks
Constructor and Description |
---|
ServiceURL(String serviceURL,
int lifeTime)
create a new ServiceURL instance from a String.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
Check if two instances are equal.
|
static ServiceURL |
fromBytes(DataInputStream input)
Reads a byte stream from a DataInput and constructs a ServiceURL from it,
following the RFC 2608 schema:
|
String |
getHost()
get the host.
|
int |
getLength() |
int |
getLifetime()
get the lifetime.
|
int |
getPort()
get the port.
|
String |
getProtocol()
get the protocol.
|
ServiceType |
getServiceType()
get the service type.
|
String |
getTransport()
Deprecated.
|
String |
getURLPath()
get the URL path.
|
int |
hashCode()
get the hashCode of the ServiceURL instance.
|
boolean |
matches(Object obj)
Check if a ServiceURL matches another ServiceURL or a ServiceType.
|
String |
toString()
get a String representation of the ServiceURL.
|
void |
writeTo(DataOutputStream out)
get the byte representation of the ServiceURL instance.
|
getAuthBlockLength, parseAuthBlock, sign, verify, writeAuthBlock
public static final int NO_PORT
public static final int LIFETIME_NONE
public static final int LIFETIME_DEFAULT
public static final int LIFETIME_MAXIMUM
public static final int LIFETIME_PERMANENT
public ServiceURL(String serviceURL, int lifeTime) throws ServiceLocationException
serviceURL
- the string representation of a ServiceURL like
service::"serviceType"://"addrspec"where servicetype should be of the form abstractType:concreteType and addrspec is the hostname or dotted decimal notation of the host's address followed by an optional :portNumber. Example:
service:osgi:remote://my.host.ch:9200
lifeTime
- the lifetime of the ServiceURL in seconds.ServiceLocationException
- if the String is not parsable.public boolean equals(Object obj)
public boolean matches(Object obj)
obj
- a ServiceURL or ServiceType. All other objects will return
false.public String toString()
public int hashCode()
public ServiceType getServiceType()
public String getTransport()
public String getProtocol()
public String getHost()
public int getPort()
public String getURLPath()
public int getLifetime()
public void writeTo(DataOutputStream out) throws IOException
IOException
IOException
- if an internal processing error occurs.public int getLength()
public static ServiceURL fromBytes(DataInputStream input) throws ServiceLocationException, IOException
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Reserved | Lifetime | URL Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |URL len, contd.| URL (variable length) \ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |# of URL auths | Auth. blocks (if any) \ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+.
input
- the DataInput streaming the ServiceURL bytes.ServiceLocationException
- in case of IO exceptions.IOException
Copyright © 2018 universAAL Consortium. All rights reserved.