@Override public Version checkVersion( Version version ) { if ( VERSION_100.equals( version ) ) return VERSION_202; return version; }
@Override public String getGetRecordByIdSchemaLocation( Version version ) { if ( VERSION_202.equals( version ) ) { return CSW_202_NS + " " + CSW_202_DISCOVERY_SCHEMA; } return null; }
private void writeAdditionalObjectsEnd( XMLStreamWriter xmlStream, Version requestVersion ) throws XMLStreamException { if ( requestVersion.equals( VERSION_200 ) ) { xmlStream.writeEndElement(); xmlStream.writeEndElement(); } }
private void writeAdditionalObjectsStart( XMLStreamWriter xmlStream, Version requestVersion ) throws XMLStreamException { if ( requestVersion.equals( VERSION_200 ) ) { xmlStream.writeStartElement( "wfs", "additionalObjects", WFS_200_NS ); xmlStream.writeStartElement( "wfs", "SimpleFeatureCollection", WFS_200_NS ); } else { xmlStream.writeComment( "Additional features (subfeatures of requested features)" ); } }
/** * * @param version * of the suspected protocol. * @return the name as it is define in the spec for given protocol version. */ public String getProtocolName( Version version ) { if ( VERSION_100.equals( version ) ) { return name_1_0_0; } return name(); }
public void export() throws XMLStreamException { if ( VERSION_202.equals( version ) || VERSION_100.equals( version ) ) { export( writer, sections, identification, provider ); } else { throw new InvalidParameterValueException( "Supported versions are: '" + VERSION_202 + "'. Version '" + version + "' instead is not supported." ); } }
@Override public XMLExceptionSerializer getExceptionSerializer( Version requestVersion ) { XMLExceptionSerializer serializer = getDefaultExceptionSerializer(); if ( VERSION_100.equals( requestVersion ) ) { serializer = new PreOWSExceptionReportSerializer( "application/vnd.ogc.se_xml" ); } else if ( VERSION_110.equals( requestVersion ) ) { serializer = new OWS100ExceptionReportSerializer(); } else if ( VERSION_200.equals( requestVersion ) ) { serializer = new OWS110ExceptionReportSerializer( VERSION_200 ); } return serializer; }
/** * Produces a <code>WFS_Capabilities</code> document compliant to the specified WFS version. * * @throws XMLStreamException * @throws IllegalArgumentException * if the specified version is not 1.0.0, 1.1.0 or 2.0.0 */ void export() throws XMLStreamException { if ( VERSION_100.equals( version ) ) { export100(); } else if ( VERSION_110.equals( version ) ) { export110(); } else if ( VERSION_200.equals( version ) ) { export200(); } else { throw new IllegalArgumentException( "Version '" + version + "' is not supported." ); } }
/** * Returns the enum constant that corresponds to the given {@link Version}. * * @param ogcVersion * version, must not be <code>null</code> * @return corresponding constant, never <code>null</code> * @throws IllegalArgumentException * if the version is not a known/supported WFS version */ public static WFSVersion valueOf( Version ogcVersion ) { for ( WFSVersion wfsVersion : values() ) { if ( wfsVersion.ogcVersion.equals( ogcVersion ) ) { return wfsVersion; } } String msg = "Version '" + ogcVersion + "' does not denote a known/supported WFS version."; throw new IllegalArgumentException( msg ); }
private void checkCapabilities() { List<Version> supportedVersions = getIdentification().getServiceTypeVersion(); for ( Version version : supportedVersions ) { if ( VERSION_111.equals( version ) || VERSION_130.equals( version ) ) { return; } } throw new IllegalArgumentException( get( "WMSCLIENT.WRONG_VERSION_CAPABILITIES", supportedVersions, VERSION_111 + ", " + VERSION_130 ) ); }
/** * @param map * @param version * @param service * @throws OWSException */ public GetFeatureInfo( Map<String, String> map, Version version ) throws OWSException { if ( version.equals( VERSION_111 ) ) { parse111( map ); } if ( version.equals( VERSION_130 ) ) { parse130( map ); } parameterMap.putAll( map ); scale = RenderHelper.calcScaleWMS130( width, height, bbox, crs, DEFAULT_PIXEL_SIZE ); }
public TransactionXmlReader createReader( Version version ) { if ( VERSION_100.equals( version ) ) { return new TransactionXmlReader100(); } else if ( VERSION_110.equals( version ) ) { return new TransactionXmlReader110(); } else if ( VERSION_200.equals( version ) ) { return new TransactionXmlReader200(); } String msg = Messages.get( "UNSUPPORTED_VERSION", version, Version.getVersionsString( VERSION_100, VERSION_110, VERSION_200 ) ); throw new InvalidParameterValueException( msg ); }
private void writeLockFeatureResponse( LockFeature request, HttpResponseBuffer response, Lock lock ) throws XMLStreamException, IOException, FeatureStoreException, OWSException { Version version = request.getVersion(); if ( VERSION_100.equals( version ) ) { writeLockFeatureResponse100( response, lock ); } else if ( VERSION_110.equals( version ) ) { writeLockFeatureResponse110( response, lock ); } else if ( VERSION_200.equals( version ) ) { writeLockFeatureResponse200( response, lock ); } else { String msg = "LockFeature for WFS version: " + request.getVersion() + " is not implemented yet."; throw new OWSException( msg, OPERATION_NOT_SUPPORTED ); } }
/** * Parses a WMS <code>GetCapabilities</code> document into a {@link GetCapabilities} request. * <p> * Supported versions: * <ul> * <li>1.3.0 (OWS 2.0.0)</li> * </ul> * * @param version * specifies the request version, may be <code>null</code> (version attribute is evaluated then) * @return parsed {@link GetCapabilities} request, never <code>null</code> * @throws IllegalArgumentException * if version is not supported */ public GetCapabilities parse( Version version ) { Version wmsVersion = detectVersion( version ); if ( VERSION_130.equals( wmsVersion ) ) return parse200(); throw new IllegalArgumentException( "Cannot parse Caapbilities request: Unsupported Version" ); }
protected WMSCapabilitiesAdapter getCapabilitiesAdapter( OMElement root, String version ) throws IOException { if ( version != null ) { wmsVersion = Version.parseVersion( version ); } else { LOG.warn( "No version attribute in WMS capabilities document. Defaulting to 1.1.1." ); wmsVersion = VERSION_111; } if ( VERSION_111.equals( wmsVersion ) ) { return new WMS111CapabilitiesAdapter( root ); } else if ( VERSION_130.equals( wmsVersion ) ) { return new WMS130CapabilitiesAdapter( root ); } throw new IllegalArgumentException( get( "WMSCLIENT.WRONG_VERSION_CAPABILITIES", getIdentification().getServiceTypeVersion(), VERSION_111 + ", " + VERSION_130 ) ); }
private boolean axisFlipped( ICRS crs ) { if ( crs.getAlias().startsWith( "EPSG:" ) ) { crs = CRSManager.getCRSRef( "urn:ogc:def:crs:EPSG::" + crs.getAlias().substring( 5 ) ); } return wmsVersion.equals( VERSION_111 ) || crs.getAxis()[0].getOrientation() == Axis.AO_EAST; }
private void checkGetFeatureWithLockRequest( Version requestVersion, GetFeatureWithLock getFeatureWithLock ) { if ( VERSION_200.equals( requestVersion ) && HITS.equals( getFeatureWithLock.getPresentationParams().getResultType() ) ) throw new InvalidParameterValueException( "ResultType 'hits' is not allowed in GetFeatureWithLock requests!" ); }
private static Version parseVersion( Map<String, String> kvp ) throws OWSException { String version = KVPUtils.getRequired( kvp, "VERSION" ); if ( !Version.parseVersion( version ).equals( VERSION_100 ) ) { throw new OWSException( "Version must be: " + VERSION_100.toString(), OWSException.INVALID_PARAMETER_VALUE ); } return VERSION_100; } }
public static GetRepositoryItem parse( Map<String, String> normalizedKVPParams ) { Version version = Version.parseVersion( KVPUtils.getRequired( normalizedKVPParams, "VERSION" ) ); if ( VERSION_202.equals( version ) || VERSION_100.equals( version ) ) { return new GetRepositoryItem( KVPUtils.getRequired( normalizedKVPParams, "ID" ) ); } else { String msg = Messages.get( "UNSUPPORTED_VERSION", version, Version.getVersionsString( VERSION_202 ) + Version.getVersionsString( VERSION_100 ) ); throw new InvalidParameterValueException( msg ); } }
/** * Parses a <code>GetPropertyValue</code> element into a {@link GetPropertyValue} object. * * @return parsed {@link GetPropertyValue} request, never <code>null</code> * @throws OWSException */ public GetPropertyValue parse() throws OWSException { Version version = Version.parseVersion( getNodeAsString( rootElement, new XPath( "@version", nsContext ), null ) ); GetPropertyValue result = null; if ( VERSION_200.equals( version ) ) { result = parse200(); } else { String msg = "Version '" + version + "' is not supported for GetPropertyValue requests. The only supported version is 2.0.0."; throw new OWSException( msg, VERSION_NEGOTIATION_FAILED, null ); } return result; }