public final class TaskExecutors extends Object
TaskExecutor
.Modifier and Type | Class and Description |
---|---|
static interface |
TaskExecutors.IoConsumer<T>
Represents an action.
|
Modifier and Type | Field and Description |
---|---|
static String |
ENV_BATCHAPPS_PATH
The environment variable of application installation path.
|
static String |
ENV_FRAMEWORK_PATH
The environment variable of framework installation path.
|
static String |
LOCATION_APPLICATION_WORKFLOW_DEFINITION
The workflow information file path (relative from each application directory).
|
Modifier and Type | Method and Description |
---|---|
static Optional<Path> |
findApplicationFile(TaskExecutionContext context,
String location)
Returns a file in the current batch application package.
|
static Optional<Path> |
findApplicationHome(ExecutionContext context)
Returns the batch application installation base path.
|
static Optional<Path> |
findApplicationHome(Map<String,String> environmentVariables)
Returns the batch application installation base path.
|
static Optional<Path> |
findApplicationWorkflowDefinitionFile(TaskExecutionContext context)
Returns an application workflow definition file.
|
static Set<Path> |
findAttachedLibraries(TaskExecutionContext context)
Returns the attached library files.
|
static Optional<Path> |
findCoreConfigurationFile(ExecutionContext context)
Returns the core configuration file.
|
static Optional<URL> |
findCoreConfigurationUrl(ExecutionContext context)
Returns the core configuration URL only if it exists.
|
static Set<Path> |
findCoreLibraries(ExecutionContext context)
Returns the framework core library files.
|
static Set<Path> |
findExtensionLibraries(ExecutionContext context)
Returns the framework extension library files.
|
static Optional<Path> |
findFrameworkFile(ExecutionContext context,
String location)
Returns a framework file.
|
static Optional<Path> |
findFrameworkHome(ExecutionContext context)
Returns the framework installation path.
|
static Optional<Path> |
findFrameworkHome(Map<String,String> environmentVariables)
Returns the framework installation path.
|
static Set<Path> |
findFrameworkLibraries(ExecutionContext context,
String location)
Returns the library files on the framework directory.
|
static Set<Path> |
findHadoopEmbeddedLibraries(ExecutionContext context)
Returns the Hadoop embedded library files.
|
static Optional<Path> |
findJobflowLibrary(TaskExecutionContext context)
Returns the jobflow library file.
|
static Path |
getUserHome(ExecutionContext context)
Returns the current user home directory.
|
static String |
getUserName(ExecutionContext context)
Returns the current user name.
|
static Collection<TaskExecutor> |
loadDefaults(ClassLoader serviceLoader)
Returns the default task executor objects via SPI.
|
static String |
resolveCommandToken(TaskExecutionContext context,
CommandToken token)
Resolves a
CommandToken for the current execution context. |
static List<String> |
resolveCommandTokens(TaskExecutionContext context,
List<? extends CommandToken> tokens)
Resolves a list of
CommandToken for the current execution context. |
static String |
resolvePath(TaskExecutionContext context,
String path)
Resolves a path string using the current context.
|
static void |
withLibraries(TaskExecutionContext context,
List<? extends Path> libraries,
TaskExecutors.IoConsumer<? super ClassLoader> action)
Loads the libraries and performs the given action.
|
static void |
withLibraries(TaskExecutionContext context,
TaskExecutors.IoConsumer<? super ClassLoader> action)
Loads the current batch libraries and performs the given action.
|
public static final String ENV_FRAMEWORK_PATH
public static final String ENV_BATCHAPPS_PATH
public static final String LOCATION_APPLICATION_WORKFLOW_DEFINITION
public static Collection<TaskExecutor> loadDefaults(ClassLoader serviceLoader)
serviceLoader
- the service loaderpublic static Optional<Path> findFrameworkHome(Map<String,String> environmentVariables)
environmentVariables
- the environment variablespublic static Optional<Path> findApplicationHome(Map<String,String> environmentVariables)
environmentVariables
- the environment variablespublic static String getUserName(ExecutionContext context)
context
- the current contextpublic static Path getUserHome(ExecutionContext context)
context
- the current contextpublic static Optional<Path> findFrameworkHome(ExecutionContext context)
context
- the current task execution contextpublic static Optional<Path> findFrameworkFile(ExecutionContext context, String location)
context
- the current task execution contextlocation
- the relative location from the framework installation rootpublic static Optional<Path> findApplicationHome(ExecutionContext context)
context
- the current contextpublic static Optional<Path> findApplicationFile(TaskExecutionContext context, String location)
context
- the current task execution contextlocation
- the relative location from the batch application package rootpublic static Optional<Path> findApplicationWorkflowDefinitionFile(TaskExecutionContext context)
context
- the current task execution contextpublic static String resolvePath(TaskExecutionContext context, String path)
context
- the current task execution contextpath
- the target path expressionpublic static List<String> resolveCommandTokens(TaskExecutionContext context, List<? extends CommandToken> tokens)
CommandToken
for the current execution context.context
- the current task execution contexttokens
- the target command tokenspublic static String resolveCommandToken(TaskExecutionContext context, CommandToken token)
CommandToken
for the current execution context.context
- the current task execution contexttoken
- the target command tokenpublic static Optional<Path> findJobflowLibrary(TaskExecutionContext context)
context
- the current task execution contextpublic static Optional<Path> findCoreConfigurationFile(ExecutionContext context)
context
- the current task execution context"asakusa-runtime.xml"
)public static Optional<URL> findCoreConfigurationUrl(ExecutionContext context)
context
- the current task execution context"asakusa-runtime.xml"
)public static Set<Path> findAttachedLibraries(TaskExecutionContext context)
context
- the current task execution contextpublic static Set<Path> findFrameworkLibraries(ExecutionContext context, String location)
context
- the current task execution contextlocation
- the directory location (relative from the framework installation path)public static Set<Path> findCoreLibraries(ExecutionContext context)
context
- the current task execution contextpublic static Set<Path> findHadoopEmbeddedLibraries(ExecutionContext context)
context
- the current task execution contextpublic static Set<Path> findExtensionLibraries(ExecutionContext context)
context
- the current task execution contextpublic static void withLibraries(TaskExecutionContext context, TaskExecutors.IoConsumer<? super ClassLoader> action) throws IOException, InterruptedException
context
- the current contextaction
- the target actionIOException
- if I/O error was occurred in this actionInterruptedException
- if interrupted while executing this actionpublic static void withLibraries(TaskExecutionContext context, List<? extends Path> libraries, TaskExecutors.IoConsumer<? super ClassLoader> action) throws IOException, InterruptedException
context
- the current contextlibraries
- the target librariesaction
- the target actionIOException
- if I/O error was occurred in this actionInterruptedException
- if interrupted while executing this actionCopyright © 2011–2019 Asakusa Framework Team. All rights reserved.