Package com.iizix.urn
Class URNResource
java.lang.Object
com.iizix.urn.URN
com.iizix.urn.URNResource
- Direct Known Subclasses:
- FileURN
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.
Resource URN's are encoded in IIZI as:
urn:nssPrefix:type:identifier
where the valid nssPrefix currently values are:
and types 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 (private) files,
- {@link URNResourceType#CLIENT_SESSION}:
 Client session (private) files.
The identifier is file identifier in the type identifier.
- Author:
- Christopher Mindus
- Field SummaryFieldsModifier and TypeFieldDescription- protected final ObjectThe resource ID depending on the type: Long or String.- protected final URNResourceTypeThe resource type.
- Constructor SummaryConstructorsModifierConstructorDescription- protected- URNResource- (String urnString, URNResourceType type, Object id) Constructs a URNResource from a string that has contains the media type followed by Base64 encoded data.
- Method SummaryModifier and TypeMethodDescription- final URNResourceGets this instance as- URNResourcetype.- booleanChecks if another URN is equal to this one.- final Object- getID()Returns the ID used for the resource.Gets the image target interface for this URN instance, if supported.Gets the parameter string for the- URN.toString()method.- final URNResourceType- getType()Gets the resource type.- getURL()Gets the URL of this resource relative the current web server.- int- hashCode()Gets the hash code of the instance.- booleanChecks if this instance supports returning the image target interface- {@link IImageTarget}.- final booleanChecks if this URN instance is a- URNResource.- Methods inherited from class com.iizix.urn.URN- from, getURNString, toString
- Field Details- typeThe resource type.
- idThe resource ID depending on the type: Long or String.
 
- Constructor Details- URNResourceConstructs a URNResource from a string that has contains the media type followed by Base64 encoded data.- Parameters:
- urnString- The URN string formatted the "IIZI" way.
- type- The URN resource type.
- id- An ID for the URN.
 
 
- Method Details- getTypeGets the resource type.- Returns:
- The resource type.
 
- getIDReturns the ID used for the resource.- Returns:
- The ID is of type Longfor ID's of a User ID, Group or a String for a User ID or Application ID.nullis returned when the URN resource is not related to either a user profile or an application.
 
- getURLGets the URL of this resource relative the current web server.- Specified by:
- getURLin class- URN
- Returns:
- The URL relative the current server, if based on the current server.
- Throws:
- IOException- If there was a problem retrieving the file or an SQL error.
 
- isURNResourcepublic final boolean isURNResource()Checks if this URN instance is a- URNResource.- Overrides:
- isURNResourcein class- URN
- Returns:
- Always trueas the instance is always aURNResourcetype.
 
- asURNResourceGets this instance as- URNResourcetype.- Overrides:
- asURNResourcein class- URN
- Returns:
- The URNResourceinstance, alwaysnon-null.
 
- isImageTargetSupportedpublic boolean isImageTargetSupported()Checks if this instance supports returning the image target interface- {@link IImageTarget}.- Overrides:
- isImageTargetSupportedin class- URN
- Returns:
- trueif the URN supports the image target interface,- false(default) otherwise.
 
- getImageTargetGets the image target interface for this URN instance, if supported.- Overrides:
- getImageTargetin class- URN
- Returns:
- The image target interface, or null(default) if not supported.
 
- hashCodepublic 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.
- equalsChecks 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.
- getParamStringGets the parameter string for the- URN.toString()method.- Specified by:
- getParamStringin class- URN
- Returns:
- The parameter string, always non-null.