[infinispan-commits] Infinispan SVN: r578 - trunk/core/src/main/java/org/infinispan/config.
infinispan-commits at lists.jboss.org
infinispan-commits at lists.jboss.org
Wed Jul 15 09:03:48 EDT 2009
Author: vblagojevic at jboss.com
Date: 2009-07-15 09:03:47 -0400 (Wed, 15 Jul 2009)
New Revision: 578
Modified:
trunk/core/src/main/java/org/infinispan/config/ConfigurationAttribute.java
trunk/core/src/main/java/org/infinispan/config/ConfigurationElement.java
trunk/core/src/main/java/org/infinispan/config/ConfigurationProperties.java
trunk/core/src/main/java/org/infinispan/config/ConfigurationProperty.java
Log:
[ISPN-97] - Improve configuration processing and maintenance
Modified: trunk/core/src/main/java/org/infinispan/config/ConfigurationAttribute.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/config/ConfigurationAttribute.java 2009-07-15 11:11:40 UTC (rev 577)
+++ trunk/core/src/main/java/org/infinispan/config/ConfigurationAttribute.java 2009-07-15 13:03:47 UTC (rev 578)
@@ -24,24 +24,58 @@
import java.lang.annotation.*;
/**
- * Represents an attribute of any XML element from a valid Infinispan configuration file.
+ * Represents an attribute of any XML element from a valid Infinispan configuration file.
+ * <p>
*
+ * Each ConfigurationAttribute should annotate the corresponding setter method in ancestor hierarchy
+ * of the appropriate AbstractConfigurationBean.
+ * <p>
+ *
+ * ConfigurationAttribute should annotate the corresponding setter methods with one parameter that
+ * could be either primitive or java.lang.String.
+ *
+ *
* @author Vladimir Blagojevic
- * @version $Id: ConfigurationAttribute.java,v 1.5 2008/05/23 11:11:02 belaban Exp $
+ * @version $Id$
*/
@Retention(RetentionPolicy.RUNTIME)
@Target( { ElementType.METHOD })
public @interface ConfigurationAttribute {
+ /**
+ * Returns name of corresponding XML (ConfigurationElement) element that declares this attribute
+ *
+ * @return
+ */
String containingElement();
+ /**
+ * Returns name of this attribute. Should match the corresponding attribute in XML
+ *
+ * @return
+ */
String name();
+ /**
+ * Returns comma delimited list of allowed values for this attribute
+ *
+ * @return
+ */
String allowedValues() default "";
+ /**
+ * Returns default value for this attribute
+ *
+ * @return
+ */
String defaultValue() default "";
+ /**
+ * Returns description of this attribute
+ *
+ * @return
+ */
String description() default "";
}
Property changes on: trunk/core/src/main/java/org/infinispan/config/ConfigurationAttribute.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: trunk/core/src/main/java/org/infinispan/config/ConfigurationElement.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/config/ConfigurationElement.java 2009-07-15 11:11:40 UTC (rev 577)
+++ trunk/core/src/main/java/org/infinispan/config/ConfigurationElement.java 2009-07-15 13:03:47 UTC (rev 578)
@@ -25,30 +25,77 @@
import org.infinispan.config.parsing.ConfigurationElementReader;
import org.infinispan.config.parsing.ConfigurationElementWriter;
-
/**
- * Represents XML element from a valid Infinispan configuration file.
+ * Represents XML element from a valid Infinispan configuration file.
+ * <p>
*
+ * Each ConfigurationElement should annotate the most derived subclass of AbstractConfigurationBean
+ * that contains setter methods for XML attributes of the corresponding XML element (the one that
+ * ConfigurationElement represents)
+ *
+ * <p>
+ * For example, CacheLoaderManagerConfig is annotated with
+ * <code>@ConfigurationElement(name="loaders",parent="default")</code> annotation since
+ * CacheLoaderManagerConfig is the most derived subclass of AbstractConfigurationBean that contains
+ * setter methods for attributes contained in <code><loaders></code> XML element.
+ *
+ * @see GlobalConfiguration
+ * @see Configuration
+ * @see CacheLoaderManagerConfig
* @author Vladimir Blagojevic
* @version $Id$
*/
@Retention(RetentionPolicy.RUNTIME)
- at Target( { ElementType.TYPE})
+ at Target( { ElementType.TYPE })
public @interface ConfigurationElement {
-
- public enum Cardinality{ONE, UNBOUNDED};
-
- String name();
- String parent();
-
- Cardinality cardinalityInParent() default Cardinality.ONE;
+ public enum Cardinality {
+ ONE, UNBOUNDED
+ };
- String description() default "";
-
- Class <? extends ConfigurationElementReader> customReader() default ConfigurationElementReader.class;
-
- Class <? extends ConfigurationElementWriter> customWriter() default ConfigurationElementWriter.class;
-
+ /**
+ * Returns name of corresponding XML element
+ *
+ * @return
+ */
+ String name();
+
+ /**
+ * Returns name of corresponding XML element.
+ *
+ * @return
+ */
+ String parent();
+
+ /**
+ * Returns Cardinality.ONE if parent ConfigurationElement can have zero or one child defined by
+ * this ConfigurationElement. In case parent can have multiple ConfigurationElement with the same
+ * name returns Cardinality.UNBOUNDED
+ *
+ * @return
+ */
+ Cardinality cardinalityInParent() default Cardinality.ONE;
+
+ /**
+ * Returns description of this element
+ *
+ * @return
+ */
+ String description() default "";
+
+ /**
+ * Returns class of customer parser needed to process this ConfigurationElement
+ *
+ * @return
+ */
+ Class<? extends ConfigurationElementReader> customReader() default ConfigurationElementReader.class;
+
+ /**
+ * Returns class of customer writer for this ConfigurationElement
+ *
+ * @return
+ */
+ Class<? extends ConfigurationElementWriter> customWriter() default ConfigurationElementWriter.class;
+
}
Modified: trunk/core/src/main/java/org/infinispan/config/ConfigurationProperties.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/config/ConfigurationProperties.java 2009-07-15 11:11:40 UTC (rev 577)
+++ trunk/core/src/main/java/org/infinispan/config/ConfigurationProperties.java 2009-07-15 13:03:47 UTC (rev 578)
@@ -30,7 +30,7 @@
* Represents a list of XML property elements from a valid Infinispan configuration file.
*
* @author Vladimir Blagojevic
- * @version $Id: ConfigurationProperties.java,v 1.5 2008/05/23 11:11:02 belaban Exp $
+ * @version $Id$
*/
@Retention(RetentionPolicy.RUNTIME)
@Target( { ElementType.METHOD })
Property changes on: trunk/core/src/main/java/org/infinispan/config/ConfigurationProperties.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: trunk/core/src/main/java/org/infinispan/config/ConfigurationProperty.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/config/ConfigurationProperty.java 2009-07-15 11:11:40 UTC (rev 577)
+++ trunk/core/src/main/java/org/infinispan/config/ConfigurationProperty.java 2009-07-15 13:03:47 UTC (rev 578)
@@ -24,18 +24,40 @@
import java.lang.annotation.*;
/**
- * Represents a property element from a valid Infinispan configuration file.
+ * Represents a property element from a valid Infinispan configuration file.
+ * <p>
*
+ * Each ConfigurationProperty should annotate the corresponding setter method in ancestor hierarchy
+ * of the appropriate AbstractConfigurationBean. Parameter of the corresponding setter should be
+ * either Properties or java.lang.String
+ * <p>
+ *
* @author Vladimir Blagojevic
- * @version $Id: ConfigurationProperty.java,v 1.5 2008/05/23 11:11:02 belaban Exp $
+ * @version $Id$
*/
@Retention(RetentionPolicy.RUNTIME)
@Target( { ElementType.METHOD, ElementType.FIELD })
public @interface ConfigurationProperty {
+ /**
+ * Returns name of corresponding XML (ConfigurationElement) element that declares this property
+ *
+ * @return
+ */
String parentElement();
+ /**
+ * Returns name of this property. Should return the value of corresponding name attribute in
+ * <property> XML element
+ *
+ * @return
+ */
String name();
+ /**
+ * Returns description of this property
+ *
+ * @return
+ */
String description() default "";
}
Property changes on: trunk/core/src/main/java/org/infinispan/config/ConfigurationProperty.java
___________________________________________________________________
Name: svn:keywords
+ Id
More information about the infinispan-commits
mailing list