/** * Short version for lazy people. * * @param key * @param arguments * @return the same as #getMessage */ public static String get( String key, Object... arguments ) { return getMessage( key, arguments ); }
/** * Returns the message assigned to the passed key. If no message is assigned, an error message will be returned that * indicates the missing key. * * @see MessageFormat for conventions on string formatting and escape characters. * * @param key * @param arguments * @return the message assigned to the passed key */ public static String getMessage( String key, Object... arguments ) { return get( defaultProps, key, arguments ); }
private Boolean parseLockAction( String lockActionStr ) { Boolean lockAll = null; if ( lockActionStr != null ) { if ( "ALL".equals( lockActionStr ) ) { lockAll = true; } else if ( "SOME".equals( lockActionStr ) ) { lockAll = false; } else { String msg = Messages.get( "WFS_UNKNOWN_LOCK_ACTION", lockActionStr ); throw new XMLParsingException( this, rootElement, msg ); } } return lockAll; }
private Boolean parseLockAction( String lockActionStr ) { Boolean lockAll = null; if ( lockActionStr != null ) { if ( "ALL".equals( lockActionStr ) ) { lockAll = true; } else if ( "SOME".equals( lockActionStr ) ) { lockAll = false; } else { String msg = Messages.get( "WFS_UNKNOWN_LOCK_ACTION", lockActionStr ); throw new XMLParsingException( this, rootElement, msg ); } } return lockAll; } }
/** * Returns the object representation for the given <code>wfs:Insert</code> element. * <p> * NOTE: In order to allow stream-oriented processing, this method does *not* consume all events corresponding to * the <code>wfs:Insert</code> element from the given <code>XMLStream</code>. After a call to this method, the XML * stream points at the <code>START_ELEMENT</code> of the insert payload. * </p> * * @param xmlStream * cursor must point at the <code>START_ELEMENT</code> event (<wfs:Insert>) * @return corresponding {@link Insert} object, never <code>null</code> * @throws NoSuchElementException * @throws XMLStreamException * @throws XMLParsingException */ Insert readInsert( XMLStreamReader xmlStream ) throws XMLStreamException { // optional: '@handle' String handle = xmlStream.getAttributeValue( null, "handle" ); if ( xmlStream.nextTag() != START_ELEMENT ) { throw new XMLParsingException( xmlStream, Messages.get( "WFS_INSERT_MISSING_FEATURE_ELEMENT" ) ); } return new Insert( handle, null, null, null, xmlStream ); }
/** * Returns the object representation for the given <code>wfs:Replace</code> element. * <p> * NOTE: In order to allow stream-oriented processing, this method does *not* consume all events corresponding to * the <code>wfs:Replace</code> element from the given <code>XMLStream</code>. After a call to this method, the XML * stream points at the <code>START_ELEMENT</code> of the replacement feature. The replacement feature is followed * by a <code>fes:Filter</code> element. * </p> * * @param xmlStream * cursor must point at the <code>START_ELEMENT</code> event (<wfs:Replace>) * @return corresponding {@link Replace} object, never <code>null</code> * @throws NoSuchElementException * @throws XMLStreamException * @throws XMLParsingException */ Replace readReplace( XMLStreamReader xmlStream ) throws NoSuchElementException, XMLStreamException { // <xsd:attribute name="handle" type="xsd:string"/> String handle = xmlStream.getAttributeValue( null, "handle" ); nextElement( xmlStream ); if ( !xmlStream.isStartElement() ) { throw new XMLParsingException( xmlStream, Messages.get( "WFS_REPLACE_MISSING_FEATURE_ELEMENT" ) ); } return new Replace( handle, xmlStream ); }
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 ) ); }
/** * Parses a WFS <code>GetGmlObject</code> document into a {@link GetGmlObject} request. * <p> * Supported versions: * <ul> * <li>WFS 1.1.0</li> * </ul> * * @return parsed {@link GetGmlObject} request * @throws XMLParsingException * if a syntax error occurs in the XML * @throws MissingParameterException * if the request version is unsupported * @throws InvalidParameterValueException * if a parameter contains a syntax error */ public GetGmlObject parse() { Version version = determineVersion110Safe(); GetGmlObject result = null; if ( VERSION_110.equals( version ) ) { result = parse110(); } else { String msg = Messages.get( "UNSUPPORTED_VERSION", version, Version.getVersionsString( VERSION_110 ) ); throw new InvalidParameterValueException( msg ); } 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; }
/** * Parses a normalized KVP-map as a WFS {@link ListStoredQueries} request. * * @param kvpParams * normalized KVP-map; keys must be uppercase, each key only has one associated value * @return parsed {@link ListStoredQueries} request * @throws MissingParameterException * if the request version is unsupported * @throws InvalidParameterValueException * if a parameter contains a syntax error */ public static ListStoredQueries parse( Map<String, String> kvpParams ) throws MissingParameterException, InvalidParameterValueException { Version version = Version.parseVersion( KVPUtils.getRequired( kvpParams, "VERSION" ) ); if ( !( VERSION_200.equals( version ) ) ) { String msg = Messages.get( "UNSUPPORTED_VERSION", version, Version.getVersionsString( VERSION_200 ) ); throw new InvalidParameterValueException( msg ); } return new ListStoredQueries( version, null ); } }
/** * Parses the {@link GetRecordById} kvp request and decides which version has to parse because of the requested * version * * @param normalizedKVPParams * that are requested containing all mandatory and optional parts regarding CSW spec * @return {@link GetRecordById} * @throws MetadataStoreException */ public static GetRecordById parse( Map<String, String> normalizedKVPParams, String defaultOutputFormat, String defaultOuputSchema ) { Version version = Version.parseVersion( KVPUtils.getRequired( normalizedKVPParams, "VERSION" ) ); GetRecordById result = null; if ( VERSION_202.equals( version ) ) { result = parse202( VERSION_202, normalizedKVPParams, defaultOutputFormat, defaultOuputSchema ); } else { String msg = Messages.get( "UNSUPPORTED_VERSION", version, Version.getVersionsString( VERSION_202 ) ); throw new InvalidParameterValueException( msg ); } return result; }
/** * Parses the {@link DescribeRecord} XML request. * * @param version * @return {@link DescribeRecord} */ public DescribeRecord parse( Version version ) { if ( version == null ) { version = Version.parseVersion( getRequiredNodeAsString( rootElement, new XPath( "@version", nsContext ) ) ); } DescribeRecord result = null; if ( VERSION_202.equals( version ) ) { result = parse202(); } else { String msg = Messages.get( "UNSUPPORTED_VERSION", version, Version.getVersionsString( VERSION_202 ) ); throw new InvalidParameterValueException( msg ); } return result; }
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 ); }
/** * Parses a normalized KVP-map as a WFS {@link DropStoredQuery} request. * * @param kvpParams * normalized KVP-map; keys must be uppercase, each key only has one associated value * @return parsed {@link DropStoredQuery} request * @throws MissingParameterException * if the request version is unsupported * @throws InvalidParameterValueException * if a parameter contains a syntax error */ public static DropStoredQuery parse( Map<String, String> kvpParams ) throws MissingParameterException, InvalidParameterValueException { Version version = Version.parseVersion( KVPUtils.getRequired( kvpParams, "VERSION" ) ); if ( !( VERSION_200.equals( version ) ) ) { String msg = Messages.get( "UNSUPPORTED_VERSION", version, Version.getVersionsString( VERSION_200 ) ); throw new InvalidParameterValueException( msg ); } String id = KVPUtils.getRequired( kvpParams, "STOREDQUERY_ID" ); return new DropStoredQuery( version, null, id ); } }
/** * Parses the {@link Transaction} XML request by deciding which version has to be parsed because of the requested * version. * * @param version * @return {@link Transaction} */ public Transaction parse( Version version ) { if ( version == null ) { version = Version.parseVersion( getRequiredNodeAsString( rootElement, new XPath( "@version", nsContext ) ) ); } Transaction result = null; if ( VERSION_202.equals( version ) ) { result = parse202(); } else { String msg = Messages.get( "UNSUPPORTED_VERSION", version, Version.getVersionsString( VERSION_202 ) ); throw new InvalidParameterValueException( msg ); } return result; }
/** * Parses the {@link GetRecords} XML request by deciding which version has to be parsed because of the requested * version. * * @param version * @return {@Link GetRecords} */ public GetRecords parse( Version version, String defaultOutputFormat, String defaultOutputSchema ) { if ( version == null ) { version = Version.parseVersion( getRequiredNodeAsString( rootElement, new XPath( "@version", nsContext ) ) ); } GetRecords result = null; if ( VERSION_202.equals( version ) ) { result = parse202( 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 ); } }
/** * Parses the {@link GetRecordById} XML request by deciding which version has to be parsed because of the requested * version. * * @param requestVersion * @return {@link GetRecordById} */ public GetRecordById parse( Version requestVersion, String defaultOutputFormat, String defaultOutputSchema ) { if ( requestVersion == null ) { requestVersion = Version.parseVersion( getRequiredNodeAsString( rootElement, new XPath( "@version", nsContext ) ) ); } GetRecordById result = null; if ( VERSION_202.equals( requestVersion ) ) { result = parse202( defaultOutputFormat, defaultOutputSchema ); } else { String msg = Messages.get( "UNSUPPORTED_VERSION", requestVersion, Version.getVersionsString( VERSION_202 ) ); throw new InvalidParameterValueException( msg ); } return result; }
result = parse200(); } else { String msg = Messages.get( "UNSUPPORTED_VERSION", version, Version.getVersionsString( VERSION_100, VERSION_110, VERSION_200 ) ); throw new InvalidParameterValueException( msg );
result = parse200(); } else { String msg = Messages.get( "UNSUPPORTED_VERSION", version, Version.getVersionsString( VERSION_100, VERSION_110, VERSION_200 ) ); throw new InvalidParameterValueException( msg );