Package org.infinispan.loaders.remote

Examples of org.infinispan.loaders.remote.RemoteCacheStoreConfig

@author Mircea.Markus@jboss.com @since 4.1

      }

      for (RemoteCacheStore store : stores) {
         final RemoteCache<Object, Object> storeCache = store.getRemoteCache();
         if (storeCache.containsKey(knownKeys)) {
            RemoteCacheStoreConfig storeConfig = (RemoteCacheStoreConfig) store.getCacheStoreConfig();
            if (!storeConfig.isHotRodWrapping()) {
               throw log.remoteStoreNoHotRodWrapping(cache.getName());
            }


            Set<ByteArrayKey> keys;
View Full Code Here


      return valueSizeEstimate;
   }

   @Override
   public RemoteCacheStoreConfig adapt() {
      RemoteCacheStoreConfig config = new RemoteCacheStoreConfig();
      // StoreConfiguration
      LegacyConfigurationAdaptor.adapt(this, config);

      // RemoteCacheStoreConfiguration
      config.setRawValues(rawValues);
      config.setRemoteCacheName(remoteCacheName);
      config.setAsyncExecutorFactory(asyncExecutorFactory.factory());

      TypedProperties p = new TypedProperties();

      // Async Executor
      p.putAll(asyncExecutorFactory.properties());

      // Connection Pool
      p.put("maxActive", Integer.toString(connectionPool.maxActive()));
      p.put("maxIdle", Integer.toString(connectionPool.maxIdle()));
      p.put("maxTotal", Integer.toString(connectionPool.maxTotal()));
      p.put("minIdle", connectionPool.minIdle());
      p.put("minEvictableIdleTimeMillis", Long.toString(connectionPool.minEvictableIdleTime()));
      p.put("testWhileIdle", Boolean.toString(connectionPool.testWhileIdle()));
      p.put("timeBetweenEvictionRunsMillis", Long.toString(connectionPool.timeBetweenEvictionRuns()));
      p.put("whenExhaustedAction", Integer.toString(connectionPool.exhaustedAction().ordinal()));

      config.setTypedProperties(p);

      Properties hrp = new Properties();
      hrp.put(ConfigurationProperties.CONNECT_TIMEOUT, Long.toString(connectionTimeout));
      hrp.put(ConfigurationProperties.FORCE_RETURN_VALUES, Boolean.toString(forceReturnValues));
      hrp.put(ConfigurationProperties.KEY_SIZE_ESTIMATE, Integer.toString(keySizeEstimate));
      hrp.put(ConfigurationProperties.PING_ON_STARTUP, Boolean.toString(pingOnStartup));
      StringBuilder serverList = new StringBuilder();
      for (RemoteServerConfiguration server : servers) {
         if (serverList.length() > 0)
            serverList.append(";");
         serverList.append(server.host());
         serverList.append(":");
         serverList.append(server.port());
      }
      hrp.put(ConfigurationProperties.SERVER_LIST, serverList.toString());
      hrp.put(ConfigurationProperties.SO_TIMEOUT, Long.toString(socketTimeout));
      hrp.put(ConfigurationProperties.TCP_NO_DELAY, Boolean.toString(tcpNoDelay));
      hrp.put(ConfigurationProperties.VALUE_SIZE_ESTIMATE, Integer.toString(valueSizeEstimate));
      if (marshaller != null)
         hrp.put(ConfigurationProperties.MARSHALLER, marshaller);
      if (transportFactory != null)
         hrp.put(ConfigurationProperties.TRANSPORT_FACTORY, transportFactory);

      config.setHotRodClientProperties(hrp);
      return config;
   }
View Full Code Here

            storeConfig.setConnectionFactoryClass(ManagedConnectionFactory.class.getName());
            storeConfig.setProperties(properties);
            XmlConfigHelper.setValues(storeConfig, properties, false, true);
            return storeConfig;
        } else if (storeKey.equals(ModelKeys.REMOTE_STORE)) {
            final RemoteCacheStoreConfig storeConfig = new RemoteCacheStoreConfig();
            for(ModelNode server : store.require(ModelKeys.REMOTE_SERVER).asList()) {
                String outboundSocketBinding = server.get(ModelKeys.OUTBOUND_SOCKET_BINDING).asString();
                // builder.addDependency(OutboundSocketBinding.OUTBOUND_SOCKET_BINDING_BASE_SERVICE_NAME.append(outboundSocketBinding), OutboundSocketBinding.class, new Injector<OutboundSocketBinding>() {
                AdditionalDependency<OutboundSocketBinding> dep = new AdditionalDependency<OutboundSocketBinding>(OutboundSocketBinding.OUTBOUND_SOCKET_BINDING_BASE_SERVICE_NAME.append(outboundSocketBinding),
                        OutboundSocketBinding.class, new Injector<OutboundSocketBinding>() {
                    @Override
                    public void inject(OutboundSocketBinding value) throws InjectionException {
                        final String address;
                        try {
                            address = value.getDestinationAddress().getHostAddress()+":"+Integer.toString(value.getDestinationPort());
                        } catch (UnknownHostException uhe) {
                            throw InfinispanMessages.MESSAGES.failedToInjectSocketBinding(uhe, value);
                        }
                        String serverList = storeConfig.getHotRodClientProperties().getProperty(ConfigurationProperties.SERVER_LIST);
                        serverList = serverList==null?address:serverList+";"+address;
                        storeConfig.getHotRodClientProperties().setProperty(ConfigurationProperties.SERVER_LIST, serverList);
                    }
                    @Override
                    public void uninject() {
                    }
                });
            additionalDeps.add(dep);
            }
            if (store.hasDefined(ModelKeys.CACHE)) {
                storeConfig.setRemoteCacheName(store.get(ModelKeys.CACHE).asString());
            }
            if (store.hasDefined(ModelKeys.SOCKET_TIMEOUT)) {
                properties.setProperty(ConfigurationProperties.SO_TIMEOUT, store.require(ModelKeys.SOCKET_TIMEOUT).asString());
            }
            if (store.hasDefined(ModelKeys.TCP_NO_DELAY)) {
                properties.setProperty(ConfigurationProperties.TCP_NO_DELAY, store.require(ModelKeys.TCP_NO_DELAY).asString());
            }
            storeConfig.setHotRodClientProperties(properties);
            return storeConfig;
        }

        String className = store.require(ModelKeys.CLASS).asString();
        try {
View Full Code Here

      return valueSizeEstimate;
   }

   @Override
   public RemoteCacheStoreConfig adapt() {
      RemoteCacheStoreConfig config = new RemoteCacheStoreConfig();
      // StoreConfiguration
      LegacyConfigurationAdaptor.adapt(this, config);

      // RemoteCacheStoreConfiguration
      config.setRemoteCacheName(remoteCacheName);
      config.setAsyncExecutorFactory(asyncExecutorFactory.factory());

      TypedProperties p = new TypedProperties();

      // Async Executor
      p.putAll(asyncExecutorFactory.properties());

      // Connection Pool
      p.put("maxActive", Integer.toString(connectionPool.maxActive()));
      p.put("maxIdle", Integer.toString(connectionPool.maxIdle()));
      p.put("maxTotal", Integer.toString(connectionPool.maxTotal()));
      p.put("minIdle", connectionPool.minIdle());
      p.put("minEvictableIdleTimeMillis", Long.toString(connectionPool.minEvictableIdleTime()));
      p.put("testWhileIdle", Boolean.toString(connectionPool.testWhileIdle()));
      p.put("timeBetweenEvictionRunsMillis", Long.toString(connectionPool.timeBetweenEvictionRuns()));
      p.put("whenExhaustedAction", Integer.toString(connectionPool.exhaustedAction().ordinal()));

      config.setTypedProperties(p);

      Properties hrp = new Properties();
      hrp.put(ConfigurationProperties.CONNECT_TIMEOUT, Long.toString(connectionTimeout));
      hrp.put(ConfigurationProperties.FORCE_RETURN_VALUES, Boolean.toString(forceReturnValues));
      hrp.put(ConfigurationProperties.KEY_SIZE_ESTIMATE, Integer.toString(keySizeEstimate));
      hrp.put(ConfigurationProperties.PING_ON_STARTUP, Boolean.toString(pingOnStartup));
      StringBuilder serverList = new StringBuilder();
      for (RemoteServerConfiguration server : servers) {
         if (serverList.length() > 0)
            serverList.append(";");
         serverList.append(server.host());
         serverList.append(":");
         serverList.append(server.port());
      }
      hrp.put(ConfigurationProperties.SERVER_LIST, serverList.toString());
      hrp.put(ConfigurationProperties.SO_TIMEOUT, Long.toString(socketTimeout));
      hrp.put(ConfigurationProperties.TCP_NO_DELAY, Boolean.toString(tcpNoDelay));
      hrp.put(ConfigurationProperties.VALUE_SIZE_ESTIMATE, Integer.toString(valueSizeEstimate));
      if (marshaller != null)
         hrp.put(ConfigurationProperties.MARSHALLER, marshaller);
      if (transportFactory != null)
         hrp.put(ConfigurationProperties.TRANSPORT_FACTORY, transportFactory);

      config.setHotRodClientProperties(hrp);
      return config;
   }
View Full Code Here

      return valueSizeEstimate;
   }

   @Override
   public RemoteCacheStoreConfig adapt() {
      RemoteCacheStoreConfig config = new RemoteCacheStoreConfig();
      // StoreConfiguration
      LegacyConfigurationAdaptor.adapt(this, config);

      // RemoteCacheStoreConfiguration
      config.setRawValues(rawValues);
      config.setHotRodWrapping(hotRodWrapping);
      config.setRemoteCacheName(remoteCacheName);
      config.setAsyncExecutorFactory(asyncExecutorFactory.factory());
      if (entryWrapper != null) {
         config.setEntryWrapper(entryWrapper);
      }

      TypedProperties p = new TypedProperties();

      // Async Executor
      p.putAll(asyncExecutorFactory.properties());

      // Connection Pool
      p.put("maxActive", Integer.toString(connectionPool.maxActive()));
      p.put("maxIdle", Integer.toString(connectionPool.maxIdle()));
      p.put("maxTotal", Integer.toString(connectionPool.maxTotal()));
      p.put("minIdle", connectionPool.minIdle());
      p.put("minEvictableIdleTimeMillis", Long.toString(connectionPool.minEvictableIdleTime()));
      p.put("testWhileIdle", Boolean.toString(connectionPool.testWhileIdle()));
      p.put("timeBetweenEvictionRunsMillis", Long.toString(connectionPool.timeBetweenEvictionRuns()));
      p.put("whenExhaustedAction", Integer.toString(connectionPool.exhaustedAction().ordinal()));

      config.setTypedProperties(p);

      Properties hrp = new Properties();
      hrp.put(ConfigurationProperties.CONNECT_TIMEOUT, Long.toString(connectionTimeout));
      hrp.put(ConfigurationProperties.FORCE_RETURN_VALUES, Boolean.toString(forceReturnValues));
      hrp.put(ConfigurationProperties.KEY_SIZE_ESTIMATE, Integer.toString(keySizeEstimate));
      hrp.put(ConfigurationProperties.PING_ON_STARTUP, Boolean.toString(pingOnStartup));
      StringBuilder serverList = new StringBuilder();
      for (RemoteServerConfiguration server : servers) {
         if (serverList.length() > 0)
            serverList.append(";");
         serverList.append(server.host());
         serverList.append(":");
         serverList.append(server.port());
      }
      hrp.put(ConfigurationProperties.SERVER_LIST, serverList.toString());
      hrp.put(ConfigurationProperties.SO_TIMEOUT, Long.toString(socketTimeout));
      hrp.put(ConfigurationProperties.TCP_NO_DELAY, Boolean.toString(tcpNoDelay));
      hrp.put(ConfigurationProperties.VALUE_SIZE_ESTIMATE, Integer.toString(valueSizeEstimate));
      if (marshaller != null)
         hrp.put(ConfigurationProperties.MARSHALLER, marshaller);
      if (transportFactory != null)
         hrp.put(ConfigurationProperties.TRANSPORT_FACTORY, transportFactory);

      config.setHotRodClientProperties(hrp);
      return config;
   }
View Full Code Here

      assert store2.connectionPool().exhaustedAction() == ExhaustedAction.EXCEPTION;
      assert store2.connectionPool().minEvictableIdleTime() == 10000;
      assert store2.fetchPersistentState();
      assert store2.async().enabled();

      RemoteCacheStoreConfig legacy = store.adapt();
      assert "RemoteCache".equals(legacy.getRemoteCacheName());
      assert "one:12111;two:11222".equals(legacy.getHotRodClientProperties().get(
            ConfigurationProperties.SERVER_LIST));
      assert legacy.getTypedProperties().getIntProperty("whenExhaustedAction", -1) == 0;
      assert legacy.isFetchPersistentState();
      assert legacy.asyncStore().isEnabled();
   }
View Full Code Here

      return valueSizeEstimate;
   }

   @Override
   public RemoteCacheStoreConfig adapt() {
      RemoteCacheStoreConfig config = new RemoteCacheStoreConfig();
      // StoreConfiguration
      LegacyConfigurationAdaptor.adapt(this, config);

      // RemoteCacheStoreConfiguration
      config.setRawValues(rawValues);
      config.setHotRodWrapping(hotRodWrapping);
      config.setRemoteCacheName(remoteCacheName);
      config.setAsyncExecutorFactory(asyncExecutorFactory.factory());
      if (entryWrapper != null) {
         config.setEntryWrapper(entryWrapper);
      }

      TypedProperties p = new TypedProperties();

      // Async Executor
      p.putAll(asyncExecutorFactory.properties());

      // Connection Pool
      p.put("maxActive", Integer.toString(connectionPool.maxActive()));
      p.put("maxIdle", Integer.toString(connectionPool.maxIdle()));
      p.put("maxTotal", Integer.toString(connectionPool.maxTotal()));
      p.put("minIdle", connectionPool.minIdle());
      p.put("minEvictableIdleTimeMillis", Long.toString(connectionPool.minEvictableIdleTime()));
      p.put("testWhileIdle", Boolean.toString(connectionPool.testWhileIdle()));
      p.put("timeBetweenEvictionRunsMillis", Long.toString(connectionPool.timeBetweenEvictionRuns()));
      p.put("whenExhaustedAction", Integer.toString(connectionPool.exhaustedAction().ordinal()));

      config.setTypedProperties(p);

      Properties hrp = new Properties();
      hrp.put(ConfigurationProperties.CONNECT_TIMEOUT, Long.toString(connectionTimeout));
      hrp.put(ConfigurationProperties.FORCE_RETURN_VALUES, Boolean.toString(forceReturnValues));
      hrp.put(ConfigurationProperties.KEY_SIZE_ESTIMATE, Integer.toString(keySizeEstimate));
      hrp.put(ConfigurationProperties.PING_ON_STARTUP, Boolean.toString(pingOnStartup));
      StringBuilder serverList = new StringBuilder();
      for (RemoteServerConfiguration server : servers) {
         if (serverList.length() > 0)
            serverList.append(";");
         serverList.append(server.host());
         serverList.append(":");
         serverList.append(server.port());
      }
      hrp.put(ConfigurationProperties.SERVER_LIST, serverList.toString());
      hrp.put(ConfigurationProperties.SO_TIMEOUT, Long.toString(socketTimeout));
      hrp.put(ConfigurationProperties.TCP_NO_DELAY, Boolean.toString(tcpNoDelay));
      hrp.put(ConfigurationProperties.VALUE_SIZE_ESTIMATE, Integer.toString(valueSizeEstimate));
      if (marshaller != null)
         hrp.put(ConfigurationProperties.MARSHALLER, marshaller);
      if (transportFactory != null)
         hrp.put(ConfigurationProperties.TRANSPORT_FACTORY, transportFactory);

      config.setHotRodClientProperties(hrp);
      return config;
   }
View Full Code Here

      }

      for (RemoteCacheStore store : stores) {
         final RemoteCache<Object, Object> storeCache = store.getRemoteCache();
         if (storeCache.containsKey(knownKeys)) {
            RemoteCacheStoreConfig storeConfig = (RemoteCacheStoreConfig) store.getCacheStoreConfig();
            if (!storeConfig.isHotRodWrapping()) {
               throw log.remoteStoreNoHotRodWrapping(cache.getName());
            }


            Set<byte[]> keys;
View Full Code Here

            storeConfig.setConnectionFactoryClass(ManagedConnectionFactory.class.getName());
            storeConfig.setProperties(properties);
            XmlConfigHelper.setValues(storeConfig, properties, false, true);
            return storeConfig;
        } else if (storeKey.equals(ModelKeys.REMOTE_STORE)) {
            final RemoteCacheStoreConfig storeConfig = new RemoteCacheStoreConfig();
            for(ModelNode server : store.require(ModelKeys.REMOTE_SERVER).asList()) {
                String outboundSocketBinding = server.get(ModelKeys.OUTBOUND_SOCKET_BINDING).asString();
                builder.addDependency(OutboundSocketBinding.OUTBOUND_SOCKET_BINDING_BASE_SERVICE_NAME.append(outboundSocketBinding), OutboundSocketBinding.class, new Injector<OutboundSocketBinding>() {
                    @Override
                    public void inject(OutboundSocketBinding value) throws InjectionException {
                        final String address;
                        try {
                            address = value.getDestinationAddress().getHostAddress()+":"+Integer.toString(value.getDestinationPort());
                        } catch (UnknownHostException uhe) {
                            throw InfinispanMessages.MESSAGES.failedToInjectSocketBinding(uhe, value);
                        }
                        String serverList = storeConfig.getHotRodClientProperties().getProperty(ConfigurationProperties.SERVER_LIST);
                        serverList = serverList==null?address:serverList+";"+address;
                        storeConfig.getHotRodClientProperties().setProperty(ConfigurationProperties.SERVER_LIST, serverList);
                    }
                    @Override
                    public void uninject() {
                    }
                });
            }
            if (store.hasDefined(ModelKeys.CACHE)) {
                storeConfig.setRemoteCacheName(store.get(ModelKeys.CACHE).asString());
            }
            if (store.hasDefined(ModelKeys.SOCKET_TIMEOUT)) {
                properties.setProperty(ConfigurationProperties.SO_TIMEOUT, store.require(ModelKeys.SOCKET_TIMEOUT).asString());
            }
            if (store.hasDefined(ModelKeys.TCP_NO_DELAY)) {
                properties.setProperty(ConfigurationProperties.TCP_NO_DELAY, store.require(ModelKeys.TCP_NO_DELAY).asString());
            }
            storeConfig.setHotRodClientProperties(properties);
            return storeConfig;
        }

        String className = store.require(ModelKeys.CLASS).asString();
        try {
View Full Code Here

TOP

Related Classes of org.infinispan.loaders.remote.RemoteCacheStoreConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.