Class AdminResource

java.lang.Object
org.apache.pulsar.broker.web.PulsarWebResource
org.apache.pulsar.broker.admin.AdminResource
Direct Known Subclasses:
Bookies, BrokersBase, BrokerStatsBase, ClustersBase, Functions, FunctionsBase, NamespacesBase, PackagesBase, PersistentTopicsBase, ResourceGroupsBase, SchemasResourceBase, SinksBase, SourcesBase, TransactionsBase, Worker, WorkerStats

public abstract class AdminResource extends PulsarWebResource
  • Field Details

    • namespaceName

      protected org.apache.pulsar.common.naming.NamespaceName namespaceName
    • topicName

      protected org.apache.pulsar.common.naming.TopicName topicName
  • Constructor Details

    • AdminResource

      public AdminResource()
  • Method Details

    • bookKeeper

      protected org.apache.bookkeeper.client.BookKeeper bookKeeper()
    • domain

      protected String domain()
      Get the domain of the topic (whether it's persistent or non-persistent).
    • validateSuperUserAccess

      public void validateSuperUserAccess()
      Description copied from class: PulsarWebResource
      Checks whether the user has Pulsar Super-User access to the system.
      Overrides:
      validateSuperUserAccess in class PulsarWebResource
    • validateAdminAccessForTenant

      protected void validateAdminAccessForTenant(String property)
      Description copied from class: PulsarWebResource
      Checks that the http client role has admin access to the specified tenant.
      Overrides:
      validateAdminAccessForTenant in class PulsarWebResource
      Parameters:
      property - the tenant id
    • validateBundleOwnership

      protected void validateBundleOwnership(String property, String cluster, String namespace, boolean authoritative, boolean readOnly, NamespaceBundle bundle)
      Overrides:
      validateBundleOwnership in class PulsarWebResource
    • isLeaderBroker

      protected boolean isLeaderBroker()
      Overrides:
      isLeaderBroker in class PulsarWebResource
    • validatePoliciesReadOnlyAccess

      public void validatePoliciesReadOnlyAccess()
      Checks whether the broker is allowed to do read-write operations based on the existence of a node in configuration metadata-store.
      Overrides:
      validatePoliciesReadOnlyAccess in class PulsarWebResource
      Throws:
      javax.ws.rs.WebApplicationException - if broker has a read only access if broker is not connected to the configuration metadata-store
    • validatePoliciesReadOnlyAccessAsync

      public CompletableFuture<Void> validatePoliciesReadOnlyAccessAsync()
      Overrides:
      validatePoliciesReadOnlyAccessAsync in class PulsarWebResource
    • tryCreatePartitionsAsync

      protected CompletableFuture<Void> tryCreatePartitionsAsync(int numPartitions)
    • tryCreateExtendedPartitionsAsync

      protected CompletableFuture<Void> tryCreateExtendedPartitionsAsync(int oldNumPartitions, int numPartitions)
    • validateNamespaceName

      protected void validateNamespaceName(String property, String namespace)
    • validateGlobalNamespaceOwnership

      protected void validateGlobalNamespaceOwnership()
    • validateNamespaceName

      @Deprecated protected void validateNamespaceName(String property, String cluster, String namespace)
      Deprecated.
    • validateTopicName

      protected void validateTopicName(String property, String namespace, String encodedTopic)
    • validatePersistentTopicName

      protected void validatePersistentTopicName(String property, String namespace, String encodedTopic)
    • validatePartitionedTopicName

      protected void validatePartitionedTopicName(String tenant, String namespace, String encodedTopic)
    • validatePartitionedTopicMetadataAsync

      protected CompletableFuture<Void> validatePartitionedTopicMetadataAsync()
    • validateTopicName

      @Deprecated protected void validateTopicName(String property, String cluster, String namespace, String encodedTopic)
      Deprecated.
    • validatePersistentTopicName

      @Deprecated protected void validatePersistentTopicName(String property, String cluster, String namespace, String encodedTopic)
      Deprecated.
    • validateAndGetWorkerService

      protected org.apache.pulsar.functions.worker.WorkerService validateAndGetWorkerService()
    • getNamespacePolicies

      protected org.apache.pulsar.common.policies.data.Policies getNamespacePolicies(org.apache.pulsar.common.naming.NamespaceName namespaceName)
    • getNamespacePoliciesAsync

      protected CompletableFuture<org.apache.pulsar.common.policies.data.Policies> getNamespacePoliciesAsync(org.apache.pulsar.common.naming.NamespaceName namespaceName)
    • namespaceBacklogQuota

      protected org.apache.pulsar.common.policies.data.BacklogQuota namespaceBacklogQuota(org.apache.pulsar.common.naming.NamespaceName namespace, org.apache.pulsar.common.policies.data.BacklogQuota.BacklogQuotaType backlogQuotaType)
    • getTopicPoliciesAsyncWithRetry

      protected CompletableFuture<Optional<org.apache.pulsar.common.policies.data.TopicPolicies>> getTopicPoliciesAsyncWithRetry(org.apache.pulsar.common.naming.TopicName topicName)
    • getTopicPoliciesAsyncWithRetry

      protected CompletableFuture<Optional<org.apache.pulsar.common.policies.data.TopicPolicies>> getTopicPoliciesAsyncWithRetry(org.apache.pulsar.common.naming.TopicName topicName, boolean isGlobal)
    • checkBacklogQuota

      protected boolean checkBacklogQuota(org.apache.pulsar.common.policies.data.BacklogQuota quota, org.apache.pulsar.common.policies.data.RetentionPolicies retention)
    • checkTopicLevelPolicyEnable

      protected void checkTopicLevelPolicyEnable()
    • dispatchRate

      protected org.apache.pulsar.common.policies.data.impl.DispatchRateImpl dispatchRate()
    • subscriptionDispatchRate

      protected org.apache.pulsar.common.policies.data.impl.DispatchRateImpl subscriptionDispatchRate()
    • replicatorDispatchRate

      protected org.apache.pulsar.common.policies.data.impl.DispatchRateImpl replicatorDispatchRate()
    • subscribeRate

      protected org.apache.pulsar.common.policies.data.SubscribeRate subscribeRate()
    • jsonMapper

      public static com.fasterxml.jackson.databind.ObjectMapper jsonMapper()
    • clusters

      protected Set<String> clusters()
    • clustersAsync

      protected CompletableFuture<Set<String>> clustersAsync()
    • setServletContext

      protected void setServletContext(javax.servlet.ServletContext servletContext)
    • getPartitionedTopicMetadata

      protected org.apache.pulsar.common.partition.PartitionedTopicMetadata getPartitionedTopicMetadata(org.apache.pulsar.common.naming.TopicName topicName, boolean authoritative, boolean checkAllowAutoCreation)
    • getPartitionedTopicMetadataAsync

      protected CompletableFuture<org.apache.pulsar.common.partition.PartitionedTopicMetadata> getPartitionedTopicMetadataAsync(org.apache.pulsar.common.naming.TopicName topicName, boolean authoritative, boolean checkAllowAutoCreation)
    • fetchPartitionedTopicMetadata

      protected static org.apache.pulsar.common.partition.PartitionedTopicMetadata fetchPartitionedTopicMetadata(PulsarService pulsar, org.apache.pulsar.common.naming.TopicName topicName)
    • fetchPartitionedTopicMetadataCheckAllowAutoCreation

      protected static org.apache.pulsar.common.partition.PartitionedTopicMetadata fetchPartitionedTopicMetadataCheckAllowAutoCreation(PulsarService pulsar, org.apache.pulsar.common.naming.TopicName topicName)
    • validateClusterExists

      protected void validateClusterExists(String cluster)
      Overrides:
      validateClusterExists in class PulsarWebResource
    • getNamespacePolicies

      protected org.apache.pulsar.common.policies.data.Policies getNamespacePolicies(String tenant, String cluster, String namespace)
    • isNamespaceReplicated

      protected boolean isNamespaceReplicated(org.apache.pulsar.common.naming.NamespaceName namespaceName)
    • getNamespaceReplicatedClusters

      protected Set<String> getNamespaceReplicatedClusters(org.apache.pulsar.common.naming.NamespaceName namespaceName)
    • getNamespaceReplicatedClustersAsync

      protected CompletableFuture<Set<String>> getNamespaceReplicatedClustersAsync(org.apache.pulsar.common.naming.NamespaceName namespaceName)
    • getPartitionedTopicList

      protected List<String> getPartitionedTopicList(org.apache.pulsar.common.naming.TopicDomain topicDomain)
    • getPartitionedTopicListAsync

      protected CompletableFuture<List<String>> getPartitionedTopicListAsync(org.apache.pulsar.common.naming.TopicDomain topicDomain)
    • getTopicPartitionList

      protected List<String> getTopicPartitionList(org.apache.pulsar.common.naming.TopicDomain topicDomain)
    • internalCreatePartitionedTopic

      protected void internalCreatePartitionedTopic(javax.ws.rs.container.AsyncResponse asyncResponse, int numPartitions, boolean createLocalTopicOnly)
    • internalCreatePartitionedTopic

      protected void internalCreatePartitionedTopic(javax.ws.rs.container.AsyncResponse asyncResponse, int numPartitions, boolean createLocalTopicOnly, Map<String,String> properties)
    • checkTopicExistsAsync

      protected CompletableFuture<Boolean> checkTopicExistsAsync(org.apache.pulsar.common.naming.TopicName topicName)
      Check the exists topics contains the given topic. Since there are topic partitions and non-partitioned topics in Pulsar, must ensure both partitions and non-partitioned topics are not duplicated. So, if compare with a partition name, we should compare to the partitioned name of this partition.
      Parameters:
      topicName - given topic name
    • getSchemaCompatibilityStrategyAsync

      protected CompletableFuture<org.apache.pulsar.common.policies.data.SchemaCompatibilityStrategy> getSchemaCompatibilityStrategyAsync()
    • getSchemaCompatibilityStrategyAsyncWithoutAuth

      protected CompletableFuture<org.apache.pulsar.common.policies.data.SchemaCompatibilityStrategy> getSchemaCompatibilityStrategyAsyncWithoutAuth()
    • checkNotNull

      @CanIgnoreReturnValue public static <T> T checkNotNull(T reference)
    • checkNotNull

      protected void checkNotNull(Object o, String errorMessage)
    • isManagedLedgerNotFoundException

      protected boolean isManagedLedgerNotFoundException(Throwable cause)
    • checkArgument

      protected void checkArgument(boolean b, String errorMessage)
    • validatePersistencePolicies

      protected void validatePersistencePolicies(org.apache.pulsar.common.policies.data.PersistencePolicies persistence)
    • isRedirectException

      protected static boolean isRedirectException(Throwable ex)
      Check current exception whether is redirect exception.
      Parameters:
      ex - The throwable.
      Returns:
      Whether is redirect exception
    • isNotFoundException

      protected static boolean isNotFoundException(Throwable ex)
    • getTopicNotFoundErrorMessage

      protected static String getTopicNotFoundErrorMessage(String topic)
    • getPartitionedTopicNotFoundErrorMessage

      protected static String getPartitionedTopicNotFoundErrorMessage(String topic)
    • getSubNotFoundErrorMessage

      protected static String getSubNotFoundErrorMessage(String topic, String subscription)
    • filterSystemTopic

      protected List<String> filterSystemTopic(List<String> topics, boolean includeSystemTopic)