use of co.cask.cdap.api.service.ServiceSpecification in project cdap by caskdata.
the class InMemoryServiceProgramRunner method run.
@Override
public ProgramController run(Program program, ProgramOptions options) {
// Extract and verify parameters
ApplicationSpecification appSpec = program.getApplicationSpecification();
Preconditions.checkNotNull(appSpec, "Missing application specification.");
ProgramType processorType = program.getType();
Preconditions.checkNotNull(processorType, "Missing processor type.");
Preconditions.checkArgument(processorType == ProgramType.SERVICE, "Only SERVICE process type is supported.");
ServiceSpecification serviceSpec = appSpec.getServices().get(program.getName());
Preconditions.checkNotNull(serviceSpec, "Missing ServiceSpecification for %s", program.getName());
//RunId for the service
RunId runId = RunIds.generate();
return startAll(program, options, runId, serviceSpec.getInstances());
}
use of co.cask.cdap.api.service.ServiceSpecification in project cdap by caskdata.
the class DefaultAppConfigurer method addService.
public void addService(Service service) {
Preconditions.checkArgument(service != null, "Service cannot be null.");
DefaultServiceConfigurer configurer = new DefaultServiceConfigurer(service, deployNamespace, artifactId, artifactRepository, pluginInstantiator);
service.configure(configurer);
ServiceSpecification spec = configurer.createSpecification();
addDatasetsAndPlugins(configurer);
services.put(spec.getName(), spec);
}
Aggregations