Java Code Examples for org.apache.ignite.configuration.IgniteConfiguration#setEncryptionSpi()

The following examples show how to use org.apache.ignite.configuration.IgniteConfiguration#setEncryptionSpi() . 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: DiskPageCompressionConfigValidationTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    KeystoreEncryptionSpi encSpi = new KeystoreEncryptionSpi();

    encSpi.setKeyStorePath(KEYSTORE_PATH);
    encSpi.setKeyStorePassword(KEYSTORE_PASSWORD.toCharArray());

    cfg.setEncryptionSpi(encSpi);

    DataStorageConfiguration dsCfg = new DataStorageConfiguration()
        .setDefaultDataRegionConfiguration(
            new DataRegionConfiguration()
                .setMaxSize(10L * 1024 * 1024)
                .setPersistenceEnabled(true))
        .setPageSize(MAX_PAGE_SIZE)
        .setWalMode(FSYNC);

    cfg.setDataStorageConfiguration(dsCfg);

    if (ccfg != null)
        cfg.setCacheConfiguration(ccfg);

    return cfg;
}
 
Example 2
Source File: IgnitePageMemReplaceDelayedWriteUnitTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/**
 * @param overallSize default region size in bytes
 * @return configuration for test.
 */
@NotNull private IgniteConfiguration getConfiguration(long overallSize) {
    IgniteConfiguration cfg = new IgniteConfiguration();

    cfg.setEncryptionSpi(new NoopEncryptionSpi());

    cfg.setMetricExporterSpi(new NoopMetricExporterSpi());

    cfg.setEventStorageSpi(new NoopEventStorageSpi());

    cfg.setDataStorageConfiguration(
        new DataStorageConfiguration()
            .setDefaultDataRegionConfiguration(
                new DataRegionConfiguration()
                    .setPersistenceEnabled(true)
                    .setMaxSize(overallSize)));

    return cfg;
}
 
Example 3
Source File: EncryptedCacheNodeJoinTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String grid) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(grid);

    cfg.setConsistentId(grid);

    if (grid.equals(GRID_0) ||
        grid.equals(GRID_2) ||
        grid.equals(GRID_3) ||
        grid.equals(GRID_4) ||
        grid.equals(GRID_5)) {
        KeystoreEncryptionSpi encSpi = new KeystoreEncryptionSpi();

        encSpi.setKeyStorePath(grid.equals(GRID_2) ? KEYSTORE_PATH_2 : KEYSTORE_PATH);
        encSpi.setKeyStorePassword(KEYSTORE_PASSWORD.toCharArray());

        cfg.setEncryptionSpi(encSpi);
    }
    else
        cfg.setEncryptionSpi(null);

    if (configureCache)
        cfg.setCacheConfiguration(cacheConfiguration(grid));

    return cfg;
}
 
Example 4
Source File: AbstractEncryptionTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String name) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(name);

    KeystoreEncryptionSpi encSpi = new KeystoreEncryptionSpi();

    encSpi.setKeyStorePath(keystorePath());
    encSpi.setKeyStorePassword(keystorePassword());

    cfg.setEncryptionSpi(encSpi);

    DataStorageConfiguration memCfg = new DataStorageConfiguration()
        .setDefaultDataRegionConfiguration(
            new DataRegionConfiguration()
                .setMaxSize(10L * 1024 * 1024)
                .setPersistenceEnabled(true))
        .setPageSize(4 * 1024)
        .setWalMode(FSYNC);

    cfg.setDataStorageConfiguration(memCfg);

    return cfg;
}
 
Example 5
Source File: WalRecoveryWithPageCompressionAndTdeTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);

    for (CacheConfiguration<?, ?> ccfg : cfg.getCacheConfiguration())
        ccfg.setEncryptionEnabled(true);

    KeystoreEncryptionSpi encSpi = new KeystoreEncryptionSpi();

    encSpi.setKeyStorePath(AbstractEncryptionTest.KEYSTORE_PATH);
    encSpi.setKeyStorePassword(AbstractEncryptionTest.KEYSTORE_PASSWORD.toCharArray());

    cfg.setEncryptionSpi(encSpi);

    return cfg;
}
 
Example 6
Source File: IgnitionEx.java    From ignite with Apache License 2.0 4 votes vote down vote up
/**
 * Initialize default SPI implementations.
 *
 * @param cfg Ignite configuration.
 */
private void initializeDefaultSpi(IgniteConfiguration cfg) {
    if (cfg.getDiscoverySpi() == null)
        cfg.setDiscoverySpi(new TcpDiscoverySpi());

    if (cfg.getDiscoverySpi() instanceof TcpDiscoverySpi) {
        TcpDiscoverySpi tcpDisco = (TcpDiscoverySpi)cfg.getDiscoverySpi();

        if (tcpDisco.getIpFinder() == null)
            tcpDisco.setIpFinder(new TcpDiscoveryMulticastIpFinder());
    }

    if (cfg.getCommunicationSpi() == null)
        cfg.setCommunicationSpi(new TcpCommunicationSpi());

    if (cfg.getDeploymentSpi() == null)
        cfg.setDeploymentSpi(new LocalDeploymentSpi());

    if (cfg.getEventStorageSpi() == null)
        cfg.setEventStorageSpi(new NoopEventStorageSpi());

    if (cfg.getCheckpointSpi() == null)
        cfg.setCheckpointSpi(new NoopCheckpointSpi());

    if (cfg.getCollisionSpi() == null)
        cfg.setCollisionSpi(new NoopCollisionSpi());

    if (cfg.getFailoverSpi() == null)
        cfg.setFailoverSpi(new AlwaysFailoverSpi());

    if (cfg.getLoadBalancingSpi() == null)
        cfg.setLoadBalancingSpi(new RoundRobinLoadBalancingSpi());
    else {
        Collection<LoadBalancingSpi> spis = new ArrayList<>();

        boolean dfltLoadBalancingSpi = false;

        for (LoadBalancingSpi spi : cfg.getLoadBalancingSpi()) {
            spis.add(spi);

            if (!dfltLoadBalancingSpi && spi instanceof RoundRobinLoadBalancingSpi)
                dfltLoadBalancingSpi = true;
        }

        // Add default load balancing SPI for internal tasks.
        if (!dfltLoadBalancingSpi)
            spis.add(new RoundRobinLoadBalancingSpi());

        cfg.setLoadBalancingSpi(spis.toArray(new LoadBalancingSpi[spis.size()]));
    }

    if (cfg.getIndexingSpi() == null)
        cfg.setIndexingSpi(new NoopIndexingSpi());

    if (cfg.getEncryptionSpi() == null)
        cfg.setEncryptionSpi(new NoopEncryptionSpi());

    if (F.isEmpty(cfg.getMetricExporterSpi()))
        cfg.setMetricExporterSpi(new NoopMetricExporterSpi());

    if (F.isEmpty(cfg.getSystemViewExporterSpi())) {
        if (IgniteComponentType.INDEXING.inClassPath()) {
            try {
                cfg.setSystemViewExporterSpi(new JmxSystemViewExporterSpi(),
                    U.newInstance(SYSTEM_VIEW_SQL_SPI));
            }
            catch (IgniteCheckedException e) {
                throw new IgniteException(e);
            }

        }
        else
            cfg.setSystemViewExporterSpi(new JmxSystemViewExporterSpi());
    }
}
 
Example 7
Source File: GridCommandHandlerAbstractTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    if (atomicConfiguration != null)
        cfg.setAtomicConfiguration(atomicConfiguration);

    cfg.setCommunicationSpi(new TestRecordingCommunicationSpi());

    cfg.setConnectorConfiguration(new ConnectorConfiguration().setSslEnabled(sslEnabled()));

    if (sslEnabled())
        cfg.setSslContextFactory(GridTestUtils.sslFactory());

    DataStorageConfiguration dsCfg = new DataStorageConfiguration()
        .setWalMode(WALMode.LOG_ONLY)
        .setCheckpointFrequency(checkpointFreq)
        .setDefaultDataRegionConfiguration(
            new DataRegionConfiguration().setMaxSize(50L * 1024 * 1024).setPersistenceEnabled(persistent)
        );

    if (dataRegionConfiguration != null)
        dsCfg.setDataRegionConfigurations(dataRegionConfiguration);

    cfg.setDataStorageConfiguration(dsCfg);

    cfg.setConsistentId(igniteInstanceName);

    cfg.setClientMode(igniteInstanceName.startsWith(CLIENT_NODE_NAME_PREFIX));

    if (encriptionEnabled) {
        KeystoreEncryptionSpi encSpi = new KeystoreEncryptionSpi();

        encSpi.setKeyStorePath(KEYSTORE_PATH);
        encSpi.setKeyStorePassword(KEYSTORE_PASSWORD.toCharArray());

        cfg.setEncryptionSpi(encSpi);
    }

    return cfg;
}
 
Example 8
Source File: MasterKeyChangeConsistencyCheckTest.java    From ignite with Apache License 2.0 3 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String name) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(name);

    TestKeystoreEncryptionSpi encSpi = new TestKeystoreEncryptionSpi();

    encSpi.setKeyStorePath(keystorePath());
    encSpi.setKeyStorePassword(keystorePassword());

    cfg.setEncryptionSpi(encSpi);

    cfg.setFailureHandler(new TestFailureHandler());

    return cfg;
}