com.nflabs.zeppelin.driver.mock.MockDriverFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of zeppelin-zengine Show documentation
Show all versions of zeppelin-zengine Show documentation
Zengine is java framework for data analysis on Hadoop. see http://nflabs.github.io/zeppelin/#/zengine
The newest version!
package com.nflabs.zeppelin.driver.mock;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import com.nflabs.zeppelin.conf.ZeppelinConfiguration;
import com.nflabs.zeppelin.driver.ZeppelinDriver;
import com.nflabs.zeppelin.driver.ZeppelinDriverException;
import com.nflabs.zeppelin.driver.ZeppelinDriverFactory;
public class MockDriverFactory extends ZeppelinDriverFactory {
Map drivers = new HashMap();
private ZeppelinConfiguration conf;
private MockDriverFactory(String driverRootDir, URI[] uriList)
throws ZeppelinDriverException {
super(driverRootDir, uriList);
}
public MockDriverFactory(){
super(null, null);
try {
drivers.put("test", new URI("test://test"));
drivers.put("production", new URI("test://production"));
} catch (URISyntaxException e) {
e.printStackTrace();
}
}
@Override
public Collection getAllConfigurationNames(){
return drivers.keySet();
}
@Override
public String getDefaultConfigurationName(){
return "test";
}
@Override
public ZeppelinDriver getDriver(String name) throws ZeppelinDriverException{
URI uri = drivers.get(name);
if (uri==null) {
throw new ZeppelinDriverException("Driver "+name+" not found");
}
return new MockDriver();
}
}