C
- the context typepublic class StreamFunctionExecutor<C>
extends java.lang.Object
A base function executor for handling input and output as streams
.Modifier and Type | Field and Description |
---|---|
protected ApplicationContext |
applicationContext
The current
ApplicationContext . |
Constructor and Description |
---|
StreamFunctionExecutor() |
Modifier and Type | Method and Description |
---|---|
protected ApplicationContext |
buildApplicationContext(C context) |
void |
close() |
void |
execute(java.io.InputStream input,
java.io.OutputStream output)
Execute the function for the given input and output.
|
protected void |
execute(java.io.InputStream input,
java.io.OutputStream output,
C context)
Execute the function with given context object.
|
ApplicationContext |
getApplicationContext()
Resolves the
ApplicationContext for this class. |
protected ApplicationContextBuilder |
newApplicationContextBuilder()
Builds a new builder.
|
protected ExecutableMethod<java.lang.Object,java.lang.Object> |
resolveFunction(LocalFunctionRegistry localFunctionRegistry,
java.lang.String functionName)
Resolve a function from the
LocalFunctionRegistry . |
protected java.lang.String |
resolveFunctionName(Environment env)
Resolves the function name to execution for the environment.
|
protected Environment |
startEnvironment(ApplicationContext applicationContext)
Start the environment specified.
|
protected ApplicationContext applicationContext
ApplicationContext
.public void execute(java.io.InputStream input, java.io.OutputStream output) throws java.io.IOException
input
- The inputoutput
- The outputjava.io.IOException
- If an I/O exception occursprotected void execute(java.io.InputStream input, java.io.OutputStream output, C context) throws java.io.IOException
input
- The InputStream
output
- THe OutputStream
context
- The context objectjava.io.IOException
- If an error occursprotected ExecutableMethod<java.lang.Object,java.lang.Object> resolveFunction(LocalFunctionRegistry localFunctionRegistry, java.lang.String functionName)
LocalFunctionRegistry
.localFunctionRegistry
- The LocalFunctionRegistry
functionName
- The function nameprotected java.lang.String resolveFunctionName(Environment env)
env
- The environmentprotected ApplicationContext buildApplicationContext(@Nullable C context)
context
- A platform specific context objectApplicationContext
to use@NonNull protected ApplicationContextBuilder newApplicationContextBuilder()
ApplicationContextBuilder
protected Environment startEnvironment(ApplicationContext applicationContext)
applicationContext
- the application context with the environmentpublic ApplicationContext getApplicationContext()
ApplicationContextProvider
ApplicationContext
for this class.getApplicationContext
in interface ApplicationContextProvider
ApplicationContext
@PreDestroy public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException