public abstract class AdminResource extends PulsarWebResource
| Modifier and Type | Field and Description |
|---|---|
protected org.apache.pulsar.common.naming.NamespaceName |
namespaceName |
static String |
PARTITIONED_TOPIC_PATH_ZNODE |
protected org.apache.pulsar.common.naming.TopicName |
topicName |
httpRequest, NOT_IMPLEMENTED, servletContext, uri| Constructor and Description |
|---|
AdminResource() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkArgument(boolean b,
String errorMessage) |
protected boolean |
checkBacklogQuota(org.apache.pulsar.common.policies.data.BacklogQuota quota,
org.apache.pulsar.common.policies.data.RetentionPolicies retention) |
protected void |
checkNotNull(Object o,
String errorMessage) |
static <T> T |
checkNotNull(T reference) |
protected CompletableFuture<Boolean> |
checkTopicExistsAsync(org.apache.pulsar.common.naming.TopicName topicName)
Check the exists topics contains the given topic.
|
protected void |
checkTopicLevelPolicyEnable() |
protected Set<String> |
clusters() |
protected ZooKeeperDataCache<org.apache.pulsar.common.policies.data.ClusterData> |
clustersCache() |
protected ZooKeeperChildrenCache |
clustersListCache() |
protected org.apache.pulsar.common.policies.data.DispatchRate |
dispatchRate() |
protected String |
domain()
Get the domain of the topic (whether it's persistent or non-persistent)
|
protected ZooKeeperDataCache<org.apache.pulsar.common.policies.data.FailureDomain> |
failureDomainCache() |
protected ZooKeeperChildrenCache |
failureDomainListCache() |
protected static org.apache.pulsar.common.partition.PartitionedTopicMetadata |
fetchPartitionedTopicMetadata(PulsarService pulsar,
org.apache.pulsar.common.naming.TopicName topicName) |
protected static org.apache.pulsar.common.partition.PartitionedTopicMetadata |
fetchPartitionedTopicMetadataCheckAllowAutoCreation(PulsarService pulsar,
org.apache.pulsar.common.naming.TopicName topicName) |
protected List<String> |
getListOfNamespaces(String property)
Get the list of namespaces (on every cluster) for a given property
|
protected org.apache.pulsar.common.policies.data.Policies |
getNamespacePolicies(org.apache.pulsar.common.naming.NamespaceName namespaceName) |
protected org.apache.pulsar.common.policies.data.Policies |
getNamespacePolicies(String property,
String cluster,
String namespace) |
protected CompletableFuture<org.apache.pulsar.common.policies.data.Policies> |
getNamespacePoliciesAsync(org.apache.pulsar.common.naming.NamespaceName namespaceName) |
protected Set<String> |
getNamespaceReplicatedClusters(org.apache.pulsar.common.naming.NamespaceName namespaceName) |
protected List<String> |
getPartitionedTopicList(org.apache.pulsar.common.naming.TopicDomain topicDomain) |
protected org.apache.pulsar.common.partition.PartitionedTopicMetadata |
getPartitionedTopicMetadata(org.apache.pulsar.common.naming.TopicName topicName,
boolean authoritative,
boolean checkAllowAutoCreation) |
protected CompletableFuture<org.apache.pulsar.common.partition.PartitionedTopicMetadata> |
getPartitionedTopicMetadataAsync(org.apache.pulsar.common.naming.TopicName topicName,
boolean authoritative,
boolean checkAllowAutoCreation) |
protected Optional<org.apache.pulsar.common.policies.data.TopicPolicies> |
getTopicPolicies(org.apache.pulsar.common.naming.TopicName topicName) |
protected ZooKeeper |
globalZk() |
protected ZooKeeperCache |
globalZkCache() |
protected void |
internalCreatePartitionedTopic(javax.ws.rs.container.AsyncResponse asyncResponse,
int numPartitions) |
protected boolean |
isLeaderBroker() |
protected boolean |
isNamespaceReplicated(org.apache.pulsar.common.naming.NamespaceName namespaceName) |
static com.fasterxml.jackson.databind.ObjectMapper |
jsonMapper() |
protected LocalZooKeeperCacheService |
localCacheService() |
protected ZooKeeperDataCache<org.apache.pulsar.common.policies.data.LocalPolicies> |
localPoliciesCache() |
protected ZooKeeper |
localZk() |
protected ZooKeeperCache |
localZkCache() |
protected ZooKeeperManagedLedgerCache |
managedLedgerListCache() |
protected void |
mergeNamespaceWithDefaults(org.apache.pulsar.common.policies.data.Policies policies,
String namespace,
String namespacePath) |
protected org.apache.pulsar.common.policies.data.BacklogQuota |
namespaceBacklogQuota(String namespace,
String namespacePath) |
protected ZooKeeperDataCache<org.apache.pulsar.common.policies.impl.NamespaceIsolationPolicies> |
namespaceIsolationPoliciesCache() |
protected ZooKeeperDataCache<org.apache.pulsar.common.policies.data.Policies> |
policiesCache() |
protected void |
resumeAsyncResponseExceptionally(javax.ws.rs.container.AsyncResponse asyncResponse,
Throwable throwable) |
protected void |
setServletContext(javax.servlet.ServletContext servletContext) |
protected org.apache.pulsar.common.policies.data.SubscribeRate |
subscribeRate() |
protected org.apache.pulsar.common.policies.data.DispatchRate |
subscriptionDispatchRate() |
ZooKeeperDataCache<org.apache.pulsar.common.policies.data.TenantInfo> |
tenantsCache() |
protected CompletableFuture<Void> |
tryCreatePartitionsAsync(int numPartitions) |
protected void |
validateAdminAccessForTenant(String property)
Checks that the http client role has admin access to the specified tenant.
|
protected void |
validateBrokerName(String broker)
Redirect the call to the specified broker
|
protected void |
validateBundleOwnership(String property,
String cluster,
String namespace,
boolean authoritative,
boolean readOnly,
NamespaceBundle bundle) |
protected void |
validateClusterExists(String cluster) |
protected void |
validateGlobalNamespaceOwnership(String property,
String namespace) |
protected void |
validateNamespaceName(String property,
String namespace) |
protected void |
validateNamespaceName(String property,
String cluster,
String namespace)
Deprecated.
|
protected void |
validateNamespaceOwnershipWithBundles(String property,
String cluster,
String namespace,
boolean authoritative,
boolean readOnly,
org.apache.pulsar.common.policies.data.BundlesData bundleData)
Checks whether the broker is the owner of all the namespace bundles.
|
protected void |
validatePartitionedTopicMetadata(String tenant,
String namespace,
String encodedTopic) |
protected void |
validatePartitionedTopicName(String tenant,
String namespace,
String encodedTopic) |
protected void |
validatePersistencePolicies(org.apache.pulsar.common.policies.data.PersistencePolicies persistence) |
void |
validatePoliciesReadOnlyAccess()
Checks whether the broker is allowed to do read-write operations based on the existence of a node in global
zookeeper.
|
protected void |
validateSuperUserAccess()
Checks whether the user has Pulsar Super-User access to the system.
|
protected void |
validateTopicExistedAndCheckAllowAutoCreation(String tenant,
String namespace,
String encodedTopic,
boolean checkAllowAutoCreation) |
protected void |
validateTopicName(String property,
String namespace,
String encodedTopic) |
protected void |
validateTopicName(String property,
String cluster,
String namespace,
String encodedTopic)
Deprecated.
|
protected void |
zkCreate(String path,
byte[] content) |
protected void |
zkCreateOptimistic(String path,
byte[] content) |
protected void |
zkCreateOptimisticAsync(ZooKeeper zk,
String path,
byte[] content,
AsyncCallback.StringCallback callback) |
protected boolean |
zkPathExists(String path) |
protected void |
zkSync(String path) |
checkAuthorization, checkConnect, checkLocalOrGetPeerReplicationCluster, clientAppId, clientAuthData, config, getClusterDataIfDifferentCluster, hasSuperUserAccess, isBundleOwnedByAnyBroker, isClientAuthenticated, isLeaderBroker, isRequestHttps, joinPath, originalPrincipal, path, pulsar, setPulsar, splitPath, validateAdminAccessForTenant, validateBundleOwnership, validateClusterForTenant, validateClusterOwnership, validateGlobalNamespaceOwnership, validateNamespaceBundleOwnership, validateNamespaceBundleRange, validateNamespaceOperation, validateNamespacePolicyOperation, validateTenantOperation, validateTopicOwnershippublic static final String PARTITIONED_TOPIC_PATH_ZNODE
protected org.apache.pulsar.common.naming.NamespaceName namespaceName
protected org.apache.pulsar.common.naming.TopicName topicName
protected ZooKeeper globalZk()
protected ZooKeeperCache globalZkCache()
protected ZooKeeper localZk()
protected ZooKeeperCache localZkCache()
protected LocalZooKeeperCacheService localCacheService()
protected void zkCreateOptimistic(String path, byte[] content) throws Exception
Exceptionprotected void zkCreateOptimisticAsync(ZooKeeper zk, String path, byte[] content, AsyncCallback.StringCallback callback)
protected boolean zkPathExists(String path) throws KeeperException, InterruptedException
KeeperExceptionInterruptedExceptionprotected String domain()
protected void validateSuperUserAccess()
PulsarWebResourcevalidateSuperUserAccess in class PulsarWebResourceprotected void validateAdminAccessForTenant(String property)
PulsarWebResourcevalidateAdminAccessForTenant in class PulsarWebResourceproperty - the tenant idprotected void validateNamespaceOwnershipWithBundles(String property, String cluster, String namespace, boolean authoritative, boolean readOnly, org.apache.pulsar.common.policies.data.BundlesData bundleData)
PulsarWebResourcevalidateNamespaceOwnershipWithBundles in class PulsarWebResourceproperty - tenant namecluster - cluster namenamespace - namespace nameauthoritative - if it is an authoritative requestreadOnly - if the request is read-onlybundleData - bundle dataprotected void validateBundleOwnership(String property, String cluster, String namespace, boolean authoritative, boolean readOnly, NamespaceBundle bundle)
validateBundleOwnership in class PulsarWebResourceprotected boolean isLeaderBroker()
isLeaderBroker in class PulsarWebResourcepublic void validatePoliciesReadOnlyAccess()
javax.ws.rs.WebApplicationException - if broker has a read only access if broker is not connected to the global zookeeperprotected List<String> getListOfNamespaces(String property) throws Exception
property - the property nameExceptionprotected CompletableFuture<Void> tryCreatePartitionsAsync(int numPartitions)
protected void validateGlobalNamespaceOwnership(String property, String namespace)
@Deprecated protected void validateNamespaceName(String property, String cluster, String namespace)
protected void validateTopicName(String property, String namespace, String encodedTopic)
protected void validatePartitionedTopicName(String tenant, String namespace, String encodedTopic)
protected void validatePartitionedTopicMetadata(String tenant, String namespace, String encodedTopic)
protected void validateTopicExistedAndCheckAllowAutoCreation(String tenant, String namespace, String encodedTopic, boolean checkAllowAutoCreation)
@Deprecated protected void validateTopicName(String property, String cluster, String namespace, String encodedTopic)
protected void validateBrokerName(String broker) throws MalformedURLException
broker - Broker nameMalformedURLException - In case the redirect happensprotected org.apache.pulsar.common.policies.data.Policies getNamespacePolicies(org.apache.pulsar.common.naming.NamespaceName namespaceName)
protected CompletableFuture<org.apache.pulsar.common.policies.data.Policies> getNamespacePoliciesAsync(org.apache.pulsar.common.naming.NamespaceName namespaceName)
protected void mergeNamespaceWithDefaults(org.apache.pulsar.common.policies.data.Policies policies,
String namespace,
String namespacePath)
protected org.apache.pulsar.common.policies.data.BacklogQuota namespaceBacklogQuota(String namespace, String namespacePath)
protected Optional<org.apache.pulsar.common.policies.data.TopicPolicies> getTopicPolicies(org.apache.pulsar.common.naming.TopicName topicName)
protected boolean checkBacklogQuota(org.apache.pulsar.common.policies.data.BacklogQuota quota,
org.apache.pulsar.common.policies.data.RetentionPolicies retention)
protected void checkTopicLevelPolicyEnable()
protected org.apache.pulsar.common.policies.data.DispatchRate dispatchRate()
protected org.apache.pulsar.common.policies.data.DispatchRate subscriptionDispatchRate()
protected org.apache.pulsar.common.policies.data.SubscribeRate subscribeRate()
public static com.fasterxml.jackson.databind.ObjectMapper jsonMapper()
public ZooKeeperDataCache<org.apache.pulsar.common.policies.data.TenantInfo> tenantsCache()
protected ZooKeeperDataCache<org.apache.pulsar.common.policies.data.Policies> policiesCache()
protected ZooKeeperDataCache<org.apache.pulsar.common.policies.data.LocalPolicies> localPoliciesCache()
protected ZooKeeperDataCache<org.apache.pulsar.common.policies.data.ClusterData> clustersCache()
protected ZooKeeperManagedLedgerCache managedLedgerListCache()
protected ZooKeeperChildrenCache clustersListCache()
protected void setServletContext(javax.servlet.ServletContext servletContext)
protected ZooKeeperDataCache<org.apache.pulsar.common.policies.impl.NamespaceIsolationPolicies> namespaceIsolationPoliciesCache()
protected ZooKeeperDataCache<org.apache.pulsar.common.policies.data.FailureDomain> failureDomainCache()
protected ZooKeeperChildrenCache failureDomainListCache()
protected CompletableFuture<org.apache.pulsar.common.partition.PartitionedTopicMetadata> getPartitionedTopicMetadataAsync(org.apache.pulsar.common.naming.TopicName topicName, boolean authoritative, boolean checkAllowAutoCreation)
protected org.apache.pulsar.common.partition.PartitionedTopicMetadata getPartitionedTopicMetadata(org.apache.pulsar.common.naming.TopicName topicName,
boolean authoritative,
boolean checkAllowAutoCreation)
protected static org.apache.pulsar.common.partition.PartitionedTopicMetadata fetchPartitionedTopicMetadata(PulsarService pulsar, org.apache.pulsar.common.naming.TopicName topicName)
protected static org.apache.pulsar.common.partition.PartitionedTopicMetadata fetchPartitionedTopicMetadataCheckAllowAutoCreation(PulsarService pulsar, org.apache.pulsar.common.naming.TopicName topicName)
protected void validateClusterExists(String cluster)
protected org.apache.pulsar.common.policies.data.Policies getNamespacePolicies(String property, String cluster, String namespace)
protected boolean isNamespaceReplicated(org.apache.pulsar.common.naming.NamespaceName namespaceName)
protected Set<String> getNamespaceReplicatedClusters(org.apache.pulsar.common.naming.NamespaceName namespaceName)
protected List<String> getPartitionedTopicList(org.apache.pulsar.common.naming.TopicDomain topicDomain)
protected void internalCreatePartitionedTopic(javax.ws.rs.container.AsyncResponse asyncResponse,
int numPartitions)
protected CompletableFuture<Boolean> checkTopicExistsAsync(org.apache.pulsar.common.naming.TopicName topicName)
topicName - given topic nameprotected void resumeAsyncResponseExceptionally(javax.ws.rs.container.AsyncResponse asyncResponse,
Throwable throwable)
@CanIgnoreReturnValue public static <T> T checkNotNull(T reference)
protected void checkArgument(boolean b,
String errorMessage)
protected void validatePersistencePolicies(org.apache.pulsar.common.policies.data.PersistencePolicies persistence)
Copyright © 2017–2021 Apache Software Foundation. All rights reserved.