View Javadoc

1   /*
2    * $Id: DataSourceDefinitionParser.java 22117 2011-06-06 11:09:58Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.transport.jdbc.config;
12  
13  import org.mule.config.spring.parsers.generic.MuleOrphanDefinitionParser;
14  
15  import java.sql.Connection;
16  import java.util.Map;
17  
18  public class DataSourceDefinitionParser extends MuleOrphanDefinitionParser
19  {
20      private static final Map<String, Integer> TRANSACTION_ISOLATION_MAPPING;
21  
22      static
23      {
24          TRANSACTION_ISOLATION_MAPPING = new java.util.HashMap<String, Integer>();
25          TRANSACTION_ISOLATION_MAPPING.put("UNSPECIFIED", Integer.valueOf(-1)); // this is the default in xapool
26          TRANSACTION_ISOLATION_MAPPING.put("NONE", Integer.valueOf(Connection.TRANSACTION_NONE));
27          TRANSACTION_ISOLATION_MAPPING.put("READ_COMMITTED", Integer.valueOf(Connection.TRANSACTION_READ_COMMITTED));
28          TRANSACTION_ISOLATION_MAPPING.put("READ_UNCOMMITTED", Integer.valueOf(Connection.TRANSACTION_READ_UNCOMMITTED));
29          TRANSACTION_ISOLATION_MAPPING.put("REPEATABLE_READ", Integer.valueOf(Connection.TRANSACTION_REPEATABLE_READ));
30          TRANSACTION_ISOLATION_MAPPING.put("SERIALIZABLE", Integer.valueOf(Connection.TRANSACTION_SERIALIZABLE));
31      }
32  
33      public DataSourceDefinitionParser(Class<? extends AbstractDataSourceFactoryBean> poolFactoryClass)
34      {
35          super(poolFactoryClass, true);
36          addIgnored("name");
37          addMapping("transactionIsolation", TRANSACTION_ISOLATION_MAPPING);
38      }
39  }