Class FileURNFactory

  • All Implemented Interfaces:
    IFileURNProvider, IURNProvider

    public final class FileURNFactory
    extends java.lang.Object
    implements IFileURNProvider
    The File URN provider depends on the URNResourceType and an identifier, where the identifier is either a String for URNResourceType.

    File URN's are encoded in IIZI as:

    urn:iz-file:type:identifier

    where the valid {code type}s are (in lower case):

    • {@link URNResourceType#COMMON_DATABASE_PERSISTENT}: Common server files stored in database (cached on the server even for starts/stops),
    • {@link URNResourceType#COMMON_PERSISTENT}: Common server files (persists when server starts/stops),
    • {@link URNResourceType#COMMON_VOLATILE}: Common server files (volatile when server starts/stops),
    • {@link URNResourceType#EXTERNAL_FILES}: External files (typically accessible using the 'file:' protocol),
    • {@link URNResourceType#APPLICATION_DATABASE_PERSISTENT}: Application files in database,
    • {@link URNResourceType#APPLICATION_PERSISTENT}: Application files,
    • {@link URNResourceType#APPLICATION_VOLATILE}: Application files,
    • {@link URNResourceType#GROUP_DATABASE_FILES}: Private user group files stored in database (cached on server),
    • {@link URNResourceType#USER_FILES}: Private user files,
    • {@link URNResourceType#USER_DATABASE_FILES}: Private user files stored in database (cached on server),
    • {@link URNResourceType#APP_SESSION}: Application session files,
    • {@link URNResourceType#CLIENT_SESSION}: Client session files.

    The identifier is file identifier in the type identifier.

    Author:
    Christopher Mindus
    • Method Detail

      • initialize

        public static void initialize​(URNFactory factory,
                                      IFileURNProvider provider)
        Initializes the File URN factory.
        Parameters:
        factory - The main URN factory.
        provider - The file provider.
      • getInstance

        public static FileURNFactory getInstance()
        Gets the singleton instance of the File URN factory.
        Returns:
        The File URN factory instance, or null if not yet initialized.
      • getResourceTypes

        public java.util.List<URNResourceType> getResourceTypes()
        Gets the URN Resource Type supported by the provider.
        Specified by:
        getResourceTypes in interface IURNProvider
        Returns:
        The supported resource type, empty list when not resource based.
      • parse

        public FileURN parse​(java.lang.String urnString,
                             java.lang.String nss,
                             java.lang.String req,
                             java.lang.String query,
                             java.lang.String fragment)
                      throws URNException
        Parses the URN after the NID specification, i.e. after "urn:NID:".
        Specified by:
        parse in interface IURNProvider
        Parameters:
        urnString - The full unparsed original URN string.
        nss - The NSS part of the string (before request/query/fragment).
        req - The decoded request String (without "?+"), null for none.
        query - The decoded query String (without "?="), null for none.
        fragment - The decoded fragment, null for none.
        Returns:
        The URN instance.
        Throws:
        URNException - For URN exceptions.
        java.lang.IllegalArgumentException - If the "NSS" part of the string is not a valid type, followed by a valid ID.