use of io.cdap.cdap.internal.app.services.DefaultSystemTableConfigurer in project cdap by caskdata.
the class DefaultAppConfigurer method addService.
@Override
public void addService(Service service) {
Preconditions.checkArgument(service != null, "Service cannot be null.");
// check that a system service is only used in system namespace
if (!deployNamespace.equals(Id.Namespace.fromEntityId(NamespaceId.SYSTEM))) {
TypeToken<?> type = TypeToken.of(service.getClass()).resolveType(Service.class.getTypeParameters()[0]);
if (SystemServiceConfigurer.class.isAssignableFrom(type.getRawType())) {
throw new IllegalArgumentException(String.format("Invalid service '%s'. Services can only use a SystemServiceConfigurer if the application is " + "deployed in the system namespace.", service.getClass().getSimpleName()));
}
}
DefaultSystemTableConfigurer systemTableConfigurer = new DefaultSystemTableConfigurer();
DefaultServiceConfigurer configurer = new DefaultServiceConfigurer(service, deployNamespace, artifactId, pluginFinder, pluginInstantiator, systemTableConfigurer, runtimeInfo, getFeatureFlagsProvider());
service.configure(configurer);
ServiceSpecification spec = configurer.createSpecification();
addDatasetsAndPlugins(configurer);
addSystemTableSpecs(systemTableConfigurer.getTableSpecs());
services.put(spec.getName(), spec);
}
Aggregations