Class ComponentImpl
java.lang.Object
org.apache.pulsar.functions.worker.rest.api.ComponentImpl
- All Implemented Interfaces:
Component<PulsarWorkerService>
- Direct Known Subclasses:
FunctionsImpl,SinksImpl,SourcesImpl
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.apache.pulsar.functions.proto.Function.FunctionDetails.ComponentTypeprotected final Supplier<PulsarWorkerService> -
Constructor Summary
ConstructorsConstructorDescriptionComponentImpl(Supplier<PulsarWorkerService> workerServiceSupplier, org.apache.pulsar.functions.proto.Function.FunctionDetails.ComponentType componentType) -
Method Summary
Modifier and TypeMethodDescriptionbooleanallowFunctionOps(org.apache.pulsar.common.naming.NamespaceName namespaceName, String role, AuthenticationDataSource authenticationData) voidchangeFunctionInstanceStatus(String tenant, String namespace, String componentName, String instanceId, boolean start, URI uri, String clientRole, AuthenticationDataSource clientAuthenticationDataHttps) voidchangeFunctionStatusAllInstances(String tenant, String namespace, String componentName, boolean start, String clientRole, AuthenticationDataSource clientAuthenticationDataHttps) protected voidcomponentInstanceStatusRequestValidate(String tenant, String namespace, String componentName, int instanceId, String clientRole, AuthenticationDataSource clientAuthenticationDataHttps) protected voidcomponentStatusRequestValidate(String tenant, String namespace, String componentName, String clientRole, AuthenticationDataSource clientAuthenticationDataHttps) static StringcreatePackagePath(String tenant, String namespace, String functionName, String fileName) voidderegisterFunction(String tenant, String namespace, String componentName, String clientRole, AuthenticationDataSource clientAuthenticationDataHttps) javax.ws.rs.core.StreamingOutputdownloadFunction(String tenant, String namespace, String componentName, String clientRole, AuthenticationDataSource clientAuthenticationDataHttps, boolean transformFunction) javax.ws.rs.core.StreamingOutputdownloadFunction(String path, String clientRole, AuthenticationDataSource clientAuthenticationDataHttps) protected FiledownloadPackageFile(String packageName) protected ClassLoadergetBuiltinFunctionClassLoader(String archive) protected ClassLoadergetClassLoaderFromPackage(String className, File packageFile, String narExtractionDirectory) org.apache.pulsar.common.functions.FunctionConfiggetFunctionInfo(String tenant, String namespace, String componentName, String clientRole, AuthenticationDataSource clientAuthenticationDataHttps) org.apache.pulsar.common.policies.data.FunctionInstanceStatsDataImplgetFunctionsInstanceStats(String tenant, String namespace, String componentName, String instanceId, URI uri, String clientRole, AuthenticationDataSource clientAuthenticationDataHttps) org.apache.pulsar.common.functions.FunctionStategetFunctionState(String tenant, String namespace, String functionName, String key, String clientRole, AuthenticationDataSource clientAuthenticationDataHttps) org.apache.pulsar.common.policies.data.FunctionStatsImplgetFunctionStats(String tenant, String namespace, String componentName, URI uri, String clientRole, AuthenticationDataSource clientAuthenticationDataHttps) List<org.apache.pulsar.common.io.ConnectorDefinition>protected FilegetPackageFile(String functionPkgUrl) protected FilegetPackageFile(String functionPkgUrl, String existingPackagePath, InputStream uploadedInputStream) booleanisAuthorizedRole(String tenant, String namespace, String clientRole, AuthenticationDataSource authenticationData) booleanisSuperUser(String clientRole, AuthenticationDataSource authenticationData) listFunctions(String tenant, String namespace, String clientRole, AuthenticationDataSource clientAuthenticationDataHttps) voidputFunctionState(String tenant, String namespace, String functionName, String key, org.apache.pulsar.common.functions.FunctionState state, String clientRole, AuthenticationDataSource clientAuthenticationDataHttps) voidreloadConnectors(String clientRole, AuthenticationDataSource authenticationData) voidrestartFunctionInstance(String tenant, String namespace, String componentName, String instanceId, URI uri, String clientRole, AuthenticationDataSource clientAuthenticationDataHttps) voidrestartFunctionInstances(String tenant, String namespace, String componentName, String clientRole, AuthenticationDataSource clientAuthenticationDataHttps) voidstartFunctionInstance(String tenant, String namespace, String componentName, String instanceId, URI uri, String clientRole, AuthenticationDataSource clientAuthenticationDataHttps) voidstartFunctionInstances(String tenant, String namespace, String componentName, String clientRole, AuthenticationDataSource clientAuthenticationDataHttps) voidstopFunctionInstance(String tenant, String namespace, String componentName, String instanceId, URI uri, String clientRole, AuthenticationDataSource clientAuthenticationDataHttps) voidstopFunctionInstances(String tenant, String namespace, String componentName, String clientRole, AuthenticationDataSource clientAuthenticationDataHttps) triggerFunction(String tenant, String namespace, String functionName, String input, InputStream uploadedInputStream, String topic, String clientRole, AuthenticationDataSource clientAuthenticationDataHttps) voiduploadFunction(InputStream uploadedInputStream, String path, String clientRole, AuthenticationDataSource authenticationData) protected voidvalidateGetFunctionInstanceRequestParams(String tenant, String namespace, String componentName, org.apache.pulsar.functions.proto.Function.FunctionDetails.ComponentType componentType, String instanceId) protected voidvalidateGetFunctionRequestParams(String tenant, String namespace, String subject, org.apache.pulsar.functions.proto.Function.FunctionDetails.ComponentType componentType) worker()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.pulsar.functions.worker.service.api.Component
deregisterFunction, downloadFunction, downloadFunction, downloadFunction
-
Field Details
-
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
- Specified by:
workerin interfaceComponent<PulsarWorkerService>
-
deregisterFunction
public void deregisterFunction(String tenant, String namespace, String componentName, String clientRole, AuthenticationDataSource clientAuthenticationDataHttps) - Specified by:
deregisterFunctionin interfaceComponent<PulsarWorkerService>
-
getFunctionInfo
public org.apache.pulsar.common.functions.FunctionConfig getFunctionInfo(String tenant, String namespace, String componentName, String clientRole, AuthenticationDataSource clientAuthenticationDataHttps) - Specified by:
getFunctionInfoin interfaceComponent<PulsarWorkerService>
-
stopFunctionInstance
public void stopFunctionInstance(String tenant, String namespace, String componentName, String instanceId, URI uri, String clientRole, AuthenticationDataSource clientAuthenticationDataHttps) - Specified by:
stopFunctionInstancein interfaceComponent<PulsarWorkerService>
-
startFunctionInstance
public void startFunctionInstance(String tenant, String namespace, String componentName, String instanceId, URI uri, String clientRole, AuthenticationDataSource clientAuthenticationDataHttps) - Specified by:
startFunctionInstancein interfaceComponent<PulsarWorkerService>
-
changeFunctionInstanceStatus
-
restartFunctionInstance
public void restartFunctionInstance(String tenant, String namespace, String componentName, String instanceId, URI uri, String clientRole, AuthenticationDataSource clientAuthenticationDataHttps) - Specified by:
restartFunctionInstancein interfaceComponent<PulsarWorkerService>
-
stopFunctionInstances
public void stopFunctionInstances(String tenant, String namespace, String componentName, String clientRole, AuthenticationDataSource clientAuthenticationDataHttps) - Specified by:
stopFunctionInstancesin interfaceComponent<PulsarWorkerService>
-
startFunctionInstances
public void startFunctionInstances(String tenant, String namespace, String componentName, String clientRole, AuthenticationDataSource clientAuthenticationDataHttps) - Specified by:
startFunctionInstancesin interfaceComponent<PulsarWorkerService>
-
changeFunctionStatusAllInstances
public void changeFunctionStatusAllInstances(String tenant, String namespace, String componentName, boolean start, String clientRole, AuthenticationDataSource clientAuthenticationDataHttps) -
restartFunctionInstances
public void restartFunctionInstances(String tenant, String namespace, String componentName, String clientRole, AuthenticationDataSource clientAuthenticationDataHttps) - Specified by:
restartFunctionInstancesin interfaceComponent<PulsarWorkerService>
-
getFunctionStats
public org.apache.pulsar.common.policies.data.FunctionStatsImpl getFunctionStats(String tenant, String namespace, String componentName, URI uri, String clientRole, AuthenticationDataSource clientAuthenticationDataHttps) - Specified by:
getFunctionStatsin interfaceComponent<PulsarWorkerService>
-
getFunctionsInstanceStats
public org.apache.pulsar.common.policies.data.FunctionInstanceStatsDataImpl getFunctionsInstanceStats(String tenant, String namespace, String componentName, String instanceId, URI uri, String clientRole, AuthenticationDataSource clientAuthenticationDataHttps) - Specified by:
getFunctionsInstanceStatsin interfaceComponent<PulsarWorkerService>
-
listFunctions
public List<String> listFunctions(String tenant, String namespace, String clientRole, AuthenticationDataSource clientAuthenticationDataHttps) - Specified by:
listFunctionsin interfaceComponent<PulsarWorkerService>
-
getListOfConnectors
- Specified by:
getListOfConnectorsin interfaceComponent<PulsarWorkerService>
-
reloadConnectors
- Specified by:
reloadConnectorsin interfaceComponent<PulsarWorkerService>
-
triggerFunction
public String triggerFunction(String tenant, String namespace, String functionName, String input, InputStream uploadedInputStream, String topic, String clientRole, AuthenticationDataSource clientAuthenticationDataHttps) - Specified by:
triggerFunctionin interfaceComponent<PulsarWorkerService>
-
getFunctionState
public org.apache.pulsar.common.functions.FunctionState getFunctionState(String tenant, String namespace, String functionName, String key, String clientRole, AuthenticationDataSource clientAuthenticationDataHttps) - Specified by:
getFunctionStatein interfaceComponent<PulsarWorkerService>
-
putFunctionState
public void putFunctionState(String tenant, String namespace, String functionName, String key, org.apache.pulsar.common.functions.FunctionState state, String clientRole, AuthenticationDataSource clientAuthenticationDataHttps) - Specified by:
putFunctionStatein interfaceComponent<PulsarWorkerService>
-
uploadFunction
public void uploadFunction(InputStream uploadedInputStream, String path, String clientRole, AuthenticationDataSource authenticationData) - Specified by:
uploadFunctionin interfaceComponent<PulsarWorkerService>
-
downloadFunction
public javax.ws.rs.core.StreamingOutput downloadFunction(String tenant, String namespace, String componentName, String clientRole, AuthenticationDataSource clientAuthenticationDataHttps, boolean transformFunction) - Specified by:
downloadFunctionin interfaceComponent<PulsarWorkerService>
-
downloadFunction
public javax.ws.rs.core.StreamingOutput downloadFunction(String path, String clientRole, AuthenticationDataSource clientAuthenticationDataHttps) - Specified by:
downloadFunctionin interfaceComponent<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
-
isAuthorizedRole
public boolean isAuthorizedRole(String tenant, String namespace, String clientRole, AuthenticationDataSource authenticationData) throws PulsarAdminException - Throws:
PulsarAdminException
-
componentStatusRequestValidate
protected void componentStatusRequestValidate(String tenant, String namespace, String componentName, String clientRole, AuthenticationDataSource clientAuthenticationDataHttps) -
componentInstanceStatusRequestValidate
protected void componentInstanceStatusRequestValidate(String tenant, String namespace, String componentName, int instanceId, String clientRole, AuthenticationDataSource clientAuthenticationDataHttps) -
isSuperUser
-
allowFunctionOps
public boolean allowFunctionOps(org.apache.pulsar.common.naming.NamespaceName namespaceName, String role, AuthenticationDataSource authenticationData) -
getClassLoaderFromPackage
protected ClassLoader getClassLoaderFromPackage(String className, File packageFile, String narExtractionDirectory) -
getPackageFile
protected File getPackageFile(String functionPkgUrl, String existingPackagePath, InputStream uploadedInputStream) throws IOException, PulsarAdminException - Throws:
IOExceptionPulsarAdminException
-
downloadPackageFile
- Throws:
IOExceptionPulsarAdminException
-
getPackageFile
- Throws:
IOExceptionPulsarAdminException
-
getBuiltinFunctionClassLoader
-