Package com.google.visualization.datasource.base

Examples of com.google.visualization.datasource.base.DataSourceException


  static void appendFromClause(Query query,
      StrBuilder queryStringBuilder, String tableName)
      throws DataSourceException {
    if (StringUtils.isEmpty(tableName)) {
      log.error("No table name provided.");
      throw new DataSourceException(ReasonType.OTHER, "No table name provided.");
    }
    queryStringBuilder.append("FROM ");
    queryStringBuilder.append(tableName);
    queryStringBuilder.append(" ");
  }
View Full Code Here


    // Get a Reader.
    Reader reader;
    try {
      reader = new BufferedReader(new InputStreamReader(new URL(url).openStream(), "UTF-8"));
    } catch (MalformedURLException e) {
      throw new DataSourceException(
          ReasonType.INVALID_REQUEST,
          "url is malformed: " + url);
    } catch (IOException e) {
      throw new DataSourceException(
          ReasonType.INVALID_REQUEST,
          "Couldn't read csv file from url: " + url);
    }
    return reader;
  }
View Full Code Here

    // Get a Reader.
    Reader reader = null;
    try {
      reader = new BufferedReader(new FileReader(file));
    } catch (FileNotFoundException e) {
      throw new DataSourceException(
          ReasonType.INVALID_REQUEST,
          "Couldn't read csv file from: " + file);
    }
    return reader;
  }
View Full Code Here

            return table;
        }
        catch(SQLException e) {
            String messageToUser = "Failed to execute SQL query. mySQL error message:"
                    + " " + e.getMessage();
            throw new DataSourceException(
                    ReasonType.INTERNAL_ERROR, messageToUser);
        }
        finally {
            if(stmt != null) {
                try {
View Full Code Here

            // We should add connection pooling to avoid heavy creation of connections.
            con = DriverManager.getConnection(url, userName, password);
        }
        catch(SQLException e) {
            log.error("Failed to connect to database server.", e);
            throw new DataSourceException(
                    ReasonType.INTERNAL_ERROR, "Failed to connect to database server.");
        }
        return con;
    }
View Full Code Here

    static void appendFromClause(Query query,
                                 StrBuilder queryStringBuilder, String tableName)
            throws DataSourceException {
        if(StringUtils.isEmpty(tableName)) {
            log.error("No table name provided.");
            throw new DataSourceException(ReasonType.OTHER, "No table name provided.");
        }
        queryStringBuilder.append("FROM ");
        queryStringBuilder.append(tableName);
        queryStringBuilder.append(" ");
    }
View Full Code Here

        Reader reader;
        try {
            reader = new BufferedReader(new InputStreamReader(new URL(url).openStream(), "UTF-8"));
        }
        catch(MalformedURLException e) {
            throw new DataSourceException(
                    ReasonType.INVALID_REQUEST,
                    "url is malformed: " + url);
        }
        catch(IOException e) {
            throw new DataSourceException(
                    ReasonType.INVALID_REQUEST,
                    "Couldn't read csv file from url: " + url);
        }
        return reader;
    }
View Full Code Here

        Reader reader = null;
        try {
            reader = new BufferedReader(new FileReader(file));
        }
        catch(FileNotFoundException e) {
            throw new DataSourceException(
                    ReasonType.INVALID_REQUEST,
                    "Couldn't read csv file from: " + file);
        }
        return reader;
    }
View Full Code Here

        return splitSortAndPagination(query);
      case SELECT:
        return splitSelect(query);
    }
    log.error("Capabilities not supported.");
    throw new DataSourceException(ReasonType.NOT_SUPPORTED, "Capabilities not supported.");
  }
View Full Code Here

    // Check for (!csv && !html && !tsv-excel) to make sure any output type
    // added in the future will be restricted to the same domain by default.
    OutputType outType = req.getDataSourceParameters().getOutputType();
    if (outType != OutputType.CSV && outType != OutputType.TSV_EXCEL
        && outType != OutputType.HTML && !req.isSameOrigin()) {
      throw new DataSourceException(ReasonType.ACCESS_DENIED,
          "Unauthorized request. Cross domain requests are not supported.");
    }
  }
View Full Code Here

TOP

Related Classes of com.google.visualization.datasource.base.DataSourceException

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.