@Override
public void addInput(Input input, @Nullable Class<?> mapperCls) {
if (input.getNamespace() != null && input.getNamespace().equals(NamespaceId.SYSTEM.getNamespace())
&& !getProgram().getNamespaceId().equals(NamespaceId.SYSTEM.getNamespace())) {
throw new IllegalArgumentException(String.format("Accessing Input %s in system namespace " +
"is not allowed from the namespace %s",
input.getName(), getProgram().getNamespaceId()));
}
if (input instanceof Input.DatasetInput) {
Input.DatasetInput datasetInput = (Input.DatasetInput) input;
Input.InputFormatProviderInput createdInput = createInput(datasetInput);
addInput(createdInput.getAlias(), createdInput.getInputFormatProvider(), mapperCls);
} else if (input instanceof Input.StreamInput) {
Input.StreamInput streamInput = (Input.StreamInput) input;
String namespace = streamInput.getNamespace();
if (namespace == null) {
namespace = getProgram().getNamespaceId();
}
addInput(input.getAlias(),
new StreamInputFormatProvider(new NamespaceId(namespace), streamInput, streamAdmin),
mapperCls);
} else if (input instanceof Input.InputFormatProviderInput) {
addInput(input.getAlias(), ((Input.InputFormatProviderInput) input).getInputFormatProvider(), mapperCls);
} else {
throw new IllegalArgumentException(String.format("Input %s has unknown input class %s",
input.getName(), input.getClass().getCanonicalName()));
}
}