Package org.infinispan.commons.util

Examples of org.infinispan.commons.util.TypedProperties


   @Deprecated
   public Properties getProperties() {
      Properties properties = new Properties();
      if (configuration.asyncExecutorFactory().factoryClass() != null) {
         properties.setProperty(ConfigurationProperties.ASYNC_EXECUTOR_FACTORY, configuration.asyncExecutorFactory().factoryClass().getName());
         TypedProperties aefProps = configuration.asyncExecutorFactory().properties();
         for(String key : Arrays.asList(ConfigurationProperties.DEFAULT_EXECUTOR_FACTORY_POOL_SIZE, ConfigurationProperties.DEFAULT_EXECUTOR_FACTORY_QUEUE_SIZE)) {
            if (aefProps.containsKey(key)) {
               properties.setProperty(key, aefProps.getProperty(key));
            }
         }
      }
      properties.setProperty(ConfigurationProperties.REQUEST_BALANCING_STRATEGY, configuration.balancingStrategy().getName());
      properties.setProperty(ConfigurationProperties.CONNECT_TIMEOUT, Integer.toString(configuration.connectionTimeout()));
View Full Code Here


      testImmutability("properties");
      // JBCACHE-531: escape all backslash characters
      // replace any "\" that is not preceded by a backslash with "\\"
      properties = XmlConfigHelper.escapeBackslashes(properties);
      ByteArrayInputStream is = new ByteArrayInputStream(properties.trim().getBytes("ISO8859_1"));
      this.properties = new TypedProperties();
      this.properties.load(is);
      is.close();
   }
View Full Code Here

   @Deprecated
   public Properties getProperties() {
      Properties properties = new Properties();
      if (configuration.asyncExecutorFactory().factoryClass() != null) {
         properties.setProperty(ConfigurationProperties.ASYNC_EXECUTOR_FACTORY, configuration.asyncExecutorFactory().factoryClass().getName());
         TypedProperties aefProps = configuration.asyncExecutorFactory().properties();
         for(String key : Arrays.asList(ConfigurationProperties.DEFAULT_EXECUTOR_FACTORY_POOL_SIZE, ConfigurationProperties.DEFAULT_EXECUTOR_FACTORY_QUEUE_SIZE)) {
            if (aefProps.containsKey(key)) {
               properties.setProperty(key, aefProps.getProperty(key));
            }
         }
      }
      properties.setProperty(ConfigurationProperties.REQUEST_BALANCING_STRATEGY, configuration.balancingStrategy().getName());
      properties.setProperty(ConfigurationProperties.CONNECT_TIMEOUT, Integer.toString(configuration.connectionTimeout()));
View Full Code Here

         log.unrecognizedAttribute((String) propName);
      }
   }

   public static Properties extractProperties(Element source) {
      TypedProperties p = new TypedProperties();
      NodeList list = source.getElementsByTagName("property");
      if (list == null) return null;
      // loop through attributes
      for (int loop = 0; loop < list.getLength(); loop++) {
         Node node = list.item(loop);
         if (node.getNodeType() != Node.ELEMENT_NODE) continue;

         // for each element (attribute) ...
         Element element = (Element) node;
         String name = element.getAttribute("name");
         String valueStr = element.getAttribute("value");

         if (valueStr.length() > 0) {
            valueStr = valueStr.trim();
            valueStr = StringPropertyReplacer.replaceProperties(valueStr);
            p.put(name, valueStr);
         }
      }
      return p.isEmpty() ? null : p;
   }
View Full Code Here

      }
   }

   @Override
   public IndexingConfiguration create() {
      TypedProperties typedProperties = TypedProperties.toTypedProperties(properties);
      if (autoConfig()) {
         if (clustering().cacheMode().isDistributed()) {
            IndexOverlay.DISTRIBUTED_INFINISPAN.apply(typedProperties);
         } else {
            IndexOverlay.NON_DISTRIBUTED_FS.apply(typedProperties);
View Full Code Here

   @Override
   public IndexingConfigurationBuilder read(IndexingConfiguration template) {
      this.index = template.index();
      this.properties = new Properties();

      TypedProperties templateProperties = template.properties();
      if (templateProperties != null) {
         for (Map.Entry entry : templateProperties.entrySet()) {
            properties.put(entry.getKey(), entry.getValue());
         }
      }

      return this;
View Full Code Here

      if (properyValue != null) {
         try {
            p.setProperty(propertyName, properyValue);
         } catch (UnsupportedOperationException e) {
            // Most likely immutable, so let's work around that
            TypedProperties writableProperties = new TypedProperties(p);
            writableProperties.setProperty(propertyName, properyValue);
            setProperties(writableProperties);
         }
      }
   }
View Full Code Here

      withCacheManager(new CacheManagerCallable(
              TestCacheManagerFactory.fromXml("configuration-parsing-test.xml")) {
         @Override
         public void call() {
            Configuration cacheConfiguration = cm.getCacheConfiguration("repl-with-default");
            TypedProperties properties = cacheConfiguration.indexing().properties();
            assertFalse(properties.isEmpty());
            assertEquals(properties.getProperty("hibernate.search.default.exclusive_index_use"), "true");
            assertEquals(properties.getProperty("hibernate.search.default.reader.strategy"), "shared");
            assertEquals(properties.getProperty("hibernate.search.default.indexmanager"), "near-real-time");
            assertEquals(properties.getProperty("hibernate.search.default.directory_provider"), "filesystem");
           
            cacheConfiguration = cm.getCacheConfiguration("dist-with-default");
            properties = cacheConfiguration.indexing().properties();
           
            assertFalse(properties.isEmpty());
            assertEquals(properties.getProperty("hibernate.search.default.directory_provider"), "infinispan");
            assertEquals(properties.getProperty("hibernate.search.default.indexmanager"), "org.infinispan.query.indexmanager.InfinispanIndexManager");
            assertEquals(properties.getProperty("hibernate.search.default.exclusive_index_use"), "true");
            assertEquals(properties.getProperty("hibernate.search.default.reader.strategy"), "shared");


         }
      });
   }
View Full Code Here

                                .threadPoolSize(StoreWriteBehindResourceDefinition.THREAD_POOL_SIZE.resolveModelAttribute(context, writeBehind).asInt())
                        ;
                    }
                }

                Properties properties = new TypedProperties();
                if (store.hasDefined(StorePropertyResourceDefinition.WILDCARD_PATH.getKey())) {
                    for (Property property : store.get(StorePropertyResourceDefinition.WILDCARD_PATH.getKey()).asPropertyList()) {
                        properties.setProperty(property.getName(), StorePropertyResourceDefinition.VALUE.resolveModelAttribute(context, property.getValue()).asString());
                    }
                }
                storeBuilder.withProperties(properties);
            }
        }
View Full Code Here

            }
        }
    }

   private Properties getProperties(ModelNode loader) {
      final Properties properties = new TypedProperties();
      if (loader.hasDefined(ModelKeys.PROPERTY)) {
          for (Property property : loader.get(ModelKeys.PROPERTY).asPropertyList()) {
              String propertyName = property.getName();
              Property complexValue = property.getValue().asProperty();
              String propertyValue = complexValue.getValue().asString();
              properties.setProperty(propertyName, propertyValue);
          }
      }
      return properties;
   }
View Full Code Here

TOP

Related Classes of org.infinispan.commons.util.TypedProperties

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.