Difference between revisions of "Configuration"

From BaseX Documentation
Jump to navigation Jump to search
m (Text replacement - "ub-director" to "ubdirector")
 
(89 intermediate revisions by 3 users not shown)
Line 1: Line 1:
==Home directory==
+
This page is part of the [[Getting Started]] Section. It gives some insight into the configuration of BaseX.
  
As BaseX is a portable application it searches for the perfect location of the home directory by itself.<br />
+
==Configuration Files==
There are three opportunities for the home directory:
 
*Users home directory: In standard case the users home directory is chosen to store the BaseX configuration and database files in it. So if you didn't change anything, all the BaseX files can be found in this location.
 
*Working directory: This directory is chosen if configuration files of BaseX are found in it. So move the configuration files to the working directory if you want to have it as home directory.
 
*Application directory:  This directory is chosen if configuration files of BaseX are found in the application directory. This is especially for people using the windows installer of BaseX.
 
  
==Database files==
+
BaseX maintains some configuration files, which are stored in the project’s [[#Home Directory|Home Directory]]:
  
A database in BaseX consists of several files, which are all bundled in a folder with the database name.<br />
+
* <code>.basex</code> contains all options that are relevant for running the server or standalone versions of BaseX.
All of these files are stored in a <code>BaseXData</code> directory in the home directory. <br />
+
* <code>.basexgui</code> defines all options relevant to the BaseX GUI.
The path can be changed in the following ways:
+
* <code>.basexhistory</code> contains commands that have been typed in most recently.
*[[GUI Tutorial|GUI]]: Go to Menu Options and change the entry <code>Database Path</code>
+
* An empty <code>.basexhome</code> file can be added to a directory to mark it as [[#Home Directory|home directory]].
*[[BaseX Server|Server]]: <code>set dbpath [PATH]</code>
 
*[[Standalone Tutorial|Standalone]]: <code>set dbpath [PATH]</code>
 
  
Note: After changing the database path, all afore created databases have to be manually moved to the new location.
+
Note that:
  
==Configuration files==
+
* Depending on your OS and configuration, files and folders with a '.' prefix may be hidden.
 +
* In the [[Web Application]] context, options can be defined in the <code>web.xml</code> file.
  
There are two configuration files for BaseX. These two configuration files <code>.basex</code> & <code>.basewin</code> are stored in the home directory.
+
==Home Directory==
  
==User and log files==
+
As BaseX is distributed in different flavors, and as it may be started from different locations, it dynamically determines its home directory:
The global users are stored in the <code>.basexperm</code> file in the home directory as the configuration files. Local users and permissions are stored in the meta data of the database, so they don't need an extra file. <br />
 
All log files are stored in text format in the home directory <code>BaseXData/.logs</code>.
 
  
[[Category: Internal]]
+
* First, the '''Java system property''' {{Code|org.basex.path}} is checked. If it contains a value, it is chosen as directory path.
 +
* If not, the '''current user directory''' (defined by the system property {{Code|user.dir}}) is selected if the {{Code|.basex}} or {{Code|.basexhome}} file is found in this directory.
 +
* If not, the '''application directory''' (the folder in which BaseX is located) is chosen if one of these two files is found in that directory.
 +
* In all other cases, a {{Code|basex}} subdirectory in the '''user home directory''' will be returned. The user home directory is retrieved via the {{Code|HOME}} environment variable, or (if unassigned) the Java system property {{Code|user.home}}.
 +
 
 +
If BaseX is used in an embedded environment (such as a servlet in a [[Web Application]]), it may not immediately be clear which directory was picked. You can run the XQuery expression <code>Q{java:org.basex.util.Prop}HOMEDIR()</code> to find out.
 +
 
 +
==Database Directory==
 +
 
 +
[[Databases]] consists of several binary files. These are located in a directory named by the name of the database. The database root directory is named {{Code|data}}.
 +
 
 +
The database path can be changed as follows:
 +
* GUI: Choose ''Options'' → ''Preferences'' and choose a new database path.
 +
* General: edit the {{Option|DBPATH}} option in the {{Code|.basex}} configuration file
 +
 
 +
'''Note:''' Existing databases will not automatically be moved to the new destination.
 +
 
 +
==Log Files==
 +
 
 +
Log files are stored in text format in a <code>.logs</code> subdirectory of the database folder (see [[Logging]] for more information).
 +
 
 +
=Changelog=
 +
 
 +
;Version 9.0
 +
 
 +
* Updated: Detection and configuration of home directory and subdirectories.
 +
 
 +
;Version 8.0
 +
 
 +
* Updated: {{Code|.basexperm}} is obsolete. Users are now stored in {{Code|users.xml}} in the database directory (see [[User Management]] for more information).
 +
 
 +
;Version 7.7
 +
 
 +
* Updated: The {{Code|.basexhome}} file marks a folder as [[#Home Directory|home directory]].

Latest revision as of 15:59, 25 July 2022

This page is part of the Getting Started Section. It gives some insight into the configuration of BaseX.

Configuration Files[edit]

BaseX maintains some configuration files, which are stored in the project’s Home Directory:

  • .basex contains all options that are relevant for running the server or standalone versions of BaseX.
  • .basexgui defines all options relevant to the BaseX GUI.
  • .basexhistory contains commands that have been typed in most recently.
  • An empty .basexhome file can be added to a directory to mark it as home directory.

Note that:

  • Depending on your OS and configuration, files and folders with a '.' prefix may be hidden.
  • In the Web Application context, options can be defined in the web.xml file.

Home Directory[edit]

As BaseX is distributed in different flavors, and as it may be started from different locations, it dynamically determines its home directory:

  • First, the Java system property org.basex.path is checked. If it contains a value, it is chosen as directory path.
  • If not, the current user directory (defined by the system property user.dir) is selected if the .basex or .basexhome file is found in this directory.
  • If not, the application directory (the folder in which BaseX is located) is chosen if one of these two files is found in that directory.
  • In all other cases, a basex subdirectory in the user home directory will be returned. The user home directory is retrieved via the HOME environment variable, or (if unassigned) the Java system property user.home.

If BaseX is used in an embedded environment (such as a servlet in a Web Application), it may not immediately be clear which directory was picked. You can run the XQuery expression Q{java:org.basex.util.Prop}HOMEDIR() to find out.

Database Directory[edit]

Databases consists of several binary files. These are located in a directory named by the name of the database. The database root directory is named data.

The database path can be changed as follows:

  • GUI: Choose OptionsPreferences and choose a new database path.
  • General: edit the DBPATH option in the .basex configuration file

Note: Existing databases will not automatically be moved to the new destination.

Log Files[edit]

Log files are stored in text format in a .logs subdirectory of the database folder (see Logging for more information).

Changelog[edit]

Version 9.0
  • Updated: Detection and configuration of home directory and subdirectories.
Version 8.0
  • Updated: .basexperm is obsolete. Users are now stored in users.xml in the database directory (see User Management for more information).
Version 7.7