Package com.taobao.tddl.jdbc.group.exception

Examples of com.taobao.tddl.jdbc.group.exception.ConfigException


  /**
   * ������ͨ��DataSource�����дDBSelector
   */
  public void init(List<DataSourceWrapper> dataSourceWrappers) {
    if ((dataSourceWrappers == null) || dataSourceWrappers.size() < 1) {
      throw new ConfigException("dataSourceWrappers����Ϊnull�ҳ���Ҫ����0");
    }
    createTAtomDataSource = false;
    // update(createDBSelectors2(dataSourceWrappers));
    resetByDataSourceWrapper(dataSourceWrappers);
  }
View Full Code Here


                .trim().toLowerCase());
            if (tempSqlDsIndexMap.get(nomalSql) == null) {
              tempSqlDsIndexMap.put(nomalSql,index);
            } else {
              // have a nice log
              throw new ConfigException(
                  "sql can not be route to different dataSourceIndex:"
                      + sql);
            }
          }
        }
        this.groupExtraConfig.setSqlDsIndexMap(tempSqlDsIndexMap);
      }
      else {
        this.groupExtraConfig.getSqlDsIndexMap().clear();
      }

      if (obj.has("tabDsIndex")) {
        Map<String, Integer> tempTabDsIndexMap = new HashMap<String, Integer>();
        JSONObject sqlDsIndex = obj.getJSONObject("tabDsIndex");
        Iterator it=sqlDsIndex.keys();
        while(it.hasNext()){
          String key=String.valueOf(it.next()).trim();
          Integer index=Integer.valueOf(key);
          JSONArray array=sqlDsIndex.getJSONArray(key);
          for (int i=0;i<array.size();i++) {
            String table=array.getString(i);
            String nomalTable = table.trim().toLowerCase();
            if (tempTabDsIndexMap.get(nomalTable) == null) {
              tempTabDsIndexMap.put(nomalTable, index);
            } else {
              // have a nice log
              throw new ConfigException(
                  "table can not be route to different dataSourceIndex:"
                      + table);
            }
          }
        }
        this.groupExtraConfig.setTableDsIndexMap(tempTabDsIndexMap);
      }
      else {
        this.groupExtraConfig.getTableDsIndexMap().clear();
      }

      if (obj.has("defaultMain")) {
        this.groupExtraConfig.setDefaultMain(obj.getBoolean("defaultMain"));
      }
      else {
        this.groupExtraConfig.setDefaultMain(false);
      }

    } catch (JSONException e) {
      throw new ConfigException(
          "group extraConfig is not json valid string:" + extraConfig,
          e);
    }
  }
View Full Code Here

      String dsWeightCommaStr) {
    logger.info("[parse2DataSourceWrapperList]dsWeightCommaStr="
        + dsWeightCommaStr);
    if ((dsWeightCommaStr == null)
        || (dsWeightCommaStr = dsWeightCommaStr.trim()).length() == 0) {
      throw new ConfigException("��dbGroupKey:'"
          + tGroupDataSource.getFullDbGroupKey()
          + "'��Ӧ��������Ϣ����Ϊnull�ҳ���Ҫ����0");
    }
    return buildDataSourceWrapper(dsWeightCommaStr,
        new MyDataSourceFetcher());
View Full Code Here

TOP

Related Classes of com.taobao.tddl.jdbc.group.exception.ConfigException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.