/** * 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 ); }
return getMessage( key, arguments ); overrideMessages( fileName, p ); fileName = "/messages_en.properties"; overrideMessages( fileName, p ); fileName = "messages_" + l + ".properties"; overrideMessages( fileName, p ); fileName = "/messages_" + l + ".properties"; overrideMessages( fileName, p ); } catch ( IOException e ) { LOG.error( "Error loading language file for language '" + l + "': ", e ); return get( props.get( loc ), key, arguments );
/** * Returns the transaction to the datastore. This makes the transaction available to other clients again (via * {@link #acquireTransaction()}. * <p> * The transaction should be terminated, i.e. commit() or rollback() must have been called before. * </p> * * @param ta * the transaction to be released, must not be <code>null</code> * @param newFeatures * @throws FeatureStoreException */ void releaseTransaction( MemoryFeatureStoreTransaction ta, StoredFeatures newFeatures ) throws FeatureStoreException { if ( ta.getStore() != this ) { String msg = Messages.getMessage( "TA_NOT_OWNER" ); throw new FeatureStoreException( msg ); } if ( ta != this.activeTransaction ) { String msg = Messages.getMessage( "TA_NOT_ACTIVE" ); throw new FeatureStoreException( msg ); } if ( newFeatures != null ) { storedFeatures = newFeatures; } this.activeTransaction = null; this.transactionHolder = null; // notifyAll(); }
/** * Parses the feature id attribute from the feature <code>START_ELEMENT</code> event that the given * <code>XMLStreamReader</code> points to. * <p> * Looks after 'gml:id' (GML 3) first, if no such attribute is present, the 'fid' (GML 2) attribute is used. * * @param xmlReader * must point to the <code>START_ELEMENT</code> event of the feature * @return the feature id, or "" (empty string) if neither a 'gml:id' nor a 'fid' attribute is present */ protected String parseFeatureId( XMLStreamReaderWrapper xmlReader ) { String fid = xmlReader.getAttributeValue( gmlNs, GMLID ); if ( fid == null ) { fid = xmlReader.getAttributeValue( null, FID ); } // Check that the feature id has the correct form. "fid" and "gml:id" are both based on the XML type "ID": // http://www.w3.org/TR/xmlschema11-2/#NCName Thus, they must match the NCName production rule. This means that // they may not contain a separating colon (only at the first position a colon is allowed) and must not start // with a digit. if ( fid != null && fid.length() > 0 && !fid.matches( "[^\\d][^:]+" ) ) { String msg = Messages.getMessage( "ERROR_INVALID_FEATUREID", fid ); throw new IllegalArgumentException( msg ); } return fid; } }
/** * Returns the feature type with the given name. * <p> * If no feature type with the given name is defined, an XMLParsingException is thrown. * * @param xmlStreamReader * * @param ftName * feature type name to look up * @return the feature type with the given name * @throws XMLParsingException * if no feature type with the given name is defined */ private FeatureType lookupFeatureType( XMLStreamReaderWrapper xmlStreamReader, QName ftName, boolean exception ) throws XMLParsingException { FeatureType ft = null; ft = schema.getFeatureType( ftName ); if ( ft == null ) { ft = WellKnownGMLTypes.getType( ftName ); } if ( ft == null && exception ) { String msg = Messages.getMessage( "ERROR_SCHEMA_FEATURE_TYPE_UNKNOWN", ftName ); throw new XMLParsingException( xmlStreamReader, msg ); } return ft; }
/** * Returns the feature type with the given name. * <p> * If no feature type with the given name is defined, an XMLParsingException is thrown. * * @param xmlStreamReader * * @param ftName * feature type name to look up * @return the feature type with the given name * @throws XMLParsingException * if no feature type with the given name is defined */ private FeatureType lookupFeatureType( XMLStreamReaderWrapper xmlStreamReader, QName ftName, boolean exception ) throws XMLParsingException { FeatureType ft = null; ft = schema.getFeatureType( ftName ); if ( ft == null ) { ft = WellKnownGMLTypes.getType( ftName ); } if ( ft == null && exception ) { String msg = Messages.getMessage( "ERROR_SCHEMA_FEATURE_TYPE_UNKNOWN", ftName ); throw new XMLParsingException( xmlStreamReader, msg ); } return ft; }
String msg = Messages.getMessage( "LOCK_DB_CREATE_ERROR", e.getMessage() ); LOG.error( msg, e ); throw new FeatureStoreException( msg, e );
String schemaLocation = xmlStream.getAttributeValue( XSINS, "schemaLocation" ); if ( schemaLocation == null ) { LOG.warn( Messages.getMessage( "NO_SCHEMA_LOCATION", xmlStream.getSystemId() ) ); return new DynamicAppSchema(); LOG.warn( Messages.getMessage( "ERROR_SCHEMA_LOCATION_TOKENS_COUNT", xmlStream.getSystemId() ) ); return new DynamicAppSchema(); LOG.warn( Messages.getMessage( "INVALID_SCHEMA_LOCATION", xmlStream.getSystemId() ) ); return new DynamicAppSchema(); schema = decoder.extractAppSchema(); } catch ( Throwable t ) { LOG.warn( Messages.getMessage( "BROKEN_SCHEMA", xmlStream.getSystemId(), t.getMessage() ), t ); return new DynamicAppSchema();
rs = stmt.executeQuery( "SELECT ACQUIRED,EXPIRES FROM LOCKS WHERE ID=" + lockIdInt + "" ); if ( !rs.next() ) { String msg = Messages.getMessage( "LOCK_NO_SUCH_ID", lockId ); throw new LockHasExpiredException( msg, "lockId" );
private void checkIfFeaturesAreNotLocked( IdFilter filter, Lock lock ) throws FeatureStoreException { String lockId = lock != null ? lock.getId() : null; // check if all features can be deleted for ( ResourceId id : filter.getSelectedIds() ) { if ( !fs.getLockManager().isFeatureModifiable( id.getRid(), lockId ) ) { if ( lockId == null ) { throw new MissingParameterException( getMessage( "TA_DELETE_LOCKED_NO_LOCK_ID", id.getRid() ), "lockId" ); } throw new InvalidParameterValueException( getMessage( "TA_DELETE_LOCKED_WRONG_LOCK_ID", id.getRid() ), "lockId" ); } } }
String msg = Messages.getMessage( "ERROR_FEATURE_ID_NOT_UNIQUE", fid ); throw new XMLParsingException( xmlStream, msg );
if ( id != null && !"".equals( id ) ) { if ( idContext.getObject( id ) != null ) { String msg = Messages.getMessage( "ERROR_FEATURE_ID_NOT_UNIQUE", id ); throw new XMLParsingException( xmlStream, msg );
String msg = Messages.getMessage( "ERROR_PROPERTY_TOO_MANY_OCCURENCES", propName, activeDecl.getMaxOccurs(), ft.getName() ); throw new XMLParsingException( xmlStream, msg ); String msg = null; if ( activeDecl.getMinOccurs() == 1 ) { msg = Messages.getMessage( "ERROR_PROPERTY_MANDATORY", activeDecl.getName(), ft.getName() ); } else { msg = Messages.getMessage( "ERROR_PROPERTY_TOO_FEW_OCCURENCES", activeDecl.getName(), activeDecl.getMinOccurs(), ft.getName() ); String msg = Messages.getMessage( "ERROR_PROPERTY_UNEXPECTED", propName, ft.getName() ); throw new XMLParsingException( xmlStream, msg );
if ( !lockManager.isFeatureModifiable( id.getRid(), lockId ) ) { if ( lockId == null ) { throw new MissingParameterException( getMessage( "TA_DELETE_LOCKED_NO_LOCK_ID", id.getRid() ), "lockId" ); throw new InvalidParameterValueException( getMessage( "TA_DELETE_LOCKED_WRONG_LOCK_ID", id.getRid() ), "lockId" );
String msg = Messages.getMessage( "ERROR_PROPERTY_TOO_MANY_OCCURENCES", propName, activeDecl.getMaxOccurs(), type.getName() ); throw new XMLParsingException( xmlStream, msg ); String msg = null; if ( activeDecl.getMinOccurs() == 1 ) { msg = Messages.getMessage( "ERROR_PROPERTY_MANDATORY", activeDecl.getName(), type.getName() ); } else { msg = Messages.getMessage( "ERROR_PROPERTY_TOO_FEW_OCCURENCES", activeDecl.getName(), activeDecl.getMinOccurs(), type.getName() ); String msg = Messages.getMessage( "ERROR_PROPERTY_UNEXPECTED", propName, type.getName() ); throw new XMLParsingException( xmlStream, msg );
if ( fid != null && !"".equals( fid ) ) { if ( idContext.getObject( fid ) != null ) { String msg = Messages.getMessage( "ERROR_FEATURE_ID_NOT_UNIQUE", fid ); throw new XMLParsingException( xmlStream, msg );
FeatureType ft = fs.getSchema().getFeatureType( ftName ); if ( ft == null ) { throw new FeatureStoreException( getMessage( "TA_OPERATION_FT_NOT_SERVED", ftName ) ); if ( !lockManager.isFeatureModifiable( feature.getId(), lockId ) ) { if ( lockId == null ) { throw new MissingParameterException( getMessage( "TA_DELETE_LOCKED_NO_LOCK_ID", feature.getId() ), "lockId" ); throw new InvalidParameterValueException( getMessage( "TA_DELETE_LOCKED_WRONG_LOCK_ID", feature.getId() ), "lockId" );
throw new FeatureStoreException( getMessage( "TA_OPERATION_FT_NOT_SERVED", ftName ) ); if ( !lockManager.isFeatureModifiable( feature.getId(), lockId ) ) { if ( lockId == null ) { throw new MissingParameterException( getMessage( "TA_UPDATE_LOCKED_NO_LOCK_ID", feature.getId() ), "lockId" ); throw new InvalidParameterValueException( getMessage( "TA_UPDATE_LOCKED_WRONG_LOCK_ID", feature.getId() ), "lockId" );
FeatureType presentFt = lookupFeatureType( xmlStream, xmlStream.getName(), true ); if ( !schema.isSubType( expectedFt, presentFt ) ) { String msg = Messages.getMessage( "ERROR_PROPERTY_WRONG_FEATURE_TYPE", expectedFt.getName(), propName, presentFt.getName() ); throw new XMLParsingException( xmlStream, msg );