Class ServiceURI
- java.lang.Object
-
- org.apache.bookkeeper.common.net.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
URIin 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:
service Stringservice-specific-part Stringauthority Stringuser-info Stringhost Stringport intpath StringSome 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 Summary
Fields Modifier and Type Field Description static ServiceURIDEFAULT_LOCAL_STREAM_STORAGE_SERVICE_URIThe default local bk service uri.static java.lang.StringSERVICE_BKService string for bookkeeper service.static intSERVICE_BK_PORTstatic java.lang.StringSERVICE_DLOGService string for dlog service.static java.lang.StringSERVICE_ZKService string for ledger service that uses zookeeper as metadata store.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancanEqual(java.lang.Object other)static ServiceURIcreate(java.lang.String uriStr)Create a service uri instance from a uri string.static ServiceURIcreate(java.net.URI uri)Create a service uri instance from aURIinstance.booleanequals(java.lang.Object o)java.lang.String[]getServiceHosts()java.lang.String[]getServiceInfos()java.lang.StringgetServiceName()java.lang.StringgetServicePath()java.lang.StringgetServiceUser()java.net.URIgetUri()inthashCode()
-
-
-
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
-
SERVICE_BK_PORT
public static final int SERVICE_BK_PORT
- 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- ifuriStris nulljava.lang.IllegalArgumentException- if the given string violates RFC 2396
-
create
public static ServiceURI create(java.net.URI uri)
Create a service uri instance from aURIinstance.- Parameters:
uri-URIinstance- Returns:
- a service uri instance
- Throws:
java.lang.NullPointerException- ifuriStris nulljava.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:
equalsin classjava.lang.Object
-
canEqual
protected boolean canEqual(java.lang.Object other)
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-