mirror of https://github.com/apache/jclouds.git
Factored JobExecutionContext utility functions into a helper class
This commit is contained in:
parent
8e74a1e029
commit
e737e45d36
|
@ -43,14 +43,15 @@ public class HttpRequestJob implements Job {
|
|||
|
||||
@Override
|
||||
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||
PlatformServices platform = getPlatform(context);
|
||||
PlatformServices platform = JobContexts.getPlatform(context);
|
||||
RunnableHttpRequest request = platform.getScheduler().getHttpRequestFactory().create(
|
||||
HttpRequest.builder()
|
||||
.endpoint(getTargetUrl(platform.getBaseUrl(), context))
|
||||
.endpoint(JobContexts.getTargetUrl(platform.getBaseUrl(), context))
|
||||
.method("GET").build());
|
||||
request.run();
|
||||
}
|
||||
|
||||
private static class JobContexts {
|
||||
private static URI getTargetUrl(String baseUrl, JobExecutionContext context) {
|
||||
return URI.create(baseUrl + (String) checkNotNull(
|
||||
context.getMergedJobDataMap().get(URL_ATTRIBUTE_NAME), URL_ATTRIBUTE_NAME));
|
||||
|
@ -65,3 +66,4 @@ public class HttpRequestJob implements Job {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue