public final class Application
extends java.lang.Object
SessionControl
objects used for
user authentication, etc.Modifier and Type | Class and Description |
---|---|
private static class |
Application.DbCleaner |
static class |
Application.Pinger
A
Pinger is an object that is used to protect another
object from timing out by automatically pinging it. |
private static class |
Application.SecondaryStorageControllerTask
Deprecated.
|
private static class |
Application.SessionControlCacheCleaner |
Modifier and Type | Field and Description |
---|---|
private static boolean |
autoUnloadPlugins
Allow automatic unload of plug-in JAR files or not.
|
private static java.lang.String |
databaseVersionNumber
The name and version of the database server
|
private static java.lang.String |
dynamicCatalog
The name of the dynamic database.
|
private static java.lang.String |
dynamicSchema
The name of the dynamic schema.
|
private static java.lang.String |
extendedPropertiesFile
The path to the file containing extended properties.
|
private static java.lang.String |
hostName
The host name of the server running BASE.
|
private static InternalJobQueue |
internalJobQueue
The internal job queue reference if it is enabled.
|
private static boolean |
isRunning
If BASE is running or not.
|
private static org.slf4j.Logger |
log
Log core events.
|
private static boolean |
noAutoCompression
If auto-compression has been enabled or not.
|
private static int |
permissionTimeout
Number of minutes permission information can be kept in
memory before it must be reloaded.
|
private static java.util.Set<Application.Pinger> |
pingers |
private static java.io.File |
pluginsDirectory
The one and only place where plug-ins can be installed.
|
private static java.lang.String |
queryFile
The path to the file containing predefined queries.
|
private static java.lang.String |
rawDataTypesFile
The path to the file containing raw data types.
|
private static Scheduler |
scheduler
An interface for adding timed task to the core timer.
|
private static int |
schemaVersion |
private static java.lang.String |
secondaryStorageDriver
The name of the secondary storage controller class, if any.
|
private static java.util.Map<java.lang.String,SessionControl> |
sessionCache
A cache of SessionControl objects.
|
private static int |
sessionCacheTimeout
Number of minutes a SessionControl object can be unused before
it is removed from the cache.
|
private static StaticCache |
staticCache
Cache for static data.
|
private static java.util.Timer |
timer
The core timer which schedules events.
|
private static java.lang.String |
title
The title of the server.
|
private static java.io.File |
userFilesDirectory
The directory where uploaded files are stored.
|
private static ExtensionsManager |
xtManager
Manager for the extensions system.
|
Constructor and Description |
---|
Application() |
Modifier and Type | Method and Description |
---|---|
static boolean |
autoCompressionEnabled()
Check if auto-compression has been enabled or not.
|
(package private) static boolean |
autoUnloadPlugins()
If external plug-in JAR files should automatically be unloaded if the are modified.
|
private static void |
cleanSessionControlCache(boolean force)
Clean the cache from unused
SessionControl objects. |
static java.lang.String |
generateRandomId(int bytes)
Generate a random id.
|
static int |
getBuild()
Get the build number.
|
(package private) static java.util.Timer |
getCoreTimer() |
static java.lang.String |
getDatabaseVersionString()
Gets the version of the database server
|
(package private) static java.lang.String |
getDynamicCatalog()
Get the name of the dynamic catalog.
|
(package private) static java.lang.String |
getDynamicSchema()
Get the name of the dynamic schema.
|
(package private) static java.util.List<java.lang.String> |
getExtendedPropertyFiles()
Get the path to the XML file containing extended properties.
|
static ExtensionsManager |
getExtensionsManager() |
static java.lang.String |
getHostName()
Get the host name of the server running BASE.
|
(package private) static org.slf4j.Logger |
getLogger()
Get the BASE core logger.
|
static int |
getMaintenanceVersion()
Get the maintenance version.
|
static int |
getMajorVersion()
Get the major version.
|
static int |
getMinorVersion()
Get the minor version.
|
static java.io.File |
getPluginsDirectory()
Get the directory where plug-ins and extensions must be installed.
|
(package private) static java.lang.String |
getQueryFile()
Get the path to the XML file containing predefined
queries for SQL and HQL.
|
(package private) static java.util.List<java.lang.String> |
getRawDataTypeFiles()
Get the path to the XML file containing raw data type definitions.
|
static Scheduler |
getScheduler()
Get a scheduler that can be used for registering
TimerTask
for executions. |
static int |
getSchemaVersion()
Get the current database schema version number.
|
(package private) static SecondaryStorageController |
getSecondaryStorageController()
Deprecated.
In 3.14, no replacement
|
static SessionControl |
getSessionControl(java.lang.String sessionControlId,
java.lang.String remoteId)
Deprecated.
In 3.9, use
getSessionControl(String, String, String, boolean) instead |
static SessionControl |
getSessionControl(java.lang.String sessionControlId,
java.lang.String externalClientId,
java.lang.String remoteId,
boolean checkLoggedIn)
Get an existing
SessionControl object if you know
the id. |
static StaticCache |
getStaticCache()
Get the static cache mananger.
|
static java.lang.String |
getTitle()
Get the "display title" of this server.
|
static java.io.File |
getUserFilesDirectory()
Get the path to the directory where uploaded
files are stored.
|
static java.lang.String |
getVersionString()
Get the BASE version string.
|
java.lang.String |
getVersionSuffix()
Get the version suffix (eg.
|
static boolean |
hasSecondaryStorage()
Deprecated.
In 3.14, no replacement
|
static boolean |
isRunning()
Check if BASE is running.
|
static Application.Pinger |
newPinger(SessionControl sc)
Create a new
Pinger object that is used
to keep a session control alive. |
(package private) static PluginSessionControl |
newPluginSessionControl(SessionControl parent,
PluginDefinition plugin,
Job job)
Create a new session control for executing plugins.
|
static SessionControl |
newSessionControl(java.lang.String externalClientId,
java.lang.String remoteId,
java.lang.String sessionControlId)
Create a new
SessionControl object. |
static int |
permissionTimeout()
Get the maximum number of minutes permission information for
a logged in user is kept in memory before beeing reloaded.
|
static int |
sessionCacheTimeout()
Gets the maximum number of minutes before an active session
is logged out.
|
static void |
start()
Starts the BASE application.
|
static void |
start(boolean useInternalJobQueue)
Starts the BASE application.
|
(package private) static void |
start(boolean installation,
boolean verifySchemaVersion,
java.lang.Boolean useInternalJobQueue)
Starts the BASE application.
|
static void |
stop()
Stops the BASE application.
|
private static void |
stopPinger(Application.Pinger p) |
private static final org.slf4j.Logger log
private static boolean isRunning
private static java.lang.String secondaryStorageDriver
private static java.util.Map<java.lang.String,SessionControl> sessionCache
private static int sessionCacheTimeout
private static volatile java.util.Timer timer
private static volatile Scheduler scheduler
private static int permissionTimeout
private static java.io.File userFilesDirectory
private static java.io.File pluginsDirectory
private static StaticCache staticCache
private static java.lang.String queryFile
private static java.lang.String extendedPropertiesFile
private static java.lang.String rawDataTypesFile
private static java.lang.String dynamicCatalog
private static java.lang.String dynamicSchema
private static boolean autoUnloadPlugins
private static java.lang.String hostName
private static java.lang.String title
private static InternalJobQueue internalJobQueue
private static java.lang.String databaseVersionNumber
private static boolean noAutoCompression
private static ExtensionsManager xtManager
private static int schemaVersion
private static java.util.Set<Application.Pinger> pingers
public static int getMajorVersion()
public static int getMinorVersion()
public static int getMaintenanceVersion()
public static int getBuild()
public java.lang.String getVersionSuffix()
public static java.lang.String getVersionString()
public static int getSchemaVersion()
static org.slf4j.Logger getLogger()
public static java.lang.String getHostName()
public static java.lang.String getTitle()
public static java.lang.String getDatabaseVersionString()
public static boolean isRunning()
public static void start() throws BaseException
BaseException
- If BASE cannot be startedstop()
,
isRunning()
public static void start(boolean useInternalJobQueue)
useInternalJobQueue
- If the internal job queue should be
enabled or notBaseException
- If BASE cannot be startedstart()
,
stop()
,
isRunning()
static void start(boolean installation, boolean verifySchemaVersion, java.lang.Boolean useInternalJobQueue) throws BaseException
installation
- TRUE if we are starting the application for
installation, FALSE for a normal startBaseException
- If BASE cannot be startedstart()
public static void stop() throws BaseException
BaseException
- If BASE cannot be stoppedstart()
,
isRunning()
public static ExtensionsManager getExtensionsManager()
public static int permissionTimeout()
public static int sessionCacheTimeout()
@Deprecated public static boolean hasSecondaryStorage()
File.setLocation(Location)
@Deprecated static SecondaryStorageController getSecondaryStorageController()
SecondaryStorageController
object, or null ifBaseException
- If the controller class could not be loadedhasSecondaryStorage()
public static java.io.File getUserFilesDirectory()
public static StaticCache getStaticCache()
static java.lang.String getQueryFile()
PredefinedQuery
static java.util.List<java.lang.String> getExtendedPropertyFiles()
ExtendedProperties
static java.util.List<java.lang.String> getRawDataTypeFiles()
RawDataTypes
static java.lang.String getDynamicCatalog()
static java.lang.String getDynamicSchema()
static boolean autoUnloadPlugins()
public static java.io.File getPluginsDirectory()
public static boolean autoCompressionEnabled()
File.setMimeTypeAuto(String, ItemSubtype)
and will automaically be compressed if auto-compression is enabled and
the MimeType.getAutoCompress()
returns TRUE.public static SessionControl newSessionControl(java.lang.String externalClientId, java.lang.String remoteId, java.lang.String sessionControlId) throws BaseException
SessionControl
object. If BASE is not
running it will be started.externalClientId
- The external id for a registered client
application, or null if not importantremoteId
- An optional parameter identifying the remote
computer, for example the IP number. This should make it harder
to hijack a login by guessing a sessionControlId
.sessionControlId
- The id to give the new SessionControl
object, or null to generate a new idItemNotFoundException
- If no client with the specified
external id existsItemAlreadyExistsException
- If another SessionControl
with the given id already existsBaseException
- If there is another errorSessionControl.getId()
static PluginSessionControl newPluginSessionControl(SessionControl parent, PluginDefinition plugin, Job job)
parent
- The parent session controlplugin
- The plugin to executejob
- The job that executes the plug-in, or nullpublic static SessionControl getSessionControl(java.lang.String sessionControlId, java.lang.String externalClientId, java.lang.String remoteId, boolean checkLoggedIn) throws ItemNotFoundException, BaseException
SessionControl
object if you know
the id.sessionControlId
- The id of the SessionControl
objectexternalClientId
- The external id for a registered client
application, or null if not importantremoteId
- If this parameter was passed to the newSessionControl
method, the same value must be passed here. Use, for example, the IP address
of the client computer. This should make it harder to hijack a login
by guessing a sessionControlId
checkLoggedIn
- TRUE to check if a user is logged in, FALSE to not checkSessionControl
objectItemNotFoundException
- If an object with the specified id could not be foundPermissionDeniedException
- If the remote or external client id is different from the
remote/external client id that was passed when the SessionControl
object
was createdNotLoggedInException
- If a user is not logged in when a check was requestedBaseException
- If there is another errornewSessionControl(String,String,String)
,
SessionControl.getId()
@Deprecated public static SessionControl getSessionControl(java.lang.String sessionControlId, java.lang.String remoteId) throws ItemNotFoundException, BaseException
getSessionControl(String, String, String, boolean)
insteadSessionControl
object if you know
the id.
NOTE! For maximum backwards compatibility calling this method
is equivalent to using "net.sf.basedb.clients.web" as the
external client id and not checking if a user is logged in.
Existing applications that use a different id MUST be updated to
use the new method or they may no longer work in BASE 3.9.ItemNotFoundException
BaseException
private static void cleanSessionControlCache(boolean force)
SessionControl
objects.force
- If TRUE all objects will be removed from the cache
regardless of if they are in use or notpublic static java.lang.String generateRandomId(int bytes)
bytes
- The number of bytes of the idstatic java.util.Timer getCoreTimer()
public static Scheduler getScheduler()
TimerTask
for executions. Each task that is added to the scheduler is executed in
it's own thread.public static Application.Pinger newPinger(SessionControl sc)
Pinger
object that is used
to keep a session control alive.sc
- The SessionControl that the pinger should protectprivate static void stopPinger(Application.Pinger p)