Java Code Examples for org.apache.ignite.configuration.CacheConfiguration#getGroupName()

The following examples show how to use org.apache.ignite.configuration.CacheConfiguration#getGroupName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GridCacheSqlDdlClusterReadOnlyModeTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/** */
private static List<String> generateCreateTableDDL() {
    List<String> ddls = new ArrayList<>();

    for (CacheConfiguration cfg : cacheConfigurations()) {
        SB sb = new SB("CREATE TABLE ");

        sb.a(tableName(cfg.getName()));
        sb.a(" (id int, city_id int, age int, PRIMARY KEY (id)) WITH \"");
        sb.a("backups=").a(cfg.getBackups()).a(",");
        sb.a("CACHE_NAME=").a(cfg.getName()).a(",");

        if (cfg.getGroupName() != null)
            sb.a("CACHE_GROUP=").a(cfg.getGroupName()).a(",");

        sb.a("ATOMICITY=").a(cfg.getAtomicityMode()).a(",");
        sb.a("TEMPLATE=").a(cfg.getCacheMode());
        sb.a("\"");

        ddls.add(sb.toString());
    }
    return ddls;
}
 
Example 2
Source File: JdbcThinWalModeChangeSelfTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override protected void createCache(Ignite node, CacheConfiguration ccfg) throws IgniteCheckedException {
    String template = ccfg.getCacheMode() == CacheMode.PARTITIONED ?
        QueryUtils.TEMPLATE_PARTITIONED : QueryUtils.TEMPLATE_REPLICATED;

    String cmd = "CREATE TABLE IF NOT EXISTS " + ccfg.getName() + " (k BIGINT PRIMARY KEY, v BIGINT) WITH \"" +
        "TEMPLATE=" + template + ", " +
        "CACHE_NAME=" + ccfg.getName() + ", " +
        "ATOMICITY=" + ccfg.getAtomicityMode() +
        (ccfg.getGroupName() != null ? ", CACHE_GROUP=" + ccfg.getGroupName() : "") +
        (ccfg.getDataRegionName() != null ? ", DATA_REGION=" + ccfg.getDataRegionName() : "") +
        "\"";

    execute(node, cmd);

    alignCacheTopologyVersion(node);
}
 
Example 3
Source File: GridCacheUtils.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * @param cfg1 Existing configuration.
 * @param cfg2 Cache configuration to start.
 * @param attrName Short attribute name for error message.
 * @param attrMsg Full attribute name for error message.
 * @param val1 Attribute value in existing configuration.
 * @param val2 Attribute value in starting configuration.
 * @param fail If true throws IgniteCheckedException in case of attribute values mismatch, otherwise logs warning.
 * @throws IgniteCheckedException If validation failed.
 */
public static void validateCacheGroupsAttributesMismatch(IgniteLogger log,
    CacheConfiguration cfg1,
    CacheConfiguration cfg2,
    String attrName,
    String attrMsg,
    Object val1,
    Object val2,
    boolean fail) throws IgniteCheckedException {
    if (F.eq(val1, val2))
        return;

    if (fail) {
        throw new IgniteCheckedException(attrMsg + " mismatch for caches related to the same group " +
            "[groupName=" + cfg1.getGroupName() +
            ", existingCache=" + cfg1.getName() +
            ", existing" + capitalize(attrName) + "=" + val1 +
            ", startingCache=" + cfg2.getName() +
            ", starting" + capitalize(attrName) + "=" + val2 + ']');
    }
    else {
        U.warn(log, attrMsg + " mismatch for caches related to the same group " +
            "[groupName=" + cfg1.getGroupName() +
            ", existingCache=" + cfg1.getName() +
            ", existing" + capitalize(attrName) + "=" + val1 +
            ", startingCache=" + cfg2.getName() +
            ", starting" + capitalize(attrName) + "=" + val2 + ']');
    }
}
 
Example 4
Source File: FilePageStoreManager.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * @param ccfg Cache configuration.
 * @return Cache configuration file with respect to {@link CacheConfiguration#getGroupName} value.
 */
private File cacheConfigurationFile(CacheConfiguration<?, ?> ccfg) {
    File cacheWorkDir = cacheWorkDir(ccfg);

    return ccfg.getGroupName() == null ? new File(cacheWorkDir, CACHE_DATA_FILENAME) :
        new File(cacheWorkDir, ccfg.getName() + CACHE_DATA_FILENAME);
}
 
Example 5
Source File: CacheGroupContext.java    From ignite with Apache License 2.0 4 votes vote down vote up
/**
 * @return Group name if it is specified, otherwise cache name.
 */
public static String cacheOrGroupName(CacheConfiguration<?, ?> ccfg) {
    return ccfg.getGroupName() != null ? ccfg.getGroupName() : ccfg.getName();
}
 
Example 6
Source File: FilePageStoreManager.java    From ignite with Apache License 2.0 4 votes vote down vote up
/**
 * @param ccfg Cache configuration.
 * @return The full cache directory name.
 */
public static String cacheDirName(CacheConfiguration<?, ?> ccfg) {
    boolean isSharedGrp = ccfg.getGroupName() != null;

    return cacheDirName(isSharedGrp, isSharedGrp ? ccfg.getGroupName() : ccfg.getName());
}
 
Example 7
Source File: VisorCacheConfiguration.java    From ignite with Apache License 2.0 4 votes vote down vote up
/**
 * Create data transfer object for cache configuration properties.
 *
 * @param ignite Grid.
 * @param ccfg Cache configuration.
 * @param dynamicDeploymentId Dynamic deployment ID.
 */
public VisorCacheConfiguration(IgniteEx ignite, CacheConfiguration ccfg, IgniteUuid dynamicDeploymentId) {
    name = ccfg.getName();
    grpName = ccfg.getGroupName();
    this.dynamicDeploymentId = dynamicDeploymentId;
    mode = ccfg.getCacheMode();
    atomicityMode = ccfg.getAtomicityMode();
    eagerTtl = ccfg.isEagerTtl();
    writeSynchronizationMode = ccfg.getWriteSynchronizationMode();
    invalidate = ccfg.isInvalidate();
    maxConcurrentAsyncOps = ccfg.getMaxConcurrentAsyncOperations();
    interceptor = compactClass(ccfg.getInterceptor());
    dfltLockTimeout = ccfg.getDefaultLockTimeout();
    qryEntities = VisorQueryEntity.list(ccfg.getQueryEntities());
    jdbcTypes = VisorCacheJdbcType.list(ccfg.getCacheStoreFactory());
    statisticsEnabled = ccfg.isStatisticsEnabled();
    mgmtEnabled = ccfg.isManagementEnabled();
    ldrFactory = compactClass(ccfg.getCacheLoaderFactory());
    writerFactory = compactClass(ccfg.getCacheWriterFactory());
    expiryPlcFactory = compactClass(ccfg.getExpiryPolicyFactory());

    sys = ignite.context().cache().systemCache(ccfg.getName());
    storeKeepBinary = ccfg.isStoreKeepBinary();
    onheapCache = ccfg.isOnheapCacheEnabled();
    partLossPlc = ccfg.getPartitionLossPolicy();
    qryParallelism = ccfg.getQueryParallelism();

    affinityCfg = new VisorCacheAffinityConfiguration(ccfg);
    rebalanceCfg = new VisorCacheRebalanceConfiguration(ccfg);
    evictCfg = new VisorCacheEvictionConfiguration(ccfg);
    nearCfg = new VisorCacheNearConfiguration(ccfg);

    storeCfg = new VisorCacheStoreConfiguration(ignite, ccfg);

    qryCfg = new VisorQueryConfiguration(ccfg);

    cpOnRead = ccfg.isCopyOnRead();
    evictFilter = compactClass(ccfg.getEvictionFilter());
    lsnrConfigurations = compactIterable(ccfg.getCacheEntryListenerConfigurations());
    loadPrevVal = ccfg.isLoadPreviousValue();
    dataRegName = ccfg.getDataRegionName();
    sqlIdxMaxInlineSize = ccfg.getSqlIndexMaxInlineSize();
    nodeFilter = compactClass(ccfg.getNodeFilter());
    qryDetailMetricsSz = ccfg.getQueryDetailMetricsSize();
    readFromBackup = ccfg.isReadFromBackup();
    tmLookupClsName = ccfg.getTransactionManagerLookupClassName();
    topValidator = compactClass(ccfg.getTopologyValidator());

    diskPageCompression = ccfg.getDiskPageCompression();
    diskPageCompressionLevel = ccfg.getDiskPageCompressionLevel();
}