Package com.iizix.urn
Enum URNResourceType
- java.lang.Object
- java.lang.Enum<URNResourceType>
- com.iizix.urn.URNResourceType
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<URNResourceType>
public enum URNResourceType extends java.lang.Enum<URNResourceType>
The types of URN Resource Type. All file sizes except external files are limited to 2 GB or 2,147,483,648 bytes.
Enum Constant Summary
Enum Constants Enum Constant Description APP_SESSION
Application session file, removed when an application session is stopped, or when the server is stopped or restarted.APPLICATION_DATABASE_PERSISTENT
Application file, persisted in the server database.APPLICATION_PERSISTENT
Application file, removed when an application is added or removed.APPLICATION_VOLATILE
Application file.CLIENT_SESSION
Client session files for a user, removed when the client session is stopped.COMMON_DATABASE_PERSISTENT
Common server files for everyone, persisted in the server database.COMMON_PERSISTENT
Common server files for everyone.COMMON_VOLATILE
Common server files for everyone, removed when server starts or stops.EXTERNAL_FILES
External files, common for everyone, should be accessible by every server in a cluster.GROUP_DATABASE_FILES
User files, private for a user.USER_DATABASE_FILES
User files, private for a user.USER_FILES
User files, private for a user.
Field Summary
Fields Modifier and Type Field Description static java.util.List<URNResourceType>
ALL
List of all possible resource types.static int
COUNT
The count of URNResourceType's.java.lang.String
descr
The description.boolean
doDeleteFiles
Flag indicating files should be deleted upon server dispose.java.lang.String
externalStartPath
The external (web-facing) start path, {code null} for external files.java.lang.Class<?>
idClass
The ID class type if stored in the databaseString.class
,long.class
ornull
for none.java.lang.String
idColumn
The ID column name for database storage,null
if not used.java.lang.String
internalSubDirectory
The internal subdirectory name, can consists of several directories.boolean
isSubjectBased
Flag indicating the type is subject based and can have multiple instances.long
maxSize
Maximum file length when stored in a database, zero for none.java.lang.String
nss
The NSS part of the URN.URNLocation
storageLocation
Storage location.java.lang.String
tableName
The table name for database storage,null
if not using a database.
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static URNResourceType
fromExternalStartPath(java.lang.String path)
Looks up the WSFileType from an external path.static URNResourceType
fromNSS(java.lang.String nss)
Gets the NSS resource for the case sensitive string.static URNResourceType[]
getNonSubjectBased()
Gets the non-subject based file types.static URNResourceType[]
getSubjectBased()
Gets the subject based file types.java.lang.String
getUniqueDirectory()
Gets a unique number to use for the directory.static URNResourceType
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static URNResourceType[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
Enum Constant Detail
COMMON_DATABASE_PERSISTENT
public static final URNResourceType COMMON_DATABASE_PERSISTENT
Common server files for everyone, persisted in the server database. The files are cached on the server event when it starts or stops. Just a single instance is allowed.
COMMON_PERSISTENT
public static final URNResourceType COMMON_PERSISTENT
Common server files for everyone. The files and directories persists when server starts or stops. Just a single instance is allowed.
COMMON_VOLATILE
public static final URNResourceType COMMON_VOLATILE
Common server files for everyone, removed when server starts or stops. Just a single instance is allowed.
EXTERNAL_FILES
public static final URNResourceType EXTERNAL_FILES
External files, common for everyone, should be accessible by every server in a cluster. The database is backing up the external file entry for URN's.
APPLICATION_DATABASE_PERSISTENT
public static final URNResourceType APPLICATION_DATABASE_PERSISTENT
Application file, persisted in the server database. The administrator must purge the files.Subject based with "application ID" as subject.
APPLICATION_PERSISTENT
public static final URNResourceType APPLICATION_PERSISTENT
Application file, removed when an application is added or removed.Subject based with "application ID" as subject.
APPLICATION_VOLATILE
public static final URNResourceType APPLICATION_VOLATILE
Application file. The files and directories persists when an application is added or removed, or when server is starts or stops.Subject based with "application ID" as subject.
GROUP_DATABASE_FILES
public static final URNResourceType GROUP_DATABASE_FILES
User files, private for a user. Remains present until a group is removed. Typically used for group profile image, etc. The subject is a special unique name generated from the user ID that is a valid file name.
USER_FILES
public static final URNResourceType USER_FILES
User files, private for a user. Remains present until a user is removed. Typically used for user profile image, etc. The subject is a special unique name generated from the user ID that is a valid file name.
USER_DATABASE_FILES
public static final URNResourceType USER_DATABASE_FILES
User files, private for a user. Remains present until a user is removed. Typically used for user profile image, etc. The subject is a special unique name generated from the user ID that is a valid file name.
APP_SESSION
public static final URNResourceType APP_SESSION
Application session file, removed when an application session is stopped, or when the server is stopped or restarted. The subject is the session ID.
CLIENT_SESSION
public static final URNResourceType CLIENT_SESSION
Client session files for a user, removed when the client session is stopped. The subject is the appSession ID followed by "-" and the client session ID.
Field Detail
descr
public final java.lang.String descr
The description.
nss
public final java.lang.String nss
The NSS part of the URN.
isSubjectBased
public final boolean isSubjectBased
Flag indicating the type is subject based and can have multiple instances.
internalSubDirectory
public final java.lang.String internalSubDirectory
The internal subdirectory name, can consists of several directories.
externalStartPath
public final java.lang.String externalStartPath
The external (web-facing) start path, {code null} for external files.
doDeleteFiles
public final boolean doDeleteFiles
Flag indicating files should be deleted upon server dispose.
storageLocation
public final URNLocation storageLocation
Storage location.
tableName
public final java.lang.String tableName
The table name for database storage,null
if not using a database.
idColumn
public final java.lang.String idColumn
The ID column name for database storage,null
if not used.
idClass
public final java.lang.Class<?> idClass
The ID class type if stored in the databaseString.class
,long.class
ornull
for none.
maxSize
public final long maxSize
Maximum file length when stored in a database, zero for none.
COUNT
public static final int COUNT
The count of URNResourceType's.
ALL
public static final java.util.List<URNResourceType> ALL
List of all possible resource types.
Method Detail
values
public static URNResourceType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (URNResourceType c : URNResourceType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
valueOf
public static URNResourceType valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
getUniqueDirectory
public java.lang.String getUniqueDirectory()
Gets a unique number to use for the directory.- Returns:
- A string as
randomHexValue
.
getNonSubjectBased
public static URNResourceType[] getNonSubjectBased()
Gets the non-subject based file types.- Returns:
- The types COMMON_PERSISTENT and COMMON_VOLATILE. The return value is a cloned array.
getSubjectBased
public static URNResourceType[] getSubjectBased()
Gets the subject based file types.- Returns:
- The types APPLICATION_PERSISTENT, APPLICATION_VOLATILE, APP_SESSION, CLIENT_SESSION and USER_FILES. The return value is a cloned array.
fromExternalStartPath
public static URNResourceType fromExternalStartPath(java.lang.String path)
Looks up the WSFileType from an external path. The external path is always preceded with "/$$" and ends at the first '/' after this.- Parameters:
path
- The external path.- Returns:
- The file type found, or
null
for none.
fromNSS
public static URNResourceType fromNSS(java.lang.String nss)
Gets the NSS resource for the case sensitive string.- Parameters:
nss
- The NSS string.- Returns:
- The URN resource found, or
null
if not found.