Package org.apache.stratos.adc.mgt.dao

Examples of org.apache.stratos.adc.mgt.dao.RepositoryCredentials


      throws Exception {

    Connection con = null;
    PreparedStatement statement = null;
    ResultSet resultSet = null;
    RepositoryCredentials repoCredentials = null;

    try {
      con = StratosDBUtils.getConnection();
      String sql = "SELECT REPO_NAME,REPO_USER_NAME,REPO_USER_PASSWORD FROM REPOSITORY R, CARTRIDGE_SUBSCRIPTION C "
          + "WHERE C.REPO_ID=R.REPO_ID AND C.TENANT_ID=? AND C.CARTRIDGE=? AND C.STATE != 'UNSUBSCRIBED' ";
      if (alias != null) {
        sql = sql + " AND C.ALIAS=?";
      }
      statement = con.prepareStatement(sql);
      statement.setInt(1, tenantId);
      statement.setString(2, cartridge);
      if (alias != null) {
        statement.setString(3, alias);
      }
      if (log.isDebugEnabled()) {
        log.debug("Executing query: " + sql);
      }
      resultSet = statement.executeQuery();
      while (resultSet.next()) {
        repoCredentials = new RepositoryCredentials();
        repoCredentials.setUrl(resultSet.getString("REPO_NAME"));
        repoCredentials.setUserName(resultSet.getString("REPO_USER_NAME"));
        repoCredentials.setPassword(decryptPassword(resultSet.getString("REPO_USER_PASSWORD")));
      }
    } catch (Exception s) {
      String msg = "Error while sql connection :" + s.getMessage();
      log.error(msg, s);
      throw s;
View Full Code Here


    return repoUrl;
  }

    public RepositoryCredentials getRepositoryCredentials(int tenantId, String cartridgeType, String alias) throws Exception {

      RepositoryCredentials repoCredentials = null;
        try {
          repoCredentials = PersistenceManager.getRepoCredentials(tenantId,cartridgeType, alias);
        } catch (Exception e) {
            String msg = "System Exception is occurred when retrieving user credentials";
            log.error(msg + ". Reason :" + e.getMessage());
View Full Code Here

TOP

Related Classes of org.apache.stratos.adc.mgt.dao.RepositoryCredentials

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.