[jboss-cvs] JBossAS SVN: r110324 - branches/JBPAPP_5_1_0_Final_JBPAPP-5758/connector/src/main/org/jboss/resource/metadata/mcf.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Jan 11 10:41:45 EST 2011


Author: raggz
Date: 2011-01-11 10:41:44 -0500 (Tue, 11 Jan 2011)
New Revision: 110324

Added:
   branches/JBPAPP_5_1_0_Final_JBPAPP-5758/connector/src/main/org/jboss/resource/metadata/mcf/AbstractSystemPropertyXmlJavaTypeAdapter.java
   branches/JBPAPP_5_1_0_Final_JBPAPP-5758/connector/src/main/org/jboss/resource/metadata/mcf/IntegerSystemPropertyXmlJavaTypeAdapter.java
   branches/JBPAPP_5_1_0_Final_JBPAPP-5758/connector/src/main/org/jboss/resource/metadata/mcf/LongSystemPropertyXmlJavaTypeAdapter.java
Modified:
   branches/JBPAPP_5_1_0_Final_JBPAPP-5758/connector/src/main/org/jboss/resource/metadata/mcf/DataSourceDeploymentMetaData.java
   branches/JBPAPP_5_1_0_Final_JBPAPP-5758/connector/src/main/org/jboss/resource/metadata/mcf/ManagedConnectionFactoryDeploymentMetaData.java
   branches/JBPAPP_5_1_0_Final_JBPAPP-5758/connector/src/main/org/jboss/resource/metadata/mcf/TxConnectionFactoryDeploymentMetaData.java
   branches/JBPAPP_5_1_0_Final_JBPAPP-5758/connector/src/main/org/jboss/resource/metadata/mcf/XADataSourceDeploymentMetaData.java
Log:
JBPAPP-5758

Copied: branches/JBPAPP_5_1_0_Final_JBPAPP-5758/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-5758/connector/src/main/org/jboss/resource/metadata/mcf/AbstractSystemPropertyXmlJavaTypeAdapter.java	                        (rev 0)
+++ branches/JBPAPP_5_1_0_Final_JBPAPP-5758/connector/src/main/org/jboss/resource/metadata/mcf/AbstractSystemPropertyXmlJavaTypeAdapter.java	2011-01-11 15:41:44 UTC (rev 110324)
@@ -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);
+}

Modified: branches/JBPAPP_5_1_0_Final_JBPAPP-5758/connector/src/main/org/jboss/resource/metadata/mcf/DataSourceDeploymentMetaData.java
===================================================================
--- branches/JBPAPP_5_1_0_Final_JBPAPP-5758/connector/src/main/org/jboss/resource/metadata/mcf/DataSourceDeploymentMetaData.java	2011-01-11 14:56:45 UTC (rev 110323)
+++ branches/JBPAPP_5_1_0_Final_JBPAPP-5758/connector/src/main/org/jboss/resource/metadata/mcf/DataSourceDeploymentMetaData.java	2011-01-11 15:41:44 UTC (rev 110324)
@@ -84,7 +84,8 @@
    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;
@@ -93,10 +94,12 @@
    private boolean useQueryTimeout;
    
    @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-5758/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-5758/connector/src/main/org/jboss/resource/metadata/mcf/IntegerSystemPropertyXmlJavaTypeAdapter.java	                        (rev 0)
+++ branches/JBPAPP_5_1_0_Final_JBPAPP-5758/connector/src/main/org/jboss/resource/metadata/mcf/IntegerSystemPropertyXmlJavaTypeAdapter.java	2011-01-11 15:41:44 UTC (rev 110324)
@@ -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-5758/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-5758/connector/src/main/org/jboss/resource/metadata/mcf/LongSystemPropertyXmlJavaTypeAdapter.java	                        (rev 0)
+++ branches/JBPAPP_5_1_0_Final_JBPAPP-5758/connector/src/main/org/jboss/resource/metadata/mcf/LongSystemPropertyXmlJavaTypeAdapter.java	2011-01-11 15:41:44 UTC (rev 110324)
@@ -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-5758/connector/src/main/org/jboss/resource/metadata/mcf/ManagedConnectionFactoryDeploymentMetaData.java
===================================================================
--- branches/JBPAPP_5_1_0_Final_JBPAPP-5758/connector/src/main/org/jboss/resource/metadata/mcf/ManagedConnectionFactoryDeploymentMetaData.java	2011-01-11 14:56:45 UTC (rev 110323)
+++ branches/JBPAPP_5_1_0_Final_JBPAPP-5758/connector/src/main/org/jboss/resource/metadata/mcf/ManagedConnectionFactoryDeploymentMetaData.java	2011-01-11 15:41:44 UTC (rev 110324)
@@ -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.
  * 
@@ -87,16 +87,20 @@
    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")
    private Boolean prefill = Boolean.FALSE;
@@ -105,7 +109,8 @@
    private boolean backgroundValidation;
    
    @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;
@@ -136,10 +141,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 +218,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-5758/connector/src/main/org/jboss/resource/metadata/mcf/TxConnectionFactoryDeploymentMetaData.java
===================================================================
--- branches/JBPAPP_5_1_0_Final_JBPAPP-5758/connector/src/main/org/jboss/resource/metadata/mcf/TxConnectionFactoryDeploymentMetaData.java	2011-01-11 14:56:45 UTC (rev 110323)
+++ branches/JBPAPP_5_1_0_Final_JBPAPP-5758/connector/src/main/org/jboss/resource/metadata/mcf/TxConnectionFactoryDeploymentMetaData.java	2011-01-11 15:41:44 UTC (rev 110324)
@@ -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-5758/connector/src/main/org/jboss/resource/metadata/mcf/XADataSourceDeploymentMetaData.java
===================================================================
--- branches/JBPAPP_5_1_0_Final_JBPAPP-5758/connector/src/main/org/jboss/resource/metadata/mcf/XADataSourceDeploymentMetaData.java	2011-01-11 14:56:45 UTC (rev 110323)
+++ branches/JBPAPP_5_1_0_Final_JBPAPP-5758/connector/src/main/org/jboss/resource/metadata/mcf/XADataSourceDeploymentMetaData.java	2011-01-11 15:41:44 UTC (rev 110324)
@@ -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)



More information about the jboss-cvs-commits mailing list