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


Java IgniteConfiguration.getCacheConfiguration方法代码示例

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


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

示例1: getConfiguration

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的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: readCacheConfigurations

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
 * Reads cache configurations from a stream and updates provided IgniteConfiguration.
 *
 * @param cfg IgniteConfiguration to update.
 * @param in Reader.
 */
private static void readCacheConfigurations(BinaryRawReaderEx in, IgniteConfiguration cfg) {
    int len = in.readInt();

    if (len == 0)
        return;

    List<CacheConfiguration> caches = new ArrayList<>();

    for (int i = 0; i < len; i++)
        caches.add(readCacheConfiguration(in));

    CacheConfiguration[] oldCaches = cfg.getCacheConfiguration();
    CacheConfiguration[] caches0 = caches.toArray(new CacheConfiguration[caches.size()]);

    if (oldCaches == null)
        cfg.setCacheConfiguration(caches0);
    else {
        CacheConfiguration[] mergedCaches = new CacheConfiguration[oldCaches.length + caches.size()];

        System.arraycopy(oldCaches, 0, mergedCaches, 0, oldCaches.length);
        System.arraycopy(caches0, 0, mergedCaches, oldCaches.length, caches.size());

        cfg.setCacheConfiguration(mergedCaches);
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:32,代码来源:PlatformConfigurationUtils.java

示例3: cachePluginConfigurations

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
 * @param cfg Config.
 * @param cls Class.
 * @return Not <code>null</code> list.
 */
public static <T extends CachePluginConfiguration> List<T> cachePluginConfigurations(IgniteConfiguration cfg,
    Class<T> cls) {
    List<T> res = new ArrayList<>();

    if (cfg.getCacheConfiguration() != null) {
        for (CacheConfiguration ccfg : cfg.getCacheConfiguration()) {
            for (CachePluginConfiguration pluginCcfg : ccfg.getPluginConfigurations()) {
                if (cls == pluginCcfg.getClass())
                    res.add((T)pluginCcfg);
            }
        }
    }

    return res;
}
 
开发者ID:apache,项目名称:ignite,代码行数:21,代码来源:GridCacheUtils.java

示例4: getConfiguration

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    if (getTestIgniteInstanceName(0).equals(igniteInstanceName)) {
        cfg.setClientMode(true);

        cfg.setCacheConfiguration();
    }

    if (getTestIgniteInstanceName(10).equals(igniteInstanceName)) {
        CacheConfiguration cc = cfg.getCacheConfiguration()[0];
        cc.setRebalanceDelay(-1);
    }

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

示例5: clusterConfiguration

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
 * @param cfgs Configurations.
 * @return Test builder.
 * @throws Exception If failed.
 */
public JoinNodeTestPlanBuilder clusterConfiguration(IgniteConfiguration... cfgs) throws Exception {
    clusterCfg = cfgs;

    strPlanBuilder.append("Start cluster:\n");

    for (IgniteConfiguration cfg : cfgs) {
        strPlanBuilder.append("node: ")
            .append(cfg.getIgniteInstanceName())
            .append(" activeOnStart - ")
            .append(cfg.isActiveOnStart())
            .append("\n");

        CacheConfiguration[] ccfgs = cfg.getCacheConfiguration();

        if (ccfgs != null) {
            for (CacheConfiguration ccfg : ccfgs)
                strPlanBuilder.append("  cache - ")
                    .append(ccfg.getName())
                    .append("\n");
        }
    }

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

示例6: nodeConfiguration

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
 * @param cfg Configuration.
 * @return Test builder.
 */
public JoinNodeTestPlanBuilder nodeConfiguration(IgniteConfiguration cfg) {
    nodeCfg = cfg;

    strPlanBuilder.append("Join node:\n")
        .append(cfg.getIgniteInstanceName())
        .append(cfg.isClientMode() != null && cfg.isClientMode() ? " (client)" : "")
        .append(" activeOnStart - ")
        .append(cfg.isActiveOnStart())
        .append("\n");

    CacheConfiguration[] ccfgs = cfg.getCacheConfiguration();

    if (ccfgs != null)
        for (CacheConfiguration ccfg : ccfgs)
            strPlanBuilder.append("  cache - ").append(ccfg.getName()).append("\n");

    return this;
}
 
开发者ID:apache,项目名称:ignite,代码行数:23,代码来源:AbstractNodeJoinTemplate.java

示例7: getConfiguration

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = loadConfiguration("modules/core/src/test/config/spring-multicache.xml");

    cfg.setIgniteInstanceName(igniteInstanceName);

    for (CacheConfiguration cCfg : cfg.getCacheConfiguration()) {
        if (cCfg.getCacheMode() == CacheMode.PARTITIONED) {
            cCfg.setAffinity(new RendezvousAffinityFunction(2048, null));
            cCfg.setBackups(1);
        }
    }

    ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);

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

示例8: configure

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected void configure(IgniteConfiguration cfg) {
    super.configure(cfg);

    for (CacheConfiguration ccfg : cfg.getCacheConfiguration()) {
        AffinityFunction aff = ccfg.getAffinity();

        int parts = aff != null ? aff.partitions() : RendezvousAffinityFunction.DFLT_PARTITION_COUNT;

        ccfg.setGroupName("testGroup-parts" + parts);
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:13,代码来源:IgnitePdsSingleNodeWithIndexingAndGroupPutGetPersistenceSelfTest.java

示例9: getConfiguration

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    if (cfg.getCacheConfiguration().length > 0)
        cfg.getCacheConfiguration()[0].setIndexedTypes(TestKey.class, String.class);

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

示例10: affinityFunctions

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
 * Find .NET affinity functions in configuration.
 *
 * @param cfg Configuration.
 * @return affinity functions.
 */
private static List<PlatformDotNetAffinityFunction> affinityFunctions(IgniteConfiguration cfg) {
    List<PlatformDotNetAffinityFunction> res = new ArrayList<>();

    CacheConfiguration[] cacheCfg = cfg.getCacheConfiguration();

    if (cacheCfg != null) {
        for (CacheConfiguration ccfg : cacheCfg) {
            if (ccfg.getAffinity() instanceof PlatformDotNetAffinityFunction)
                res.add((PlatformDotNetAffinityFunction)ccfg.getAffinity());
        }
    }

    return res;
}
 
开发者ID:apache,项目名称:ignite,代码行数:21,代码来源:PlatformDotNetConfigurationClosure.java

示例11: cacheConfiguration

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
 * @param cfg Configuration.
 * @param cacheName Cache name.
 * @return Cache configuration.
 */
protected CacheConfiguration cacheConfiguration(IgniteConfiguration cfg, String cacheName) {
    for (CacheConfiguration ccfg : cfg.getCacheConfiguration()) {
        if (F.eq(cacheName, ccfg.getName()))
            return ccfg;
    }

    fail("Failed to find cache configuration for cache: " + cacheName);

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

示例12: getConfiguration

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration iCfg = super.getConfiguration(igniteInstanceName);

    for (CacheConfiguration cacheCfg : iCfg.getCacheConfiguration())
        cacheCfg.setRebalanceMode(CacheRebalanceMode.ASYNC);

    return iCfg;
}
 
开发者ID:apache,项目名称:ignite,代码行数:10,代码来源:GridCacheRebalancingAsyncSelfTest.java

示例13: commonConfiguration

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration commonConfiguration(int idx) throws Exception {
    IgniteConfiguration cfg = super.commonConfiguration(idx);

    if (idx != nodeIndex())
        return cfg;

    CacheConfiguration staticCacheCfg = cacheConfiguration().setName(STATIC_CACHE_NAME);

    ((QueryEntity)staticCacheCfg.getQueryEntities().iterator().next()).setIndexes(Collections.singletonList(index(
        IDX_NAME_1, field(FIELD_NAME_1)
    )));

    CacheConfiguration[] newCfgs = new CacheConfiguration[F.isEmpty(cfg.getCacheConfiguration()) ? 1 :
        cfg.getCacheConfiguration().length + 1];

    if (newCfgs.length > 1)
        System.arraycopy(cfg.getCacheConfiguration(), 0, newCfgs, 0, newCfgs.length - 1);

    newCfgs[newCfgs.length - 1] = staticCacheCfg;

    cfg.setCacheConfiguration(newCfgs);

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

示例14: getBinaryConfiguration

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
 * @param igniteInstanceName Ignite instance name.
 * @return Grid configuration used for starting the grid ready for manipulating binary objects.
 * @throws Exception If failed.
 */
IgniteConfiguration getBinaryConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = getConfiguration0(igniteInstanceName);

    cfg.setMarshaller(new BinaryMarshaller());

    CacheConfiguration ccfg = cfg.getCacheConfiguration()[0];

    ccfg.getQueryEntities().clear();

    QueryEntity e = new QueryEntity();

    e.setKeyType(String.class.getName());
    e.setValueType("Person");

    e.addQueryField("id", Integer.class.getName(), null);
    e.addQueryField("age", Integer.class.getName(), null);
    e.addQueryField("firstName", String.class.getName(), null);
    e.addQueryField("lastName", String.class.getName(), null);

    ccfg.setQueryEntities(Collections.singletonList(e));

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

示例15: prepareConfiguration

import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
 * Prepares configuration for warmup.
 *
 * @param gridCfg Original grid configuration.
 * @return Prepared configuration or {@code null} if no caches found.
 */
private IgniteConfiguration prepareConfiguration(IgniteConfiguration gridCfg) {
    if (F.isEmpty(gridCfg.getCacheConfiguration()))
        return null;

    IgniteConfiguration cp = new IgniteConfiguration();

    cp.setConnectorConfiguration(null);

    Collection<CacheConfiguration> reduced = new ArrayList<>();

    for (CacheConfiguration ccfg : gridCfg.getCacheConfiguration()) {
        if (CU.isSystemCache(ccfg.getName()))
            continue;

        if (!matches(reduced, ccfg)) {
            CacheConfiguration ccfgCp = new CacheConfiguration(ccfg);

            ccfgCp.setCacheStoreFactory(null);
            ccfgCp.setWriteBehindEnabled(false);

            reduced.add(ccfgCp);
        }
    }

    if (F.isEmpty(reduced))
        return null;

    CacheConfiguration[] res = new CacheConfiguration[reduced.size()];

    reduced.toArray(res);

    cp.setCacheConfiguration(res);

    return cp;
}
 
开发者ID:apache,项目名称:ignite,代码行数:42,代码来源:BasicWarmupClosure.java


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