[infinispan-commits] Infinispan SVN: r740 - in trunk: cachestore/jdbc/src/main/java/org/infinispan/loaders/jdbc/binary and 12 other directories.
infinispan-commits at lists.jboss.org
infinispan-commits at lists.jboss.org
Wed Aug 26 08:59:40 EDT 2009
Author: vblagojevic at jboss.com
Date: 2009-08-26 08:59:39 -0400 (Wed, 26 Aug 2009)
New Revision: 740
Added:
trunk/tools/src/main/java/org/infinispan/tools/schema/AbstractTreeWalker.java
trunk/tools/src/main/java/org/infinispan/tools/schema/TreeNode.java
trunk/tools/src/main/java/org/infinispan/tools/schema/TreeWalker.java
trunk/tools/src/main/java/org/infinispan/tools/schema/XSOMSchemaTreeWalker.java
Removed:
trunk/core/src/main/java/org/infinispan/config/ConfigurationAttribute.java
trunk/core/src/main/java/org/infinispan/config/ConfigurationElement.java
trunk/core/src/main/java/org/infinispan/config/ConfigurationElements.java
trunk/core/src/main/java/org/infinispan/config/ConfigurationProperties.java
trunk/core/src/main/java/org/infinispan/config/ConfigurationProperty.java
trunk/core/src/main/java/org/infinispan/config/parsing/TreeNode.java
trunk/core/src/main/java/org/infinispan/config/parsing/TreeWalker.java
trunk/tools/src/main/java/org/infinispan/tools/schema/ConfigurationTreeWalker.java
Modified:
trunk/cachestore/bdbje/src/main/java/org/infinispan/loaders/bdbje/BdbjeCacheStoreConfig.java
trunk/cachestore/jdbc/src/main/java/org/infinispan/loaders/jdbc/binary/JdbcBinaryCacheStoreConfig.java
trunk/cachestore/jdbc/src/main/java/org/infinispan/loaders/jdbc/mixed/JdbcMixedCacheStoreConfig.java
trunk/cachestore/jdbc/src/main/java/org/infinispan/loaders/jdbc/stringbased/JdbcStringBasedCacheStoreConfig.java
trunk/cachestore/s3/src/main/java/org/infinispan/loaders/s3/S3CacheStoreConfig.java
trunk/core/src/main/java/org/infinispan/config/CacheLoaderManagerConfig.java
trunk/core/src/main/java/org/infinispan/config/Configuration.java
trunk/core/src/main/java/org/infinispan/config/CustomInterceptorConfig.java
trunk/core/src/main/java/org/infinispan/config/GlobalConfiguration.java
trunk/core/src/main/java/org/infinispan/config/InfinispanConfiguration.java
trunk/core/src/main/java/org/infinispan/config/PluggableConfigurationComponent.java
trunk/core/src/main/java/org/infinispan/loaders/AbstractCacheLoaderConfig.java
trunk/core/src/main/java/org/infinispan/loaders/AbstractCacheStoreConfig.java
trunk/core/src/main/java/org/infinispan/loaders/LockSupportCacheStoreConfig.java
trunk/core/src/main/java/org/infinispan/loaders/decorators/AsyncStoreConfig.java
trunk/core/src/main/java/org/infinispan/loaders/decorators/SingletonStoreConfig.java
trunk/core/src/main/java/org/infinispan/loaders/file/FileCacheStoreConfig.java
trunk/core/src/main/java/org/infinispan/util/TypedProperties.java
trunk/tools/pom.xml
trunk/tools/src/main/java/org/infinispan/tools/doclet/config/ConfigDoclet.java
trunk/tools/src/main/java/org/infinispan/tools/doclet/config/ConfigHtmlGenerator.java
trunk/tools/src/main/java/org/infinispan/tools/doclet/config/XMLTreeOutputWalker.java
Log:
[ISPN-89] - Improve configuration processing and maintenance
Rely solely on XSOM and javadoc tags to generate documentation
Remove all our custom annotations previously used for ISPN-89
Modified: trunk/cachestore/bdbje/src/main/java/org/infinispan/loaders/bdbje/BdbjeCacheStoreConfig.java
===================================================================
--- trunk/cachestore/bdbje/src/main/java/org/infinispan/loaders/bdbje/BdbjeCacheStoreConfig.java 2009-08-26 12:45:48 UTC (rev 739)
+++ trunk/cachestore/bdbje/src/main/java/org/infinispan/loaders/bdbje/BdbjeCacheStoreConfig.java 2009-08-26 12:59:39 UTC (rev 740)
@@ -1,9 +1,5 @@
package org.infinispan.loaders.bdbje;
-import org.infinispan.config.ConfigurationElement;
-import org.infinispan.config.ConfigurationElements;
-import org.infinispan.config.ConfigurationProperty;
-import org.infinispan.config.ConfigurationElement.Cardinality;
import org.infinispan.loaders.AbstractCacheStoreConfig;
/**
@@ -28,11 +24,6 @@
* @author Adrian Cole
* @since 4.0
*/
- at ConfigurationElements(elements = {
- @ConfigurationElement(name = "loader", parent = "loaders",
- description = "org.infinispan.loaders.bdbje.BdbjeCacheStore",
- cardinalityInParent = Cardinality.UNBOUNDED),
- @ConfigurationElement(name = "properties", parent = "loader")})
public class BdbjeCacheStoreConfig extends AbstractCacheStoreConfig {
private String location = "Infinispan-BdbjeCacheStore";
private long lockAcquistionTimeout = 60 * 1000;
@@ -54,7 +45,6 @@
}
}
- @ConfigurationProperty(name = "expiryDbNamePrefix", parentElement = "properties")
public void setExpiryDbNamePrefix(String expiryDbName) {
this.expiryDbPrefix = expiryDbName;
}
@@ -68,9 +58,6 @@
return maxTxRetries;
}
-
- @ConfigurationProperty(name = "maxTxRetries",
- parentElement = "properties")
public void setMaxTxRetries(int maxTxRetries) {
this.maxTxRetries = maxTxRetries;
}
@@ -80,9 +67,6 @@
return lockAcquistionTimeout;
}
-
- @ConfigurationProperty(name = "lockAcquistionTimeout",
- parentElement = "properties")
public void setLockAcquistionTimeout(long lockAcquistionTimeout) {
this.lockAcquistionTimeout = lockAcquistionTimeout;
}
@@ -91,9 +75,6 @@
return location;
}
-
- @ConfigurationProperty(name = "location",
- parentElement = "properties")
public void setLocation(String location) {
testImmutability("location");
this.location = location;
@@ -104,9 +85,6 @@
return cacheDbNamePrefix;
}
-
- @ConfigurationProperty(name = "cacheDbNamePrefix",
- parentElement = "properties")
public void setCacheDbNamePrefix(String cacheDbNamePrefix) {
this.cacheDbNamePrefix = cacheDbNamePrefix;
}
@@ -115,9 +93,6 @@
return catalogDbName;
}
-
- @ConfigurationProperty(name = "catalogDbName",
- parentElement = "properties")
public void setCatalogDbName(String catalogDbName) {
this.catalogDbName = catalogDbName;
}
Modified: trunk/cachestore/jdbc/src/main/java/org/infinispan/loaders/jdbc/binary/JdbcBinaryCacheStoreConfig.java
===================================================================
--- trunk/cachestore/jdbc/src/main/java/org/infinispan/loaders/jdbc/binary/JdbcBinaryCacheStoreConfig.java 2009-08-26 12:45:48 UTC (rev 739)
+++ trunk/cachestore/jdbc/src/main/java/org/infinispan/loaders/jdbc/binary/JdbcBinaryCacheStoreConfig.java 2009-08-26 12:59:39 UTC (rev 740)
@@ -1,9 +1,5 @@
package org.infinispan.loaders.jdbc.binary;
-import org.infinispan.config.ConfigurationElement;
-import org.infinispan.config.ConfigurationElements;
-import org.infinispan.config.ConfigurationProperty;
-import org.infinispan.config.ConfigurationElement.Cardinality;
import org.infinispan.loaders.LockSupportCacheStoreConfig;
import org.infinispan.loaders.jdbc.TableManipulation;
import org.infinispan.loaders.jdbc.connectionfactory.ConnectionFactoryConfig;
@@ -13,11 +9,6 @@
*
* @author Mircea.Markus at jboss.com
*/
- at ConfigurationElements(elements = {
- @ConfigurationElement(name = "loader", parent = "loaders",
- description = "org.infinispan.loaders.jdbc.binary.JdbcBinaryCacheStore",
- cardinalityInParent=Cardinality.UNBOUNDED),
- @ConfigurationElement(name = "properties", parent = "loader") })
public class JdbcBinaryCacheStoreConfig extends LockSupportCacheStoreConfig {
private ConnectionFactoryConfig connectionFactoryConfig = new ConnectionFactoryConfig();
@@ -45,8 +36,6 @@
/**
* If true, and the table is missing it will be created when starting the cache store. Default to <tt>true</tt>.
*/
- @ConfigurationProperty(name="createTableOnStart",
- parentElement="properties")
public void setCreateTableOnStart(boolean createTableOnStart) {
testImmutability("tableManipulation");
tableManipulation.setCreateTableOnStart(createTableOnStart);
@@ -55,7 +44,6 @@
/**
* If true, the table will be created when cache store is stopped. Default to <tt>false</tt>.
*/
- @ConfigurationProperty(name="dropTableOnExit", parentElement="properties")
public void setDropTableOnExit(boolean dropTableOnExit) {
testImmutability("tableManipulation");
this.tableManipulation.setDropTableOnExit(dropTableOnExit);
@@ -65,45 +53,37 @@
* Sets the prefix for the name of the table where the data will be stored. "_<cache name>" will be appended
* to this prefix in order to enforce unique table names for each cache.
*/
- @ConfigurationProperty(name="bucketTableNamePrefix", parentElement="properties")
public void setBucketTableNamePrefix(String bucketTableName) {
testImmutability("tableManipulation");
this.tableManipulation.setTableNamePrefix(bucketTableName);
}
-
- @ConfigurationProperty(name="idColumnName", parentElement="properties")
public void setIdColumnName(String idColumnName) {
testImmutability("tableManipulation");
this.tableManipulation.setIdColumnName(idColumnName);
}
- @ConfigurationProperty(name="idColumnType", parentElement="properties")
public void setIdColumnType(String idColumnType) {
testImmutability("tableManipulation");
this.tableManipulation.setIdColumnType(idColumnType);
}
- @ConfigurationProperty(name="dataColumnName", parentElement="properties")
public void setDataColumnName(String dataColumnName) {
testImmutability("tableManipulation");
this.tableManipulation.setDataColumnName(dataColumnName);
}
- @ConfigurationProperty(name="dataColumnType", parentElement="properties")
public void setDataColumnType(String dataColumnType) {
testImmutability("tableManipulation");
this.tableManipulation.setDataColumnType(dataColumnType);
}
- @ConfigurationProperty(name="timestampColumnName", parentElement="properties")
public void setTimestampColumnName(String timestampColumnName) {
testImmutability("tableManipulation");
this.tableManipulation.setTimestampColumnName(timestampColumnName);
}
- @ConfigurationProperty(name="timestampColumnType", parentElement="properties")
public void setTimestampColumnType(String timestampColumnType) {
testImmutability("tableManipulation");
this.tableManipulation.setTimestampColumnType(timestampColumnType);
@@ -113,7 +93,6 @@
* Url connection to the database.
*/
- @ConfigurationProperty(name="connectionUrl", parentElement="properties")
public void setConnectionUrl(String connectionUrl) {
testImmutability("connectionFactoryConfig");
this.connectionFactoryConfig.setConnectionUrl(connectionUrl);
@@ -122,7 +101,6 @@
/**
* Databse user name.
*/
- @ConfigurationProperty(name="userName", parentElement="properties")
public void setUserName(String userName) {
testImmutability("connectionFactoryConfig");
this.connectionFactoryConfig.setUserName(userName);
@@ -131,7 +109,6 @@
/**
* Database username's password.
*/
- @ConfigurationProperty(name="password", parentElement="properties")
public void setPassword(String password) {
testImmutability("connectionFactoryConfig");
this.connectionFactoryConfig.setPassword(password);
@@ -140,7 +117,6 @@
/**
* Driver class, will be loaded before initializing the {@link org.infinispan.loaders.jdbc.connectionfactory.ConnectionFactory}
*/
- @ConfigurationProperty(name="driverClass", parentElement="properties")
public void setDriverClass(String driverClass) {
testImmutability("connectionFactoryConfig");
this.connectionFactoryConfig.setDriverClass(driverClass);
@@ -151,7 +127,6 @@
*
* @see org.infinispan.loaders.jdbc.connectionfactory.ConnectionFactory
*/
- @ConfigurationProperty(name="connectionFactoryClass", parentElement="properties")
public void setConnectionFactoryClass(String connectionFactoryClass) {
testImmutability("connectionFactoryConfig");
this.connectionFactoryConfig.setConnectionFactoryClass(connectionFactoryClass);
@@ -182,7 +157,6 @@
/**
* @see org.infinispan.loaders.jdbc.TableManipulation#getFetchSize()
*/
- @ConfigurationProperty(name="fetchSize", parentElement="properties")
public void setFetchSize(int fetchSize) {
testImmutability("tableManipulation");
this.tableManipulation.setFetchSize(fetchSize);
@@ -191,7 +165,6 @@
/**
* @see org.infinispan.loaders.jdbc.TableManipulation#getBatchSize()
*/
- @ConfigurationProperty(name="batchSize", parentElement="properties")
public void setBatchSize(int batchSize) {
testImmutability("tableManipulation");
this.tableManipulation.setBatchSize(batchSize);
Modified: trunk/cachestore/jdbc/src/main/java/org/infinispan/loaders/jdbc/mixed/JdbcMixedCacheStoreConfig.java
===================================================================
--- trunk/cachestore/jdbc/src/main/java/org/infinispan/loaders/jdbc/mixed/JdbcMixedCacheStoreConfig.java 2009-08-26 12:45:48 UTC (rev 739)
+++ trunk/cachestore/jdbc/src/main/java/org/infinispan/loaders/jdbc/mixed/JdbcMixedCacheStoreConfig.java 2009-08-26 12:59:39 UTC (rev 740)
@@ -1,9 +1,5 @@
package org.infinispan.loaders.jdbc.mixed;
-import org.infinispan.config.ConfigurationElement;
-import org.infinispan.config.ConfigurationElements;
-import org.infinispan.config.ConfigurationProperty;
-import org.infinispan.config.ConfigurationElement.Cardinality;
import org.infinispan.loaders.AbstractCacheStoreConfig;
import org.infinispan.loaders.LockSupportCacheStoreConfig;
import org.infinispan.loaders.jdbc.TableManipulation;
@@ -16,11 +12,6 @@
*
* @author Mircea.Markus at jboss.com
*/
- at ConfigurationElements(elements = {
- @ConfigurationElement(name = "loader", parent = "loaders",
- description = "org.infinispan.loaders.jdbc.mixed.JdbcMixedCacheStore",
- cardinalityInParent = Cardinality.UNBOUNDED),
- @ConfigurationElement(name = "properties", parent = "loader")})
public class JdbcMixedCacheStoreConfig extends AbstractCacheStoreConfig {
private ConnectionFactoryConfig connectionFactoryConfig = new ConnectionFactoryConfig();
@@ -76,21 +67,16 @@
return config;
}
- @ConfigurationProperty(name = "idColumnNameForStrings",
- parentElement = "properties")
public void setIdColumnNameForStrings(String idColumnNameForStrings) {
testImmutability("stringsTableManipulation");
this.stringsTableManipulation.setIdColumnName(idColumnNameForStrings);
}
- @ConfigurationProperty(name = "idColumnTypeForStrings",
- parentElement = "properties")
public void setIdColumnTypeForStrings(String idColumnTypeForStrings) {
testImmutability("stringsTableManipulation");
this.stringsTableManipulation.setIdColumnType(idColumnTypeForStrings);
}
- @ConfigurationProperty(name = "tableNamePrefixForStrings", parentElement = "properties")
public void setTableNamePrefixForStrings(String tableNameForStrings) {
testImmutability("stringsTableManipulation");
if (tableNameForStrings == null) throw new IllegalArgumentException("Null table name not allowed.");
@@ -100,63 +86,45 @@
this.stringsTableManipulation.setTableNamePrefix(tableNameForStrings);
}
- @ConfigurationProperty(name = "dataColumnNameForStrings",
- parentElement = "properties")
public void setDataColumnNameForStrings(String dataColumnNameForStrings) {
testImmutability("stringsTableManipulation");
this.stringsTableManipulation.setDataColumnName(dataColumnNameForStrings);
}
- @ConfigurationProperty(name = "dataColumnTypeForStrings",
- parentElement = "properties")
public void setDataColumnTypeForStrings(String dataColumnTypeForStrings) {
testImmutability("stringsTableManipulation");
this.stringsTableManipulation.setDataColumnType(dataColumnTypeForStrings);
}
- @ConfigurationProperty(name = "timestampColumnNameForStrings",
- parentElement = "properties")
public void setTimestampColumnNameForStrings(String timestampColumnNameForStrings) {
testImmutability("stringsTableManipulation");
this.stringsTableManipulation.setTimestampColumnName(timestampColumnNameForStrings);
}
- @ConfigurationProperty(name = "timestampColumnTypeForStrings",
- parentElement = "properties")
public void setTimestampColumnTypeForStrings(String timestampColumnTypeForStrings) {
testImmutability("stringsTableManipulation");
this.stringsTableManipulation.setTimestampColumnType(timestampColumnTypeForStrings);
}
- @ConfigurationProperty(name = "createTableOnStartForStrings",
- parentElement = "properties")
public void setCreateTableOnStartForStrings(boolean createTableOnStartForStrings) {
testImmutability("stringsTableManipulation");
this.stringsTableManipulation.setCreateTableOnStart(createTableOnStartForStrings);
}
- @ConfigurationProperty(name = "dropTableOnExitForStrings",
- parentElement = "properties")
public void setDropTableOnExitForStrings(boolean dropTableOnExitForStrings) {
testImmutability("stringsTableManipulation");
this.stringsTableManipulation.setDropTableOnExit(dropTableOnExitForStrings);
}
- @ConfigurationProperty(name = "idColumnNameForBinary",
- parentElement = "properties")
public void setIdColumnNameForBinary(String idColumnNameForBinary) {
this.binaryTableManipulation.setIdColumnName(idColumnNameForBinary);
}
- @ConfigurationProperty(name = "idColumnTypeForBinary",
- parentElement = "properties")
public void setIdColumnTypeForBinary(String idColumnTypeForBinary) {
testImmutability("stringsTableManipulation");
this.binaryTableManipulation.setIdColumnType(idColumnTypeForBinary);
}
- @ConfigurationProperty(name = "tableNamePrefixForBinary",
- parentElement = "properties")
public void setTableNamePrefixForBinary(String tableNameForBinary) {
testImmutability("binaryTableManipulation");
if (tableNameForBinary == null) throw new IllegalArgumentException("Null table name not allowed.");
@@ -166,70 +134,50 @@
this.binaryTableManipulation.setTableNamePrefix(tableNameForBinary);
}
- @ConfigurationProperty(name = "dataColumnNameForBinary",
- parentElement = "properties")
public void setDataColumnNameForBinary(String dataColumnNameForBinary) {
testImmutability("binaryTableManipulation");
this.binaryTableManipulation.setDataColumnName(dataColumnNameForBinary);
}
- @ConfigurationProperty(name = "dataColumnTypeForBinary",
- parentElement = "properties")
public void setDataColumnTypeForBinary(String dataColumnTypeForBinary) {
testImmutability("binaryTableManipulation");
this.binaryTableManipulation.setDataColumnType(dataColumnTypeForBinary);
}
- @ConfigurationProperty(name = "timestampColumnNameForBinary",
- parentElement = "properties")
public void setTimestampColumnNameForBinary(String timestampColumnNameForBinary) {
testImmutability("binaryTableManipulation");
this.binaryTableManipulation.setTimestampColumnName(timestampColumnNameForBinary);
}
-
- @ConfigurationProperty(name = "timestampColumnTypeForBinary",
- parentElement = "properties")
+
public void setTimestampColumnTypeForBinary(String timestampColumnTypeForBinary) {
this.binaryTableManipulation.setTimestampColumnType(timestampColumnTypeForBinary);
}
- @ConfigurationProperty(name = "createTableOnStartForBinary",
- parentElement = "properties")
public void setCreateTableOnStartForBinary(boolean createTableOnStartForBinary) {
testImmutability("binaryTableManipulation");
this.binaryTableManipulation.setCreateTableOnStart(createTableOnStartForBinary);
}
-
- @ConfigurationProperty(name = "dropTableOnExitForBinary",
- parentElement = "properties")
+
public void setDropTableOnExitForBinary(boolean dropTableOnExitForBinary) {
testImmutability("binaryTableManipulation");
this.binaryTableManipulation.setDropTableOnExit(dropTableOnExitForBinary);
}
-
- @ConfigurationProperty(name = "driverClass",
- parentElement = "properties")
+
public void setDriverClass(String driverClass) {
testImmutability("connectionFactoryConfig");
this.connectionFactoryConfig.setDriverClass(driverClass);
}
- @ConfigurationProperty(name = "connectionUrl",
- parentElement = "properties")
public void setConnectionUrl(String connectionUrl) {
testImmutability("connectionFactoryConfig");
this.connectionFactoryConfig.setConnectionUrl(connectionUrl);
}
- @ConfigurationProperty(name = "userName",
- parentElement = "properties")
public void setUserName(String userName) {
testImmutability("connectionFactoryConfig");
this.connectionFactoryConfig.setUserName(userName);
}
- @ConfigurationProperty(name = "password",
- parentElement = "properties")
public void setPassword(String password) {
testImmutability("connectionFactoryConfig");
this.connectionFactoryConfig.setPassword(password);
@@ -240,7 +188,6 @@
*
* @see org.infinispan.loaders.jdbc.connectionfactory.ConnectionFactory
*/
- @ConfigurationProperty(name = "connectionFactoryClass", parentElement = "properties")
public void setConnectionFactoryClass(String connectionFactoryClass) {
testImmutability("connectionFactoryConfig");
this.connectionFactoryConfig.setConnectionFactoryClass(connectionFactoryClass);
@@ -250,29 +197,21 @@
return connectionFactoryConfig;
}
- @ConfigurationProperty(name = "key2StringMapperClass",
- parentElement = "properties")
public void setKey2StringMapperClass(String name) {
testImmutability("key2StringMapper");
this.key2StringMapper = name;
}
- @ConfigurationProperty(name = "lockConcurrencyLevelForStrings",
- parentElement = "properties")
public void setLockConcurrencyLevelForStrings(int concurrencyLevel) {
testImmutability("stringsConcurrencyLevel");
this.stringsConcurrencyLevel = concurrencyLevel;
}
- @ConfigurationProperty(name = "lockConcurrencyLevelForBinary",
- parentElement = "properties")
public void setLockConcurrencyLevelForBinary(int concurrencyLevel) {
testImmutability("binaryConcurrencyLevel");
this.binaryConcurrencyLevel = concurrencyLevel;
}
- @ConfigurationProperty(name = "lockAcquistionTimeout",
- parentElement = "properties")
public void setLockAcquistionTimeout(int lockAcquistionTimeout) {
testImmutability("lockAcquistionTimeout");
this.lockAcquistionTimeout = lockAcquistionTimeout;
@@ -281,8 +220,6 @@
/**
* @see org.infinispan.loaders.jdbc.TableManipulation#getFetchSize()
*/
- @ConfigurationProperty(name = "fetchSize",
- parentElement = "properties")
public void setFetchSize(int fetchSize) {
testImmutability("tableManipulation");
this.binaryTableManipulation.setFetchSize(fetchSize);
@@ -292,8 +229,6 @@
/**
* @see org.infinispan.loaders.jdbc.TableManipulation#getBatchSize()
*/
- @ConfigurationProperty(name = "batchSize",
- parentElement = "properties")
public void setBatchSize(int batchSize) {
testImmutability("tableManipulation");
this.binaryTableManipulation.setBatchSize(batchSize);
Modified: trunk/cachestore/jdbc/src/main/java/org/infinispan/loaders/jdbc/stringbased/JdbcStringBasedCacheStoreConfig.java
===================================================================
--- trunk/cachestore/jdbc/src/main/java/org/infinispan/loaders/jdbc/stringbased/JdbcStringBasedCacheStoreConfig.java 2009-08-26 12:45:48 UTC (rev 739)
+++ trunk/cachestore/jdbc/src/main/java/org/infinispan/loaders/jdbc/stringbased/JdbcStringBasedCacheStoreConfig.java 2009-08-26 12:59:39 UTC (rev 740)
@@ -1,9 +1,5 @@
package org.infinispan.loaders.jdbc.stringbased;
-import org.infinispan.config.ConfigurationElement;
-import org.infinispan.config.ConfigurationElements;
-import org.infinispan.config.ConfigurationProperty;
-import org.infinispan.config.ConfigurationElement.Cardinality;
import org.infinispan.loaders.LockSupportCacheStoreConfig;
import org.infinispan.loaders.jdbc.TableManipulation;
import org.infinispan.loaders.jdbc.connectionfactory.ConnectionFactoryConfig;
@@ -15,11 +11,6 @@
* @author Mircea.Markus at jboss.com
* @see org.infinispan.loaders.jdbc.stringbased.Key2StringMapper
*/
- at ConfigurationElements(elements = {
- @ConfigurationElement(name = "loader", parent = "loaders",
- description = "org.infinispan.loaders.jdbc.stringbased.JdbcStringBasedCacheStore",
- cardinalityInParent=Cardinality.UNBOUNDED),
- @ConfigurationElement(name = "properties", parent = "loader") })
public class JdbcStringBasedCacheStoreConfig extends LockSupportCacheStoreConfig {
private Key2StringMapper key2StringMapper;
@@ -59,8 +50,6 @@
*
* @see org.infinispan.loaders.jdbc.stringbased.Key2StringMapper
*/
- @ConfigurationProperty(name="key2StringMapper",
- parentElement="properties")
public void setKey2StringMapperClass(String className) {
testImmutability("key2StringMapper");
try {
@@ -74,7 +63,6 @@
* Sets the prefix for the name of the table where the data will be stored. "_<cache name>" will be appended
* to this prefix in order to enforce unique table names for each cache.
*/
- @ConfigurationProperty(name="stringsTableNamePrefix", parentElement="properties")
public void setStringsTableNamePrefix(String stringsTableNamePrefix) {
testImmutability("tableManipulation");
this.tableManipulation.setTableNamePrefix(stringsTableNamePrefix);
@@ -95,7 +83,6 @@
* </pre>
* Mandatory.
*/
- @ConfigurationProperty(name="idColumnName", parentElement="properties")
public void setIdColumnName(String idColumnName) {
testImmutability("tableManipulation");
this.tableManipulation.setIdColumnName(idColumnName);
@@ -104,7 +91,6 @@
/**
* Sets the name of the column where the StoredEntry will be binary stored. Mandatory.
*/
- @ConfigurationProperty(name="dataColumnName", parentElement="properties")
public void setDataColumnName(String dataColumnName) {
testImmutability("tableManipulation");
this.tableManipulation.setDataColumnName(dataColumnName);
@@ -113,7 +99,6 @@
/**
* Sets the name of the column where the timestamp (Long in java) will be stored. Mandatory.
*/
- @ConfigurationProperty(name="timestampColumnName", parentElement="properties")
public void setTimestampColumnName(String timestampColumnName) {
testImmutability("tableManipulation");
this.tableManipulation.setTimestampColumnName(timestampColumnName);
@@ -123,13 +108,11 @@
* Sets the prefix for the name of the table where the data will be stored. "_<cache name>" will be appended
* to this prefix in order to enforce unique table names for each cache.
*/
- @ConfigurationProperty(name="timestampColumnType", parentElement="properties")
public void setTimestampColumnType(String timestampColumnType) {
testImmutability("tableManipulation");
this.tableManipulation.setTimestampColumnType(timestampColumnType);
}
- @ConfigurationProperty(name="connectionFactoryClass", parentElement="properties")
public void setConnectionFactoryClass(String connectionFactoryClass) {
testImmutability("connectionFactoryConfig");
this.connectionFactoryConfig.setConnectionFactoryClass(connectionFactoryClass);
@@ -146,8 +129,6 @@
/**
* Jdbc connection string for connecting to the database. Mandatory.
*/
- @ConfigurationProperty(name="connectionUrl",
- parentElement="properties")
public void setConnectionUrl(String connectionUrl) {
testImmutability("connectionFactoryConfig");
this.connectionFactoryConfig.setConnectionUrl(connectionUrl);
@@ -156,8 +137,6 @@
/**
* Database username.
*/
- @ConfigurationProperty(name="userName",
- parentElement="properties")
public void setUserName(String userName) {
testImmutability("connectionFactoryConfig");
this.connectionFactoryConfig.setUserName(userName);
@@ -166,8 +145,6 @@
/**
* Database username's password.
*/
- @ConfigurationProperty(name="password",
- parentElement="properties")
public void setPassword(String password) {
testImmutability("connectionFactoryConfig");
this.connectionFactoryConfig.setPassword(password);
@@ -177,7 +154,6 @@
* The name of the driver used for connecting to the database. Mandatory, will be loaded before initiating the first
* connection.
*/
- @ConfigurationProperty(name="driverClass", parentElement="properties")
public void setDriverClass(String driverClassName) {
testImmutability("connectionFactoryConfig");
this.connectionFactoryConfig.setDriverClass(driverClassName);
@@ -186,7 +162,6 @@
/**
* sql equivalent for java's String. Mandatory.
*/
- @ConfigurationProperty(name="idColumnType", parentElement="properties")
public void setIdColumnType(String idColumnType) {
testImmutability("tableManipulation");
this.tableManipulation.setIdColumnType(idColumnType);
@@ -195,22 +170,16 @@
/**
* Sets the type of the column where data will be binary stored. BLOB-like type, DBMS dependent. Mandatory.
*/
- @ConfigurationProperty(name="dataColumnType", parentElement="properties")
public void setDataColumnType(String dataColumnType) {
testImmutability("tableManipulation");
this.tableManipulation.setDataColumnType(dataColumnType);
}
- @ConfigurationProperty(name="dropTableOnExit",
- parentElement="properties")
public void setDropTableOnExit(boolean dropTableOnExit) {
testImmutability("tableManipulation");
this.tableManipulation.setDropTableOnExit(dropTableOnExit);
}
-
- @ConfigurationProperty(name="createTableOnStart",
- parentElement="properties")
public void setCreateTableOnStart(boolean createTableOnStart) {
testImmutability("tableManipulation");
this.tableManipulation.setCreateTableOnStart(createTableOnStart);
@@ -233,8 +202,6 @@
/**
* @see org.infinispan.loaders.jdbc.TableManipulation#getFetchSize()
*/
- @ConfigurationProperty(name="fetchSize",
- parentElement="properties")
public void setFetchSize(int fetchSize) {
testImmutability("tableManipulation");
this.tableManipulation.setFetchSize(fetchSize);
@@ -243,8 +210,6 @@
/**
* @see org.infinispan.loaders.jdbc.TableManipulation#getBatchSize()
*/
- @ConfigurationProperty(name="batchSize",
- parentElement="properties")
public void setBatchSize(int batchSize) {
testImmutability("tableManipulation");
this.tableManipulation.setBatchSize(batchSize);
Modified: trunk/cachestore/s3/src/main/java/org/infinispan/loaders/s3/S3CacheStoreConfig.java
===================================================================
--- trunk/cachestore/s3/src/main/java/org/infinispan/loaders/s3/S3CacheStoreConfig.java 2009-08-26 12:45:48 UTC (rev 739)
+++ trunk/cachestore/s3/src/main/java/org/infinispan/loaders/s3/S3CacheStoreConfig.java 2009-08-26 12:59:39 UTC (rev 740)
@@ -1,9 +1,5 @@
package org.infinispan.loaders.s3;
-import org.infinispan.config.ConfigurationElement;
-import org.infinispan.config.ConfigurationElements;
-import org.infinispan.config.ConfigurationProperty;
-import org.infinispan.config.ConfigurationElement.Cardinality;
import org.infinispan.loaders.LockSupportCacheStoreConfig;
/**
@@ -19,11 +15,6 @@
* @author Adrian Cole
* @since 4.0
*/
- at ConfigurationElements(elements = {
- @ConfigurationElement(name = "loader", parent = "loaders",
- description = "org.infinispan.loaders.s3.S3CacheStore",
- cardinalityInParent=Cardinality.UNBOUNDED),
- @ConfigurationElement(name = "properties", parent = "loader") })
public class S3CacheStoreConfig extends LockSupportCacheStoreConfig {
private String awsAccessKey;
private String awsSecretKey;
@@ -40,8 +31,6 @@
return requestTimeout;
}
- @ConfigurationProperty(name="requestTimeout",
- parentElement="properties")
public void setRequestTimeout(long requestTimeout) {
this.requestTimeout = requestTimeout;
}
@@ -51,8 +40,6 @@
return maxConnections;
}
- @ConfigurationProperty(name="maxConnections",
- parentElement="properties")
public void setMaxConnections(int maxConnections) {
this.maxConnections = maxConnections;
}
@@ -64,8 +51,6 @@
return secure;
}
- @ConfigurationProperty(name="secure",
- parentElement="properties")
public void setSecure(boolean secure) {
this.secure = secure;
}
@@ -80,8 +65,6 @@
}
- @ConfigurationProperty(name="awsAccessKey",
- parentElement="properties")
public void setAwsAccessKey(String awsAccessKey) {
this.awsAccessKey = awsAccessKey;
}
@@ -90,9 +73,6 @@
return awsSecretKey;
}
-
- @ConfigurationProperty(name="awsSecretKey",
- parentElement="properties")
public void setAwsSecretKey(String awsSecretKey) {
this.awsSecretKey = awsSecretKey;
}
@@ -101,8 +81,6 @@
return bucketPrefix;
}
- @ConfigurationProperty(name="bucketPrefix",
- parentElement="properties")
public void setBucketPrefix(String bucketPrefix) {
this.bucketPrefix = bucketPrefix;
}
@@ -111,8 +89,6 @@
return proxyHost;
}
- @ConfigurationProperty(name="proxyHost",
- parentElement="properties")
public void setProxyHost(String proxyHost) {
this.proxyHost = proxyHost;
}
@@ -121,8 +97,6 @@
return proxyPort;
}
- @ConfigurationProperty(name="proxyPort",
- parentElement="properties")
public void setProxyPort(int proxyPort) {
this.proxyPort = proxyPort;
}
Modified: trunk/core/src/main/java/org/infinispan/config/CacheLoaderManagerConfig.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/config/CacheLoaderManagerConfig.java 2009-08-26 12:45:48 UTC (rev 739)
+++ trunk/core/src/main/java/org/infinispan/config/CacheLoaderManagerConfig.java 2009-08-26 12:59:39 UTC (rev 740)
@@ -41,6 +41,8 @@
* configuration files are read into instances of configuration class hierarchy as well as they
* provide meta data for configuration file XML schema generation. Please modify these annotations
* and Java element types they annotate with utmost understanding and care.
+ *
+ * @configRef loaders
*
* @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
* @author Brian Stansberry
@@ -48,35 +50,30 @@
* @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
* @since 4.0
*/
- at ConfigurationElement(name="loaders",parent="default")
@XmlAccessorType(XmlAccessType.FIELD)
public class CacheLoaderManagerConfig extends AbstractNamedCacheConfigurationBean {
private static final long serialVersionUID = 2210349340378984424L;
@XmlAttribute
- private Boolean passivation = false;
+ protected Boolean passivation = false;
@XmlAttribute
- private Boolean preload = false;
+ protected Boolean preload = false;
@XmlAttribute
- private Boolean shared = false;
+ protected Boolean shared = false;
@XmlElement(name="loader")
- private List<CacheLoaderConfig> cacheLoaderConfigs = new LinkedList<CacheLoaderConfig>();
+ protected List<CacheLoaderConfig> cacheLoaderConfigs = new LinkedList<CacheLoaderConfig>();
- @ConfigurationAttribute(name = "preload",
- containingElement = "loaders")
+
public void setPreload(boolean preload) {
testImmutability("preload");
this.preload = preload;
}
-
- @ConfigurationAttribute(name = "passivation",
- containingElement = "loaders")
public void setPassivation(boolean passivation) {
testImmutability("passivation");
this.passivation = passivation;
@@ -117,9 +114,6 @@
cacheLoaderConfigs.size()).append('}').toString();
}
-
- @ConfigurationAttribute(name = "shared",
- containingElement = "loaders")
public void setShared(boolean shared) {
testImmutability("shared");
this.shared = shared;
Modified: trunk/core/src/main/java/org/infinispan/config/Configuration.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/config/Configuration.java 2009-08-26 12:45:48 UTC (rev 739)
+++ trunk/core/src/main/java/org/infinispan/config/Configuration.java 2009-08-26 12:59:39 UTC (rev 740)
@@ -21,7 +21,6 @@
*/
package org.infinispan.config;
-import org.infinispan.CacheException;
import org.infinispan.distribution.DefaultConsistentHash;
import org.infinispan.eviction.EvictionStrategy;
import org.infinispan.factories.annotations.Inject;
@@ -30,6 +29,7 @@
import org.infinispan.transaction.lookup.GenericTransactionManagerLookup;
import org.infinispan.transaction.lookup.TransactionManagerLookup;
import org.infinispan.util.concurrent.IsolationLevel;
+import org.infinispan.CacheException;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
@@ -39,6 +39,7 @@
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -46,63 +47,49 @@
/**
* Encapsulates the configuration of a Cache.
- * <p/>
- * <p/>
- * Note that class Configuration contains JAXB annotations. These annotations determine how XML configuration files are
- * read into instances of configuration class hierarchy as well as they provide meta data for configuration file XML
- * schema generation. Please modify these annotations and Java element types they annotate with utmost understanding and
- * care.
- *
+ *
+ * <p>
+ * Note that class Configuration contains JAXB annotations. These annotations determine how XML
+ * configuration files are read into instances of configuration class hierarchy as well as they
+ * provide meta data for configuration file XML schema generation. Please modify these annotations
+ * and Java element types they annotate with utmost understanding and care.
+ *
+ *
+ *
+ *
+ * @configRef default|Configures the default cache and acts as a template for other named caches defined.
+ * @configRef namedCache
+ *
* @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
* @author Vladimir Blagojevic
* @author Galder Zamarreño
* @since 4.0
*/
@NonVolatile
- at ConfigurationElements(elements = {
- @ConfigurationElement(name = "default", parent = "infinispan", description = "This section configures the default cache. This is also used as a template for other named caches defined."),
- @ConfigurationElement(name = "namedCache", parent = "infinispan", description = "This section overrides the default cache configuration. Named sections are applied to caches obtained via CacheManager.getCache(name)."),
- @ConfigurationElement(name = "locking", parent = "default", description = "This element defines locking characteristics of the cache."),
- @ConfigurationElement(name = "transaction", parent = "default", description = "This element defines transactionat (JTA) characteristics of the cache."),
- @ConfigurationElement(name = "jmxStatistics", parent = "default", description = "This element defines how JMX components are bound to an MBean server."),
- @ConfigurationElement(name = "lazyDeserialization", parent = "default", description = "This element defines lazy deserialization characteristics of the cache."),
- @ConfigurationElement(name = "invocationBatching", parent = "default", description = "This section defines whether invocation batching is allowed in this cache instance."),
- @ConfigurationElement(name = "clustering", parent = "default", description = "This section defines clustering characteristics of the cache."),
- @ConfigurationElement(name = "stateRetrieval", parent = "clustering", description = "This section configures how state retrieval is performed on new caches in a cluster."),
- @ConfigurationElement(name = "sync", parent = "clustering", description = "Specifies that network communications are synchronous. Charcteristics of this can be tuned here."),
- @ConfigurationElement(name = "hash", parent = "clustering", description = "Allows you to fine-tune rehashing characteristics. Only used with the 'distributed' cache mode, and otherwise ignored."),
- @ConfigurationElement(name = "l1", parent = "clustering", description = "Enables and defines details of the L1 cache. Only used with the 'distributed' cache mode, and otherwise ignored."),
- @ConfigurationElement(name = "async", parent = "clustering", description = "Specifies that network communications are asynchronous. Charcteristics of this can be tuned here."),
- @ConfigurationElement(name = "eviction", parent = "default", description = "Enables or disables eviction, and configures characteristics accordingly."),
- @ConfigurationElement(name = "expiration", parent = "default", description = "Enables or disables expiration, and configures characteristics accordingly."),
- @ConfigurationElement(name = "unsafe", parent = "default", description = "Allows you to tune various unsafe or non-standard characteristics. Use with care."),
- @ConfigurationElement(name = "deadlockDetection", parent = "default", description = "Enables or disables, and tunes, deadlock detection."),
- @ConfigurationElement(name = "customInterceptors", parent = "default", description = "Configures custom interceptors to be added to the cache.")
-})
@XmlAccessorType(XmlAccessType.FIELD)
- at XmlType(propOrder = {})
-public class Configuration extends AbstractNamedCacheConfigurationBean {
+ at XmlType(propOrder={})
+public class Configuration extends AbstractNamedCacheConfigurationBean {
private static final long serialVersionUID = 5553791890144997466L;
// reference to a global configuration
@XmlTransient
private GlobalConfiguration globalConfiguration;
-
+
@XmlAttribute
- private String name;
+ protected String name;
// ------------------------------------------------------------------------------------------------------------
// CONFIGURATION OPTIONS
// ------------------------------------------------------------------------------------------------------------
-
+
@XmlElement
private LockingType locking = new LockingType();
-
+
@XmlElement
private CacheLoaderManagerConfig loaders = new CacheLoaderManagerConfig();
-
+
@XmlElement
private TransactionType transaction = new TransactionType(null);
@@ -120,20 +107,20 @@
@XmlElement
private ClusteringType clustering = new ClusteringType();
-
+
@XmlElement
private BooleanAttributeType jmxStatistics = new BooleanAttributeType();
-
+
@XmlElement
private BooleanAttributeType lazyDeserialization = new BooleanAttributeType();
-
+
@XmlElement
private BooleanAttributeType invocationBatching = new BooleanAttributeType();
-
+
@XmlElement
private DeadlockDetectionType deadlockDetection = new DeadlockDetectionType();
+
-
@SuppressWarnings("unused")
@Start(priority = 1)
private void correctIsolationLevels() {
@@ -166,8 +153,9 @@
private void injectGlobalConfiguration(GlobalConfiguration globalConfiguration) {
this.globalConfiguration = globalConfiguration;
}
+
+
-
public boolean isStateTransferEnabled() {
return clustering.stateRetrieval.fetchInMemoryState || (loaders != null && loaders.isFetchPersistentState());
}
@@ -177,7 +165,7 @@
return deadlockDetection.spinDuration;
}
- @ConfigurationAttribute(name = "spinDuration", containingElement = "deadlockDetection", description = "Allows you to tune how long the inner deadlock detection loop should spin for (in milliseconds)", defaultValue = "100")
+
public void setDeadlockDetectionSpinDuration(long eagerDeadlockSpinDuration) {
this.deadlockDetection.setSpinDuration(eagerDeadlockSpinDuration);
}
@@ -187,7 +175,6 @@
return deadlockDetection.enabled;
}
- @ConfigurationAttribute(name = "enabled", containingElement = "deadlockDetection", description = "Enables deadlock detection.", defaultValue = "false")
public void setEnableDeadlockDetection(boolean useEagerDeadlockDetection) {
this.deadlockDetection.setEnabled(useEagerDeadlockDetection);
}
@@ -203,14 +190,11 @@
public boolean isUnsafeUnreliableReturnValues() {
return unsafe.unreliableReturnValues;
}
-
- @ConfigurationAttribute(name = "unreliableReturnValues", containingElement = "unsafe", description = "If enabled, forces distribution code to skip looking up remote values when overwriting, rendering return values from certain methods (e.g., Cache.put()) unreliable. Use with care. Only used with 'distributed' cache mode.", defaultValue = "false")
+
public void setUnsafeUnreliableReturnValues(boolean unsafeUnreliableReturnValues) {
this.unsafe.setUnreliableReturnValues(unsafeUnreliableReturnValues);
}
-
- @ConfigurationAttribute(name = "rehashRpcTimeout",
- containingElement = "hash", description = "Timeout for rehash-related RPC calls, in milliseconds.", defaultValue = "600000")
+
public void setRehashRpcTimeout(long rehashRpcTimeout) {
this.clustering.hash.setRehashRpcTimeout(rehashRpcTimeout);
}
@@ -218,14 +202,10 @@
public long getRehashRpcTimeout() {
return clustering.hash.rehashRpcTimeout;
}
-
public boolean isWriteSkewCheck() {
return locking.writeSkewCheck;
}
-
- @ConfigurationAttribute(name = "writeSkewCheck",
- containingElement = "locking")
public void setWriteSkewCheck(boolean writeSkewCheck) {
locking.setWriteSkewCheck(writeSkewCheck);
}
@@ -235,20 +215,15 @@
}
- @ConfigurationAttribute(name = "concurrencyLevel",
- containingElement = "locking")
+
public void setConcurrencyLevel(int concurrencyLevel) {
locking.setConcurrencyLevel(concurrencyLevel);
}
- @ConfigurationAttribute(name = "replQueueMaxElements",
- containingElement = "async")
public void setReplQueueMaxElements(int replQueueMaxElements) {
this.clustering.async.setReplQueueMaxElements(replQueueMaxElements);
}
- @ConfigurationAttribute(name = "replQueueInterval",
- containingElement = "async")
public void setReplQueueInterval(long replQueueInterval) {
this.clustering.async.setReplQueueInterval(replQueueInterval);
}
@@ -257,8 +232,7 @@
setReplQueueInterval(timeUnit.toMillis(replQueueInterval));
}
- @ConfigurationAttribute(name = "enabled",
- containingElement = "jmxStatistics")
+
public void setExposeJmxStatistics(boolean useMbean) {
jmxStatistics.setEnabled(useMbean);
}
@@ -271,21 +245,14 @@
* @param enabled if true, batching is enabled.
* @since 4.0
*/
-
- @ConfigurationAttribute(name = "enabled",
- containingElement = "invocationBatching")
public void setInvocationBatchingEnabled(boolean enabled) {
invocationBatching.setEnabled(enabled);
}
- @ConfigurationAttribute(name = "fetchInMemoryState",
- containingElement = "stateRetrieval")
public void setFetchInMemoryState(boolean fetchInMemoryState) {
this.clustering.stateRetrieval.setFetchInMemoryState(fetchInMemoryState);
}
- @ConfigurationAttribute(name = "lockAcquisitionTimeout",
- containingElement = "locking")
public void setLockAcquisitionTimeout(long lockAcquisitionTimeout) {
locking.setLockAcquisitionTimeout(lockAcquisitionTimeout);
}
@@ -294,8 +261,6 @@
setLockAcquisitionTimeout(timeUnit.toMillis(lockAcquisitionTimeout));
}
- @ConfigurationAttribute(name = "replTimeout",
- containingElement = "sync")
public void setSyncReplTimeout(long syncReplTimeout) {
this.clustering.sync.setReplTimeout(syncReplTimeout);
}
@@ -307,9 +272,7 @@
public void setCacheMode(CacheMode cacheModeInt) {
clustering.setMode(cacheModeInt);
}
-
- @ConfigurationAttribute(name = "mode",
- containingElement = "clustering", allowedValues = {"LOCAL", "REPL", "INVALIDATION", "DIST"})
+
public void setCacheMode(String cacheMode) {
if (cacheMode == null) throw new ConfigurationException("Cache mode cannot be null", "CacheMode");
clustering.setMode(CacheMode.valueOf(uc(cacheMode)));
@@ -331,8 +294,6 @@
return eviction.wakeUpInterval;
}
- @ConfigurationAttribute(name = "wakeUpInterval",
- containingElement = "eviction")
public void setEvictionWakeUpInterval(long evictionWakeUpInterval) {
this.eviction.setWakeUpInterval(evictionWakeUpInterval);
}
@@ -344,10 +305,8 @@
public void setEvictionStrategy(EvictionStrategy evictionStrategy) {
this.eviction.setStrategy(evictionStrategy);
}
-
- @ConfigurationAttribute(name = "strategy",
- containingElement = "eviction", allowedValues = {"NONE", "FIFO", "LRU"})
- public void setEvictionStrategy(String eStrategy) {
+
+ public void setEvictionStrategy(String eStrategy){
this.eviction.strategy = EvictionStrategy.valueOf(uc(eStrategy));
if (this.eviction.strategy == null) {
log.warn("Unknown evictionStrategy '" + eStrategy + "', using defaults.");
@@ -359,8 +318,6 @@
return eviction.maxEntries;
}
- @ConfigurationAttribute(name = "maxEntries",
- containingElement = "eviction")
public void setEvictionMaxEntries(int evictionMaxEntries) {
this.eviction.setMaxEntries(evictionMaxEntries);
}
@@ -369,8 +326,6 @@
return expiration.lifespan;
}
- @ConfigurationAttribute(name = "lifespan",
- containingElement = "expiration")
public void setExpirationLifespan(long expirationLifespan) {
this.expiration.setLifespan(expirationLifespan);
}
@@ -379,20 +334,14 @@
return expiration.maxIdle;
}
- @ConfigurationAttribute(name = "maxIdle",
- containingElement = "expiration")
public void setExpirationMaxIdle(long expirationMaxIdle) {
this.expiration.setMaxIdle(expirationMaxIdle);
}
- @ConfigurationAttribute(name = "transactionManagerLookupClass",
- containingElement = "transaction",
- description = "",
- defaultValue = "org.infinispan.transaction.lookup.GenericTransactionManagerLookup")
public void setTransactionManagerLookupClass(String transactionManagerLookupClass) {
this.transaction.setTransactionManagerLookupClass(transactionManagerLookupClass);
}
-
+
public void setTransactionManagerLookup(TransactionManagerLookup transactionManagerLookup) {
this.transaction.transactionManagerLookup = transactionManagerLookup;
}
@@ -401,26 +350,18 @@
this.loaders = cacheLoaderManagerConfig;
}
- @ConfigurationAttribute(name = "syncCommitPhase",
- containingElement = "transaction")
public void setSyncCommitPhase(boolean syncCommitPhase) {
this.transaction.setSyncCommitPhase(syncCommitPhase);
}
- @ConfigurationAttribute(name = "syncRollbackPhase",
- containingElement = "transaction")
public void setSyncRollbackPhase(boolean syncRollbackPhase) {
this.transaction.setSyncRollbackPhase(syncRollbackPhase);
}
-
- @ConfigurationAttribute(name = "useEagerLocking",
- containingElement = "transaction")
+
public void setUseEagerLocking(boolean useEagerLocking) {
this.transaction.setUseEagerLocking(useEagerLocking);
}
- @ConfigurationAttribute(name = "useReplQueue",
- containingElement = "async")
public void setUseReplQueue(boolean useReplQueue) {
this.clustering.async.setUseReplQueue(useReplQueue);
}
@@ -429,8 +370,6 @@
locking.setIsolationLevel(isolationLevel);
}
- @ConfigurationAttribute(name = "timeout",
- containingElement = "stateRetrieval")
public void setStateRetrievalTimeout(long stateRetrievalTimeout) {
this.clustering.stateRetrieval.setTimeout(stateRetrievalTimeout);
}
@@ -438,10 +377,7 @@
public void setStateRetrievalTimeout(long stateRetrievalTimeout, TimeUnit timeUnit) {
setStateRetrievalTimeout(timeUnit.toMillis(stateRetrievalTimeout));
}
-
- @ConfigurationAttribute(name = "isolationLevel",
- containingElement = "locking",
- allowedValues = {"NONE", "SERIALIZABLE", "REPEATABLE_READ", "READ_COMMITTED", "READ_UNCOMMITTED"})
+
public void setIsolationLevel(String isolationLevel) {
if (isolationLevel == null) throw new ConfigurationException("Isolation level cannot be null", "IsolationLevel");
locking.setIsolationLevel(IsolationLevel.valueOf(uc(isolationLevel)));
@@ -450,52 +386,35 @@
locking.setIsolationLevel(IsolationLevel.REPEATABLE_READ);
}
}
-
- @ConfigurationAttribute(name = "enabled",
- containingElement = "lazyDeserialization")
+
public void setUseLazyDeserialization(boolean useLazyDeserialization) {
lazyDeserialization.setEnabled(useLazyDeserialization);
}
- @ConfigurationAttribute(name = "enabled",
- containingElement = "l1")
public void setL1CacheEnabled(boolean l1CacheEnabled) {
this.clustering.l1.setEnabled(l1CacheEnabled);
}
-
- @ConfigurationAttribute(name = "lifespan",
- containingElement = "l1")
public void setL1Lifespan(long l1Lifespan) {
this.clustering.l1.setLifespan(l1Lifespan);
}
- @ConfigurationAttribute(name = "onRehash",
- containingElement = "l1")
public void setL1OnRehash(boolean l1OnRehash) {
this.clustering.l1.setOnRehash(l1OnRehash);
}
- @ConfigurationAttribute(name = "consistentHashClass",
- containingElement = "hash")
public void setConsistentHashClass(String consistentHashClass) {
this.clustering.hash.setConsistentHashClass(consistentHashClass);
}
-
- @ConfigurationAttribute(name = "numOwners",
- containingElement = "hash")
+
public void setNumOwners(int numOwners) {
this.clustering.hash.setNumOwners(numOwners);
}
-
- @ConfigurationAttribute(name = "rehashWait",
- containingElement = "hash")
+
public void setRehashWaitTime(long rehashWaitTime) {
this.clustering.hash.setRehashWait(rehashWaitTime);
}
-
- @ConfigurationAttribute(name = "asyncMarshalling",
- containingElement = "async")
+
public void setUseAsyncMarshalling(boolean useAsyncMarshalling) {
this.clustering.async.setAsyncMarshalling(useAsyncMarshalling);
}
@@ -529,7 +448,7 @@
* @since 4.0
*/
public boolean isInvocationBatchingEnabled() {
- return invocationBatching.enabled;
+ return invocationBatching.enabled ;
}
public boolean isFetchInMemoryState() {
@@ -571,7 +490,7 @@
public boolean isSyncRollbackPhase() {
return transaction.syncRollbackPhase;
}
-
+
public boolean isUseEagerLocking() {
return transaction.useEagerLocking;
}
@@ -629,9 +548,8 @@
if (expiration.lifespan != that.expiration.lifespan) return false;
if (expiration.maxIdle != that.expiration.maxIdle) return false;
if (jmxStatistics.enabled != that.jmxStatistics.enabled) return false;
- if (clustering.stateRetrieval.fetchInMemoryState != that.clustering.stateRetrieval.fetchInMemoryState)
- return false;
- if (invocationBatching.enabled != that.invocationBatching.enabled) return false;
+ if (clustering.stateRetrieval.fetchInMemoryState != that.clustering.stateRetrieval.fetchInMemoryState) return false;
+ if (invocationBatching.enabled != that.invocationBatching.enabled ) return false;
if (clustering.l1.enabled != that.clustering.l1.enabled) return false;
if (clustering.l1.lifespan != that.clustering.l1.lifespan) return false;
if (clustering.hash.rehashWait != that.clustering.hash.rehashWait) return false;
@@ -691,7 +609,7 @@
result = 31 * result + (customInterceptors.customInterceptors != null ? customInterceptors.customInterceptors.hashCode() : 0);
result = 31 * result + (locking.writeSkewCheck ? 1 : 0);
result = 31 * result + locking.concurrencyLevel;
- result = 31 * result + (invocationBatching.enabled ? 1 : 0);
+ result = 31 * result + (invocationBatching.enabled ? 1 : 0);
result = 31 * result + (int) (eviction.wakeUpInterval ^ (eviction.wakeUpInterval >>> 32));
result = 31 * result + (eviction.strategy != null ? eviction.strategy.hashCode() : 0);
result = 31 * result + eviction.maxEntries;
@@ -712,7 +630,7 @@
public Configuration clone() {
try {
Configuration dolly = (Configuration) super.clone();
- if (globalConfiguration != null) dolly.globalConfiguration = globalConfiguration.clone();
+ if (globalConfiguration!= null) dolly.globalConfiguration = globalConfiguration.clone();
if (locking != null) dolly.locking = (LockingType) locking.clone();
if (loaders != null) dolly.loaders = loaders.clone();
if (transaction != null) dolly.transaction = (TransactionType) transaction.clone();
@@ -722,13 +640,12 @@
if (unsafe != null) dolly.unsafe = (UnsafeType) unsafe.clone();
if (clustering != null) dolly.clustering = clustering.clone();
if (jmxStatistics != null) dolly.jmxStatistics = (BooleanAttributeType) jmxStatistics.clone();
- if (lazyDeserialization != null)
- dolly.lazyDeserialization = (BooleanAttributeType) lazyDeserialization.clone();
+ if (lazyDeserialization != null) dolly.lazyDeserialization = (BooleanAttributeType) lazyDeserialization.clone();
if (invocationBatching != null) dolly.invocationBatching = (BooleanAttributeType) invocationBatching.clone();
if (deadlockDetection != null) dolly.deadlockDetection = (DeadlockDetectionType) deadlockDetection.clone();
return dolly;
} catch (CloneNotSupportedException e) {
- throw new CacheException("Unexpected!", e);
+ throw new CacheException("Unexpected!",e);
}
}
@@ -753,7 +670,7 @@
public void setCustomInterceptors(List<CustomInterceptorConfig> customInterceptors) {
testImmutability("customInterceptors");
this.customInterceptors.customInterceptors = customInterceptors;
- }
+ }
public void assertValid() throws ConfigurationException {
// certain combinations are illegal, such as state transfer + DIST
@@ -764,33 +681,35 @@
public boolean isOnePhaseCommit() {
return !getCacheMode().isSynchronous();
}
-
+
+ /**
+ *
+ * @configRef transaction|Defines transactional (JTA) characteristics of the cache.
+ */
@XmlAccessorType(XmlAccessType.PROPERTY)
- private static class TransactionType extends AbstractNamedCacheConfigurationBean {
-
- /**
- * The serialVersionUID
- */
+ private static class TransactionType extends AbstractNamedCacheConfigurationBean{
+
+ /** The serialVersionUID */
private static final long serialVersionUID = -3867090839830874603L;
- private String transactionManagerLookupClass;
-
+ protected String transactionManagerLookupClass;
+
@XmlTransient
- private TransactionManagerLookup transactionManagerLookup;
-
+ protected TransactionManagerLookup transactionManagerLookup;
+
@Dynamic
- private Boolean syncCommitPhase = false;
-
+ protected Boolean syncCommitPhase = false;
+
@Dynamic
- private Boolean syncRollbackPhase = false;
-
+ protected Boolean syncRollbackPhase = false;
+
@Dynamic
- private Boolean useEagerLocking = false;
-
+ protected Boolean useEagerLocking = false;
+
public TransactionType(String transactionManagerLookupClass) {
this.transactionManagerLookupClass = transactionManagerLookupClass;
}
-
+
public TransactionType() {
this.transactionManagerLookupClass = GenericTransactionManagerLookup.class.getName();
}
@@ -798,7 +717,7 @@
@XmlAttribute
public void setTransactionManagerLookupClass(String transactionManagerLookupClass) {
testImmutability("transactionManagerLookupClass");
- this.transactionManagerLookupClass = transactionManagerLookupClass;
+ this.transactionManagerLookupClass = transactionManagerLookupClass;
}
@XmlAttribute
@@ -819,33 +738,36 @@
this.useEagerLocking = useEagerLocking;
}
}
-
+ /**
+ *
+ * @configRef locking|Defines locking characteristics of the cache.
+ */
@XmlAccessorType(XmlAccessType.PROPERTY)
- private static class LockingType extends AbstractNamedCacheConfigurationBean {
+ private static class LockingType extends AbstractNamedCacheConfigurationBean{
+
-
- /**
- * The serialVersionUID
- */
+ /** The serialVersionUID */
private static final long serialVersionUID = 8142143187082119506L;
@Dynamic
- private Long lockAcquisitionTimeout = 10000L;
-
- private IsolationLevel isolationLevel = IsolationLevel.READ_COMMITTED;
-
- private Boolean writeSkewCheck = false;
-
- private Boolean useLockStriping = true;
-
- private Integer concurrencyLevel = 500;
-
- @XmlAttribute
+ protected Long lockAcquisitionTimeout = 10000L;
+
+ protected IsolationLevel isolationLevel = IsolationLevel.READ_COMMITTED;
+
+ protected Boolean writeSkewCheck = false;
+
+ protected Boolean useLockStriping = true;
+
+ protected Integer concurrencyLevel = 500;
+
+
+ @XmlAttribute
public void setLockAcquisitionTimeout(Long lockAcquisitionTimeout) {
testImmutability("lockAcquisitionTimeout");
this.lockAcquisitionTimeout = lockAcquisitionTimeout;
}
+
@XmlAttribute
public void setIsolationLevel(IsolationLevel isolationLevel) {
testImmutability("isolationLevel");
@@ -858,6 +780,7 @@
this.writeSkewCheck = writeSkewCheck;
}
+
@XmlAttribute
public void setUseLockStriping(Boolean useLockStriping) {
testImmutability("useLockStriping");
@@ -869,49 +792,51 @@
testImmutability("concurrencyLevel");
this.concurrencyLevel = concurrencyLevel;
}
- }
-
+ }
+
+ /**
+ *
+ * @configRef clustering|Defines clustering characteristics of the cache.
+ */
@XmlJavaTypeAdapter(ClusteringTypeAdapter.class)
@XmlAccessorType(XmlAccessType.FIELD)
- @XmlType(propOrder = {})
+ @XmlType(propOrder={})
private static class ClusteringType extends AbstractNamedCacheConfigurationBean {
-
- /**
- * The serialVersionUID
- */
+
+ /** The serialVersionUID */
private static final long serialVersionUID = 4048135465543498430L;
+
+ @XmlAttribute(name="mode")
+ protected String stringMode;
- @XmlAttribute(name = "mode")
- private String stringMode;
-
@XmlTransient
- private CacheMode mode = CacheMode.LOCAL;
-
+ protected CacheMode mode = CacheMode.LOCAL;
+
@XmlElement
- private SyncType sync = new SyncType();
-
+ protected SyncType sync = new SyncType();
+
@XmlElement
- private StateRetrievalType stateRetrieval = new StateRetrievalType();
-
+ protected StateRetrievalType stateRetrieval = new StateRetrievalType();
+
@XmlElement
- private L1Type l1 = new L1Type();
-
+ protected L1Type l1 = new L1Type();
+
@XmlElement
- private AsyncType async = new AsyncType(false);
-
+ protected AsyncType async = new AsyncType(false);
+
@XmlElement
- private HashType hash = new HashType();
+ protected HashType hash = new HashType();
-
+
public void setMode(CacheMode mode) {
testImmutability("mode");
this.mode = mode;
}
-
+
public boolean isSynchronous() {
return !async.readFromXml;
}
-
+
@Override
public ClusteringType clone() throws CloneNotSupportedException {
ClusteringType dolly = (ClusteringType) super.clone();
@@ -923,67 +848,70 @@
return dolly;
}
}
-
+
private static class ClusteringTypeAdapter extends XmlAdapter<ClusteringType, ClusteringType> {
@Override
public ClusteringType marshal(ClusteringType ct) throws Exception {
- return ct;
+ return ct;
}
@Override
public ClusteringType unmarshal(ClusteringType ct) throws Exception {
- if (ct.stringMode != null) {
+ if(ct.stringMode != null){
String mode = ct.stringMode.toLowerCase();
- if (mode.startsWith("r")) {
- if (ct.isSynchronous())
+ if(mode.startsWith("r")){
+ if(ct.isSynchronous())
ct.setMode(CacheMode.REPL_SYNC);
- else
+ else
ct.setMode(CacheMode.REPL_ASYNC);
- } else if (mode.startsWith("i")) {
- if (ct.isSynchronous())
+ } else if (mode.startsWith("i")){
+ if(ct.isSynchronous())
ct.setMode(CacheMode.INVALIDATION_SYNC);
- else
+ else
ct.setMode(CacheMode.INVALIDATION_ASYNC);
- } else if (mode.startsWith("d")) {
- if (ct.isSynchronous())
+ } else if (mode.startsWith("d")){
+ if(ct.isSynchronous())
ct.setMode(CacheMode.DIST_SYNC);
- else
+ else
ct.setMode(CacheMode.DIST_ASYNC);
- } else {
+ }
+ else {
throw new ConfigurationException("Invalid clustering mode" + ct.stringMode);
}
}
return ct;
}
}
-
+
+ /**
+ *
+ * @configRef async:clustering;|Specifies that network communications are asynchronous. Characteristics of this can be tuned here.
+ */
@XmlAccessorType(XmlAccessType.PROPERTY)
private static class AsyncType extends AbstractNamedCacheConfigurationBean {
@XmlTransient
private boolean readFromXml = false;
-
- /**
- * The serialVersionUID
- */
+
+ /** The serialVersionUID */
private static final long serialVersionUID = -7726319188826197399L;
- private Boolean useReplQueue = false;
-
- private Integer replQueueMaxElements = 1000;
-
- private Long replQueueInterval = 5000L;
-
- private Boolean asyncMarshalling = true;
-
-
+ protected Boolean useReplQueue=false;
+
+ protected Integer replQueueMaxElements=1000;
+
+ protected Long replQueueInterval=5000L;
+
+ protected Boolean asyncMarshalling=true;
+
+
private AsyncType(boolean readFromXml) {
super();
this.readFromXml = readFromXml;
}
-
- private AsyncType() {
+
+ private AsyncType(){
this(true);
}
@@ -1011,19 +939,21 @@
this.asyncMarshalling = asyncMarshalling;
}
}
-
+
+ /**
+ *
+ * @configRef expiration|Enables or disables expiration, and configures characteristics accordingly.
+ */
@XmlAccessorType(XmlAccessType.PROPERTY)
- private static class ExpirationType extends AbstractNamedCacheConfigurationBean {
+ private static class ExpirationType extends AbstractNamedCacheConfigurationBean{
- /**
- * The serialVersionUID
- */
+ /** The serialVersionUID */
private static final long serialVersionUID = 5757161438110848530L;
- private Long lifespan = -1L;
-
- private Long maxIdle = -1L;
-
+ protected Long lifespan=-1L;
+
+ protected Long maxIdle=-1L;
+
@XmlAttribute
public void setLifespan(Long lifespan) {
testImmutability("lifespan");
@@ -1036,21 +966,23 @@
this.maxIdle = maxIdle;
}
}
-
+
+ /**
+ *
+ * @configRef eviction|Enables or disables eviction, and configures characteristics accordingly.
+ */
@XmlAccessorType(XmlAccessType.PROPERTY)
private static class EvictionType extends AbstractNamedCacheConfigurationBean {
- /**
- * The serialVersionUID
- */
+ /** The serialVersionUID */
private static final long serialVersionUID = -1248563712058858791L;
- private Long wakeUpInterval = 5000L;
-
- private EvictionStrategy strategy = EvictionStrategy.NONE;
-
- private Integer maxEntries = -1;
-
+ protected Long wakeUpInterval=5000L;
+
+ protected EvictionStrategy strategy=EvictionStrategy.NONE;
+
+ protected Integer maxEntries=-1;
+
@XmlAttribute
public void setWakeUpInterval(Long wakeUpInterval) {
testImmutability("wakeUpInterval");
@@ -1069,21 +1001,24 @@
this.maxEntries = maxEntries;
}
}
-
+
+ /**
+ *
+ * @configRef stateRetrieval|Configures how state retrieval is performed on new caches in a cluster.
+ *
+ */
@XmlAccessorType(XmlAccessType.PROPERTY)
private static class StateRetrievalType extends AbstractNamedCacheConfigurationBean {
- /**
- * The serialVersionUID
- */
+ /** The serialVersionUID */
private static final long serialVersionUID = 3709234918426217096L;
@Dynamic
- private Boolean fetchInMemoryState = false;
-
- @Dynamic
- private Long timeout = 10000L;
-
+ protected Boolean fetchInMemoryState = false;
+
+ @Dynamic
+ protected Long timeout=10000L;
+
@XmlAttribute
public void setFetchInMemoryState(Boolean fetchInMemoryState) {
testImmutability("fetchInMemoryState");
@@ -1096,41 +1031,54 @@
this.timeout = timeout;
}
}
-
+
+ /**
+ *
+ * @configRef sync|Specifies that network communications are synchronous. Characteristics of this can be tuned here.
+ *
+ */
@XmlAccessorType(XmlAccessType.PROPERTY)
- private static class SyncType extends AbstractNamedCacheConfigurationBean {
- /**
- * The serialVersionUID
- */
+ private static class SyncType extends AbstractNamedCacheConfigurationBean {
+ /** The serialVersionUID */
private static final long serialVersionUID = 8419216253674289524L;
-
+
@Dynamic
- private Long replTimeout = 15000L;
-
+ protected Long replTimeout=15000L;
+
@XmlAttribute
public void setReplTimeout(Long replTimeout) {
testImmutability("replTimeout");
this.replTimeout = replTimeout;
}
}
-
+
+ /**
+ *
+ * @configRef hash|Allows fine-tuning of rehashing characteristics. Only used with the 'distributed' cache mode, and otherwise ignored.
+ */
@XmlAccessorType(XmlAccessType.PROPERTY)
private static class HashType extends AbstractNamedCacheConfigurationBean {
- /**
- * The serialVersionUID
- */
+ /** The serialVersionUID */
private static final long serialVersionUID = 752218766840948822L;
- private String consistentHashClass = DefaultConsistentHash.class.getName();
-
- private Integer numOwners = 2;
-
- private Long rehashWait = 60000L;
-
- private Long rehashRpcTimeout = 60 * 1000 * 10L;
-
- @XmlAttribute(name = "class")
+
+ /**
+ * @configRef class|Class name of a hashing algorithm
+ * */
+ protected String consistentHashClass = DefaultConsistentHash.class.getName();
+
+
+ /** @configDoc number of owners doco here */
+ protected Integer numOwners=2;
+
+ /** @configDoc rehashWait doco here */
+ protected Long rehashWait=60000L;
+
+ /** @configDoc rehashRpcTimeout doco here */
+ protected Long rehashRpcTimeout=60 * 1000 * 10L;
+
+ @XmlAttribute(name="class")
public void setConsistentHashClass(String consistentHashClass) {
testImmutability("class");
this.consistentHashClass = consistentHashClass;
@@ -1154,27 +1102,29 @@
this.rehashRpcTimeout = rehashRpcTimeout;
}
}
-
+
+ /**
+ *
+ * @configRef l1|Enables and defines details of the L1 cache. Only used with the 'distributed' cache mode, and otherwise ignored.
+ */
@XmlAccessorType(XmlAccessType.PROPERTY)
private static class L1Type extends AbstractNamedCacheConfigurationBean {
-
- /**
- * The serialVersionUID
- */
+
+ /** The serialVersionUID */
private static final long serialVersionUID = -4703587764861110638L;
- private Boolean enabled = true;
+ protected Boolean enabled=true;
- private Long lifespan = 600000L;
-
- private Boolean onRehash = true;
-
+ protected Long lifespan=600000L;
+
+ protected Boolean onRehash=true;
+
@XmlAttribute
public void setEnabled(Boolean enabled) {
testImmutability("enabled");
this.enabled = enabled;
}
-
+
@XmlAttribute
public void setLifespan(Long lifespan) {
testImmutability("lifespan");
@@ -1187,35 +1137,42 @@
this.onRehash = onRehash;
}
}
-
+ /**
+ *
+ * @configRef jmxStatistics|Defines how JMX components are bound to an MBean server
+ * @configRef lazyDeserialization|Defines lazy deserialization characteristics of the cache.
+ * @configRef invocationBatching|Defines whether invocation batching is allowed in this cache instance.
+ *
+ * @configElementDoc any documentation here
+ */
@XmlAccessorType(XmlAccessType.PROPERTY)
- private static class BooleanAttributeType extends AbstractNamedCacheConfigurationBean {
-
- /**
- * The serialVersionUID
- */
+ private static class BooleanAttributeType extends AbstractNamedCacheConfigurationBean {
+
+ /** The serialVersionUID */
private static final long serialVersionUID = 2296863404153834686L;
Boolean enabled = false;
-
+
@XmlAttribute
public void setEnabled(Boolean enabled) {
testImmutability("enabled");
this.enabled = enabled;
}
}
-
+
+ /**
+ *
+ * @configRef deadlockDetection|Enables or disables, and tunes, deadlock detection.
+ */
@XmlAccessorType(XmlAccessType.PROPERTY)
- private static class DeadlockDetectionType extends AbstractNamedCacheConfigurationBean {
-
- /**
- * The serialVersionUID
- */
+ private static class DeadlockDetectionType extends AbstractNamedCacheConfigurationBean{
+
+ /** The serialVersionUID */
private static final long serialVersionUID = -7178286048602531152L;
- private Boolean enabled = false;
-
- private Long spinDuration = 100L;
-
+ protected Boolean enabled=false;
+
+ protected Long spinDuration=100L;
+
@XmlAttribute
public void setEnabled(Boolean enabled) {
testImmutability("enabled");
@@ -1228,40 +1185,44 @@
this.spinDuration = spinDuration;
}
}
-
+
+ /**
+ *
+ * @configRef unsafe|Allows you to tune various unsafe or non-standard characteristics. Use with care.
+ */
@XmlAccessorType(XmlAccessType.PROPERTY)
- private static class UnsafeType extends AbstractNamedCacheConfigurationBean {
-
- /**
- * The serialVersionUID
- */
+ private static class UnsafeType extends AbstractNamedCacheConfigurationBean{
+
+ /** The serialVersionUID */
private static final long serialVersionUID = -9200921443651234163L;
- private Boolean unreliableReturnValues = false;
-
+ protected Boolean unreliableReturnValues=false;
+
@XmlAttribute
public void setUnreliableReturnValues(Boolean unreliableReturnValues) {
testImmutability("unreliableReturnValues");
this.unreliableReturnValues = unreliableReturnValues;
}
}
-
+
+ /**
+ *
+ * @configRef customInterceptors|Configures custom interceptors to be added to the cache
+ */
@XmlAccessorType(XmlAccessType.FIELD)
private static class CustomInterceptorsType extends AbstractNamedCacheConfigurationBean {
-
- /**
- * The serialVersionUID
- */
+
+ /** The serialVersionUID */
private static final long serialVersionUID = 7187545782011884661L;
+
+ @XmlElement(name="interceptor")
+ private List<CustomInterceptorConfig> customInterceptors= new ArrayList<CustomInterceptorConfig>();
- @XmlElement(name = "interceptor")
- private List<CustomInterceptorConfig> customInterceptors = new ArrayList<CustomInterceptorConfig>();
-
@Override
public CustomInterceptorsType clone() throws CloneNotSupportedException {
CustomInterceptorsType dolly = (CustomInterceptorsType) super.clone();
if (customInterceptors != null) {
dolly.customInterceptors = new ArrayList<CustomInterceptorConfig>();
- for (CustomInterceptorConfig config : customInterceptors) {
+ for (CustomInterceptorConfig config: customInterceptors) {
CustomInterceptorConfig clone = config.clone();
dolly.customInterceptors.add(clone);
}
Deleted: trunk/core/src/main/java/org/infinispan/config/ConfigurationAttribute.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/config/ConfigurationAttribute.java 2009-08-26 12:45:48 UTC (rev 739)
+++ trunk/core/src/main/java/org/infinispan/config/ConfigurationAttribute.java 2009-08-26 12:59:39 UTC (rev 740)
@@ -1,80 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.infinispan.config;
-
-import java.lang.annotation.*;
-
-/**
- * Represents an attribute of any XML element from a valid Infinispan configuration file.
- * <p>
- *
- * Each ConfigurationAttribute should annotate the corresponding setter method in ancestor hierarchy
- * of the appropriate AbstractConfigurationBean.
- * <p>
- *
- * ConfigurationAttribute should annotate the corresponding setter methods having one parameter that
- * could be either any primitive or java.lang.String.
- *
- *
- * @author Vladimir Blagojevic
- */
-
- at Retention(RetentionPolicy.RUNTIME)
- at Target( { ElementType.METHOD })
-public @interface ConfigurationAttribute {
-
- /**
- * Returns name of corresponding XML (ConfigurationElement) element that declares this attribute
- *
- * @return
- */
- String containingElement();
-
- /**
- * Returns name of this attribute. Should match the corresponding attribute in XML
- *
- * @return
- */
- String name();
-
- /**
- * Returns an array of String values representing allowed values for this attribute
- *
- * @return
- */
- String [] allowedValues() default {};
-
- /**
- * Returns default value for this attribute
- *
- * @return
- */
- String defaultValue() default "";
-
- /**
- * Returns description of this attribute
- *
- * @return
- */
- String description() default "";
-
-}
Deleted: trunk/core/src/main/java/org/infinispan/config/ConfigurationElement.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/config/ConfigurationElement.java 2009-08-26 12:45:48 UTC (rev 739)
+++ trunk/core/src/main/java/org/infinispan/config/ConfigurationElement.java 2009-08-26 12:59:39 UTC (rev 740)
@@ -1,84 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.infinispan.config;
-
-import java.lang.annotation.*;
-
-/**
- * Represents XML element from a valid Infinispan configuration file.
- * <p>
- *
- * Each ConfigurationElement should annotate the most derived subclass of AbstractConfigurationBean
- * that contains setter methods for XML attributes of the corresponding XML element (the one that
- * ConfigurationElement represents)
- *
- * <p>
- * For example, CacheLoaderManagerConfig is annotated with
- * <code>@ConfigurationElement(name="loaders",parent="default")</code> annotation since
- * CacheLoaderManagerConfig is the most derived subclass of AbstractConfigurationBean that contains
- * setter methods for attributes contained in <code><loaders></code> XML element.
- *
- * @see GlobalConfiguration
- * @see Configuration
- * @see CacheLoaderManagerConfig
- * @author Vladimir Blagojevic
- */
-
- at Retention(RetentionPolicy.RUNTIME)
- at Target( { ElementType.TYPE })
-public @interface ConfigurationElement {
-
- public enum Cardinality {
- ONE, UNBOUNDED
- };
-
- /**
- * Returns name of corresponding XML element
- *
- * @return
- */
- String name();
-
- /**
- * Returns name of corresponding parent XML element.
- *
- * @return
- */
- String parent();
-
- /**
- * Returns Cardinality.ONE if parent ConfigurationElement can have zero or one child defined by
- * this ConfigurationElement. In case parent can have multiple ConfigurationElement with the same
- * name returns Cardinality.UNBOUNDED
- *
- * @return
- */
- Cardinality cardinalityInParent() default Cardinality.ONE;
-
- /**
- * Returns description of this element
- *
- * @return
- */
- String description() default "";
-
-}
Deleted: trunk/core/src/main/java/org/infinispan/config/ConfigurationElements.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/config/ConfigurationElements.java 2009-08-26 12:45:48 UTC (rev 739)
+++ trunk/core/src/main/java/org/infinispan/config/ConfigurationElements.java 2009-08-26 12:59:39 UTC (rev 740)
@@ -1,38 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.infinispan.config;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Represents a list of XML elements from a valid Infinispan configuration file.
- *
- * @author Vladimir Blagojevic
- */
- at Retention(RetentionPolicy.RUNTIME)
- at Target( { ElementType.TYPE})
-public @interface ConfigurationElements {
- ConfigurationElement [] elements();
-}
Deleted: trunk/core/src/main/java/org/infinispan/config/ConfigurationProperties.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/config/ConfigurationProperties.java 2009-08-26 12:45:48 UTC (rev 739)
+++ trunk/core/src/main/java/org/infinispan/config/ConfigurationProperties.java 2009-08-26 12:59:39 UTC (rev 740)
@@ -1,38 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.infinispan.config;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Represents a list of XML property elements from a valid Infinispan configuration file.
- *
- * @author Vladimir Blagojevic
- */
- at Retention(RetentionPolicy.RUNTIME)
- at Target( { ElementType.METHOD })
-public @interface ConfigurationProperties {
- ConfigurationProperty[] elements();
-}
Deleted: trunk/core/src/main/java/org/infinispan/config/ConfigurationProperty.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/config/ConfigurationProperty.java 2009-08-26 12:45:48 UTC (rev 739)
+++ trunk/core/src/main/java/org/infinispan/config/ConfigurationProperty.java 2009-08-26 12:59:39 UTC (rev 740)
@@ -1,62 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.infinispan.config;
-
-import java.lang.annotation.*;
-
-/**
- * Represents a property element from a valid Infinispan configuration file.
- * <p>
- *
- * Each ConfigurationProperty should annotate the corresponding setter method in ancestor hierarchy
- * of the appropriate AbstractConfigurationBean. Parameter of the corresponding setter should be
- * either Properties or java.lang.String
- * <p>
- *
- * @author Vladimir Blagojevic
- */
- at Retention(RetentionPolicy.RUNTIME)
- at Target( { ElementType.METHOD, ElementType.FIELD })
-public @interface ConfigurationProperty {
-
- /**
- * Returns name of corresponding XML (ConfigurationElement) element that declares this property
- *
- * @return
- */
- String parentElement();
-
- /**
- * Returns name of this property. Should return the value of corresponding name attribute in
- * <property> XML element
- *
- * @return
- */
- String name();
-
- /**
- * Returns description of this property
- *
- * @return
- */
- String description() default "";
-}
Modified: trunk/core/src/main/java/org/infinispan/config/CustomInterceptorConfig.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/config/CustomInterceptorConfig.java 2009-08-26 12:45:48 UTC (rev 739)
+++ trunk/core/src/main/java/org/infinispan/config/CustomInterceptorConfig.java 2009-08-26 12:59:39 UTC (rev 740)
@@ -22,7 +22,6 @@
package org.infinispan.config;
import net.jcip.annotations.Immutable;
-import org.infinispan.config.ConfigurationElement.Cardinality;
import org.infinispan.interceptors.base.CommandInterceptor;
import org.infinispan.util.TypedProperties;
@@ -44,40 +43,40 @@
* provide meta data for configuration file XML schema generation. Please modify these annotations
* and Java element types they annotate with utmost understanding and care.
*
+ * @configRef interceptor
+ *
* @author Mircea.Markus at jboss.com
* @author Vladimir Blagojevic
* @since 4.0
*/
@Immutable
- at ConfigurationElement(name = "interceptor", parent = "customInterceptors" ,
- cardinalityInParent=Cardinality.UNBOUNDED)
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name="interceptor")
public class CustomInterceptorConfig extends AbstractNamedCacheConfigurationBean {
@XmlTransient
- private CommandInterceptor interceptor;
+ protected CommandInterceptor interceptor;
@XmlTransient
- private boolean isFirst;
+ protected boolean isFirst;
@XmlTransient
- private boolean isLast;
+ protected boolean isLast;
@XmlAttribute
- private Integer index = -1;
+ protected Integer index = -1;
@XmlAttribute
- private String after;
+ protected String after;
@XmlAttribute
- private String before;
+ protected String before;
@XmlAttribute
- private Position position;
+ protected Position position;
@XmlAttribute(name="class")
- private String className;
+ protected String className;
@XmlElement
private TypedProperties properties = EMPTY_PROPERTIES;
@@ -139,7 +138,6 @@
return properties;
}
- @ConfigurationProperty(name = "anyCustomProperty", parentElement = "interceptor")
public void setProperties(Properties properties) {
this.properties = toTypedProperties(properties);
}
@@ -156,8 +154,6 @@
return className;
}
- @ConfigurationAttribute(name = "class",
- containingElement = "interceptor")
public void setClassName(String className) {
this.className = className;
}
@@ -179,8 +175,6 @@
isLast = last;
}
- @ConfigurationAttribute(name = "position",
- containingElement = "interceptor")
public void setPosition(String pos) {
setPosition(Position.valueOf(uc(pos)));
}
@@ -189,8 +183,6 @@
* Put this interceptor at the specified index, after the default chain is built. If the index is not valid (negative
* or grater than the size of the chain) an {@link ConfigurationException} is thrown at construction time.
*/
- @ConfigurationAttribute(name = "index",
- containingElement = "interceptor")
public void setIndex(int index) {
testImmutability("index");
this.index = index;
@@ -200,8 +192,6 @@
* Adds the interceptor immediately after the first occurance of an interceptor having the given class. If the chain
* does not contain such an interceptor then this interceptor definition is ignored.
*/
- @ConfigurationAttribute(name = "after",
- containingElement = "interceptor")
public void setAfterInterceptor(String afterClass) {
testImmutability("after");
this.after = afterClass;
@@ -219,8 +209,6 @@
* Adds the interceptor immediately before the first occurance of an interceptor having the given class. If the chain
* does not contain such an interceptor then this interceptor definition is ignored.
*/
- @ConfigurationAttribute(name = "before",
- containingElement = "interceptor")
public void setBeforeInterceptor(String beforeClass) {
testImmutability("before");
this.before = beforeClass;
Modified: trunk/core/src/main/java/org/infinispan/config/GlobalConfiguration.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/config/GlobalConfiguration.java 2009-08-26 12:45:48 UTC (rev 739)
+++ trunk/core/src/main/java/org/infinispan/config/GlobalConfiguration.java 2009-08-26 12:59:39 UTC (rev 740)
@@ -31,6 +31,8 @@
* configuration files are read into instances of configuration class hierarchy as well as they
* provide meta data for configuration file XML schema generation. Please modify these annotations
* and Java element types they annotate with utmost understanding and care.
+ *
+ * @configRef global|Defines global configuration shared among all cache instances
*
* @author Manik Surtani
* @author Vladimir Blagojevic
@@ -38,17 +40,6 @@
*/
@NonVolatile
@Scope(Scopes.GLOBAL)
- at ConfigurationElements(elements = {
- @ConfigurationElement(name = "global", parent = "infinispan", description = ""),
- @ConfigurationElement(name = "asyncListenerExecutor", parent = "global", description = ""),
- @ConfigurationElement(name = "transport", parent = "global", description = ""),
- @ConfigurationElement(name = "evictionScheduledExecutor", parent = "global", description = ""),
- @ConfigurationElement(name = "replicationQueueScheduledExecutor", parent = "global", description = ""),
- @ConfigurationElement(name = "globalJmxStatistics", parent = "global", description = ""),
- @ConfigurationElement(name = "asyncTransportExecutor", parent = "global", description = ""),
- @ConfigurationElement(name = "serialization", parent = "global", description = ""),
- @ConfigurationElement(name = "shutdown", parent = "global", description = "")
-})
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(propOrder={})
public class GlobalConfiguration extends AbstractConfigurationBean {
@@ -95,10 +86,7 @@
public boolean isExposeGlobalJmxStatistics() {
return globalJmxStatistics.enabled;
}
-
- @ConfigurationAttribute(name = "enabled",
- containingElement = "globalJmxStatistics",
- description = "If true, global JMX statistics are published")
+
public void setExposeGlobalJmxStatistics(boolean exposeGlobalJmxStatistics) {
testImmutability("exposeGlobalManagementStatistics");
globalJmxStatistics.setEnabled(exposeGlobalJmxStatistics);
@@ -108,9 +96,6 @@
* If JMX statistics are enabled then all 'published' JMX objects will appear under this name. This is optional, if
* not specified an object name will be created for you by default.
*/
- @ConfigurationAttribute(name = "jmxDomain",
- containingElement = "globalJmxStatistics",
- description = "If JMX statistics are enabled then all 'published' JMX objects will appear under this name")
public void setJmxDomain(String jmxObjectName) {
globalJmxStatistics.setJmxDomain(jmxObjectName);
}
@@ -126,9 +111,6 @@
return globalJmxStatistics.mBeanServerLookup;
}
- @ConfigurationAttribute(name = "mBeanServerLookup",
- containingElement = "globalJmxStatistics",
- description = "")
public void setMBeanServerLookup(String mBeanServerLookup) {
globalJmxStatistics.setMBeanServerLookup(mBeanServerLookup);
}
@@ -137,9 +119,6 @@
return globalJmxStatistics.allowDuplicateDomains;
}
- @ConfigurationAttribute(name = "allowDuplicateDomains",
- containingElement = "globalJmxStatistics",
- description = "")
public void setAllowDuplicateDomains(boolean allowDuplicateDomains) {
globalJmxStatistics.setAllowDuplicateDomains(allowDuplicateDomains);
}
@@ -184,9 +163,6 @@
return asyncListenerExecutor.factory;
}
- @ConfigurationAttribute(name = "factory",
- containingElement = "asyncListenerExecutor",
- description = "ExecutorService factory class for asynchronous listeners")
public void setAsyncListenerExecutorFactoryClass(String asyncListenerExecutorFactoryClass) {
asyncListenerExecutor.setFactory(asyncListenerExecutorFactoryClass);
}
@@ -195,9 +171,6 @@
return asyncTransportExecutor.factory;
}
- @ConfigurationAttribute(name = "factory",
- containingElement = "asyncTransportExecutor",
- description = "ExecutorService factory class for async transport")
public void setAsyncTransportExecutorFactoryClass(String asyncTransportExecutorFactoryClass) {
this.asyncTransportExecutor.setFactory(asyncTransportExecutorFactoryClass);
}
@@ -206,9 +179,6 @@
return evictionScheduledExecutor.factory;
}
- @ConfigurationAttribute(name = "factory",
- containingElement = "evictionScheduledExecutor",
- description = "ExecutorService factory class for eviction threads")
public void setEvictionScheduledExecutorFactoryClass(String evictionScheduledExecutorFactoryClass) {
evictionScheduledExecutor.setFactory(evictionScheduledExecutorFactoryClass);
}
@@ -217,9 +187,7 @@
return replicationQueueScheduledExecutor.factory;
}
- @ConfigurationAttribute(name = "factory",
- containingElement = "replicationQueueScheduledExecutor",
- description = "ExecutorService factory class for replication queue threads")
+
public void setReplicationQueueScheduledExecutorFactoryClass(String replicationQueueScheduledExecutorFactoryClass) {
replicationQueueScheduledExecutor.setFactory(replicationQueueScheduledExecutorFactoryClass);
}
@@ -228,8 +196,6 @@
return serialization.marshallerClass;
}
- @ConfigurationAttribute(name = "marshallerClass",
- containingElement = "serialization")
public void setMarshallerClass(String marshallerClass) {
serialization.setMarshallerClass(marshallerClass);
}
@@ -238,10 +204,7 @@
return transport.transportClass;
}
- @ConfigurationAttribute(name = "transportClass",
- containingElement = "transport",
- description = "Transport class, by default null i.e. no transport",
- defaultValue = "org.infinispan.remoting.transport.jgroups.JGroupsTransport")
+
public void setTransportClass(String transportClass) {
transport.setTransportClass(transportClass);
}
@@ -250,10 +213,6 @@
return transport.properties;
}
- @ConfigurationProperties(elements = {
- @ConfigurationProperty(name = "configurationString", parentElement = "transport"),
- @ConfigurationProperty(name = "configurationFile", parentElement = "transport"),
- @ConfigurationProperty(name = "configurationXml", parentElement = "transport") })
public void setTransportProperties(Properties transportProperties) {
transport.setProperties(toTypedProperties(transportProperties));
}
@@ -274,8 +233,6 @@
return transport.clusterName;
}
- @ConfigurationAttribute(name = "clusterName",
- containingElement = "transport")
public void setClusterName(String clusterName) {
transport.setClusterName(clusterName);
}
@@ -288,10 +245,6 @@
shutdown.setHookBehavior(shutdownHookBehavior);
}
- @ConfigurationAttribute(name = "hookBehavior",
- containingElement = "shutdown",
- allowedValues = {"DEFAULT", "REGISTER", "DONT_REGISTER"},
- defaultValue = "DEFAULT")
public void setShutdownHookBehavior(String shutdownHookBehavior) {
if (shutdownHookBehavior == null)
throw new ConfigurationException("Shutdown hook behavior cannot be null", "ShutdownHookBehavior");
@@ -308,9 +261,6 @@
}
- @ConfigurationProperties(elements = {
- @ConfigurationProperty(name = "maxThreads", parentElement = "asyncListenerExecutor"),
- @ConfigurationProperty(name = "threadNamePrefix", parentElement = "asyncListenerExecutor") })
public void setAsyncListenerExecutorProperties(Properties asyncListenerExecutorProperties) {
asyncListenerExecutor.setProperties(toTypedProperties(asyncListenerExecutorProperties));
}
@@ -323,9 +273,6 @@
return asyncTransportExecutor.properties;
}
- @ConfigurationProperties(elements = {
- @ConfigurationProperty(name = "maxThreads", parentElement = "asyncTransportExecutor"),
- @ConfigurationProperty(name = "threadNamePrefix", parentElement = "asyncTransportExecutor") })
public void setAsyncTransportExecutorProperties(Properties asyncTransportExecutorProperties) {
this.asyncTransportExecutor.setProperties(toTypedProperties(asyncTransportExecutorProperties));
}
@@ -337,11 +284,7 @@
public Properties getEvictionScheduledExecutorProperties() {
return evictionScheduledExecutor.properties;
}
-
-
- @ConfigurationProperties(elements = {
- @ConfigurationProperty(name = "maxThreads", parentElement = "evictionScheduledExecutor"),
- @ConfigurationProperty(name = "threadNamePrefix", parentElement = "evictionScheduledExecutor") })
+
public void setEvictionScheduledExecutorProperties(Properties evictionScheduledExecutorProperties) {
evictionScheduledExecutor.setProperties(toTypedProperties(evictionScheduledExecutorProperties));
}
@@ -353,10 +296,7 @@
public Properties getReplicationQueueScheduledExecutorProperties() {
return replicationQueueScheduledExecutor.properties;
}
-
- @ConfigurationProperties(elements = {
- @ConfigurationProperty(name = "maxThreads", parentElement = "replicationQueueScheduledExecutor"),
- @ConfigurationProperty(name = "threadNamePrefix", parentElement = "replicationQueueScheduledExecutor") })
+
public void setReplicationQueueScheduledExecutorProperties(Properties replicationQueueScheduledExecutorProperties) {
this.replicationQueueScheduledExecutor.setProperties(toTypedProperties(replicationQueueScheduledExecutorProperties));
}
@@ -378,8 +318,6 @@
serialization.version = Version.decodeVersionForSerialization(marshallVersion);
}
- @ConfigurationAttribute(name = "version",
- containingElement = "serialization", defaultValue=Version.version)
public void setMarshallVersion(String marshallVersion) {
serialization.setVersion(marshallVersion);
}
@@ -388,8 +326,6 @@
return transport.distributedSyncTimeout;
}
- @ConfigurationAttribute(name = "distributedSyncTimeout",
- containingElement = "transport")
public void setDistributedSyncTimeout(long distributedSyncTimeout) {
transport.distributedSyncTimeout = distributedSyncTimeout;
}
@@ -492,14 +428,25 @@
return gc;
}
+ /**
+ *
+ * @configRef asyncListenerExecutor
+ * @configRef asyncTransportExecutor
+ * @configRef evictionScheduledExecutor
+ * @configRef replicationQueueScheduledExecutor
+ */
@XmlAccessorType(XmlAccessType.PROPERTY)
private static class FactoryClassWithPropertiesType extends AbstractConfigurationBeanWithGCR {
@XmlAttribute
- private String factory;
+ protected String factory;
+ /**
+ * @configPropertyRef maxThreads
+ * @configPropertyRef threadNamePrefix
+ * */
@XmlElement(name="properties")
- private TypedProperties properties = EMPTY_PROPERTIES;
+ protected TypedProperties properties = EMPTY_PROPERTIES;
public FactoryClassWithPropertiesType(String factory) {
super();
@@ -529,16 +476,20 @@
}
}
+ /**
+ *
+ * @configRef transport
+ */
@XmlAccessorType(XmlAccessType.PROPERTY)
private static class TransportType extends AbstractConfigurationBeanWithGCR {
- private String clusterName = "Infinispan-Cluster";
+ protected String clusterName = "Infinispan-Cluster";
- private Long distributedSyncTimeout = 60000L; // default
+ protected Long distributedSyncTimeout = 60000L; // default
- private String transportClass = null; // this defaults to a non-clustered cache.
+ protected String transportClass = null; // this defaults to a non-clustered cache.
- private TypedProperties properties = EMPTY_PROPERTIES;
+ protected TypedProperties properties = EMPTY_PROPERTIES;
public TransportType() {
super();
@@ -583,12 +534,16 @@
}
}
+ /**
+ *
+ * @configRef serialization
+ */
@XmlAccessorType(XmlAccessType.PROPERTY)
private static class SerializationType extends AbstractConfigurationBeanWithGCR {
- private String marshallerClass = VersionAwareMarshaller.class.getName(); // the default
+ protected String marshallerClass = VersionAwareMarshaller.class.getName(); // the default
- private String version = Version.getMajorVersion();
+ protected String version = Version.getMajorVersion();
public SerializationType() {
super();
@@ -607,16 +562,20 @@
}
}
+ /**
+ *
+ * @configRef globalJmxStatistics
+ */
@XmlAccessorType(XmlAccessType.PROPERTY)
private static class GlobalJmxStatisticsType extends AbstractConfigurationBeanWithGCR {
- private Boolean enabled = false;
+ protected Boolean enabled = false;
- private String jmxDomain = "infinispan";
+ protected String jmxDomain = "infinispan";
- private String mBeanServerLookup = PlatformMBeanServerLookup.class.getName();
+ protected String mBeanServerLookup = PlatformMBeanServerLookup.class.getName();
- private Boolean allowDuplicateDomains = false;
+ protected Boolean allowDuplicateDomains = false;
@XmlAttribute
public void setEnabled(Boolean enabled) {
@@ -643,10 +602,14 @@
}
}
+ /**
+ *
+ * @configRef shutdown
+ */
@XmlAccessorType(XmlAccessType.PROPERTY)
private static class ShutdownType extends AbstractConfigurationBeanWithGCR {
- private ShutdownHookBehavior hookBehavior = ShutdownHookBehavior.DEFAULT;
+ protected ShutdownHookBehavior hookBehavior = ShutdownHookBehavior.DEFAULT;
@XmlAttribute
public void setHookBehavior(ShutdownHookBehavior hookBehavior) {
Modified: trunk/core/src/main/java/org/infinispan/config/InfinispanConfiguration.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/config/InfinispanConfiguration.java 2009-08-26 12:45:48 UTC (rev 739)
+++ trunk/core/src/main/java/org/infinispan/config/InfinispanConfiguration.java 2009-08-26 12:59:39 UTC (rev 740)
@@ -50,6 +50,8 @@
* files are read into instances of configuration class hierarchy as well as they provide meta data for configuration
* file XML schema generation. Please modify these annotations and Java element types they annotate with utmost
* understanding and care.
+ *
+ * @configRef infinispan|Root of Infinispan configuration.
*
* @author Vladimir Blagojevic
* @since 4.0
Modified: trunk/core/src/main/java/org/infinispan/config/PluggableConfigurationComponent.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/config/PluggableConfigurationComponent.java 2009-08-26 12:45:48 UTC (rev 739)
+++ trunk/core/src/main/java/org/infinispan/config/PluggableConfigurationComponent.java 2009-08-26 12:59:39 UTC (rev 740)
@@ -31,7 +31,6 @@
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
/**
* A configuration component where the implementation class can be specified, and comes with its own set of properties.
Deleted: trunk/core/src/main/java/org/infinispan/config/parsing/TreeNode.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/config/parsing/TreeNode.java 2009-08-26 12:45:48 UTC (rev 739)
+++ trunk/core/src/main/java/org/infinispan/config/parsing/TreeNode.java 2009-08-26 12:59:39 UTC (rev 740)
@@ -1,96 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.infinispan.config.parsing;
-
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * TreeNode of Infinispan configuration
- *
- * @author Vladimir Blagojevic
- * @since 4.0
- */
-public class TreeNode {
- private final String name;
- private final TreeNode parent;
- private final int depth;
- private final Set<TreeNode> children = new HashSet<TreeNode>();
-
- public TreeNode(String name, TreeNode parent, int depth) {
- this.name = name;
- this.parent = parent;
- this.depth = depth;
- }
-
- public TreeNode() {
- this.name="";
- this.parent=null;
- this.depth = -1; // :)
- }
-
- public String getName() {
- return name;
- }
-
- public int getDepth() {
- return depth;
- }
-
- public boolean hasChildren(){
- return !children.isEmpty();
- }
-
- public TreeNode getParent() {
- return parent;
- }
-
- public Set<TreeNode> getChildren() {
- return children;
- }
-
- public void accept(TreeWalker tw) {
- tw.visitNode(this);
- }
-
- public boolean equals(Object other) {
- if (other == this)
- return true;
- if (!(other instanceof TreeNode))
- return false;
- TreeNode tn = (TreeNode) other;
- return this.parent.name != null && tn.parent != null
- && this.parent.name.equals(tn.parent.name) && this.name.equals(tn.name);
- }
-
- public int hashCode() {
- int result = 17;
- result = 31 * result + name.hashCode();
- result = 31 * result
- + ((parent != null && parent.name != null) ? parent.name.hashCode() : 0);
- return result;
- }
-
- public String toString() {
- return name;
- }
-}
\ No newline at end of file
Deleted: trunk/core/src/main/java/org/infinispan/config/parsing/TreeWalker.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/config/parsing/TreeWalker.java 2009-08-26 12:45:48 UTC (rev 739)
+++ trunk/core/src/main/java/org/infinispan/config/parsing/TreeWalker.java 2009-08-26 12:59:39 UTC (rev 740)
@@ -1,36 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.infinispan.config.parsing;
-
-/**
- * TreeWalker visitor
- *
- * @author Vladimir Blagojevic
- * @see SchemaGeneratorTreeWalker
- * @see XMLTreeOutputWalker
- * @since 4.0
- */
-public interface TreeWalker {
-
- void visitNode(TreeNode treeNode);
-
-}
Modified: trunk/core/src/main/java/org/infinispan/loaders/AbstractCacheLoaderConfig.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/loaders/AbstractCacheLoaderConfig.java 2009-08-26 12:45:48 UTC (rev 739)
+++ trunk/core/src/main/java/org/infinispan/loaders/AbstractCacheLoaderConfig.java 2009-08-26 12:59:39 UTC (rev 740)
@@ -5,7 +5,6 @@
import javax.xml.bind.annotation.XmlAttribute;
import org.infinispan.CacheException;
-import org.infinispan.config.ConfigurationAttribute;
import org.infinispan.config.PluggableConfigurationComponent;
/**
@@ -31,10 +30,7 @@
public String getCacheLoaderClassName() {
return cacheLoaderClassName;
}
-
- @ConfigurationAttribute(name = "class",
- containingElement = "loader",
- description = "Full class name of a cache loader")
+
public void setCacheLoaderClassName(String className) {
if (className == null || className.length() == 0) return;
testImmutability("cacheLoaderClassName");
Modified: trunk/core/src/main/java/org/infinispan/loaders/AbstractCacheStoreConfig.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/loaders/AbstractCacheStoreConfig.java 2009-08-26 12:45:48 UTC (rev 739)
+++ trunk/core/src/main/java/org/infinispan/loaders/AbstractCacheStoreConfig.java 2009-08-26 12:59:39 UTC (rev 740)
@@ -1,16 +1,15 @@
package org.infinispan.loaders;
-import org.infinispan.config.ConfigurationAttribute;
-import org.infinispan.loaders.decorators.AsyncStoreConfig;
-import org.infinispan.loaders.decorators.SingletonStoreConfig;
-import org.infinispan.util.Util;
-
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
+import org.infinispan.loaders.decorators.AsyncStoreConfig;
+import org.infinispan.loaders.decorators.SingletonStoreConfig;
+import org.infinispan.util.Util;
+
/**
* Configures {@link AbstractCacheStore}. This allows you to tune a number of characteristics of the {@link
* AbstractCacheStore}.
@@ -25,6 +24,8 @@
* configuration files are read into instances of configuration class hierarchy as well as they
* provide meta data for configuration file XML schema generation. Please modify these annotations
* and Java element types they annotate with utmost understanding and care.
+ *
+ * @configRef loader
*
* @author Mircea.Markus at jboss.com
* @since 4.0
@@ -33,23 +34,35 @@
@XmlType(propOrder={"singletonStore","async"})
public class AbstractCacheStoreConfig extends AbstractCacheLoaderConfig implements CacheStoreConfig {
+ /**
+ * @configRef |If true, any operation that modifies the cache store (remove, clear, store...etc) won't be applied to it
+ * */
@XmlAttribute
- private Boolean ignoreModifications = false;
+ protected Boolean ignoreModifications = false;
+ /**
+ * @configRef |If true, fetch persistent state on state transfer
+ * */
@XmlAttribute
- private Boolean fetchPersistentState = false;
+ protected Boolean fetchPersistentState = false;
+ /**
+ * @configRef |If true, purge node state on startup
+ * */
@XmlAttribute
- private Boolean purgeOnStartup = false;
+ protected Boolean purgeOnStartup = false;
+ /**
+ * @configRef |If true, and purging is turned on, purge on startup will be done synchronously
+ * */
@XmlAttribute
- private Boolean purgeSynchronously = false;
+ protected Boolean purgeSynchronously = false;
@XmlElement
- private SingletonStoreConfig singletonStore = new SingletonStoreConfig();
+ protected SingletonStoreConfig singletonStore = new SingletonStoreConfig();
@XmlElement
- private AsyncStoreConfig async = new AsyncStoreConfig();
+ protected AsyncStoreConfig async = new AsyncStoreConfig();
@@ -70,18 +83,11 @@
return fetchPersistentState;
}
- @ConfigurationAttribute(name = "fetchPersistentState",
- containingElement = "loader",
- description = "If true, fetch persistent state on state transfer")
public void setFetchPersistentState(boolean fetchPersistentState) {
testImmutability("fetchPersistentState");
this.fetchPersistentState = fetchPersistentState;
}
- @ConfigurationAttribute(name = "ignoreModifications",
- containingElement = "loader",
- description = "If true, any operation that modifies the cache store (remove, clear, store...etc) " +
- "won't be applied to it")
public void setIgnoreModifications(boolean ignoreModifications) {
testImmutability("ignoreModifications");
this.ignoreModifications = ignoreModifications;
@@ -91,9 +97,6 @@
return ignoreModifications;
}
- @ConfigurationAttribute(name = "purgeOnStartup",
- containingElement = "loader",
- description = "If true, purge node state on startup")
public void setPurgeOnStartup(boolean purgeOnStartup) {
testImmutability("purgeOnStartup");
this.purgeOnStartup = purgeOnStartup;
Modified: trunk/core/src/main/java/org/infinispan/loaders/LockSupportCacheStoreConfig.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/loaders/LockSupportCacheStoreConfig.java 2009-08-26 12:45:48 UTC (rev 739)
+++ trunk/core/src/main/java/org/infinispan/loaders/LockSupportCacheStoreConfig.java 2009-08-26 12:59:39 UTC (rev 740)
@@ -1,6 +1,5 @@
package org.infinispan.loaders;
-import org.infinispan.config.ConfigurationProperty;
/**
* Adds configuration support for {@link LockSupportCacheStore}.
@@ -24,9 +23,6 @@
/**
* Sets number of threads expected to use this class concurrently.
*/
- @ConfigurationProperty(name = "lockConcurrencyLevel",
- parentElement = "properties",
- description = "Concurrency level as integer. Default is " + DEFAULT_CONCURRENCY_LEVEL)
public void setLockConcurrencyLevel(int lockConcurrencyLevel) {
testImmutability("lockConcurrencyLevel");
this.lockConcurrencyLevel = lockConcurrencyLevel;
@@ -36,9 +32,6 @@
return lockAcquistionTimeout;
}
- @ConfigurationProperty(name = "lockAcquistionTimeout",
- parentElement = "properties",
- description= "Default lock acquisition timeout as long. Default is " + DEFAULT_LOCK_ACQUISITION_TIMEOUT)
public void setLockAcquistionTimeout(long lockAcquistionTimeout) {
testImmutability("lockAcquistionTimeout");
this.lockAcquistionTimeout = lockAcquistionTimeout;
Modified: trunk/core/src/main/java/org/infinispan/loaders/decorators/AsyncStoreConfig.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/loaders/decorators/AsyncStoreConfig.java 2009-08-26 12:45:48 UTC (rev 739)
+++ trunk/core/src/main/java/org/infinispan/loaders/decorators/AsyncStoreConfig.java 2009-08-26 12:59:39 UTC (rev 740)
@@ -5,8 +5,6 @@
import javax.xml.bind.annotation.XmlAttribute;
import org.infinispan.config.AbstractNamedCacheConfigurationBean;
-import org.infinispan.config.ConfigurationAttribute;
-import org.infinispan.config.ConfigurationElement;
import org.infinispan.config.Dynamic;
/**
@@ -18,31 +16,38 @@
* provide meta data for configuration file XML schema generation. Please modify these annotations
* and Java element types they annotate with utmost understanding and care.
*
+ * @configRef async:loader:
*
* @author Manik Surtani
* @author Vladimir Blagojevic
* @since 4.0
*/
- at ConfigurationElement(name="async", parent="loader")
@XmlAccessorType(XmlAccessType.FIELD)
public class AsyncStoreConfig extends AbstractNamedCacheConfigurationBean {
+
+ /**
+ * @configRef |If true, modifications are stored in the cache store asynchronously.
+ * */
@XmlAttribute
- Boolean enabled = false;
+ protected Boolean enabled = false;
+ /**
+ * @configRef |Size of the thread pool whose threads are responsible for applying the modifications.
+ * */
@XmlAttribute
- Integer threadPoolSize = 1;
+ protected Integer threadPoolSize = 1;
+ /**
+ * @configRef |Lock timeout for access to map containing latest state.
+ * */
@Dynamic
@XmlAttribute
- Long mapLockTimeout = 5000L;
+ protected Long mapLockTimeout = 5000L;
public boolean isEnabled() {
return enabled;
}
-
- @ConfigurationAttribute(name = "enabled",
- containingElement = "async",
- description="If true, modifications are stored in the cache store asynchronously.")
+
public void setEnabled(boolean enabled) {
testImmutability("enabled");
this.enabled = enabled;
@@ -51,10 +56,7 @@
public int getThreadPoolSize() {
return threadPoolSize;
}
-
- @ConfigurationAttribute(name = "threadPoolSize",
- containingElement = "async",
- description="Size of the thread pool whose threads are responsible for applying the modifications.")
+
public void setThreadPoolSize(int threadPoolSize) {
testImmutability("threadPoolSize");
this.threadPoolSize = threadPoolSize;
@@ -64,9 +66,6 @@
return mapLockTimeout;
}
- @ConfigurationAttribute(name = "mapLockTimeout",
- containingElement = "async",
- description="Lock timeout for access to map containing latest state.")
public void setMapLockTimeout(long stateLockTimeout) {
testImmutability("mapLockTimeout");
this.mapLockTimeout = stateLockTimeout;
Modified: trunk/core/src/main/java/org/infinispan/loaders/decorators/SingletonStoreConfig.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/loaders/decorators/SingletonStoreConfig.java 2009-08-26 12:45:48 UTC (rev 739)
+++ trunk/core/src/main/java/org/infinispan/loaders/decorators/SingletonStoreConfig.java 2009-08-26 12:59:39 UTC (rev 740)
@@ -5,8 +5,6 @@
import javax.xml.bind.annotation.XmlAttribute;
import org.infinispan.config.AbstractNamedCacheConfigurationBean;
-import org.infinispan.config.ConfigurationAttribute;
-import org.infinispan.config.ConfigurationElement;
/**
* Configuration for a singleton store
@@ -17,32 +15,30 @@
* provide meta data for configuration file XML schema generation. Please modify these annotations
* and Java element types they annotate with utmost understanding and care.
*
+ * @configRef singletonStore
+ *
* @author Manik Surtani
* @author Vladimir Blagojevic
* @since 4.0
*/
- at ConfigurationElement(name="singletonStore", parent="loader")
@XmlAccessorType(XmlAccessType.FIELD)
public class SingletonStoreConfig extends AbstractNamedCacheConfigurationBean {
private static final long serialVersionUID = 824251894176131850L;
@XmlAttribute
- Boolean enabled = false;
+ protected Boolean enabled = false;
@XmlAttribute
- Boolean pushStateWhenCoordinator = true;
+ protected Boolean pushStateWhenCoordinator = true;
@XmlAttribute
- Long pushStateTimeout = 10000L;
+ protected Long pushStateTimeout = 10000L;
public boolean isSingletonStoreEnabled() {
return enabled;
}
-
- @ConfigurationAttribute(name = "enabled",
- containingElement = "singletonStore",
- description="Switch to enable singleton store")
+
public void setSingletonStoreEnabled(boolean singletonStoreEnabled) {
testImmutability("enabled");
this.enabled = singletonStoreEnabled;
@@ -53,9 +49,6 @@
return pushStateWhenCoordinator;
}
- @ConfigurationAttribute(name = "pushStateWhenCoordinator",
- containingElement = "singletonStore",
- description="TODO")
public void setPushStateWhenCoordinator(boolean pushStateWhenCoordinator) {
testImmutability("pushStateWhenCoordinator");
this.pushStateWhenCoordinator = pushStateWhenCoordinator;
@@ -65,9 +58,6 @@
return pushStateTimeout;
}
- @ConfigurationAttribute(name = "pushStateTimeout",
- containingElement = "singletonStore",
- description="TODO")
public void setPushStateTimeout(long pushStateTimeout) {
testImmutability("pushStateTimeout");
this.pushStateTimeout = pushStateTimeout;
Modified: trunk/core/src/main/java/org/infinispan/loaders/file/FileCacheStoreConfig.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/loaders/file/FileCacheStoreConfig.java 2009-08-26 12:45:48 UTC (rev 739)
+++ trunk/core/src/main/java/org/infinispan/loaders/file/FileCacheStoreConfig.java 2009-08-26 12:59:39 UTC (rev 740)
@@ -1,9 +1,5 @@
package org.infinispan.loaders.file;
-import org.infinispan.config.ConfigurationElement;
-import org.infinispan.config.ConfigurationElements;
-import org.infinispan.config.ConfigurationProperty;
-import org.infinispan.config.ConfigurationElement.Cardinality;
import org.infinispan.loaders.LockSupportCacheStoreConfig;
/**
@@ -25,11 +21,6 @@
* @autor Vladimir Blagojevic
* @since 4.0
*/
- at ConfigurationElements(elements = {
- @ConfigurationElement(name = "loader", parent = "loaders",
- description = "org.infinispan.loaders.file.FileCacheStore",
- cardinalityInParent=Cardinality.UNBOUNDED),
- @ConfigurationElement(name = "properties", parent = "loader") })
public class FileCacheStoreConfig extends LockSupportCacheStoreConfig {
String location = "Infinispan-FileCacheStore";
private int streamBufferSize = 8192;
@@ -42,9 +33,6 @@
return location;
}
- @ConfigurationProperty(name="location",
- parentElement="properties",
- description="Path to file")
public void setLocation(String location) {
testImmutability("location");
this.location = location;
Modified: trunk/core/src/main/java/org/infinispan/util/TypedProperties.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/util/TypedProperties.java 2009-08-26 12:45:48 UTC (rev 739)
+++ trunk/core/src/main/java/org/infinispan/util/TypedProperties.java 2009-08-26 12:59:39 UTC (rev 740)
@@ -12,7 +12,10 @@
/**
* Type-aware properties. Extends the JDK {@link Properties} class to provide accessors that convert values to certain
* types, using default values if a conversion is not possible.
+ *
*
+ * @configRef properties
+ *
* @author Manik Surtani
* @since 4.0
*/
Modified: trunk/tools/pom.xml
===================================================================
--- trunk/tools/pom.xml 2009-08-26 12:45:48 UTC (rev 739)
+++ trunk/tools/pom.xml 2009-08-26 12:59:39 UTC (rev 740)
@@ -16,6 +16,15 @@
<version>4.0.0-SNAPSHOT</version>
<name>Infinispan Tools</name>
<description>Infinispan - Tools for project</description>
+
+ <!-- needed for XSOM -->
+ <repositories>
+ <repository>
+ <id>download.java.net</id>
+ <url>http://download.java.net/maven/2</url>
+ </repository>
+ </repositories>
+
<dependencies>
<dependency>
<groupId>${project-package}</groupId>
@@ -78,6 +87,12 @@
<artifactId>infinispan-tree</artifactId>
<version>${project-version}</version>
</dependency>
+
+ <dependency>
+ <groupId>com.sun.xsom</groupId>
+ <artifactId>xsom</artifactId>
+ <version>20081112</version>
+ </dependency>
</dependencies>
<profiles>
Modified: trunk/tools/src/main/java/org/infinispan/tools/doclet/config/ConfigDoclet.java
===================================================================
--- trunk/tools/src/main/java/org/infinispan/tools/doclet/config/ConfigDoclet.java 2009-08-26 12:45:48 UTC (rev 739)
+++ trunk/tools/src/main/java/org/infinispan/tools/doclet/config/ConfigDoclet.java 2009-08-26 12:59:39 UTC (rev 740)
@@ -1,14 +1,13 @@
package org.infinispan.tools.doclet.config;
+import java.io.File;
+import java.io.IOException;
+import java.util.Arrays;
+
import com.sun.javadoc.DocErrorReporter;
import com.sun.javadoc.RootDoc;
import com.sun.tools.doclets.formats.html.ConfigurationImpl;
-import org.infinispan.tools.doclet.html.HtmlGenerator;
-import java.io.File;
-import java.io.IOException;
-import java.util.Arrays;
-
/**
* A Doclet that generates configuration guide for Infinispan
*
@@ -25,9 +24,10 @@
System.out.println("STARTING CONFIG DOCLET");
- HtmlGenerator generator = new ConfigHtmlGenerator(encoding, title(), bottom, footer, header,
+ ConfigHtmlGenerator generator = new ConfigHtmlGenerator(encoding, title(), bottom, footer, header,
"Infinispan configuration options", Arrays.asList("Configuration", "Infinispan",
"Data Grids", "Documentation", "Reference", "MBeans"), cp);
+ generator.setRootDoc(root);
generator.generateHtml(outputDirectory + File.separator + "config.html", "stylesheet2.css");
Modified: trunk/tools/src/main/java/org/infinispan/tools/doclet/config/ConfigHtmlGenerator.java
===================================================================
--- trunk/tools/src/main/java/org/infinispan/tools/doclet/config/ConfigHtmlGenerator.java 2009-08-26 12:45:48 UTC (rev 739)
+++ trunk/tools/src/main/java/org/infinispan/tools/doclet/config/ConfigHtmlGenerator.java 2009-08-26 12:59:39 UTC (rev 740)
@@ -1,43 +1,72 @@
package org.infinispan.tools.doclet.config;
+import java.io.InputStream;
+import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
-import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
+import java.util.Arrays;
+import java.util.Collection;
import java.util.List;
+import java.util.Set;
+import org.infinispan.Version;
import org.infinispan.config.AbstractConfigurationBean;
-import org.infinispan.config.ConfigurationAttribute;
-import org.infinispan.config.ConfigurationElement;
-import org.infinispan.config.ConfigurationElements;
-import org.infinispan.config.ConfigurationProperties;
-import org.infinispan.config.ConfigurationProperty;
-import org.infinispan.config.parsing.TreeNode;
+import org.infinispan.config.InfinispanConfiguration;
import org.infinispan.tools.doclet.html.HtmlGenerator;
+import org.infinispan.tools.schema.AbstractTreeWalker;
+import org.infinispan.tools.schema.TreeNode;
+import org.infinispan.tools.schema.XSOMSchemaTreeWalker;
import org.infinispan.util.ClassFinder;
+import org.infinispan.util.FileLookup;
+import org.infinispan.util.TypedProperties;
+import com.sun.javadoc.ClassDoc;
+import com.sun.javadoc.FieldDoc;
+import com.sun.javadoc.RootDoc;
+import com.sun.javadoc.Tag;
+import com.sun.xml.xsom.XSAttributeDecl;
+import com.sun.xml.xsom.XSFacet;
+import com.sun.xml.xsom.XSRestrictionSimpleType;
+import com.sun.xml.xsom.XSSchemaSet;
+import com.sun.xml.xsom.parser.XSOMParser;
+
/**
* Infinispan configuration reference guide generator
- *
+ *
* @author Vladimir Blagojevic
* @since 4.0
*/
+ at SuppressWarnings("restriction")
public class ConfigHtmlGenerator extends HtmlGenerator {
+
+ private static final String CONFIG_REF = "configRef";
+ private static final String CONFIG_PROPERTY_REF = "configPropertyRef";
String classpath;
+ RootDoc rootDoc;
public ConfigHtmlGenerator(String encoding, String title, String bottom, String footer,
- String header, String metaDescription, List<String> metaKeywords, String classpath) {
+ String header, String metaDescription, List<String> metaKeywords, String classpath) {
super(encoding, title, bottom, footer, header, metaDescription, metaKeywords);
this.classpath = classpath;
}
+ public RootDoc getRootDoc() {
+ return rootDoc;
+ }
+
+ public void setRootDoc(RootDoc rootDoc) {
+ this.rootDoc = rootDoc;
+ }
+
protected List<Class<?>> getConfigBeans() throws Exception {
- return ClassFinder.isAssignableFrom(ClassFinder.infinispanClasses(classpath), AbstractConfigurationBean.class);
+ return ClassFinder.isAssignableFrom(ClassFinder.infinispanClasses(classpath),
+ AbstractConfigurationBean.class);
}
protected String generateContents() {
-
+
StringBuilder sb = new StringBuilder();
// index of components
sb.append("<h2>Infinispan configuration options</h2><br/>");
@@ -45,59 +74,48 @@
List<Class<?>> configBeans;
try {
- configBeans = getConfigBeans();
-
+ configBeans = getConfigBeans();
+ configBeans.add(TypedProperties.class);
+ configBeans.add(InfinispanConfiguration.class);
+
XMLTreeOutputWalker tw = new XMLTreeOutputWalker(sb);
- TreeNode root = tw.constructTreeFromBeans(configBeans);
+ FileLookup fl = new FileLookup();
+ InputStream file = fl.lookupFile("schema/infinispan-config-" + Version.getMajorVersion()+ ".xsd");
+ XSOMParser reader = new XSOMParser();
+ reader.parse(file);
+ XSSchemaSet xss = reader.getResult();
+ XSOMSchemaTreeWalker w = new XSOMSchemaTreeWalker(xss.getSchema(1), "infinispan");
+ TreeNode root = w.getRoot();
+
+ associateBeansWithTreeNodes(configBeans, root);
+
+ sb.append("<div class=\"" + "source" + "\"><pre>");
+ // print xml tree into StringBuilder
+ tw.preOrderTraverse(root);
+ sb.append("</pre></div>");
- sb.append("<div class=\"" +"source" + "\"><pre>");
- //print xml tree into StringBuilder
- tw.preOrderTraverse(root);
- sb.append("</pre></div>");
- for (Class<?> clazz : configBeans) {
- ConfigurationElement ces[] = configurationElementsOnBean(clazz);
- for (ConfigurationElement ce : ces) {
- boolean createdAttributes = false;
- boolean createdProperties = false;
- //Name, description, parent and child elements for ce ConfigurationElement
- generateHeaderForConfigurationElement(sb, tw, root, ce);
- for (Method m : clazz.getMethods()) {
- ConfigurationAttribute a = m.getAnnotation(ConfigurationAttribute.class);
- boolean attribute = a != null && a.containingElement().equals(ce.name());
- if (attribute && !createdAttributes) {
- // Attributes
- sb.append("<table class=\"bodyTable\"> ");
- sb.append("<tr class=\"a\"><th>Attribute</th><th>Type</th><th>Default</th><th>Description</th></tr>\n");
- createdAttributes = true;
- }
- if (attribute) {
- generateAttributeTableRow(clazz,sb, m, a);
- }
- }
- if (createdAttributes) {
- sb.append("</table></div>");
- }
-
- for (Method m : clazz.getMethods()) {
- ConfigurationProperty[] cprops = propertiesElementsOnMethod(m);
- for (ConfigurationProperty c : cprops) {
- boolean property = c.parentElement().equals(ce.name());
- if (property && !createdProperties) {
- // custom properties
- sb.append("\n<table class=\"bodyTable\"> ");
- sb.append("<tr class=\"a\"><th>Property</th><th>Description</th></tr>\n");
- createdProperties = true;
- }
- if (property) {
- generatePropertyTableRow(sb, c);
- }
- }
- }
- if (createdProperties) {
- sb.append("</table></div>");
- }
+ TreeNode node = tw.findNode(root, "namedCache", "infinispan");
+ node.detach();
+
+ PruneTreeWalker ptw = new PruneTreeWalker("property");
+ ptw.postOrderTraverse(root);
+
+ for (TreeNode n : root) {
+ if (n.getName().equals("properties"))
+ continue;
+
+ // Name, description, parent and child elements node
+ generateHeaderForConfigurationElement(sb, tw, n);
+ if (!n.getAttributes().isEmpty()) {
+ generateAttributeTableRows(sb, n);
}
- }
+
+ //has properties?
+ if (n.hasChild("properties")) {
+ generatePropertiesTableRows(sb, n);
+ }
+ }
+
} catch (Exception e) {
System.out.println("Exception while generating configuration reference " + e);
System.out.println("Classpath is " + classpath);
@@ -106,92 +124,159 @@
return sb.toString();
}
- private void generatePropertyTableRow(StringBuilder sb, ConfigurationProperty c) {
- sb.append("<tr class=\"b\">");
- sb.append("<td>").append(c.name()).append("</td>\n");
- if(c.description().length() >0)
- sb.append("<td>").append(c.description()).append("</td>\n");
- else
- sb.append("<td>").append("todo").append("</td>\n");
- sb.append("</tr>\n");
+ private void associateBeansWithTreeNodes(List<Class<?>> configBeans, TreeNode root) {
+ for (TreeNode n : root) {
+ if (n.getBeanClass() == null) {
+ for (Class<?> clazz : configBeans) {
+ ClassDoc classDoc = rootDoc.classNamed(clazz.getName());
+ if (classDoc != null) {
+ List<Tag> list = Arrays.asList(classDoc.tags(CONFIG_REF));
+ for (Tag tag : list) {
+ String text = tag.text().trim();
+ if(text.contains(":")){
+ String strings []= text.split(":");
+ String parent = strings[1].trim();
+ String thisNode = strings[0].trim();
+ if(thisNode.startsWith(n.getName()) && parent.startsWith(n.getParent().getName())){
+ n.setBeanClass(clazz);
+ }
+ }
+ if (text.startsWith(n.getName()) && n.getBeanClass() == null) {
+ n.setBeanClass(clazz);
+ }
+ }
+ }
+ }
+ }
+ }
}
- private ConfigurationProperty[] propertiesElementsOnMethod(Method m) {
- ConfigurationProperty[] cprops = new ConfigurationProperty[0];
- ConfigurationProperties cp = m.getAnnotation(ConfigurationProperties.class);
- ConfigurationProperty p = null;
- if (cp != null) {
- cprops = cp.elements();
- } else {
- p = m.getAnnotation(ConfigurationProperty.class);
- if (p != null) {
- cprops = new ConfigurationProperty[]{p};
+ private void generatePropertiesTableRows(StringBuilder sb, TreeNode n) {
+ FieldDoc fieldDoc = fieldDocWithTag(n.getBeanClass(),CONFIG_PROPERTY_REF);
+ if (fieldDoc != null) {
+ sb.append("\n<table class=\"bodyTable\"> ");
+ sb.append("<tr class=\"a\"><th>Property</th><th>Description</th></tr>\n");
+ Tag[] tags = fieldDoc.tags(CONFIG_PROPERTY_REF);
+ for (Tag t : tags) {
+ String[] strings = t.text().trim().split(" ");
+ sb.append("<tr class=\"b\">");
+ sb.append("<td>").append(strings[0]).append("</td>\n");
+ if (strings.length > 1)
+ sb.append("<td>").append(strings[1]).append("</td>\n");
+ else
+ sb.append("<td>").append("todo").append("</td>\n");
+
+ sb.append("</tr>\n");
}
+ sb.append("</table></div>");
}
- return cprops;
}
- private void generateAttributeTableRow(Class<?> bean,StringBuilder sb, Method m, ConfigurationAttribute a) {
- sb.append("<tr class=\"b\">");
- sb.append("<td>").append("<code>" + a.name() +"</code>").append("</td>\n");
-
- sb.append("<td>").append("<code>" + m.getParameterTypes()[0].getSimpleName() + "</code>");
- if(a.allowedValues().length>0){
- sb.append("* (");
- for(String s:a.allowedValues()){
- sb.append(s+'|');
+ private void generateAttributeTableRows(StringBuilder sb, TreeNode n) {
+
+ sb.append("<table class=\"bodyTable\"> ");
+ sb.append("<tr class=\"a\"><th>Attribute</th><th>Type</th><th>Default</th><th>Description</th></tr>\n");
+
+ Class<?> bean = n.getBeanClass();
+ Object object = null;
+ try {
+ Constructor<?>[] constructors = bean.getDeclaredConstructors();
+ for (Constructor<?> c : constructors) {
+ if (c.getParameterTypes().length == 0) {
+ c.setAccessible(true);
+ object = c.newInstance();
+ }
}
- sb.deleteCharAt(sb.length()-1);
- sb.append(")</td>\n");
- } else{
- sb.append("</td>\n");
- }
-
- //if default value specified in annotation use it
- if (a.defaultValue().length() > 0) {
- sb.append("<td>").append(a.defaultValue()).append("</td>\n");
+ } catch (Exception e) {
}
- //otherwise reflect that field and read default value
- else {
- try {
- //reflect default value
- Object matchingFieldValue = matchingFieldValue(bean,m);
- sb.append("<td>").append(matchingFieldValue).append("</td>\n");
- } catch (Exception e) {
- sb.append("<td>").append("N/A").append("</td>\n");
+ Set<XSAttributeDecl> attributes = n.getAttributes();
+ for (XSAttributeDecl a : attributes) {
+ sb.append("<tr class=\"b\">");
+ sb.append("<td>").append("<code>" + a.getName() + "</code>").append("</td>\n");
+ sb.append("<td>").append("<code>" + a.getType().getName() + "</code>");
+
+ XSRestrictionSimpleType restriction = a.getType().asRestriction();
+ Collection<? extends XSFacet> declaredFacets = restriction.getDeclaredFacets();
+
+ // if default value specified in annotation use it
+ if (a.getDefaultValue() != null) {
+ sb.append("<td>").append(a.getDefaultValue().toString()).append("</td>\n");
}
- }
- if(a.description().length() >0)
- sb.append("<td>").append(a.description()).append("</td>\n");
- else
- sb.append("<td>").append("todo").append("</td>\n");
-
- sb.append("</tr>\n");
+
+ // otherwise reflect that field and read default value
+ else {
+ boolean valueSet = false;
+ try {
+ Field field = findFieldRecursively(bean, a.getName());
+ Object value = fieldValue(field, object);
+ if (value != null) {
+ valueSet = true;
+ sb.append("<td>").append(value.toString()).append("</td>\n");
+ }
+ } catch (Exception e) {
+ } finally {
+ if (!valueSet) {
+ sb.append("<td>").append("N/A").append("</td>\n");
+ }
+ }
+ }
+
+ boolean docSet = false;
+ FieldDoc fieldDoc = findFieldDocRecursively(bean, a.getName(), CONFIG_REF);
+ //System.out.println("FieldDoc for " + bean + " " + a.getName() + " is " + fieldDoc);
+ if (fieldDoc != null) {
+ Tag[] tags = fieldDoc.tags(CONFIG_REF);
+ if (tags.length == 1) {
+ docSet = true;
+ String text = tags[0].text().trim();
+ if(text.contains("|")){
+ text = text.substring(text.indexOf("|")+1);
+ sb.append("<td>").append(text).append("</td>\n");
+ }
+ }
+ }
+ if (!docSet) {
+ sb.append("<td>").append("todo").append("</td>\n");
+ }
+ sb.append("</tr>\n");
+ }
+ sb.append("</table></div>");
}
private void generateHeaderForConfigurationElement(StringBuilder sb, XMLTreeOutputWalker tw,
- TreeNode root, ConfigurationElement ce) {
- sb.append("\n<a name=\"").append("ce_" + ce.parent() +"_" +ce.name() +"\">" + "</a>");
- sb.append("<div class=\"section\"><h3><a name=\"" + ce.name() + "\"></a>" + ce.name() +"</h3>");
+ TreeNode n) {
+ sb.append("\n<a name=\"").append("ce_" + n.getParent().getName() + "_" + n.getName() + "\">" + "</a>");
+ sb.append("<div class=\"section\"><h3><a name=\"" + n.getName() + "\"></a>" + n.getName()
+ + "</h3>");
sb.append("\n<p>");
- if (ce.description().length() > 0) {
- sb.append(ce.description());
- } else {
- sb.append("todo");
+ Class<?> beanClass = n.getBeanClass();
+ //System.out.println("Generating " + n + " bean is " + beanClass);
+ ClassDoc classDoc = rootDoc.classNamed(n.getBeanClass().getName());
+ Tag[] tags = classDoc.tags(CONFIG_REF);
+ for (Tag tag : tags) {
+ String text = tag.text().trim();
+ if (text.startsWith(n.getName())) {
+ if(text.contains("|")){
+ sb.append(text.substring(text.indexOf("|")+1));
+ }
+ }
}
-
- TreeNode n = tw.findNode(root,ce.name(),ce.parent());
- sb.append(" Parent element is " + "<a href=\"").append("#ce_" + n.getParent().getParent().getName() +
- "_" + n.getParent().getName()+ "\">" + "<" + ce.parent() + ">" + "</a>.");
-
- if(!n.getChildren().isEmpty()){
+
+ if (n.getParent().getParent() != null) {
+ sb.append(" Parent element is " + "<a href=\"").append(
+ "#ce_" + n.getParent().getParent().getName() + "_" + n.getParent().getName()
+ + "\">" + "<" + n.getParent().getName() + ">" + "</a>.");
+ }
+
+ if (!n.getChildren().isEmpty()) {
sb.append(" Child elements are ");
int childCount = n.getChildren().size();
int count = 1;
for (TreeNode tn : n.getChildren()) {
- sb.append("<a href=\"").append("#ce_" + tn.getParent().getName() + "_"
- + tn.getName() + "\">" + "<" + tn.getName() + ">" + "</a>");
+ sb.append("<a href=\"").append(
+ "#ce_" + tn.getParent().getName() + "_" + tn.getName() + "\">" + "<"
+ + tn.getName() + ">" + "</a>");
if (count < childCount) {
sb.append(",");
} else {
@@ -204,38 +289,78 @@
sb.append("</p>");
}
- private ConfigurationElement[] configurationElementsOnBean(Class<?> clazz) {
- ConfigurationElements configurationElements = clazz.getAnnotation(ConfigurationElements.class);
- ConfigurationElement configurationElement = clazz.getAnnotation(ConfigurationElement.class);
- ConfigurationElement ces [] = new ConfigurationElement[0];
- if (configurationElement != null && configurationElements == null) {
- ces = new ConfigurationElement[]{configurationElement};
+ private Field findFieldRecursively(Class<?> c, String fieldName) {
+ Field f = null;
+ try {
+ f = c.getDeclaredField(fieldName);
+ } catch (NoSuchFieldException e) {
+ ClassDoc classDoc = rootDoc.classNamed(c.getName());
+ for (FieldDoc fd : classDoc.fields()) {
+ for (Tag t : fd.tags(CONFIG_REF)) {
+ if (t.text().equals(fieldName)) {
+ return findFieldRecursively(c, fd.name());
+ }
+ }
+ }
+ if (!c.equals(Object.class))
+ f = findFieldRecursively(c.getSuperclass(), fieldName);
}
- if (configurationElements != null && configurationElement == null) {
- ces = configurationElements.elements();
+ return f;
+ }
+
+ private FieldDoc findFieldDocRecursively(Class<?> c, String fieldName, String tagName) {
+ ClassDoc classDoc = rootDoc.classNamed(c.getName());
+ for (FieldDoc fd : classDoc.fields()) {
+ if (fd.name().equalsIgnoreCase(fieldName)) {
+ return fd;
+ }
+ for (Tag t : fd.tags(tagName)) {
+ if (t.text().trim().startsWith(fieldName)) {
+ return fd;
+ }
+ }
}
- return ces;
+ if (c.getSuperclass() != null)
+ findFieldDocRecursively(c.getSuperclass(), fieldName, tagName);
+ return null;
}
- private Object matchingFieldValue(Class<?> bean, Method m) throws Exception {
- String name = m.getName();
- if (!name.startsWith("set")) throw new IllegalArgumentException("Not a setter method");
+ private FieldDoc fieldDocWithTag(Class<?> c, String tagName) {
+ ClassDoc classDoc = rootDoc.classNamed(c.getName());
+ for (FieldDoc fd : classDoc.fields()) {
+ if (fd.tags(tagName).length > 0)
+ return fd;
- String fieldName = name.substring(name.indexOf("set") + 3);
- fieldName = fieldName.substring(0, 1).toLowerCase() + fieldName.substring(1);
- Field f = m.getDeclaringClass().getDeclaredField(fieldName);
- return getField(f, bean.newInstance());
+ }
+ if (c.getSuperclass() != null)
+ fieldDocWithTag(c.getSuperclass(), tagName);
+ return null;
}
- private static Object getField(Field field, Object target) {
+ private static Object fieldValue(Field field, Object target) {
if (!Modifier.isPublic(field.getModifiers())) {
field.setAccessible(true);
}
try {
return field.get(target);
- }
- catch (IllegalAccessException iae) {
+ } catch (IllegalAccessException iae) {
throw new IllegalArgumentException("Could not get field " + field, iae);
}
}
+
+ private static class PruneTreeWalker extends AbstractTreeWalker {
+
+ private String pruneNodeName = "";
+
+ private PruneTreeWalker(String pruneNodeName) {
+ super();
+ this.pruneNodeName = pruneNodeName;
+ }
+
+ public void visitNode(TreeNode treeNode) {
+ if (treeNode.getName().equals(pruneNodeName)) {
+ treeNode.detach();
+ }
+ }
+ }
}
Modified: trunk/tools/src/main/java/org/infinispan/tools/doclet/config/XMLTreeOutputWalker.java
===================================================================
--- trunk/tools/src/main/java/org/infinispan/tools/doclet/config/XMLTreeOutputWalker.java 2009-08-26 12:45:48 UTC (rev 739)
+++ trunk/tools/src/main/java/org/infinispan/tools/doclet/config/XMLTreeOutputWalker.java 2009-08-26 12:59:39 UTC (rev 740)
@@ -21,8 +21,8 @@
*/
package org.infinispan.tools.doclet.config;
-import org.infinispan.tools.schema.ConfigurationTreeWalker;
-import org.infinispan.config.parsing.TreeNode;
+import org.infinispan.tools.schema.AbstractTreeWalker;
+import org.infinispan.tools.schema.TreeNode;
/**
* TreeWalker that generates XML pretty print of the configuration tree
@@ -31,7 +31,7 @@
* @see ConfigDoclet
* @since 4.0
*/
-public class XMLTreeOutputWalker extends ConfigurationTreeWalker {
+public class XMLTreeOutputWalker extends AbstractTreeWalker {
private final StringBuilder sb;
@@ -44,7 +44,12 @@
String ident = "";
for(int i = 0; i<=treeNode.getDepth();i++)
ident += " ";
- sb.append(ident + "<<a href=\"" + "#ce_" + treeNode.getParent().getName()
+
+ String parentName = treeNode.getParent().getName();
+ if(parentName.startsWith("namedCache")){
+ parentName = "default";
+ }
+ sb.append(ident + "<<a href=\"" + "#ce_" + parentName
+ "_" + treeNode.getName() + "\">" + treeNode.getName() + "</a>>" + "\n");
}
Copied: trunk/tools/src/main/java/org/infinispan/tools/schema/AbstractTreeWalker.java (from rev 721, trunk/tools/src/main/java/org/infinispan/tools/schema/ConfigurationTreeWalker.java)
===================================================================
--- trunk/tools/src/main/java/org/infinispan/tools/schema/AbstractTreeWalker.java (rev 0)
+++ trunk/tools/src/main/java/org/infinispan/tools/schema/AbstractTreeWalker.java 2009-08-26 12:59:39 UTC (rev 740)
@@ -0,0 +1,75 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.infinispan.tools.schema;
+
+import java.util.Queue;
+import java.util.concurrent.LinkedBlockingQueue;
+
+import org.infinispan.util.logging.Log;
+import org.infinispan.util.logging.LogFactory;
+
+/**
+ * TreeWalker abstract super class that should be extended for a particular tool
+ *
+ * @author Vladimir Blagojevic
+ * @since 4.0
+ */
+public abstract class AbstractTreeWalker implements TreeWalker{
+
+ protected final Log log;
+
+ public AbstractTreeWalker() {
+ super();
+ log = LogFactory.getLog(getClass());
+ }
+
+ public void levelOrderTraverse(TreeNode root) {
+ Queue<TreeNode> q = new LinkedBlockingQueue<TreeNode>();
+ q.add(root);
+
+ while(!q.isEmpty()){
+ TreeNode treeNode = q.poll();
+ treeNode.accept(this);
+ if(treeNode.hasChildren()){
+ q.addAll(treeNode.getChildren());
+ }
+ }
+ }
+
+ public void preOrderTraverse(TreeNode node) {
+ node.accept(this);
+ if(node.hasChildren()){
+ for (TreeNode child : node.getChildren()) {
+ preOrderTraverse(child);
+ }
+ }
+ }
+
+ public void postOrderTraverse(TreeNode node) {
+ if(node.hasChildren()){
+ for (TreeNode child : node.getChildren()) {
+ preOrderTraverse(child);
+ }
+ }
+ node.accept(this);
+ }
+}
\ No newline at end of file
Deleted: trunk/tools/src/main/java/org/infinispan/tools/schema/ConfigurationTreeWalker.java
===================================================================
--- trunk/tools/src/main/java/org/infinispan/tools/schema/ConfigurationTreeWalker.java 2009-08-26 12:45:48 UTC (rev 739)
+++ trunk/tools/src/main/java/org/infinispan/tools/schema/ConfigurationTreeWalker.java 2009-08-26 12:59:39 UTC (rev 740)
@@ -1,196 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.infinispan.tools.schema;
-
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Queue;
-import java.util.concurrent.LinkedBlockingQueue;
-
-import org.infinispan.config.ConfigurationElement;
-import org.infinispan.config.ConfigurationElements;
-import org.infinispan.config.ConfigurationException;
-import org.infinispan.config.ConfigurationProperties;
-import org.infinispan.config.ConfigurationProperty;
-import org.infinispan.config.parsing.TreeNode;
-import org.infinispan.config.parsing.TreeWalker;
-import org.infinispan.util.logging.Log;
-import org.infinispan.util.logging.LogFactory;
-
-/**
- * TreeWalker abstract super class that should be extended for a particular tool
- *
- * @author Vladimir Blagojevic
- * @see SchemaGeneratorTreeWalker
- * @see XMLTreeOutputWalker
- * @since 4.0
- */
-public abstract class ConfigurationTreeWalker implements TreeWalker{
-
- protected final Log log;
-
- public ConfigurationTreeWalker() {
- super();
- log = LogFactory.getLog(getClass());
- }
-
- public TreeNode constructTreeFromBeans(List<Class<?>>configBeans) {
- List<ConfigurationElement> lce = new ArrayList<ConfigurationElement>(7);
- for (Class<?> clazz : configBeans) {
- ConfigurationElement ces[] = null;
- ConfigurationElements configurationElements = clazz.getAnnotation(ConfigurationElements.class);
- ConfigurationElement configurationElement = clazz.getAnnotation(ConfigurationElement.class);
-
- if (configurationElement != null && configurationElements == null) {
- ces = new ConfigurationElement[]{configurationElement};
- }
- if (configurationElements != null && configurationElement == null) {
- ces = configurationElements.elements();
- }
- if(ces != null){
- lce.addAll(Arrays.asList(ces));
- }
- }
- TreeNode root = new TreeNode("infinispan",new TreeNode(),0);
- makeTree(lce,root, 1);
- return root;
- }
-
- private void makeTree(List<ConfigurationElement> lce, TreeNode tn, int currentDepth) {
- for (ConfigurationElement ce : lce) {
- if(ce.parent().equals(tn.getName())){
- TreeNode child = new TreeNode(ce.name(),tn,currentDepth);
- tn.getChildren().add(child);
- makeTree(lce,child,(currentDepth+1));
- }
- }
- }
-
- public void levelOrderTraverse(TreeNode root) {
- Queue<TreeNode> q = new LinkedBlockingQueue<TreeNode>();
- q.add(root);
-
- while(!q.isEmpty()){
- TreeNode treeNode = q.poll();
- treeNode.accept(this);
- if(treeNode.hasChildren()){
- q.addAll(treeNode.getChildren());
- }
- }
- }
-
- public void preOrderTraverse(TreeNode node) {
- node.accept(this);
- if(node.hasChildren()){
- for (TreeNode child : node.getChildren()) {
- preOrderTraverse(child);
- }
- }
- }
-
- public void postOrderTraverse(TreeNode node) {
- if(node.hasChildren()){
- for (TreeNode child : node.getChildren()) {
- preOrderTraverse(child);
- }
- }
- node.accept(this);
- }
-
- public void postTraverseCleanup(){}
-
- protected ConfigurationElement findConfigurationElementForBean(Class<?> clazz, String name, String parentName){
- ConfigurationElement[] onBean = configurationElementsOnBean(clazz);
- for(ConfigurationElement ce:onBean){
- if(ce.name().equals(name) && ce.parent().equals(parentName)){
- return ce;
- }
- }
- return null;
- }
-
- protected ConfigurationElement findConfigurationElement(List<Class<?>> b, String name, String parentName){
- ConfigurationElement result = null;
- Class<?> bean = findBean(b, name, parentName);
- if(bean != null){
- result = findConfigurationElementForBean(bean, name, parentName);
- }
- return result;
- }
-
- protected ConfigurationElement[] configurationElementsOnBean(Class<?> clazz) {
- ConfigurationElements configurationElements = clazz.getAnnotation(ConfigurationElements.class);
- ConfigurationElement configurationElement = clazz.getAnnotation(ConfigurationElement.class);
- ConfigurationElement ces [] = new ConfigurationElement[0];
- if (configurationElement != null && configurationElements == null) {
- ces = new ConfigurationElement[]{configurationElement};
- }
- if (configurationElements != null && configurationElement == null) {
- ces = configurationElements.elements();
- }
- return ces;
- }
-
- protected ConfigurationProperty[] propertiesElementsOnMethod(Method m) {
- ConfigurationProperty[] cprops = new ConfigurationProperty[0];
- ConfigurationProperties cp = m.getAnnotation(ConfigurationProperties.class);
- ConfigurationProperty p = null;
- if (cp != null) {
- cprops = cp.elements();
- } else {
- p = m.getAnnotation(ConfigurationProperty.class);
- if (p != null) {
- cprops = new ConfigurationProperty[]{p};
- }
- }
- return cprops;
- }
-
-
- protected Class<?> findBean(List<Class<?>> b, String name, String parentName) throws ConfigurationException {
-
- if (parentName.equals("namedCache"))
- parentName = "default";
- for (Class<?> clazz : b) {
- ConfigurationElements elements = clazz.getAnnotation(ConfigurationElements.class);
- try {
- if (elements != null) {
- for (ConfigurationElement ce : elements.elements()) {
- if (ce.name().equals(name) && ce.parent().equals(parentName)) {
- return clazz;
- }
- }
- } else {
- ConfigurationElement ce = clazz.getAnnotation(ConfigurationElement.class);
- if (ce != null && (ce.name().equals(name) && ce.parent().equals(parentName))) {
- return clazz;
- }
- }
- } catch (Exception e1) {
- throw new ConfigurationException("Could not instantiate class " + clazz, e1);
- }
- }
- return null;
- }
-}
\ No newline at end of file
Copied: trunk/tools/src/main/java/org/infinispan/tools/schema/TreeNode.java (from rev 721, trunk/core/src/main/java/org/infinispan/config/parsing/TreeNode.java)
===================================================================
--- trunk/tools/src/main/java/org/infinispan/tools/schema/TreeNode.java (rev 0)
+++ trunk/tools/src/main/java/org/infinispan/tools/schema/TreeNode.java 2009-08-26 12:59:39 UTC (rev 740)
@@ -0,0 +1,182 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.infinispan.tools.schema;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import com.sun.xml.xsom.XSAttributeDecl;
+import com.sun.xml.xsom.XSComplexType;
+
+/**
+ * TreeNode of Infinispan configuration
+ *
+ * @author Vladimir Blagojevic
+ * @since 4.0
+ */
+ at SuppressWarnings("restriction")
+public class TreeNode implements Iterable<TreeNode> {
+ private final String name;
+ private TreeNode parent;
+ private final Set<TreeNode> children = new HashSet<TreeNode>();
+
+ private XSComplexType type;
+ private final Set<XSAttributeDecl> attributes = new HashSet<XSAttributeDecl>();
+ private Class<?> clazz;
+
+ public TreeNode(String name, TreeNode parent) {
+ this.name = name;
+ this.parent = parent;
+ }
+
+ public TreeNode() {
+ this.name = "";
+ this.parent = null;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public int getDepth() {
+ if (getParent() == null) {
+ return -1;
+ } else {
+ return 1 + getParent().getDepth();
+ }
+ }
+
+ public boolean hasChildren() {
+ return !children.isEmpty();
+ }
+
+ public boolean hasChild(String name) {
+ for (TreeNode treeNode : children) {
+ if (treeNode.getName().equals(name)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public TreeNode getParent() {
+ return parent;
+ }
+
+ public Set<TreeNode> getChildren() {
+ return children;
+ }
+
+ public void detach(){
+ parent.getChildren().remove(this);
+ parent = null;
+ }
+
+ public void accept(TreeWalker tw) {
+ tw.visitNode(this);
+ }
+
+ public Class<?> getBeanClass() {
+ return clazz;
+ }
+
+ public void setBeanClass(Class<?> bean) {
+ this.clazz = bean;
+ }
+
+ public XSComplexType getType() {
+ return type;
+ }
+
+ public void setType(XSComplexType type) {
+ this.type = type;
+ }
+
+ public void addAttribute(XSAttributeDecl att) {
+ attributes.add(att);
+ }
+
+ public Set<XSAttributeDecl> getAttributes() {
+ return attributes;
+ }
+
+ public Iterator<TreeNode> iterator() {
+ return new TreeIterator();
+ }
+
+ public boolean equals(Object other) {
+ if (other == this)
+ return true;
+ if (!(other instanceof TreeNode))
+ return false;
+ TreeNode tn = (TreeNode) other;
+ return this.parent.name != null && tn.parent != null
+ && this.parent.name.equals(tn.parent.name) && this.name.equals(tn.name);
+ }
+
+ public int hashCode() {
+ int result = 17;
+ result = 31 * result + name.hashCode();
+ result = 31 * result + ((parent != null && parent.name != null) ? parent.name.hashCode() : 0);
+ return result;
+ }
+
+ public String toString() {
+ return name;
+ }
+
+ private class TreeIterator extends AbstractTreeWalker implements Iterator<TreeNode>,
+ Iterable<TreeNode> {
+
+ private List<TreeNode> nodes;
+ private Iterator<TreeNode> i;
+
+ private TreeIterator() {
+ super();
+ nodes = new ArrayList<TreeNode>();
+ preOrderTraverse(TreeNode.this);
+ i = nodes.iterator();
+ }
+
+ public Iterator<TreeNode> iterator() {
+ return nodes.iterator();
+ }
+
+ public void visitNode(TreeNode treeNode) {
+ nodes.add(treeNode);
+ }
+
+ public boolean hasNext() {
+ return i.hasNext();
+ }
+
+ public TreeNode next() {
+ return i.next();
+ }
+
+ public void remove() {
+ }
+ }
+}
\ No newline at end of file
Copied: trunk/tools/src/main/java/org/infinispan/tools/schema/TreeWalker.java (from rev 721, trunk/core/src/main/java/org/infinispan/config/parsing/TreeWalker.java)
===================================================================
--- trunk/tools/src/main/java/org/infinispan/tools/schema/TreeWalker.java (rev 0)
+++ trunk/tools/src/main/java/org/infinispan/tools/schema/TreeWalker.java 2009-08-26 12:59:39 UTC (rev 740)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.infinispan.tools.schema;
+
+/**
+ * TreeWalker visitor
+ *
+ * @author Vladimir Blagojevic
+ * @see XMLTreeOutputWalker
+ * @since 4.0
+ */
+public interface TreeWalker {
+
+ void visitNode(TreeNode treeNode);
+
+}
Added: trunk/tools/src/main/java/org/infinispan/tools/schema/XSOMSchemaTreeWalker.java
===================================================================
--- trunk/tools/src/main/java/org/infinispan/tools/schema/XSOMSchemaTreeWalker.java (rev 0)
+++ trunk/tools/src/main/java/org/infinispan/tools/schema/XSOMSchemaTreeWalker.java 2009-08-26 12:59:39 UTC (rev 740)
@@ -0,0 +1,230 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.infinispan.tools.schema;
+
+import java.util.Iterator;
+
+import com.sun.xml.xsom.XSAnnotation;
+import com.sun.xml.xsom.XSAttGroupDecl;
+import com.sun.xml.xsom.XSAttributeDecl;
+import com.sun.xml.xsom.XSAttributeUse;
+import com.sun.xml.xsom.XSComplexType;
+import com.sun.xml.xsom.XSContentType;
+import com.sun.xml.xsom.XSElementDecl;
+import com.sun.xml.xsom.XSFacet;
+import com.sun.xml.xsom.XSIdentityConstraint;
+import com.sun.xml.xsom.XSListSimpleType;
+import com.sun.xml.xsom.XSModelGroup;
+import com.sun.xml.xsom.XSModelGroupDecl;
+import com.sun.xml.xsom.XSNotation;
+import com.sun.xml.xsom.XSParticle;
+import com.sun.xml.xsom.XSRestrictionSimpleType;
+import com.sun.xml.xsom.XSSchema;
+import com.sun.xml.xsom.XSSimpleType;
+import com.sun.xml.xsom.XSType;
+import com.sun.xml.xsom.XSUnionSimpleType;
+import com.sun.xml.xsom.XSWildcard;
+import com.sun.xml.xsom.XSXPath;
+import com.sun.xml.xsom.visitor.XSSimpleTypeVisitor;
+import com.sun.xml.xsom.visitor.XSTermVisitor;
+import com.sun.xml.xsom.visitor.XSVisitor;
+
+/**
+ * XSOMSchemaTreeWalker traverses XML schema and builds a tree with elements we need out of that schema
+ *
+ * @author Vladimir Blagojevic
+ * @see ConfigHtmlGenerator
+ * @since 4.0
+ */
+public class XSOMSchemaTreeWalker implements XSVisitor {
+ private XSSchema schema;
+ TreeNode root;
+ TreeNode currentNode;
+
+ public XSOMSchemaTreeWalker(XSSchema schema, String rootName) {
+ super();
+ this.schema = schema;
+ XSElementDecl decl = schema.getElementDecl(rootName);
+ XSComplexType type = schema.getComplexType(decl.getType().getName());
+ root = new TreeNode("infinispan", new TreeNode());
+ root.setType(type);
+ currentNode = root;
+ complexType(type);
+ }
+
+ public TreeNode getRoot() {
+ return root;
+ }
+
+ public void empty(XSContentType empty) {
+ }
+
+ public void particle(XSParticle part) {
+ int i;
+
+ StringBuffer buf = new StringBuffer();
+ i = part.getMaxOccurs();
+ if (i == XSParticle.UNBOUNDED) {
+ buf.append(" maxOccurs=\"unbounded\"");
+ } else {
+ if (i != 1) {
+ buf.append(" maxOccurs=\"" + i + "\"");
+ }
+ }
+
+ i = part.getMinOccurs();
+ if (i != 1) {
+ buf.append(" minOccurs=\"" + i + "\"");
+ }
+
+ part.getTerm().visit(new XSTermVisitor() {
+ public void elementDecl(XSElementDecl decl) {
+ if (decl.isLocal()) {
+ XSOMSchemaTreeWalker.this.elementDecl(decl);
+ } else {
+ // reference, don't care
+ }
+ }
+
+ public void modelGroupDecl(XSModelGroupDecl decl) {
+ }
+
+ public void modelGroup(XSModelGroup group) {
+ final int len = group.getSize();
+ for (int i = 0; i < len; i++) {
+ particle(group.getChild(i));
+ }
+ }
+
+ public void wildcard(XSWildcard wc) {
+ }
+ });
+ }
+
+ public void simpleType(XSSimpleType simpleType) {
+ simpleType.visit(new XSSimpleTypeVisitor() {
+
+ public void listSimpleType(XSListSimpleType type) {
+ }
+
+ public void restrictionSimpleType(XSRestrictionSimpleType type) {
+ XSSimpleType baseType = type.getSimpleBaseType();
+ //System.out.println("Restriction " + type.getName() + " :" + baseType.getName());
+ Iterator<?> itr = type.iterateDeclaredFacets();
+ while (itr.hasNext()) {
+ facet((XSFacet) itr.next());
+ }
+ }
+
+ public void unionSimpleType(XSUnionSimpleType type) {
+ }
+ });
+ }
+
+ public void annotation(XSAnnotation ann) {
+
+ }
+
+ public void attGroupDecl(XSAttGroupDecl decl) {
+
+ }
+
+ public void attributeDecl(XSAttributeDecl decl) {
+ // visitAttribute(decl);
+ }
+
+ public void attributeUse(XSAttributeUse use) {
+ XSAttributeDecl decl = use.getDecl();
+
+ if (decl.isLocal()) {
+ // this is anonymous attribute use
+ visitAttribute(decl);
+ }
+ }
+
+ private void visitAttribute(XSAttributeDecl decl) {
+ XSSimpleType type = decl.getType();
+ //System.out.println("Visiting attribute " + decl.getName() + ":" + type.getName());
+ currentNode.addAttribute(decl);
+ if (schema.getSimpleType(type.getName()) != null)
+ simpleType(type);
+ }
+
+ private void dumpComplexTypeAttribute(XSComplexType type) {
+ Iterator<?> itr = type.iterateDeclaredAttributeUses();
+ while (itr.hasNext()) {
+ attributeUse((XSAttributeUse) itr.next());
+ }
+ }
+
+ public void complexType(XSComplexType type) {
+ dumpComplexTypeAttribute(type);
+ if (type.getDerivationMethod() == XSType.RESTRICTION) {
+ type.getContentType().visit(this);
+ } else {
+ XSType baseType = type.getBaseType();
+ String name = baseType.getName();
+ XSComplexType parentType = schema.getComplexType(name);
+ complexType(parentType);
+ type.getExplicitContent().visit(this);
+ }
+ }
+
+ public void facet(XSFacet facet) {
+ //System.out.println(facet.getName() + ":" + facet.getValue());
+ }
+
+ public void identityConstraint(XSIdentityConstraint decl) {
+ }
+
+ public void notation(XSNotation notation) {
+ }
+
+ public void schema(XSSchema schema) {
+ }
+
+ public void xpath(XSXPath xp) {
+ }
+
+ public void elementDecl(XSElementDecl decl) {
+ XSComplexType type = schema.getComplexType(decl.getType().getName());
+ if (!decl.isAbstract()) {
+ TreeNode n = new TreeNode(decl.getName(), currentNode);
+ /*System.out.println("Created node " + n.getName() + ", parent is "
+ + n.getParent().getName() + " depth is " + n.getDepth());*/
+ currentNode.getChildren().add(n);
+ currentNode = n;
+ currentNode.setType(type);
+ complexType(type);
+ currentNode = n.getParent();
+ }
+ }
+
+ public void modelGroup(XSModelGroup group) {
+ }
+
+ public void modelGroupDecl(XSModelGroupDecl decl) {
+ }
+
+ public void wildcard(XSWildcard wc) {
+ }
+}
\ No newline at end of file
More information about the infinispan-commits
mailing list