This section covers the details of the BASE file system.
DirectoryData class holds
information about directories. Directories are organised in the
ususal way as as tree structure. All directories must have
a parent directory, except the system-defined root directory.
FileData class holds information about
a file. The actual file contents is stored on disk in the directory
specified by the
userfiles setting in
property is the name of the file on disk, but this is never exposed to
client applications. The filenames and directories
on the disk doesn't correspond to the the filenames and directories in
url property is used for file items which are stored in
an external location. In this case there is no local file data on the
location property can take three values:
0 = The file is offline, ie. there is no file on the disk
1 = The file is in primary storage, ie. it is located on the disk and can be used by BASE
3 = The file is an external file whose location is referenced by the
url property. If the file is protected by passwords
or certificates the file item may reference a
object. Note that an external file in most cases can be used by client
applications/plug-ins as if the file was stored locally on the BASE
md5 property can be used to check for file
corruption when a user re-uploads a file that has been offline.
BASE can store files in a compressed format. This is handled internally
and is not visible to client applications. The
compressedSize properties are used to store information
about this. A file may always be compressed if the users says so, but
BASE can also do this automatically if the file is uploaded
to a directory with the
autoCompress flag set
or if the file has MIME type with the
holds information about an external file server. If the
isn't set BASE automatically selects a factory based on the URL of the file. There is
built-in support for HTTP and HTTPS, but it is possible to install extensions for
support for other protocols. The
host property can be set
to override the host part of the URL from the file. See Section 27.8.8, “Connection managers” for more
information about connection managers.
password properties are used if
the server requires the user to be logged in. BASE has built-in support for Basic and
Digest authentication. The
serverCertificate can be used with HTTPS
servers that uses a non-trusted certificate to tell BASE to trust the server anyway.
In most cases, this is only needed if the server uses a self-signed certificate, but could, for
example, also be used if a trusted site has forgot to renew an expired certificate.
The server certificate should be an X.509 certificate in either binary or text format.
properties are used for servers that require that users present a valid client
certificate before they are allowed access. The client certificate is usually issued
by the server operator and must be in PKCS #12 format.
MimeTypeData is used to register mime types and
map them to file extensions. The information is only used to lookup values
when needed. Given the filename we can set the
File.fileType properties. The MIME type is also
used to decide if a file should be stored in a compressed format or not.
The extension of a MIME type must be unique. Extensions should be registered
without a dot, ie html, not .html.