Class ServiceURI


  • @Public
    @Evolving
    public class ServiceURI
    extends java.lang.Object
    ServiceURI represents service uri within bookkeeper cluster.

    Service URI syntax and components

    At the highest level a service uri is a URI in string form has the syntax.

    [service[service-specific-part]:[//authority][path]

    where the characters : and / stand for themselves.

    The service-specific-part of a service URI consists of the backend information used for services to use. It has the syntax as below:

    [(-|+)][backend-part]

    where the characters - and + stand as a separator to separate service type from service backend information.

    The authority component of a service URI has the same meaning as the authority component in a URI. If specified, it should be server-based. A server-based authority parses according to the familiar syntax

    [user-info@]host[:port]

    where the characters @ and : stand for themselves.

    The path component of a service URI is itself said to be absolute. It typically means which path a service stores metadata or data.

    All told, then, a service URI instance has the following components:

    serviceString
    service-specific-part    String
    authorityString
    user-infoString
    hostString
    portint
    pathString

    Some examples of service URIs are:

    zk://localhost:2181/cluster1/ledgers => ledger service uri using default ledger manager
    zk+hierarchical://localhost:2181/ledgers => ledger service uri using hierarchical ledger manager
    etcd://localhost/ledgers => ledger service uri using etcd as metadata store
    distributedlog://localhost:2181/distributedlog => distributedlog namespace
    distributedlog-bk://localhost:2181/distributedlog => distributedlog namespace with bk backend
    bk://bookkeeper-cluster/ => stream storage service uri
    host1:port,host2:port => a list of hosts as bootstrap hosts to a stream storage cluster}
    Since:
    4.8.0
    • Field Detail

      • SERVICE_ZK

        public static final java.lang.String SERVICE_ZK
        Service string for ledger service that uses zookeeper as metadata store.
        See Also:
        Constant Field Values
      • SERVICE_DLOG

        public static final java.lang.String SERVICE_DLOG
        Service string for dlog service.
        See Also:
        Constant Field Values
      • SERVICE_BK

        public static final java.lang.String SERVICE_BK
        Service string for bookkeeper service.
        See Also:
        Constant Field Values
      • DEFAULT_LOCAL_STREAM_STORAGE_SERVICE_URI

        public static final ServiceURI DEFAULT_LOCAL_STREAM_STORAGE_SERVICE_URI
        The default local bk service uri.
    • Method Detail

      • create

        public static ServiceURI create​(java.lang.String uriStr)
        Create a service uri instance from a uri string.
        Parameters:
        uriStr - service uri string
        Returns:
        a service uri instance
        Throws:
        java.lang.NullPointerException - if uriStr is null
        java.lang.IllegalArgumentException - if the given string violates RFC 2396
      • create

        public static ServiceURI create​(java.net.URI uri)
        Create a service uri instance from a URI instance.
        Parameters:
        uri - URI instance
        Returns:
        a service uri instance
        Throws:
        java.lang.NullPointerException - if uriStr is null
        java.lang.IllegalArgumentException - if the given string violates RFC 2396
      • getServiceInfos

        public java.lang.String[] getServiceInfos()
      • getServiceHosts

        public java.lang.String[] getServiceHosts()
      • getServiceName

        public java.lang.String getServiceName()
      • getServiceUser

        public java.lang.String getServiceUser()
      • getServicePath

        public java.lang.String getServicePath()
      • getUri

        public java.net.URI getUri()
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • canEqual

        protected boolean canEqual​(java.lang.Object other)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object