org.infinispan.client.hotrod.configuration.Configuration Java Examples

The following examples show how to use org.infinispan.client.hotrod.configuration.Configuration. 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: Infinispan10Driver.java    From hazelcast-simulator with Apache License 2.0 6 votes vote down vote up
@Override
public void startVendorInstance() throws Exception {
    String workerType = get("WORKER_TYPE");
    if ("javaclient".equals(workerType)) {
         Properties hotrodProperties = new Properties();
        hotrodProperties.setProperty("infinispan.client.hotrod.server_list", get("server_list"));
        ConfigurationBuilder configurationBuilder = new ConfigurationBuilder().withProperties(hotrodProperties);
        Configuration configuration = configurationBuilder.build();
        RemoteCacheManager remoteCacheManager = new RemoteCacheManager(configuration);
        this.cacheContainer = remoteCacheManager;
    } else {
        DefaultCacheManager defaultCacheManager = new DefaultCacheManager("infinispan.xml");
        this.cacheContainer = defaultCacheManager;
        HotRodServerConfiguration hotRodServerConfiguration = new HotRodServerConfigurationBuilder()
                .host(get("PRIVATE_ADDRESS")).port(11222).build();
        this.hotRodServer = new HotRodServer();
        hotRodServer.start(hotRodServerConfiguration, defaultCacheManager);
    }
}
 
Example #2
Source File: Infinispan9Driver.java    From hazelcast-simulator with Apache License 2.0 6 votes vote down vote up
@Override
public void startVendorInstance() throws Exception {
    String workerType = get("WORKER_TYPE");
    if ("javaclient".equals(workerType)) {
        Properties hotrodProperties = new Properties();
        hotrodProperties.setProperty("infinispan.client.hotrod.server_list", get("server_list"));
        ConfigurationBuilder configurationBuilder = new ConfigurationBuilder().withProperties(hotrodProperties);
        Configuration configuration = configurationBuilder.build();
        RemoteCacheManager remoteCacheManager = new RemoteCacheManager(configuration);
        this.cacheContainer = remoteCacheManager;
    } else {
        DefaultCacheManager defaultCacheManager = new DefaultCacheManager("infinispan.xml");
        this.cacheContainer = defaultCacheManager;
        HotRodServerConfiguration hotRodServerConfiguration = new HotRodServerConfigurationBuilder()
                .host(get("PRIVATE_ADDRESS")).port(11222).build();
        this.hotRodServer = new HotRodServer();
        hotRodServer.start(hotRodServerConfiguration, defaultCacheManager);
    }
}
 
Example #3
Source File: InfinispanHealthCheck.java    From kogito-runtimes with Apache License 2.0 5 votes vote down vote up
@Override
public HealthCheckResponse call() {
    return cacheManagerOptional.map(cacheManager -> {

        final ChannelFactory channelFactory = cacheManager.getChannelFactory();
        final Codec codec = cacheManager.getCodec();
        final Configuration configuration = cacheManager.getConfiguration();
        final ClientListenerNotifier listenerNotifier = new ClientListenerNotifier(codec,
                                                                                   cacheManager.getMarshaller(),
                                                                                   channelFactory,
                                                                                   configuration);
        final OperationsFactory operationsFactory = new OperationsFactory(channelFactory,
                                                                          codec,
                                                                          listenerNotifier,
                                                                          configuration);

        return Optional.of(channelFactory
                                   .getServers()
                                   .stream()
                                   .map(server -> invokePingOperation(channelFactory, operationsFactory, server)
                                           .thenApply(PingResponse::isSuccess)
                                           .exceptionally(ex -> false))
                                   .map(op -> {
                                       try {
                                           return op.get(500, TimeUnit.MILLISECONDS);
                                       } catch (Exception e) {
                                           return false;
                                       }
                                   })
                                   .allMatch(Boolean.FALSE::equals))
                .map(allDown -> buildResponse(channelFactory, !allDown))
                .orElse(buildResponse(channelFactory, false));
    }).orElse(null);
}
 
Example #4
Source File: InfinispanRemoteConfigurationPropertiesTest.java    From hono with Eclipse Public License 2.0 5 votes vote down vote up
@Test
void testConnectionPoolProperties() {
    props.setConnectionPool(Map.of("min_idle", "2"));
    final Configuration config = props.getConfigurationBuilder().build();
    System.out.println(config);
    assertThat(config.connectionPool().minIdle()).isEqualTo(2);
    assertThat(config.connectionPool().minEvictableIdleTime()).isGreaterThan(0L);
}
 
Example #5
Source File: HotrodCacheTest.java    From hono with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected org.infinispan.client.hotrod.RemoteCache<Object, Object> givenAConnectedCache() {
    final Configuration configuration = mock(Configuration.class);
    @SuppressWarnings("unchecked")
    final org.infinispan.client.hotrod.RemoteCache<Object, Object> result = mock(org.infinispan.client.hotrod.RemoteCache.class);
    when(remoteCacheManager.getCache(anyString(), anyBoolean())).thenReturn(result);
    when(remoteCacheManager.getConfiguration()).thenReturn(configuration);
    when(configuration.forceReturnValues()).thenReturn(false);
    when(result.withFlags(Flag.FORCE_RETURN_VALUE)).thenReturn(result);
    return result;
}
 
Example #6
Source File: InfinispanHotRodImpl.java    From khan-session with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * 초기화 함수, 설정파일을 읽어서 캐시를 초기화한다.
 *
 * @param configFile
 * @param cacheName
 * @param loginCacheName
 * @throws IOException
 */
@Override
public void initialize(String configFile, String cacheName, String loginCacheName)
        throws IOException {
    StringUtils.isNotNull("configFile", configFile);

    Configuration configuration = null;
    ConfigurationBuilder builder = new ConfigurationBuilder();
    ClassLoader cl = Thread.currentThread().getContextClassLoader();
    builder.classLoader(cl);

    InputStream stream = cl.getResourceAsStream(configFile);

    if (stream == null) {
        logger.error("Can't Found configFile=" + configFile);
    } else {
        try {
            builder.withProperties(loadFromStream(stream));
        } finally {
            Util.close(stream);
        }
    }
    configuration = builder.build();


    cacheManager = new RemoteCacheManager(configuration);

    cache = cacheManager.getCache(cacheName);
    loginCache = cacheManager.getCache(loginCacheName);

    waitForConnectionReady();
}
 
Example #7
Source File: InfinispanClientProducer.java    From quarkus with Apache License 2.0 4 votes vote down vote up
private void initialize() {
    log.debug("Initializing CacheManager");
    Configuration conf;
    if (properties == null) {
        // We already loaded and it wasn't present - so use an empty config
        conf = new ConfigurationBuilder().build();
    } else {
        conf = builderFromProperties(properties).build();
    }
    cacheManager = new RemoteCacheManager(conf);

    // TODO: do we want to automatically register all the proto file definitions?
    RemoteCache<String, String> protobufMetadataCache = null;

    Set<SerializationContextInitializer> initializers = (Set) properties.remove(PROTOBUF_INITIALIZERS);
    if (initializers != null) {
        for (SerializationContextInitializer initializer : initializers) {
            if (protobufMetadataCache == null) {
                protobufMetadataCache = cacheManager.getCache(
                        ProtobufMetadataManagerConstants.PROTOBUF_METADATA_CACHE_NAME);
            }
            protobufMetadataCache.put(initializer.getProtoFileName(), initializer.getProtoFile());
        }
    }

    for (Map.Entry<Object, Object> property : properties.entrySet()) {
        Object key = property.getKey();
        if (key instanceof String) {
            String keyString = (String) key;
            if (keyString.startsWith(InfinispanClientProducer.PROTOBUF_FILE_PREFIX)) {
                String fileName = keyString.substring(InfinispanClientProducer.PROTOBUF_FILE_PREFIX.length());
                String fileContents = (String) property.getValue();
                if (protobufMetadataCache == null) {
                    protobufMetadataCache = cacheManager.getCache(
                            ProtobufMetadataManagerConstants.PROTOBUF_METADATA_CACHE_NAME);
                }
                protobufMetadataCache.put(fileName, fileContents);
            }
        }
    }
}
 
Example #8
Source File: CustomPropertiesTest.java    From infinispan-spring-boot with Apache License 2.0 4 votes vote down vote up
@Test
public void testDefaultClient() throws Exception {
   //when
   Configuration configuration = remoteCacheManager.getConfiguration();
   String hostObtainedFromPropertiesFile = configuration.servers().get(0).host();
   int portObtainedFromPropertiesFile = configuration.servers().get(0).port();

   // Connection
   assertThat(hostObtainedFromPropertiesFile).isEqualTo("127.0.0.1");
   assertThat(portObtainedFromPropertiesFile).isEqualTo(6667);
   assertThat(configuration.tcpNoDelay()).isFalse();
   assertThat(configuration.tcpKeepAlive()).isTrue();
   assertThat(configuration.clientIntelligence()).isEqualTo(ClientIntelligence.TOPOLOGY_AWARE);
   assertThat(configuration.socketTimeout()).isEqualTo(3000);
   assertThat(configuration.connectionTimeout()).isEqualTo(5000);
   assertThat(configuration.maxRetries()).isEqualTo(42);
   assertThat(configuration.batchSize()).isEqualTo(90);
   assertThat(configuration.version()).isEqualTo(ProtocolVersion.PROTOCOL_VERSION_28);

   // Connection pool properties
   assertThat(configuration.connectionPool().maxActive()).isEqualTo(91);
   assertThat(configuration.connectionPool().exhaustedAction()).isEqualTo(ExhaustedAction.EXCEPTION);
   assertThat(configuration.connectionPool().maxWait()).isEqualTo(20001);
   assertThat(configuration.connectionPool().minIdle()).isEqualTo(1001);
   assertThat(configuration.connectionPool().minEvictableIdleTime()).isEqualTo(9001);
   assertThat(configuration.connectionPool().maxPendingRequests()).isEqualTo(846);

   // Thread pool properties
   assertThat(configuration.asyncExecutorFactory().factoryClass()).isEqualTo(DefaultAsyncExecutorFactory.class);
   // TODO: how to assert thread pool size ? default_executor_factory.pool_size

   // Marshalling properties
   assertThat(configuration.marshallerClass()).isEqualTo(JavaSerializationMarshaller.class);
   assertThat(configuration.keySizeEstimate()).isEqualTo(123456);
   assertThat(configuration.valueSizeEstimate()).isEqualTo(789012);
   assertThat(configuration.forceReturnValues()).isTrue();
   assertThat(configuration.serialWhitelist()).contains("SERIAL-KILLER");
   // TODO: Consistent Hash Impl ??
   //assertThat(configuration.consistentHashImpl().getClass().toString()).isEqualTo("");

   // Encryption properties
   assertThat(configuration.security().ssl().enabled()).isTrue();
   assertThat(configuration.security().ssl().keyStoreFileName()).isEqualTo("keyStoreFile");
   assertThat(configuration.security().ssl().keyStoreType()).isEqualTo("JKS");
   assertThat(configuration.security().ssl().keyStorePassword()).hasSize(12);
   assertThat(configuration.security().ssl().keyAlias()).isEqualTo("aliasKey");
   assertThat(configuration.security().ssl().keyStoreCertificatePassword()).hasSize(9);
   assertThat(configuration.security().ssl().trustStoreFileName()).isEqualTo("trustFileName");
   assertThat(configuration.security().ssl().trustStorePath()).isNull();
   assertThat(configuration.security().ssl().trustStoreType()).isEqualTo("LOL");
   assertThat(configuration.security().ssl().trustStorePassword().length).isEqualTo(13);
   assertThat(configuration.security().ssl().sniHostName()).isEqualTo("oihost");
   assertThat(configuration.security().ssl().protocol()).isEqualTo("TLSv1.3");

   // authentication
   assertThat(configuration.security().authentication().enabled()).isTrue();
   assertThat(configuration.security().authentication().saslMechanism()).isEqualTo("DIGEST-MD5");
   assertThat(configuration.security().authentication().callbackHandler()).isInstanceOf(BasicCallbackHandler.class);
   assertThat(configuration.security().authentication().serverName()).isEqualTo("my_ela_server_name");
   BasicCallbackHandler basicCallbackHandler = (BasicCallbackHandler) configuration.security().authentication().callbackHandler();
   NameCallback nameCallback = new NameCallback("test", "test");
   PasswordCallback passwordCallback = new PasswordCallback("test", false);
   RealmCallback realmCallback = new RealmCallback("test", "test");
   basicCallbackHandler.handle(new Callback[]{nameCallback, passwordCallback, realmCallback});
   assertThat(nameCallback.getName()).isEqualTo("elaia");
   assertThat(passwordCallback.getPassword()).isEqualTo("elapass".toCharArray());
   assertThat(realmCallback.getText()).isEqualTo("elarealm");
   assertThat(configuration.security().authentication().saslProperties()).hasSize(1);
   assertThat(configuration.security().authentication().saslProperties()).containsOnlyKeys("prop1");
   assertThat(configuration.security().authentication().saslProperties()).containsValues("value1");

   // Transaction properties
   // TODO: transaction_manager_lookup??
   assertThat(configuration.transaction().transactionMode()).isEqualTo(TransactionMode.FULL_XA);
   assertThat(configuration.transaction().timeout()).isEqualTo(50001);

   // near cache
   assertThat(configuration.nearCache().mode()).isEqualTo(NearCacheMode.INVALIDATED);
   assertThat(configuration.nearCache().maxEntries()).isEqualTo(10000);
   assertThat(configuration.nearCache().cacheNamePattern().pattern()).isEqualTo("nearSuperCache*");

   // xsite
   assertThat(configuration.clusters()).hasSize(2);
   ClusterConfiguration siteA = configuration.clusters().get(0);
   ClusterConfiguration siteB = configuration.clusters().get(1);
   assertThat(siteA.getClusterName()).isEqualTo("siteA");
   assertThat(siteB.getClusterName()).isEqualTo("siteB");
   assertThat(siteA.getCluster()).extracting("host", "port").containsExactly(tuple("hostA1", 11222), tuple("hostA2", 11223));
   assertThat(siteB.getCluster()).extracting("host", "port").containsExactly(tuple("hostB1", 11224), tuple("hostB2", 11225));

   // statistics
   assertThat(configuration.statistics().enabled()).isTrue();
   assertThat(configuration.statistics().jmxEnabled()).isTrue();
   assertThat(configuration.statistics().jmxName()).isEqualTo("elaJmx");
   assertThat(configuration.statistics().jmxDomain()).isEqualTo("elaJmxDom2");
}
 
Example #9
Source File: ApplicationPropertiesTest.java    From infinispan-spring-boot with Apache License 2.0 4 votes vote down vote up
@Test
public void testDefaultClient() throws Exception {
   //when
   Configuration configuration = remoteCacheManager.getConfiguration();
   String hostObtainedFromPropertiesFile = configuration.servers().get(0).host();
   int portObtainedFromPropertiesFile = configuration.servers().get(0).port();

   configuration.asyncExecutorFactory().factoryClass();

   // properties
   assertThat(hostObtainedFromPropertiesFile).isEqualTo("180.567.112.333");
   assertThat(portObtainedFromPropertiesFile).isEqualTo(6668);
   assertThat(configuration.tcpNoDelay()).isFalse();
   assertThat(configuration.tcpKeepAlive()).isTrue();
   assertThat(configuration.clientIntelligence()).isEqualTo(ClientIntelligence.TOPOLOGY_AWARE);
   assertThat(configuration.socketTimeout()).isEqualTo(500);
   assertThat(configuration.connectionTimeout()).isEqualTo(200);
   assertThat(configuration.maxRetries()).isEqualTo(30);
   assertThat(configuration.batchSize()).isEqualTo(91);
   assertThat(configuration.version()).isEqualTo(ProtocolVersion.PROTOCOL_VERSION_24);

   // pool
   assertThat(configuration.connectionPool().maxActive()).isEqualTo(90);
   assertThat(configuration.connectionPool().maxWait()).isEqualTo(20000);
   assertThat(configuration.connectionPool().minIdle()).isEqualTo(1000);
   assertThat(configuration.connectionPool().maxPendingRequests()).isEqualTo(845);
   assertThat(configuration.connectionPool().minEvictableIdleTime()).isEqualTo(9000);
   assertThat(configuration.connectionPool().exhaustedAction()).isEqualTo(ExhaustedAction.CREATE_NEW);

   // Thread pool properties
   assertThat(configuration.asyncExecutorFactory().factoryClass()).isEqualTo(DefaultAsyncExecutorFactory.class);
   // TODO: how to assert thread pool size ? default-executor-factory-pool-size

   // Marshalling properties
   assertThat(configuration.marshallerClass()).isEqualTo(JavaSerializationMarshaller.class);
   assertThat(configuration.keySizeEstimate()).isEqualTo(88889);
   assertThat(configuration.valueSizeEstimate()).isEqualTo(11112);
   assertThat(configuration.forceReturnValues()).isTrue();
   assertThat(configuration.serialWhitelist()).contains("APP-KILLER1", "APP-KILLER2");
   // TODO: Consistent Hash Impl ??
   //assertThat(configuration.consistentHashImpl().getClass().toString()).isEqualTo("");

   // Encryption properties
   assertThat(configuration.security().ssl().enabled()).isTrue();
   assertThat(configuration.security().ssl().keyStoreFileName()).isEqualTo("superKeyStoreFile");
   assertThat(configuration.security().ssl().keyStoreType()).isEqualTo("SKL");
   assertThat(configuration.security().ssl().keyStorePassword().length).isEqualTo(17);
   assertThat(configuration.security().ssl().keyAlias()).isEqualTo("superAliasKey");
   assertThat(configuration.security().ssl().keyStoreCertificatePassword()).hasSize(13);
   assertThat(configuration.security().ssl().trustStoreFileName()).isEqualTo("superTrustFileName");
   assertThat(configuration.security().ssl().trustStorePath()).isNull();
   assertThat(configuration.security().ssl().trustStoreType()).isEqualTo("CKO");
   assertThat(configuration.security().ssl().trustStorePassword().length).isEqualTo(18);
   assertThat(configuration.security().ssl().sniHostName()).isEqualTo("elahost");
   assertThat(configuration.security().ssl().protocol()).isEqualTo("TLSv1.4");

   // authentication
   assertThat(configuration.security().authentication().enabled()).isTrue();
   assertThat(configuration.security().authentication().callbackHandler().getClass()).isEqualTo(BasicCallbackHandler.class);
   assertThat(configuration.security().authentication().saslMechanism()).isEqualTo("my-sasl-mechanism");
   assertThat(configuration.security().authentication().serverName()).isEqualTo("my-server-name");
   BasicCallbackHandler basicCallbackHandler = (BasicCallbackHandler) configuration.security().authentication().callbackHandler();
   NameCallback nameCallback = new NameCallback("test", "test");
   PasswordCallback passwordCallback = new PasswordCallback("test", false);
   RealmCallback realmCallback = new RealmCallback("test", "test");
   basicCallbackHandler.handle(new Callback[]{nameCallback, passwordCallback, realmCallback});
   assertThat(nameCallback.getName()).isEqualTo("oihana");
   assertThat(passwordCallback.getPassword()).isEqualTo("oipass".toCharArray());
   assertThat(realmCallback.getText()).isEqualTo("oirealm");
   assertThat(configuration.security().authentication().saslProperties()).hasSize(2);
   assertThat(configuration.security().authentication().saslProperties()).extracting("prop1", "prop2").containsExactly("value1", "value2");

   // transactions
   assertThat(configuration.transaction().transactionMode()).isEqualTo(TransactionMode.NON_DURABLE_XA);
   assertThat(configuration.transaction().timeout()).isEqualTo(50000);

   // near cache
   assertThat(configuration.nearCache().mode()).isEqualTo(NearCacheMode.INVALIDATED);
   assertThat(configuration.nearCache().maxEntries()).isEqualTo(2000);
   assertThat(configuration.nearCache().cacheNamePattern().pattern()).isEqualTo("appCache*");

   // xsite
   assertThat(configuration.clusters()).hasSize(1);
   ClusterConfiguration site = configuration.clusters().get(0);
   assertThat(site.getCluster()).extracting("host", "port").containsExactly(tuple("hostOi1", 21222), tuple("hostOi2", 21223));

   // statistics
   assertThat(configuration.statistics().enabled()).isTrue();
   assertThat(configuration.statistics().jmxEnabled()).isTrue();
   assertThat(configuration.statistics().jmxName()).isEqualTo("oiJmx");
   assertThat(configuration.statistics().jmxDomain()).isEqualTo("oiJmxDom");
}
 
Example #10
Source File: SimpleSparkJob.java    From infinispan-simple-tutorials with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) throws UnknownHostException {
   // Obtain the Infinispan address
   String infinispanAddress = args[0];

   // Adjust log levels
   Logger.getLogger("org").setLevel(Level.WARN);

   // Create the remote cache manager
   Configuration build = new ConfigurationBuilder().addServer().host(infinispanAddress).build();
   RemoteCacheManager remoteCacheManager = new RemoteCacheManager(build);

   // Obtain the remote cache
   RemoteCache<Integer, Temperature> cache = remoteCacheManager.getCache();

   // Add some data
   cache.put(1, new Temperature(21, "London"));
   cache.put(2, new Temperature(34, "Rome"));
   cache.put(3, new Temperature(33, "Barcelona"));
   cache.put(4, new Temperature(8, "Oslo"));

   // Create java spark context
   SparkConf conf = new SparkConf().setAppName("infinispan-spark-simple-job");
   JavaSparkContext jsc = new JavaSparkContext(conf);

   // Create InfinispanRDD
   ConnectorConfiguration config = new ConnectorConfiguration().setServerList(infinispanAddress);

   JavaPairRDD<Integer, Temperature> infinispanRDD = InfinispanJavaRDD.createInfinispanRDD(jsc, config);

   // Convert RDD to RDD of doubles
   JavaDoubleRDD javaDoubleRDD = infinispanRDD.values().mapToDouble(Temperature::getValue);

   // Calculate average temperature
   Double meanTemp = javaDoubleRDD.mean();
   System.out.printf("\nAVERAGE TEMPERATURE: %f C\n", meanTemp);

   // Calculate standard deviation
   Double stdDev = javaDoubleRDD.sampleStdev();
   System.out.printf("STD DEVIATION: %f C\n ", stdDev);

   // Calculate histogram of temperatures
   System.out.println("TEMPERATURE HISTOGRAM:");
   double[] buckets = {0d, 10d, 20d, 30d, 40d};
   long[] histogram = javaDoubleRDD.histogram(buckets);

   for (int i = 0; i < buckets.length - 1; i++) {
      System.out.printf("Between %f C and %f C: %d cities\n", buckets[i], buckets[i + 1], histogram[i]);
   }
}
 
Example #11
Source File: RemoteCacheProvider.java    From keycloak with Apache License 2.0 4 votes vote down vote up
protected RemoteCacheManager getOrCreateSecuredRemoteCacheManager(Config.Scope config, String cacheName, RemoteCacheManager origManager) {
    String serverName = config.get("remoteStoreSecurityServerName", "keycloak-jdg-server");
    String realm = config.get("remoteStoreSecurityRealm", "AllowScriptManager");

    String username = config.get("remoteStoreSecurityUsername", "___script_manager");
    String password = config.get("remoteStoreSecurityPassword", "not-so-secret-password");

    // Create configuration template from the original configuration provided at remoteStore level
    Configuration origConfig = origManager.getConfiguration();

    ConfigurationBuilder cfgBuilder = new ConfigurationBuilder()
            .read(origConfig);

    String securedHotRodEndpoint = origConfig.servers().stream()
          .map(serverConfiguration -> serverConfiguration.host() + ":" + serverConfiguration.port())
          .collect(Collectors.joining(";"));

    if (managedManagers.containsKey(securedHotRodEndpoint)) {
        return managedManagers.get(securedHotRodEndpoint);
    }

    logger.infof("Creating secured RemoteCacheManager for Server: '%s', Cache: '%s', Realm: '%s', Username: '%s', Secured HotRod endpoint: '%s'", serverName, cacheName, realm, username, securedHotRodEndpoint);

    // Workaround as I need a way to override servers and it's not possible to remove existing :/
    try {
        Field serversField = cfgBuilder.getClass().getDeclaredField("servers");
        Reflections.setAccessible(serversField);
        List origServers = Reflections.getFieldValue(serversField, cfgBuilder, List.class);
        origServers.clear();
    } catch (NoSuchFieldException nsfe) {
        throw new RuntimeException(nsfe);
    }

    // Create configuration based on the configuration template from remoteStore. Just add security and override secured endpoint
    Configuration newConfig = cfgBuilder
            .addServers(securedHotRodEndpoint)
            .security()
              .authentication()
                .serverName(serverName) //define server name, should be specified in XML configuration on JDG side
                .saslMechanism("DIGEST-MD5") // define SASL mechanism, in this example we use DIGEST with MD5 hash
                .callbackHandler(new LoginHandler(username, password.toCharArray(), realm)) // define login handler, implementation defined
                .enable()
            .build();

    final RemoteCacheManager remoteCacheManager = new RemoteCacheManager(newConfig);
    managedManagers.put(securedHotRodEndpoint, remoteCacheManager);
    return remoteCacheManager;
}
 
Example #12
Source File: InfinispanRemoteConfigurer.java    From infinispan-spring-boot with Apache License 2.0 votes vote down vote up
Configuration getRemoteConfiguration();