/** * Construct a principal to local plugin * * @param topoConf storm configuration * @return the plugin */ public static IPrincipalToLocal getPrincipalToLocalPlugin(Map<String, Object> topoConf) { IPrincipalToLocal ptol = null; try { String ptol_klassName = (String) topoConf.get(Config.STORM_PRINCIPAL_TO_LOCAL_PLUGIN); if (ptol_klassName == null) { LOG.warn("No principal to local given {}", Config.STORM_PRINCIPAL_TO_LOCAL_PLUGIN); } else { ptol = ReflectionUtils.newInstance(ptol_klassName); //TODO this can only ever be null if someone is doing something odd with mocking // We should really fix the mocking and remove this if (ptol != null) { ptol.prepare(topoConf); } } } catch (Exception e) { throw new RuntimeException(e); } return ptol; }
/** * Construct a principal to local plugin * @param storm_conf storm configuration * @return the plugin */ public static IPrincipalToLocal GetPrincipalToLocalPlugin(Map storm_conf) { IPrincipalToLocal ptol; try { String ptol_klassName = (String) storm_conf.get(Config.STORM_PRINCIPAL_TO_LOCAL_PLUGIN); Class klass = Class.forName(ptol_klassName); ptol = (IPrincipalToLocal)klass.newInstance(); ptol.prepare(storm_conf); } catch (Exception e) { throw new RuntimeException(e); } return ptol; }