当前位置: 首页>>代码示例>>Java>>正文


Java U.resolveIgniteUrl方法代码示例

本文整理汇总了Java中org.apache.ignite.internal.util.typedef.internal.U.resolveIgniteUrl方法的典型用法代码示例。如果您正苦于以下问题:Java U.resolveIgniteUrl方法的具体用法?Java U.resolveIgniteUrl怎么用?Java U.resolveIgniteUrl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.ignite.internal.util.typedef.internal.U的用法示例。


在下文中一共展示了U.resolveIgniteUrl方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getConfiguration

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    String path = builtinKeys
        ? "modules/spring/src/test/config/jdbc-pojo-store-builtin.xml"
        : "modules/spring/src/test/config/jdbc-pojo-store-obj.xml";

    URL url = U.resolveIgniteUrl(path);

    IgniteSpringHelper spring = IgniteComponentType.SPRING.create(false);

    IgniteConfiguration cfg = spring.loadConfigurations(url).get1().iterator().next();

    if (sqlEscapeAll()) {
        for (CacheConfiguration ccfg : cfg.getCacheConfiguration())
            ((CacheJdbcPojoStoreFactory)ccfg.getCacheStoreFactory()).setSqlEscapeAll(true);
    }

    cfg.setIgniteInstanceName(igniteInstanceName);

    return cfg;
}
 
开发者ID:apache,项目名称:ignite,代码行数:22,代码来源:CachePojoStoreXmlSelfTest.java

示例2: Log4JLogger

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
 * Creates new logger with given configuration {@code path}.
 *
 * @param path Path to log4j configuration XML file.
 * @throws IgniteCheckedException Thrown in case logger can't be created.
 */
public Log4JLogger(final String path) throws IgniteCheckedException {
    if (path == null)
        throw new IgniteCheckedException("Configuration XML file for Log4j must be specified.");

    this.cfg = path;

    final URL cfgUrl = U.resolveIgniteUrl(path);

    if (cfgUrl == null)
        throw new IgniteCheckedException("Log4j configuration path was not found: " + path);

    addConsoleAppenderIfNeeded(null, new C1<Boolean, Logger>() {
        @Override public Logger apply(Boolean init) {
            if (init)
                DOMConfigurator.configure(cfgUrl);

            return Logger.getRootLogger();
        }
    });

    quiet = quiet0;
}
 
开发者ID:apache,项目名称:ignite,代码行数:29,代码来源:Log4JLogger.java

示例3: Log4J2Logger

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
 * Creates new logger with given configuration {@code path}.
 *
 * @param path Path to log4j2 configuration XML file.
 * @throws IgniteCheckedException Thrown in case logger can't be created.
 */
public Log4J2Logger(String path) throws IgniteCheckedException {
    if (path == null)
        throw new IgniteCheckedException("Configuration XML file for Log4j2 must be specified.");

    final URL cfgUrl = U.resolveIgniteUrl(path);

    if (cfgUrl == null)
        throw new IgniteCheckedException("Log4j2 configuration path was not found: " + path);

    addConsoleAppenderIfNeeded(new C1<Boolean, Logger>() {
        @Override public Logger apply(Boolean init) {
            if (init)
                Configurator.initialize(LogManager.ROOT_LOGGER_NAME, cfgUrl.toString());

            return (Logger)LogManager.getRootLogger();
        }
    });

    quiet = quiet0;
    cfg = path;
}
 
开发者ID:apache,项目名称:ignite,代码行数:28,代码来源:Log4J2Logger.java

示例4: run

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected VisorEither<VisorFileBlock> run(VisorFileBlockTaskArg arg) {
    try {
        URL url = U.resolveIgniteUrl(arg.getPath());

        if (url == null)
            return new VisorEither<>(new NoSuchFileException("File path not found: " + arg.getPath()));

        VisorFileBlock block = readBlock(
            new File(url.toURI()), arg.getOffset(), arg.getBlockSize(), arg.getLastModified());

        return new VisorEither<>(block);
    }
    catch (IOException e) {
        return new VisorEither<>(e);
    }
    catch (URISyntaxException ignored) {
        return new VisorEither<>(new NoSuchFileException("File path not found: " + arg.getPath()));
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:21,代码来源:VisorFileBlockTask.java

示例5: resolveSpringUrl

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
 * Resolve Spring configuration URL.
 *
 * @param springCfgPath Spring XML configuration file path or URL. This cannot be {@code null}.
 * @return URL.
 * @throws IgniteCheckedException If failed.
 */
public static URL resolveSpringUrl(String springCfgPath) throws IgniteCheckedException {
    A.notNull(springCfgPath, "springCfgPath");

    URL url;

    try {
        url = new URL(springCfgPath);
    }
    catch (MalformedURLException e) {
        url = U.resolveIgniteUrl(springCfgPath);

        if (url == null)
            url = resolveInClasspath(springCfgPath);

        if (url == null)
            throw new IgniteCheckedException("Spring XML configuration path is invalid: " + springCfgPath +
                ". Note that this path should be either absolute or a relative local file system path, " +
                "relative to META-INF in classpath or valid URL to IGNITE_HOME.", e);
    }

    return url;
}
 
开发者ID:apache,项目名称:ignite,代码行数:30,代码来源:IgniteUtils.java

示例6: defaultConfiguration

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
 * Reads default JUL configuration.
 */
private void defaultConfiguration() {
    final URL cfgUrl = U.resolveIgniteUrl(DFLT_CONFIG_PATH);

    if (cfgUrl == null) {
        error("Failed to resolve default logging config file: " + DFLT_CONFIG_PATH);

        return;
    }

    try (InputStream in = cfgUrl.openStream()) {
        LogManager.getLogManager().readConfiguration(in);
    }
    catch (IOException e) {
        error("Failed to read logging configuration: " + cfgUrl, e);
    }

    cfg = cfgUrl.getPath();
}
 
开发者ID:apache,项目名称:ignite,代码行数:22,代码来源:JavaLogger.java

示例7: GridTestLog4jLogger

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
 * Creates new logger with given configuration {@code path}.
 *
 * @param path Path to log4j configuration XML file.
 * @throws IgniteCheckedException Thrown in case logger can't be created.
 */
public GridTestLog4jLogger(String path) throws IgniteCheckedException {
    if (path == null)
        throw new IgniteCheckedException("Configuration XML file for Log4j must be specified.");

    this.cfg = path;

    final URL cfgUrl = U.resolveIgniteUrl(path);

    if (cfgUrl == null)
        throw new IgniteCheckedException("Log4j configuration path was not found: " + path);

    addConsoleAppenderIfNeeded(null, new C1<Boolean, Logger>() {
        @Override public Logger apply(Boolean init) {
            if (init)
                DOMConfigurator.configure(cfgUrl);

            return Logger.getRootLogger();
        }
    });

    quiet = quiet0;
}
 
开发者ID:apache,项目名称:ignite,代码行数:29,代码来源:GridTestLog4jLogger.java

示例8: doTest

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
 * @throws Exception If failed.
 */
private void doTest() throws Exception {
    final GridUriDeploymentClassLoader ldr = new GridUriDeploymentClassLoader(
        new URL[] { U.resolveIgniteUrl(GridTestProperties.getProperty("ant.urideployment.gar.file")) },
            getClass().getClassLoader());

    multithreaded(
        new Callable<Object>() {
            @Nullable @Override public Object call() throws Exception {
                ldr.loadClass("org.apache.ignite.spi.deployment.uri.tasks.GridUriDeploymentTestTask0");

                return null;
            }
        },
        500
    );

    final GridUriDeploymentClassLoader ldr0 = new GridUriDeploymentClassLoader(
        new URL[] { U.resolveIgniteUrl(GridTestProperties.getProperty("ant.urideployment.gar.file")) },
        getClass().getClassLoader());

    multithreaded(
        new Callable<Object>() {
            @Nullable @Override public Object call() throws Exception {
                ldr0.loadClassGarOnly("org.apache.ignite.spi.deployment.uri.tasks.GridUriDeploymentTestTask0");

                return null;
            }
        },
        500
    );
}
 
开发者ID:apache,项目名称:ignite,代码行数:35,代码来源:GridUriDeploymentClassLoaderMultiThreadedSelfTest.java

示例9: resolveIgfsProfilerLogsDir

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
 * Resolve IGFS profiler logs directory.
 *
 * @param igfs IGFS instance to resolve logs dir for.
 * @return {@link Path} to log dir or {@code null} if not found.
 * @throws IgniteCheckedException if failed to resolve.
 */
public static Path resolveIgfsProfilerLogsDir(IgniteFileSystem igfs) throws IgniteCheckedException {
    String logsDir;

    if (igfs instanceof IgfsEx)
        logsDir = ((IgfsEx)igfs).clientLogDirectory();
    else if (igfs == null)
        throw new IgniteCheckedException("Failed to get profiler log folder (IGFS instance not found)");
    else
        throw new IgniteCheckedException("Failed to get profiler log folder (unexpected IGFS instance type)");

    URL logsDirUrl = U.resolveIgniteUrl(logsDir != null ? logsDir : DFLT_IGFS_LOG_DIR);

    return logsDirUrl != null ? new File(logsDirUrl.getPath()).toPath() : null;
}
 
开发者ID:apache,项目名称:ignite,代码行数:22,代码来源:VisorTaskUtils.java

示例10: beforeTestsStarted

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected void beforeTestsStarted() throws Exception {
    store = store();

    URL cfgUrl;

    try {
        cfgUrl = new URL(DFLT_MAPPING_CONFIG);
    }
    catch (MalformedURLException ignore) {
        cfgUrl = U.resolveIgniteUrl(DFLT_MAPPING_CONFIG);
    }

    if (cfgUrl == null)
        throw new Exception("Failed to resolve metadata path: " + DFLT_MAPPING_CONFIG);

    try {
        GenericApplicationContext springCtx = new GenericApplicationContext();

        new XmlBeanDefinitionReader(springCtx).loadBeanDefinitions(new UrlResource(cfgUrl));

        springCtx.refresh();

        Collection<JdbcType> types = new ArrayList<>(springCtx.getBeansOfType(JdbcType.class).values());

        store.setTypes(types.toArray(new JdbcType[types.size()]));
    }
    catch (BeansException e) {
        if (X.hasCause(e, ClassNotFoundException.class))
            throw new IgniteCheckedException("Failed to instantiate Spring XML application context " +
                "(make sure all classes used in Spring configuration are present at CLASSPATH) " +
                "[springUrl=" + cfgUrl + ']', e);
        else
            throw new IgniteCheckedException("Failed to instantiate Spring XML application context [springUrl=" +
                cfgUrl + ", err=" + e.getMessage() + ']', e);
    }

}
 
开发者ID:apache,项目名称:ignite,代码行数:39,代码来源:CacheJdbcStoreAbstractMultithreadedSelfTest.java

示例11: start

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public void start() throws IgniteException {
    BasicHadoopFileSystemFactory proxy0 = (BasicHadoopFileSystemFactory)proxy;

    cfg = HadoopUtils.safeCreateConfiguration();

    if (proxy0.getConfigPaths() != null) {
        for (String cfgPath : proxy0.getConfigPaths()) {
            if (cfgPath == null)
                throw new NullPointerException("Configuration path cannot be null: " +
                    Arrays.toString(proxy0.getConfigPaths()));
            else {
                URL url = U.resolveIgniteUrl(cfgPath);

                if (url == null) {
                    // If secConfPath is given, it should be resolvable:
                    throw new IgniteException("Failed to resolve secondary file system configuration path " +
                        "(ensure that it exists locally and you have read access to it): " + cfgPath);
                }

                cfg.addResource(url);
            }
        }
    }

    // If secondary fs URI is not given explicitly, try to get it from the configuration:
    if (proxy0.getUri() == null)
        fullUri = FileSystem.getDefaultUri(cfg);
    else {
        try {
            fullUri = new URI(proxy0.getUri());
        }
        catch (URISyntaxException ignored) {
            throw new IgniteException("Failed to resolve secondary file system URI: " + proxy0.getUri());
        }
    }

    String strWorkDir = fullUri.getPath();

    if (!"/".equals(strWorkDir))
        workDir = new Path(strWorkDir);

    usrNameMapper = proxy0.getUserNameMapper();

    if (usrNameMapper != null && usrNameMapper instanceof LifecycleAware)
        ((LifecycleAware)usrNameMapper).start();
}
 
开发者ID:apache,项目名称:ignite,代码行数:48,代码来源:HadoopBasicFileSystemFactoryDelegate.java

示例12: main

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
 * Wrapper method to run router from command-line.
 *
 * @param args Command-line arguments.
 * @throws IgniteCheckedException If failed.
 */
public static void main(String[] args) throws IgniteCheckedException {
    X.println(
        "   __________  ________________ ",
        "  /  _/ ___/ |/ /  _/_  __/ __/ ",
        " _/ // (_ /    // /  / / / _/   ",
        "/___/\\___/_/|_/___/ /_/ /___/  ",
        " ",
        "Ignite Router Command Line Loader",
        "ver. " + ACK_VER_STR,
        COPYRIGHT,
        " "
    );

    IgniteSpringHelper spring = SPRING.create(false);

    if (args.length < 1) {
        X.error("Missing XML configuration path.");

        System.exit(1);
    }

    String cfgPath = args[0];

    URL cfgUrl = U.resolveIgniteUrl(cfgPath);

    if (cfgUrl == null) {
        X.error("Spring XML file not found (is IGNITE_HOME set?): " + cfgPath);

        System.exit(1);
    }

    boolean isLog4jUsed = U.gridClassLoader().getResource("org/apache/log4j/Appender.class") != null;

    IgniteBiTuple<Object, Object> t = null;
    Collection<Handler> savedHnds = null;

    if (isLog4jUsed) {
        try {
            t = U.addLog4jNoOpLogger();
        }
        catch (Exception ignored) {
            isLog4jUsed = false;
        }
    }

    if (!isLog4jUsed)
        savedHnds = U.addJavaNoOpLogger();

    Map<Class<?>, Object> beans;

    try {
        beans = spring.loadBeans(cfgUrl, IgniteLogger.class, GridTcpRouterConfiguration.class);
    }
    finally {
        if (isLog4jUsed && t != null)
            U.removeLog4jNoOpLogger(t);

        if (!isLog4jUsed)
            U.removeJavaNoOpLogger(savedHnds);
    }

    final GridRouterCommandLineStartup routerStartup = new GridRouterCommandLineStartup();

    routerStartup.start(beans);

    Runtime.getRuntime().addShutdownHook(new Thread() {
        @Override public void run() {
            routerStartup.stop();
        }
    });
}
 
开发者ID:apache,项目名称:ignite,代码行数:78,代码来源:GridRouterCommandLineStartup.java

示例13: getConfig

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
 * Load grid configuration for specified node type.
 *
 * @param type Node type to load configuration for.
 * @return Grid configuration for specified node type.
 */
static IgniteConfiguration getConfig(String type) {
    String path = NODE_CFG.get(type);

    if (path == null)
        throw new IllegalArgumentException("Unsupported node type: " + type);

    URL url = U.resolveIgniteUrl(path);

    BeanFactory ctx = new FileSystemXmlApplicationContext(url.toString());

    return (IgniteConfiguration)ctx.getBean("grid.cfg");
}
 
开发者ID:apache,项目名称:ignite,代码行数:19,代码来源:ClientStartNodeTask.java

示例14: start

import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
 * Starts grid with default configuration. By default this method will
 * use grid configuration defined in {@code IGNITE_HOME/config/default-config.xml}
 * configuration file. If such file is not found, then all system defaults will be used.
 *
 * @param springCtx Optional Spring application context, possibly {@code null}.
 *      Spring bean definitions for bean injection are taken from this context.
 *      If provided, this context can be injected into grid tasks and grid jobs using
 *      {@link SpringApplicationContextResource @SpringApplicationContextResource} annotation.
 * @return Started grid.
 * @throws IgniteCheckedException If default grid could not be started. This exception will be thrown
 *      also if default grid has already been started.
 */
public static Ignite start(@Nullable GridSpringResourceContext springCtx) throws IgniteCheckedException {
    URL url = U.resolveIgniteUrl(DFLT_CFG);

    if (url != null)
        return start(DFLT_CFG, null, springCtx, null);

    U.warn(null, "Default Spring XML file not found (is IGNITE_HOME set?): " + DFLT_CFG);

    return start0(new GridStartContext(new IgniteConfiguration(), null, springCtx), true)
        .get1().grid();
}
 
开发者ID:apache,项目名称:ignite,代码行数:25,代码来源:IgnitionEx.java


注:本文中的org.apache.ignite.internal.util.typedef.internal.U.resolveIgniteUrl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。