[jboss-cvs] JBossAS SVN: r111301 - branches/JBPAPP_5_1_0_Final_JBPAPP-5820/connector/src/main/org/jboss/resource/metadata/mcf.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu May 5 08:20:44 EDT 2011
Author: raggz
Date: 2011-05-05 08:20:43 -0400 (Thu, 05 May 2011)
New Revision: 111301
Added:
branches/JBPAPP_5_1_0_Final_JBPAPP-5820/connector/src/main/org/jboss/resource/metadata/mcf/AbstractSystemPropertyXmlJavaTypeAdapter.java
branches/JBPAPP_5_1_0_Final_JBPAPP-5820/connector/src/main/org/jboss/resource/metadata/mcf/BooleanSystemPropertyXmlJavaTypeAdapter.java
branches/JBPAPP_5_1_0_Final_JBPAPP-5820/connector/src/main/org/jboss/resource/metadata/mcf/IntegerSystemPropertyXmlJavaTypeAdapter.java
branches/JBPAPP_5_1_0_Final_JBPAPP-5820/connector/src/main/org/jboss/resource/metadata/mcf/LongSystemPropertyXmlJavaTypeAdapter.java
Modified:
branches/JBPAPP_5_1_0_Final_JBPAPP-5820/connector/src/main/org/jboss/resource/metadata/mcf/DataSourceDeploymentMetaData.java
branches/JBPAPP_5_1_0_Final_JBPAPP-5820/connector/src/main/org/jboss/resource/metadata/mcf/ManagedConnectionFactoryDeploymentMetaData.java
branches/JBPAPP_5_1_0_Final_JBPAPP-5820/connector/src/main/org/jboss/resource/metadata/mcf/TxConnectionFactoryDeploymentMetaData.java
branches/JBPAPP_5_1_0_Final_JBPAPP-5820/connector/src/main/org/jboss/resource/metadata/mcf/XADataSourceDeploymentMetaData.java
Log:
JBPAPP-6465 back port of JBAS-8344 and JBPAPP-4539.
Copied: branches/JBPAPP_5_1_0_Final_JBPAPP-5820/connector/src/main/org/jboss/resource/metadata/mcf/AbstractSystemPropertyXmlJavaTypeAdapter.java (from rev 109885, branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/metadata/mcf/AbstractSystemPropertyXmlJavaTypeAdapter.java)
===================================================================
--- branches/JBPAPP_5_1_0_Final_JBPAPP-5820/connector/src/main/org/jboss/resource/metadata/mcf/AbstractSystemPropertyXmlJavaTypeAdapter.java (rev 0)
+++ branches/JBPAPP_5_1_0_Final_JBPAPP-5820/connector/src/main/org/jboss/resource/metadata/mcf/AbstractSystemPropertyXmlJavaTypeAdapter.java 2011-05-05 12:20:43 UTC (rev 111301)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.jboss.resource.metadata.mcf;
+
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+
+import org.jboss.logging.Logger;
+import org.jboss.util.StringPropertyReplacer;
+
+/**
+ * A AbstractSystemPropertyXmlJavaTypeAdapter.
+ *
+ * @author <a href="jeff.zhang at jboss.org">Jeff Zhang</a>
+ * @version $Revision: $
+ */
+public abstract class AbstractSystemPropertyXmlJavaTypeAdapter<T> extends XmlAdapter<String, T>
+{
+ private static Logger log = Logger.getLogger(AbstractSystemPropertyXmlJavaTypeAdapter.class);
+
+ @Override
+ public String marshal(T v)
+ {
+ return v.toString();
+ }
+
+ @Override
+ public T unmarshal(String v)
+ {
+ if (v == null)
+ return null;
+ v = StringPropertyReplacer.replaceProperties(v);
+ return convertType(v);
+ }
+
+ abstract T convertType(String v);
+}
Copied: branches/JBPAPP_5_1_0_Final_JBPAPP-5820/connector/src/main/org/jboss/resource/metadata/mcf/BooleanSystemPropertyXmlJavaTypeAdapter.java (from rev 110330, branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/metadata/mcf/BooleanSystemPropertyXmlJavaTypeAdapter.java)
===================================================================
--- branches/JBPAPP_5_1_0_Final_JBPAPP-5820/connector/src/main/org/jboss/resource/metadata/mcf/BooleanSystemPropertyXmlJavaTypeAdapter.java (rev 0)
+++ branches/JBPAPP_5_1_0_Final_JBPAPP-5820/connector/src/main/org/jboss/resource/metadata/mcf/BooleanSystemPropertyXmlJavaTypeAdapter.java 2011-05-05 12:20:43 UTC (rev 111301)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.jboss.resource.metadata.mcf;
+
+/**
+ * A BooleanSystemPropertyXmlJavaTypeAdapter.
+ *
+ * @author <a href="jeff.zhang at jboss.org">Jeff Zhang</a>
+ * @version $Revision: $
+ */
+public class BooleanSystemPropertyXmlJavaTypeAdapter extends AbstractSystemPropertyXmlJavaTypeAdapter<Boolean>
+{
+ @Override
+ Boolean convertType(String v)
+ {
+ return Boolean.parseBoolean(v);
+ }
+}
Modified: branches/JBPAPP_5_1_0_Final_JBPAPP-5820/connector/src/main/org/jboss/resource/metadata/mcf/DataSourceDeploymentMetaData.java
===================================================================
--- branches/JBPAPP_5_1_0_Final_JBPAPP-5820/connector/src/main/org/jboss/resource/metadata/mcf/DataSourceDeploymentMetaData.java 2011-05-05 09:47:13 UTC (rev 111300)
+++ branches/JBPAPP_5_1_0_Final_JBPAPP-5820/connector/src/main/org/jboss/resource/metadata/mcf/DataSourceDeploymentMetaData.java 2011-05-05 12:20:43 UTC (rev 111301)
@@ -84,19 +84,24 @@
private String trackStatements;
@XmlElement(name="prepared-statement-cache-size")
- private int preparedStatementCacheSize = 0;
+ @XmlJavaTypeAdapter(IntegerSystemPropertyXmlJavaTypeAdapter.class)
+ private Integer preparedStatementCacheSize = 0;
@XmlElement(name="share-prepared-statements")
- private boolean sharePreparedStatements;
+ @XmlJavaTypeAdapter(BooleanSystemPropertyXmlJavaTypeAdapter.class)
+ private Boolean sharePreparedStatements = Boolean.FALSE;
@XmlElement(name="set-tx-query-timeout")
- private boolean useQueryTimeout;
+ @XmlJavaTypeAdapter(BooleanSystemPropertyXmlJavaTypeAdapter.class)
+ private Boolean useQueryTimeout = Boolean.FALSE;
@XmlElement(name="query-timeout")
- private int queryTimeout;
+ @XmlJavaTypeAdapter(IntegerSystemPropertyXmlJavaTypeAdapter.class)
+ private Integer queryTimeout = 0;
@XmlElement(name="use-try-lock")
- private Integer useTryLock;
+ @XmlJavaTypeAdapter(IntegerSystemPropertyXmlJavaTypeAdapter.class)
+ private Integer useTryLock = 0;
@XmlElement(name="url-delimiter")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
Copied: branches/JBPAPP_5_1_0_Final_JBPAPP-5820/connector/src/main/org/jboss/resource/metadata/mcf/IntegerSystemPropertyXmlJavaTypeAdapter.java (from rev 109885, branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/metadata/mcf/IntegerSystemPropertyXmlJavaTypeAdapter.java)
===================================================================
--- branches/JBPAPP_5_1_0_Final_JBPAPP-5820/connector/src/main/org/jboss/resource/metadata/mcf/IntegerSystemPropertyXmlJavaTypeAdapter.java (rev 0)
+++ branches/JBPAPP_5_1_0_Final_JBPAPP-5820/connector/src/main/org/jboss/resource/metadata/mcf/IntegerSystemPropertyXmlJavaTypeAdapter.java 2011-05-05 12:20:43 UTC (rev 111301)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.jboss.resource.metadata.mcf;
+
+/**
+ * A IntegerSystemPropertyXmlJavaTypeAdapter.
+ *
+ * @author <a href="jeff.zhang at jboss.org">Jeff Zhang</a>
+ * @version $Revision: $
+ */
+public class IntegerSystemPropertyXmlJavaTypeAdapter extends AbstractSystemPropertyXmlJavaTypeAdapter<Integer>
+{
+ @Override
+ Integer convertType(String v)
+ {
+ try
+ {
+ return Integer.parseInt(v);
+ }
+ catch (NumberFormatException e)
+ {
+ return 0;
+ }
+ }
+}
Copied: branches/JBPAPP_5_1_0_Final_JBPAPP-5820/connector/src/main/org/jboss/resource/metadata/mcf/LongSystemPropertyXmlJavaTypeAdapter.java (from rev 109885, branches/JBPAPP_5_1/connector/src/main/org/jboss/resource/metadata/mcf/LongSystemPropertyXmlJavaTypeAdapter.java)
===================================================================
--- branches/JBPAPP_5_1_0_Final_JBPAPP-5820/connector/src/main/org/jboss/resource/metadata/mcf/LongSystemPropertyXmlJavaTypeAdapter.java (rev 0)
+++ branches/JBPAPP_5_1_0_Final_JBPAPP-5820/connector/src/main/org/jboss/resource/metadata/mcf/LongSystemPropertyXmlJavaTypeAdapter.java 2011-05-05 12:20:43 UTC (rev 111301)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.jboss.resource.metadata.mcf;
+
+/**
+ * A LongSystemPropertyXmlJavaTypeAdapter.
+ *
+ * @author <a href="jeff.zhang at jboss.org">Jeff Zhang</a>
+ * @version $Revision: $
+ */
+public class LongSystemPropertyXmlJavaTypeAdapter extends AbstractSystemPropertyXmlJavaTypeAdapter<Long>
+{
+ @Override
+ Long convertType(String v)
+ {
+ try
+ {
+ return Long.parseLong(v);
+ }
+ catch (NumberFormatException e)
+ {
+ return 0L;
+ }
+ }
+}
Modified: branches/JBPAPP_5_1_0_Final_JBPAPP-5820/connector/src/main/org/jboss/resource/metadata/mcf/ManagedConnectionFactoryDeploymentMetaData.java
===================================================================
--- branches/JBPAPP_5_1_0_Final_JBPAPP-5820/connector/src/main/org/jboss/resource/metadata/mcf/ManagedConnectionFactoryDeploymentMetaData.java 2011-05-05 09:47:13 UTC (rev 111300)
+++ branches/JBPAPP_5_1_0_Final_JBPAPP-5820/connector/src/main/org/jboss/resource/metadata/mcf/ManagedConnectionFactoryDeploymentMetaData.java 2011-05-05 12:20:43 UTC (rev 111301)
@@ -44,8 +44,8 @@
import org.jboss.managed.api.annotation.ViewUse;
import org.jboss.resource.deployers.management.ConnectionFactoryProperty;
import org.jboss.system.metadata.ServiceMetaData;
+import org.jboss.util.StringPropertyReplacer;
-
/**
* A ManagedConnectionFactoryDeployment.
*
@@ -74,7 +74,8 @@
/** The useJavaContext */
@XmlElement(name="use-java-context")
- private boolean useJavaContext = true;
+ @XmlJavaTypeAdapter(BooleanSystemPropertyXmlJavaTypeAdapter.class)
+ private Boolean useJavaContext = Boolean.TRUE;
/** The connectionDefinition */
@XmlElement(name="connection-definition")
@@ -87,28 +88,36 @@
private String jmxInvokerName = "jboss:service=invoker,type=jrmp";
@XmlElement(name="min-pool-size")
- private int minSize = 0;
+ @XmlJavaTypeAdapter(IntegerSystemPropertyXmlJavaTypeAdapter.class)
+ private Integer minSize = 0;
@XmlElement(name="max-pool-size")
- private int maxPoolSize = 10;
+ @XmlJavaTypeAdapter(IntegerSystemPropertyXmlJavaTypeAdapter.class)
+ private Integer maxPoolSize = 10;
@XmlElement(name="blocking-timeout-millis")
- private long blockingTimeout = 30000;
+ @XmlJavaTypeAdapter(LongSystemPropertyXmlJavaTypeAdapter.class)
+ private Long blockingTimeout = 30000L;
@XmlElement(name="idle-timeout-minutes")
- private int idleTimeout = 30;
+ @XmlJavaTypeAdapter(IntegerSystemPropertyXmlJavaTypeAdapter.class)
+ private Integer idleTimeout = 30;
@XmlElement(name="prefill")
+ @XmlJavaTypeAdapter(BooleanSystemPropertyXmlJavaTypeAdapter.class)
private Boolean prefill = Boolean.FALSE;
@XmlElement(name="background-validation")
- private boolean backgroundValidation;
+ @XmlJavaTypeAdapter(BooleanSystemPropertyXmlJavaTypeAdapter.class)
+ private Boolean backgroundValidation = Boolean.FALSE;
@XmlElement(name="background-validation-millis")
- private long backgroundValidationMillis;
+ @XmlJavaTypeAdapter(LongSystemPropertyXmlJavaTypeAdapter.class)
+ private Long backgroundValidationMillis = new Long(0L);
@XmlElement(name="validate-on-match")
- private boolean validateOnMatch = true;
+ @XmlJavaTypeAdapter(BooleanSystemPropertyXmlJavaTypeAdapter.class)
+ private Boolean validateOnMatch = Boolean.TRUE;
@XmlJavaTypeAdapter(ManagedConnectionEmptyContentAdapter.class)
@XmlElement(name="use-strict-min")
@@ -123,6 +132,7 @@
private String statisticsFormatter = "org.jboss.resource.statistic.pool.JBossDefaultSubPoolStatisticFormatter";
@XmlElement(name="isSameRM-override-value")
+ @XmlJavaTypeAdapter(BooleanSystemPropertyXmlJavaTypeAdapter.class)
private Boolean isSameRMOverrideValue = Boolean.FALSE;
// is always true now and left here for the xml binding
@@ -136,10 +146,12 @@
private Boolean interleaving;
@XmlElement(name="allocation-retry")
- private int allocationRetry = 0;
+ @XmlJavaTypeAdapter(IntegerSystemPropertyXmlJavaTypeAdapter.class)
+ private Integer allocationRetry = 0;
@XmlElement(name="allocation-retry-wait-millis")
- private long allocationRetryWaitMillis = 5000;
+ @XmlJavaTypeAdapter(LongSystemPropertyXmlJavaTypeAdapter.class)
+ private Long allocationRetryWaitMillis = 5000L;
/** The transactionSupportMetaData */
@XmlTransient
@@ -211,6 +223,10 @@
@ManagementObjectID(type="DataSource")
public String getJndiName()
{
+ if (jndiName.indexOf("${") >= 0 && jndiName.indexOf('}') >=0)
+ {
+ jndiName = StringPropertyReplacer.replaceProperties(jndiName);
+ }
return jndiName;
}
Modified: branches/JBPAPP_5_1_0_Final_JBPAPP-5820/connector/src/main/org/jboss/resource/metadata/mcf/TxConnectionFactoryDeploymentMetaData.java
===================================================================
--- branches/JBPAPP_5_1_0_Final_JBPAPP-5820/connector/src/main/org/jboss/resource/metadata/mcf/TxConnectionFactoryDeploymentMetaData.java 2011-05-05 09:47:13 UTC (rev 111300)
+++ branches/JBPAPP_5_1_0_Final_JBPAPP-5820/connector/src/main/org/jboss/resource/metadata/mcf/TxConnectionFactoryDeploymentMetaData.java 2011-05-05 12:20:43 UTC (rev 111301)
@@ -53,7 +53,8 @@
}
@XmlElement(name="xa-resource-timeout")
- private int xaResourceTimeout;
+ @XmlJavaTypeAdapter(IntegerSystemPropertyXmlJavaTypeAdapter.class)
+ private Integer xaResourceTimeout = 0;
@XmlJavaTypeAdapter(ManagedConnectionEmptyContentAdapter.class)
@XmlElement(name="xa-transaction")
Modified: branches/JBPAPP_5_1_0_Final_JBPAPP-5820/connector/src/main/org/jboss/resource/metadata/mcf/XADataSourceDeploymentMetaData.java
===================================================================
--- branches/JBPAPP_5_1_0_Final_JBPAPP-5820/connector/src/main/org/jboss/resource/metadata/mcf/XADataSourceDeploymentMetaData.java 2011-05-05 09:47:13 UTC (rev 111300)
+++ branches/JBPAPP_5_1_0_Final_JBPAPP-5820/connector/src/main/org/jboss/resource/metadata/mcf/XADataSourceDeploymentMetaData.java 2011-05-05 12:20:43 UTC (rev 111301)
@@ -68,7 +68,8 @@
private String urlProperty;
@XmlElement(name="xa-resource-timeout")
- private int xaResourceTimeout;
+ @XmlJavaTypeAdapter(IntegerSystemPropertyXmlJavaTypeAdapter.class)
+ private Integer xaResourceTimeout = 0;
@XmlElement(name="recover-user-name")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
@@ -79,6 +80,7 @@
private String recoverPassWord;
@XmlElement(name="no-recover")
+ @XmlJavaTypeAdapter(BooleanSystemPropertyXmlJavaTypeAdapter.class)
private Boolean noRecover = Boolean.FALSE;
/** The recoverSecurityMetaData */
More information about the jboss-cvs-commits
mailing list