omniture-lib/src/main/java/com/streamsets/pipeline/stage/origin/omniture/OmniturePollingConsumer.java
public int queueReport() throws IOException, InterruptedException, ExecutionException, TimeoutException, StageException {
    final AsyncInvoker asyncInvoker = queueResource.request()
        .header(WSSE_HEADER, OmnitureAuthUtil.getHeader(username.get(), sharedSecret.get()))
        .async();
    LOG.debug("Queueing report using URL {} with description {}",
        queueResource.getUri().toURL().toString(), reportDescription);
    final Future<Response> responseFuture = asyncInvoker.post(Entity.json(reportDescription));
    Response response = responseFuture.get(responseTimeoutMillis, TimeUnit.MILLISECONDS);
    if (response == null) {
      LOG.error("Failed to get response using URL {}", queueResource.getUri().toURL().toString());
      throw new StageException(Errors.OMNITURE_01, "HTTP response was null");
    }
    LOG.debug("Received response: status {}", response.getStatus());

    ObjectMapper mapper = new ObjectMapper();
    String json = response.readEntity(String.class);
    LOG.trace("Response JSON: {}", json);
    JsonNode root = mapper.readTree(json);

    if (root == null) {
      LOG.error("Invalid JSON in response: {}", json);
      throw new StageException(Errors.OMNITURE_01, json);
    }

    if (root.has("error")) {
      throw new StageException(Errors.OMNITURE_01, root.get("error_description").asText());
    }

    LOG.info("Omniture report queued");
    return root.get("reportID").asInt();
  }
public int queueReport() throws IOException, InterruptedException, ExecutionException, TimeoutException, StageException {
    final AsyncInvoker asyncInvoker = queueResource.request()
        .header(WSSE_HEADER, OmnitureAuthUtil.getHeader(username.get(), sharedSecret.get()))
        .async();
    LOG.debug("Queueing report using URL {} with description {}",
        queueResource.getUri().toURL().toString(), reportDescription);
    final Future<Response> responseFuture = asyncInvoker.post(Entity.json(reportDescription));
    Response response = responseFuture.get(responseTimeoutMillis, TimeUnit.MILLISECONDS);
    if (response == null) {
      LOG.error("Failed to get response using URL {}", queueResource.getUri().toURL().toString());
      throw new StageException(Errors.OMNITURE_01, "HTTP response was null");
    }
    LOG.debug("Received response: status {}", response.getStatus());

    ObjectMapper mapper = new ObjectMapper();
    String json = response.readEntity(String.class);
    LOG.trace("Response JSON: {}", json);
    JsonNode root = mapper.readTree(json);

    if (root == null) {
      LOG.error("Invalid JSON in response: {}", json);
      throw new StageException(Errors.OMNITURE_01, json);
    }

    if (root.has("error")) {
      throw new StageException(Errors.OMNITURE_01, root.get("error_description").asText());
    }

    LOG.info("Omniture report queued");
    return root.get("reportID").asInt();
  }
public int queueReport ( ) throws IOException , InterruptedException , ExecutionException , TimeoutException , StageException { final AsyncInvoker asyncInvoker = queueResource . request ( ) . header ( WSSE_HEADER , OmnitureAuthUtil . getHeader ( username . get ( ) , sharedSecret . get ( ) ) ) . async ( ) ; LOG . debug ( "Queueing report using URL {} with description {}" , queueResource . getUri ( ) . toURL ( ) . toString ( ) , reportDescription ) ; final Future < Response > responseFuture = asyncInvoker . post ( Entity . json ( reportDescription ) ) ; Response response = responseFuture . get ( responseTimeoutMillis , TimeUnit . MILLISECONDS ) ; if ( response == null ) { LOG . error ( "Failed to get response using URL {}" , queueResource . getUri ( ) . toURL ( ) . toString ( ) ) ; throw new StageException ( Errors . OMNITURE_01 , "HTTP response was null" ) ; } LOG . debug ( "Received response: status {}" , response . getStatus ( ) ) ; ObjectMapper mapper = new ObjectMapper ( ) ; String json = response . readEntity ( String . class ) ; LOG . trace ( "Response JSON: {}" , json ) ; JsonNode root = mapper . readTree ( json ) ; if ( root == null ) { LOG . error ( "Invalid JSON in response: {}" , json ) ; throw new StageException ( Errors . OMNITURE_01 , json ) ; } if ( root . has ( "error" ) ) { throw new StageException ( Errors . OMNITURE_01 , root . get ( "error_description" ) . asText ( ) ) ; } LOG . info ( "Omniture report queued" ) ; return root . get ( "reportID" ) . asInt ( ) ; }
Queue a report using the Report.Queue method. This will post a request with the report description
to the Omniture API and return a report ID that can be used to retrieve the report once it's ready.
@return report ID
@throws IOException
@throws InterruptedException
@throws ExecutionException
@throws TimeoutException
Queue a report using the Report . Queue method . This will post a request with the report description to the Omniture API and return a report ID that can be used to retrieve the report once it s ready .