Package com.iizix.urn.file
Class FileURNFactory
- java.lang.Object
- com.iizix.urn.file.FileURNFactory
- All Implemented Interfaces:
IFileURNProvider
,IURNProvider
public final class FileURNFactory extends java.lang.Object implements IFileURNProvider
The File URN provider depends on theURNResourceType
and anidentifier
, where theidentifier
is either aString
forURNResourceType
.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 thetype
identifier.- Author:
- Christopher Mindus
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static FileURNFactory
getInstance()
Gets the singleton instance of the File URN factory.NID
getNID()
Gets the Naming IDentifier of the provider.java.util.List<URNResourceType>
getResourceTypes()
Gets the URN Resource Type supported by the provider.static void
initialize(URNFactory factory, IFileURNProvider provider)
Initializes the File URN factory.FileURN
parse(java.lang.String urnString, java.lang.String nss, java.lang.String req, java.lang.String query, java.lang.String fragment)
Parses the URN after the NID specification, i.e.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.iizix.urn.IURNProvider
paramString0
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 interfaceIURNProvider
- Returns:
- The supported resource type, empty list when not resource based.
getNID
public NID getNID()
Gets the Naming IDentifier of the provider.- Specified by:
getNID
in interfaceIURNProvider
- Returns:
- The
NID.FILE
.
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 interfaceIURNProvider
- 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.