this.appName = appName;
}
@Override
public TwillSpecification configure() {
ServiceConfigurer configurer = new DefaultServiceConfigurer();
service.configure(configurer);
Set<String> datasets = configurer.getDatasets();
List<? extends HttpServiceHandler> serviceHandlers = configurer.getHandlers();
if (serviceHandlers.size() == 0) {
throw new InvalidParameterException("No handlers provided. Add handlers using configurer.");
}
TwillSpecification.Builder.RunnableSetter runnableSetter = TwillSpecification.Builder.with()
.setName(configurer.getName())
.withRunnable()
.add(new HttpServiceTwillRunnable(appName, configurer.getName(),
serviceHandlers, datasets))
.noLocalFiles();
for (ServiceWorker worker : configurer.getWorkers()) {
TwillRunnable runnable = new ServiceWorkerTwillRunnable(worker, datasets);
runnableSetter = runnableSetter.add(runnable, worker.configure().getResourceSpecification()).noLocalFiles();
}
return runnableSetter.anyOrder().build();
}