Class ServiceURL

All Implemented Interfaces:
Serializable

public final class ServiceURL extends ServiceDesignation
An RFC 2609-compliant service description URL. This implementation only deviates from the specification in that it does not support AppleTalk or IPX address schemes.
Author:
David M. Lloyd
See Also:
  • Method Details

    • satisfies

      public boolean satisfies(FilterSpec filterSpec)
      Determine whether this service URL satisfies the given filter specification.
      Parameters:
      filterSpec - the filter specification
      Returns:
      true if this service satisfies the filter specification, false if it does not
    • implies

      public boolean implies(ServiceURL other)
      Determine if this service URL implies the other service URL. This is true only when the two are equal.
      Parameters:
      other - the other service URL
      Returns:
      true if they are equal, false otherwise
    • implies

      public boolean implies(ServiceDesignation other)
      Determine if this service URL implies the other service designation. This is true only when the other designation is a service URL and the two are equal.
      Specified by:
      implies in class ServiceDesignation
      Parameters:
      other - the other service designation
      Returns:
      true if they are equal service URLs, false otherwise
    • equals

      public boolean equals(ServiceURL other)
      Determine whether this service URL is equal to the given object. This is true when the other object is a service URL with the same abstract type and authority, the same concrete URI, and the same attributes.
      Parameters:
      other - the other object
      Returns:
      true if they are equal, false otherwise
    • equals

      public boolean equals(ServiceDesignation other)
      Determine whether this service URL is equal to the given object. This is true when the other object is a service URL with the same abstract type and authority, the same concrete URI, and the same attributes.
      Specified by:
      equals in class ServiceDesignation
      Parameters:
      other - the other object
      Returns:
      true if they are equal, false otherwise
    • equals

      public boolean equals(Object other)
      Determine whether this service URL is equal to the given object. This is true when the other object is a service URL with the same abstract type and authority, the same concrete URI, and the same attributes.
      Specified by:
      equals in class ServiceDesignation
      Parameters:
      other - the other object
      Returns:
      true if they are equal, false otherwise
    • hashCode

      public int hashCode()
      Get the hash code of this service URL. Service URLs are suitable for use as hash table keys.
      Specified by:
      hashCode in class ServiceDesignation
      Returns:
      the hash code
    • toString

      public String toString()
      Get the string representation of this service URL.
      Specified by:
      toString in class ServiceDesignation
      Returns:
      the string representation
    • toServiceURI

      public URI toServiceURI() throws URISyntaxException
      Convert this service URL into a URI whose contents are exactly equal to this object's.
      Returns:
      the URI (not null)
      Throws:
      URISyntaxException - if there was some syntactical problem in the URI being constructed
    • getLocationURI

      public URI getLocationURI()
      Get the concrete location URI of this service URL.
      Returns:
      the concrete location (not null)
    • getServiceType

      public ServiceType getServiceType()
      Get the service type of this URL.
      Returns:
      the service type (not null)
    • getAbstractType

      public String getAbstractType()
      Get the abstract type, if any.
      Specified by:
      getAbstractType in class ServiceDesignation
      Returns:
      the abstract type, or null if no abstract type is set
    • getAbstractTypeAuthority

      public String getAbstractTypeAuthority()
      Get the abstract type authority, if any.
      Specified by:
      getAbstractTypeAuthority in class ServiceDesignation
      Returns:
      the abstract type authority, or null if no abstract type authority is set
    • getUriScheme

      public String getUriScheme()
      Get the concrete URI scheme.
      Specified by:
      getUriScheme in class ServiceDesignation
      Returns:
      the concrete URI scheme (not null)
    • getUriSchemeAuthority

      public String getUriSchemeAuthority()
      Get the concrete URI scheme authority, if any.
      Specified by:
      getUriSchemeAuthority in class ServiceDesignation
      Returns:
      the concrete URI scheme authority, or null if none is set
    • getUserName

      public String getUserName()
      Get the user name of the concrete URI, if any.
      Returns:
      the user name of the concrete URI, or null if none is set
    • getHostName

      public String getHostName()
      Get the host name of the concrete URI.
      Returns:
      the host name of the concrete URI (not null)
    • getPort

      public int getPort()
      Get the port number of the concrete URI, if any.
      Returns:
      the port number of the concrete URI, or -1 if it is undefined
    • getPath

      public String getPath()
      Get the path name of the concrete URI, if any.
      Returns:
      the path name of the concrete URI, or null if none is set
    • getFirstAttributeValue

      public AttributeValue getFirstAttributeValue(String name)
      Get the first attribute value for the given name.
      Parameters:
      name - the attribute name (must not be null)
      Returns:
      the first attribute value for the given name, or null if no such attribute exists
    • getFirstAttributeValue

      public AttributeValue getFirstAttributeValue(String name, AttributeValue defaultValue)
      Get the first attribute value for the given name.
      Parameters:
      name - the attribute name (must not be null)
      defaultValue - the value to return if no such attribute exists
      Returns:
      the first attribute value for the given name, or defaultValue if no such attribute exists
    • getLastAttributeValue

      public AttributeValue getLastAttributeValue(String name)
      Get the last attribute value for the given name.
      Parameters:
      name - the attribute name (must not be null)
      Returns:
      the last attribute value for the given name, or null if no such attribute exists
    • getLastAttributeValue

      public AttributeValue getLastAttributeValue(String name, AttributeValue defaultValue)
      Get the last attribute value for the given name.
      Parameters:
      name - the attribute name (must not be null)
      defaultValue - the value to return if no such attribute exists
      Returns:
      the last attribute value for the given name, or null if no such attribute exists
    • getAttributeValues

      public List<AttributeValue> getAttributeValues(String name)
      Get the values of the attribute with the given name. If no such attribute exists, an empty list is returned.
      Parameters:
      name - the attribute name (must not be null)
      Returns:
      the values of the attribute with the given name (not null)
    • getAttributeNames

      public Set<String> getAttributeNames()
      Get the attribute names. If no attributes exist, an empty set is returned.
      Returns:
      an unmodifiable set of attribute names (not null)