Package com.dp.nebula.wormhole.common

Examples of com.dp.nebula.wormhole.common.WormholeException


      }
      lineSender.flush();

    } catch (Exception e) {
      LOG.error(e.getCause());
      throw new WormholeException(e,
          JobStatus.READ_DATA_EXCEPTION.getStatus());
    } finally {
      if (itr != null) {
        itr.close();
      }
View Full Code Here


    DBResultSetSender proxy = DBResultSetSender.newSender(lineSender);
    proxy.setMonitor(getMonitor());
    proxy.setDateFormatMap(genDateFormatMap());
    if(sql.isEmpty()){
      logger.error("Sql for SqlserverReader is empty.");
      throw new WormholeException("Sql for SqlserverReader is empty.",JobStatus.READ_FAILED.getStatus()+ERROR_CODE_ADD);
    }
    logger.debug(String.format("SqlserverReader start to query %s .", sql));
    for(String sqlItem:sql.split(";")){
      sqlItem = sqlItem.trim();
      if(sqlItem.isEmpty()) {
        continue;
      }
      logger.debug(sqlItem);
      ResultSet rs = null;
      try {
        rs = DBUtils.query(conn, sqlItem);
        proxy.sendToWriter(rs);
        proxy.flush();
      } catch (SQLException e) {
        logger.error(e.getMessage());
        throw new WormholeException(e,JobStatus.READ_FAILED.getStatus()+ERROR_CODE_ADD);
      } catch (WormholeException e1) {
        e1.setStatusCode(e1.getStatusCode() + ERROR_CODE_ADD);
        throw e1;
      } finally {
        if (null != rs) {
            try {
            DBUtils.closeResultSet(rs);
          } catch (SQLException e) {
            logger.error("SqlserverReader close resultset error ");
            throw new WormholeException(e,JobStatus.READ_FAILED.getStatus()+ERROR_CODE_ADD)
          }
              }
      }
    }
  }
View Full Code Here

  private void readFromHiveServer(ILineSender lineSender) {
    try {
      client.processSelectQuery(lineSender, getMonitor());
    } catch (SQLException e) {
      throw new WormholeException(e,
          JobStatus.READ_DATA_EXCEPTION.getStatus());
    }
  }
View Full Code Here

    if (encryptionKeyFile != null && encryptionKeyFile.length() != 0) {
      try {
        encrypter.setCipherKeyFromFilePath(encryptionKeyFile);
      } catch (IOException e) {
        LOG.error(e);
        throw new WormholeException(
            "Error initialize encrypter with encryptionKeyFile",
            JobStatus.CONF_FAILED.getStatus());
      }
    }
  }
View Full Code Here

        } else if (startDate == null || endDate == null) {
          try{
            startInt = Integer.parseInt(items[0]);
            endInt = Integer.parseInt(items[1]);
          } catch (Exception e) {
            throw new WormholeException(e,JobStatus.READ_FAILED.getStatus()+errorCodeAdd)
          }
          while (startInt <= endInt) {
            result.add(String.valueOf(startInt));
            startInt ++;
          }
          continue;
        }  
      }
      logger.error("Greenplum partition value format error.");
      throw new WormholeException("Greenplum partition value format error.",JobStatus.READ_FAILED.getStatus()+errorCodeAdd)
    }
    return result;
  }
View Full Code Here

          }
        }
        LOG.info(sb.toString());

      } catch (Exception e) {
        throw new WormholeException(e.getMessage(),
            JobStatus.READ_CONNECTION_FAILED.getStatus());
      }
    }

  }
View Full Code Here

          qr = conn.queryMore(qr.getQueryLocator());
        }
      }
      lineSender.flush();
    } catch (ConnectionException e) {
      throw new WormholeException("Error Query extractionSOQL",
          JobStatus.READ_CONNECTION_FAILED.getStatus());
    }

  }
View Full Code Here

    config.setServiceEndpoint(END_POINT);
    try {
      conn = Connector.newConnection(config);
      LoginResult loginResult = conn.login(username, password);
      if (loginResult.getPasswordExpired()) {
        throw new WormholeException("Error Expired Password",
            JobStatus.CONF_FAILED.getStatus());
      }
      conn.setSessionHeader(loginResult.getSessionId());
    } catch (ConnectionException e) {
      LOG.error("Error Login " + e.getMessage());
      throw new WormholeException("Error Login " + e.getMessage(),
          JobStatus.CONF_FAILED.getStatus());
    }
    return true;
  }
View Full Code Here

  private String decryptPassword(String password) {
    if (password != null && password.length() > 0) {
      try {
        return encrypter.decryptString(password);
      } catch (Exception ex) {
        throw new WormholeException("Error decrypt password" + ex.getMessage(),
            JobStatus.CONF_FAILED.getStatus());
      }
    }
    return password;
  }
View Full Code Here

    conf = HBaseConfiguration.create();
    try {
      admin = new HBaseAdmin(conf);
      checkStatus(tableName);
    } catch (IOException e) {
      throw new WormholeException(e,
          JobStatus.PRE_CHECK_FAILED.getStatus());
    }
    this.autoFlush = autoFlush;
    this.writeBufferSize = writeBufferSize;
    this.writeAheadLog = writeAheadLog;
View Full Code Here

TOP

Related Classes of com.dp.nebula.wormhole.common.WormholeException

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.