public static ParameterContainer parseOM(ObservationDocument document) throws Exception { ParameterContainer paramCon = new ParameterContainer();
@Override public ServiceDescriptor initService(String url) throws ExceptionReport, OXFException { ParameterContainer paramCon = new ParameterContainer(); paramCon.addParameterShell("version", serviceVersion); paramCon.addParameterShell("service", "SOS"); Operation operation = new Operation("GetCapabilities", url.toString(), url.toString()); OperationResult opResult = doOperation(operation, paramCon); return initService(opResult); }
private boolean requestCapabilities() { SESAdapter adapter = new SESAdapter("0.0.0"); Operation op = new Operation(SESAdapter.GET_CAPABILITIES, null, host.toExternalForm()); ParameterContainer parameter = new ParameterContainer(); try { parameter.addParameterShell(ISESRequestBuilder.GET_CAPABILITIES_SES_URL, host.toExternalForm()); OperationResult opResult = adapter.doOperation(op, parameter); if (opResult == null) return false; XmlObject response = XmlObject.Factory.parse(opResult.getIncomingResultAsAutoCloseStream()); if (response instanceof EnvelopeDocument) { if (((EnvelopeDocument) response).getEnvelope().getBody().xmlText().contains("Capabilities")) { return true; } } } catch (OXFException e) { logger.warn(e.getMessage()); } catch (XmlException e) { logger.warn(e.getMessage()); } catch (IOException e) { logger.warn(e.getMessage()); } catch (ExceptionReport e) { logger.warn(e.getMessage()); } return false; } }).start();
@Override public ServiceDescriptor initService(String url) throws ExceptionReport, OXFException { ParameterContainer paramCon = new ParameterContainer(); paramCon.addParameterShell(GET_CAPABILITIES_SERVICE_PARAMETER, "SOS"); paramCon.addParameterShell(GET_CAPABILITIES_ACCEPT_VERSIONS_PARAMETER, serviceVersion); Operation operation = new Operation(SOSAdapter.GET_CAPABILITIES, url, url); OperationResult opResult = doOperation(operation, paramCon); return initService(opResult); }
private ParameterContainer createParameterContainerWithCommonServiceParameters() throws OXFException { final ParameterContainer parameterContainer = new ParameterContainer(); parameterContainer.addParameterShell(SERVICE, SERVICE_TYPE); parameterContainer.addParameterShell(VERSION, serviceDescriptor.getVersion()); if (binding != null) { parameterContainer.addParameterShell(BINDING, binding.name()); } return parameterContainer; }
private Callable<OperationResult> createGDAAccess(String sosUrl, String version, SosTimeseries timeserie) throws OXFException { ParameterContainer container = new ParameterContainer(); container.addParameterShell("procedure", timeserie.getProcedure()); container.addParameterShell("version", version); Operation operation = new Operation(GET_DATA_AVAILABILITY, sosUrl, sosUrl); return new OperationAccessor(getSosAdapter(), operation, container); }
private Callable<OperationResult> createGetFoiAccess(String sosUrl, String sosVersion, String procedureID) throws OXFException { ParameterContainer container = new ParameterContainer(); container.addParameterShell(GET_FOI_SERVICE_PARAMETER, "SOS"); container.addParameterShell(GET_FOI_VERSION_PARAMETER, sosVersion); container.addParameterShell("procedure", procedureID); Operation operation = new Operation(GET_FEATURE_OF_INTEREST, sosUrl, sosUrl); return new OperationAccessor(getSosAdapter(), operation, container); }
/** * initializes the ServiceDescriptor by requesting the capabilities document of the SOS. * * @param url * the base URL of the SOS * @param serviceVersion * the schema version to which the service description shall be conform. * * @return the ServiceDescriptor based on the retrieved capabilities document * * @throws ExceptionReport * if service side exception occurs * @throws OXFException * if internal exception (in general parsing error or Capabilities doc is incorrect) occurs * */ @Override public ServiceDescriptor initService(final String url) throws ExceptionReport, OXFException { final ParameterContainer paramContainer = new ParameterContainer(); paramContainer.addParameterShell("acceptVersions", serviceVersion); paramContainer.addParameterShell("service", "SOS"); final String baseUrlPost = url; final String baseUrlGet = baseUrlPost + "?"; final Operation operation = new Operation("GetCapabilities", baseUrlGet, baseUrlPost); return initService(doOperation(operation, paramContainer)); }
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; }
ParameterContainer parameters = new ParameterContainer(); parameters.addParameterShell(DESCRIBE_SENSOR_SERVICE_PARAMETER, "SOS"); parameters.addParameterShell(DESCRIBE_SENSOR_VERSION_PARAMETER, sosVersion);
public static void main(String[] args) throws OXFException { Operation operation = new Operation("GetCapabilities", "http://divenos.meraka.csir.co.za:8080/geoserver/wms", null); String version = "1.1.1"; ParameterContainer paramCon = new ParameterContainer(); paramCon.addParameterShell(new ParameterShell(new Parameter("version", true, new StringValueDomain(new String[] {"1.1.1", "1.1.0", "1.0.0"}), Parameter.COMMON_NAME_VERSION), version)); String requestString = new WMSRequestBuilder().buildGetCapabilitiesRequest(operation, paramCon); LOGGER.info(requestString); } }
/** * initializes the ServiceDescriptor by requesting the capabilities document of the SOS using the binding specified. * * @param serviceEndpoint * @param binding * @return * @throws OXFException * @throws ExceptionReport */ public ServiceDescriptor initService(final String serviceEndpoint, final Binding binding) throws OXFException, ExceptionReport { final ParameterContainer paramContainer = new ParameterContainer(); paramContainer.addParameterShell(GET_CAPABILITIES_ACCEPT_VERSIONS_PARAMETER, serviceVersion); paramContainer.addParameterShell(SERVICE, "SOS"); paramContainer.addParameterShell(BINDING, binding != null? binding.name() : DEFAULT_BINDING); final String baseUrlGet = serviceEndpoint + "?"; final Operation operation = new Operation("GetCapabilities", baseUrlGet, serviceEndpoint); return initService(doOperation(operation, paramContainer)); }
/** * 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(); }
private OperationAccessor createDescribeSensorAccessor(String sosUrl, String sosVersion, String smlVersion, Procedure proc) throws OXFException { Operation operation = new Operation(SOSAdapter.DESCRIBE_SENSOR, sosUrl, sosUrl); ParameterContainer paramCon = new ParameterContainer(); paramCon.addParameterShell(ISOSRequestBuilder.DESCRIBE_SENSOR_SERVICE_PARAMETER, "SOS"); paramCon.addParameterShell(ISOSRequestBuilder.DESCRIBE_SENSOR_VERSION_PARAMETER, sosVersion); paramCon.addParameterShell(ISOSRequestBuilder.DESCRIBE_SENSOR_PROCEDURE_PARAMETER, proc.getId()); if (SosUtil.isVersion100(sosVersion)) { paramCon.addParameterShell(ISOSRequestBuilder.DESCRIBE_SENSOR_OUTPUT_FORMAT, smlVersion); } else if (SosUtil.isVersion200(sosVersion)) { paramCon.addParameterShell(ISOSRequestBuilder.DESCRIBE_SENSOR_PROCEDURE_DESCRIPTION_FORMAT, smlVersion); } else { throw new IllegalStateException("SOS Version (" + sosVersion + ") is not supported!"); } OperationAccessor opAccessorCallable = new OperationAccessor(getSosAdapter(), operation, paramCon); return opAccessorCallable; }
String url = sosMetadata.getServiceUrl(); try { ParameterContainer container = new ParameterContainer(); container.addParameterShell(GET_FOI_SERVICE_PARAMETER, "SOS"); container.addParameterShell(GET_FOI_VERSION_PARAMETER, sosMetadata.getVersion());
public OperationResult doDeleteSensor(final String sensorId, final String authtoken) throws OXFException, ExceptionReport { final SOSAdapter adapter = new SOSAdapter(serviceDescriptor.getVersion()); if (checkOperationAvailability(DELETE_SENSOR)) { final Operation operation = serviceDescriptor.getOperationsMetadata().getOperationByName(DELETE_SENSOR); final ParameterContainer pc = new ParameterContainer(); pc.addParameterShell(ISOSRequestBuilder.SERVICE, "SOS"); pc.addParameterShell(ISOSRequestBuilder.VERSION, serviceDescriptor.getVersion()); pc.addParameterShell(ISOSRequestBuilder.DELETE_SENSOR_PROCEDURE, sensorId); if (authtoken != null && !authtoken.isEmpty()) { SosRequestParameters params = new SosRequestParameters() {}; params.setAuthtoken(authtoken); addAuthtokenParameter(params, pc); } return adapter.doOperation(operation, pc, connectionTimeout, readTimeout); }else { throw new OXFException("Operation: '" + DELETE_SENSOR + "' not supported by the SOS instance!"); } }
@Override public ServiceDescriptor initService(String serviceURL) throws ExceptionReport, OXFException { ParameterContainer parameters = new ParameterContainer(); parameters.addParameterShell(ISESRequestBuilder.GET_CAPABILITIES_SES_URL, serviceURL); OperationResult opResult = doOperation(new Operation(SESAdapter.GET_CAPABILITIES, serviceURL, serviceURL), parameters); try { // free OWS Response from SOAP-Envelope EnvelopeDocument envDoc = EnvelopeDocument.Factory.parse(opResult.getIncomingResultAsAutoCloseStream()); String owsResponse = envDoc.getEnvelope().getBody().xmlText(); CapabilitiesDocument capsDoc = CapabilitiesDocument.Factory.parse(owsResponse); return handleCapabilities(capsDoc); } catch (XmlException | IOException e) { throw new OXFException(e); } }
final ParameterContainer container = new ParameterContainer(); container.addParameterShell(SERVICE, SosUtil.SERVICE_TYPE); container.addParameterShell(VERSION, serviceVersion);
/** * */ private void init() { this.parameterContainer = new ParameterContainer(); try { // add bbox to parameter container because it is needed in the rendering process this.parameterContainer.addParameterShell(new ParameterShell(new Parameter(Parameter.COMMON_NAME_BBOX, true, getBBox(), Parameter.COMMON_NAME_BBOX), getBBox())); // values will be filled in method super.refreshParameterContainer(contextBBox, window) this.parameterContainer.addParameterShell(new ParameterShell(new Parameter(Parameter.COMMON_NAME_SRS, true, new StringValueDomain(getSrs()), Parameter.COMMON_NAME_SRS), getSrs())); } catch (NullPointerException e) { throw new OXFRuntimeException("parameter container of the layer '" + getIDName() + "' could not be initialized successfully.", e); } catch (OXFException e) { throw new OXFRuntimeException("parameter container of the layer '" + getIDName() + "' could not be initialized successfully.", e); } }
String[] observedProperties = getArray(request.getPhenomenonsSet()); ParameterContainer params = new ParameterContainer(); params.addParameterShell(GET_OBSERVATION_SERVICE_PARAMETER, "SOS"); params.addParameterShell(GET_OBSERVATION_VERSION_PARAMETER, sosVersion);