use of org.apache.oozie.dependency.URIHandler in project oozie by apache.
the class URIHandlerService method initLauncherClassesToShip.
/**
* Initialize classes that need to be shipped for using LauncherURIHandler in the launcher job
*/
private void initLauncherClassesToShip() {
launcherClassesToShip = new HashSet<Class<?>>();
launcherClassesToShip.add(LauncherURIHandlerFactory.class);
launcherClassesToShip.add(LauncherURIHandler.class);
for (URIHandler handler : cache.values()) {
launcherClassesToShip.add(handler.getLauncherURIHandlerClass());
List<Class<?>> classes = handler.getClassesForLauncher();
if (classes != null) {
launcherClassesToShip.addAll(classes);
}
}
launcherClassesToShip.add(defaultHandler.getLauncherURIHandlerClass());
}
use of org.apache.oozie.dependency.URIHandler in project oozie by apache.
the class URIHandlerService method initLauncherURIHandlerConf.
/**
* Initialize configuration required for using LauncherURIHandler in the launcher job
*/
private void initLauncherURIHandlerConf() {
launcherConf = new Configuration(false);
for (URIHandler handler : cache.values()) {
for (String scheme : handler.getSupportedSchemes()) {
String schemeConf = LauncherURIHandlerFactory.CONF_LAUNCHER_URIHANDLER_SCHEME_PREFIX + scheme;
launcherConf.set(schemeConf, handler.getLauncherURIHandlerClass().getName());
}
}
for (String scheme : defaultHandler.getSupportedSchemes()) {
String schemeConf = LauncherURIHandlerFactory.CONF_LAUNCHER_URIHANDLER_SCHEME_PREFIX + scheme;
launcherConf.set(schemeConf, defaultHandler.getLauncherURIHandlerClass().getName());
}
}
use of org.apache.oozie.dependency.URIHandler in project oozie by apache.
the class URIHandlerService method init.
private void init(Configuration conf) throws ClassNotFoundException {
cache = new HashMap<String, URIHandler>();
String[] classes = ConfigurationService.getStrings(conf, URI_HANDLERS);
for (String classname : classes) {
Class<?> clazz = Class.forName(classname.trim());
URIHandler uriHandler = (URIHandler) ReflectionUtils.newInstance(clazz, null);
uriHandler.init(conf);
for (String scheme : uriHandler.getSupportedSchemes()) {
cache.put(scheme, uriHandler);
}
}
Class<?> defaultClass = conf.getClass(URI_HANDLER_DEFAULT, null);
defaultHandler = (defaultClass == null) ? new FSURIHandler() : (URIHandler) ReflectionUtils.newInstance(defaultClass, null);
defaultHandler.init(conf);
for (String scheme : defaultHandler.getSupportedSchemes()) {
cache.put(scheme, defaultHandler);
}
initLauncherClassesToShip();
initLauncherURIHandlerConf();
LOG.info("Loaded urihandlers {0}", Arrays.toString(classes));
LOG.info("Loaded default urihandler {0}", defaultHandler.getClass().getName());
}
use of org.apache.oozie.dependency.URIHandler in project oozie by apache.
the class URIHandlerService method destroy.
@Override
public void destroy() {
Set<URIHandler> handlers = new HashSet<URIHandler>();
handlers.addAll(cache.values());
for (URIHandler handler : handlers) {
handler.destroy();
}
cache.clear();
}
use of org.apache.oozie.dependency.URIHandler in project oozie by apache.
the class CoordPushDependencyCheckXCommand method unregisterMissingDependencies.
public static void unregisterMissingDependencies(List<String> missingDeps, String actionId) {
final XLog LOG = XLog.getLog(CoordPushDependencyCheckXCommand.class);
URIHandlerService uriService = Services.get().get(URIHandlerService.class);
for (String missingDep : missingDeps) {
try {
URI missingURI = new URI(missingDep);
URIHandler handler = uriService.getURIHandler(missingURI);
if (handler.unregisterFromNotification(missingURI, actionId)) {
LOG.debug("Successfully unregistered uri [{0}] from notifications", missingURI);
} else {
LOG.warn("Unable to unregister uri [{0}] from notifications", missingURI);
}
} catch (Exception e) {
LOG.warn("Exception while unregistering uri [{0}] from notifications", missingDep, e);
}
}
}
Aggregations