Package javax.jmdns.impl
Class ServiceInfoImpl
- java.lang.Object
-
- javax.jmdns.ServiceInfo
-
- javax.jmdns.impl.ServiceInfoImpl
-
- All Implemented Interfaces:
java.lang.Cloneable,DNSListener,DNSStatefulObject
public class ServiceInfoImpl extends ServiceInfo implements DNSListener, DNSStatefulObject
JmDNS service information.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceServiceInfoImpl.Delegateprivate static classServiceInfoImpl.ServiceInfoState-
Nested classes/interfaces inherited from class javax.jmdns.ServiceInfo
ServiceInfo.Fields
-
Nested classes/interfaces inherited from interface javax.jmdns.impl.DNSStatefulObject
DNSStatefulObject.DefaultImplementation, DNSStatefulObject.DNSStatefulObjectSemaphore
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String_applicationprivate ServiceInfoImpl.Delegate_delegateprivate java.lang.String_domainprivate java.util.Set<java.net.Inet4Address>_ipv4Addressesprivate java.util.Set<java.net.Inet6Address>_ipv6Addressesprivate java.lang.String_keyprivate java.lang.String_nameprivate boolean_needTextAnnouncingprivate boolean_persistentprivate int_portprivate int_priorityprivate java.util.Map<java.lang.String,byte[]>_propsprivate java.lang.String_protocolprivate java.lang.String_serverprivate ServiceInfoImpl.ServiceInfoState_stateprivate java.lang.String_subtypeprivate byte[]_textprivate int_weightprivate static org.slf4j.Loggerlogger
-
Constructor Summary
Constructors Constructor Description 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.lang.String 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.util.Map<ServiceInfo.Fields,java.lang.String> qualifiedNameMap, int port, int weight, int priority, boolean persistent, byte[] text)ServiceInfoImpl(java.util.Map<ServiceInfo.Fields,java.lang.String> qualifiedNameMap, int port, int weight, int priority, boolean persistent, java.lang.String text)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(ServiceInfo info)During recovery we need to duplicate service info to reregister them
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description (package private) void_setText(byte[] text)This is used internally by the framework(package private) voidaddAddress(java.net.Inet4Address addr)(package private) voidaddAddress(java.net.Inet6Address addr)booleanadvanceState(DNSTask task)Sets the state and notifies all objects that wait on the ServiceInfo.java.util.Collection<DNSRecord>answers(DNSRecordClass recordClass, boolean unique, int ttl, HostInfo localHost)Create a series of answer that correspond with the give service info.voidassociateWithTask(DNSTask task, DNSState state)Sets the task associated with this Object.booleancancelState()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)ServiceInfoImplclone()booleancloseState()Sets the state and notifies all objects that wait on the ServiceInfo.(package private) static java.util.Map<ServiceInfo.Fields,java.lang.String>createQualifiedMap(java.lang.String instance, java.lang.String application, java.lang.String protocol, java.lang.String domain, java.lang.String subtype)booleanequals(java.lang.Object obj)java.net.InetAddressgetAddress()Deprecated.java.lang.StringgetApplication()Returns the application of the service info suitable for printing.(package private) ServiceInfoImpl.DelegategetDelegate()JmDNSImplgetDns()Returns the DNS associated with this object.java.lang.StringgetDomain()Returns the domain of the service info suitable for printing.java.lang.StringgetHostAddress()Deprecated.java.lang.String[]getHostAddresses()Returns the host IP addresses string in textual presentation.java.net.Inet4AddressgetInet4Address()Deprecated.java.net.Inet4Address[]getInet4Addresses()Returns a list of all IPv4 InetAddresses that can be used for this service.java.net.Inet6AddressgetInet6Address()Deprecated.java.net.Inet6Address[]getInet6Addresses()Returns a list of all IPv6 InetAddresses that can be used for this service.java.net.InetAddressgetInetAddress()Deprecated.java.net.InetAddress[]getInetAddresses()Returns a list of all InetAddresses that can be used for this service.java.lang.StringgetKey()The key is used to retrieve service info in hash tables.
The key is the lower case qualified name.java.lang.StringgetName()Unqualified service instance name, such asfoobar.java.lang.StringgetNiceTextString()Returns a description of the service info suitable for printing.intgetPort()Get the port for the service.intgetPriority()Get the priority of the service.(package private) java.util.Map<java.lang.String,byte[]>getProperties()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.StringgetPropertyString(java.lang.String name)Get a property of the service.java.lang.StringgetProtocol()Returns the protocol of the service info suitable for printing.java.lang.StringgetQualifiedName()Fully qualified service name, such asfoobar._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.StringgetServer()Get the name of the server.java.lang.StringgetSubtype()Returns the sub type of the service info suitable for printing.byte[]getTextBytes()Get the text for the service as raw bytes.java.lang.StringgetTextString()Deprecated.java.lang.StringgetType()Fully qualified service type name, such as_http._tcp.local.java.lang.StringgetTypeWithSubtype()Fully qualified service type name with the subtype if appropriate, such as_printer._sub._http._tcp.local.java.lang.StringgetURL()Deprecated.java.lang.StringgetURL(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.intgetWeight()Get the weight of the service.private booleanhandleExpiredRecord(DNSRecord record)Handles expired records insofar that it removes their content from this service.private booleanhandleUpdateRecord(DNSCache dnsCache, long now, DNSRecord record)Adds data ofDNSRecordto the internal service representation.booleanhasData()Returns true if the service info is filled with data.inthashCode()private booleanhasInetAddress()booleanhasSameAddresses(ServiceInfo other)Compare addresses of another ServiceInfobooleanhasServer()Returns true if the service info has a serverbooleanisAnnounced()Returns true, if this is an announced state.booleanisAnnouncing()Returns true, if this is an announcing state.booleanisAssociatedWithTask(DNSTask task, DNSState state)Checks if this object is associated with the task and in the same state.booleanisCanceled()Returns true, if this is a canceled state.booleanisCanceling()Returns true, if this is a canceling state.booleanisClosed()Returns true, if this is a closed state.booleanisClosing()Returns true, if this is a closing state.booleanisPersistent()Returnstrueif ServiceListener.resolveService will be called whenever new new information is received.booleanisProbing()Returns true, if this is a probing state.booleanneedTextAnnouncing()booleanrecoverState()Sets the state and notifies all objects that wait on the ServiceInfo.voidremoveAssociationWithTask(DNSTask task)Remove the association of the task with this Object.(package private) static java.lang.StringremoveSeparators(java.lang.String name)booleanrevertState()Sets the state and notifies all objects that wait on the ServiceInfo.(package private) voidsetDelegate(ServiceInfoImpl.Delegate delegate)voidsetDns(JmDNSImpl dns)(package private) voidsetName(java.lang.String name)Sets the service instance name.voidsetNeedTextAnnouncing(boolean needTextAnnouncing)(package private) voidsetServer(java.lang.String server)voidsetText(byte[] text)Set the text for the service.voidsetText(java.util.Map<java.lang.String,?> props)Set the text for the service.java.lang.StringtoString()voidupdateRecord(DNSCache dnsCache, long now, DNSEntry dnsEntry)JmDNS callback to update a DNS record.booleanwaitForAnnounced(long timeout)Waits for the object to be announced.booleanwaitForCanceled(long timeout)Waits for the object to be canceled.
-
-
-
Field Detail
-
logger
private static org.slf4j.Logger logger
-
_domain
private java.lang.String _domain
-
_protocol
private java.lang.String _protocol
-
_application
private java.lang.String _application
-
_name
private java.lang.String _name
-
_subtype
private java.lang.String _subtype
-
_server
private java.lang.String _server
-
_port
private int _port
-
_weight
private int _weight
-
_priority
private int _priority
-
_text
private byte[] _text
-
_props
private java.util.Map<java.lang.String,byte[]> _props
-
_ipv4Addresses
private final java.util.Set<java.net.Inet4Address> _ipv4Addresses
-
_ipv6Addresses
private final java.util.Set<java.net.Inet6Address> _ipv6Addresses
-
_key
private transient java.lang.String _key
-
_persistent
private boolean _persistent
-
_needTextAnnouncing
private boolean _needTextAnnouncing
-
_state
private final ServiceInfoImpl.ServiceInfoState _state
-
_delegate
private ServiceInfoImpl.Delegate _delegate
-
-
Constructor Detail
-
ServiceInfoImpl
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)- Parameters:
type-name-subtype-port-weight-priority-persistent-text-- See Also:
ServiceInfo.create(String, String, int, int, int, String)
-
ServiceInfoImpl
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)- Parameters:
type-name-subtype-port-weight-priority-persistent-props-- See Also:
ServiceInfo.create(String, String, int, int, int, Map)
-
ServiceInfoImpl
public ServiceInfoImpl(java.lang.String type, java.lang.String name, java.lang.String subtype, int port, int weight, int priority, boolean persistent, byte[] text)- Parameters:
type-name-subtype-port-weight-priority-persistent-text-- See Also:
ServiceInfo.create(String, String, int, int, int, byte[])
-
ServiceInfoImpl
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)
-
ServiceInfoImpl
ServiceInfoImpl(java.util.Map<ServiceInfo.Fields,java.lang.String> qualifiedNameMap, int port, int weight, int priority, boolean persistent, java.lang.String text)
-
ServiceInfoImpl
ServiceInfoImpl(java.util.Map<ServiceInfo.Fields,java.lang.String> qualifiedNameMap, int port, int weight, int priority, boolean persistent, byte[] text)
-
ServiceInfoImpl
ServiceInfoImpl(ServiceInfo info)
During recovery we need to duplicate service info to reregister them- Parameters:
info-
-
-
Method Detail
-
createQualifiedMap
static java.util.Map<ServiceInfo.Fields,java.lang.String> createQualifiedMap(java.lang.String instance, java.lang.String application, java.lang.String protocol, java.lang.String domain, java.lang.String subtype)
-
checkQualifiedNameMap
protected static java.util.Map<ServiceInfo.Fields,java.lang.String> checkQualifiedNameMap(java.util.Map<ServiceInfo.Fields,java.lang.String> qualifiedNameMap)
-
removeSeparators
static java.lang.String removeSeparators(java.lang.String name)
-
getType
public java.lang.String getType()
Fully qualified service type name, such as_http._tcp.local.- Specified by:
getTypein classServiceInfo- Returns:
- service type name
-
getTypeWithSubtype
public java.lang.String getTypeWithSubtype()
Fully qualified service type name with the subtype if appropriate, such as_printer._sub._http._tcp.local.- Specified by:
getTypeWithSubtypein classServiceInfo- Returns:
- service type name
-
getName
public java.lang.String getName()
Unqualified service instance name, such asfoobar.- Specified by:
getNamein classServiceInfo- Returns:
- service name
-
getKey
public java.lang.String getKey()
The key is used to retrieve service info in hash tables.
The key is the lower case qualified name.- Specified by:
getKeyin classServiceInfo- Returns:
- the key
-
setName
void setName(java.lang.String name)
Sets the service instance name.- Parameters:
name- unqualified service instance name, such asfoobar
-
getQualifiedName
public java.lang.String getQualifiedName()
Fully qualified service name, such asfoobar._http._tcp.local..- Specified by:
getQualifiedNamein classServiceInfo- Returns:
- qualified service name
-
getServer
public java.lang.String getServer()
Description copied from class:ServiceInfoGet the name of the server. Note: This will be an empty string if no value has been set- Specified by:
getServerin classServiceInfo- Returns:
- server name
- See Also:
ServiceInfo.getServer()
-
hasServer
public boolean hasServer()
Description copied from class:ServiceInfoReturns true if the service info has a server- Specified by:
hasServerin classServiceInfo- Returns:
trueif the service info has a server specified,falseotherwise.- See Also:
ServiceInfo.hasServer()
-
setServer
void setServer(java.lang.String server)
- Parameters:
server- the server to set
-
getHostAddress
@Deprecated public java.lang.String getHostAddress()
Deprecated.Returns the host IP address string in textual presentation.
Note: This can be either an IPv4 or an IPv6 representation.- Specified by:
getHostAddressin classServiceInfo- Returns:
- the host raw IP address in a string format.
- See Also:
ServiceInfo.getHostAddresses()
-
getHostAddresses
public java.lang.String[] getHostAddresses()
Returns the host IP addresses string in textual presentation.- Specified by:
getHostAddressesin classServiceInfo- Returns:
- list of host raw IP address in a string format.
-
addAddress
void addAddress(java.net.Inet4Address addr)
- Parameters:
addr- the addr to add
-
addAddress
void addAddress(java.net.Inet6Address addr)
- Parameters:
addr- the addr to add
-
getAddress
@Deprecated public java.net.InetAddress getAddress()
Deprecated.Get the host address of the service.- Specified by:
getAddressin classServiceInfo- Returns:
- host Internet address
- See Also:
ServiceInfo.getInetAddresses()
-
getInetAddress
@Deprecated public java.net.InetAddress getInetAddress()
Deprecated.Get the InetAddress of the service. This will return the IPv4 if it exist, otherwise it return the IPv6 if set.
Note: This return null if the service IP address cannot be resolved.- Specified by:
getInetAddressin classServiceInfo- Returns:
- Internet address
- See Also:
ServiceInfo.getInetAddresses()
-
getInet4Address
@Deprecated public java.net.Inet4Address getInet4Address()
Deprecated.Get the IPv4 InetAddress of the service.
Note: This return null if the service IPv4 address cannot be resolved.- Specified by:
getInet4Addressin classServiceInfo- Returns:
- Internet address
- See Also:
ServiceInfo.getInet4Addresses()
-
getInet6Address
@Deprecated public java.net.Inet6Address getInet6Address()
Deprecated.Get the IPv6 InetAddress of the service.
Note: This return null if the service IPv6 address cannot be resolved.- Specified by:
getInet6Addressin classServiceInfo- Returns:
- Internet address
- See Also:
ServiceInfo.getInet6Addresses()
-
getInetAddresses
public java.net.InetAddress[] getInetAddresses()
Description copied from class:ServiceInfoReturns a list of all InetAddresses that can be used for this service.In a multi-homed environment service info can be associated with more than one address.
- Specified by:
getInetAddressesin classServiceInfo- Returns:
- list of InetAddress objects
-
getInet4Addresses
public java.net.Inet4Address[] getInet4Addresses()
Description copied from class:ServiceInfoReturns a list of all IPv4 InetAddresses that can be used for this service.In a multi-homed environment service info can be associated with more than one address.
- Specified by:
getInet4Addressesin classServiceInfo- Returns:
- list of InetAddress objects
-
getInet6Addresses
public java.net.Inet6Address[] getInet6Addresses()
Description copied from class:ServiceInfoReturns a list of all IPv6 InetAddresses that can be used for this service.In a multi-homed environment service info can be associated with more than one address.
- Specified by:
getInet6Addressesin classServiceInfo- Returns:
- list of InetAddress objects
-
getPort
public int getPort()
Description copied from class:ServiceInfoGet the port for the service.- Specified by:
getPortin classServiceInfo- Returns:
- service port
- See Also:
ServiceInfo.getPort()
-
getPriority
public int getPriority()
Description copied from class:ServiceInfoGet the priority of the service.- Specified by:
getPriorityin classServiceInfo- Returns:
- service priority
- See Also:
ServiceInfo.getPriority()
-
getWeight
public int getWeight()
Description copied from class:ServiceInfoGet the weight of the service.- Specified by:
getWeightin classServiceInfo- Returns:
- service weight
- See Also:
ServiceInfo.getWeight()
-
getTextBytes
public byte[] getTextBytes()
Description copied from class:ServiceInfoGet the text for the service as raw bytes.- Specified by:
getTextBytesin classServiceInfo- Returns:
- raw service text
- See Also:
ServiceInfo.getTextBytes()
-
getTextString
@Deprecated public java.lang.String getTextString()
Deprecated.Get the text for the service. This will interpret the text bytes as a UTF8 encoded string. Will return null if the bytes are not a valid UTF8 encoded string.
Note: Do not use. This method make the assumption that the TXT record is one string. This is false. The TXT record is a series of key value pairs.- Specified by:
getTextStringin classServiceInfo- Returns:
- service text
- See Also:
ServiceInfo.getPropertyNames(),ServiceInfo.getPropertyBytes(String),ServiceInfo.getPropertyString(String)
-
getURL
@Deprecated public java.lang.String getURL()
Deprecated.Description copied from class:ServiceInfoGet the URL for this service. An http URL is created by combining the address, port, and path properties.- Specified by:
getURLin classServiceInfo- Returns:
- service URL
- See Also:
ServiceInfo.getURLs()
-
getURLs
public java.lang.String[] getURLs()
Description copied from class:ServiceInfoGet the list of URL for this service. An http URL is created by combining the address, port, and path properties.- Specified by:
getURLsin classServiceInfo- Returns:
- list of service URL
-
getURL
@Deprecated public java.lang.String getURL(java.lang.String protocol)
Deprecated.Description copied from class:ServiceInfoGet the URL for this service. An URL is created by combining the protocol, address, port, and path properties.- Specified by:
getURLin classServiceInfo- Parameters:
protocol- requested protocol- Returns:
- service URL
- See Also:
ServiceInfo.getURLs()
-
getURLs
public java.lang.String[] getURLs(java.lang.String protocol)
Description copied from class:ServiceInfoGet the list of URL for this service. An URL is created by combining the protocol, address, port, and path properties.- Specified by:
getURLsin classServiceInfo- Parameters:
protocol- requested protocol- Returns:
- list of service URL
-
getPropertyBytes
public byte[] getPropertyBytes(java.lang.String name)
Get a property of the service. This involves decoding the text bytes into a property list. Returns null if the property is not found or the text data could not be decoded correctly.- Specified by:
getPropertyBytesin classServiceInfo- Parameters:
name- property name- Returns:
- raw property text
-
getPropertyString
public java.lang.String getPropertyString(java.lang.String name)
Get a property of the service. This involves decoding the text bytes into a property list. Returns null if the property is not found, the text data could not be decoded correctly, or the resulting bytes are not a valid UTF8 string.- Specified by:
getPropertyStringin classServiceInfo- Parameters:
name- property name- Returns:
- property text
-
getPropertyNames
public java.util.Enumeration<java.lang.String> getPropertyNames()
Enumeration of the property names.- Specified by:
getPropertyNamesin classServiceInfo- Returns:
- property name enumeration
-
getApplication
public java.lang.String getApplication()
Returns the application of the service info suitable for printing.- Specified by:
getApplicationin classServiceInfo- Returns:
- service application
-
getDomain
public java.lang.String getDomain()
Returns the domain of the service info suitable for printing.- Specified by:
getDomainin classServiceInfo- Returns:
- service domain
-
getProtocol
public java.lang.String getProtocol()
Returns the protocol of the service info suitable for printing.- Specified by:
getProtocolin classServiceInfo- Returns:
- service protocol
-
getSubtype
public java.lang.String getSubtype()
Returns the sub type of the service info suitable for printing.- Specified by:
getSubtypein classServiceInfo- Returns:
- service sub type
-
getQualifiedNameMap
public java.util.Map<ServiceInfo.Fields,java.lang.String> getQualifiedNameMap()
Returns a dictionary of the fully qualified name component of this service.- Specified by:
getQualifiedNameMapin classServiceInfo- Returns:
- dictionary of the fully qualified name components
-
getProperties
java.util.Map<java.lang.String,byte[]> getProperties()
-
updateRecord
public void updateRecord(DNSCache dnsCache, long now, DNSEntry dnsEntry)
JmDNS callback to update a DNS record.- Specified by:
updateRecordin interfaceDNSListener- Parameters:
dnsCache-now-dnsEntry-
-
handleExpiredRecord
private boolean handleExpiredRecord(DNSRecord record)
Handles expired records insofar that it removes their content from this service. Implementation note:
Currently only expired A and AAAA records are handled.- Parameters:
record- to check for data to be removed- Returns:
trueif data from the expired record could be removed from this service,falseotherwise
-
handleUpdateRecord
private boolean handleUpdateRecord(DNSCache dnsCache, long now, DNSRecord record)
Adds data ofDNSRecordto the internal service representation.- Parameters:
dnsCache-now-record- to get data from- Returns:
trueif service was updated,falseotherwise
-
hasData
public boolean hasData()
Returns true if the service info is filled with data.- Specified by:
hasDatain classServiceInfo- Returns:
trueif the service info has data,falseotherwise.
-
hasInetAddress
private final boolean hasInetAddress()
-
advanceState
public boolean advanceState(DNSTask task)
Sets the state and notifies all objects that wait on the ServiceInfo.- Specified by:
advanceStatein interfaceDNSStatefulObject- Parameters:
task- associated task- Returns:
trueif the state was changed by this thread,falseotherwise.- See Also:
DNSState.advance()
-
revertState
public boolean revertState()
Sets the state and notifies all objects that wait on the ServiceInfo.- Specified by:
revertStatein interfaceDNSStatefulObject- Returns:
trueif the state was changed by this thread,falseotherwise.- See Also:
DNSState.revert()
-
cancelState
public boolean cancelState()
Sets the state and notifies all objects that wait on the ServiceInfo.- Specified by:
cancelStatein interfaceDNSStatefulObject- Returns:
trueif the state was changed by this thread,falseotherwise.
-
closeState
public boolean closeState()
Sets the state and notifies all objects that wait on the ServiceInfo.- Specified by:
closeStatein interfaceDNSStatefulObject- Returns:
trueif the state was changed by this thread,falseotherwise.
-
recoverState
public boolean recoverState()
Sets the state and notifies all objects that wait on the ServiceInfo.- Specified by:
recoverStatein interfaceDNSStatefulObject- Returns:
trueif the state was changed by this thread,falseotherwise.
-
removeAssociationWithTask
public void removeAssociationWithTask(DNSTask task)
Remove the association of the task with this Object.- Specified by:
removeAssociationWithTaskin interfaceDNSStatefulObject- Parameters:
task- associated task
-
associateWithTask
public void associateWithTask(DNSTask task, DNSState state)
Sets the task associated with this Object.- Specified by:
associateWithTaskin interfaceDNSStatefulObject- Parameters:
task- associated taskstate- state of the task
-
isAssociatedWithTask
public boolean isAssociatedWithTask(DNSTask task, DNSState state)
Checks if this object is associated with the task and in the same state.- Specified by:
isAssociatedWithTaskin interfaceDNSStatefulObject- Parameters:
task- associated taskstate- state of the task- Returns:
trueis the task is associated with this object,falseotherwise.
-
isProbing
public boolean isProbing()
Returns true, if this is a probing state.- Specified by:
isProbingin interfaceDNSStatefulObject- Returns:
trueif probing state,falseotherwise
-
isAnnouncing
public boolean isAnnouncing()
Returns true, if this is an announcing state.- Specified by:
isAnnouncingin interfaceDNSStatefulObject- Returns:
trueif announcing state,falseotherwise
-
isAnnounced
public boolean isAnnounced()
Returns true, if this is an announced state.- Specified by:
isAnnouncedin interfaceDNSStatefulObject- Returns:
trueif announced state,falseotherwise
-
isCanceling
public boolean isCanceling()
Returns true, if this is a canceling state.- Specified by:
isCancelingin interfaceDNSStatefulObject- Returns:
trueif canceling state,falseotherwise
-
isCanceled
public boolean isCanceled()
Returns true, if this is a canceled state.- Specified by:
isCanceledin interfaceDNSStatefulObject- Returns:
trueif canceled state,falseotherwise
-
isClosing
public boolean isClosing()
Returns true, if this is a closing state.- Specified by:
isClosingin interfaceDNSStatefulObject- Returns:
trueif closing state,falseotherwise
-
isClosed
public boolean isClosed()
Returns true, if this is a closed state.- Specified by:
isClosedin interfaceDNSStatefulObject- Returns:
trueif closed state,falseotherwise
-
waitForAnnounced
public boolean waitForAnnounced(long timeout)
Waits for the object to be announced.- Specified by:
waitForAnnouncedin interfaceDNSStatefulObject- Parameters:
timeout- the maximum time to wait in milliseconds.- Returns:
trueif the object is announced,falseotherwise
-
waitForCanceled
public boolean waitForCanceled(long timeout)
Waits for the object to be canceled.- Specified by:
waitForCanceledin interfaceDNSStatefulObject- Parameters:
timeout- the maximum time to wait in milliseconds.- Returns:
trueif the object is canceled,falseotherwise
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
getNiceTextString
public java.lang.String getNiceTextString()
Returns a description of the service info suitable for printing.- Specified by:
getNiceTextStringin classServiceInfo- Returns:
- service info description
-
clone
public ServiceInfoImpl clone()
- Overrides:
clonein classServiceInfo
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
answers
public java.util.Collection<DNSRecord> answers(DNSRecordClass recordClass, boolean unique, int ttl, HostInfo localHost)
Create a series of answer that correspond with the give service info.- Parameters:
recordClass- record class of the queryunique-ttl-localHost-- Returns:
- collection of answers
-
setText
public void setText(byte[] text) throws java.lang.IllegalStateExceptionSet the text for the service. Setting the text will fore a re-announce of the service.- Specified by:
setTextin classServiceInfo- Parameters:
text- the raw byte representation of the text field.- Throws:
java.lang.IllegalStateException- if attempting to set the text for a non persistent service info.
-
setText
public void setText(java.util.Map<java.lang.String,?> props) throws java.lang.IllegalStateExceptionSet the text for the service. Setting the text will fore a re-announce of the service.- Specified by:
setTextin classServiceInfo- Parameters:
props- a key=value map that will be encoded into raw bytes.- Throws:
java.lang.IllegalStateException- if attempting to set the text for a non persistent service info.
-
_setText
void _setText(byte[] text)
This is used internally by the framework- Parameters:
text-
-
setDns
public void setDns(JmDNSImpl dns)
-
getDns
public JmDNSImpl getDns()
Returns the DNS associated with this object.- Specified by:
getDnsin interfaceDNSStatefulObject- Returns:
- DNS resolver
-
isPersistent
public boolean isPersistent()
Returnstrueif ServiceListener.resolveService will be called whenever new new information is received.- Specified by:
isPersistentin classServiceInfo- Returns:
- the persistent
-
setNeedTextAnnouncing
public void setNeedTextAnnouncing(boolean needTextAnnouncing)
- Parameters:
needTextAnnouncing- the needTextAnnouncing to set
-
needTextAnnouncing
public boolean needTextAnnouncing()
- Returns:
- the needTextAnnouncing
-
getDelegate
ServiceInfoImpl.Delegate getDelegate()
- Returns:
- the delegate
-
setDelegate
void setDelegate(ServiceInfoImpl.Delegate delegate)
- Parameters:
delegate- the delegate to set
-
hasSameAddresses
public boolean hasSameAddresses(ServiceInfo other)
Description copied from class:ServiceInfoCompare addresses of another ServiceInfo- Specified by:
hasSameAddressesin classServiceInfo- Parameters:
other- ServiceInfo to compare- Returns:
- true if addresses are the same, false if not
-
-