[infinispan-commits] Infinispan SVN: r2534 - in trunk: core/src/main/java/org/infinispan/loaders and 2 other directories.
infinispan-commits at lists.jboss.org
infinispan-commits at lists.jboss.org
Wed Oct 20 14:00:27 EDT 2010
Author: vblagojevic at jboss.com
Date: 2010-10-20 14:00:27 -0400 (Wed, 20 Oct 2010)
New Revision: 2534
Added:
trunk/core/src/main/java/org/infinispan/config/ConfigurationDoc.java
trunk/core/src/main/java/org/infinispan/config/ConfigurationDocRef.java
trunk/core/src/main/java/org/infinispan/config/ConfigurationDocs.java
Modified:
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/loaders/AbstractCacheLoaderConfig.java
trunk/core/src/main/java/org/infinispan/loaders/AbstractCacheStoreConfig.java
trunk/core/src/main/java/org/infinispan/loaders/CacheLoaderConfig.java
trunk/core/src/main/java/org/infinispan/loaders/decorators/AsyncStoreConfig.java
trunk/core/src/main/java/org/infinispan/loaders/decorators/SingletonStoreConfig.java
trunk/tools/src/main/java/org/infinispan/tools/doclet/config/AbstractConfigHtmlGenerator.java
trunk/tools/src/main/java/org/infinispan/tools/doclet/config/ConfigHtmlGenerator.java
Log:
[ISPN-626] - Config doc and Javadocs not in sync
Modified: trunk/core/src/main/java/org/infinispan/config/CacheLoaderManagerConfig.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/config/CacheLoaderManagerConfig.java 2010-10-20 17:15:56 UTC (rev 2533)
+++ trunk/core/src/main/java/org/infinispan/config/CacheLoaderManagerConfig.java 2010-10-20 18:00:27 UTC (rev 2534)
@@ -33,18 +33,12 @@
import java.util.List;
/**
- * Holds the configuration of the cache loader chain. ALL cache loaders should be defined using this
+ * Holds the configuration of the cache loader chain. All cache loaders should be defined using this
* class, adding individual cache loaders to the chain by calling
* {@link CacheLoaderManagerConfig#addCacheLoaderConfig}
*
- * <p>
- * Note that class CacheLoaderManagerConfig 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 name="loaders",desc="Holds the configuration for cache loaders and stores."
- *
* @see <a href="../../../config.html#ce_default_loaders">Configuration reference</a>
*
* @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
@@ -54,40 +48,18 @@
* @since 4.0
*/
@XmlAccessorType(XmlAccessType.PUBLIC_MEMBER)
+ at ConfigurationDoc(name="loaders",desc="Holds the configuration for cache loaders and stores")
public class CacheLoaderManagerConfig extends AbstractNamedCacheConfigurationBean {
private static final long serialVersionUID = 2210349340378984424L;
- /**
- * @configRef desc="If true, data is only written to the cache store when it is evicted from memory,
- * a phenomenon known as 'passivation'. Next time the data is requested, it will be 'activated' which
- * means that data will be brought back to memory and removed from the persistent store. This gives you
- * the ability to 'overflow' to disk, similar to swapping in an operating system.
- * <br /><br />
- * If false, the cache store contains a copy of the contents in memory, so writes to cache
- * result in cache store writes. This essentially gives you a 'write-through' configuration."
- * */
+ @ConfigurationDocRef(bean=CacheLoaderManagerConfig.class,targetElement="setPassivation")
protected Boolean passivation = false;
- /**
- * @configRef desc= "If true, when the cache starts, data stored in the cache store will be pre-loaded into
- * memory. This is particularly useful when data in the cache store will be needed immediately
- * after startup and you want to avoid cache operations being delayed as a result of loading this
- * data lazily. Can be used to provide a 'warm-cache' on startup, however there is a performance
- * penalty as startup time is affected by this process."
- * */
+ @ConfigurationDocRef(bean=CacheLoaderManagerConfig.class,targetElement="setPreload")
protected Boolean preload = false;
- /**
- * @configRef desc="This setting should be set to true when multiple cache instances share the same cache store
- * (e.g., multiple nodes in a cluster using a JDBC-based CacheStore pointing to the same, shared
- * database.) Setting this to true avoids multiple cache instances writing the same modification multiple
- * times. If enabled, only the node where the modification originated will write to the cache store.
- * <br /><br />
- * If disabled, each individual cache reacts to a potential remote update by storing the data to the cache
- * store. Note that this could be useful if each individual node has its own cache store - perhaps local
- * on-disk.
- * */
+ @ConfigurationDocRef(bean=CacheLoaderManagerConfig.class,targetElement="setShared")
protected Boolean shared = false;
protected List<CacheLoaderConfig> cacheLoaderConfigs = new LinkedList<CacheLoaderConfig>();
@@ -96,12 +68,32 @@
return preload;
}
+ /**
+ * If true, when the cache starts, data stored in the cache store will be pre-loaded into memory.
+ * This is particularly useful when data in the cache store will be needed immediately after
+ * startup and you want to avoid cache operations being delayed as a result of loading this data
+ * lazily. Can be used to provide a 'warm-cache' on startup, however there is a performance
+ * penalty as startup time is affected by this process.
+ *
+ * @param preload
+ */
@XmlAttribute
public void setPreload(Boolean preload) {
testImmutability("preload");
this.preload = preload;
}
+ /**
+ * If true, data is only written to the cache store when it is evicted from memory, a phenomenon
+ * known as 'passivation'. Next time the data is requested, it will be 'activated' which means
+ * that data will be brought back to memory and removed from the persistent store. This gives you
+ * the ability to 'overflow' to disk, similar to swapping in an operating system. <br />
+ * <br />
+ * If false, the cache store contains a copy of the contents in memory, so writes to cache result
+ * in cache store writes. This essentially gives you a 'write-through' configuration.
+ *
+ * @param passivation
+ */
@XmlAttribute
public void setPassivation(Boolean passivation) {
testImmutability("passivation");
@@ -112,6 +104,19 @@
return passivation;
}
+ /**
+ * This setting should be set to true when multiple cache instances share the same cache store
+ * (e.g., multiple nodes in a cluster using a JDBC-based CacheStore pointing to the same, shared
+ * database.) Setting this to true avoids multiple cache instances writing the same modification
+ * multiple times. If enabled, only the node where the modification originated will write to the
+ * cache store. <br />
+ * <br />
+ * If disabled, each individual cache reacts to a potential remote update by storing the data to
+ * the cache store. Note that this could be useful if each individual node has its own cache
+ * store - perhaps local on-disk.
+ *
+ * @param shared
+ */
@XmlAttribute
public void setShared(Boolean shared) {
testImmutability("shared");
Modified: trunk/core/src/main/java/org/infinispan/config/Configuration.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/config/Configuration.java 2010-10-20 17:15:56 UTC (rev 2533)
+++ trunk/core/src/main/java/org/infinispan/config/Configuration.java 2010-10-20 18:00:27 UTC (rev 2534)
@@ -51,19 +51,9 @@
import static java.util.concurrent.TimeUnit.MINUTES;
/**
- * Encapsulates the configuration of a Cache.
- * <p>
- * A default instance of this bean takes default values for each attribute. Please see the individual setters for
- * details of what these defaults are.
- * </p>
- *
- * @configRef name="default",desc="Configures the default cache which can be retrieved via CacheManager.getCache().
- * These default settings are also used as a starting point when configuring namedCaches,
- * since the default settings are inherited by any named cache."
- * @configRef name="namedCache",desc=" If you use <namedCache ... > instead of <default ... > this defines a
- * a named cache whose name can be passed to CacheManager.getCache(String)
- * in order to retrieve the named instance. Named caches inherit settings from the
- * default, and additional behavior can be specified or overridden. Also the 'name' attribute is mandatory."
+ * Encapsulates the configuration of a Cache. Configures the default cache which can be retrieved
+ * via CacheManager.getCache(). These default settings are also used as a starting point when
+ * configuring namedCaches, since the default settings are inherited by any named cache.
*
* @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
* @author Vladimir Blagojevic
@@ -72,16 +62,10 @@
*
* @see <a href="../../../config.html#ce_infinispan_default">Configuration reference</a>
*/
-
-//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.
-
-
@SurvivesRestarts
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(propOrder={})
+ at ConfigurationDoc(name="default")
public class Configuration extends AbstractNamedCacheConfigurationBean {
private static final long serialVersionUID = 5553791890144997466L;
@@ -90,10 +74,8 @@
@XmlTransient
private GlobalConfiguration globalConfiguration;
- /**
- * @configRef desc="Only used with the namedCache element, this attribute specifies the name of the cache. Can be any String, but must be unique in a given configuration."
- * */
@XmlAttribute
+ @ConfigurationDoc(desc="Only used with the namedCache element, this attribute specifies the name of the cache. Can be any String, but must be unique in a given configuration.")
protected String name;
@@ -203,6 +185,12 @@
}
+ /**
+ * Time period that determines how often is lock acquisition attempted within maximum time
+ * allowed to acquire a particular lock
+ *
+ * @param eagerDeadlockSpinDuration
+ */
public void setDeadlockDetectionSpinDuration(long eagerDeadlockSpinDuration) {
this.deadlockDetection.setSpinDuration(eagerDeadlockSpinDuration);
}
@@ -211,10 +199,22 @@
return deadlockDetection.enabled;
}
+ /**
+ * Toggle to enable/disable deadlock detection
+ *
+ * @param useEagerDeadlockDetection
+ */
public void setEnableDeadlockDetection(boolean useEagerDeadlockDetection) {
this.deadlockDetection.setEnabled(useEagerDeadlockDetection);
}
+ /**
+ * If true, a pool of shared locks is maintained for all entries that need to be locked.
+ * Otherwise, a lock is created per entry in the cache. Lock striping helps control memory
+ * footprint but may reduce concurrency in the system.
+ *
+ * @param useLockStriping
+ */
public void setUseLockStriping(boolean useLockStriping) {
locking.setUseLockStriping(useLockStriping);
}
@@ -227,10 +227,22 @@
return unsafe.unreliableReturnValues;
}
+
+
+ /**
+ * Toggle to enable/disable return value fetching
+ *
+ * @param unsafeUnreliableReturnValues
+ */
public void setUnsafeUnreliableReturnValues(boolean unsafeUnreliableReturnValues) {
this.unsafe.setUnreliableReturnValues(unsafeUnreliableReturnValues);
}
+ /**
+ * Rehashing timeout
+ *
+ * @param rehashRpcTimeout
+ */
public void setRehashRpcTimeout(long rehashRpcTimeout) {
this.clustering.hash.setRehashRpcTimeout(rehashRpcTimeout);
}
@@ -242,6 +254,14 @@
return locking.writeSkewCheck;
}
+ /**
+ * This setting is only applicable in the case of REPEATABLE_READ. When write skew check is set
+ * to false, if the writer at commit time discovers that the working entry and the underlying
+ * entry have different versions, the working entry will overwrite the underlying entry. If true,
+ * such version conflict - known as a write-skew - will throw an Exception.
+ *
+ * @param writeSkewCheck
+ */
public void setWriteSkewCheck(boolean writeSkewCheck) {
locking.setWriteSkewCheck(writeSkewCheck);
}
@@ -250,14 +270,34 @@
return locking.concurrencyLevel;
}
+ /**
+ * Concurrency level for lock containers. Adjust this value according to the number of concurrent
+ * threads interating with Infinispan. Similar to the concurrencyLevel tuning parameter seen in
+ * the JDK's ConcurrentHashMap.
+ *
+ * @param concurrencyLevel
+ */
public void setConcurrencyLevel(int concurrencyLevel) {
locking.setConcurrencyLevel(concurrencyLevel);
}
+ /**
+ * If useReplQueue is set to true, this attribute can be used to trigger flushing of the queue
+ * when it reaches a specific threshold.
+ *
+ * @param replQueueMaxElements
+ */
public void setReplQueueMaxElements(int replQueueMaxElements) {
this.clustering.async.setReplQueueMaxElements(replQueueMaxElements);
}
+ /**
+ * If useReplQueue is set to true, this attribute controls how often the asynchronous thread used
+ * to flush the replication queue runs. This should be a positive integer which represents thread
+ * wakeup time in milliseconds.
+ *
+ * @param replQueueInterval
+ */
public void setReplQueueInterval(long replQueueInterval) {
this.clustering.async.setReplQueueInterval(replQueueInterval);
}
@@ -266,6 +306,12 @@
setReplQueueInterval(timeUnit.toMillis(replQueueInterval));
}
+ /**
+ * This overrides the replication queue implementation class. Overriding the default allows you
+ * to add behavior to the queue, typically by subclassing the default implementation.
+ *
+ * @param classname
+ */
public void setReplQueueClass(String classname) {
this.clustering.async.setReplQueueClass(classname);
}
@@ -287,34 +333,86 @@
invocationBatching.setEnabled(enabled);
}
+ /**
+ * If true, this will cause the cache to ask neighboring caches for state when it starts up, so
+ * the cache starts 'warm', although it will impact startup time.
+ *
+ * @param fetchInMemoryState
+ */
public void setFetchInMemoryState(boolean fetchInMemoryState) {
this.clustering.stateRetrieval.setFetchInMemoryState(fetchInMemoryState);
}
+ /**
+ * If true, this will allow the cache to provide in-memory state to a neighbor, even if the cache
+ * is not configured to fetch state from its neighbors (fetchInMemoryState is false)
+ *
+ * @param alwaysProvideInMemoryState
+ */
public void setAlwaysProvideInMemoryState(boolean alwaysProvideInMemoryState) {
this.clustering.stateRetrieval.setAlwaysProvideInMemoryState(alwaysProvideInMemoryState);
}
+ /**
+ * Maximum time to attempt a particular lock acquisition
+ *
+ * @param lockAcquisitionTimeout
+ */
public void setLockAcquisitionTimeout(long lockAcquisitionTimeout) {
locking.setLockAcquisitionTimeout(lockAcquisitionTimeout);
}
+ /**
+ * Maximum time to attempt a particular lock acquisition
+ *
+ * @param lockAcquisitionTimeout
+ * @param timeUnit
+ */
public void setLockAcquisitionTimeout(long lockAcquisitionTimeout, TimeUnit timeUnit) {
setLockAcquisitionTimeout(timeUnit.toMillis(lockAcquisitionTimeout));
}
+
+ /**
+ *
+ * This is the timeout used to wait for an acknowledgment when making a remote call, after which
+ * the call is aborted and an exception is thrown.
+ *
+ * @param syncReplTimeout
+ */
public void setSyncReplTimeout(long syncReplTimeout) {
this.clustering.sync.setReplTimeout(syncReplTimeout);
}
+ /**
+ * This is the timeout used to wait for an acknowledgment when making a remote call, after which
+ * the call is aborted and an exception is thrown.
+ *
+ * @param syncReplTimeout
+ * @param timeUnit
+ */
public void setSyncReplTimeout(long syncReplTimeout, TimeUnit timeUnit) {
setSyncReplTimeout(timeUnit.toMillis(syncReplTimeout));
}
+ /**
+ * Cache mode. For distribution, set mode to either 'd', 'dist' or 'distribution'. For
+ * replication, use either 'r', 'repl' or 'replication'. Finally, for invalidation, 'i', 'inv' or
+ * 'invalidation'.
+ *
+ * @param cacheMode
+ */
public void setCacheMode(CacheMode cacheModeInt) {
clustering.setMode(cacheModeInt);
}
+ /**
+ * Cache mode. For distribution, set mode to either 'd', 'dist' or 'distribution'. For
+ * replication, use either 'r', 'repl' or 'replication'. Finally, for invalidation, 'i', 'inv' or
+ * 'invalidation'.
+ *
+ * @param cacheMode
+ */
public void setCacheMode(String cacheMode) {
if (cacheMode == null) throw new ConfigurationException("Cache mode cannot be null", "CacheMode");
clustering.setMode(CacheMode.valueOf(uc(cacheMode)));
@@ -340,7 +438,10 @@
}
/**
- * Eviction thread wake up interval, in milliseconds.
+ * Interval between subsequent eviction runs, in milliseconds. If you wish to disable the
+ * periodic eviction process altogether, set wakeupInterval to -1.
+ *
+ * @param evictionWakeUpInterval
*/
public void setEvictionWakeUpInterval(long evictionWakeUpInterval) {
this.eviction.setWakeUpInterval(evictionWakeUpInterval);
@@ -350,11 +451,23 @@
return eviction.strategy;
}
+ /**
+ * Eviction strategy. Available options are 'UNORDERED', 'FIFO', 'LRU' and 'NONE' (to disable
+ * eviction).
+ *
+ * @param evictionStrategy
+ */
public void setEvictionStrategy(EvictionStrategy evictionStrategy) {
this.eviction.setStrategy(evictionStrategy);
}
- public void setEvictionStrategy(String eStrategy){
+ /**
+ * Eviction strategy. Available options are 'UNORDERED', 'FIFO', 'LRU' and 'NONE' (to disable
+ * eviction).
+ *
+ * @param eStrategy
+ */
+ public void setEvictionStrategy(String eStrategy) {
this.eviction.strategy = EvictionStrategy.valueOf(uc(eStrategy));
if (this.eviction.strategy == null) {
log.warn("Unknown evictionStrategy '" + eStrategy + "'! Using EvictionStrategy.NONE.");
@@ -366,10 +479,20 @@
return eviction.threadPolicy;
}
+ /**
+ * Threading policy for eviction.
+ *
+ * @param policy
+ */
public void setEvictionThreadPolicy(EvictionThreadPolicy policy) {
this.eviction.setThreadPolicy(policy);
}
+ /**
+ * Threading policy for eviction.
+ *
+ * @param policy
+ */
public void setEvictionThreadPolicy(String policy){
this.eviction.threadPolicy = EvictionThreadPolicy.valueOf(uc(policy));
if (this.eviction.threadPolicy == null) {
@@ -382,6 +505,13 @@
return eviction.maxEntries;
}
+ /**
+ * Maximum number of entries in a cache instance. If selected value is not a power of two the
+ * actual value will default to the least power of two larger than selected value. -1 means no
+ * limit.
+ *
+ * @param evictionMaxEntries
+ */
public void setEvictionMaxEntries(int evictionMaxEntries) {
this.eviction.setMaxEntries(evictionMaxEntries);
}
@@ -393,8 +523,14 @@
return expiration.lifespan;
}
+
/**
- * Expiration lifespan, in milliseconds
+ * Maximum lifespan of a cache entry, after which the entry is expired cluster-wide, in
+ * milliseconds. -1 means the entries never expire. <br />
+ * <br />
+ * Note that this can be overriden on a per-entry bassi by using the Cache API.
+ *
+ * @param expirationLifespan
*/
public void setExpirationLifespan(long expirationLifespan) {
this.expiration.setLifespan(expirationLifespan);
@@ -407,13 +543,26 @@
return expiration.maxIdle;
}
+
/**
- * Expiration max idle time, in milliseconds
- */
+ * Maximum idle time a cache entry will be maintained in the cache, in milliseconds. If the idle
+ * time is exceeded, the entry will be expired cluster-wide. -1 means the entries never expire. <br />
+ * <br />
+ * Note that this can be overriden on a per-entry bassi by using the Cache API.
+ *
+ * @param expirationMaxIdle
+ */
public void setExpirationMaxIdle(long expirationMaxIdle) {
this.expiration.setMaxIdle(expirationMaxIdle);
}
+ /**
+ * Fully qualified class name of a class that looks up a reference to a
+ * {@link javax.transaction.TransactionManager}. The default provided is capable of locating the
+ * default TransactionManager in most popular Java EE systems, using a JNDI lookup.
+ *
+ * @param transactionManagerLookupClass
+ * */
public void setTransactionManagerLookupClass(String transactionManagerLookupClass) {
this.transaction.setTransactionManagerLookupClass(transactionManagerLookupClass);
}
@@ -426,30 +575,86 @@
this.loaders = cacheLoaderManagerConfig;
}
+ /**
+ * If true, the cluster-wide commit phase in two-phase commit (2PC) transactions will be
+ * synchronous, so Infinispan will wait for responses from all nodes to which the commit was
+ * sent. Otherwise, the commit phase will be asynchronous. Keeping it as false improves
+ * performance of 2PC transactions, since any remote failures are trapped during the prepare
+ * phase anyway and appropriate rollbacks are issued.
+ *
+ * @param syncCommitPhase
+ * */
public void setSyncCommitPhase(boolean syncCommitPhase) {
this.transaction.setSyncCommitPhase(syncCommitPhase);
}
+ /**
+ * If true, the cluster-wide rollback phase in two-phase commit (2PC) transactions will be
+ * synchronous, so Infinispan will wait for responses from all nodes to which the rollback was
+ * sent. Otherwise, the rollback phase will be asynchronous. Keeping it as false improves
+ * performance of 2PC transactions.
+ *
+ * @param syncRollbackPhase
+ */
public void setSyncRollbackPhase(boolean syncRollbackPhase) {
this.transaction.setSyncRollbackPhase(syncRollbackPhase);
}
+ /**
+ * Only has effect for DIST mode and when useEagerLocking is set to true. When this is enabled,
+ * then only one node is locked in the cluster, disregarding numOwners config. On the opposite,
+ * if this is false, then on all cache.lock() calls numOwners RPCs are being performed. The node
+ * that gets locked is the main data owner, i.e. the node where data would reside if
+ * numOwners==1. If the node where the lock resides crashes, then the transaction is marked for
+ * rollback - data is in a consistent state, no fault tolerance.
+ *
+ * @param useEagerLocking
+ *
+ */
public void setUseEagerLocking(boolean useEagerLocking) {
this.transaction.setUseEagerLocking(useEagerLocking);
}
+ /**
+ * Only has effect for DIST mode and when useEagerLocking is set to true. When this is enabled, then only one node
+ * is locked in the cluster, disregarding numOwners config. On the opposite, if this is false, then on all cache.lock() calls
+ * numOwners RPCs are being performed. The node that gets locked is the main data owner, i.e. the node where data
+ * would reside if numOwners==1. If the node where the lock resides crashes, then the transaction is marked for rollback -
+ * data is in a consistent state, no fault tolerance.
+ *
+ * @param eagerLockSingleNode
+ */
public void setEagerLockSingleNode(boolean eagerLockSingleNode) {
this.transaction.setEagerLockSingleNode(eagerLockSingleNode);
}
+ /**
+ * If true, this forces all async communications to be queued up and sent out periodically as a
+ * batch.
+ *
+ * @param useReplQueue
+ */
public void setUseReplQueue(boolean useReplQueue) {
this.clustering.async.setUseReplQueue(useReplQueue);
}
+ /**
+ * Cache isolation level. Infinispan only supports READ_COMMITTED or REPEATABLE_READ isolation
+ * levels. See <a href='http://en.wikipedia.org/wiki/Isolation_level'>http://en.wikipedia.org/wiki/Isolation_level</a>
+ * for a discussion on isolation levels.
+ *
+ * @param isolationLevel
+ */
public void setIsolationLevel(IsolationLevel isolationLevel) {
locking.setIsolationLevel(isolationLevel);
}
+ /**
+ * This is the maximum amount of time - in milliseconds - to wait for state from neighboring
+ * caches, before throwing an exception and aborting startup.
+ *
+ * @param stateRetrievalTimeout
+ */
public void setStateRetrievalTimeout(long stateRetrievalTimeout) {
this.clustering.stateRetrieval.setTimeout(stateRetrievalTimeout);
}
@@ -458,6 +663,12 @@
setStateRetrievalTimeout(timeUnit.toMillis(stateRetrievalTimeout));
}
+ /**
+ * This is the maximum amount of time to run a cluster-wide flush, to allow for syncing of
+ * transaction logs.
+ *
+ * @param logFlushTimeout
+ */
public void setStateRetrievalLogFlushTimeout(long logFlushTimeout) {
this.clustering.stateRetrieval.setLogFlushTimeout(logFlushTimeout);
}
@@ -466,10 +677,23 @@
this.clustering.stateRetrieval.setLogFlushTimeout(timeUnit.toMillis(logFlushTimeout));
}
+
+ /**
+ *
+ * This is the maximum number of non-progressing transaction log writes after which a brute-force
+ * flush approach is resorted to, to synchronize transaction logs.
+ *
+ * @param maxNonProgressingLogWrites
+ */
public void setStateRetrievalMaxNonProgressingLogWrites(int maxNonProgressingLogWrites) {
this.clustering.stateRetrieval.setMaxNonProgressingLogWrites(maxNonProgressingLogWrites);
}
+ /**
+ * Initial wait time when backing off before retrying state transfer retrieval
+ *
+ * @param initialRetryWaitTime
+ */
public void setStateRetrievalInitialRetryWaitTime(long initialRetryWaitTime) {
clustering.stateRetrieval.setInitialRetryWaitTime(initialRetryWaitTime);
}
@@ -478,10 +702,21 @@
setStateRetrievalInitialRetryWaitTime(timeUnit.toMillis(initialRetryWaitTime));
}
+
+ /**
+ * Wait time increase factor over successive state retrieval backoffs
+ *
+ * @param retryWaitTimeIncreaseFactor
+ */
public void setStateRetrievalRetryWaitTimeIncreaseFactor(int retryWaitTimeIncreaseFactor) {
clustering.stateRetrieval.setRetryWaitTimeIncreaseFactor(retryWaitTimeIncreaseFactor);
}
+ /**
+ * Number of state retrieval retries before giving up and aborting startup.
+ *
+ * @param numRetries
+ */
public void setStateRetrievalNumRetries(int numRetries) {
clustering.stateRetrieval.setNumRetries(numRetries);
}
@@ -499,26 +734,58 @@
lazyDeserialization.setEnabled(useLazyDeserialization);
}
+ /**
+ * Toggle to enable/disable L1 cache.
+ *
+ * @param l1CacheEnabled
+ */
public void setL1CacheEnabled(boolean l1CacheEnabled) {
this.clustering.l1.setEnabled(l1CacheEnabled);
}
+ /**
+ * Maximum lifespan of an entry placed in the L1 cache.
+ *
+ * @param l1Lifespan
+ */
public void setL1Lifespan(long l1Lifespan) {
this.clustering.l1.setLifespan(l1Lifespan);
}
+ /**
+ * If true, entries removed due to a rehash will be moved to L1 rather than being removed
+ * altogether.
+ *
+ * @param l1OnRehash
+ */
public void setL1OnRehash(boolean l1OnRehash) {
this.clustering.l1.setOnRehash(l1OnRehash);
}
+ /**
+ * Fully qualified name of class providing consistent hash algorithm
+ *
+ * @param consistentHashClass
+ */
public void setConsistentHashClass(String consistentHashClass) {
this.clustering.hash.setConsistentHashClass(consistentHashClass);
}
+ /**
+ * Number of cluster-wide replicas for each cache entry.
+ *
+ * @param numOwners
+ */
public void setNumOwners(int numOwners) {
this.clustering.hash.setNumOwners(numOwners);
}
+ /**
+ * If false, no rebalancing or rehashing will take place when a new node joins the cluster or a
+ * node leaves
+ *
+ * @param rehashEnabled
+ */
public void setRehashEnabled(boolean rehashEnabled) {
this.clustering.hash.setRehashEnabled(rehashEnabled);
}
@@ -527,14 +794,34 @@
this.clustering.hash.setRehashWait(rehashWaitTime);
}
+ /**
+ *
+ * If true, asynchronous marshalling is enabled which means that caller can return even quicker,
+ * but it can suffer from reordering of operations. You can find more information <a
+ * href="http://community.jboss.org/docs/DOC-15725">here</a>
+ *
+ * @param useAsyncMarshalling
+ */
public void setUseAsyncMarshalling(boolean useAsyncMarshalling) {
this.clustering.async.setAsyncMarshalling(useAsyncMarshalling);
}
+ /**
+ * If enabled, entries will be indexed when they are added to the cache. Indexes will be updated
+ * as entries change or are removed.
+ *
+ * @param enabled
+ */
public void setIndexingEnabled(boolean enabled) {
this.indexing.setEnabled(enabled);
}
+ /**
+ * If true, only index changes made locally, ignoring remote changes. This is useful if indexes
+ * are shared across a cluster to prevent redundant indexing of updates.
+ *
+ * @param indexLocalOnly
+ */
public void setIndexLocalOnly(boolean indexLocalOnly) {
this.indexing.setIndexLocalOnly(indexLocalOnly);
}
@@ -828,62 +1115,37 @@
/**
*
- * @configRef name="transaction",desc="Defines transactional (JTA) characteristics of the cache."
+ * Defines transactional (JTA) characteristics of the cache.
*
* @see <a href="../../../config.html#ce_default_transaction">Configuration reference</a>
*/
@XmlAccessorType(XmlAccessType.PROPERTY)
+ @ConfigurationDoc(name="transaction")
public static class TransactionType extends AbstractNamedCacheConfigurationBean{
/** The serialVersionUID */
private static final long serialVersionUID = -3867090839830874603L;
-
- /**
- * @configRef desc="Fully qualified class name of a class that looks up a reference to a {@link javax.transaction.TransactionManager}.
- * The default provided is capable of locating the default TransactionManager in most popular Java EE systems,
- * using a JNDI lookup."
- * */
+
+ @ConfigurationDocRef(bean=Configuration.class,targetElement="setTransactionManagerLookupClass")
protected String transactionManagerLookupClass;
@XmlTransient
protected TransactionManagerLookup transactionManagerLookup;
-
- /**
- * @configRef desc="If true, the cluster-wide commit phase in two-phase commit (2PC) transactions will be synchronous,
- * so Infinispan will wait for responses from all nodes to which the commit was sent. Otherwise, the
- * commit phase will be asynchronous. Keeping it as false improves performance of 2PC transactions, since
- * any remote failures are trapped during the prepare phase anyway and appropriate rollbacks are issued."
- * */
- @Dynamic
+
+ @Dynamic
+ @ConfigurationDocRef(bean=Configuration.class,targetElement="setSyncCommitPhase")
protected Boolean syncCommitPhase = false;
-
- /**
- * @configRef desc="If true, the cluster-wide rollback phase in two-phase commit (2PC) transactions will be synchronous,
- * so Infinispan will wait for responses from all nodes to which the rollback was sent. Otherwise, the
- * rollback phase will be asynchronous. Keeping it as false improves performance of 2PC transactions."
- */
-
+
+ @ConfigurationDocRef(bean=Configuration.class,targetElement="setSyncRollbackPhase")
@Dynamic
protected Boolean syncRollbackPhase = false;
-
- /**
- * @configRef desc="When eager locking is set to true, whenever a lock on key is required, cluster-wide locks will
- * be acquired at the same time as local, in-VM locks. If false, cluster-wide locks are only acquired
- * during the prepare phase in the two-phase commit protocol. Note that this setting
- * is implicit and so it's indiscriminate. Alternatively, you can keep this setting as false and instead
- * do eager locking explicitly on a per invocation basis by calling AdvancedCache.lock(Object)".
- * */
+
@Dynamic
+ @ConfigurationDocRef(bean=Configuration.class,targetElement="setUseEagerLocking")
protected Boolean useEagerLocking = false;
- /**
- * @configRef desc="Only has effect for DIST mode and when useEagerLocking is set to true. When this is enabled, then only one node
- * is locked in the cluster, disregarding numOwners config. On the opposite, if this is false, then on all cache.lock() calls
- * numOwners RPCs are being performed. The node that gets locked is the main data owner, i.e. the node where data
- * would reside if numOwners==1. If the node where the lock resides crashes, then the transaction is marked for rollback -
- * data is in a consistent state, no fault tolerance."
- */
- @Dynamic
+ @Dynamic
+ @ConfigurationDocRef(bean=Configuration.class,targetElement="setEagerLockSingleNode")
protected Boolean eagerLockSingleNode = false;
@@ -963,40 +1225,31 @@
}
/**
*
- * @configRef name="locking",desc="Defines the local, in-VM locking and concurrency characteristics of the cache."
+ * Defines the local, in-VM locking and concurrency characteristics of the cache.
*
* @see <a href="../../../config.html#ce_default_locking">Configuration reference</a>
*/
@XmlAccessorType(XmlAccessType.PROPERTY)
+ @ConfigurationDoc(name = "locking")
public static class LockingType extends AbstractNamedCacheConfigurationBean{
/** The serialVersionUID */
private static final long serialVersionUID = 8142143187082119506L;
-
- /** @configRef desc="Maximum time to attempt a particular lock acquisition" */
+
@Dynamic
+ @ConfigurationDocRef(bean=Configuration.class,targetElement="setLockAcquisitionTimeout")
protected Long lockAcquisitionTimeout = 10000L;
-
- /** @configRef desc="Cache isolation level. Infinispan only supports READ_COMMITTED
- * or REPEATABLE_READ isolation levels. See <a href='http://en.wikipedia.org/wiki/Isolation_level'>http://en.wikipedia.org/wiki/Isolation_level</a>
- * for a discussion on isolation levels." */
+
+ @ConfigurationDocRef(bean=Configuration.class,targetElement="setIsolationLevel")
protected IsolationLevel isolationLevel = IsolationLevel.READ_COMMITTED;
-
- /** @configRef desc="This setting is only applicable in the case of REPEATABLE_READ.
- * When write skew check is set to false, if the writer at commit time discovers that the working
- * entry and the underlying entry have different versions, the working entry will overwrite the
- * underlying entry. If true, such version conflict - known as a write-skew - will throw an Exception. */
+
+ @ConfigurationDocRef(bean=Configuration.class,targetElement="setWriteSkewCheck")
protected Boolean writeSkewCheck = false;
-
- /** @configRef desc="If true, a pool of shared locks is maintained for all entries that need to be locked.
- * Otherwise, a lock is created per entry in the cache. Lock striping helps control memory footprint
- * but may reduce concurrency in the system."
- */
+
+ @ConfigurationDocRef(bean=Configuration.class,targetElement="setUseLockStriping")
protected Boolean useLockStriping = true;
-
- /** @configRef desc="Concurrency level for lock containers. Adjust this value according to the number of concurrent
- * threads interating with Infinispan. Similar to the concurrencyLevel tuning parameter seen in
- * the JDK's ConcurrentHashMap."*/
+
+ @ConfigurationDocRef(bean=Configuration.class,targetElement="setConcurrencyLevel")
protected Integer concurrencyLevel = 32;
@XmlAttribute
@@ -1066,27 +1319,24 @@
}
/**
- * @configRef name="clustering",desc="Defines clustered characteristics of the cache."
+ * Defines clustered characteristics of the cache.
*
* @see <a href="../../../config.html#ce_default_clustering">Configuration reference</a>
*/
@XmlJavaTypeAdapter(ClusteringTypeAdapter.class)
@XmlAccessorType(XmlAccessType.PROPERTY)
@XmlType(propOrder={})
+ @ConfigurationDoc(name = "clustering")
public static class ClusteringType extends AbstractNamedCacheConfigurationBean {
/** The serialVersionUID */
private static final long serialVersionUID = 4048135465543498430L;
-
- /**
- * @configRef name="mode",desc="Cache mode. For distribution, set mode to either 'd', 'dist' or 'distribution'.
- * For replication, use either 'r', 'repl' or 'replication'. Finally, for invalidation,
- * 'i', 'inv' or 'invalidation'.",defaultValue="D"
- */
- @XmlAttribute(name="mode")
+
+ @XmlAttribute(name="mode")
protected String stringMode;
- @XmlTransient
+ @XmlTransient
+ @ConfigurationDocRef(bean=Configuration.class,targetElement="setCacheMode")
protected CacheMode mode = CacheMode.LOCAL;
@XmlElement
@@ -1200,15 +1450,17 @@
}
/**
- * @configRef name="async",parentName="clustering",desc="If this element is present, all communications are
- * asynchronous, in that whenever a thread sends a message sent over the wire, it does not wait
- * for an acknowledgement before returning. This element is mutually exclusive with the <sync />
- * element.<br /><br />Characteristics of this can be tuned here."
- *
+ * If this element is present, all communications are asynchronous, in that whenever a thread
+ * sends a message sent over the wire, it does not wait for an acknowledgment before returning.
+ * This element is mutually exclusive with the <sync /> element.<br />
+ * <br />
+ * Characteristics of this can be tuned here.
+ *
* @see <a href="../../../config.html#ce_clustering_async">Configuration reference</a>
- *
+ *
*/
@XmlAccessorType(XmlAccessType.PROPERTY)
+ @ConfigurationDoc(name = "async",parentName="clustering")
public static class AsyncType extends AbstractNamedCacheConfigurationBean {
@XmlTransient
@@ -1216,29 +1468,21 @@
/** The serialVersionUID */
private static final long serialVersionUID = -7726319188826197399L;
-
- /** @configRef desc="If true, this forces all async communications to be queued up and sent out periodically as
- * a batch." */
+
+ @ConfigurationDocRef(bean=Configuration.class,targetElement="setUseReplQueue")
protected Boolean useReplQueue=false;
- /** @configRef desc="If useReplQueue is set to true, this attribute can be used to trigger flushing of the queue
- * when it reaches a specific threshold." */
+ @ConfigurationDocRef(bean=Configuration.class,targetElement="setReplQueueMaxElements")
protected Integer replQueueMaxElements=1000;
-
- /** @configRef desc="If useReplQueue is set to true, this attribute controls how often the asynchronous thread
- * used to flush the replication queue runs. This should be a positive integer which represents thread
- * wakeup time in milliseconds." */
+
+ @ConfigurationDocRef(bean=Configuration.class,targetElement="setReplQueueInterval")
protected Long replQueueInterval=5000L;
- /** @configRef desc="If true, asynchronous marshalling is enabled which means that caller can return even
- * quicker, but it can suffer from reordering of operations. You can find more information
- * <a href="http://community.jboss.org/docs/DOC-15725">here</a>" */
+
+ @ConfigurationDocRef(bean=Configuration.class,targetElement="setUseAsyncMarshalling")
protected Boolean asyncMarshalling=false;
-
- /**
- * @configRef desc="This overrides the replication queue implementation class. Overriding the default allows
- * you to add behavior to the queue, typically by subclassing the default implementation."
- */
+
+ @ConfigurationDocRef(bean=Configuration.class,targetElement="setReplQueueClass")
protected String replQueueClass = ReplicationQueueImpl.class.getName();
private AsyncType(boolean readFromXml) {
@@ -1319,25 +1563,21 @@
}
/**
- * @configRef name="expiration",desc="This element controls the default expiration settings for entries in the cache."
+ * This element controls the default expiration settings for entries in the cache.
*
* @see <a href="../../../config.html#ce_default_expiration">Configuration reference</a>
*/
@XmlAccessorType(XmlAccessType.PROPERTY)
+ @ConfigurationDoc(name = "expiration")
public static class ExpirationType extends AbstractNamedCacheConfigurationBean{
/** The serialVersionUID */
private static final long serialVersionUID = 5757161438110848530L;
-
- /** @configRef desc="Maximum lifespan of a cache entry, after which the entry is expired cluster-wide, in milliseconds. -1 means the entries never expire.
- * <br /><br />Note that this can be overriden on a per-entry bassi by using the Cache API."
- */
+
+ @ConfigurationDocRef(bean=Configuration.class,targetElement="setExpirationLifespan")
protected Long lifespan=-1L;
-
- /** @configRef desc="Maximum idle time a cache entry will be maintained in the cache, in milliseconds. If the idle time
- * is exceeded, the entry will be expired cluster-wide. -1 means the entries never expire.
- * <br /><br />Note that this can be overriden on a per-entry bassi by using the Cache API."
- */
+
+ @ConfigurationDocRef(bean=Configuration.class,targetElement="setExpirationMaxIdle")
protected Long maxIdle=-1L;
@XmlAttribute
@@ -1378,28 +1618,27 @@
}
/**
- * @configRef name="eviction",desc="This element controls the eviction settings for the cache."
+ * This element controls the eviction settings for the cache.
*
* @see <a href="../../../config.html#ce_default_eviction">Configuration reference</a>
*/
@XmlAccessorType(XmlAccessType.PROPERTY)
+ @ConfigurationDoc(name = "eviction")
public static class EvictionType extends AbstractNamedCacheConfigurationBean {
/** The serialVersionUID */
private static final long serialVersionUID = -1248563712058858791L;
-
- /** @configRef desc="Interval between subsequent eviction runs, in milliseconds. If you wish to disable the periodic eviction process
- * altogether, set wakeupInterval to -1."
- */
+
+ @ConfigurationDocRef(bean=Configuration.class,targetElement="setEvictionWakeUpInterval")
protected Long wakeUpInterval=5000L;
-
- /** @configRef desc="Eviction strategy. Available options are 'UNORDERED', 'FIFO', 'LRU' and 'NONE' (to disable eviction)."*/
+
+ @ConfigurationDocRef(bean=Configuration.class,targetElement="setEvictionStrategy")
protected EvictionStrategy strategy=EvictionStrategy.NONE;
-
- /** @configRef desc="Maximum number of entries in a cache instance. -1 means no limit." */
- protected Integer maxEntries=-1;
-
- /** @configRef desc="Threading policy for eviction." */
+
+ @ConfigurationDocRef(bean=Configuration.class,targetElement="setEvictionMaxEntries")
+ protected Integer maxEntries = -1;
+
+ @ConfigurationDocRef(bean=Configuration.class,targetElement="setEvictionThreadPolicy")
protected EvictionThreadPolicy threadPolicy=EvictionThreadPolicy.DEFAULT;
@XmlAttribute
@@ -1457,46 +1696,42 @@
}
/**
- * @configRef name="stateRetrieval",desc="Configures how state is retrieved when a new cache joins the cluster. This
- * element is only used with invalidation and replication clustered modes."
- *
- * @see <a href="../../../config.html#ce_clustering_stateRetrieval">Configuration reference</a>
+ * Configures how state is retrieved when a new cache joins the cluster. This element is only
+ * used with invalidation and replication clustered modes.
+ *
+ * @see <a href="../../../config.html#ce_clustering_stateRetrieval">Configuration reference</a>
*/
@XmlAccessorType(XmlAccessType.PROPERTY)
+ @ConfigurationDoc(name = "stateRetrieval")
public static class StateRetrievalType extends AbstractNamedCacheConfigurationBean {
/** The serialVersionUID */
private static final long serialVersionUID = 3709234918426217096L;
-
- /** @configRef desc="If true, this will cause the cache to ask neighboring caches for state when it starts up,
- * so the cache starts 'warm', although it will impact startup time." */
- @Dynamic
+
+ @Dynamic
+ @ConfigurationDocRef(bean=Configuration.class,targetElement="setFetchInMemoryState")
protected Boolean fetchInMemoryState = false;
-
- /**
- * @configRef desc="If true, this will allow the cache to provide in-memory state to a neighbor, even if the
- * cache is not configured to fetch state from its neighbors (fetchInMemoryState is false).
- */
+
+ @ConfigurationDocRef(bean=Configuration.class,targetElement="setAlwaysProvideInMemoryState")
protected Boolean alwaysProvideInMemoryState = false;
-
- /** @configRef desc="This is the maximum amount of time - in milliseconds - to wait for state from neighboring
- * caches, before throwing an exception and aborting startup. " */
- @Dynamic
+
+ @Dynamic
+ @ConfigurationDocRef(bean=Configuration.class,targetElement="setStateRetrievalTimeout")
protected Long timeout = 10000L;
-
- /** @configRef desc="Initial wait time when backing off before retrying state transfer retrieval"*/
+
+ @ConfigurationDocRef(bean=Configuration.class,targetElement="setStateRetrievalInitialRetryWaitTime")
protected Long initialRetryWaitTime = 500L;
-
- /** @configRef desc="Wait time increase factor over successive state retrieval backoffs"*/
+
+ @ConfigurationDocRef(bean=Configuration.class,targetElement="setStateRetrievalRetryWaitTimeIncreaseFactor")
protected Integer retryWaitTimeIncreaseFactor = 2;
-
- /** @configRef desc="Number of state retrieval retries before giving up and aborting startup."*/
+
+ @ConfigurationDocRef(bean=Configuration.class,targetElement="setStateRetrievalNumRetries")
protected Integer numRetries = 5;
-
- /** @configRef desc="This is the maximum amount of time to run a cluster-wide flush, to allow for syncing of transaction logs." **/
+
+ @ConfigurationDocRef(bean=Configuration.class,targetElement="setStateRetrievalLogFlushTimeout")
protected Long logFlushTimeout = 60000L;
-
- /** @configRef desc="This is the maximum number of non-progressing transaction log writes after which a brute-force flush approach is resorted to, to synchronize transaction logs." **/
+
+ @ConfigurationDocRef(bean=Configuration.class,targetElement="setStateRetrievalMaxNonProgressingLogWrites")
protected Integer maxNonProgressingLogWrites = 100;
@XmlAttribute
@@ -1579,20 +1814,22 @@
}
/**
- * @configRef name="sync",desc="If this element is present, all communications are synchronous, in that whenever a
- * thread sends a message sent over the wire, it blocks until it receives an acknowledgement from the
- * recipient. This element is mutually exclusive with the <async /> element. <br /><br />Characteristics of this can be tuned here."
- *
+ * If this element is present, all communications are synchronous, in that whenever a thread
+ * sends a message sent over the wire, it blocks until it receives an acknowledgment from the
+ * recipient. This element is mutually exclusive with the <async /> element. <br />
+ * <br />
+ * Characteristics of this can be tuned here.
+ *
* @see <a href="../../../config.html#ce_clustering_sync">Configuration reference</a>
*/
@XmlAccessorType(XmlAccessType.PROPERTY)
+ @ConfigurationDoc(name = "sync")
public static class SyncType extends AbstractNamedCacheConfigurationBean {
/** The serialVersionUID */
private static final long serialVersionUID = 8419216253674289524L;
-
- /** @configRef desc="This is the timeout used to wait for an acknowledgement when making a remote call, after
- * which the call is aborted and an exception is thrown. "*/
- @Dynamic
+
+ @Dynamic
+ @ConfigurationDocRef(bean=Configuration.class,targetElement="setSyncReplTimeout")
protected Long replTimeout=15000L;
@XmlAttribute
@@ -1625,31 +1862,31 @@
}
/**
- * @configRef name="hash",desc="Allows fine-tuning of rehashing characteristics. Only used with 'distributed'
- * cache mode, and otherwise ignored."
- *
+ * Allows fine-tuning of rehashing characteristics. Only used with 'distributed' cache mode, and
+ * otherwise ignored.
+ *
* @see <a href="../../../config.html#ce_clustering_hash">Configuration reference</a>
*/
@XmlAccessorType(XmlAccessType.PROPERTY)
+ @ConfigurationDoc(name = "hash")
public static class HashType extends AbstractNamedCacheConfigurationBean {
/** The serialVersionUID */
private static final long serialVersionUID = 752218766840948822L;
-
- /** @configRef name="class", desc="Fully qualified name of class providing consistent hash algorithm" */
+
+ @ConfigurationDocRef(name="class", bean=Configuration.class,targetElement="setConsistentHashClass")
protected String consistentHashClass = DefaultConsistentHash.class.getName();
-
- /** @configRef desc="Number of cluster-wide replicas for each cache entry." */
+
+ @ConfigurationDocRef(bean=Configuration.class,targetElement="setNumOwners")
protected Integer numOwners=2;
-
- /** @configRef desc="Future flag. Currenly unused." */
+
+ @ConfigurationDoc(desc="Future flag. Currenly unused.")
protected Long rehashWait = MINUTES.toMillis(1);
-
- /** @configRef desc="Rehashing timeout" */
+
+ @ConfigurationDocRef(bean=Configuration.class,targetElement="setRehashRpcTimeout")
protected Long rehashRpcTimeout = MINUTES.toMillis(10);
-
- /** @configRef desc="If false, no rebalancing or rehashing will take place when a new node joins the cluster or
- * a node leaves." **/
+
+ @ConfigurationDocRef(bean=Configuration.class,targetElement="setRehashEnabled")
protected Boolean rehashEnabled=true;
@XmlAttribute(name="class")
@@ -1716,25 +1953,25 @@
}
/**
- * @configRef name="l1",desc="This element configures the L1 cache behavior in 'distributed' caches instances.
- * In any other cache modes, this element is ignored. "
- *
- * @see <a href="../../../config.html#ce_clustering_l1">Configuration reference</a>
+ * This element configures the L1 cache behavior in 'distributed' caches instances. In any other
+ * cache modes, this element is ignored.
+ *
+ * @see <a href="../../../config.html#ce_clustering_l1">Configuration reference</a>
*/
@XmlAccessorType(XmlAccessType.PROPERTY)
+ @ConfigurationDoc(name = "l1")
public static class L1Type extends AbstractNamedCacheConfigurationBean {
/** The serialVersionUID */
private static final long serialVersionUID = -4703587764861110638L;
-
- /** @configRef desc="Toggle to enable/disable L1 cache." */
+
+ @ConfigurationDocRef(bean=Configuration.class,targetElement="setL1CacheEnabled")
protected Boolean enabled=true;
-
- /** @configRef desc="Maximum lifespan of an entry placed in the L1 cache." */
+
+ @ConfigurationDocRef(bean=Configuration.class,targetElement="setL1Lifespan")
protected Long lifespan=600000L;
-
- /** @configRef desc="If true, entries removed due to a rehash will be moved to L1 rather than being removed
- * altogether." */
+
+ @ConfigurationDocRef(bean=Configuration.class,targetElement="setL1OnRehash")
protected Boolean onRehash=true;
@XmlAttribute
@@ -1791,7 +2028,7 @@
/** The serialVersionUID */
private static final long serialVersionUID = 2296863404153834686L;
- /** @configRef desc="Toggle switch" */
+ @ConfigurationDoc(desc="Toggle switch")
protected Boolean enabled = false;
public BooleanAttributeType() {
@@ -1835,13 +2072,14 @@
}
/**
- * @configRef name="lazyDeserialization",desc="A mechanism by which serialization and deserialization of objects is
- * deferred till the point in time in which they are used and needed. This typically means that any
- * deserialization happens using the thread context class loader of the invocation that requires
- * deserialization, and is an effective mechanism to provide classloader isolation."
- *
- * @see <a href="../../../config.html#ce_default_lazyDeserialization">Configuration reference</a>
+ * A mechanism by which serialization and deserialization of objects is deferred till the point
+ * in time in which they are used and needed. This typically means that any deserialization
+ * happens using the thread context class loader of the invocation that requires deserialization,
+ * and is an effective mechanism to provide classloader isolation.
+ *
+ * @see <a href="../../../config.html#ce_default_lazyDeserialization">Configuration reference</a>
*/
+ @ConfigurationDoc(name = "lazyDeserialization")
public static class LazyDeserialization extends BooleanAttributeType {
/** The serialVersionUID */
private static final long serialVersionUID = 7404820498857564962L;
@@ -1852,10 +2090,12 @@
}
/**
- * @configRef name="jmxStatistics",desc=" This element specifies whether cache statistics are gathered and reported
- * via JMX."
+ *
+ * This element specifies whether cache statistics are gathered and reported via JMX.
+ *
* @see <a href="../../../config.html#ce_default_jmxStatistics">Configuration reference</a>
*/
+ @ConfigurationDoc(name="jmxStatistics")
public static class JmxStatistics extends BooleanAttributeType {
/** The serialVersionUID */
private static final long serialVersionUID = 8716456707015486673L;
@@ -1866,11 +2106,12 @@
}
/**
- * @configRef name="invocationBatching",desc="Defines whether invocation batching is allowed in this cache instance, and sets up internals accordingly to allow use of this API."
+ * Defines whether invocation batching is allowed in this cache instance, and sets up internals accordingly to allow use of this API.
*
* @see <a href="../../../config.html#ce_default_invocationBatching">Configuration reference</a>
*
*/
+ @ConfigurationDoc(name = "invocationBatching")
public static class InvocationBatching extends BooleanAttributeType {
/** The serialVersionUID */
private static final long serialVersionUID = 5854115656815587815L;
@@ -1881,21 +2122,22 @@
}
/**
- * @configRef name="deadlockDetection",desc="This element configures deadlock detection."
+ * This element configures deadlock detection.
*
+ *
* @see <a href="../../../config.html#ce_default_deadlockDetection">Configuration reference</a>
*/
@XmlAccessorType(XmlAccessType.PROPERTY)
+ @ConfigurationDoc(name="deadlockDetection")
public static class DeadlockDetectionType extends AbstractNamedCacheConfigurationBean{
/** The serialVersionUID */
private static final long serialVersionUID = -7178286048602531152L;
-
- /** @configRef desc="Toggle to enable/disable deadlock detection"*/
+
+ @ConfigurationDocRef(bean=Configuration.class,targetElement="setEnableDeadlockDetection")
protected Boolean enabled=false;
-
- /** @configRef desc="Time period that determines how often is lock acquisition attempted within maximum time
- * allowed to acquire a particular lock" */
+
+ @ConfigurationDocRef(bean=Configuration.class,targetElement="setDeadlockDetectionSpinDuration")
protected Long spinDuration=100L;
@XmlAttribute
@@ -1936,20 +2178,21 @@
}
/**
- * @configRef name="unsafe",desc="Allows you to tune various unsafe or non-standard characteristics. Certain operations
+ * Allows you to tune various unsafe or non-standard characteristics. Certain operations
* such as Cache.put() that are supposed to return the previous value associated with the specified key according
* to the java.util.Map contract will not fulfill this contract if unsafe toggle is turned on. Use with care.
- * See details at http://www.jboss.org/community/wiki/infinispantechnicalfaqs"
+ * See details at http://www.jboss.org/community/wiki/infinispantechnicalfaqs
*
* @see <a href="../../../config.html#ce_default_unsafe">Configuration reference</a>
*/
@XmlAccessorType(XmlAccessType.PROPERTY)
+ @ConfigurationDoc(name="unsafe")
public static class UnsafeType extends AbstractNamedCacheConfigurationBean{
/** The serialVersionUID */
private static final long serialVersionUID = -9200921443651234163L;
- /** @configRef desc="Toggle to enable/disable return value fetching" */
+ @ConfigurationDocRef(bean=Configuration.class,targetElement="setUnsafeUnreliableReturnValues")
protected Boolean unreliableReturnValues=false;
@XmlAttribute
@@ -1982,11 +2225,12 @@
}
/**
- * @configRef name="customInterceptors",desc="Configures custom interceptors to be added to the cache."
+ * Configures custom interceptors to be added to the cache.
*
* @see <a href="../../../config.html#ce_default_customInterceptors">Configuration reference</a>
*/
@XmlAccessorType(XmlAccessType.FIELD)
+ @ConfigurationDoc(name="customInterceptors")
public static class CustomInterceptorsType extends AbstractNamedCacheConfigurationBean {
/** The serialVersionUID */
@@ -2044,20 +2288,22 @@
}
/**
- * @configRef name="indexing",desc="Configures indexing of entries in the cache for searching. Note that infinispan-query.jar and its dependencies needs to be available if this option is to be used."
+ * Configures indexing of entries in the cache for searching.
+ * Note that infinispan-query.jar and its dependencies needs to be available if this option is to be used.
*
* @see <a href="../../../config.html#ce_default_indexing">Configuration reference</a>
*/
@XmlAccessorType(XmlAccessType.PROPERTY)
+ @ConfigurationDoc(name="indexing")
public static class QueryConfigurationBean extends AbstractConfigurationBean {
/** The serialVersionUID */
private static final long serialVersionUID = 2891683014353342549L;
- /** @configRef desc="If enabled, entries will be indexed when they are added to the cache. Indexes will be updated as entries change or are removed." */
+ @ConfigurationDocRef(bean=Configuration.class,targetElement="setIndexingEnabled")
protected Boolean enabled = false;
-
- /** @configRef desc="If true, only index changes made locally, ignoring remote changes. This is useful if indexes are shared across a cluster to prevent redundant indexing of updates." */
+
+ @ConfigurationDocRef(bean=Configuration.class,targetElement="setIndexLocalOnly")
protected Boolean indexLocalOnly = false;
public Boolean isEnabled() {
@@ -2216,4 +2462,4 @@
}
}
}
-}
+}
\ No newline at end of file
Added: trunk/core/src/main/java/org/infinispan/config/ConfigurationDoc.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/config/ConfigurationDoc.java (rev 0)
+++ trunk/core/src/main/java/org/infinispan/config/ConfigurationDoc.java 2010-10-20 18:00:27 UTC (rev 2534)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2000 - 2008, 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;
+
+/**
+ * Configuration bean element annotated with @ConfigurationDoc indicates that the element should
+ * be included in configuration reference.
+ *
+ *
+ * @author Vladimir Blagojevic
+ * @since 4.2
+ */
+ at Retention(RetentionPolicy.RUNTIME)
+ at Target( { ElementType.METHOD, ElementType.FIELD, ElementType.TYPE })
+public @interface ConfigurationDoc {
+ String name() default "";
+
+ String parentName() default "";
+
+ String desc() default "";
+}
Added: trunk/core/src/main/java/org/infinispan/config/ConfigurationDocRef.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/config/ConfigurationDocRef.java (rev 0)
+++ trunk/core/src/main/java/org/infinispan/config/ConfigurationDocRef.java 2010-10-20 18:00:27 UTC (rev 2534)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2000 - 2008, 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;
+
+/**
+ * Configuration bean element annotated with @ConfigurationDocRef indicates that the element
+ * should be included in configuration reference but that the description should be extracted from
+ * bean class target and its targetElement (method or field).
+ *
+ *
+ * @author Vladimir Blagojevic
+ * @since 4.2
+ */
+ at Retention(RetentionPolicy.RUNTIME)
+ at Target( { ElementType.METHOD, ElementType.FIELD })
+public @interface ConfigurationDocRef {
+ String name() default "";
+
+ Class<?> bean();
+
+ String targetElement();
+}
Added: trunk/core/src/main/java/org/infinispan/config/ConfigurationDocs.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/config/ConfigurationDocs.java (rev 0)
+++ trunk/core/src/main/java/org/infinispan/config/ConfigurationDocs.java 2010-10-20 18:00:27 UTC (rev 2534)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2000 - 2008, 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;
+
+/**
+ * Configuration bean element annotated with @ConfigurationDocs wraps multiple
+ * @ConfigurationDoc annotations
+ *
+ *
+ * @author Vladimir Blagojevic
+ * @since 4.2
+ */
+ at Retention(RetentionPolicy.RUNTIME)
+ at Target( { ElementType.METHOD, ElementType.FIELD, ElementType.TYPE })
+public @interface ConfigurationDocs {
+ ConfigurationDoc[] value();
+}
Modified: trunk/core/src/main/java/org/infinispan/config/CustomInterceptorConfig.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/config/CustomInterceptorConfig.java 2010-10-20 17:15:56 UTC (rev 2533)
+++ trunk/core/src/main/java/org/infinispan/config/CustomInterceptorConfig.java 2010-10-20 18:00:27 UTC (rev 2534)
@@ -36,21 +36,14 @@
/**
* Holds information about the custom interceptors defined in the configuration file.
*
- * <p>
- * Note that class CustomInterceptorConfig 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 name="interceptor",desc=" This element allows you configure and inject a custom interceptor.
- * This tag may appear multiple times."
- *
* @author Mircea.Markus at jboss.com
* @author Vladimir Blagojevic
* @since 4.0
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name="interceptor")
+ at ConfigurationDoc(name="interceptor")
public class CustomInterceptorConfig extends AbstractNamedCacheConfigurationBean {
/** The serialVersionUID */
@@ -65,32 +58,24 @@
@XmlTransient
protected boolean isLast;
- /** @configRef desc="A position at which to place this interceptor in the chain, with 0 being the first position.
- * Note that this attribute is mutually exclusive with 'position', 'before' and 'after'." */
@XmlAttribute
+ @ConfigurationDocRef(name="class", bean=CustomInterceptorConfig.class,targetElement="setIndex")
protected Integer index = -1;
-
- /** @configRef desc="Will place the new interceptor directly after the instance of the named interceptor which is
- * specified via its fully qualified class name. Note that this attribute is mutually exclusive with
- * 'position', 'before' and 'index'." */
+
@XmlAttribute
+ @ConfigurationDocRef(name="class", bean=CustomInterceptorConfig.class,targetElement="setAfterInterceptor")
protected String after;
- /** @configRef desc="Will place the new interceptor directly before the instance of the named interceptor which is
- * specified via its fully qualified class name.. Note that this attribute is mutually exclusive with
- * 'position', 'after' and 'index'." */
@XmlAttribute
+ @ConfigurationDocRef(name="class", bean=CustomInterceptorConfig.class,targetElement="setBeforeInterceptor")
protected String before;
- /** @configRef desc="A position at which to place this interceptor in the chain. FIRST is the first interceptor
- * encountered when an invocation is made on the cache, LAST is the last interceptor before the call is
- * passed on to the data structure. Note that this attribute is mutually exclusive with 'before', 'after'
- * and 'index'." */
@XmlAttribute
+ @ConfigurationDocRef(name="class", bean=CustomInterceptorConfig.class,targetElement="setPosition")
protected Position position;
-
- /** @configRef name="class",desc="Fully qualified interceptor class name which must extend org.infinispan.interceptors.base.CommandInterceptor." */
+
@XmlAttribute(name="class")
+ @ConfigurationDocRef(name="class", bean=CustomInterceptorConfig.class,targetElement="setClassName")
protected String className;
@XmlElement
@@ -181,6 +166,14 @@
return position;
}
+ /**
+ * A position at which to place this interceptor in the chain. FIRST is the first interceptor
+ * encountered when an invocation is made on the cache, LAST is the last interceptor before the
+ * call is passed on to the data structure. Note that this attribute is mutually exclusive with
+ * 'before', 'after' and 'index'.
+ *
+ * @param position
+ */
public void setPosition(Position position) {
this.position = position;
testImmutability("position");
@@ -190,6 +183,10 @@
return className;
}
+ /**
+ * Fully qualified interceptor class name which must extend org.infinispan.interceptors.base.CommandInterceptor.
+ * @param className
+ */
public void setClassName(String className) {
this.className = className;
testImmutability("className");
@@ -212,22 +209,37 @@
isLast = last;
}
+ /**
+ * A position at which to place this interceptor in the chain. FIRST is the first interceptor
+ * encountered when an invocation is made on the cache, LAST is the last interceptor before the
+ * call is passed on to the data structure. Note that this attribute is mutually exclusive with
+ * 'before', 'after' and 'index'.
+ *
+ * @param pos
+ */
public void setPosition(String pos) {
setPosition(Position.valueOf(uc(pos)));
}
+
/**
- * 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.
+ * A position at which to place this interceptor in the chain, with 0 being the first position.
+ * Note that this attribute is mutually exclusive with 'position', 'before' and 'after'."
+ *
+ * @param index
*/
public void setIndex(int index) {
testImmutability("index");
this.index = index;
}
+
/**
- * Adds the interceptor immediately after the first occurrence of an interceptor having the given class. If the chain
- * does not contain such an interceptor then this interceptor definition is ignored.
+ * Places the new interceptor directly after the instance of the named interceptor which is
+ * specified via its fully qualified class name. Note that this attribute is mutually exclusive
+ * with 'position', 'before' and 'index'.
+ *
+ * @param afterClass
*/
public void setAfterInterceptor(String afterClass) {
testImmutability("after");
@@ -235,16 +247,22 @@
}
/**
- * Adds the interceptor immediately after the first occurrence of an interceptor having the given class. If the chain
- * does not contain such an interceptor then this interceptor definition is ignored.
+ * Places the new interceptor directly after the instance of the named interceptor which is
+ * specified via its fully qualified class name. Note that this attribute is mutually exclusive
+ * with 'position', 'before' and 'index'.
+ *
+ * @param interceptorClass
*/
public void setAfterInterceptor(Class<? extends CommandInterceptor> interceptorClass) {
setAfterInterceptor(interceptorClass.getName());
}
/**
- * Adds the interceptor immediately before the first occurrence of an interceptor having the given class. If the chain
- * does not contain such an interceptor then this interceptor definition is ignored.
+ * Places the new interceptor directly before the instance of the named interceptor which is
+ * specified via its fully qualified class name.. Note that this attribute is mutually exclusive
+ * with 'position', 'after' and 'index'."
+ *
+ * @param beforeClass
*/
public void setBeforeInterceptor(String beforeClass) {
testImmutability("before");
@@ -252,8 +270,11 @@
}
/**
- * Adds the interceptor immediately before the first occurrence of an interceptor having the given class. If the chain
- * does not contain such an interceptor then this interceptor definition is ignored.
+ * Places the new interceptor directly before the instance of the named interceptor which is
+ * specified via its fully qualified class name.. Note that this attribute is mutually exclusive
+ * with 'position', 'after' and 'index'."
+ *
+ * @param interceptorClass
*/
public void setBeforeInterceptor(Class<? extends CommandInterceptor> interceptorClass) {
setBeforeInterceptor(interceptorClass.getName());
Modified: trunk/core/src/main/java/org/infinispan/loaders/AbstractCacheLoaderConfig.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/loaders/AbstractCacheLoaderConfig.java 2010-10-20 17:15:56 UTC (rev 2533)
+++ trunk/core/src/main/java/org/infinispan/loaders/AbstractCacheLoaderConfig.java 2010-10-20 18:00:27 UTC (rev 2534)
@@ -1,21 +1,17 @@
package org.infinispan.loaders;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+
import org.infinispan.CacheException;
import org.infinispan.config.ConfigurationBeanVisitor;
+import org.infinispan.config.ConfigurationDocRef;
import org.infinispan.config.PluggableConfigurationComponent;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAttribute;
-
/**
* Abstract base class for CacheLoaderConfigs.
*
- * <p>
- * Note that class AbstractCacheLoaderConfig 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.
*
* @author Mircea.Markus at jboss.com
* @author Vladimir Blagojevic
@@ -28,15 +24,20 @@
/** The serialVersionUID */
private static final long serialVersionUID = -4303705423800914433L;
- /** @configRef name="class",desc="Fully qualified name of a cache loader class that must implement
- * org.infinispan.loaders.CacheLoader interface." */
@XmlAttribute(name="class")
+ @ConfigurationDocRef(name="class", bean=AbstractCacheLoaderConfig.class,targetElement="setCacheLoaderClassName")
protected String cacheLoaderClassName;
public String getCacheLoaderClassName() {
return cacheLoaderClassName;
}
+ /**
+ * Fully qualified name of a cache loader class that must implement
+ * org.infinispan.loaders.CacheLoader interface
+ *
+ * @see org.infinispan.loaders.CacheLoaderConfig#setCacheLoaderClassName(java.lang.String)
+ */
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 2010-10-20 17:15:56 UTC (rev 2533)
+++ trunk/core/src/main/java/org/infinispan/loaders/AbstractCacheStoreConfig.java 2010-10-20 18:00:27 UTC (rev 2534)
@@ -1,34 +1,28 @@
package org.infinispan.loaders;
import org.infinispan.config.ConfigurationBeanVisitor;
+import org.infinispan.config.ConfigurationDoc;
+import org.infinispan.config.ConfigurationDocRef;
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.XmlElement;
import javax.xml.bind.annotation.*;
-import javax.xml.bind.annotation.XmlType;
/**
- * Configures {@link AbstractCacheStore}. This allows you to tune a number of characteristics of the {@link
- * AbstractCacheStore}.
+ * Configures {@link AbstractCacheStore}. This allows you to tune a number of characteristics of the
+ * {@link AbstractCacheStore}.
* <p/>
- * <ul> <li><tt>purgeSynchronously</tt> - whether {@link org.infinispan.loaders.CacheStore#purgeExpired()} calls happen
- * synchronously or not. By default, this is set to <tt>false</tt>.</li>
- * <li><tt>purgerThreads</tt> - number of threads to use when purging. Defaults to <tt>1</tt> if <tt>purgeSynchronously</tt>
- * is <tt>true</tt>, ignored if <tt>false</tt>.</li>
+ * <ul>
+ * <li><tt>purgeSynchronously</tt> - whether
+ * {@link org.infinispan.loaders.CacheStore#purgeExpired()} calls happen synchronously or not. By
+ * default, this is set to <tt>false</tt>.</li>
+ * <li><tt>purgerThreads</tt> - number of threads to use when purging. Defaults to <tt>1</tt> if
+ * <tt>purgeSynchronously</tt> is <tt>true</tt>, ignored if <tt>false</tt>.</li>
* </ul>
*
- * <p>
- * Note that class AbstractCacheStoreConfig 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 name="loader",desc="Responsible for loading/storing cache data from/to an external source."
- *
+ *
* @author Mircea.Markus at jboss.com
* @author Vladimir Blagojevic
* @since 4.0
@@ -37,30 +31,25 @@
*/
@XmlAccessorType(XmlAccessType.PUBLIC_MEMBER)
@XmlType(propOrder= {"singletonStoreConfig", "asyncStoreConfig"})
+ at ConfigurationDoc(name="loader",desc="Responsible for loading/storing cache data from/to an external source.")
public class AbstractCacheStoreConfig extends AbstractCacheLoaderConfig implements CacheStoreConfig {
/** The serialVersionUID */
private static final long serialVersionUID = 4607371052771122893L;
-
- /** @configRef desc="If true, any operation that modifies the cache (put, remove, clear, store...etc) won't be
- * applied to the cache store. This means that the cache store could become out of sync with the cache." */
+
+ @ConfigurationDocRef(bean=AbstractCacheStoreConfig.class,targetElement="setIgnoreModifications")
protected Boolean ignoreModifications = false;
- /** @configRef desc="If true, fetch persistent state when joining a cluster. If multiple cache stores are chained,
- * only one of them can have this property enabled. Persistent state transfer with a shared cache
- * store does not make sense, as the same persistent store that provides the data will just end up
- * receiving it. Therefore, if a shared cache store is used, the cache will not allow a persistent
- * state transfer even if a cache store has this property set to true. Finally, setting it to true only
- * makes sense if in a clustered environment, and only 'replication' and 'invalidation' cluster modes are supported." */
+ @ConfigurationDocRef(bean=AbstractCacheStoreConfig.class,targetElement="setFetchPersistentState")
protected Boolean fetchPersistentState = false;
- /** @configRef desc="If true, purges this cache store when it starts up." */
+ @ConfigurationDocRef(bean=AbstractCacheStoreConfig.class,targetElement="setPurgeOnStartup")
protected Boolean purgeOnStartup = false;
- /** @configRef desc="If true, CacheStore#purgeExpired() call will be done synchronously" */
+ @ConfigurationDocRef(bean=AbstractCacheStoreConfig.class,targetElement="setPurgeSynchronously")
protected Boolean purgeSynchronously = false;
- /** @configRef desc="The number of threads to use when purging asynchronously." */
+ @ConfigurationDocRef(bean=AbstractCacheStoreConfig.class,targetElement="setPurgerThreads")
protected Integer purgerThreads = 1;
protected SingletonStoreConfig singletonStore = new SingletonStoreConfig();
@@ -77,11 +66,21 @@
return purgerThreads;
}
+ /**
+ * If true, CacheStore#purgeExpired() call will be done synchronously
+ *
+ * @param purgeSynchronously
+ */
public void setPurgeSynchronously(Boolean purgeSynchronously) {
testImmutability("purgeSynchronously");
this.purgeSynchronously = purgeSynchronously;
}
+ /**
+ * The number of threads to use when purging asynchronously.
+ *
+ * @param purgerThreads
+ */
public void setPurgerThreads(Integer purgerThreads) {
testImmutability("purgerThreads");
this.purgerThreads = purgerThreads;
@@ -92,11 +91,30 @@
return fetchPersistentState;
}
+ /**
+ * If true, fetch persistent state when joining a cluster. If multiple cache stores are chained,
+ * only one of them can have this property enabled. Persistent state transfer with a shared cache
+ * store does not make sense, as the same persistent store that provides the data will just end
+ * up receiving it. Therefore, if a shared cache store is used, the cache will not allow a
+ * persistent state transfer even if a cache store has this property set to true. Finally,
+ * setting it to true only makes sense if in a clustered environment, and only 'replication' and
+ * 'invalidation' cluster modes are supported.
+ *
+ *
+ * @param fetchPersistentState
+ */
public void setFetchPersistentState(Boolean fetchPersistentState) {
testImmutability("fetchPersistentState");
this.fetchPersistentState = fetchPersistentState;
}
+ /**
+ * If true, any operation that modifies the cache (put, remove, clear, store...etc) won't be
+ * applied to the cache store. This means that the cache store could become out of sync with the
+ * cache.
+ *
+ * @param ignoreModifications
+ */
public void setIgnoreModifications(Boolean ignoreModifications) {
testImmutability("ignoreModifications");
this.ignoreModifications = ignoreModifications;
@@ -112,6 +130,12 @@
return purgeOnStartup;
}
+ /**
+ *
+ * If true, purges this cache store when it starts up.
+ *
+ * @param purgeOnStartup
+ */
public void setPurgeOnStartup(Boolean purgeOnStartup) {
testImmutability("purgeOnStartup");
this.purgeOnStartup = purgeOnStartup;
Modified: trunk/core/src/main/java/org/infinispan/loaders/CacheLoaderConfig.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/loaders/CacheLoaderConfig.java 2010-10-20 17:15:56 UTC (rev 2533)
+++ trunk/core/src/main/java/org/infinispan/loaders/CacheLoaderConfig.java 2010-10-20 18:00:27 UTC (rev 2534)
@@ -15,11 +15,6 @@
/**
* Configures individual cache loaders
*
- * <p>
- * Note that class CacheLoaderConfig 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.
*
* @author Manik Surtani
* @author Vladimir Blagojevic
Modified: trunk/core/src/main/java/org/infinispan/loaders/decorators/AsyncStoreConfig.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/loaders/decorators/AsyncStoreConfig.java 2010-10-20 17:15:56 UTC (rev 2533)
+++ trunk/core/src/main/java/org/infinispan/loaders/decorators/AsyncStoreConfig.java 2010-10-20 18:00:27 UTC (rev 2534)
@@ -2,6 +2,8 @@
import org.infinispan.config.AbstractNamedCacheConfigurationBean;
import org.infinispan.config.ConfigurationBeanVisitor;
+import org.infinispan.config.ConfigurationDoc;
+import org.infinispan.config.ConfigurationDocRef;
import org.infinispan.config.Dynamic;
import javax.xml.bind.annotation.XmlAccessType;
@@ -9,17 +11,9 @@
import javax.xml.bind.annotation.XmlAttribute;
/**
- * Configuration for the async cache loader
+ * Configuration for the async cache loader. If enabled, this provides you with asynchronous writes
+ * to the cache store, giving you 'write-behind' caching.
*
- * <p>
- * Note that class AsyncStoreConfig 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 name="async",parentName="loader",desc="Configuration for the async cache loader. If enabled, this provides
- * you with asynchronous writes to the cache store, giving you 'write-behind' caching."
- *
* @author Manik Surtani
* @author Vladimir Blagojevic
* @since 4.0
@@ -27,24 +21,24 @@
* @see <a href="../../../../config.html#ce_loader_async">Configuration reference</a>
*/
@XmlAccessorType(XmlAccessType.PUBLIC_MEMBER)
+ at ConfigurationDoc(name="async",parentName="loader")
public class AsyncStoreConfig extends AbstractNamedCacheConfigurationBean {
/** The serialVersionUID */
private static final long serialVersionUID = -8596800049019004961L;
- /** @configRef desc="If true, all modifications to this cache store happen asynchronously, on a separate thread." */
+ @ConfigurationDocRef(bean=AsyncStoreConfig.class,targetElement="setEnabled")
protected Boolean enabled = false;
- /** @configRef desc="Size of the thread pool whose threads are responsible for applying the modifications." */
+ @ConfigurationDocRef(bean=AsyncStoreConfig.class,targetElement="setThreadPoolSize")
protected Integer threadPoolSize = 1;
- /** @configRef desc="Timeout to acquire the lock which guards the state to be flushed to the cache store periodically." */
@Dynamic
+ @ConfigurationDocRef(bean=AsyncStoreConfig.class,targetElement="setFlushLockTimeout")
protected Long flushLockTimeout = 5000L;
- /** @configRef desc="Timeout to stop the cache store. When the store is stopped it's possible that some modifications still need to be applied;
- * you likely want to set a very large timeout to make sure to not loose data." */
@Dynamic
+ @ConfigurationDocRef(bean=AsyncStoreConfig.class,targetElement="setShutdownTimeout")
protected Long shutdownTimeout = 7200L;
@XmlAttribute
@@ -52,6 +46,11 @@
return enabled;
}
+ /**
+ * If true, all modifications to this cache store happen asynchronously, on a separate thread.
+ *
+ * @param enabled
+ */
public void setEnabled(Boolean enabled) {
testImmutability("enabled");
this.enabled = enabled;
@@ -62,6 +61,11 @@
return threadPoolSize;
}
+ /**
+ * Size of the thread pool whose threads are responsible for applying the modifications.
+ *
+ * @param threadPoolSize
+ */
public void setThreadPoolSize(Integer threadPoolSize) {
testImmutability("threadPoolSize");
this.threadPoolSize = threadPoolSize;
@@ -72,6 +76,12 @@
return flushLockTimeout;
}
+ /**
+ * Timeout to acquire the lock which guards the state to be flushed to the cache store
+ * periodically.
+ *
+ * @param stateLockTimeout
+ */
public void setFlushLockTimeout(Long stateLockTimeout) {
testImmutability("flushLockTimeout");
this.flushLockTimeout = stateLockTimeout;
@@ -82,6 +92,13 @@
return shutdownTimeout;
}
+ /**
+ * Timeout to stop the cache store. When the store is stopped it's possible that some
+ * modifications still need to be applied; you likely want to set a very large timeout to make
+ * sure to not loose data
+ *
+ * @param shutdownTimeout
+ */
public void setShutdownTimeout(Long shutdownTimeout) {
testImmutability("shutdownTimeout");
this.shutdownTimeout = shutdownTimeout;
Modified: trunk/core/src/main/java/org/infinispan/loaders/decorators/SingletonStoreConfig.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/loaders/decorators/SingletonStoreConfig.java 2010-10-20 17:15:56 UTC (rev 2533)
+++ trunk/core/src/main/java/org/infinispan/loaders/decorators/SingletonStoreConfig.java 2010-10-20 18:00:27 UTC (rev 2534)
@@ -2,24 +2,18 @@
import org.infinispan.config.AbstractNamedCacheConfigurationBean;
import org.infinispan.config.ConfigurationBeanVisitor;
+import org.infinispan.config.ConfigurationDoc;
+import org.infinispan.config.ConfigurationDocRef;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
/**
- * Configuration for a singleton store
- *
- *<p>
- * Note that class SingletonStoreConfig 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 name="singletonStore",desc="SingletonStore is a delegating cache store used for situations when only one
+ * SingletonStore is a delegating cache store used for situations when only one
* instance in a cluster should interact with the underlying store. The coordinator of the cluster will be responsible for
* the underlying CacheStore. SingletonStore is a simply facade to a real CacheStore implementation. It always
- * delegates reads to the real CacheStore."
+ * delegates reads to the real CacheStore.
*
* @author Manik Surtani
* @author Vladimir Blagojevic
@@ -28,20 +22,18 @@
* @see <a href="../../../../config.html#ce_loader_singletonStore">Configuration reference</a>
*/
@XmlAccessorType(XmlAccessType.PUBLIC_MEMBER)
+ at ConfigurationDoc(name="singletonStore")
public class SingletonStoreConfig extends AbstractNamedCacheConfigurationBean {
private static final long serialVersionUID = 824251894176131850L;
-
- /** @configRef desc="If true, the singleton store cache store is enabled. "*/
+
+ @ConfigurationDocRef(bean=SingletonStoreConfig.class,targetElement="setSingletonStoreEnabled")
protected Boolean enabled = false;
- /** @configRef desc="If true, when a node becomes the coordinator, it will transfer in-memory state to the
- * underlying cache store. This can be very useful in situations where the coordinator crashes and
- * there's a gap in time until the new coordinator is elected." */
+ @ConfigurationDocRef(bean=SingletonStoreConfig.class,targetElement="setPushStateWhenCoordinator")
protected Boolean pushStateWhenCoordinator = true;
- /** @configRef desc="If pushStateWhenCoordinator is true, this property sets the maximum number of milliseconds that
- * the process of pushing the in-memory state to the underlying cache loader should take." */
+ @ConfigurationDocRef(bean=SingletonStoreConfig.class,targetElement="setPushStateTimeout")
protected Long pushStateTimeout = 10000L;
@XmlAttribute(name="enabled")
@@ -49,6 +41,11 @@
return enabled;
}
+ /**
+ * If true, the singleton store cache store is enabled.
+ *
+ * @param singletonStoreEnabled
+ */
public void setSingletonStoreEnabled(Boolean singletonStoreEnabled) {
testImmutability("enabled");
this.enabled = singletonStoreEnabled;
@@ -59,6 +56,13 @@
return pushStateWhenCoordinator;
}
+ /**
+ * If true, when a node becomes the coordinator, it will transfer in-memory state to the
+ * underlying cache store. This can be very useful in situations where the coordinator crashes
+ * and there's a gap in time until the new coordinator is elected.
+ *
+ * @param pushStateWhenCoordinator
+ */
public void setPushStateWhenCoordinator(Boolean pushStateWhenCoordinator) {
testImmutability("pushStateWhenCoordinator");
this.pushStateWhenCoordinator = pushStateWhenCoordinator;
@@ -69,6 +73,12 @@
return pushStateTimeout;
}
+ /**
+ * If pushStateWhenCoordinator is true, this property sets the maximum number of milliseconds
+ * that the process of pushing the in-memory state to the underlying cache loader should take.
+ *
+ * @param pushStateTimeout
+ */
public void setPushStateTimeout(Long pushStateTimeout) {
testImmutability("pushStateTimeout");
this.pushStateTimeout = pushStateTimeout;
Modified: trunk/tools/src/main/java/org/infinispan/tools/doclet/config/AbstractConfigHtmlGenerator.java
===================================================================
--- trunk/tools/src/main/java/org/infinispan/tools/doclet/config/AbstractConfigHtmlGenerator.java 2010-10-20 17:15:56 UTC (rev 2533)
+++ trunk/tools/src/main/java/org/infinispan/tools/doclet/config/AbstractConfigHtmlGenerator.java 2010-10-20 18:00:27 UTC (rev 2534)
@@ -24,25 +24,29 @@
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
+import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Scanner;
import java.util.Set;
+import java.util.Map.Entry;
+import org.infinispan.config.ConfigurationDoc;
+import org.infinispan.config.ConfigurationDocRef;
+import org.infinispan.config.ConfigurationDocs;
import org.infinispan.tools.doclet.html.HtmlGenerator;
import org.infinispan.tools.schema.TreeNode;
import org.infinispan.tools.schema.XSOMSchemaTreeWalker;
+import org.infinispan.util.ReflectionUtil;
import com.sun.javadoc.ClassDoc;
+import com.sun.javadoc.Doc;
import com.sun.javadoc.FieldDoc;
+import com.sun.javadoc.MethodDoc;
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;
@@ -51,72 +55,44 @@
@SuppressWarnings("restriction")
public abstract class AbstractConfigHtmlGenerator extends HtmlGenerator {
-
- protected static final String CONFIG_REF = "configRef";
-
- protected static final String CONFIG_REF_NAME_ATT= "name";
- protected static final String CONFIG_REF_PARENT_NAME_ATT= "parentName";
- protected static final String CONFIG_REF_DESC_ATT= "desc";
-
- private static final int LEVEL_MULT = 3;
- private static final boolean DEBUG = Boolean.parseBoolean(System.getProperty("infinispan.tools.configdoc.debug", "false"));
-
- protected RootDoc rootDoc;
- protected StringBuilder sb;
+ protected static final String CONFIG_REF = "configRef";
- public AbstractConfigHtmlGenerator(String encoding, String title, String bottom, String footer,
- String header, String metaDescription, List<String> metaKeywords) {
- super(encoding, title, bottom, footer, header, metaDescription, metaKeywords);
- sb = new StringBuilder();
- }
+ protected static final String CONFIG_REF_NAME_ATT = "name";
+ protected static final String CONFIG_REF_PARENT_NAME_ATT = "parentName";
+ protected static final String CONFIG_REF_DESC_ATT = "desc";
+ private static final int LEVEL_MULT = 3;
+ private static final boolean DEBUG = Boolean.parseBoolean(System.getProperty("infinispan.tools.configdoc.debug", "false"));
+
+ protected RootDoc rootDoc;
+ protected StringBuilder sb;
+
+ public AbstractConfigHtmlGenerator(String encoding, String title, String bottom, String footer,
+ String header, String metaDescription, List<String> metaKeywords) {
+ super(encoding, title, bottom, footer, header, metaDescription, metaKeywords);
+ sb = new StringBuilder();
+ }
+
+ protected abstract List<Class<?>> getConfigBeans() throws Exception;
+
/**
- * Returns a list of classes inspected for configuration reference javadoc tags. Configuration
- * reference tags are specified at class level and field level using <code>@configRef</code>
- * javadoc tag.
+ * Returns name of the schema file.
*
* <p>
- * Configuration class hierarchy should match configuration XML schema where each
- * configuration class matches to one Java class and each property of XML element matches to a
- * field of a class. On a class level <code>@configRef</code> javadoc tag should be placed on a
- * class definition that matches the target XML element. On a field level <code>@configRef</code>
- * javadoc tag should be placed on a field (anywhere in class hiearchy) that matches XML
- * property.
+ * Note that schema file should be placed on a classpath.
*
- * <p>
- * <code>@configRef</code> has two key value property pairs: name and desc. Name specifies the
- * name of the matching XML element in cases when <code>@configRef</code> decorates a class. If
- * <code>@configRef</code> decorates a Java field then name attribute should match XML attribute.
- *
- * <p>
- * Note that name property is optional in cases when <code>@configRef</code> decorates a Java
- * field while it is mandatory in cases when <code>@configRef</code> decorates a configuration
- * class.
- *
- *
- *
- * @return a list of configuration classes decorated with <code>@configRef</code> Javadoc tags.
- * @throws Exception
+ * @return name of the schema file located on the classpath.
*/
- protected abstract List<Class<?>> getConfigBeans() throws Exception;
-
- /**
- * Returns name of the schema file.
- *
- * <p>Note that schema file should be placed on a classpath.
- *
- * @return name of the schema file located on the classpath.
- */
protected abstract String getSchemaFile();
-
- /**
+
+ /**
* Name of the root element in the schema
*
* @return name of the root element in the schema
*/
protected abstract String getRootElementName();
-
+
/**
* Invoked prior to creation of XML tree table of contents for configuration elements in schema
*
@@ -136,402 +112,426 @@
protected void postXMLTableOfContentsCreate(XSOMSchemaTreeWalker w, XMLTreeOutputWalker tw) {
}
-
- /**
+
+ /**
* Callback invoked prior to visiting the specified node n.
*
* @param n
- * @return true if the TreeNode n should be skipped for configuration reference creation, false otherwise
+ * @return true if the TreeNode n should be skipped for configuration reference creation, false
+ * otherwise
*/
protected boolean preVisitNode(TreeNode n) {
- return true;
- }
-
+ return true;
+ }
+
/**
* Callback invoked after visiting the specified node n.
*
* @param n
- * @return true if no more elements should be included in configuration reference creation, false otherwise
+ * @return true if no more elements should be included in configuration reference creation, false
+ * otherwise
*/
- protected boolean postVisitNode(TreeNode n) {
- return false;
- }
-
- protected String getTitle() {
- return "<h2>Configuration reference</h2><br/>";
- }
+ protected boolean postVisitNode(TreeNode n) {
+ return false;
+ }
- public RootDoc getRootDoc() {
- return rootDoc;
- }
+ protected String getTitle() {
+ return "<h2>Configuration reference</h2><br/>";
+ }
- public void setRootDoc(RootDoc rootDoc) {
- this.rootDoc = rootDoc;
- }
-
- public InputStream lookupFile(String filename) {
- InputStream is = filename == null || filename.length() == 0 ? null : getAsInputStreamFromClassLoader(filename);
- if (is == null) {
- try {
- is = new FileInputStream(filename);
- }
- catch (FileNotFoundException e) {
- return null;
- }
- }
- return is;
- }
-
- protected InputStream getAsInputStreamFromClassLoader(String filename) {
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
- InputStream is = cl == null ? null : cl.getResourceAsStream(filename);
- if (is == null) {
- // check system class loader
- is = getClass().getClassLoader().getResourceAsStream(filename);
- }
- return is;
- }
-
- protected StringBuilder getStringBuilder() {
- return sb;
- }
+ public RootDoc getRootDoc() {
+ return rootDoc;
+ }
- protected String generateContents() {
- sb.append(getTitle());
+ public void setRootDoc(RootDoc rootDoc) {
+ this.rootDoc = rootDoc;
+ }
- List<Class<?>> configBeans;
- try {
- configBeans = getConfigBeans();
-
- if (configBeans == null || configBeans.isEmpty())
- throw new Exception("Configuration bean classes are not specified. Make sure that "
+ public InputStream lookupFile(String filename) {
+ InputStream is = filename == null || filename.length() == 0 ? null
+ : getAsInputStreamFromClassLoader(filename);
+ if (is == null) {
+ try {
+ is = new FileInputStream(filename);
+ } catch (FileNotFoundException e) {
+ return null;
+ }
+ }
+ return is;
+ }
+
+ protected InputStream getAsInputStreamFromClassLoader(String filename) {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ InputStream is = cl == null ? null : cl.getResourceAsStream(filename);
+ if (is == null) {
+ // check system class loader
+ is = getClass().getClassLoader().getResourceAsStream(filename);
+ }
+ return is;
+ }
+
+ protected StringBuilder getStringBuilder() {
+ return sb;
+ }
+
+ protected String generateContents() {
+ sb.append(getTitle());
+
+ List<Class<?>> configBeans;
+ try {
+ configBeans = getConfigBeans();
+
+ if (configBeans == null || configBeans.isEmpty())
+ throw new Exception(
+ "Configuration bean classes are not specified. Make sure that "
+ "getConfigBeans() method returns a list of classes. Documentation creation aborted");
- XMLTreeOutputWalker tw = new XMLTreeOutputWalker(sb);
- String schemaFile = getSchemaFile();
-
- if (schemaFile == null)
- throw new Exception("Schema file name not specified. Documentation creation aborted");
+ XMLTreeOutputWalker tw = new XMLTreeOutputWalker(sb);
+ String schemaFile = getSchemaFile();
- InputStream file = lookupFile(schemaFile);
-
+ if (schemaFile == null)
+ throw new Exception("Schema file name not specified. Documentation creation aborted");
+
+ InputStream file = lookupFile(schemaFile);
+
if (file == null)
throw new Exception("Schema file " + schemaFile
+ " not found on classpath. Documentation creation aborted");
-
- XSOMParser reader = new XSOMParser();
- reader.parse(file);
- XSSchemaSet xss = reader.getResult();
- XSOMSchemaTreeWalker w = new XSOMSchemaTreeWalker(xss.getSchema(1), getRootElementName());
- TreeNode root = w.getRoot();
- associateBeansWithTreeNodes(configBeans, root);
-
- preXMLTableOfContentsCreate(w, tw);
- sb.append("<div class=\"" + "source" + "\"><pre>");
- // print XMLTableOfContents into StringBuilder
- tw.preOrderTraverse(root);
- sb.append("</pre></div>");
-
- postXMLTableOfContentsCreate(w, tw);
+ XSOMParser reader = new XSOMParser();
+ reader.parse(file);
+ XSSchemaSet xss = reader.getResult();
+ XSOMSchemaTreeWalker w = new XSOMSchemaTreeWalker(xss.getSchema(1), getRootElementName());
+ TreeNode root = w.getRoot();
+ associateBeansWithTreeNodes(configBeans, root);
+ preXMLTableOfContentsCreate(w, tw);
- for (TreeNode n : root) {
+ sb.append("<div class=\"" + "source" + "\"><pre>");
+ // print XMLTableOfContents into StringBuilder
+ tw.preOrderTraverse(root);
+ sb.append("</pre></div>");
- boolean skip = preVisitNode(n);
- //do not generate element for skipped element
- if (skip)
- continue;
+ postXMLTableOfContentsCreate(w, tw);
- debug("element = " + n.getName(), 0);
+ for (TreeNode n : root) {
- sb.append("<div class=\"section\">\n");
- // Name, description, parent and child elements for node
- generateHeaderForConfigurationElement(sb, tw, n);
+ boolean skip = preVisitNode(n);
+ // do not generate element for skipped element
+ if (skip)
+ continue;
- //now attributes
- if (!n.getAttributes().isEmpty()) {
- generateAttributeTableRows(sb, n);
- }
-
- boolean breakLoop = postVisitNode(n);
- sb.append("</div>\n");
- if(breakLoop)
- break;
- }
+ sb.append("<div class=\"section\">\n");
- } catch (Exception e) {
- System.out.println("Exception while generating configuration reference " + e);
- e.printStackTrace();
- }
- return sb.toString();
- }
+ debug("Generating " + n + " bean is " + n.getBeanClass());
- 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();
- Map<String, String> p = parseTag(text);
- String thisNode = p.get(CONFIG_REF_NAME_ATT);
- String parentNode = p.get(CONFIG_REF_PARENT_NAME_ATT);
- if (n.getName().equalsIgnoreCase(thisNode)) {
- // parent specified
- if (parentNode != null
- && parentNode.equalsIgnoreCase(n.getParent().getName())) {
- n.setBeanClass(clazz);
- } else if (parentNode == null) {
- n.setBeanClass(clazz);
- }
- }
- }
- }
- }
- }
- }
- }
+ // Name, description, parent and child elements for node
+ generateHeaderForConfigurationElement(sb, tw, n);
- private void generateAttributeTableRows(StringBuilder sb, TreeNode n) {
+ // now attributes
+ if (!n.getAttributes().isEmpty()) {
+ generateAttributeTableRows(sb, 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");
+ boolean breakLoop = postVisitNode(n);
+ sb.append("</div>\n");
+ if (breakLoop)
+ break;
+ }
- 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();
- }
- }
- } catch (Exception e) {
- System.out.println("Did not construct object " + bean);
- }
+ } catch (Exception e) {
+ System.out.println("Exception while generating configuration reference " + e);
+ e.printStackTrace();
+ }
+ return sb.toString();
+ }
- Set<XSAttributeDecl> attributes = n.getAttributes();
- for (XSAttributeDecl a : attributes) {
- sb.append("<tr class=\"b\">");
+ private void associateBeansWithTreeNodes(List<Class<?>> configBeans, TreeNode root) {
+ for (TreeNode n : root) {
+ if (n.getBeanClass() == null) {
+ for (Class<?> clazz : configBeans) {
+ if (clazz.isAnnotationPresent(ConfigurationDoc.class)) {
+ associate(clazz.getAnnotation(ConfigurationDoc.class), n, clazz);
+ } else if (clazz.isAnnotationPresent(ConfigurationDocs.class)) {
+ ConfigurationDoc[] docs = clazz.getAnnotation(ConfigurationDocs.class).value();
+ for (ConfigurationDoc cd : docs) {
+ associate(cd, n, clazz);
+ }
+ }
+ }
+ }
+ }
+ }
- //name, type...
- sb.append("<td>").append("<code>" + a.getName() + "</code>").append("</td>\n");
- sb.append("<td>").append("<code>" + a.getType().getName() + "</code>");
+ private void associate(ConfigurationDoc cd, TreeNode n, Class<?> clazz) {
+ if (cd != null) {
+ String thisNode = cd.name();
+ String parentNode = cd.parentName();
+ if (n.getName().equalsIgnoreCase(thisNode)) {
+ if (parentNode.equalsIgnoreCase(n.getParent().getName())) {
+ debug("Parent associated " + clazz + " with node " + n.getName() + ", parent " + parentNode);
+ n.setBeanClass(clazz);
+ } else if (parentNode.length() == 0) {
+ debug("Normal associated " + clazz + " with node " + n.getName());
+ n.setBeanClass(clazz);
+ }
+ }
+ }
+ }
- boolean isRestricted = false;
- XSRestrictionSimpleType restriction = a.getType().asRestriction();
- Collection<? extends XSFacet> declaredFacets = restriction.getDeclaredFacets();
- for (XSFacet facet : declaredFacets) {
- if (facet.getName().equalsIgnoreCase("enumeration")) {
- isRestricted = true;
- break;
- }
- }
+ private void generateAttributeTableRows(StringBuilder sb, TreeNode n) {
- debug ("attribute = " + a.getName() + "(restricted = " + isRestricted + ")", 1);
+ sb.append("<table class=\"bodyTable\"> ");
+ sb.append("<tr class=\"a\"><th>Attribute</th><th>Type</th><th>Default</th><th>Description</th></tr>\n");
- // restriction on type...
- if (isRestricted) {
- sb.append("* (");
- for (XSFacet facet : declaredFacets) {
- sb.append(facet.getValue().toString() + '|');
- }
- sb.deleteCharAt(sb.length() - 1);
- sb.append(")</td>\n");
- } else {
- sb.append("</td>\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();
+ }
+ }
+ } catch (Exception e) {
+ System.out.println("Did not construct object " + bean);
+ }
- // if default value specified in annotation use it
- if (a.getDefaultValue() != null) {
- debug("annotation-defined default = " + a.getDefaultValue(), 2);
- sb.append("<td>").append(a.getDefaultValue().toString()).append("</td>\n");
- }
+ Set<XSAttributeDecl> attributes = n.getAttributes();
+ for (XSAttributeDecl a : attributes) {
+ sb.append("<tr class=\"b\">");
- // otherwise reflect that field and read default value
- else {
- Field field = null;
- Object defaultValue = null;
- try {
- field = findFieldRecursively(bean, a.getName());
- defaultValue = fieldValue(field, object);
- if (defaultValue != null) {
- sb.append("<td>").append(defaultValue.toString()).append("</td>\n");
- debug("field-defined default = " + defaultValue, 2);
- } else {
- debug("field-defined default is null!", 2);
- sb.append("<td>").append("null").append("</td>\n");
- }
- } catch (Exception e) {
- debug("Caught exception, bean is " + bean.getName() + ", looking for field " + a.getName() + ", field " + field, 2);
- e.printStackTrace();
- sb.append("<td>").append("N/A").append("</td>\n");
- }
- }
+ // name, type...
+ sb.append("<td>").append("<code>" + a.getName() + "</code>").append("</td>\n");
+ sb.append("<td>").append("<code>" + a.getType().getName() + "</code>");
- // and finally description
- FieldDoc fieldDoc = findFieldDocRecursively(bean, a.getName(), CONFIG_REF);
- if (fieldDoc != null) {
- Tag[] tags = fieldDoc.tags(CONFIG_REF);
- Map<String, String> p = parseTag(tags[0].text().trim());
- sb.append("<td>").append(p.get(CONFIG_REF_DESC_ATT)).append("\n");
- String packageDir = fieldDoc.containingPackage().toString().replace(".", "/").concat("/");
- String htmlFile = fieldDoc.containingClass().typeName().concat(".html");
- String field = fieldDoc.name();
- sb.append(" (<a href=\"" +packageDir.concat(htmlFile).concat("#").concat(field) +"\">" + "Javadoc</a>)");
- sb.append("</td>\n");
-
- }
- sb.append("</tr>\n");
- }
- sb.append("</table>\n");
- }
+ boolean isRestricted = false;
+ XSRestrictionSimpleType restriction = a.getType().asRestriction();
+ Collection<? extends XSFacet> declaredFacets = restriction.getDeclaredFacets();
+ for (XSFacet facet : declaredFacets) {
+ if (facet.getName().equalsIgnoreCase("enumeration")) {
+ isRestricted = true;
+ break;
+ }
+ }
- private void debug(String s, int level) {
- if (DEBUG) {
- StringBuilder sb = new StringBuilder();
- for (int i = 0; i < level * LEVEL_MULT; i++) sb.append(" ");
- sb.append("> ").append(s);
- System.out.println(sb.toString());
- }
- }
+ debug("attribute = " + a.getName() + "(restricted = " + isRestricted + ")", 1);
- public Map<String, String> parseTag(String tag) {
+ // restriction on type...
+ if (isRestricted) {
+ sb.append("* (");
+ for (XSFacet facet : declaredFacets) {
+ sb.append(facet.getValue().toString() + '|');
+ }
+ sb.deleteCharAt(sb.length() - 1);
+ sb.append(")</td>\n");
+ } else {
+ sb.append("</td>\n");
+ }
- //javadoc parser for our tags
- Map<String, String> p = new HashMap<String, String>();
- Scanner sc = new Scanner(tag);
- Scanner sc2 = null;
- sc.useDelimiter("\"\\s*,\\s*");
- try {
- while (sc.hasNext()) {
- String keyValue = sc.next();
- sc2 = new Scanner(keyValue);
- sc2.useDelimiter("=\\s*\"");
- String key = sc2.next();
- String value = sc2.next().replace("\"", "");
- p.put(key, value);
- sc2.close();
- }
- sc.close();
- } catch (Exception e) {
- System.out.println("Invalid tag " + tag + " skipping...");
- } finally {
- sc.close();
- sc2.close();
- }
- return p;
- }
+ Field field = findField(bean, a.getName());
+ if (field == null) {
+ throw new RuntimeException("Null field for " + bean.getName() + " attribute "
+ + a.getName());
+ }
- private void generateHeaderForConfigurationElement(StringBuilder sb, XMLTreeOutputWalker tw, TreeNode n) {
- sb.append("<a name=\"").append("ce_" + n.getParent().getName() + "_" + n.getName() + "\">" + "</a>");
- sb.append("<h3><a name=\"" + n.getName() + "\"></a>" + n.getName() + "</h3>");
- sb.append("\n<p>");
- Class<?> beanClass = n.getBeanClass();
- //System.out.println("Generating " + n + " bean is " + beanClass);
- ClassDoc classDoc = rootDoc.classNamed(beanClass.getName());
- Tag[] tags = classDoc.tags(CONFIG_REF);
-
- for (Tag tag : tags) {
- String text = tag.text().trim();
- Map<String, String> m = parseTag(text);
- String name = m.get(CONFIG_REF_NAME_ATT);
- if(n.getName().equals(name)) {
- sb.append(m.get(CONFIG_REF_DESC_ATT));
- }
- }
+ // if default value specified in annotation use it
+ if (a.getDefaultValue() != null) {
+ debug("annotation-defined default = " + a.getDefaultValue(), 2);
+ sb.append("<td>").append(a.getDefaultValue().toString()).append("</td>\n");
+ }
- sb.append("<BR/><BR />");
+ // otherwise use reflected field and read default value
+ else {
+ Object defaultValue = null;
+ try {
+ defaultValue = ReflectionUtil.getValue(object, field.getName());
+ if (defaultValue != null) {
+ sb.append("<td>").append(defaultValue.toString()).append("</td>\n");
+ debug("field-defined default = " + defaultValue, 2);
+ } else {
+ debug("field-defined default is null!", 2);
+ sb.append("<td>").append("null").append("</td>\n");
+ }
+ } catch (Exception e) {
+ debug("Caught exception, bean is " + bean.getName() + ", looking for field "
+ + a.getName() + ", field " + field, 2);
+ e.printStackTrace();
+ sb.append("<td>").append("N/A").append("</td>\n");
+ }
+ }
- if (n.getParent().getParent() != null) {
- sb.append("The parent element is " + "<a href=\"").append("#ce_" + n.getParent().getParent().getName()
- + "_" + n.getParent().getName() + "\">" + "<" + n.getParent().getName() + ">" + "</a>. ");
- }
+ // and finally description
+ String desc = findAttributeDescription(field);
+ if (desc != null) {
+ sb.append("<td>").append(desc).append("\n");
+ String htmlFile = field.getDeclaringClass().getName().replace(".", "/").replace("$",".").concat(".html");
+ sb.append(" (<a href=\"" + htmlFile.concat("#").concat(field.getName()) + "\">"+ "Javadoc</a>)");
+ sb.append("</td>\n");
+ }
+ sb.append("</tr>\n");
+ }
+ sb.append("</table>\n");
+ }
- if (!n.getChildren().isEmpty()) {
- int childCount = n.getChildren().size();
- int count = 1;
- if (childCount == 1)
- sb.append("The only child element is ");
- else
- sb.append("Child elements are ");
- for (TreeNode tn : n.getChildren()) {
- sb.append("<a href=\"").append("#ce_" + tn.getParent().getName() + "_"
- + tn.getName() + "\">" + "<" + tn.getName() + ">" + "</a>");
- if (count < childCount) {
- sb.append(", ");
- } else {
- sb.append(".");
- }
- count++;
- }
- sb.append("\n");
- }
- sb.append("</p>");
- }
+ private void debug(String s, int level) {
+ if (DEBUG) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < level * LEVEL_MULT; i++)
+ sb.append(" ");
+ sb.append("> ").append(s);
+ System.out.println(sb.toString());
+ }
+ }
- private Field findFieldRecursively(Class<?> c, String fieldName) {
- findFieldRecursively:
- while (true) {
- 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)) {
- Map<String, String> m = parseTag(t.text().trim());
- String field = m.get(CONFIG_REF_NAME_ATT);
- if (field != null && field.startsWith(fieldName)) {
- fieldName = fd.name();
- continue findFieldRecursively;
- }
- }
- }
- if (!c.equals(Object.class))
- f = findFieldRecursively(c.getSuperclass(), fieldName);
- }
- return f;
- }
- }
+ private void debug(String s) {
+ debug(s, 0);
+ }
- private FieldDoc findFieldDocRecursively(Class<?> c, String fieldName, String tagName) {
- while (true) {
- ClassDoc classDoc = rootDoc.classNamed(c.getName());
- for (FieldDoc fd : classDoc.fields()) {
- if (fd.name().equalsIgnoreCase(fieldName)) {
- return fd;
- }
- for (Tag t : fd.tags(tagName)) {
- Map<String, String> m = parseTag(t.text().trim());
- if (m.containsKey(CONFIG_REF_NAME_ATT)) {
- String value = m.get(CONFIG_REF_NAME_ATT).trim();
- if (fieldName.equalsIgnoreCase(value)) {
- return fd;
- }
- }
- }
- }
- if (c.getSuperclass() != null) {
- c = c.getSuperclass();
- continue;
- }
- return null;
- }
- }
+ private boolean validString(String s) {
+ return s != null && s.length() > 0;
+ }
- private static Object fieldValue(Field field, Object target) {
- if (!Modifier.isPublic(field.getModifiers())) {
- field.setAccessible(true);
- }
- try {
- return field.get(target);
- } catch (IllegalAccessException iae) {
- throw new IllegalArgumentException("Could not get field " + field, iae);
- }
- }
+ protected void generateHeaderForConfigurationElement(StringBuilder sb, XMLTreeOutputWalker tw,
+ TreeNode n) {
+ sb.append("<a name=\"").append("ce_" + n.getParent().getName() + "_" + n.getName() + "\">" + "</a>");
+ sb.append("<h3><a name=\"" + n.getName() + "\"></a>" + n.getName() + "</h3>");
+ sb.append("\n<p>");
+ Class<?> beanClass = n.getBeanClass();
+ Map<String, String> desc = findDescription(beanClass);
+ if (!desc.isEmpty()) {
+ for (Entry<String, String> e : desc.entrySet()) {
+ if (n.getName().equals(e.getKey())) {
+ sb.append(e.getValue());
+ }
+ }
+ }
+
+ sb.append("<BR/><BR />");
+
+ if (n.getParent().getParent() != null) {
+ sb.append("The parent element is " + "<a href=\"").append("#ce_"
+ + n.getParent().getParent().getName() + "_" + n.getParent().getName()
+ + "\">" + "<" + n.getParent().getName() + ">" + "</a>. ");
+ }
+
+ if (!n.getChildren().isEmpty()) {
+ int childCount = n.getChildren().size();
+ int count = 1;
+ if (childCount == 1)
+ sb.append("The only child element is ");
+ else
+ sb.append("Child elements are ");
+ for (TreeNode tn : n.getChildren()) {
+ sb.append("<a href=\"").append("#ce_" + tn.getParent().getName() +
+ "_" + tn.getName() + "\">" + "<" + tn.getName() + ">" + "</a>");
+ if (count < childCount) {
+ sb.append(", ");
+ } else {
+ sb.append(".");
+ }
+ count++;
+ }
+ sb.append("\n");
+ }
+ sb.append("</p>");
+ }
+
+ protected String findAttributeDescription(Field field) {
+ String desc = null;
+ if (field.isAnnotationPresent(ConfigurationDoc.class)) {
+ desc = field.getAnnotation(ConfigurationDoc.class).desc();
+ } else if (field.isAnnotationPresent(ConfigurationDocRef.class)) {
+ ConfigurationDocRef docRef = field.getAnnotation(ConfigurationDocRef.class);
+ Doc fieldDocRec = findDocElement(docRef.bean(), docRef.targetElement());
+ desc = fieldDocRec.commentText();
+ }
+ return desc;
+ }
+
+ protected Field findField(Class<?> clazz, String name) {
+ Field f = null;
+ boolean found = false;
+ Class<?> current = clazz;
+ while (current != null) {
+ try {
+ f = current.getDeclaredField(name);
+ return f;
+ } catch (NoSuchFieldException e) {
+ current = current.getSuperclass();
+ }
+ }
+
+ List<Field> anFields = ReflectionUtil.getAnnotatedFields(clazz, ConfigurationDoc.class);
+ for (Field field : anFields) {
+ if (field.getAnnotation(ConfigurationDoc.class).name().equals(name)) {
+ f = field;
+ found = true;
+ break;
+ }
+ }
+
+ // or with ConfigurationDocReference....
+ if (!found) {
+ anFields = ReflectionUtil.getAnnotatedFields(clazz, ConfigurationDocRef.class);
+ for (Field field : anFields) {
+ if (field.getAnnotation(ConfigurationDocRef.class).name().equals(name)) {
+ f = field;
+ break;
+ }
+ }
+ }
+ return f;
+ }
+
+ protected Map<String, String> findDescription(AnnotatedElement e) {
+ Map<String, String> m = new HashMap<String, String>();
+ ConfigurationDoc cd = e.getAnnotation(ConfigurationDoc.class);
+ if (cd != null) {
+ extractConfigurationDocComments(e, m, cd);
+ } else if (e.isAnnotationPresent(ConfigurationDocs.class)) {
+ ConfigurationDoc[] configurationDocs = e.getAnnotation(ConfigurationDocs.class).value();
+ for (ConfigurationDoc cd2 : configurationDocs) {
+ extractConfigurationDocComments(e, m, cd2);
+ }
+ }
+ return m;
+ }
+
+ protected void extractConfigurationDocComments(AnnotatedElement e, Map<String, String> m,
+ ConfigurationDoc cd) {
+ if (cd != null) {
+ if (validString(cd.desc())) {
+ m.put(cd.name(), cd.desc());
+ } else {
+ if (e instanceof Class<?>) {
+ Class<?> clazz = (Class<?>) e;
+ ClassDoc classDoc = rootDoc.classNamed(clazz.getName());
+ m.put(cd.name(), classDoc.commentText());
+ }
+ }
+ }
+ }
+
+ protected Doc findDocElement(Class<?> c, String elementName) {
+ while (true) {
+ ClassDoc classDoc = rootDoc.classNamed(c.getName());
+ for (MethodDoc md : classDoc.methods()) {
+ if (md.name().equalsIgnoreCase(elementName)) {
+ return md;
+ }
+ }
+ for (FieldDoc fd : classDoc.fields()) {
+ if (fd.name().equalsIgnoreCase(elementName)) {
+ return fd;
+ }
+ }
+ if (c.getSuperclass() != null) {
+ c = c.getSuperclass();
+ continue;
+ }
+ return null;
+ }
+ }
}
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 2010-10-20 17:15:56 UTC (rev 2533)
+++ trunk/tools/src/main/java/org/infinispan/tools/doclet/config/ConfigHtmlGenerator.java 2010-10-20 18:00:27 UTC (rev 2534)
@@ -1,7 +1,9 @@
package org.infinispan.tools.doclet.config;
+import java.lang.reflect.Field;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import org.infinispan.Version;
import org.infinispan.config.AbstractConfigurationBean;
@@ -12,22 +14,14 @@
import org.infinispan.util.ClassFinder;
import org.infinispan.util.TypedProperties;
-import com.sun.javadoc.ClassDoc;
-import com.sun.javadoc.FieldDoc;
-import com.sun.javadoc.Tag;
-
/**
* Infinispan configuration reference guide generator
*
* @author Vladimir Blagojevic
* @since 4.0
*/
+public class ConfigHtmlGenerator extends AbstractConfigHtmlGenerator {
- at SuppressWarnings("restriction")
-public class ConfigHtmlGenerator extends AbstractConfigHtmlGenerator {
-
- private static final String CONFIG_PROPERTY_REF = "configPropertyRef";
-
String classpath;
public ConfigHtmlGenerator(String encoding, String title, String bottom, String footer,
@@ -80,38 +74,22 @@
return super.postVisitNode(n);
}
- private void generatePropertiesTableRows(StringBuilder sb, TreeNode n) {
- FieldDoc fieldDoc = fieldDocWithTag(n.getBeanClass(), CONFIG_PROPERTY_REF);
- if (fieldDoc != null) {
- sb.append("<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) {
- Map<String, String> m = parseTag(t.text().trim());
- sb.append("<tr class=\"b\">");
- sb.append("<td>").append(m.get(CONFIG_REF_NAME_ATT)).append("</td>\n");
- sb.append("<td>").append(m.get(CONFIG_REF_DESC_ATT)).append("</td>\n");
- sb.append("</tr>\n");
- }
- sb.append("</table>\n");
- }
- }
-
- private FieldDoc fieldDocWithTag(Class<?> c, String tagName) {
- while (true) {
- ClassDoc classDoc = rootDoc.classNamed(c.getName());
- for (FieldDoc fd : classDoc.fields()) {
- if (fd.tags(tagName).length > 0) {
- return fd;
- }
- }
-
- if (c.getSuperclass() != null) {
- c = c.getSuperclass();
- continue;
- }
- return null;
- }
+ private void generatePropertiesTableRows(StringBuilder sb, TreeNode n) {
+ Field field = findField(n.getBeanClass(), "properties");
+ if (field != null) {
+ Map<String, String> description = findDescription(field);
+ if (!description.isEmpty()) {
+ sb.append("<table class=\"bodyTable\"> ");
+ sb.append("<tr class=\"a\"><th>Property</th><th>Description</th></tr>\n");
+ for (Entry<String, String> e : description.entrySet()) {
+ sb.append("<tr class=\"b\">");
+ sb.append("<td>").append(e.getKey()).append("</td>\n");
+ sb.append("<td>").append(e.getValue()).append("</td>\n");
+ sb.append("</tr>\n");
+ }
+ sb.append("</table>\n");
+ }
+ }
}
private static class PruneTreeWalker extends AbstractTreeWalker {
More information about the infinispan-commits
mailing list