Class ComponentImpl

java.lang.Object
org.apache.pulsar.functions.worker.rest.api.ComponentImpl
All Implemented Interfaces:
Component<PulsarWorkerService>
Direct Known Subclasses:
FunctionsImpl, SinksImpl, SourcesImpl

public abstract class ComponentImpl extends Object implements Component<PulsarWorkerService>
  • Field Details

    • workerServiceSupplier

      protected final Supplier<PulsarWorkerService> workerServiceSupplier
    • componentType

      protected final org.apache.pulsar.functions.proto.Function.FunctionDetails.ComponentType componentType
  • Constructor Details

    • ComponentImpl

      public ComponentImpl(Supplier<PulsarWorkerService> workerServiceSupplier, org.apache.pulsar.functions.proto.Function.FunctionDetails.ComponentType componentType)
  • Method Details

    • worker

      public PulsarWorkerService worker()
      Specified by:
      worker in interface Component<PulsarWorkerService>
    • deregisterFunction

      public void deregisterFunction(String tenant, String namespace, String componentName, org.apache.pulsar.broker.authentication.AuthenticationParameters authParams)
      Specified by:
      deregisterFunction in interface Component<PulsarWorkerService>
    • getFunctionInfo

      public org.apache.pulsar.common.functions.FunctionConfig getFunctionInfo(String tenant, String namespace, String componentName, org.apache.pulsar.broker.authentication.AuthenticationParameters authParams)
      Specified by:
      getFunctionInfo in interface Component<PulsarWorkerService>
    • stopFunctionInstance

      public void stopFunctionInstance(String tenant, String namespace, String componentName, String instanceId, URI uri, org.apache.pulsar.broker.authentication.AuthenticationParameters authParams)
      Specified by:
      stopFunctionInstance in interface Component<PulsarWorkerService>
    • startFunctionInstance

      public void startFunctionInstance(String tenant, String namespace, String componentName, String instanceId, URI uri, org.apache.pulsar.broker.authentication.AuthenticationParameters authParams)
      Specified by:
      startFunctionInstance in interface Component<PulsarWorkerService>
    • changeFunctionInstanceStatus

      @Deprecated public void changeFunctionInstanceStatus(String tenant, String namespace, String componentName, String instanceId, boolean start, URI uri, String clientRole, org.apache.pulsar.broker.authentication.AuthenticationDataSource clientAuthenticationDataHttps)
      Deprecated.
    • changeFunctionInstanceStatus

      public void changeFunctionInstanceStatus(String tenant, String namespace, String componentName, String instanceId, boolean start, URI uri, org.apache.pulsar.broker.authentication.AuthenticationParameters authParams)
    • restartFunctionInstance

      public void restartFunctionInstance(String tenant, String namespace, String componentName, String instanceId, URI uri, org.apache.pulsar.broker.authentication.AuthenticationParameters authParams)
      Specified by:
      restartFunctionInstance in interface Component<PulsarWorkerService>
    • stopFunctionInstances

      public void stopFunctionInstances(String tenant, String namespace, String componentName, org.apache.pulsar.broker.authentication.AuthenticationParameters authParams)
      Specified by:
      stopFunctionInstances in interface Component<PulsarWorkerService>
    • startFunctionInstances

      public void startFunctionInstances(String tenant, String namespace, String componentName, org.apache.pulsar.broker.authentication.AuthenticationParameters authParams)
      Specified by:
      startFunctionInstances in interface Component<PulsarWorkerService>
    • changeFunctionStatusAllInstances

      @Deprecated public void changeFunctionStatusAllInstances(String tenant, String namespace, String componentName, boolean start, String clientRole, org.apache.pulsar.broker.authentication.AuthenticationDataSource clientAuthenticationDataHttps)
      Deprecated.
    • changeFunctionStatusAllInstances

      public void changeFunctionStatusAllInstances(String tenant, String namespace, String componentName, boolean start, org.apache.pulsar.broker.authentication.AuthenticationParameters authParams)
    • restartFunctionInstances

      public void restartFunctionInstances(String tenant, String namespace, String componentName, org.apache.pulsar.broker.authentication.AuthenticationParameters authParams)
      Specified by:
      restartFunctionInstances in interface Component<PulsarWorkerService>
    • getFunctionStats

      public org.apache.pulsar.common.policies.data.FunctionStatsImpl getFunctionStats(String tenant, String namespace, String componentName, URI uri, org.apache.pulsar.broker.authentication.AuthenticationParameters authParams)
      Specified by:
      getFunctionStats in interface Component<PulsarWorkerService>
    • getFunctionsInstanceStats

      public org.apache.pulsar.common.policies.data.FunctionInstanceStatsDataImpl getFunctionsInstanceStats(String tenant, String namespace, String componentName, String instanceId, URI uri, org.apache.pulsar.broker.authentication.AuthenticationParameters authParams)
      Specified by:
      getFunctionsInstanceStats in interface Component<PulsarWorkerService>
    • listFunctions

      public List<String> listFunctions(String tenant, String namespace, org.apache.pulsar.broker.authentication.AuthenticationParameters authParams)
      Specified by:
      listFunctions in interface Component<PulsarWorkerService>
    • getListOfConnectors

      public List<org.apache.pulsar.common.io.ConnectorDefinition> getListOfConnectors()
      Specified by:
      getListOfConnectors in interface Component<PulsarWorkerService>
    • reloadConnectors

      public void reloadConnectors(org.apache.pulsar.broker.authentication.AuthenticationParameters authParams)
      Specified by:
      reloadConnectors in interface Component<PulsarWorkerService>
    • triggerFunction

      public String triggerFunction(String tenant, String namespace, String functionName, String input, InputStream uploadedInputStream, String topic, org.apache.pulsar.broker.authentication.AuthenticationParameters authParams)
      Specified by:
      triggerFunction in interface Component<PulsarWorkerService>
    • getFunctionState

      public org.apache.pulsar.common.functions.FunctionState getFunctionState(String tenant, String namespace, String functionName, String key, org.apache.pulsar.broker.authentication.AuthenticationParameters authParams)
      Specified by:
      getFunctionState in interface Component<PulsarWorkerService>
    • putFunctionState

      public void putFunctionState(String tenant, String namespace, String functionName, String key, org.apache.pulsar.common.functions.FunctionState state, org.apache.pulsar.broker.authentication.AuthenticationParameters authParams)
      Specified by:
      putFunctionState in interface Component<PulsarWorkerService>
    • uploadFunction

      public void uploadFunction(InputStream uploadedInputStream, String path, org.apache.pulsar.broker.authentication.AuthenticationParameters authParams)
      Specified by:
      uploadFunction in interface Component<PulsarWorkerService>
    • downloadFunction

      public javax.ws.rs.core.StreamingOutput downloadFunction(String tenant, String namespace, String componentName, org.apache.pulsar.broker.authentication.AuthenticationParameters authParams)
      Specified by:
      downloadFunction in interface Component<PulsarWorkerService>
    • downloadFunction

      public javax.ws.rs.core.StreamingOutput downloadFunction(String path, org.apache.pulsar.broker.authentication.AuthenticationParameters authParams)
      Specified by:
      downloadFunction in interface Component<PulsarWorkerService>
    • validateGetFunctionInstanceRequestParams

      protected void validateGetFunctionInstanceRequestParams(String tenant, String namespace, String componentName, org.apache.pulsar.functions.proto.Function.FunctionDetails.ComponentType componentType, String instanceId) throws IllegalArgumentException
      Throws:
      IllegalArgumentException
    • validateGetFunctionRequestParams

      protected void validateGetFunctionRequestParams(String tenant, String namespace, String subject, org.apache.pulsar.functions.proto.Function.FunctionDetails.ComponentType componentType) throws IllegalArgumentException
      Throws:
      IllegalArgumentException
    • createPackagePath

      public static String createPackagePath(String tenant, String namespace, String functionName, String fileName)
    • isAuthorizedRole

      @Deprecated public boolean isAuthorizedRole(String tenant, String namespace, String clientRole, org.apache.pulsar.broker.authentication.AuthenticationDataSource authenticationData) throws org.apache.pulsar.client.admin.PulsarAdminException
      Throws:
      org.apache.pulsar.client.admin.PulsarAdminException
    • isAuthorizedRole

      public boolean isAuthorizedRole(String tenant, String namespace, org.apache.pulsar.broker.authentication.AuthenticationParameters authParams) throws org.apache.pulsar.client.admin.PulsarAdminException
      Throws:
      org.apache.pulsar.client.admin.PulsarAdminException
    • throwRestExceptionIfUnauthorizedForNamespace

      public void throwRestExceptionIfUnauthorizedForNamespace(String tenant, String namespace, String componentName, String action, org.apache.pulsar.broker.authentication.AuthenticationParameters authParams)
    • componentStatusRequestValidate

      @Deprecated protected void componentStatusRequestValidate(String tenant, String namespace, String componentName, String clientRole, org.apache.pulsar.broker.authentication.AuthenticationDataSource clientAuthenticationDataHttps)
      Deprecated.
    • componentStatusRequestValidate

      protected void componentStatusRequestValidate(String tenant, String namespace, String componentName, org.apache.pulsar.broker.authentication.AuthenticationParameters authParams)
    • componentInstanceStatusRequestValidate

      @Deprecated protected void componentInstanceStatusRequestValidate(String tenant, String namespace, String componentName, int instanceId, String clientRole, org.apache.pulsar.broker.authentication.AuthenticationDataSource clientAuthenticationDataHttps)
      Deprecated.
    • componentInstanceStatusRequestValidate

      protected void componentInstanceStatusRequestValidate(String tenant, String namespace, String componentName, int instanceId, org.apache.pulsar.broker.authentication.AuthenticationParameters authParams)
    • isSuperUser

      public boolean isSuperUser(org.apache.pulsar.broker.authentication.AuthenticationParameters authParams)
    • isSuperUser

      @Deprecated public boolean isSuperUser(String clientRole, org.apache.pulsar.broker.authentication.AuthenticationDataSource authenticationData)
    • allowFunctionOps

      @Deprecated public boolean allowFunctionOps(org.apache.pulsar.common.naming.NamespaceName namespaceName, String role, org.apache.pulsar.broker.authentication.AuthenticationDataSource authenticationData)
    • allowFunctionOps

      public boolean allowFunctionOps(org.apache.pulsar.common.naming.NamespaceName namespaceName, org.apache.pulsar.broker.authentication.AuthenticationParameters authParams)
    • getClassLoaderFromPackage

      protected ClassLoader getClassLoaderFromPackage(String className, File packageFile, String narExtractionDirectory)