[jboss-cvs] JBossAS SVN: r112160 - in projects/jboss-jca/branches/Branch_1_0/common/src/main/java/org/jboss/jca/common: metadata and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Aug 30 06:41:20 EDT 2011


Author: maeste
Date: 2011-08-30 06:41:20 -0400 (Tue, 30 Aug 2011)
New Revision: 112160

Added:
   projects/jboss-jca/branches/Branch_1_0/common/src/main/java/org/jboss/jca/common/api/metadata/Defaults.java
Modified:
   projects/jboss-jca/branches/Branch_1_0/common/src/main/java/org/jboss/jca/common/metadata/AbstractParser.java
   projects/jboss-jca/branches/Branch_1_0/common/src/main/java/org/jboss/jca/common/metadata/ds/DsParser.java
Log:
Adding Defaults and its use in parsers

Added: projects/jboss-jca/branches/Branch_1_0/common/src/main/java/org/jboss/jca/common/api/metadata/Defaults.java
===================================================================
--- projects/jboss-jca/branches/Branch_1_0/common/src/main/java/org/jboss/jca/common/api/metadata/Defaults.java	                        (rev 0)
+++ projects/jboss-jca/branches/Branch_1_0/common/src/main/java/org/jboss/jca/common/api/metadata/Defaults.java	2011-08-30 10:41:20 UTC (rev 112160)
@@ -0,0 +1,159 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat, Inc., 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.jca.common.api.metadata;
+
+import org.jboss.jca.common.api.metadata.common.FlushStrategy;
+import org.jboss.jca.common.api.metadata.ds.Statement;
+
+/**
+ * Default values for the JCA metadata
+ *
+ * @author <a href="jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public interface Defaults {
+
+    //DATASOURCE
+
+    /**
+     * Use Java context
+     */
+    public static final Boolean USE_JAVA_CONTEXT = Boolean.FALSE;
+
+    /**
+     * Use Java context
+    */
+    public static final Boolean ENABLED = Boolean.TRUE;
+
+    /**
+     * SPY
+     */
+    public static final Boolean SPY = Boolean.FALSE;
+
+    /**
+     * Use ccm
+     */
+    public static final Boolean USE_CCM = Boolean.TRUE;
+
+    /**
+     * JTA
+     */
+    public static final boolean JTA = Boolean.TRUE;
+
+
+
+    // POOL
+
+    /**
+     * Min pool size
+     */
+    public static final Integer MIN_POOL_SIZE = Integer.valueOf(0);
+
+    /**
+     * Max pool size
+     */
+    public static final Integer MAX_POOL_SIZE = Integer.valueOf(20);
+
+    /**
+     * Prefill
+     */
+    public static final Boolean PREFILL = Boolean.FALSE;
+
+    /**
+     * Use strict min
+     */
+    public static final Boolean USE_STRICT_MIN = Boolean.FALSE;
+
+    /**
+     * Flush strategy
+     */
+    public static final FlushStrategy FLUSH_STRATEGY = FlushStrategy.FAILING_CONNECTION_ONLY;
+
+    /**
+     * Interleaving
+     */
+    public static final Boolean INTERLEAVING = Boolean.FALSE;
+
+    /**
+     * Is same rm override
+     */
+    public static final Boolean IS_SAME_RM_OVERRIDE = Boolean.FALSE;
+
+    /**
+     * Pad Xid
+     */
+    public static final Boolean PAD_XID = Boolean.FALSE;
+
+    /**
+     * No tx separate pool
+     */
+    public static final Boolean NO_TX_SEPARATE_POOL = Boolean.FALSE;
+
+    /**
+     * Wrap XAResource
+     */
+    public static final Boolean WRAP_XA_RESOURCE = Boolean.TRUE;
+
+    //Statement
+
+    /**
+     * share prepared statement
+     */
+    public static final Boolean SHARE_PREPARED_STATEMENTS = Boolean.FALSE;
+
+    /**
+     * Track statements
+     */
+    public static final Statement.TrackStatementsEnum TRACK_STATEMENTS = Statement.TrackStatementsEnum.NOWARN;
+
+
+    //timeout
+
+    /**
+     * SET TX QUERY TIMEOUT
+     */
+    public static  final  Boolean SET_TX_QUERY_TIMEOUT = Boolean.FALSE;
+
+    //Validation
+
+    /**
+     * Background validation
+     */
+    public static final Boolean BACKGROUND_VALIDATION = Boolean.FALSE ;
+    /**
+     * Use fast fail
+     */
+    public static final Boolean USE_FAST_FAIl = Boolean.FALSE ;
+
+    /**
+     * Validate on match
+     */
+    public static final Boolean VALIDATE_ON_MATCH = Boolean.FALSE ;
+
+    //Security
+
+    /**
+     * application managed security
+     */
+    public static final Boolean APPLICATION_MANAGED_SECURITY = Boolean.FALSE;
+
+}

Modified: projects/jboss-jca/branches/Branch_1_0/common/src/main/java/org/jboss/jca/common/metadata/AbstractParser.java
===================================================================
--- projects/jboss-jca/branches/Branch_1_0/common/src/main/java/org/jboss/jca/common/metadata/AbstractParser.java	2011-08-30 06:14:28 UTC (rev 112159)
+++ projects/jboss-jca/branches/Branch_1_0/common/src/main/java/org/jboss/jca/common/metadata/AbstractParser.java	2011-08-30 10:41:20 UTC (rev 112160)
@@ -23,6 +23,7 @@
 
 import org.jboss.jca.common.CommonBundle;
 import org.jboss.jca.common.CommonLogger;
+import org.jboss.jca.common.api.metadata.Defaults;
 import org.jboss.jca.common.api.metadata.common.CommonPool;
 import org.jboss.jca.common.api.metadata.common.CommonSecurity;
 import org.jboss.jca.common.api.metadata.common.CommonXaPool;
@@ -276,9 +277,9 @@
    {
       Integer minPoolSize = null;
       Integer maxPoolSize = null;
-      Boolean prefill = Boolean.FALSE;
-      Boolean useStrictMin = Boolean.FALSE;
-      FlushStrategy flushStrategy = FlushStrategy.FAILING_CONNECTION_ONLY;
+      Boolean prefill = Defaults.PREFILL;
+      Boolean useStrictMin = Defaults.USE_STRICT_MIN;
+      FlushStrategy flushStrategy = Defaults.FLUSH_STRATEGY;
 
       while (reader.hasNext())
       {
@@ -350,7 +351,7 @@
 
       String securityDomain = null;
       String securityDomainAndApplication = null;
-      boolean application = false;
+      boolean application = Defaults.APPLICATION_MANAGED_SECURITY;
 
       while (reader.hasNext())
       {
@@ -411,16 +412,16 @@
    protected CommonXaPool parseXaPool(XMLStreamReader reader) throws XMLStreamException, ParserException,
       ValidateException
    {
-      Integer minPoolSize = null;
-      Integer maxPoolSize = null;
-      Boolean prefill = Boolean.FALSE;
-      FlushStrategy flushStrategy = FlushStrategy.FAILING_CONNECTION_ONLY;
-      Boolean interleaving = Boolean.FALSE;
-      Boolean isSameRmOverride = Boolean.FALSE;
-      Boolean padXid = Boolean.FALSE;
-      Boolean noTxSeparatePool = Boolean.FALSE;
-      Boolean wrapXaDataSource = Boolean.TRUE;
-      Boolean useStrictMin = Boolean.FALSE;
+      Integer minPoolSize = Defaults.MIN_POOL_SIZE;
+      Integer maxPoolSize = Defaults.MAX_POOL_SIZE;
+      Boolean prefill = Defaults.PREFILL;
+      FlushStrategy flushStrategy = Defaults.FLUSH_STRATEGY;
+      Boolean interleaving = Defaults.INTERLEAVING;
+      Boolean isSameRmOverride = Defaults.IS_SAME_RM_OVERRIDE;
+      Boolean padXid = Defaults.PAD_XID;
+      Boolean noTxSeparatePool = Defaults.NO_TX_SEPARATE_POOL;
+      Boolean wrapXaDataSource = Defaults.WRAP_XA_RESOURCE;
+      Boolean useStrictMin = Defaults.USE_STRICT_MIN;
 
       while (reader.hasNext())
       {

Modified: projects/jboss-jca/branches/Branch_1_0/common/src/main/java/org/jboss/jca/common/metadata/ds/DsParser.java
===================================================================
--- projects/jboss-jca/branches/Branch_1_0/common/src/main/java/org/jboss/jca/common/metadata/ds/DsParser.java	2011-08-30 06:14:28 UTC (rev 112159)
+++ projects/jboss-jca/branches/Branch_1_0/common/src/main/java/org/jboss/jca/common/metadata/ds/DsParser.java	2011-08-30 10:41:20 UTC (rev 112160)
@@ -22,6 +22,7 @@
 package org.jboss.jca.common.metadata.ds;
 
 import org.jboss.jca.common.CommonBundle;
+import org.jboss.jca.common.api.metadata.Defaults;
 import org.jboss.jca.common.api.metadata.common.CommonPool;
 import org.jboss.jca.common.api.metadata.common.CommonXaPool;
 import org.jboss.jca.common.api.metadata.common.Extension;
@@ -237,7 +238,7 @@
                if (DataSources.Tag.forName(reader.getLocalName()) == DataSources.Tag.DRIVER)
                {
 
-                  return new DriverImpl(name, majorVersion, minorVersion, module, 
+                  return new DriverImpl(name, majorVersion, minorVersion, module,
                                         driverClass, dataSourceClass, xaDataSourceClass);
                }
                else
@@ -294,12 +295,12 @@
 
       //attributes reading
 
-      Boolean useJavaContext = Boolean.TRUE;
+      Boolean useJavaContext = Defaults.USE_JAVA_CONTEXT;
       String poolName = null;
-      Boolean enabled = Boolean.TRUE;
+      Boolean enabled = Defaults.ENABLED;
       String jndiName = null;
-      Boolean spy = Boolean.FALSE;
-      Boolean useCcm = Boolean.TRUE;
+      Boolean spy = Defaults.SPY;
+      Boolean useCcm = Defaults.USE_CCM;
 
       for (XaDataSource.Attribute attribute : XaDataSource.Attribute.values())
       {
@@ -500,13 +501,13 @@
       CommonPool pool = null;
 
       //attributes reading
-      Boolean useJavaContext = Boolean.TRUE;
+      Boolean useJavaContext = Defaults.USE_JAVA_CONTEXT;
       String poolName = null;
-      Boolean enabled = Boolean.TRUE;
+      Boolean enabled = Defaults.ENABLED;
       String jndiName = null;
-      Boolean spy = Boolean.FALSE;
-      Boolean useCcm = Boolean.TRUE;
-      Boolean jta = Boolean.TRUE;
+      Boolean spy = Defaults.SPY;
+      Boolean useCcm = Defaults.USE_CCM;
+      Boolean jta = Defaults.JTA;
 
       for (DataSource.Attribute attribute : DataSource.Attribute.values())
       {
@@ -641,11 +642,11 @@
    private Validation parseValidationSetting(XMLStreamReader reader) throws XMLStreamException, ParserException,
       ValidateException
    {
-      Boolean validateOnMatch = Boolean.FALSE;
-      Boolean useFastFail = Boolean.FALSE;
+      Boolean validateOnMatch = Defaults.VALIDATE_ON_MATCH;
+      Boolean useFastFail = Defaults.USE_CCM;
       Long backgroundValidationMillis = null;
       Extension staleConnectionChecker = null;
-      Boolean backgroundValidation = Boolean.FALSE;
+      Boolean backgroundValidation = Defaults.BACKGROUND_VALIDATION;
       String checkValidConnectionSql = null;
       Extension validConnectionChecker = null;
       Extension exceptionSorter = null;
@@ -737,7 +738,7 @@
 
       Long blockingTimeoutMillis = null;
       Long idleTimeoutMinutes = null;
-      Boolean setTxQuertTimeout = Boolean.FALSE;
+      Boolean setTxQuertTimeout = Defaults.SET_TX_QUERY_TIMEOUT;
       Long queryTimeout = null;
       Integer allocationRetry = null;
       Long allocationRetryWaitMillis = null;
@@ -815,7 +816,7 @@
    {
 
       Long preparedStatementsCacheSize = null;
-      Boolean sharePreparedStatements = Boolean.FALSE;
+      Boolean sharePreparedStatements = Defaults.SHARE_PREPARED_STATEMENTS;
       TrackStatementsEnum trackStatements = null;
 
       while (reader.hasNext())



More information about the jboss-cvs-commits mailing list