[infinispan-commits] Infinispan SVN: r538 - in trunk/core/src/main/java/org/infinispan/config: parsing and 1 other directory.
infinispan-commits at lists.jboss.org
infinispan-commits at lists.jboss.org
Thu Jul 9 09:03:28 EDT 2009
Author: vblagojevic at jboss.com
Date: 2009-07-09 09:03:27 -0400 (Thu, 09 Jul 2009)
New Revision: 538
Removed:
trunk/core/src/main/java/org/infinispan/config/parsing/TransactionConfigReader.java
Modified:
trunk/core/src/main/java/org/infinispan/config/Configuration.java
trunk/core/src/main/java/org/infinispan/config/parsing/AutomatedXmlConfigurationParserImpl.java
Log:
handle transaction without custom reader
use default value in annotation
Modified: trunk/core/src/main/java/org/infinispan/config/Configuration.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/config/Configuration.java 2009-07-09 12:33:07 UTC (rev 537)
+++ trunk/core/src/main/java/org/infinispan/config/Configuration.java 2009-07-09 13:03:27 UTC (rev 538)
@@ -21,8 +21,11 @@
*/
package org.infinispan.config;
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
import org.infinispan.config.parsing.ClusteringConfigReader;
-import org.infinispan.config.parsing.TransactionConfigReader;
import org.infinispan.distribution.DefaultConsistentHash;
import org.infinispan.eviction.EvictionStrategy;
import org.infinispan.factories.annotations.Inject;
@@ -31,10 +34,6 @@
import org.infinispan.util.ReflectionUtil;
import org.infinispan.util.concurrent.IsolationLevel;
-import java.util.Collections;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-
/**
* Encapsulates the configuration of a Cache.
*
@@ -46,7 +45,7 @@
@ConfigurationElement(name = "default", parent = "infinispan", description = ""),
@ConfigurationElement(name = "namedCache", parent = "infinispan", description = ""),
@ConfigurationElement(name = "locking", parent = "default", description = ""),
- @ConfigurationElement(name = "transaction", parent = "default", description = "", customReader=TransactionConfigReader.class),
+ @ConfigurationElement(name = "transaction", parent = "default", description = ""),
@ConfigurationElement(name = "jmxStatistics", parent = "default", description = ""),
@ConfigurationElement(name = "lazyDeserialization", parent = "default", description = ""),
@ConfigurationElement(name = "invocationBatching", parent = "default", description = ""),
@@ -457,7 +456,8 @@
@ConfigurationAttribute(name = "transactionManagerLookupClass",
containingElement = "transaction",
- description = "")
+ description = "",
+ defaultValue="org.infinispan.transaction.lookup.GenericTransactionManagerLookup")
public void setTransactionManagerLookupClass(String transactionManagerLookupClass) {
testImmutability("transactionManagerLookupClass");
this.transactionManagerLookupClass = transactionManagerLookupClass;
Modified: trunk/core/src/main/java/org/infinispan/config/parsing/AutomatedXmlConfigurationParserImpl.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/config/parsing/AutomatedXmlConfigurationParserImpl.java 2009-07-09 12:33:07 UTC (rev 537)
+++ trunk/core/src/main/java/org/infinispan/config/parsing/AutomatedXmlConfigurationParserImpl.java 2009-07-09 13:03:27 UTC (rev 538)
@@ -298,15 +298,21 @@
boolean isConfigBean = AbstractConfigurationBean.class.isAssignableFrom(parameterType);
if (matchedAttributeToSetter) {
String attValue = getAttributeValue(node, a.name());
- if (attValue != null && attValue.length() > 0) {
+ Object methodAttributeValue = null;
+ if (attValue != null && attValue.length() > 0) {
PropertyEditor editor = PropertyEditorManager.findEditor(parameterType);
if (editor == null) {
throw new ConfigurationException("Could not find property editor, type="
+ parameterType + ",method=" + m + ",attribute=" + a.name());
}
editor.setAsText(attValue);
- try {
- m.invoke(bean, editor.getValue());
+ methodAttributeValue = editor.getValue();
+ } else if (a.defaultValue().length() > 0) {
+ methodAttributeValue = a.defaultValue();
+ }
+ if (methodAttributeValue != null) {
+ try {
+ m.invoke(bean, methodAttributeValue);
} catch (Exception ae) {
throw new ConfigurationException("Illegal attribute value " + attValue + ",type="
+ parameterType + ",method=" + m + ",attribute=" + a.name(), ae);
Deleted: trunk/core/src/main/java/org/infinispan/config/parsing/TransactionConfigReader.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/config/parsing/TransactionConfigReader.java 2009-07-09 12:33:07 UTC (rev 537)
+++ trunk/core/src/main/java/org/infinispan/config/parsing/TransactionConfigReader.java 2009-07-09 13:03:27 UTC (rev 538)
@@ -1,55 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.infinispan.config.parsing;
-
-import org.infinispan.config.AbstractConfigurationBean;
-import org.infinispan.config.Configuration;
-import org.infinispan.transaction.lookup.GenericTransactionManagerLookup;
-import org.w3c.dom.Element;
-
-public class TransactionConfigReader implements ConfigurationElementReader {
-
- private AutomatedXmlConfigurationParserImpl parser;
-
- public TransactionConfigReader() {
- super();
- }
-
- public void setParser(AutomatedXmlConfigurationParserImpl parser) {
- this.parser = parser;
- }
-
- public void process(Element e, AbstractConfigurationBean bean) {
- if (e == null)
- return; // we might not have this configured
-
- Configuration config = (Configuration) bean;
- String tmp = parser.getAttributeValue(e, "transactionManagerLookupClass");
- if (parser.existsAttribute(tmp)) {
- config.setTransactionManagerLookupClass(tmp);
- } else {
- // use defaults since the transaction element is still present!
- config.setTransactionManagerLookupClass(GenericTransactionManagerLookup.class.getName());
- }
- parser.visitElementWithNoCustomReader(e, config);
- }
-}
More information about the infinispan-commits
mailing list