/*
 * Copyright 2016-2018 shardingsphere.io.
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * </p>
 */

package io.shardingsphere.core.property;

import io.shardingsphere.core.constant.DatabaseType;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;

import javax.sql.DataSource;

/**
 * Data source property factory.
 *
 * @author panjuan
 */
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class DataSourcePropertyFactory {
    
    /**
     * Create data source property parser.
     *
     * @param databaseType data base type.
     * @return data source property parser.
     */
    public static DataSourcePropertyParser createDataSourcePropertyParser(final DatabaseType databaseType) {
        return new DataSourcePropertyParser() {
            @Override
            public DataSourceProperty parseDataSource(final DataSource dataSource) {
                return new DataSourceProperty("", 3306, "", databaseType);
            }
        };
    }
}

@@ -708,16 +708,413 @@
 seType;%0A
+import io.shardingsphere.core.property.dialect.H2DataSourcePropertyParser;%0Aimport io.shardingsphere.core.property.dialect.MySQLDataSourcePropertyParser;%0Aimport io.shardingsphere.core.property.dialect.OracleDataSourcePropertyParser;%0Aimport io.shardingsphere.core.property.dialect.PostgreSQLDataSourcePropertyParser;%0Aimport io.shardingsphere.core.property.dialect.SQLServerDataSourcePropertyParser;%0A
 import l
@@ -1132,16 +1132,16 @@
 sLevel;%0A
-
 import l
@@ -1170,38 +1170,8 @@
 r;%0A%0A
-import javax.sql.DataSource;%0A%0A
 /**%0A
@@ -1588,24 +1588,85 @@
 baseType) %7B%0A
+        switch (databaseType) %7B%0A            case H2:%0A        
         retu
@@ -1664,32 +1664,34 @@
      return new 
+H2
 DataSourceProper
@@ -1700,18 +1700,17 @@
 Parser()
- %7B
+;
 %0A       
@@ -1718,17 +1718,19 @@
     
-@Override
+case MySQL:
 %0A   
@@ -1738,23 +1738,36 @@
         
-public 
+    return new MySQL
 DataSour
@@ -1780,55 +1780,225 @@
 erty
- p
+P
 arse
-DataSource(final DataSource dataSource) %7B
+r();%0A            case Oracle:%0A                return new OracleDataSourcePropertyParser();%0A            case PostgreSQL:%0A                return new PostgreSQLDataSourcePropertyParser();%0A            case SQLServer:
 %0A   
@@ -2021,16 +2021,25 @@
 urn new 
+SQLServer
 DataSour
@@ -2052,20 +2052,139 @@
 erty
-(%22%22, 3306, %22
+Parser();%0A            default:%0A                throw new UnsupportedOperationException(String.format(%22Cannot support database %5B%25s%5D.
 %22, d
@@ -2195,16 +2195,17 @@
 aseType)
+)
 ;%0A      
@@ -2210,24 +2210,9 @@
     
- 
-   %7D%0A        %7D;
+%7D
 %0A   

MODIFY DataSourcePropertyFactory.