Package step.functions.handler
Class AbstractFunctionHandler<IN,OUT>
java.lang.Object
step.functions.handler.AbstractFunctionHandler<IN,OUT>
- Direct Known Subclasses:
JsonBasedFunctionHandler
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected step.functions.io.Output<OUT>
Delegate the execution of the function to theAbstractFunctionHandler
specified in the arguments in the context of the specified branchprotected step.functions.io.Output<OUT>
Delegate the execution of the function to theAbstractFunctionHandler
specified in the arguments in the context of the default branchprotected step.grid.contextbuilder.ApplicationContextBuilder.ApplicationContext
protected step.grid.contextbuilder.ApplicationContextBuilder.ApplicationContext
getCurrentContext
(String branch) protected step.grid.filemanager.FileVersionId
getFileVersionId
(String properyName, Map<String, String> properties) protected FunctionHandlerFactory
protected step.grid.agent.tokenpool.TokenReservationSession
protected step.grid.agent.tokenpool.TokenSession
protected abstract step.functions.io.Output<OUT>
void
mergeAllProperties
(step.functions.io.Input<?> input) protected void
pushLocalApplicationContext
(ClassLoader classLoader, String resourceName) Push a new context based on a local file (jar or zip) to the default branch.protected void
pushLocalApplicationContext
(String branch, ClassLoader classLoader, String resourceName) Push a new context based on a local file (jar or zip) to the branch specified as argument.protected void
pushLocalFolderApplicationContext
(File libFolder) Push a new context based on a local folder containing a list of jars to the master branch.protected void
pushLocalFolderApplicationContext
(String branch, File libFolder) Push a new context based on a local folder containing a list of jars to the branch specified as argument.protected void
Push a new remote context to the branch specified as argument.protected void
pushRemoteApplicationContext
(String fileId, Map<String, String> properties) Push a new remote context to the default branch.protected File
retrieveFileVersion
(String properyName, Map<String, String> properties) protected <T> T
runInContext
(String branch, Callable<T> callable) Executes the callable in the current context of the branch specified as argumentprotected <T> T
runInContext
(Callable<T> callable) Executes the callable using theClassLoader
associated to the currentApplicationContextBuilder.ApplicationContext
as context classloaderprotected void
setApplicationContextBuilder
(step.grid.contextbuilder.ApplicationContextBuilder applicationContextBuilder) protected void
setFileManagerClient
(step.grid.filemanager.FileManagerClient fileManagerClient) protected void
setFunctionHandlerFactory
(FunctionHandlerFactory functionHandlerFactory) protected void
setProperties
(Map<String, String> properties) protected void
setTokenReservationSession
(step.grid.agent.tokenpool.TokenReservationSession tokenReservationSession) protected void
setTokenSession
(step.grid.agent.tokenpool.TokenSession tokenSession)
-
Field Details
-
FORKED_BRANCH
- See Also:
-
STEP_NODE_KEY
- See Also:
-
PARENTREPORTID_KEY
- See Also:
-
EXECUTION_CONTEXT_KEY
- See Also:
-
-
Constructor Details
-
AbstractFunctionHandler
public AbstractFunctionHandler()
-
-
Method Details
-
getFunctionHandlerFactory
-
setFunctionHandlerFactory
-
setApplicationContextBuilder
protected void setApplicationContextBuilder(step.grid.contextbuilder.ApplicationContextBuilder applicationContextBuilder) -
setFileManagerClient
protected void setFileManagerClient(step.grid.filemanager.FileManagerClient fileManagerClient) -
setProperties
-
getProperties
-
getTokenSession
protected step.grid.agent.tokenpool.TokenSession getTokenSession() -
setTokenSession
protected void setTokenSession(step.grid.agent.tokenpool.TokenSession tokenSession) -
getTokenReservationSession
protected step.grid.agent.tokenpool.TokenReservationSession getTokenReservationSession() -
setTokenReservationSession
protected void setTokenReservationSession(step.grid.agent.tokenpool.TokenReservationSession tokenReservationSession) -
initialize
public void initialize() -
getCurrentContext
protected step.grid.contextbuilder.ApplicationContextBuilder.ApplicationContext getCurrentContext()- Returns:
- the current
ApplicationContextBuilder.ApplicationContext
of the default branch
-
getCurrentContext
protected step.grid.contextbuilder.ApplicationContextBuilder.ApplicationContext getCurrentContext(String branch) - Parameters:
branch
-- Returns:
- the current
ApplicationContextBuilder.ApplicationContext
of the branch specified in the argument
-
runInContext
Executes the callable using theClassLoader
associated to the currentApplicationContextBuilder.ApplicationContext
as context classloader- Parameters:
callable
- the callable to be executed in the currentApplicationContextBuilder.ApplicationContext
- Returns:
- the result of the callable
- Throws:
Exception
-
runInContext
Executes the callable in the current context of the branch specified as argument- Parameters:
branch
- the name of the branch to be used for executioncallable
- the callable to be executed in the currentApplicationContextBuilder.ApplicationContext
- Returns:
- the result of the callable
- Throws:
Exception
-
pushLocalApplicationContext
protected void pushLocalApplicationContext(ClassLoader classLoader, String resourceName) throws step.grid.contextbuilder.ApplicationContextBuilderException Push a new context based on a local file (jar or zip) to the default branch. SeeApplicationContextBuilder
for details- Parameters:
classLoader
- the classloader to be used to search the fileresourceName
- the name of the resource to be pushed- Throws:
step.grid.contextbuilder.ApplicationContextBuilderException
-
pushLocalApplicationContext
protected void pushLocalApplicationContext(String branch, ClassLoader classLoader, String resourceName) throws step.grid.contextbuilder.ApplicationContextBuilderException Push a new context based on a local file (jar or zip) to the branch specified as argument. SeeApplicationContextBuilder
for details- Parameters:
branch
- the name of the branch on which the context has to be pushedclassLoader
- the classloader to be used to search the fileresourceName
- the name of the resource to be pushed- Throws:
step.grid.contextbuilder.ApplicationContextBuilderException
-
pushLocalFolderApplicationContext
protected void pushLocalFolderApplicationContext(File libFolder) throws step.grid.contextbuilder.ApplicationContextBuilderException Push a new context based on a local folder containing a list of jars to the master branch. SeeApplicationContextBuilder
for details- Parameters:
libFolder
- the folder containing the jars to be pushed to the context- Throws:
step.grid.contextbuilder.ApplicationContextBuilderException
-
pushLocalFolderApplicationContext
protected void pushLocalFolderApplicationContext(String branch, File libFolder) throws step.grid.contextbuilder.ApplicationContextBuilderException Push a new context based on a local folder containing a list of jars to the branch specified as argument. SeeApplicationContextBuilder
for details- Parameters:
branch
- the name of the branch on which the context has to be pushedlibFolder
- the folder containing the jars to be pushed to the context- Throws:
step.grid.contextbuilder.ApplicationContextBuilderException
-
pushRemoteApplicationContext
protected void pushRemoteApplicationContext(String fileId, Map<String, String> properties) throws step.grid.contextbuilder.ApplicationContextBuilderExceptionPush a new remote context to the default branch. SeeApplicationContextBuilder
for details- Parameters:
fileId
- the id of the remote file (jar or folder) to be pushedproperties
-- Throws:
step.grid.contextbuilder.ApplicationContextBuilderException
-
pushRemoteApplicationContext
protected void pushRemoteApplicationContext(String branch, String fileId, Map<String, String> properties) throws step.grid.contextbuilder.ApplicationContextBuilderExceptionPush a new remote context to the branch specified as argument. SeeApplicationContextBuilder
for details- Parameters:
branch
- the name of the branch on which the context has to be pushedfileId
- the id of the remote file (jar or folder) to be pushedproperties
-- Throws:
step.grid.contextbuilder.ApplicationContextBuilderException
-
delegate
protected step.functions.io.Output<OUT> delegate(String branchName, String functionHandlerClassname, step.functions.io.Input<IN> input) throws Exception Delegate the execution of the function to theAbstractFunctionHandler
specified in the arguments in the context of the specified branch- Parameters:
branchName
-functionHandlerClassname
-input
-- Returns:
- Throws:
Exception
-
delegate
protected step.functions.io.Output<OUT> delegate(String functionHandlerClassname, step.functions.io.Input<IN> input) throws Exception Delegate the execution of the function to theAbstractFunctionHandler
specified in the arguments in the context of the default branch- Parameters:
functionHandlerClassname
-input
-- Returns:
- Throws:
Exception
-
retrieveFileVersion
protected File retrieveFileVersion(String properyName, Map<String, String> properties) throws step.grid.filemanager.FileManagerException- Throws:
step.grid.filemanager.FileManagerException
-
getFileVersionId
-
handle
protected abstract step.functions.io.Output<OUT> handle(step.functions.io.Input<IN> input) throws Exception - Throws:
Exception
-
mergeAllProperties
-
getInputPayloadClass
-
getOutputPayloadClass
-