Package com.iizix.urn

Class URNResource

  • Direct Known Subclasses:

    public abstract class URNResource
    extends URN
    The URN resource contains information of for local server environment from where it was originated. Thus the final URL could vary depending on the server and/or cluster configuration.
    Christopher Mindus
    • Constructor Detail

      • URNResource

        protected URNResource​(java.lang.String urnString,
                              URNResourceType type,
                              java.lang.Object id)
        Constructs a URNResource from a string that has contains the media type followed by Base64 encoded data.
        urnString - The URN string formatted the "iizi" way.
        ValueException - If there is a problem with the URN parsing, e.g. the string doesn't start with "urn:".
        java.lang.NullPointerException - If the urnString, type or id is null.
    • Method Detail

      • setUserProfileImageURNProvider

        public static void setUserProfileImageURNProvider​(IFileURNProvider provider)
        Assigns the File URN provider. This is an IIZI internal method. This method cannot only be called from the server and should not be called elsewhere.
        java.lang.NullPointerException - If provider is null.
        java.lang.IllegalStateException - If called twice or outside the server.
      • getType

        public final URNResourceType getType()
        Gets the resource type.
        The resource type.
      • getID

        public final java.lang.Object getID()
        Returns the ID used for the resource. The ID is of type Long for ID's of a User ID, Group or a String for Application ID.
      • getURL

        public final java.lang.String getURL()
        Gets the URL of this resource relative the current web server.
        Specified by:
        getURL in class URN
        The URL relative the current server, if based on the current server.
        Throws: - If there was a problem retrieving the file or an SQL error.
      • isURNResource

        public final boolean isURNResource()
        Checks if this URN instance is a .
        isURNResource in class URN
        Always true as the instance is always a type.
      • asURNResource

        public final URNResource asURNResource()
        Gets this instance as type.
        asURNResource in class URN
        The instance, always non-null.
      • isImageTargetSupported

        public boolean isImageTargetSupported()
        Checks if this instance supports returning the image target interface {@link IImageTarget}.
        isImageTargetSupported in class URN
        true if the URN supports the image target interface, false (default) otherwise.
      • getImageTarget

        public IImageTarget getImageTarget()
        Gets the image target interface for this URN instance, if supported.
        getImageTarget in class URN
        The image target interface, or null (default) if not supported.
      • hashCode

        public final int hashCode()
        Gets the hash code of the instance. The original URN string is not used for this hash code, rather the URN 'NID' and the parameters.
        Specified by:
        hashCode in class URN
        A hash code value.
      • equals

        public final boolean equals​(java.lang.Object obj)
        Checks if another URN is equal to this one. The original URN string is not used for this comparison, rather the URN 'NID' and the parameters.
        Specified by:
        equals in class URN
        obj - The other object to compare with.
        true if the URN's are equal, false otherwise.
      • getParamString

        public final java.lang.String getParamString()
        Gets the parameter string for the URN.toString() method.
        Specified by:
        getParamString in class URN
        The parameter string, always non-null.