public ConfigurationBuilder getConfigurationBuilder() { ConfigurationBuilder builder = new ConfigurationBuilder(); Properties properties = this.getProperties(); builder.withProperties(properties); return builder; }
private ConfigurationBuilder getConfigurationBuilder(Properties userProperties) { ConfigurationBuilder builder = new ConfigurationBuilder(); InputStream is; if (userProperties != null && !userProperties.isEmpty()) { this.properties = userProperties; builder.withProperties(userProperties); } else if ((is = findPropertiesFile()) != null) { Properties fileProperties = new Properties(); try { fileProperties.load(is); this.properties = fileProperties; builder.withProperties(fileProperties); } catch (IOException e) { throw new CacheException("Unable to load properties from `hotrod-client.properties`", e); } } else { builder.addServer().host("127.0.0.1").port(11222); } return builder; }
@Bean @Conditional(InfinispanRemoteFileChecker.class) public RemoteCacheManager remoteCacheManager() throws IOException { org.infinispan.client.hotrod.configuration.Configuration configuration; if(infinispanRemoteConfigurer != null) { configuration = infinispanRemoteConfigurer.getRemoteConfiguration(); } else { final String remoteClientPropertiesLocation = infinispanProperties.getRemote().getClientProperties(); Resource hotRodClientPropertiesFile = ctx.getResource(remoteClientPropertiesLocation); Properties hotrodClientProperties = new Properties(); try (InputStream stream = hotRodClientPropertiesFile.getURL().openStream()) { hotrodClientProperties.load(stream); configuration = new ConfigurationBuilder().withProperties(hotrodClientProperties).build(); } } return new RemoteCacheManager(configuration); } }
/** * @see InitializingBean#afterPropertiesSet() */ @Override public void afterPropertiesSet() throws Exception { assertCorrectlyConfigured(); this.logger.info("Creating new instance of RemoteCacheManager ..."); final Properties configurationPropertiesToUse = configurationProperties(); org.infinispan.client.hotrod.configuration.ConfigurationBuilder clientBuilder = new org.infinispan.client.hotrod.configuration.ConfigurationBuilder(); clientBuilder.withProperties(configurationPropertiesToUse); long readTimeout; if (configurationPropertiesToUse.containsKey(ConfigurationPropertiesOverrides.OPERATION_READ_TIMEOUT)) readTimeout = Long.parseLong(configurationPropertiesToUse.getProperty(ConfigurationPropertiesOverrides.OPERATION_READ_TIMEOUT)); else readTimeout = 0; long writeTimeout; if (configurationPropertiesToUse.containsKey(ConfigurationPropertiesOverrides.OPERATION_WRITE_TIMEOUT)) writeTimeout = Long.parseLong(configurationPropertiesToUse.getProperty(ConfigurationPropertiesOverrides.OPERATION_WRITE_TIMEOUT)); else writeTimeout = 0; final RemoteCacheManager nativeRemoteCacheManager = new RemoteCacheManager( clientBuilder.build(), this.startAutomatically); this.springRemoteCacheManager = new SpringRemoteCacheManager(nativeRemoteCacheManager, readTimeout, writeTimeout); this.logger.info("Finished creating new instance of RemoteCacheManager"); }
hotrodClientProperties.load(stream); builder = new ConfigurationBuilder().withProperties(hotrodClientProperties);
/** * @see InitializingBean#afterPropertiesSet() */ @Override public void afterPropertiesSet() throws Exception { assertCorrectlyConfigured(); this.logger.info("Creating new instance of RemoteCacheManager ..."); final Properties configurationPropertiesToUse = configurationProperties(); org.infinispan.client.hotrod.configuration.ConfigurationBuilder clientBuilder = new org.infinispan.client.hotrod.configuration.ConfigurationBuilder(); clientBuilder.withProperties(configurationPropertiesToUse); this.nativeRemoteCacheManager = new RemoteCacheManager(clientBuilder.build(), this.startAutomatically); this.logger.info("Finished creating new instance of RemoteCacheManager"); }
public RemoteCacheManager build() { ConfigurationBuilder builder = new ConfigurationBuilder() .classLoader( HotRodClientBuilder.class.getClassLoader() ) .withProperties( config.getClientProperties() ) .marshaller( this.marshaller ); if ( platform != null && !TransactionMode.NONE.equals( transactionMode ) ) { builder.transaction().transactionMode( transactionMode ); builder.transaction().transactionManagerLookup( new TransactionManagerLookupDelegator( platform ) ); } return new RemoteCacheManager( builder.build() ); }
public InfinispanSessionLegacyConverter (String cacheName) throws Exception { //legacy serialization _legacyManager = new RemoteCacheManager(); _legacyCache = _legacyManager.getCache(cacheName); //new protobuf based String host = System.getProperty("host", "127.0.0.1"); _verbose = Boolean.getBoolean("verbose"); Properties properties = new Properties(); ConfigurationBuilder clientBuilder = new ConfigurationBuilder(); clientBuilder.withProperties(properties).addServer().host(host).marshaller(new ProtoStreamMarshaller()); _protoManager = new RemoteCacheManager(clientBuilder.build()); FileDescriptorSource fds = new FileDescriptorSource(); fds.addProtoFiles("/session.proto"); SerializationContext serCtx = ProtoStreamMarshaller.getSerializationContext(_protoManager); serCtx.registerProtoFiles(fds); serCtx.registerMarshaller(new SessionDataMarshaller()); _protoCache = _protoManager.getCache(cacheName); }
new ConfigurationBuilder().withProperties(props).build(), true );
builder.withProperties(properties);
public InfinispanConfiguration build() { ConfigurationBuilder builder = new ConfigurationBuilder(); if (this.infinispanConfiguration.getConfigurationProperties() != null) builder.withProperties(this.infinispanConfiguration.getConfigurationProperties()); RemoteCacheManager remoteCacheManager = new RemoteCacheManager(builder.build()); BasicCache<Object, Object> basicCache = this.infinispanConfiguration.getCacheName() == null ? remoteCacheManager.getCache() : remoteCacheManager.getCache(this.infinispanConfiguration.getCacheName()); this.infinispanConfiguration.setCache(basicCache); return this.infinispanConfiguration; }
public InfinispanConfiguration build() { ConfigurationBuilder builder = new ConfigurationBuilder(); if (this.infinispanConfiguration.getConfigurationProperties() != null) builder.withProperties(this.infinispanConfiguration.getConfigurationProperties()); RemoteCacheManager remoteCacheManager = new RemoteCacheManager(builder.build()); BasicCache<Object, Object> basicCache = this.infinispanConfiguration.getCacheName() == null ? remoteCacheManager.getCache() : remoteCacheManager.getCache(this.infinispanConfiguration.getCacheName()); this.infinispanConfiguration.setCache(basicCache); return this.infinispanConfiguration; }
new ConfigurationBuilder().withProperties(props).build(), true );