use of co.cask.cdap.app.runtime.ProgramRuntimeProvider in project cdap by caskdata.
the class ProgramRuntimeProviderLoader method getSupportedTypesForProvider.
@Override
public Set<ProgramType> getSupportedTypesForProvider(ProgramRuntimeProvider programRuntimeProvider) {
// See if the provide supports the required program type
ProgramRuntimeProvider.SupportedProgramType supportedTypes = programRuntimeProvider.getClass().getAnnotation(ProgramRuntimeProvider.SupportedProgramType.class);
ImmutableSet.Builder<ProgramType> types = ImmutableSet.builder();
for (ProgramType programType : supportedTypes.value()) {
if (programRuntimeProvider.isSupported(programType, cConf)) {
types.add(programType);
}
}
return types.build();
}
use of co.cask.cdap.app.runtime.ProgramRuntimeProvider in project cdap by caskdata.
the class DefaultProgramRunnerFactory method create.
@Override
public ProgramRunner create(ProgramType programType) {
ProgramRuntimeProvider provider = runtimeProviderLoader.get(programType);
if (provider != null) {
LOG.debug("Using runtime provider {} for program type {}", provider, programType);
return provider.createProgramRunner(programType, mode, injector);
}
Provider<ProgramRunner> defaultProvider = defaultRunnerProviders.get(programType);
if (defaultProvider == null) {
throw new IllegalArgumentException("Unsupported program type: " + programType);
}
return defaultProvider.get();
}
Aggregations