T
- the target script kindpublic abstract class ExecutionScriptHandlerDispatcher<T extends ExecutionScript> extends Object implements ExecutionScriptHandler<T>
ExecutionScriptHandler
.DEFAULT_RESOURCE_ID, ENV_EXTENSION_PREFIX, KEY_ENV_PREFIX, KEY_PROP_PREFIX, KEY_RESOURCE
Modifier | Constructor and Description |
---|---|
protected |
ExecutionScriptHandlerDispatcher(Class<? extends ExecutionScriptHandler<T>> handlerKind)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
cleanUp(ExecutionMonitor monitor,
ExecutionContext context)
Cleanup the target environment.
|
void |
configure(ServiceProfile<?> profile)
Configures this service.
|
void |
execute(ExecutionMonitor monitor,
ExecutionContext context,
T script)
Executes the specified script.
|
Map<String,String> |
getEnvironmentVariables(ExecutionContext context,
ExecutionScript script)
Returns desired environment variables to execute scripts using this handler.
|
String |
getHandlerId()
Returns the ID of this handler.
|
Map<String,String> |
getProperties(ExecutionContext context,
ExecutionScript script)
Returns desired system/hadoop properties to execute scripts using this handler.
|
String |
getResourceId(ExecutionContext context,
ExecutionScript script)
Returns the ID of a resource which is used for executing this handler.
|
void |
setUp(ExecutionMonitor monitor,
ExecutionContext context)
Setup the target environment.
|
protected ExecutionScriptHandlerDispatcher(Class<? extends ExecutionScriptHandler<T>> handlerKind)
handlerKind
- the handler kindIllegalArgumentException
- if some parameters were null
public void configure(ServiceProfile<?> profile) throws IOException, InterruptedException
Service
configure
in interface Service
profile
- the profile of this serviceIOException
- if failed to configure this serviceInterruptedException
- if interrupted in configurationpublic String getHandlerId()
ExecutionScriptHandler
getHandlerId
in interface ExecutionScriptHandler<T extends ExecutionScript>
public String getResourceId(ExecutionContext context, ExecutionScript script) throws InterruptedException, IOException
ExecutionScriptHandler
getResourceId
in interface ExecutionScriptHandler<T extends ExecutionScript>
context
- the current execution contextscript
- the target script (nullable)InterruptedException
- if this operation is interruptedIOException
- if failed to setup the target environmentpublic Map<String,String> getProperties(ExecutionContext context, ExecutionScript script) throws InterruptedException, IOException
ExecutionScriptHandler
getProperties
in interface ExecutionScriptHandler<T extends ExecutionScript>
context
- the current execution contextscript
- the target script (nullable)InterruptedException
- if this operation is interruptedIOException
- if failed to setup the target environmentpublic Map<String,String> getEnvironmentVariables(ExecutionContext context, ExecutionScript script) throws InterruptedException, IOException
ExecutionScriptHandler
getEnvironmentVariables
in interface ExecutionScriptHandler<T extends ExecutionScript>
context
- the current execution contextscript
- the target script (nullable)InterruptedException
- if this operation is interruptedIOException
- if failed to setup the target environmentpublic void setUp(ExecutionMonitor monitor, ExecutionContext context) throws InterruptedException, IOException
ExecutionScriptHandler
setUp
in interface ExecutionScriptHandler<T extends ExecutionScript>
monitor
- the progress monitor of the operationcontext
- the current execution contextInterruptedException
- if this operation is interruptedIOException
- if failed to setup the target environmentpublic void execute(ExecutionMonitor monitor, ExecutionContext context, T script) throws InterruptedException, IOException
ExecutionScriptHandler
execute
in interface ExecutionScriptHandler<T extends ExecutionScript>
monitor
- the progress monitor of the executioncontext
- current execution contextscript
- target scriptInterruptedException
- if the execution was interruptedIOException
- if execution was failedpublic void cleanUp(ExecutionMonitor monitor, ExecutionContext context) throws InterruptedException, IOException
ExecutionScriptHandler
cleanUp
in interface ExecutionScriptHandler<T extends ExecutionScript>
monitor
- the progress monitor of the operationcontext
- the current execution contextInterruptedException
- if this operation is interruptedIOException
- if failed to setup the target environmentCopyright © 2011–2019 Asakusa Framework Team. All rights reserved.