コード例 #1
0
  public boolean isFitForAggregation(Point point) {

    boolean result = false;

    for (String propertyName : GlobalProperties.getPropertiesOfInterestDatabase().keySet()) {

      Object numberObject = point.getProperty(propertyName);

      if (numberObject instanceof Number) {
        result = result || !Utils.isNumberObjectNullOrZero((Number) numberObject);
      } else {
        /*
         * not a number, we cannot aggregate this currently
         */
        result = result || false;
      }
    }

    /*
     * also check for bbox
     */
    if (bbox != null) {
      Coordinate pointCoordinate = new Coordinate(point.getX(), point.getY());

      if (!bbox.contains(Utils.geometryFactory.createPoint(pointCoordinate))) {
        return false;
      }
    }

    return result;
  }
コード例 #2
0
  public void runAlgorithm(final String trackID) throws IOException {
    LOGGER.debug("Aggregating Track: " + trackID);

    if (pointService.trackAlreadyAggregated(trackID)) {
      LOGGER.info("Track already aggregated. skipping. " + trackID);
      return;
    }

    HttpGet get = new HttpGet(GlobalProperties.getRequestTrackURL() + trackID);

    HttpClient client;
    try {
      client = createClient();
    } catch (KeyManagementException
        | UnrecoverableKeyException
        | NoSuchAlgorithmException
        | KeyStoreException e) {
      throw new IllegalStateException(e);
    }

    HttpResponse resp = client.execute(get);
    if (resp != null
        && resp.getEntity() != null
        && resp.getStatusLine() != null
        && resp.getStatusLine().getStatusCode() < HttpStatus.SC_MULTIPLE_CHOICES) {

      PointViaJsonMapIterator it =
          new PointViaJsonMapIterator(Utils.parseJsonStream(resp.getEntity().getContent()));

      runAlgorithm(it, trackID);
    }
  }
コード例 #3
0
 protected HttpClient createClient()
     throws IOException, KeyManagementException, UnrecoverableKeyException,
         NoSuchAlgorithmException, KeyStoreException {
   return Utils.createClient();
 }