Permalink
Browse files

ISPN-2908 Add XML parsers and XSDs for Infinispan 5.3

  • Loading branch information...
1 parent 37ae5be commit a7cb15c5099e291b1a5c1a1832084c2329fc3f80 @galderz galderz committed with tristantarrant Mar 11, 2013
Showing with 6,934 additions and 166 deletions.
  1. +1 −1 as-modules/pom.xml
  2. +1 −1 ...rc/main/java/org/infinispan/loaders/bdbje/configuration/BdbjeCacheStoreConfigurationParser52.java
  3. +126 −0 ...rc/main/java/org/infinispan/loaders/bdbje/configuration/BdbjeCacheStoreConfigurationParser53.java
  4. +1 −0 ...bje/src/main/resources/META-INF/services/org.infinispan.configuration.parsing.ConfigurationParser
  5. +88 −0 cachestore/bdbje/src/main/resources/schema/infinispan-cachestore-bdbje-config-5.3.xsd
  6. +1 −1 cachestore/bdbje/src/test/java/org/infinispan/loaders/bdbje/configuration/XmlFileParsingTest.java
  7. +1 −1 ...java/org/infinispan/loaders/cassandra/configuration/CassandraCacheStoreConfigurationParser52.java
  8. +186 −0 ...java/org/infinispan/loaders/cassandra/configuration/CassandraCacheStoreConfigurationParser53.java
  9. +1 −0 ...dra/src/main/resources/META-INF/services/org.infinispan.configuration.parsing.ConfigurationParser
  10. +208 −0 cachestore/cassandra/src/main/resources/schema/infinispan-cachestore-cassandra-config-5.3.xsd
  11. +1 −1 ...re/cassandra/src/test/java/org/infinispan/loaders/cassandra/configuration/XmlFileParsingTest.java
  12. +1 −1 ...rc/main/java/org/infinispan/loaders/cloud/configuration/CloudCacheStoreConfigurationParser52.java
  13. +146 −0 ...rc/main/java/org/infinispan/loaders/cloud/configuration/CloudCacheStoreConfigurationParser53.java
  14. +1 −0 ...oud/src/main/resources/META-INF/services/org.infinispan.configuration.parsing.ConfigurationParser
  15. +123 −0 cachestore/cloud/src/main/resources/schema/infinispan-cachestore-cloud-config-5.3.xsd
  16. +1 −1 cachestore/cloud/src/test/java/org/infinispan/loaders/cloud/configuration/XmlFileParsingTest.java
  17. +1 −1 ...rc/main/java/org/infinispan/loaders/hbase/configuration/HBaseCacheStoreConfigurationParser52.java
  18. +138 −0 ...rc/main/java/org/infinispan/loaders/hbase/configuration/HBaseCacheStoreConfigurationParser53.java
  19. +1 −0 ...ase/src/main/resources/META-INF/services/org.infinispan.configuration.parsing.ConfigurationParser
  20. +116 −0 cachestore/hbase/src/main/resources/schema/infinispan-cachestore-hbase-config-5.3.xsd
  21. +1 −1 cachestore/hbase/src/test/java/org/infinispan/loaders/hbase/configuration/XmlFileParsingTest.java
  22. +1 −3 .../src/main/java/org/infinispan/loaders/jdbc/configuration/JdbcCacheStoreConfigurationParser52.java
  23. +361 −0 .../src/main/java/org/infinispan/loaders/jdbc/configuration/JdbcCacheStoreConfigurationParser53.java
  24. +1 −0 ...dbc/src/main/resources/META-INF/services/org.infinispan.configuration.parsing.ConfigurationParser
  25. +292 −0 cachestore/jdbc/src/main/resources/schema/infinispan-cachestore-jdbc-config-5.3.xsd
  26. +1 −1 cachestore/jdbc/src/test/java/org/infinispan/loaders/jdbc/configuration/XmlFileParsingTest.java
  27. +1 −1 cachestore/jdbc/src/test/resources/configs/managed/str-managed-connection-factory.xml
  28. +1 −1 .../src/main/java/org/infinispan/loaders/jdbm/configuration/JdbmCacheStoreConfigurationParser52.java
  29. +110 −0 .../src/main/java/org/infinispan/loaders/jdbm/configuration/JdbmCacheStoreConfigurationParser53.java
  30. +1 −0 ...dbm/src/main/resources/META-INF/services/org.infinispan.configuration.parsing.ConfigurationParser
  31. +60 −0 cachestore/jdbm/src/main/resources/schema/infinispan-cachestore-jdbm-config-5.3.xsd
  32. +1 −1 cachestore/jdbm/src/test/java/org/infinispan/loaders/jdbm/configuration/XmlFileParsingTest.java
  33. +1 −1 .../main/java/org/infinispan/loaders/remote/configuration/RemoteCacheStoreConfigurationParser52.java
  34. +291 −0 .../main/java/org/infinispan/loaders/remote/configuration/RemoteCacheStoreConfigurationParser53.java
  35. +1 −0 ...ote/src/main/resources/META-INF/services/org.infinispan.configuration.parsing.ConfigurationParser
  36. +275 −0 cachestore/remote/src/main/resources/schema/infinispan-cachestore-remote-config-5.3.xsd
  37. +1 −1 cachestore/remote/src/test/java/org/infinispan/loaders/remote/configuration/XmlFileParsingTest.java
  38. +6 −6 cachestore/remote/src/test/resources/remote-cl-config.xml
  39. +2 −2 cdi/extension/src/test/resources/infinispan.xml
  40. +1 −73 core/pom.xml
  41. +0 −1 core/src/main/java/org/infinispan/configuration/parsing/Parser52.java
  42. +1,926 −0 core/src/main/java/org/infinispan/configuration/parsing/Parser53.java
  43. +42 −0 core/src/main/release/etc/config-samples-5.2/distributed-ec2.xml
  44. +42 −0 core/src/main/release/etc/config-samples-5.2/distributed-udp.xml
  45. +26 −0 core/src/main/release/etc/config-samples-5.2/minimal.xml
  46. +605 −0 core/src/main/release/etc/config-samples-5.2/sample.xml
  47. +2 −2 core/src/main/release/etc/config-samples/distributed-ec2.xml
  48. +2 −2 core/src/main/release/etc/config-samples/distributed-udp.xml
  49. +2 −2 core/src/main/release/etc/config-samples/sample.xml
  50. +1 −0 core/src/main/resources/META-INF/services/org.infinispan.configuration.parsing.ConfigurationParser
  51. +1,631 −0 core/src/main/resources/schema/infinispan-config-5.3.xsd
  52. +39 −0 core/src/test/java/org/infinispan/config/SampleConfigFilesCorrectness52Test.java
  53. +11 −3 core/src/test/java/org/infinispan/config/SampleConfigFilesCorrectnessTest.java
  54. +1 −9 core/src/test/java/org/infinispan/configuration/ConfigurationUnitTest.java
  55. +7 −3 core/src/test/java/org/infinispan/test/TestingUtil.java
  56. +2 −2 core/src/test/resources/configs/all.xml
  57. +2 −2 core/src/test/resources/configs/batching.xml
  58. +2 −2 core/src/test/resources/configs/local-singlenamedcache-test.xml
  59. +2 −2 core/src/test/resources/configs/named-cache-test.xml
  60. +2 −2 core/src/test/resources/configs/no-xa-config.xml
  61. +2 −2 core/src/test/resources/configs/recovery-enabled-config.xml
  62. +2 −2 core/src/test/resources/configs/string-property-replaced.xml
  63. +2 −2 core/src/test/resources/configs/xsite/xsite-offline-test.xml
  64. +2 −2 core/src/test/resources/configs/xsite/xsite-test.xml
  65. +2 −2 core/src/test/resources/configs/xsite/xsite-test2.xml
  66. +2 −2 demos/ec2/src/main/release/etc/config-samples/ec2-demo/infinispan-ec2-config.xml
  67. +2 −2 demos/gridfs-webdav/src/main/webapp/WEB-INF/classes/infinispan.xml
  68. +2 −2 demos/gui/src/main/release/etc/config-samples/gui-demo-cache-config.xml
  69. +2 −2 demos/gui/src/main/release/etc/config-samples/relay1.xml
  70. +2 −2 demos/gui/src/main/release/etc/config-samples/relay2.xml
  71. +2 −2 demos/lucene-directory-demo/src/main/release/etc/config-samples/lucene-demo-cache-config.xml
  72. +2 −2 demos/lucene-directory-demo/src/test/resources/config-samples/lucene-demo-cache-config.xml
  73. +1 −1 ide-settings/eclipse/codetemplates.xml
  74. +2 −2 query/src/test/resources/configuration-parsing-test-enbledInDefault.xml
  75. +2 −2 query/src/test/resources/configuration-parsing-test.xml
  76. +2 −2 query/src/test/resources/dynamic-indexing-distribution.xml
  77. +2 −2 query/src/test/resources/dynamic-indexing-replication.xml
  78. +2 −2 server/rest/src/test/resources/test-config.xml
View
@@ -17,7 +17,7 @@
<packaging>pom</packaging>
<properties>
- <infinispan.slot>5.2</infinispan.slot>
+ <infinispan.slot>5.3</infinispan.slot>
<jgroups.slot>3.2</jgroups.slot>
</properties>
@@ -43,7 +43,7 @@
private static final Namespace NAMESPACES[] = {
new Namespace(Namespace.INFINISPAN_NS_BASE_URI, "bdbje", Element.BDBJE_STORE.getLocalName(), 5, 2),
- new Namespace("", Element.BDBJE_STORE.getLocalName(), 0, 0) };
+ };
public BdbjeCacheStoreConfigurationParser52() {
}
@@ -0,0 +1,126 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2012 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @author tags. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.infinispan.loaders.bdbje.configuration;
+
+import org.infinispan.configuration.cache.ConfigurationBuilder;
+import org.infinispan.configuration.cache.LoadersConfigurationBuilder;
+import org.infinispan.configuration.parsing.ConfigurationBuilderHolder;
+import org.infinispan.configuration.parsing.ConfigurationParser;
+import org.infinispan.configuration.parsing.Namespace;
+import org.infinispan.configuration.parsing.ParseUtils;
+import org.infinispan.configuration.parsing.Parser52;
+import org.jboss.staxmapper.XMLExtendedStreamReader;
+
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+
+import static org.infinispan.util.StringPropertyReplacer.replaceProperties;
+
+/**
+ *
+ * BdbjeCacheStoreConfigurationParser52.
+ *
+ * @author Tristan Tarrant
+ * @since 5.2
+ */
+public class BdbjeCacheStoreConfigurationParser53 implements ConfigurationParser<ConfigurationBuilderHolder> {
+
+ private static final Namespace NAMESPACES[] = {
+ new Namespace(Namespace.INFINISPAN_NS_BASE_URI, "bdbje", Element.BDBJE_STORE.getLocalName(), 5, 3),
+ new Namespace("", Element.BDBJE_STORE.getLocalName(), 0, 0) };
+
+ public BdbjeCacheStoreConfigurationParser53() {
+ }
+
+ @Override
+ public Namespace[] getSupportedNamespaces() {
+ return NAMESPACES;
+ }
+
+ @Override
+ public void readElement(final XMLExtendedStreamReader reader, final ConfigurationBuilderHolder holder)
+ throws XMLStreamException {
+ ConfigurationBuilder builder = holder.getCurrentConfigurationBuilder();
+
+ Element element = Element.forName(reader.getLocalName());
+ switch (element) {
+ case BDBJE_STORE: {
+ parseBdbjeStore(reader, builder.loaders(), holder.getClassLoader());
+ break;
+ }
+ default: {
+ throw ParseUtils.unexpectedElement(reader);
+ }
+ }
+ }
+
+ private void parseBdbjeStore(final XMLExtendedStreamReader reader, LoadersConfigurationBuilder loadersBuilder,
+ ClassLoader classLoader) throws XMLStreamException {
+ BdbjeCacheStoreConfigurationBuilder builder = new BdbjeCacheStoreConfigurationBuilder(loadersBuilder);
+ parseBdbjeStoreAttributes(reader, builder);
+
+ while (reader.hasNext() && (reader.nextTag() != XMLStreamConstants.END_ELEMENT)) {
+ Parser52.parseCommonStoreChildren(reader, builder);
+ }
+ loadersBuilder.addStore(builder);
+ }
+
+ private void parseBdbjeStoreAttributes(XMLExtendedStreamReader reader, BdbjeCacheStoreConfigurationBuilder builder)
+ throws XMLStreamException {
+ for (int i = 0; i < reader.getAttributeCount(); i++) {
+ ParseUtils.requireNoNamespaceAttribute(reader, i);
+ String value = replaceProperties(reader.getAttributeValue(i));
+ Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
+ switch (attribute) {
+ case CACHE_DB_NAME_PREFIX: {
+ builder.cacheDbNamePrefix(value);
+ break;
+ }
+ case CATALOG_DB_NAME: {
+ builder.catalogDbName(value);
+ break;
+ }
+ case ENVIRONMENT_PROPERTIES_FILE: {
+ builder.environmentPropertiesFile(value);
+ break;
+ }
+ case EXPIRY_DB_PREFIX: {
+ builder.expiryDbPrefix(value);
+ break;
+ }
+ case LOCATION: {
+ builder.location(value);
+ break;
+ }
+ case LOCK_ACQUISITION_TIMEOUT: {
+ builder.lockAcquistionTimeout(Long.parseLong(value));
+ break;
+ }
+ case MAX_TX_RETRIES: {
+ builder.maxTxRetries(Integer.parseInt(value));
+ break;
+ }
+ default: {
+ Parser52.parseCommonStoreAttributes(reader, i, builder);
+ break;
+ }
+ }
+ }
+ }
+}
@@ -1 +1,2 @@
org.infinispan.loaders.bdbje.configuration.BdbjeCacheStoreConfigurationParser52
+org.infinispan.loaders.bdbje.configuration.BdbjeCacheStoreConfigurationParser53
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+
+<!--
+ ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.
+ ~
+ ~ This is free software; you can redistribute it and/or modify it
+ ~ under the terms of the GNU Lesser General Public License as
+ ~ published by the Free Software Foundation; either version 2.1 of
+ ~ the License, or (at your option) any later version.
+ ~
+ ~ This software is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ ~ Lesser General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public
+ ~ License along with this library; if not, write to the Free Software
+ ~ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ ~ 02110-1301 USA
+ -->
+
+<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" version="1.0"
+ targetNamespace="urn:infinispan:config:bdbje:5.3"
+ xmlns:tns="urn:infinispan:config:bdbje:5.3"
+ xmlns:config="urn:infinispan:config:5.3" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:import namespace="urn:infinispan:config:5.3"
+ schemaLocation="http://www.infinispan.org/schemas/infinispan-config-5.3.xsd" />
+
+ <xs:element name="bdbjeStore">
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="config:store">
+ <xs:sequence>
+ </xs:sequence>
+ <xs:attribute name="location" type="xs:string" default="Infinispan-BdbjeCacheStore">
+ <xs:annotation>
+ <xs:documentation>
+ Location on disk where the store can write internal files.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="lockAcquistionTimeout" type="xs:int" default="60000">
+ <xs:annotation>
+ <xs:documentation>
+ The length of time, in milliseconds, to wait for locks before timing out and throwing an exception. By default, this is set to 60000
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="maxTxRetries" type="xs:int" default="5">
+ <xs:annotation>
+ <xs:documentation>
+ The number of times transaction prepares will attempt to resolve a deadlock before throwing an exception. By default, this is set to 5
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="cacheDbNamePrefix" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>
+ The name of the SleepyCat database persisting this store. This defaults to {cache_name}
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="catalogDbName" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>
+ The name of the SleepyCat database persisting the class information for objects in this store. This defaults to {cache_name}_class_catalog
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="expiryDbPrefix" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>
+ The prefix of the SleepyCat database persisting the expiration data for objects in this store. If unset the name of the database will be {cache_name}_expiry
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="environmentPropertiesFile" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>
+ The name of the SleepyCat properties file containing je.* properties to initialize the JE environment. Defaults to null, no properties are passed in to the JE engine if this is null or empty. The file specified needs to be available on the classpath, or must be an absolute path to a valid properties file. Refer to SleepyCat JE Environment configuration documentation for details.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+</xs:schema>
@@ -49,7 +49,7 @@ public void testRemoteCacheStore() throws Exception {
String config = INFINISPAN_START_TAG +
" <default>\n" +
" <loaders>\n" +
- " <bdbjeStore xmlns=\"urn:infinispan:config:bdbje:5.2\" location=\"/tmp/bdbje\" catalogDbName=\"mycatalog\">\n" +
+ " <bdbjeStore xmlns=\"urn:infinispan:config:bdbje:5.3\" location=\"/tmp/bdbje\" catalogDbName=\"mycatalog\">\n" +
" <async enabled=\"true\" />\n" +
" </bdbjeStore>\n" +
" </loaders>\n" +
@@ -44,7 +44,7 @@
private static final Namespace NAMESPACES[] = {
new Namespace(Namespace.INFINISPAN_NS_BASE_URI, "cassandra", Element.CASSANDRA_STORE.getLocalName(), 5, 2),
- new Namespace("", Element.CASSANDRA_STORE.getLocalName(), 0, 0) };
+ };
public CassandraCacheStoreConfigurationParser52() {
}
Oops, something went wrong.

0 comments on commit a7cb15c

Please sign in to comment.