Class ServiceRef

java.lang.Object
xal.extension.service.ServiceRef

public class ServiceRef extends Object
ServiceRef wraps the native Rendezvous ServiceInfo and provides a reference to the service that hides a direct reference to Rendezvous.
Author:
tap
  • Method Details

    • getServiceName

      public String getServiceName()
      Get the name of the service.
      Returns:
      The name of the service provided.
    • getRawName

      public String getRawName()
      Get the unique raw name of the service provider.
      Returns:
      The raw name of the service provider.
    • getType

      public String getType()
      Get the type of service provided.
      Returns:
      The type of service provided.
    • getFullType

      public String getFullType()
      Get the fully qualified type
      Returns:
      the fully qualified type
    • getHostAddress

      public String getHostAddress()
      Get the address of the remote service.
      Returns:
      the address of the remote service
    • getPort

      public int getPort()
      Get the port for connecting to the remote service.
      Returns:
      the port for connecting to the remote service
    • equals

      public boolean equals(Object other)
      Override equals to compare the wrapped service info instances.
      Overrides:
      equals in class Object
      Parameters:
      other - The other service reference against which to compare this one.
      Returns:
      true if the other service reference refers to the same service provider as the this instance and false otherwise.
    • hashCode

      public int hashCode()
      override hashCode as required for consistency with equals
      Overrides:
      hashCode in class Object
    • getBaseType

      protected static String getBaseType(String fullType)
      Internally used to strip the communication protocol and DNS address from the full type name.
      Parameters:
      fullType - The full rendezvous type (e.g. "greeting._tcp._local.")
      Returns:
      Just the simple base type (e.g. "greeting")
    • getBaseName

      protected static String getBaseName(String fullName, String fullType)
      Internally used to strip the type information from the name to get just the base name.
      Parameters:
      fullName - The full rendezvous name (e.g. "Mary.greeting._tcp._local.")
      fullType - The full rendezvous type (e.g. "greeting._tcp._local.")
      Returns:
      The simple base name (e.g. "Mary")
    • getFullType

      protected static String getFullType(String baseType)
      Internally used to construct the full bonjour type from the simple base type.
      Parameters:
      baseType - The simple base type (e.g. "greeting")
      Returns:
      The full rendezvous type (e.g. "greeting._tcp.local.")