private GetFeatureOfInterestResponseDocument getFOIResponseOfOpResult(OperationResult opRes) throws XmlException, IOException, OXFException { XmlObject foiResponse = XmlObject.Factory.parse(opRes.getIncomingResultAsStream()); if (foiResponse instanceof GetFeatureOfInterestResponseDocument) { return (GetFeatureOfInterestResponseDocument) foiResponse; } else { throw new OXFException("No valid GetFeatureOfInterestREsponse"); } }
private Collection<SosTimeseries> executeGDATasks( Map<SosTimeseries, FutureTask<OperationResult>> getDataAvailabilityTasks) throws InterruptedException, ExecutionException, TimeoutException, XmlException, IOException { int counter = getDataAvailabilityTasks.size(); LOGGER.debug("Sending " + counter + " GetDataAvailability requests"); Collection<SosTimeseries> timeseries = new ArrayList<SosTimeseries>(); for (SosTimeseries timeserie : getDataAvailabilityTasks.keySet()) { LOGGER.debug("Sending #{} GetDataAvailability request for procedure " + timeserie.getProcedure(), counter--); FutureTask<OperationResult> futureTask = getDataAvailabilityTasks.get(timeserie); AccessorThreadPool.execute(futureTask); OperationResult result = futureTask.get(SERVER_TIMEOUT, MILLISECONDS); if (result == null) { LOGGER.error("Get no result for GetDataAvailability with parameter constellation: " + timeserie + "!"); } XmlObject result_xb = XmlObject.Factory.parse(result.getIncomingResultAsStream()); timeseries.addAll(getAvailableTimeseries(result_xb, timeserie)); } return timeseries; }
public StaticVisualization renderLayer(OperationResult operationResult) throws OXFException { PlanarImage resultImage = null; String format = (String) operationResult.getUsedParameters().getParameterShellWithCommonName(Parameter.COMMON_NAME_FORMAT).getSpecifiedValue(); SeekableStream seekableStream = SeekableStream.wrapInputStream(operationResult.getIncomingResultAsStream(), true); ParameterBlock pb = new ParameterBlock(); pb.add(seekableStream); if (format.toLowerCase().contains("png")) { resultImage = JAI.create("PNG", pb); } else if (format.toLowerCase().contains("gif")) { resultImage = JAI.create("GIF", pb); } else if (format.toLowerCase().contains("tif")) { resultImage = JAI.create("TIFF", pb); } else if (format.toLowerCase().contains("jpeg") || format.toLowerCase().contains("jpg")) { resultImage = JAI.create("JPEG", pb); } else { throw new OXFException("Format '" + format + "' is not supported by this WMSRenderer."); } return new StaticVisualization(resultImage.getAsBufferedImage()); }
incomingResultAsStream = opResult.getIncomingResultAsStream(); DescribeSensorParser parser = new DescribeSensorParser(incomingResultAsStream, metadata);
HttpEntity responseEntity = httpResponse.getEntity(); OperationResult result = new OperationResult(responseEntity.getContent(), parameters, getDataAvailability); XmlObject result_xb = XmlObject.Factory.parse(result.getIncomingResultAsStream()); String resultStr = result_xb.xmlText(); String timeString = resultStr.substring(resultStr.indexOf("<gml:beginPosition>") + 19, resultStr.indexOf("</gml:beginPosition>"));
String incomingFormat = paramMap.getParameterValue("FORMAT"); SeekableStream seekableStream = SeekableStream.wrapInputStream(operationResult.getIncomingResultAsStream(), true); ParameterBlock pb = new ParameterBlock(); pb.add(seekableStream);
protected Map<Feature, Point> performGetFeatureOfInterest(TimeseriesParametersLookup lookup) throws OXFException, ExceptionReport { HashMap<Feature, Point> features = new HashMap<Feature, Point>(); for (Network network : networks.values()) { ParameterContainer paramCon = new ParameterContainer(); paramCon.addParameterShell(GET_FOI_SERVICE_PARAMETER, "SOS"); paramCon.addParameterShell(GET_FOI_VERSION_PARAMETER, getServiceVersion()); paramCon.addParameterShell("procedure", network.getNetwork()); Operation operation = new Operation("GetFeatureOfInterest", getServiceUrl(), getServiceUrl()); try { OperationResult result = getSosAdapter().doOperation(operation, paramCon); FeatureParser parser = new FeatureParser(getServiceUrl(), createEpsgStrictAxisOrder()); features.putAll(parser.parseFeatures(result.getIncomingResultAsStream())); } catch (OXFException e) { LOGGER.warn("Exception in OXF layer while executing operation", e); } catch (ExceptionReport e) { // TODO probably we do have to handle an ExceedsSizeLimitException here LOGGER.warn("Service returned an ExceptionReport", e); } } for (Feature feature : features.keySet()) { lookup.addFeature(feature); } return features; }
return XmlObject.Factory.parse(result.getIncomingResultAsStream());
result = super.doOperation(operation, parameters); ByteArrayInputStream resultStream = result.getIncomingResultAsStream(); try { XmlObject result_xb = XmlObject.Factory.parse(resultStream);
/** * Performs a DescribeSensor request and caches the procedure description within * {@link #sensorDescriptions}. If procedure is already known no further DescribeSensor request will be * sent. * * @param procedure * the procedure id which SensorDescription is needed. * @return the procedure id(s). * @throws OXFException * when request preparation failed. * @throws ExceptionReport * when request processing failed. */ protected Set<String> describeSensorNetwork(String procedure) throws OXFException, ExceptionReport { ParameterContainer paramCon = new ParameterContainer(); paramCon.addParameterShell(DESCRIBE_SENSOR_SERVICE_PARAMETER, "SOS"); paramCon.addParameterShell(DESCRIBE_SENSOR_VERSION_PARAMETER, getServiceVersion()); paramCon.addParameterShell(DESCRIBE_SENSOR_PROCEDURE_PARAMETER, procedure); paramCon.addParameterShell(DESCRIBE_SENSOR_PROCEDURE_DESCRIPTION_FORMAT, SML_NAMESPACE); Operation operation = new Operation(DESCRIBE_SENSOR, getServiceUrl(), getServiceUrl()); OperationResult result = getSosAdapter().doOperation(operation, paramCon); InputStream stream = result.getIncomingResultAsStream(); SensorNetworkParser networkParser = new SensorNetworkParser(); Map<String, ComponentType> descriptions = networkParser.parseSensorDescriptions(stream); sensorDescriptions.putAll(descriptions); return descriptions.keySet(); }
OperationResult result = adapter.doOperation(operation, container); XmlObject foiResponse = XmlObject.Factory.parse(result .getIncomingResultAsStream()); if (foiResponse instanceof GetFeatureOfInterestResponseDocument) { GetFeatureOfInterestResponseDocument foiResDoc = (GetFeatureOfInterestResponseDocument) foiResponse;
@Override public ServiceDescriptor initService(OperationResult getCapabilitiesResult) throws ExceptionReport, OXFException { ByteArrayInputStream resultStream = getCapabilitiesResult.getIncomingResultAsStream(); try { XmlObject capsDoc = XmlObject.Factory.parse(resultStream); if (SosUtil.isVersion100(serviceVersion)) { if (capsDoc instanceof net.opengis.sos.x10.CapabilitiesDocument) { return initService((net.opengis.sos.x10.CapabilitiesDocument) capsDoc); } } else if (SosUtil.isVersion200(serviceVersion)) { if (capsDoc instanceof net.opengis.sos.x20.CapabilitiesDocument) { return initService((net.opengis.sos.x20.CapabilitiesDocument) capsDoc); } } throw new OXFException("Version is not supported: " + serviceVersion); } catch (XmlException e) { // BufferedReader reader = new BufferedReader(new InputStreamReader(resultStream)); // LOGGER.debug("First line of response: {}", reader.readLine()); throw new OXFException("Unparsable XML response.", e); } catch (IOException e) { throw new OXFException("Could not read from stream.", e); } }
XmlObject.Factory.parse(opResult.getIncomingResultAsStream(), xmlOpts); MetadataType metadataType = MetadataType.Factory.newInstance();