示例#1
0
  public SendEvent(
      TransformerManager transformerManager, GetRecordsType request, QueryRequest query)
      throws CswException {

    URI deliveryMethodUrl;
    if (request.getResponseHandler() != null && !request.getResponseHandler().isEmpty()) {

      try {
        deliveryMethodUrl = new URI(request.getResponseHandler().get(0));
      } catch (URISyntaxException e) {
        throw new CswException("Invalid ResponseHandler URL", e);
      }
    } else {
      String msg = "Subscriptions require a ResponseHandler URL to be specified";
      LOGGER.error(msg);
      throw new CswException(msg);
    }
    this.transformerManager = transformerManager;
    this.query = query;
    this.callbackUrl = deliveryMethodUrl;
    this.request = request;
    this.outputSchema = request.getOutputSchema();
    this.mimeType = request.getOutputFormat();
    QueryType queryType = (QueryType) request.getAbstractQuery().getValue();
    this.elementName = queryType.getElementName();
    this.elementSetType =
        (queryType.getElementSetName() != null) ? queryType.getElementSetName().getValue() : null;
    this.resultType = request.getResultType() == null ? ResultType.HITS : request.getResultType();
    SecureCxfClientFactory<CswSubscribe> cxfClientFactory =
        new SecureCxfClientFactory<>(callbackUrl.toString(), CswSubscribe.class);
    webClient = cxfClientFactory.getWebClient();
  }