Interface PropertySource


  • public interface PropertySource
    Defines a source of properties. This is used by both PROPFIND and PROPPATCH
    • Method Detail

      • getProperty

        Object getProperty​(QName name,
                           Resource r)
                    throws io.milton.http.exceptions.NotAuthorizedException
        Return the typed value of the given property. For example, if the property is a date/time value it should generally return a java.util.Date. Milton will take care of formatting types values into XML responses. If the current user cannot read the requested property throw a NotAuthorizedException, this will set the appropriate status against this
        Parameters:
        name -
        r -
        Returns:
        Throws:
        io.milton.http.exceptions.NotAuthorizedException
      • setProperty

        void setProperty​(QName name,
                         Object value,
                         Resource r)
                  throws PropertySource.PropertySetException,
                         io.milton.http.exceptions.NotAuthorizedException
        Update the given property to the value given. If the value is invalid throw a PropertySetException, and if the user is not permitted to update the property throw a NotAuthorizedException
        Parameters:
        name -
        value -
        r -
        Throws:
        com.bradmcevoy.property.PropertySource.PropertySetException
        io.milton.http.exceptions.NotAuthorizedException
        PropertySource.PropertySetException
      • getPropertyMetaData

        PropertySource.PropertyMetaData getPropertyMetaData​(QName name,
                                                            Resource r)
                                                     throws io.milton.http.exceptions.NotAuthorizedException,
                                                            io.milton.http.exceptions.BadRequestException
        Check to see if the property is known, and if it is writable. The returned value also contains a class which is the most specific known class of the values which can be contained in this property. This class must be sufficient to locate a ValueWriter to parse the textual representation sent in PROPPATCH requests.
        Parameters:
        name - - the qualified name of the property
        r - - the resource which might contain the property
        Returns:
        - never null, contains an enum value indicating if the property is known to this source, and if it is writable, and a class indicating the type of the property.
        Throws:
        io.milton.http.exceptions.NotAuthorizedException
        io.milton.http.exceptions.BadRequestException
      • clearProperty

        void clearProperty​(QName name,
                           Resource r)
                    throws PropertySource.PropertySetException,
                           io.milton.http.exceptions.NotAuthorizedException
        Remove the given property. There may be a semantic difference in some cases between setting a property to a null value vs removing the property. Generally this should completely the remove the property if possible.
        Parameters:
        name -
        r -
        Throws:
        PropertySource.PropertySetException
        io.milton.http.exceptions.NotAuthorizedException
      • getAllPropertyNames

        List<QName> getAllPropertyNames​(Resource r)
                                 throws io.milton.http.exceptions.NotAuthorizedException,
                                        io.milton.http.exceptions.BadRequestException
        Parameters:
        r - - the resource which may contain properties
        Returns:
        - all properties known by this source on the given resource. This list should be exclusive. Ie only return properties not returned by any other source
        Throws:
        io.milton.http.exceptions.NotAuthorizedException
        io.milton.http.exceptions.BadRequestException