Package com.iizix.server.wsfile
Class WSFileProviderEngine
java.lang.Object
com.iizix.server.wsfile.WSFileProviderEngine
- All Implemented Interfaces:
IWSFileProviderServer
Engine to handle file providing for external web server files, typically images and other client resources that are fetched from the web server.
The file contexts are:
- Server session,
- Per application (and version),
- Per user (all sessions),
- Per application session (on user basis),
- Per client session.
The server places these files in subdirectories in the file provider directory configured for the server (default "wsfiles" in ServerSettings.DEFAULT_FILE_PROVIDER_ROOT
).
- Author:
- Christopher Mindus
- See Also:
WSFile
URNResourceType
Constructor Summary
ConstructorDescriptionWSFileProviderEngine
(ServerSettings serverSettings) Constructs a new engine.WSFileProviderEngine
(File wsFileRootDir) Constructs a new engine for the iiziGo Designer First-Time-Start dialog to assign a profile image.Method Summary
Modifier and TypeMethodDescriptionvoid
dispose()
Disposes of the engine and all the providers.getCreateFileProvider
(URNResourceType type, String descr, String subject, Object id, boolean doPersistFileNames, ServerSettings settings) Gets or creates a new engine type file provider.getFileResourceFromExternalURL
(String target) Gets the file resource for an external URL that starts with "/".
Constructor Details
WSFileProviderEngine
Constructs a new engine. This constructor is intended to be used by the IIZI framework and not instantiated elsewhere.- Parameters:
serverSettings
- The server settings.- Throws:
IOException
- If the root directory for the files cannot be created.
WSFileProviderEngine
Constructs a new engine for the iiziGo Designer First-Time-Start dialog to assign a profile image. This constructor is intended to be used by the IIZI framework and not instantiated elsewhere.- Parameters:
wsFileRootDir
- The web server provider files root directory.- Throws:
IOException
- If the root directory does not exist.
Method Details
getCreateFileProvider
public WSFileProvider getCreateFileProvider(URNResourceType type, String descr, String subject, Object id, boolean doPersistFileNames, ServerSettings settings) throws IOException Gets or creates a new engine type file provider. Depending on the engine type, just one may be created for a particular subject.- Parameters:
type
- The engine type.descr
- The description used for logging (ignored for single WSFileType's)subject
- The subject when multiple file providers is supported,null
(or ignored) for single types.id
- The ID used when storing in a database: a Long or String value, Long for User ID, Group ID, String for Application IDdoPersistFileNames
- Flag to use the real file name for client caching purposes. Otherwise a unique file name is always generated.settings
- The server settings.- Returns:
- The file provider.
- Throws:
IOException
- If the sub-directory for the file provider type cannot be created.NullPointerException
- If thesubject
orid
is required but isnull
.IllegalArgumentException
- If theid
is required but of wrong class type (Long or String).IllegalStateException
- If the engine is disposed of.
getFileResourceFromExternalURL
Gets the file resource for an external URL that starts with "/".- Specified by:
getFileResourceFromExternalURL
in interfaceIWSFileProviderServer
- Parameters:
target
- The target request.- Returns:
- The file target, or null if it is not found.
dispose
public void dispose()Disposes of the engine and all the providers.