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 boolean isBindingParameterSpecified(final ParameterContainer parameters) { return parameters.getParameterShellWithCommonName(ISOSRequestBuilder.BINDING) != null && parameters.getParameterShellWithCommonName(ISOSRequestBuilder.BINDING).hasSingleSpecifiedValue() && parameters.getParameterShellWithCommonName(ISOSRequestBuilder.BINDING) .getSpecifiedValue() instanceof String; }
protected ParameterShell getShellForServerParameter(final ParameterContainer container, final String name) { return container.getParameterShellWithServiceSidedName(name); }
/** * convenience method for: * <code>getParameterContainer().getParameterShellWithCommonName(Parameter.COMMON_NAME_TIME.getSpecifiedValue())</code> * * @return the "temporal position" of this Layer. Possibly <code>null</code> if the Layer has no * temporal stamp. */ public ITime getTimeStamp() { if (parameterContainer.containsParameterShellWithCommonName(Parameter.COMMON_NAME_TIME)) { return (ITime) parameterContainer.getParameterShellWithCommonName(Parameter.COMMON_NAME_TIME).getSpecifiedValue(); } return null; }
private void processOptionalBasicAuthParameter(ParameterContainer parameterContainer) throws OXFException { if (basicAuthHost != null && !basicAuthHost.isEmpty() && basicAuthUser != null && !basicAuthUser.isEmpty() && basicAuthPassword != null && !basicAuthPassword.isEmpty()) { parameterContainer.addParameterShell(ISOSRequestBuilder.BASIC_AUTH_HOST, basicAuthHost); parameterContainer.addParameterShell(ISOSRequestBuilder.BASIC_AUTH_USER, basicAuthUser); parameterContainer.addParameterShell(ISOSRequestBuilder.BASIC_AUTH_PASSWORD, basicAuthPassword); } }
if (parameterContainer.containsParameterShellWithCommonName(Parameter.COMMON_NAME_SRS)) { String actualSRS = contextBBox.getSRS(); String oldSRS = (String) parameterContainer.getParameterShellWithCommonName(Parameter.COMMON_NAME_SRS).getSpecifiedValue(); parameterContainer.setParameterValue(Parameter.COMMON_NAME_SRS, actualSRS); refreshed = true; new StringValueDomain(contextBBox.getSRS()), Parameter.COMMON_NAME_SRS); parameterContainer.addParameterShell(new ParameterShell(srsParam, contextBBox.getSRS())); refreshed = true; if (parameterContainer.containsParameterShellWithCommonName(Parameter.COMMON_NAME_BBOX)) { BoundingBox actualBBox = contextBBox.asCommonCapabilitiesBoundingBox(); BoundingBox oldBBox = (BoundingBox) parameterContainer.getParameterShellWithCommonName(Parameter.COMMON_NAME_BBOX).getSpecifiedValue(); parameterContainer.setParameterValue(Parameter.COMMON_NAME_BBOX, actualBBox); refreshed = true; contextBBox.asCommonCapabilitiesBoundingBox(), Parameter.COMMON_NAME_BBOX); parameterContainer.addParameterShell(new ParameterShell(bboxParam, contextBBox.asCommonCapabilitiesBoundingBox())); refreshed = true; if (parameterContainer.containsParameterShellWithCommonName(Parameter.COMMON_NAME_HEIGHT)) { int actualHeight = window.getHeight(); int oldHeight = Integer.MIN_VALUE;
@Override public String buildGetObservationRequest(ParameterContainer parameters) throws OXFException { ParameterShell temporalFilter = parameters.getParameterShellWithServiceSidedName("temporalFilter"); Object specifiedValue = temporalFilter.getSpecifiedValue(); parameters.removeParameterShell(temporalFilter); String timeString = resultStr.substring(resultStr.indexOf("<gml:beginPosition>") + 19, resultStr.indexOf("</gml:beginPosition>")); parameters.removeParameterShell(temporalFilter); parameters.addParameterShell(ISOSRequestBuilder.GET_OBSERVATION_TEMPORAL_FILTER_PARAMETER, timeString); } catch (Exception e) { LOGGER.error("Exception occured on server side, while requesting the timestamp of the first observation.", e.getCause());
if (parameters.getParameterShellWithServiceSidedName(GET_CAPABILITIES_UPDATE_SEQUENCE_PARAMETER) != null) { getCap.setUpdateSequence((String) parameters .getParameterShellWithServiceSidedName(GET_CAPABILITIES_UPDATE_SEQUENCE_PARAMETER) .getSpecifiedValue()); .getParameterShellWithServiceSidedName(GET_CAPABILITIES_ACCEPT_VERSIONS_PARAMETER); if (versionPS == null){ versionPS = parameters.getParameterShellWithCommonName(Parameter.COMMON_NAME_VERSION); .getParameterShellWithServiceSidedName(GET_CAPABILITIES_SECTIONS_PARAMETER); if (sectionParamShell != null) { final SectionsType sections = getCap.addNewSections();
if (parameterContainer.containsParameterShellWithCommonName(Parameter.COMMON_NAME_FORMAT)) { FormatListType xb_formatList = xb_layer.addNewFormatList(); xb_format.setStringValue((String) parameterContainer.getParameterShellWithCommonName(Parameter.COMMON_NAME_FORMAT).getSpecifiedValue()); if (parameterContainer.containsParameterShellWithCommonName(Parameter.COMMON_NAME_TIME)) { builder.append("<DimensionList>"); builder.append("<Dimension name=\"time\">"); builder.append(parameterContainer.getParameterShellWithCommonName(Parameter.COMMON_NAME_TIME).getSpecifiedValue()); builder.append("</Dimension>"); for (ParameterShell ps : parameterContainer.getParameterShells()) { if (ps.getParameter().getCommonName() == null) { if (ps.getSpecifiedValue() instanceof IGenericParameterValue) {
public static ParameterContainer parseOM(ObservationDocument document) throws Exception { ParameterContainer paramCon = new ParameterContainer();
if (parameters.getParameterShellWithServiceSidedName(INSERT_OBSERVATION_NEW_FOI_ID_PARAMETER) == null) { xbObservation .addNewFeatureOfInterest() .setHref( (String) parameters .getParameterShellWithServiceSidedName(INSERT_OBSERVATION_FOI_ID_PARAMETER) .getSpecifiedValue()); final CodeWithAuthorityType identifier = xbSpatialSamplingFeature.addNewIdentifier(); identifier.setStringValue((String) parameters.getParameterShellWithServiceSidedName(INSERT_OBSERVATION_NEW_FOI_ID_PARAMETER) .getSpecifiedValue()); identifier.setCodeSpace(""); xbSpatialSamplingFeature.addNewName().setStringValue((String) parameters.getParameterShellWithServiceSidedName(INSERT_OBSERVATION_NEW_FOI_NAME) .getSpecifiedValue()); xbSpatialSamplingFeature.addNewType().setHref(OGC_OM_2_0_SF_SAMPLING_POINT); if (parameters.containsParameterShellWithCommonName(INSERT_OBSERVATION_NEW_FOI_PARENT_FEATURE_ID) || parameters .containsParameterShellWithServiceSidedName(INSERT_OBSERVATION_NEW_FOI_PARENT_FEATURE_ID)) { xbSpatialSamplingFeature .addNewSampledFeature() .setHref((String) parameters .getParameterShellWithServiceSidedName( INSERT_OBSERVATION_NEW_FOI_PARENT_FEATURE_ID).getSpecifiedValue()); final DirectPositionType pos = xbGmlPoint.addNewPos();
@Override public String buildGetFeatureOfInterestRequest(final ParameterContainer parameters) throws OXFException { final GetFeatureOfInterestDocument xbGetFOIDoc = GetFeatureOfInterestDocument.Factory.newInstance(); final GetFeatureOfInterestType xbGetFOI = xbGetFOIDoc.addNewGetFeatureOfInterest(); xbGetFOI.setService("SOS"); xbGetFOI.setVersion("2.0.0"); // TODO multiple values are allowed for each filter parameter if (parameters.containsParameterShellWithCommonName("procedure")) { ParameterShell filter = parameters.getParameterShellWithServiceSidedName("procedure"); for (String procedureFilter : filter.getSpecifiedTypedValueArray(String[].class)) { xbGetFOI.addProcedure(procedureFilter); } } if (parameters.containsParameterShellWithCommonName("observedProperty")) { ParameterShell filter = parameters.getParameterShellWithServiceSidedName("observedProperty"); for (String phenomenonFilter : filter.getSpecifiedTypedValueArray(String[].class)) { xbGetFOI.addObservedProperty(phenomenonFilter); } } if (parameters.containsParameterShellWithCommonName("featureOfInterest")) { ParameterShell filter = parameters.getParameterShellWithServiceSidedName("featureOfInterest"); for (String featureFilter : filter.getSpecifiedTypedValueArray(String[].class)) { xbGetFOI.addFeatureOfInterest(featureFilter); } } doLaxRequestValidation(xbGetFOI); return xbGetFOIDoc.xmlText(XmlUtil.FAST); }
private void processOptionalMimetypeParameter(final Map<String, ?> parameters, final ParameterContainer parameterContainer) throws OXFException { if (parameters.get(MIME_TYPE) != null && parameters.get(CHARSET) != null) { final String mimeType = (String) parameters.get(MIME_TYPE); final String charSet = (String) parameters.get(CHARSET); if (!mimeType.isEmpty() && !charSet.isEmpty()) { final Charset charset = Charset.forName(charSet); final ContentType contentType = ContentType.create(mimeType, charset); parameterContainer.addParameterShell(MIMETYPE, contentType.getMimeType()); parameterContainer.addParameterShell(ENCODING, charSet); } } }
private boolean isSetAuthtoken(final ParameterContainer parameters) { return parameters.containsParameterShellWithCommonName(ISOSRequestBuilder.AUTH_TOKEN) && parameters.getParameterShellWithCommonName(ISOSRequestBuilder.AUTH_TOKEN) != null && parameters.getParameterShellWithCommonName(ISOSRequestBuilder.AUTH_TOKEN).getSpecifiedValue().getClass().isAssignableFrom(String.class) && !((String)parameters.getParameterShellWithCommonName(ISOSRequestBuilder.AUTH_TOKEN).getSpecifiedValue()).isEmpty(); }
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); }
/** * @param commonName the common parameter name. * @param parameters the parameter container. * @return the parameter's specificValue if set, <code>null</code> otherwise. */ private String getStringValueFor(String commonName, ParameterContainer parameters) { ParameterShell value = parameters.getParameterShellWithCommonName(commonName); return value == null ? null : (String) value.getSpecifiedValue(); }
private ParameterContainer createParameterContainerForGetObservationById(final Map<String, String> parameters) throws OXFException, ExceptionReport { final ParameterContainer parameterContainer = createParameterContainerWithCommonServiceParameters(); // mandatory parameters from builder parameterContainer.addParameterShell(GET_OBSERVATION_BY_ID_OBSERVATION_ID_PARAMETER, parameters.get(GET_OBSERVATION_BY_ID_OBSERVATION_ID_PARAMETER)); parameterContainer.addParameterShell(GET_OBSERVATION_BY_ID_RESPONSE_FORMAT_PARAMETER, parameters.get(GET_OBSERVATION_BY_ID_RESPONSE_FORMAT_PARAMETER)); // optional parameters from builder if (parameters.get(ISOSRequestBuilder.GET_OBSERVATION_BY_ID_SRS_NAME_PARAMETER) != null) { parameterContainer.addParameterShell(ISOSRequestBuilder.GET_OBSERVATION_BY_ID_SRS_NAME_PARAMETER, parameters.get(ISOSRequestBuilder.GET_OBSERVATION_BY_ID_SRS_NAME_PARAMETER)); } if (parameters.get(GET_OBSERVATION_BY_ID_RESULT_MODEL_PARAMETER) != null) { parameterContainer.addParameterShell(GET_OBSERVATION_BY_ID_RESULT_MODEL_PARAMETER, parameters.get(GET_OBSERVATION_BY_ID_RESULT_MODEL_PARAMETER)); } if (parameters.get(GET_OBSERVATION_BY_ID_RESPONSE_MODE_PARAMETER) != null) { parameterContainer.addParameterShell(GET_OBSERVATION_BY_ID_RESPONSE_MODE_PARAMETER, parameters.get(GET_OBSERVATION_BY_ID_RESPONSE_MODE_PARAMETER)); } processOptionalMimetypeParameter(parameters, parameterContainer); processOptionalBasicAuthParameter(parameterContainer); return parameterContainer; }
private String getSpecifiedStringValue(ParameterContainer parameters, String parameterName) { ParameterShell parameter = parameters.getParameterShellWithServiceSidedName(parameterName); return parameter == null ? "" : (String) parameter.getSpecifiedValue(); }
private boolean isSetBasicAuth(ParameterContainer parameters) { return parameters.containsParameterShellWithCommonName(ISOSRequestBuilder.BASIC_AUTH_USER) && parameters.getParameterShellWithCommonName(ISOSRequestBuilder.BASIC_AUTH_USER) != null && parameters.getParameterShellWithCommonName(ISOSRequestBuilder.BASIC_AUTH_USER).getSpecifiedValue().getClass().isAssignableFrom(String.class) && !((String)parameters.getParameterShellWithCommonName(ISOSRequestBuilder.BASIC_AUTH_USER).getSpecifiedValue()).isEmpty() && parameters.containsParameterShellWithCommonName(ISOSRequestBuilder.BASIC_AUTH_PASSWORD) && parameters.getParameterShellWithCommonName(ISOSRequestBuilder.BASIC_AUTH_PASSWORD) != null && parameters.getParameterShellWithCommonName(ISOSRequestBuilder.BASIC_AUTH_PASSWORD).getSpecifiedValue().getClass().isAssignableFrom(String.class) && !((String)parameters.getParameterShellWithCommonName(ISOSRequestBuilder.BASIC_AUTH_PASSWORD).getSpecifiedValue()).isEmpty() && parameters.containsParameterShellWithCommonName(ISOSRequestBuilder.BASIC_AUTH_HOST) && parameters.getParameterShellWithCommonName(ISOSRequestBuilder.BASIC_AUTH_HOST) != null && parameters.getParameterShellWithCommonName(ISOSRequestBuilder.BASIC_AUTH_HOST).getSpecifiedValue().getClass().isAssignableFrom(String.class) && !((String)parameters.getParameterShellWithCommonName(ISOSRequestBuilder.BASIC_AUTH_HOST).getSpecifiedValue()).isEmpty(); }
@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); }