org.apache.flink.runtime.webmonitor.handlers.JarRequestBody Java Examples
The following examples show how to use
org.apache.flink.runtime.webmonitor.handlers.JarRequestBody.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JarHandlerUtils.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
public static <R extends JarRequestBody> JarHandlerContext fromRequest( @Nonnull final HandlerRequest<R, ?> request, @Nonnull final Path jarDir, @Nonnull final Logger log) throws RestHandlerException { final JarRequestBody requestBody = request.getRequestBody(); final String pathParameter = request.getPathParameter(JarIdPathParameter.class); Path jarFile = jarDir.resolve(pathParameter); String entryClass = fromRequestBodyOrQueryParameter( emptyToNull(requestBody.getEntryClassName()), () -> emptyToNull(getQueryParameter(request, EntryClassQueryParameter.class)), null, log); List<String> programArgs = JarHandlerUtils.getProgramArgs(request, log); int parallelism = fromRequestBodyOrQueryParameter( requestBody.getParallelism(), () -> getQueryParameter(request, ParallelismQueryParameter.class), ExecutionConfig.PARALLELISM_DEFAULT, log); JobID jobId = fromRequestBodyOrQueryParameter( requestBody.getJobId(), () -> null, // No support via query parameter null, // Delegate default job ID to actual JobGraph generation log); return new JarHandlerContext(jarFile, entryClass, programArgs, parallelism, jobId); }
Example #2
Source File: JarHandlerUtils.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
/** Parse program arguments in jar run or plan request. */ private static <R extends JarRequestBody, M extends MessageParameters> List<String> getProgramArgs( HandlerRequest<R, M> request, Logger log) throws RestHandlerException { JarRequestBody requestBody = request.getRequestBody(); @SuppressWarnings("deprecation") List<String> programArgs = tokenizeArguments( fromRequestBodyOrQueryParameter( emptyToNull(requestBody.getProgramArguments()), () -> getQueryParameter(request, ProgramArgsQueryParameter.class), null, log)); List<String> programArgsList = fromRequestBodyOrQueryParameter( requestBody.getProgramArgumentsList(), () -> request.getQueryParameter(ProgramArgQueryParameter.class), null, log); if (!programArgsList.isEmpty()) { if (!programArgs.isEmpty()) { throw new RestHandlerException( "Confusing request: programArgs and programArgsList are specified, please, use only programArgsList", HttpResponseStatus.BAD_REQUEST); } return programArgsList; } else { return programArgs; } }
Example #3
Source File: JarHandlerUtils.java From flink with Apache License 2.0 | 5 votes |
public static <R extends JarRequestBody> JarHandlerContext fromRequest( @Nonnull final HandlerRequest<R, ?> request, @Nonnull final Path jarDir, @Nonnull final Logger log) throws RestHandlerException { final JarRequestBody requestBody = request.getRequestBody(); final String pathParameter = request.getPathParameter(JarIdPathParameter.class); Path jarFile = jarDir.resolve(pathParameter); String entryClass = fromRequestBodyOrQueryParameter( emptyToNull(requestBody.getEntryClassName()), () -> emptyToNull(getQueryParameter(request, EntryClassQueryParameter.class)), null, log); List<String> programArgs = JarHandlerUtils.getProgramArgs(request, log); int parallelism = fromRequestBodyOrQueryParameter( requestBody.getParallelism(), () -> getQueryParameter(request, ParallelismQueryParameter.class), ExecutionConfig.PARALLELISM_DEFAULT, log); JobID jobId = fromRequestBodyOrQueryParameter( requestBody.getJobId(), () -> null, // No support via query parameter null, // Delegate default job ID to actual JobGraph generation log); return new JarHandlerContext(jarFile, entryClass, programArgs, parallelism, jobId); }
Example #4
Source File: JarHandlerUtils.java From flink with Apache License 2.0 | 5 votes |
/** Parse program arguments in jar run or plan request. */ private static <R extends JarRequestBody, M extends MessageParameters> List<String> getProgramArgs( HandlerRequest<R, M> request, Logger log) throws RestHandlerException { JarRequestBody requestBody = request.getRequestBody(); @SuppressWarnings("deprecation") List<String> programArgs = tokenizeArguments( fromRequestBodyOrQueryParameter( emptyToNull(requestBody.getProgramArguments()), () -> getQueryParameter(request, ProgramArgsQueryParameter.class), null, log)); List<String> programArgsList = fromRequestBodyOrQueryParameter( requestBody.getProgramArgumentsList(), () -> request.getQueryParameter(ProgramArgQueryParameter.class), null, log); if (!programArgsList.isEmpty()) { if (!programArgs.isEmpty()) { throw new RestHandlerException( "Confusing request: programArgs and programArgsList are specified, please, use only programArgsList", HttpResponseStatus.BAD_REQUEST); } return programArgsList; } else { return programArgs; } }
Example #5
Source File: JarHandlerUtils.java From flink with Apache License 2.0 | 5 votes |
public static <R extends JarRequestBody> JarHandlerContext fromRequest( @Nonnull final HandlerRequest<R, ?> request, @Nonnull final Path jarDir, @Nonnull final Logger log) throws RestHandlerException { final JarRequestBody requestBody = request.getRequestBody(); final String pathParameter = request.getPathParameter(JarIdPathParameter.class); Path jarFile = jarDir.resolve(pathParameter); String entryClass = fromRequestBodyOrQueryParameter( emptyToNull(requestBody.getEntryClassName()), () -> emptyToNull(getQueryParameter(request, EntryClassQueryParameter.class)), null, log); List<String> programArgs = JarHandlerUtils.getProgramArgs(request, log); int parallelism = fromRequestBodyOrQueryParameter( requestBody.getParallelism(), () -> getQueryParameter(request, ParallelismQueryParameter.class), CoreOptions.DEFAULT_PARALLELISM.defaultValue(), log); JobID jobId = fromRequestBodyOrQueryParameter( requestBody.getJobId(), () -> null, // No support via query parameter null, // Delegate default job ID to actual JobGraph generation log); return new JarHandlerContext(jarFile, entryClass, programArgs, parallelism, jobId); }
Example #6
Source File: JarHandlerUtils.java From flink with Apache License 2.0 | 5 votes |
/** Parse program arguments in jar run or plan request. */ private static <R extends JarRequestBody, M extends MessageParameters> List<String> getProgramArgs( HandlerRequest<R, M> request, Logger log) throws RestHandlerException { JarRequestBody requestBody = request.getRequestBody(); @SuppressWarnings("deprecation") List<String> programArgs = tokenizeArguments( fromRequestBodyOrQueryParameter( emptyToNull(requestBody.getProgramArguments()), () -> getQueryParameter(request, ProgramArgsQueryParameter.class), null, log)); List<String> programArgsList = fromRequestBodyOrQueryParameter( requestBody.getProgramArgumentsList(), () -> request.getQueryParameter(ProgramArgQueryParameter.class), null, log); if (!programArgsList.isEmpty()) { if (!programArgs.isEmpty()) { throw new RestHandlerException( "Confusing request: programArgs and programArgsList are specified, please, use only programArgsList", HttpResponseStatus.BAD_REQUEST); } return programArgsList; } else { return programArgs; } }