Search in sources :

Example 1 with GetQueryReport

use of org.apache.rya.indexing.pcj.fluo.api.GetQueryReport in project incubator-rya by apache.

the class QueryReportCommand method execute.

@Override
public void execute(final Connector accumulo, final String ryaTablePrefix, final RyaSailRepository rya, final FluoClient fluo, final String[] args) throws ArgumentsException, ExecutionException, UnsupportedQueryException {
    checkNotNull(accumulo);
    checkNotNull(ryaTablePrefix);
    checkNotNull(rya);
    checkNotNull(fluo);
    checkNotNull(args);
    log.trace("Executing the Get Query Report Command...");
    // Parse the command line arguments.
    final Parameters params = new Parameters();
    try {
        new JCommander(params, args);
    } catch (final ParameterException e) {
        throw new ArgumentsException("Could not create a new query because of invalid command line parameters.", e);
    }
    // Build the report using what is stored in Fluo.
    log.trace("Building the report for Query ID: " + params.queryId);
    final QueryReport queryReport = new GetQueryReport().getReport(fluo, params.queryId);
    log.trace("Report built.");
    // Format and print the report.
    try {
        final String reportString = new QueryReportRenderer().render(queryReport);
        System.out.println(reportString);
    } catch (final Exception e) {
        throw new ExecutionException("Unable to render the query metadata report for output.", e);
    }
    log.trace("Finished executing the Get Query Report Command.");
}
Also used : JCommander(com.beust.jcommander.JCommander) ParameterException(com.beust.jcommander.ParameterException) GetQueryReport(org.apache.rya.indexing.pcj.fluo.api.GetQueryReport) QueryReport(org.apache.rya.indexing.pcj.fluo.api.GetQueryReport.QueryReport) QueryReportRenderer(org.apache.rya.indexing.pcj.fluo.client.util.QueryReportRenderer) UnsupportedQueryException(org.apache.rya.indexing.pcj.fluo.app.query.UnsupportedQueryException) ParameterException(com.beust.jcommander.ParameterException) GetQueryReport(org.apache.rya.indexing.pcj.fluo.api.GetQueryReport)

Aggregations

JCommander (com.beust.jcommander.JCommander)1 ParameterException (com.beust.jcommander.ParameterException)1 GetQueryReport (org.apache.rya.indexing.pcj.fluo.api.GetQueryReport)1 QueryReport (org.apache.rya.indexing.pcj.fluo.api.GetQueryReport.QueryReport)1 UnsupportedQueryException (org.apache.rya.indexing.pcj.fluo.app.query.UnsupportedQueryException)1 QueryReportRenderer (org.apache.rya.indexing.pcj.fluo.client.util.QueryReportRenderer)1