/** * Loads all grid configurations specified within given Spring XML configuration file. * <p> * Usually Spring XML configuration file will contain only one Grid definition. Note that * Grid configuration bean(s) is retrieved form configuration file by type, so the name of * the Grid configuration bean is ignored. * * @param springCfgPath Spring XML configuration file path. This cannot be {@code null}. * @return Tuple containing all loaded configurations and Spring context used to load them. * @throws IgniteCheckedException If grid could not be started or configuration * read. This exception will be thrown also if grid with given name has already * been started or Spring XML configuration file is invalid. */ public static IgniteBiTuple<Collection<IgniteConfiguration>, ? extends GridSpringResourceContext> loadConfigurations(String springCfgPath) throws IgniteCheckedException { A.notNull(springCfgPath, "springCfgPath"); return loadConfigurations(IgniteUtils.resolveSpringUrl(springCfgPath)); }
IgnitionEx.loadConfigurations(cfgUrl);
/** * Loads first found grid configuration specified within given Spring XML configuration file. * <p> * Usually Spring XML configuration file will contain only one Grid definition. Note that * Grid configuration bean(s) is retrieved form configuration file by type, so the name of * the Grid configuration bean is ignored. * * @param springCfgUrl Spring XML configuration file path or URL. This cannot be {@code null}. * @return First found configuration and Spring context used to load it. * @throws IgniteCheckedException If grid could not be started or configuration * read. This exception will be thrown also if grid with given name has already * been started or Spring XML configuration file is invalid. */ public static IgniteBiTuple<IgniteConfiguration, GridSpringResourceContext> loadConfiguration(URL springCfgUrl) throws IgniteCheckedException { IgniteBiTuple<Collection<IgniteConfiguration>, ? extends GridSpringResourceContext> t = loadConfigurations(springCfgUrl); return F.t(F.first(t.get1()), t.get2()); }
/** * Loads first found grid configuration specified within given Spring XML configuration file. * <p> * Usually Spring XML configuration file will contain only one Grid definition. Note that * Grid configuration bean(s) is retrieved form configuration file by type, so the name of * the Grid configuration bean is ignored. * * @param springCfgPath Spring XML configuration file path. This cannot be {@code null}. * @return First found configuration and Spring context used to load it. * @throws IgniteCheckedException If grid could not be started or configuration * read. This exception will be thrown also if grid with given name has already * been started or Spring XML configuration file is invalid. */ public static IgniteBiTuple<IgniteConfiguration, GridSpringResourceContext> loadConfiguration(String springCfgPath) throws IgniteCheckedException { IgniteBiTuple<Collection<IgniteConfiguration>, ? extends GridSpringResourceContext> t = loadConfigurations(springCfgPath); return F.t(F.first(t.get1()), t.get2()); }
cfgMap = loadConfigurations(springCfgUrl);
cfgMap = loadConfigurations(springCfgStream);
t = IgnitionEx.loadConfigurations(cfgUrl);
/** * @param cfgUrl Config URL. * @param jdbcName Appended to instance name or used as default. * @return Ignite config and Spring context. */ private IgniteBiTuple<IgniteConfiguration, ? extends GridSpringResourceContext> loadConfiguration(String cfgUrl, String jdbcName) { try { IgniteBiTuple<Collection<IgniteConfiguration>, ? extends GridSpringResourceContext> cfgMap = IgnitionEx.loadConfigurations(cfgUrl); IgniteConfiguration cfg = F.first(cfgMap.get1()); if (cfg.getIgniteInstanceName() == null) cfg.setIgniteInstanceName(jdbcName); else cfg.setIgniteInstanceName(cfg.getIgniteInstanceName() + "-" + jdbcName); cfg.setClientMode(true); // Force client mode. return new IgniteBiTuple<>(cfg, cfgMap.getValue()); } catch (IgniteCheckedException e) { throw new IgniteException(e); } }
/** * Starts new grid with given name. * * @param gridName Grid name. * @param client Client mode. * @param cfgUrl Config URL. * @return Started grid. * @throws Exception If failed. */ protected Ignite startGridWithSpringCtx(String gridName, boolean client, String cfgUrl) throws Exception { IgniteBiTuple<Collection<IgniteConfiguration>, ? extends GridSpringResourceContext> cfgMap = IgnitionEx.loadConfigurations(cfgUrl); IgniteConfiguration cfg = F.first(cfgMap.get1()); cfg.setIgniteInstanceName(gridName); cfg.setClientMode(client); return IgnitionEx.start(cfg, cfgMap.getValue()); }
private IgniteConfiguration loadConfiguration() { ClassLoader ctxClsLoader = Thread.currentThread().getContextClassLoader(); InputStream is = null; if (ctxClsLoader != null) { is = ctxClsLoader.getResourceAsStream(CONFIG_FILE); } if (is == null) { is = getClass().getClassLoader().getResourceAsStream(CONFIG_FILE); if (is == null) { is = getClass().getClassLoader().getResourceAsStream(DEFAULT_CONFIG_FILE); log.info("Using default configuration."); } } try { IgniteConfiguration cfg = F.first(IgnitionEx.loadConfigurations(is).get1()); setNodeID(cfg); return cfg; } catch (IgniteCheckedException e) { log.error("Configuration loading error:", e); throw new RuntimeException(e); } }
/** * Loads all grid configurations specified within given Spring XML configuration file. * <p> * Usually Spring XML configuration file will contain only one Grid definition. Note that * Grid configuration bean(s) is retrieved form configuration file by type, so the name of * the Grid configuration bean is ignored. * * @param springCfgPath Spring XML configuration file path. This cannot be {@code null}. * @return Tuple containing all loaded configurations and Spring context used to load them. * @throws IgniteCheckedException If grid could not be started or configuration * read. This exception will be thrown also if grid with given name has already * been started or Spring XML configuration file is invalid. */ public static IgniteBiTuple<Collection<IgniteConfiguration>, ? extends GridSpringResourceContext> loadConfigurations(String springCfgPath) throws IgniteCheckedException { A.notNull(springCfgPath, "springCfgPath"); return loadConfigurations(IgniteUtils.resolveSpringUrl(springCfgPath)); }
private IgniteConfiguration loadConfiguration() { ClassLoader ctxClsLoader = Thread.currentThread().getContextClassLoader(); InputStream is = null; if (ctxClsLoader != null) { is = ctxClsLoader.getResourceAsStream(CONFIG_FILE); } if (is == null) { is = getClass().getClassLoader().getResourceAsStream(CONFIG_FILE); if (is == null) { is = getClass().getClassLoader().getResourceAsStream(DEFAULT_CONFIG_FILE); log.info("Using default configuration."); } } try { IgniteConfiguration cfg = F.first(IgnitionEx.loadConfigurations(is).get1()); setNodeID(cfg); return cfg; } catch (IgniteCheckedException e) { log.error("Configuration loading error:", e); throw new RuntimeException(e); } }
private IgniteConfiguration loadConfiguration(URL config) { try { IgniteConfiguration cfg = F.first(IgnitionEx.loadConfigurations(config).get1()); setNodeID(cfg); return cfg; } catch (IgniteCheckedException e) { log.error("Configuration loading error:", e); throw new RuntimeException(e); } }
private IgniteConfiguration loadConfiguration(URL config) { try { IgniteConfiguration cfg = F.first(IgnitionEx.loadConfigurations(config).get1()); setNodeID(cfg); return cfg; } catch (IgniteCheckedException e) { log.error("Configuration loading error:", e); throw new RuntimeException(e); } }
IgnitionEx.loadConfigurations(cfgUrl);
/** * Loads first found grid configuration specified within given Spring XML configuration file. * <p> * Usually Spring XML configuration file will contain only one Grid definition. Note that * Grid configuration bean(s) is retrieved form configuration file by type, so the name of * the Grid configuration bean is ignored. * * @param springCfgUrl Spring XML configuration file path or URL. This cannot be {@code null}. * @return First found configuration and Spring context used to load it. * @throws IgniteCheckedException If grid could not be started or configuration * read. This exception will be thrown also if grid with given name has already * been started or Spring XML configuration file is invalid. */ public static IgniteBiTuple<IgniteConfiguration, GridSpringResourceContext> loadConfiguration(URL springCfgUrl) throws IgniteCheckedException { IgniteBiTuple<Collection<IgniteConfiguration>, ? extends GridSpringResourceContext> t = loadConfigurations(springCfgUrl); return F.t(F.first(t.get1()), t.get2()); }
/** * Loads first found grid configuration specified within given Spring XML configuration file. * <p> * Usually Spring XML configuration file will contain only one Grid definition. Note that * Grid configuration bean(s) is retrieved form configuration file by type, so the name of * the Grid configuration bean is ignored. * * @param springCfgPath Spring XML configuration file path. This cannot be {@code null}. * @return First found configuration and Spring context used to load it. * @throws IgniteCheckedException If grid could not be started or configuration * read. This exception will be thrown also if grid with given name has already * been started or Spring XML configuration file is invalid. */ public static IgniteBiTuple<IgniteConfiguration, GridSpringResourceContext> loadConfiguration(String springCfgPath) throws IgniteCheckedException { IgniteBiTuple<Collection<IgniteConfiguration>, ? extends GridSpringResourceContext> t = loadConfigurations(springCfgPath); return F.t(F.first(t.get1()), t.get2()); }
cfgMap = loadConfigurations(springCfgUrl);
cfgMap = loadConfigurations(springCfgStream);
/** * @param cfgUrl Config URL. * @param jdbcName Appended to instance name or used as default. * @return Ignite config and Spring context. */ private IgniteBiTuple<IgniteConfiguration, ? extends GridSpringResourceContext> loadConfiguration(String cfgUrl, String jdbcName) { try { IgniteBiTuple<Collection<IgniteConfiguration>, ? extends GridSpringResourceContext> cfgMap = IgnitionEx.loadConfigurations(cfgUrl); IgniteConfiguration cfg = F.first(cfgMap.get1()); if (cfg.getIgniteInstanceName() == null) cfg.setIgniteInstanceName(jdbcName); else cfg.setIgniteInstanceName(cfg.getIgniteInstanceName() + "-" + jdbcName); cfg.setClientMode(true); // Force client mode. return new IgniteBiTuple<>(cfg, cfgMap.getValue()); } catch (IgniteCheckedException e) { throw new IgniteException(e); } }