@Override public boolean includes(DestinationName dn) { return this.equals(dn.getNamespaceObject()); } }
public NamespaceBundle getBundle(DestinationName destination) throws Exception { return bundleFactory.getBundles(destination.getNamespaceObject()).findBundle(destination); }
public static boolean isValid(String destination) { try { get(destination); return true; } catch (Exception e) { return false; } }
public NamespaceBundle findBundle(DestinationName dn) { checkArgument(this.nsname.equals(dn.getNamespaceObject())); long hashCode = factory.getLongHashCode(dn.toString()); return getBundle(hashCode); }
public CompletableFuture<NamespaceBundle> getBundleAsync(DestinationName topic) { return bundleFactory.getBundlesAsync(topic.getNamespaceObject()) .thenApply(bundles -> bundles.findBundle(topic)); }
/** * Extract the namespace portion out of a destination name. * * Works both with old & new convention. * * @return the namespace */ public String getNamespace() { return namespaceName.toString(); }
public int getBundleCount(NamespaceName namespace) throws Exception { return bundleFactory.getBundles(namespace).size(); }
public NamespaceBundles(NamespaceName nsname, SortedSet<Long> partitionsSet, NamespaceBundleFactory factory) throws Exception { this(nsname, convertPartitions(partitionsSet), factory); }
@Override public boolean includes(DestinationName dn) { return this.equals(dn); }
public static final String path(NamespaceBundle suname) { // The ephemeral node path for new namespaces should always have bundle name appended return OWNER_INFO_ROOT + "/" + suname.toString(); }
public NamespaceName(String property, String cluster, String namespace) { validateNamespaceName(property, cluster, namespace); this.namespace = property + '/' + cluster + '/' + namespace; this.property = property; this.cluster = cluster; this.localName = namespace; }
@Override public DestinationName load(String name) throws Exception { return new DestinationName(name); } });
public NamespaceBundle getBundle(NamespaceName nsname, Range<Long> hashRange) { return new NamespaceBundle(nsname, hashRange, this); }
private NamespaceBundle getFullBundle(NamespaceName fqnn) throws Exception { return bundleFactory.getFullBundle(fqnn); }
public String getPersistentTopicName(String localTopic) { return getDestinationName(DestinationDomain.persistent, localTopic); }
@Override public String toString() { return getKey(this.nsname, this.keyRange); }
public static NamespaceBundleFactory createFactory(HashFunction hashFunc) { return new NamespaceBundleFactory(null, hashFunc); }
@Override public boolean includes(DestinationName dn) { if (!this.nsname.equals(dn.getNamespaceObject())) { return false; } return this.keyRange.contains(factory.getLongHashCode(dn.toString())); }
public static DestinationName get(String domain, String property, String cluster, String namespace, String destination) { String name = domain + "://" + property + '/' + cluster + '/' + namespace + '/' + destination; return DestinationName.get(name); }
private DestinationName validateTopic(String destination) { // Parsing will throw exception if name is not valid return DestinationName.get(destination); }