public class ServiceInfoImpl extends ServiceInfo implements DNSStatefulObject
| Modifier and Type | Class and Description |
|---|---|
static interface |
ServiceInfoImpl.Delegate |
ServiceInfo.FieldsDNSStatefulObject.DefaultImplementation, DNSStatefulObject.DNSStatefulObjectSemaphoreNO_VALUE| Constructor and Description |
|---|
ServiceInfoImpl(java.util.Map<ServiceInfo.Fields,java.lang.String> qualifiedNameMap,
int port,
int weight,
int priority,
boolean persistent,
java.util.Map<java.lang.String,?> props) |
ServiceInfoImpl(java.lang.String type,
java.lang.String name,
java.lang.String subtype,
int port,
int weight,
int priority,
boolean persistent,
byte[] text) |
ServiceInfoImpl(java.lang.String type,
java.lang.String name,
java.lang.String subtype,
int port,
int weight,
int priority,
boolean persistent,
java.util.Map<java.lang.String,?> props) |
ServiceInfoImpl(java.lang.String type,
java.lang.String name,
java.lang.String subtype,
int port,
int weight,
int priority,
boolean persistent,
java.lang.String text) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
advanceState(DNSTask task)
Sets the state and notifies all objects that wait on the ServiceInfo.
|
java.util.Collection<DNSRecord> |
answers(boolean unique,
int ttl,
HostInfo localHost) |
void |
associateWithTask(DNSTask task,
DNSState state)
Sets the task associated with this Object.
|
boolean |
cancelState()
Sets the state and notifies all objects that wait on the ServiceInfo.
|
protected static java.util.Map<ServiceInfo.Fields,java.lang.String> |
checkQualifiedNameMap(java.util.Map<ServiceInfo.Fields,java.lang.String> qualifiedNameMap) |
ServiceInfoImpl |
clone() |
boolean |
closeState()
Sets the state and notifies all objects that wait on the ServiceInfo.
|
static java.util.Map<ServiceInfo.Fields,java.lang.String> |
decodeQualifiedNameMap(java.lang.String type,
java.lang.String name,
java.lang.String subtype) |
static java.util.Map<ServiceInfo.Fields,java.lang.String> |
decodeQualifiedNameMapForType(java.lang.String type) |
boolean |
equals(java.lang.Object obj) |
java.net.InetAddress |
getAddress()
Deprecated.
|
java.lang.String |
getApplication()
Returns the application of the service info suitable for printing.
|
JmDNSImpl |
getDns()
Returns the DNS associated with this object.
|
java.lang.String |
getDomain()
Returns the domain of the service info suitable for printing.
|
java.lang.String |
getHostAddress()
Deprecated.
|
java.lang.String[] |
getHostAddresses()
Returns the host IP addresses string in textual presentation.
|
java.net.Inet4Address |
getInet4Address()
Deprecated.
|
java.net.Inet4Address[] |
getInet4Addresses()
Returns a list of all IPv4 InetAddresses that can be used for this service.
|
java.net.Inet6Address |
getInet6Address()
Deprecated.
|
java.net.Inet6Address[] |
getInet6Addresses()
Returns a list of all IPv6 InetAddresses that can be used for this service.
|
java.net.InetAddress |
getInetAddress()
Deprecated.
|
java.net.InetAddress[] |
getInetAddresses()
Returns a list of all InetAddresses that can be used for this service.
|
java.lang.String |
getKey()
The key is used to retrieve service info in hash tables.
The key is the lower case qualified name. |
java.lang.String |
getName()
Unqualified service instance name, such as
foobar . |
java.lang.String |
getNiceTextString()
Returns a description of the service info suitable for printing.
|
int |
getPort()
Get the port for the service.
|
int |
getPriority()
Get the priority of the service.
|
byte[] |
getPropertyBytes(java.lang.String name)
Get a property of the service.
|
java.util.Enumeration<java.lang.String> |
getPropertyNames()
Enumeration of the property names.
|
java.lang.String |
getPropertyString(java.lang.String name)
Get a property of the service.
|
java.lang.String |
getProtocol()
Returns the protocol of the service info suitable for printing.
|
java.lang.String |
getQualifiedName()
Fully qualified service name, such as
foobar._http._tcp.local. . |
java.util.Map<ServiceInfo.Fields,java.lang.String> |
getQualifiedNameMap()
Returns a dictionary of the fully qualified name component of this service.
|
java.lang.String |
getServer()
Get the name of the server.
|
java.lang.String |
getSubtype()
Returns the sub type of the service info suitable for printing.
|
byte[] |
getTextBytes()
Get the text for the service as raw bytes.
|
java.lang.String |
getTextString()
Deprecated.
|
java.lang.String |
getType()
Fully qualified service type name, such as
_http._tcp.local. |
java.lang.String |
getTypeWithSubtype()
Fully qualified service type name with the subtype if appropriate, such as
_printer._sub._http._tcp.local. |
java.lang.String |
getURL()
Deprecated.
|
java.lang.String |
getURL(java.lang.String protocol)
Deprecated.
|
java.lang.String[] |
getURLs()
Get the list of URL for this service.
|
java.lang.String[] |
getURLs(java.lang.String protocol)
Get the list of URL for this service.
|
int |
getWeight()
Get the weight of the service.
|
boolean |
hasData()
Returns true if the service info is filled with data.
|
int |
hashCode() |
boolean |
isAnnounced()
Returns true, if this is an announced state.
|
boolean |
isAnnouncing()
Returns true, if this is an announcing state.
|
boolean |
isAssociatedWithTask(DNSTask task,
DNSState state)
Checks if this object is associated with the task and in the same state.
|
boolean |
isCanceled()
Returns true, if this is a canceled state.
|
boolean |
isCanceling()
Returns true, if this is a canceling state.
|
boolean |
isClosed()
Returns true, if this is a closed state.
|
boolean |
isClosing()
Returns true, if this is a closing state.
|
boolean |
isPersistent()
Returns
true if ServiceListener.resolveService will be called whenever new new information is received. |
boolean |
isProbing()
Returns true, if this is a probing state.
|
boolean |
needTextAnnouncing() |
boolean |
recoverState()
Sets the state and notifies all objects that wait on the ServiceInfo.
|
void |
removeAssociationWithTask(DNSTask task)
Remove the association of the task with this Object.
|
boolean |
revertState()
Sets the state and notifies all objects that wait on the ServiceInfo.
|
void |
setDns(JmDNSImpl dns) |
void |
setNeedTextAnnouncing(boolean needTextAnnouncing) |
void |
setText(byte[] text)
Set the text for the service.
|
void |
setText(java.util.Map<java.lang.String,?> props)
Set the text for the service.
|
java.lang.String |
toString() |
void |
updateRecord(DNSCache dnsCache,
long now,
DNSEntry rec)
JmDNS callback to update a DNS record.
|
boolean |
waitForAnnounced(long timeout)
Waits for the object to be announced.
|
boolean |
waitForCanceled(long timeout)
Waits for the object to be canceled.
|
public ServiceInfoImpl(java.lang.String type,
java.lang.String name,
java.lang.String subtype,
int port,
int weight,
int priority,
boolean persistent,
java.lang.String text)
type - name - subtype - port - weight - priority - persistent - text - ServiceInfo.create(String, String, int, int, int, String)public ServiceInfoImpl(java.lang.String type,
java.lang.String name,
java.lang.String subtype,
int port,
int weight,
int priority,
boolean persistent,
java.util.Map<java.lang.String,?> props)
type - name - subtype - port - weight - priority - persistent - props - ServiceInfo.create(String, String, int, int, int, Map)public ServiceInfoImpl(java.lang.String type,
java.lang.String name,
java.lang.String subtype,
int port,
int weight,
int priority,
boolean persistent,
byte[] text)
type - name - subtype - port - weight - priority - persistent - text - ServiceInfo.create(String, String, int, int, int, byte[])public ServiceInfoImpl(java.util.Map<ServiceInfo.Fields,java.lang.String> qualifiedNameMap, int port, int weight, int priority, boolean persistent, java.util.Map<java.lang.String,?> props)
public static java.util.Map<ServiceInfo.Fields,java.lang.String> decodeQualifiedNameMap(java.lang.String type, java.lang.String name, java.lang.String subtype)
public static java.util.Map<ServiceInfo.Fields,java.lang.String> decodeQualifiedNameMapForType(java.lang.String type)
protected static java.util.Map<ServiceInfo.Fields,java.lang.String> checkQualifiedNameMap(java.util.Map<ServiceInfo.Fields,java.lang.String> qualifiedNameMap)
public java.lang.String getType()
_http._tcp.local.getType in class ServiceInfopublic java.lang.String getTypeWithSubtype()
_printer._sub._http._tcp.local.getTypeWithSubtype in class ServiceInfopublic java.lang.String getName()
foobar .getName in class ServiceInfopublic java.lang.String getKey()
getKey in class ServiceInfopublic java.lang.String getQualifiedName()
foobar._http._tcp.local. .getQualifiedName in class ServiceInfopublic java.lang.String getServer()
ServiceInfogetServer in class ServiceInfoServiceInfo.getServer()@Deprecated public java.lang.String getHostAddress()
getHostAddress in class ServiceInfoServiceInfo.getHostAddresses()public java.lang.String[] getHostAddresses()
getHostAddresses in class ServiceInfo@Deprecated public java.net.InetAddress getAddress()
getAddress in class ServiceInfoServiceInfo.getInetAddresses()@Deprecated public java.net.InetAddress getInetAddress()
getInetAddress in class ServiceInfoServiceInfo.getInetAddresses()@Deprecated public java.net.Inet4Address getInet4Address()
getInet4Address in class ServiceInfoServiceInfo.getInet4Addresses()@Deprecated public java.net.Inet6Address getInet6Address()
getInet6Address in class ServiceInfoServiceInfo.getInet6Addresses()public java.net.InetAddress[] getInetAddresses()
ServiceInfoIn a multi-homed environment service info can be associated with more than one address.
getInetAddresses in class ServiceInfopublic java.net.Inet4Address[] getInet4Addresses()
ServiceInfoIn a multi-homed environment service info can be associated with more than one address.
getInet4Addresses in class ServiceInfopublic java.net.Inet6Address[] getInet6Addresses()
ServiceInfoIn a multi-homed environment service info can be associated with more than one address.
getInet6Addresses in class ServiceInfopublic int getPort()
ServiceInfogetPort in class ServiceInfoServiceInfo.getPort()public int getPriority()
ServiceInfogetPriority in class ServiceInfoServiceInfo.getPriority()public int getWeight()
ServiceInfogetWeight in class ServiceInfoServiceInfo.getWeight()public byte[] getTextBytes()
ServiceInfogetTextBytes in class ServiceInfoServiceInfo.getTextBytes()@Deprecated public java.lang.String getTextString()
getTextString in class ServiceInfoServiceInfo.getPropertyNames(),
ServiceInfo.getPropertyBytes(String),
ServiceInfo.getPropertyString(String)@Deprecated public java.lang.String getURL()
ServiceInfogetURL in class ServiceInfoServiceInfo.getURLs()public java.lang.String[] getURLs()
ServiceInfogetURLs in class ServiceInfo@Deprecated public java.lang.String getURL(java.lang.String protocol)
ServiceInfogetURL in class ServiceInfoprotocol - requested protocolServiceInfo.getURLs()public java.lang.String[] getURLs(java.lang.String protocol)
ServiceInfogetURLs in class ServiceInfoprotocol - requested protocolpublic byte[] getPropertyBytes(java.lang.String name)
getPropertyBytes in class ServiceInfoname - property namepublic java.lang.String getPropertyString(java.lang.String name)
getPropertyString in class ServiceInfoname - property namepublic java.util.Enumeration<java.lang.String> getPropertyNames()
getPropertyNames in class ServiceInfopublic java.lang.String getApplication()
getApplication in class ServiceInfopublic java.lang.String getDomain()
getDomain in class ServiceInfopublic java.lang.String getProtocol()
getProtocol in class ServiceInfopublic java.lang.String getSubtype()
getSubtype in class ServiceInfopublic java.util.Map<ServiceInfo.Fields,java.lang.String> getQualifiedNameMap()
getQualifiedNameMap in class ServiceInfopublic void updateRecord(DNSCache dnsCache, long now, DNSEntry rec)
dnsCache - now - rec - public boolean hasData()
hasData in class ServiceInfotrue if the service info has data, false otherwise.public boolean advanceState(DNSTask task)
advanceState in interface DNSStatefulObjecttask - associated tasktruefalse otherwise.DNSState.advance()public boolean revertState()
revertState in interface DNSStatefulObjecttruefalse otherwise.DNSState.revert()public boolean cancelState()
cancelState in interface DNSStatefulObjecttruefalse otherwise.public boolean closeState()
closeState in interface DNSStatefulObjecttruefalse otherwise.public boolean recoverState()
recoverState in interface DNSStatefulObjecttruefalse otherwise.public void removeAssociationWithTask(DNSTask task)
removeAssociationWithTask in interface DNSStatefulObjecttask - associated taskpublic void associateWithTask(DNSTask task, DNSState state)
associateWithTask in interface DNSStatefulObjecttask - associated taskstate - state of the taskpublic boolean isAssociatedWithTask(DNSTask task, DNSState state)
isAssociatedWithTask in interface DNSStatefulObjecttask - associated taskstate - state of the tasktrue is the task is associated with this object, false otherwise.public boolean isProbing()
isProbing in interface DNSStatefulObjecttrue if probing state, false otherwisepublic boolean isAnnouncing()
isAnnouncing in interface DNSStatefulObjecttrue if announcing state, false otherwisepublic boolean isAnnounced()
isAnnounced in interface DNSStatefulObjecttrue if announced state, false otherwisepublic boolean isCanceling()
isCanceling in interface DNSStatefulObjecttrue if canceling state, false otherwisepublic boolean isCanceled()
isCanceled in interface DNSStatefulObjecttrue if canceled state, false otherwisepublic boolean isClosing()
isClosing in interface DNSStatefulObjecttrue if closing state, false otherwisepublic boolean isClosed()
isClosed in interface DNSStatefulObjecttrue if closed state, false otherwisepublic boolean waitForAnnounced(long timeout)
waitForAnnounced in interface DNSStatefulObjecttimeout - the maximum time to wait in milliseconds.true if the object is announced, false otherwisepublic boolean waitForCanceled(long timeout)
waitForCanceled in interface DNSStatefulObjecttimeout - the maximum time to wait in milliseconds.true if the object is canceled, false otherwisepublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic java.lang.String getNiceTextString()
getNiceTextString in class ServiceInfopublic ServiceInfoImpl clone()
clone in class ServiceInfopublic java.lang.String toString()
toString in class java.lang.Objectpublic void setText(byte[] text)
throws java.lang.IllegalStateException
setText in class ServiceInfotext - the raw byte representation of the text field.java.lang.IllegalStateException - if attempting to set the text for a non persistent service info.public void setText(java.util.Map<java.lang.String,?> props)
throws java.lang.IllegalStateException
setText in class ServiceInfoprops - a key=value map that will be encoded into raw bytes.java.lang.IllegalStateException - if attempting to set the text for a non persistent service info.public void setDns(JmDNSImpl dns)
public JmDNSImpl getDns()
getDns in interface DNSStatefulObjectpublic boolean isPersistent()
true if ServiceListener.resolveService will be called whenever new new information is received.isPersistent in class ServiceInfopublic void setNeedTextAnnouncing(boolean needTextAnnouncing)
needTextAnnouncing - the needTextAnnouncing to setpublic boolean needTextAnnouncing()