Package com.exedosoft.plat.bo

Examples of com.exedosoft.plat.bo.DODataSource


    // tenant data datastore url
    String multi_datasource_uid = tenant.getValue("multi_datasource_uid");
    // tenant config datastore url
    String model_datasource_uid = tenant.getValue("model_datasource_uid");

    DODataSource dataDds = dsConfig.get(multi_datasource_uid);
    DODataSource dds = dsConfig.get(model_datasource_uid);

    if (dataDds == null && dds == null) {

      DOService findDataSource = DOService
          .getService("multi_datasource_browse");

      // //data datasource
      BOInstance aBI = findDataSource.getInstance(multi_datasource_uid);
      if (aBI != null) {
        dataDds = (DODataSource) aBI.toObject(DODataSource.class);
        // /现在多租户情况下默认都是mysql
        dataDds.setDialect(DODataSource.DIALECT_MYSQL);
        dsConfig.put(multi_datasource_uid, dataDds);
      }

      // /model datasource
      aBI = findDataSource.getInstance(model_datasource_uid);
      if (aBI != null) {
        dds = (DODataSource) aBI.toObject(DODataSource.class);
        // /现在多租户情况下默认都是mysql
        dds.setDialect(DODataSource.DIALECT_MYSQL);
        dsConfig.put(model_datasource_uid, dds);
      }
    }

    if (dataDds == null || dds == null) {
View Full Code Here


        .getService("multi_datasource_browse");

    // //data datasource
    BOInstance aBI = findDataSource
        .getInstance("402881eb38a231d20138a23b4ab70015");
    DODataSource dataDds = null;
    if (aBI != null) {
      dataDds = (DODataSource) aBI.toObject(DODataSource.class);
      // /现在多租户情况下默认都是mysql
      dataDds.setDialect(DODataSource.DIALECT_MYSQL);
    }

    BOInstance aBI2 = findDataSource
        .getInstance("402881eb38a231d20138a23b4ab70015");
    DODataSource dataDds2 = null;
    if (aBI2 != null) {
      dataDds2 = (DODataSource) aBI2.toObject(DODataSource.class);
      // /现在多租户情况下默认都是mysql
      dataDds2.setDialect(DODataSource.DIALECT_MYSQL);
    }

    System.out.println("equals::::" + dataDds.equals(dataDds2));

    // CacheFactory.getCacheData().fromSerialObject();
View Full Code Here

//    dao.setAutoClose(false);

    // //first gene component!
//    this.geneForms(dao);
   
    DODataSource dss = DODataSource.parseGlobals();
    Transaction t = dss.getTransaction();
   
 

    // ///////////////////second generator grid and panes
    try {
View Full Code Here

   */
  public void contextDestroyed(ServletContextEvent arg0) {

    log.info("contextDestroyed!!!!!");

    DODataSource defaultDs = DODataSource.parseGlobals();

    String sql = "select dds.* from DO_DataSource dds,DO_Application da where dds.applicationUID = da.objuid and da.name = ?";

    try {
      List list = DAOUtil.INSTANCE().select(DODataSource.class, sql,
          DOGlobals.getValue("application"));
      list.add(defaultDs);

      for (Iterator it = list.iterator(); it.hasNext();) {

        DODataSource dss = (DODataSource) it.next();

        // /以DODataSource 为key
        if (DODataSource.pools != null && dss != null) {
          BasicDataSource bds = (BasicDataSource) DODataSource.pools
              .get(dss);
          log.info("关闭数据库连接池::" + dss.getDriverUrl());
          if (bds != null) {
            bds.close();
            log.info("数据库连接池正常关闭!");
          }
        }
View Full Code Here

      }

      if (!"sae".equals(DOGlobals.getValue("cloud.env"))) {

        DODataSource defaultDs = DODataSource.parseGlobals();
        poolASource(defaultDs);

        System.out.println("Application's Name:: "
            + DOGlobals.getValue("application"));

        List<DODataSource> list = DODataSource.getDataSourcesNeedInit();
        // DAOUtil.select(DODataSource.class, sql, DOGlobals
        // .getValue("application"));
        for (Iterator<DODataSource> it = list.iterator(); it.hasNext();) {

          DODataSource dss = (DODataSource) it.next();
          log.info("初始化数据库连接池::" + dss.getDriverUrl());

          if (dss.getDriverUrl().equals(defaultDs.getDriverUrl())) {
            log.info("...和初始化连接池相同,使用初始化连接池::" + dss.getDriverUrl());
            DODataSource.pools.put(dss,
                DODataSource.pools.get(defaultDs));
            continue;
          }
View Full Code Here

  /**
   * @param args
   */
  public static void main(String[] args) {
    // TODO Auto-generated method stub
    DODataSource  dds = DODataSource.getDataSourceByL10n("国土资源部配号系统数据库");
   
    Connection con = null;
    PreparedStatement pstmt = null;
    try {
      con = dds.getContextConnection();
      pstmt = con.prepareStatement("select * from DB_PERAMBULATE_ITEM");
      Statement alertStmt = con.createStatement();


      ResultSet rs = pstmt.executeQuery();
View Full Code Here

      if (user != null) {
        userName = user.getName();
      }
    }

    DODataSource dss = null;
    if ("true".equals(DOGlobals.getValue("multi.tenancy"))) {

      if (DOGlobals.getInstance().getSessoinContext().getTenancyValues() != null) {
        dss = DOGlobals.getInstance().getSessoinContext()
            .getTenancyValues().getDataDDS();
      }else{
        return;
      }
    } else {

      DOBO bo = DOBO.getDOBOByName("do_datasource");
      dss = bo.getDataBase();
    }

    Connection con = dss.getConnection();

    if (con != null) {
      String sql = "insert into do_log_dev(id,threadstr,starttime,username,ip,msgstr) values(?,?,?,?,?,?)";
      try {
        PreparedStatement pstmt = con.prepareStatement(sql);
View Full Code Here

    }
  }

  public static boolean check(String userName, String pwd) {

    DODataSource dss = DODataSource.parseConfigHelper("/ds_ldap_url.xml",
        "ds_ldap_url");
    InitialContext iCnt = null;
    Hashtable envi = new Hashtable();
    try {
      envi.put("java.naming.factory.initial",
          "com.sun.jndi.ldap.LdapCtxFactory");
      envi.put("java.naming.provider.url", dss.getDriverUrl());
      envi.put(Context.SECURITY_AUTHENTICATION, "simple");
      envi.put(Context.SECURITY_PRINCIPAL, "uid=" + userName
          + dss.getUserName());
      envi.put(Context.SECURITY_CREDENTIALS, pwd);
      iCnt = new InitialContext(envi);
      System.out.println("认证通过!");

    } catch (Exception e) {
View Full Code Here

  public Object findTemplateSource(String para) throws IOException {

    Connection conn = null;
    PreparedStatement s = null;
    ResultSet rs = null;
    DODataSource dss = DODataSource.parseGlobals();
    try {
      if (conn == null || conn.isClosed()) {
        conn = dss.getConnection();
      }
      s = conn
          .prepareStatement("select * from DO_BO_ICON where objuid= ?");
      s.setString(1, para);
      rs = s.executeQuery();
View Full Code Here

  public Connection getConnection() {

    if (this.dataSourceUid != null) {

      try {
        DODataSource dds = (DODataSource) DAOUtil.INSTANCE().getByObjUid(
            DODataSource.class, this.dataSourceUid);

        return dds.getConnection();
      } catch (Exception e) {
        e.printStackTrace();
        return null;
      }
    } else {
View Full Code Here

TOP

Related Classes of com.exedosoft.plat.bo.DODataSource

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.