MLIOFactory { public MLInputAdapter getInputAdapter(String type) { Class<?> c; if (configuration != null) { String className = configuration.getProperty(type); if (className == null) { return new FileInputAdapter(); } try { c = Class.forName(className); MLInputAdapter inputAdapter = (MLInputAdapter) c.newInstance(); return inputAdapter; } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) { log.warn(String .format("Failed to load/instantiate the class: %s . Hence, the default implementation %s will be used.", className, FileInputAdapter.class.getName())); } } return new FileInputAdapter(); } MLIOFactory(Properties properties); MLInputAdapter getInputAdapter(String type); MLOutputAdapter getOutputAdapter(String type); String getTargetPath(String fileName);  }
@Test public void getInputAdapter() { MLInputAdapter inputAdapter = ioFactory.getInputAdapter("hdfs.input"); Assert.assertEquals(inputAdapter instanceof HdfsInputAdapter, true); inputAdapter = ioFactory.getInputAdapter("hdfs"); Assert.assertEquals(inputAdapter instanceof FileInputAdapter, true); }