/** * Returns the old-style version information (used by pre-OWS GetCapabilities requests, see section D.11 of OGC * 06-121r3). * * @return old-style version information, may be <code>null</code> (if this is an OWS-style request or an pre-OWS * request without version specification) * @throws InvalidParameterValueException * if any of the versions is not syntactically correct */ public Version getVersionAsVersion() throws InvalidParameterValueException { return Version.parseVersion( version ); }
private WFSVersion( String ogcVersion, String ns ) { this.ogcVersion = Version.parseVersion( ogcVersion ); this.ns = ns; }
/** * Returns the acceptable versions in order of client preference (most preferred version first). * * @see Version * * @return the acceptable versions, in order of preference, may be empty, but not <code>null</code> * @throws InvalidParameterValueException * if any of the versions is not syntactically correct */ public List<Version> getAcceptVersionsAsVersions() throws InvalidParameterValueException { List<Version> versions = new ArrayList<Version>( acceptVersions.size() ); for ( String version : acceptVersions ) { versions.add( Version.parseVersion( version ) ); } return versions; }
@Override public XMLExceptionSerializer getExceptionSerializer( Version requestVersion ) { return new CswExceptionReportSerializer( Version.parseVersion( "1.2.0" ) ); }
public Version getNodeAsVersion( OMElement context, XPath xpath, Version defaultValue ) throws XMLParsingException { Version value = defaultValue; String s = getNodeAsString( context, xpath, null ); if ( s != null ) { value = Version.parseVersion( s ); } return value; }
/** * Returns the {@link ExceptionSerializer} for the given request version. * * @param requestVersion * version of the request, may be <code>null</code> (implies that the serializer for the highest * supported version shall be returned) * @return suitable XML serializer, never <code>null</code> */ public XMLExceptionSerializer getExceptionSerializer( Version requestVersion ) { return new OWS110ExceptionReportSerializer( Version.parseVersion( "1.1.0" ) ); }
private Version getVersion( String versionString ) throws OWSException { Version version = null; if ( versionString != null ) { try { version = Version.parseVersion( versionString ); } catch ( IllegalArgumentException e ) { throw new OWSException( "Specified request version '" + versionString + "' is not a valid OGC version string.", OWSException.INVALID_PARAMETER_VALUE ); } } return version; }
public TransactionXmlReader createReader( XMLStreamReader xmlStream ) { Version version = null; if ( WFS_NS.equals( xmlStream.getNamespaceURI() ) ) { String s = getAttributeValue( xmlStream, "version" ); if ( s == null ) { s = "1.1.0"; } version = parseVersion( s ); } else { version = parseVersion( getRequiredAttributeValue( xmlStream, "version" ) ); } return createReader( version ); } }
private Version getVersion( String versionString ) throws OWSException { Version version = null; if ( versionString != null && !"".equals( versionString ) ) { try { version = Version.parseVersion( versionString ); } catch ( InvalidParameterValueException e ) { throw new OWSException( e.getMessage(), OWSException.INVALID_PARAMETER_VALUE, "version" ); } } return version; }
private Version parseVersion( String versionString ) throws OWSException { if ( versionString != null && !"".equals( versionString ) ) { try { return Version.parseVersion( versionString ); } catch ( InvalidParameterValueException e ) { throw new OWSException( e.getMessage(), OWSException.INVALID_PARAMETER_VALUE, "version" ); } } return null; }
/** * Parses the {@link DescribeRecord} KVP request and decides which version has to parse because of the requested * version. * * @param normalizedKVPParams * that are requested as key to a value. * @return {@link DescribeRecord} */ public static DescribeRecord parse( Map<String, String> normalizedKVPParams ) { Version version = Version.parseVersion( KVPUtils.getRequired( normalizedKVPParams, "VERSION" ) ); return parse202( version, normalizedKVPParams ); }
private void sendServiceException( OWSException ex, HttpResponseBuffer response ) throws ServletException { sendException( null, getExceptionSerializer( parseVersion( "1.2.0" ) ), ex, response ); }
/** * @param requestedVersions * @throws ResourceInitException */ protected final void validateAndSetOfferedVersions( Collection<String> requestedVersions ) throws ResourceInitException { for ( String requestedVersion : requestedVersions ) { Version version = Version.parseVersion( requestedVersion ); if ( !( ( (OWSProvider) metadata.getProvider() ).getImplementationMetadata().getImplementedVersions().contains( Version.parseVersion( requestedVersion ) ) ) ) { String msg = "Version '" + requestedVersion + "' is not supported by the service implementation."; throw new ResourceInitException( msg ); } offeredVersions.add( version ); } }
/** * @param kvp * @return a DescribeCoverage object with all requested coverages */ public static DescribeCoverage parse( Map<String, String> kvp ) { List<String> coverages = KVPUtils.splitAll( kvp, "COVERAGE" ); String version = KVPUtils.getDefault( kvp, "VERSION", "1.0.0" ); return new DescribeCoverage( Version.parseVersion( version ), coverages ); } }
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; } }
private void sendSoapException( SOAPEnvelope soapDoc, SOAPFactory factory, HttpResponseBuffer response, OWSException e, ServletRequest request, SOAPVersion version ) throws OMException, ServletException { XMLExceptionSerializer serializer = getExceptionSerializer( parseVersion( "1.2.0" ) ); sendSOAPException( soapDoc.getHeader(), factory, response, e, serializer, null, null, request.getServerName(), request.getCharacterEncoding() ); }
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 ) ); }
/** * 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; }
/** * Parses the {@link GetRecords} kvp request and decides which version has to parse because of the requested version * * @param normalizedKVPParams * that are requested as key to a value. * @return {@link GetRecords} */ public static GetRecords parse( Map<String, String> normalizedKVPParams, String defaultOutputFormat, String defaultOutputSchema ) { Version version = Version.parseVersion( KVPUtils.getRequired( normalizedKVPParams, "VERSION" ) ); GetRecords result = null; if ( VERSION_202.equals( version ) ) { result = parse202( VERSION_202, normalizedKVPParams, defaultOutputFormat, defaultOutputSchema ); } else { String msg = Messages.get( "UNSUPPORTED_VERSION", version, Version.getVersionsString( VERSION_202 ) ); throw new InvalidParameterValueException( msg ); } return result; }
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 ); } }