protected ParameterShell getShellForServerParameter(final ParameterContainer container, final String name) { return container.getParameterShellWithServiceSidedName(name); }
private String getSpecifiedStringValue(ParameterContainer parameters, String parameterName) { ParameterShell parameter = parameters.getParameterShellWithServiceSidedName(parameterName); return parameter == null ? "" : (String) parameter.getSpecifiedValue(); }
private String[] getSpecifiedStringArrayValue(ParameterContainer parameters, String parameterName) { ParameterShell parameterShell = parameters.getParameterShellWithServiceSidedName(parameterName); return parameterShell.getSpecifiedTypedValueArray(String[].class); }
private void addObservedProperty(final ParameterContainer parameters, final OMObservationType xbObservation) { // add observed property xbObservation.addNewObservedProperty().setHref((String) parameters.getParameterShellWithServiceSidedName(INSERT_OBSERVATION_OBSERVED_PROPERTY_PARAMETER) .getSpecifiedValue()); }
private void addProcedure(final ParameterContainer parameters, final OMObservationType xbObservation) { // add procedure identifier xbObservation.addNewProcedure().setHref((String) parameters.getParameterShellWithServiceSidedName(INSERT_OBSERVATION_PROCEDURE_PARAMETER) .getSpecifiedValue()); }
@Override public String buildGetFeatureOfInterestRequest(final ParameterContainer parameters) { final GetFeatureOfInterestDocument getFoIDoc = GetFeatureOfInterestDocument.Factory.newInstance(); final GetFeatureOfInterest getFoI = getFoIDoc.addNewGetFeatureOfInterest(); // set required elements: getFoI.setService((String) parameters.getParameterShellWithServiceSidedName(SERVICE).getSpecifiedValue()); final ParameterShell versionPS = parameters.getParameterShellWithServiceSidedName(VERSION); getFoI.setVersion((String) versionPS.getSpecifiedValue()); // set optional elements: if (parameters.getParameterShellWithServiceSidedName(GET_FOI_ID_PARAMETER) != null) { final ParameterShell foiIDParamShell = parameters.getParameterShellWithServiceSidedName(GET_FOI_ID_PARAMETER); if (foiIDParamShell.hasSingleSpecifiedValue()) { final String foiIDParamValue = (String) foiIDParamShell.getSpecifiedValue(); getFoI.setFeatureOfInterestIdArray(new String[] {foiIDParamValue}); } else { final String[] foiIDParamValue = foiIDParamShell.getSpecifiedTypedValueArray(String[].class); getFoI.setFeatureOfInterestIdArray(foiIDParamValue); } } else if (parameters.getParameterShellWithServiceSidedName(GET_FOI_LOCATION_PARAMETER) != null) { throw new UnsupportedOperationException("The parameter '" + GET_FOI_LOCATION_PARAMETER + "' is not yet supported."); } if (parameters.getParameterShellWithServiceSidedName(GET_FOI_EVENT_TIME_PARAMETER) != null) { throw new UnsupportedOperationException("The parameter '" + GET_FOI_EVENT_TIME_PARAMETER + "' is not yet supported."); } return getFoIDoc.xmlText(XmlUtil.PRETTYPRINT); }
public JFreeChart renderChart(OXFFeatureCollection observationCollection, ParameterContainer paramCon) { ParameterShell observedPropertyPS = paramCon.getParameterShellWithServiceSidedName("observedProperty"); if (observedPropertyPS.hasMultipleSpecifiedValues()) { String[] observedProperties =observedPropertyPS.getSpecifiedTypedValueArray(String[].class);; observedPropertyX = observedProperties[0]; observedPropertyY = observedProperties[1]; } else { throw new IllegalArgumentException("2 observedProperties needed."); } String[] foiIdArray = paramCon.getParameterShellWithServiceSidedName("featureOfInterest").getSpecifiedTypedValueArray(String[].class); ObservationSeriesCollection tupleFinder = new ObservationSeriesCollection(observationCollection, foiIdArray, new String[] {observedPropertyX, observedPropertyY}, true); return drawChart(tupleFinder.getAllTuples()); }
private void addProcedure(final ParameterContainer parameters, final InsertSensorType xbInsertSensorType) throws OXFException { // add procedure description format xbInsertSensorType.setProcedureDescriptionFormat((String) parameters .getParameterShellWithServiceSidedName(REGISTER_SENSOR_PROCEDURE_DESCRIPTION_FORMAT_PARAMETER) .getSpecifiedValue()); // add procedure description XmlObject xbObj; try { xbObj = XmlObject.Factory.parse((String) parameters.getParameterShellWithServiceSidedName(REGISTER_SENSOR_ML_DOC_PARAMETER) .getSpecifiedValue()); xbInsertSensorType.addNewProcedureDescription().set(xbObj); } catch (final XmlException e) { final String errorMsg = "Error while parsing MANDATORY parameter 'procedure description'!"; LOGGER.error("{} Exception message: {}", errorMsg, e.getMessage(), e); throw new OXFException(errorMsg, e); } }
private ITime getSpecifiedTime(ParameterContainer parameters) { Object tempFilter = parameters.getParameterShellWithServiceSidedName(GET_OBSERVATION_TEMPORAL_FILTER_PARAMETER).getSpecifiedValue(); if (tempFilter instanceof ITime) { ITime filter = (ITime) tempFilter; if (isSetFirstOrLatestTime(filter.toISO8601Format())) { return filter.toISO8601Format().equals("getFirst") ? new TimePosition_OXFExtension("first") : new TimePosition_OXFExtension("latest"); } return filter; } else { return TimeFactory.createTime((String) tempFilter); } }
@Override public String buildGetObservationRequest(ParameterContainer parameters) throws OXFException { ParameterShell temporalFilter = parameters.getParameterShellWithServiceSidedName("temporalFilter"); Object specifiedValue = temporalFilter.getSpecifiedValue();
private void addOfferings(final ParameterContainer parameters, final InsertObservationType xbInsertObservationType) { // add offerings final ParameterShell offeringsPS = parameters .getParameterShellWithServiceSidedName(INSERT_OBSERVATION_OFFERINGS_PARAMETER); if (offeringsPS != null) { if (offeringsPS.hasSingleSpecifiedValue()) { xbInsertObservationType.addOffering((String) offeringsPS.getSpecifiedValue()); } else { final String[] offerings = offeringsPS.getSpecifiedTypedValueArray(String[].class); for (final String offering : offerings) { xbInsertObservationType.addOffering(offering); } } } }
private OMObservationType addObservationType(final ParameterContainer parameters, final InsertObservationType xbInsertObservationType) throws OXFException { // add observation type identifier final OMObservationType xbObservation = xbInsertObservationType.addNewObservation().addNewOMObservation(); final String observationType = (String) parameters.getParameterShellWithServiceSidedName(INSERT_OBSERVATION_TYPE) .getSpecifiedValue(); xbObservation.addNewType().setHref(getObservationTypeIdentifier(observationType)); return xbObservation; }
private void addObservableProperties(final ParameterContainer parameters, final InsertSensorType xbInsertSensorType) { // add observable property final ParameterShell observedPropertyPS = parameters.getParameterShellWithServiceSidedName(REGISTER_SENSOR_OBSERVED_PROPERTY_PARAMETER); if (observedPropertyPS != null) { if (observedPropertyPS.hasSingleSpecifiedValue()) { xbInsertSensorType.addObservableProperty((String) observedPropertyPS.getSpecifiedValue()); } else { final String[] properties = observedPropertyPS.getSpecifiedTypedValueArray(String[].class); for (final String property : properties) { xbInsertSensorType.addObservableProperty(property); } } } }
@Override public String buildDescribeSensorRequest(final ParameterContainer parameters) throws OXFException { final DescribeSensorDocument descSensorDoc = DescribeSensorDocument.Factory.newInstance(); final DescribeSensorType descSensor = descSensorDoc.addNewDescribeSensor(); // set required elements: descSensor.setService((String) parameters.getParameterShellWithServiceSidedName(SERVICE) .getSpecifiedValue()); descSensor.setVersion((String) parameters.getParameterShellWithServiceSidedName(VERSION) .getSpecifiedValue()); processProcedure(descSensor, getShellForServerParameter(parameters, DESCRIBE_SENSOR_PROCEDURE_PARAMETER)); processProcedureDescriptionFormat(descSensor, getShellForServerParameter(parameters, DESCRIBE_SENSOR_PROCEDURE_DESCRIPTION_FORMAT)); doLaxRequestValidation(descSensorDoc); return descSensorDoc.xmlText(XmlUtil.FAST); }
@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); }
ParameterShell observedPropertyPS = paramCon.getParameterShellWithServiceSidedName("observedProperty"); if (observedPropertyPS.hasMultipleSpecifiedValues()) { observedProperties = observedPropertyPS.getSpecifiedTypedValueArray(String[].class);
ParameterShell observedPropertyPS = paramCon.getParameterShellWithServiceSidedName("observedProperty"); String[] observedProperties = observedPropertyPS.getSpecifiedTypedValueArray(String[].class);
private void addResultTime(final ParameterContainer parameters, final OMObservationType xbObservation) throws OXFException { // add resultTime final Object resultTimeObj = parameters .getParameterShellWithServiceSidedName(INSERT_OBSERVATION_RESULT_TIME).getSpecifiedValue(); if (resultTimeObj instanceof TimePosition) { addResultTimeObject(xbObservation, (TimePosition) resultTimeObj); } else if (isObjStringAndInDocumentReference(resultTimeObj)){ // add resultTime as reference xbObservation.addNewResultTime().setHref((String) resultTimeObj); } else if (resultTimeObj instanceof String) { final ITime time = getITimeFromString((String)resultTimeObj); if (time != null && time instanceof TimePosition) { addResultTimeObject(xbObservation, (TimePosition) time); } else { throw createException("resultTime", resultTimeObj); } } else { throw createException("resultTime", resultTimeObj); } }
@Override public String buildGetObservationByIDRequest(final ParameterContainer parameters) throws OXFException { final GetObservationByIdDocument xbGetOBsByIdDoc = GetObservationByIdDocument.Factory.newInstance(); final GetObservationByIdType xbGetObsById = xbGetOBsByIdDoc.addNewGetObservationById(); xbGetObsById.setService("SOS"); xbGetObsById.setVersion("2.0.0"); final ParameterShell observationIds = parameters.getParameterShellWithServiceSidedName(GET_OBSERVATION_BY_ID_OBSERVATION_ID_PARAMETER); if (observationIds != null) { if (observationIds.hasSingleSpecifiedValue()) { xbGetObsById.addObservation((String)observationIds.getSpecifiedValue()); } else { for (final String observationId : observationIds.getSpecifiedTypedValueArray(String[].class)) { xbGetObsById.addObservation(observationId); } } doLaxRequestValidation(xbGetOBsByIdDoc); return xbGetOBsByIdDoc.xmlText(XmlUtil.PRETTYPRINT); } throw new OXFException("Parameter 'GET_OBSERVATION_BY_ID_OBSERVATION_ID_PARAMETER' is mandatory!"); }
parameters.getParameterShellWithServiceSidedName(INSERT_OBSERVATION_PHENOMENON_TIME) .getSpecifiedValue();